Skip to content

Commit

Permalink
Merge pull request #78 from lipak2345/bugfix-add-v4-client-api-with-t…
Browse files Browse the repository at this point in the history
…enant

Create new v4 client and add Tenant API to it and remove it from v3 client
  • Loading branch information
ben-schumacher authored Jan 25, 2021
2 parents d3f6149 + 56cbb40 commit 5e9e6ea
Show file tree
Hide file tree
Showing 23 changed files with 570 additions and 102 deletions.
188 changes: 94 additions & 94 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ arguments:
+-----------------------+------------+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
| Name | Required | Default Value | Description |
+=======================+============+========================+===============================================================================================================================================+
| ``version`` | Yes | None | Version of the target ECS system. Options are ``2`` and ``3`` |
| ``version`` | Yes | None | Version of the target ECS system. Options are ``2``, ``3`` and ``4`` |
+-----------------------+------------+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
| ``username`` | No | None | The username used to fetch the ECS token |
+-----------------------+------------+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+
Expand Down Expand Up @@ -142,99 +142,99 @@ Supported endpoints

The following table shows the supported endpoints per API version.

+--------------------------+---------+---------+
| | `v2`_ | `v3`_ |
+==========================+=========+=========+
| **Configuration** |
+--------------------------+---------+---------+
| Certificate |||
+--------------------------+---------+---------+
| Configuration Properties | ✓* | ✓* |
+--------------------------+---------+---------+
| Licensing |||
+--------------------------+---------+---------+
| Feature |||
+--------------------------+---------+---------+
| Syslog | | ✓* |
+--------------------------+---------+---------+
| Snmp | | ✓* |
+--------------------------+---------+---------+
| **CAS** |
+--------------------------+---------+---------+
| CAS User Profile | ✓* | ✓* |
+--------------------------+---------+---------+
| **File System Access** |
+--------------------------+---------+---------+
| NFS |||
+--------------------------+---------+---------+
| **Metering** |
+--------------------------+---------+---------+
| Billing | ~ | ~ |
+--------------------------+---------+---------+
| **Migration** |
+--------------------------+---------+---------+
| Transformation |||
+--------------------------+---------+---------+
| **Monitoring** |
+--------------------------+---------+---------+
| Capacity |||
+--------------------------+---------+---------+
| Dashboard | ✓* | ✓* |
+--------------------------+---------+---------+
| Events | ✓* | ✓* |
+--------------------------+---------+---------+
| Alerts | ✓* | ✓* |
+--------------------------+---------+---------+
| **Multi-tenancy** |
+--------------------------+---------+---------+
| Namespace | ✓* | ✓* |
+--------------------------+---------+---------+
| Tenant(Flex) || ✓* |
+--------------------------+---------+---------+
| **Geo-Replication** |
+--------------------------+---------+---------+
| Replication Group |||
+--------------------------+---------+---------+
| Temporary Failed Zone | ✓* | ✓* |
+--------------------------+---------+---------+
| **Provisioning** |
+--------------------------+---------+---------+
| Base URL | ✓* | ✓* |
+--------------------------+---------+---------+
| Bucket | ✓* ||
+--------------------------+---------+---------+
| Data Store | ✓* ||
+--------------------------+---------+---------+
| Node | ~ | ~ |
+--------------------------+---------+---------+
| Storage Pool |||
+--------------------------+---------+---------+
| Virtual Data Center |||
+--------------------------+---------+---------+
| VDC Keystore |||
+--------------------------+---------+---------+
| **Support** |
+--------------------------+---------+---------+
| Call Home |||
+--------------------------+---------+---------+
| **User Management** |
+--------------------------+---------+---------+
| Authentication Provider | ~ | ~ |
+--------------------------+---------+---------+
| Password Group (Swift) |||
+--------------------------+---------+---------+
| Secret Key |||
+--------------------------+---------+---------+
| Secret Key Self-Service |||
+--------------------------+---------+---------+
| User (Object) |||
+--------------------------+---------+---------+
| User (Management) | ✓* ||
+--------------------------+---------+---------+
| **Other** |
+--------------------------+---------+---------+
| Who am I |||
+--------------------------+---------+---------+
+--------------------------+---------+---------+---------+
| | `v2`_ | `v3`_ | `v4`_ |
+==========================+=========+=========+=========+
| **Configuration** |
+--------------------------+---------+---------+---------+
| Certificate ||||
+--------------------------+---------+---------+---------+
| Configuration Properties | ✓* | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| Licensing ||||
+--------------------------+---------+---------+---------+
| Feature ||||
+--------------------------+---------+---------+---------+
| Syslog | | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| Snmp | | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| **CAS** |
+--------------------------+---------+---------+---------+
| CAS User Profile | ✓* | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| **File System Access** |
+--------------------------+---------+---------+---------+
| NFS ||||
+--------------------------+---------+---------+---------+
| **Metering** |
+--------------------------+---------+---------+---------+
| Billing | ~ | ~ | ~ |
+--------------------------+---------+---------+---------+
| **Migration** |
+--------------------------+---------+---------+---------+
| Transformation ||||
+--------------------------+---------+---------+---------+
| **Monitoring** |
+--------------------------+---------+---------+---------+
| Capacity ||||
+--------------------------+---------+---------+---------+
| Dashboard | ✓* | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| Events | ✓* | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| Alerts | ✓* | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| **Multi-tenancy** |
+--------------------------+---------+---------+---------+
| Namespace | ✓* | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| Tenant(Flex) || | ✓* |
+--------------------------+---------+---------+---------+
| **Geo-Replication** |
+--------------------------+---------+---------+---------+
| Replication Group ||||
+--------------------------+---------+---------+---------+
| Temporary Failed Zone | ✓* | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| **Provisioning** |
+--------------------------+---------+---------+---------+
| Base URL | ✓* | ✓* | ✓* |
+--------------------------+---------+---------+---------+
| Bucket | ✓* |||
+--------------------------+---------+---------+---------+
| Data Store | ✓* |||
+--------------------------+---------+---------+---------+
| Node | ~ | ~ | ~ |
+--------------------------+---------+---------+---------+
| Storage Pool ||||
+--------------------------+---------+---------+---------+
| Virtual Data Center ||||
+--------------------------+---------+---------+---------+
| VDC Keystore ||||
+--------------------------+---------+---------+---------+
| **Support** |
+--------------------------+---------+---------+---------+
| Call Home ||||
+--------------------------+---------+---------+---------+
| **User Management** |
+--------------------------+---------+---------+---------+
| Authentication Provider | ~ | ~ | ~ |
+--------------------------+---------+---------+---------+
| Password Group (Swift) ||||
+--------------------------+---------+---------+---------+
| Secret Key ||||
+--------------------------+---------+---------+---------+
| Secret Key Self-Service ||||
+--------------------------+---------+---------+---------+
| User (Object) ||||
+--------------------------+---------+---------+---------+
| User (Management) | ✓* |||
+--------------------------+---------+---------+---------+
| **Other** |
+--------------------------+---------+---------+---------+
| Who am I ||||
+--------------------------+---------+---------+---------+

**Legend:**

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.12-rc3
1.1.12-rc4
4 changes: 3 additions & 1 deletion ecsclient/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

import ecsclient.v2.client as v2_client
import ecsclient.v3.client as v3_client
import ecsclient.v4.client as v4_client

_logger = logging.getLogger(__name__)

_CLIENT_VERSIONS = {'2': v2_client.Client,
'3': v3_client.Client}
'3': v3_client.Client,
'4': v4_client.Client}


def Client(version=None, *args, **kwargs):
Expand Down
2 changes: 0 additions & 2 deletions ecsclient/v3/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from ecsclient.v3.metering import billing
from ecsclient.v3.monitoring import capacity, dashboard, events, alerts
from ecsclient.v3.multitenancy import namespace
from ecsclient.v3.multitenancy import tenant
from ecsclient.v3.geo_replication import replication_group, temporary_failed_zone
from ecsclient.v3.provisioning import base_url, bucket, data_store, storage_pool, \
virtual_data_center, node, vdc_keystore
Expand Down Expand Up @@ -53,7 +52,6 @@ def __init__(self, *args, **kwargs):

# Multi-tenancy
self.namespace = namespace.Namespace(self)
self.tenant = tenant.Tenant(self)
# Geo-replication
self.replication_group = replication_group.ReplicationGroup(self)
self.temporary_failed_zone = temporary_failed_zone.TemporaryFailedZone(self)
Expand Down
2 changes: 0 additions & 2 deletions ecsclient/v3/multitenancy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from ecsclient.common.multitenancy import namespace
from ecsclient.common.multitenancy import tenant

namespace = namespace
tenant = tenant
Empty file added ecsclient/v4/__init__.py
Empty file.
Empty file added ecsclient/v4/cas/__init__.py
Empty file.
25 changes: 25 additions & 0 deletions ecsclient/v4/cas/cas.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from ecsclient.common.cas import cas
import logging

log = logging.getLogger(__name__)


class Cas(cas.Cas):

def update_cluster_id(self, cluster_id):
"""
Updates the cluster ID
Required role(s):
SYSTEM_ADMIN
NAMESPACE_ADMIN
There is no response body for this call
Expect: HTTP/1.1 200 OK
:param cluster_id: given cluster ID
"""
log.info("Updating cluster ID '{}'".format(cluster_id))
return self.conn.put('object/user-cas/cluster/{}'.format(cluster_id))
81 changes: 81 additions & 0 deletions ecsclient/v4/client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import logging

from ecsclient import baseclient
from ecsclient.v4.configuration import certificate, configuration_properties, \
licensing, feature, syslog, snmp
from ecsclient.v4.cas import cas
from ecsclient.v4.metering import billing
from ecsclient.v4.monitoring import capacity, dashboard, events, alerts
from ecsclient.v4.multitenancy import namespace
from ecsclient.v4.multitenancy import tenant
from ecsclient.v4.geo_replication import replication_group, temporary_failed_zone
from ecsclient.v4.provisioning import base_url, bucket, data_store, storage_pool, \
virtual_data_center, node, vdc_keystore
from ecsclient.v4.user_management import authentication_provider, management_user, \
object_user, secret_key, password_group
from ecsclient.v4.other import user_info

# Initialize logger
log = logging.getLogger(__name__)


class Client(baseclient.Client):
version = 'v4'

def __init__(self, *args, **kwargs):
super(Client, self).__init__(*args, **kwargs)

# Configuration
self.certificate = certificate.Certificate(self)
self.configuration_properties = configuration_properties.ConfigurationProperties(self)
self.licensing = licensing.Licensing(self)
self.feature = feature.Feature(self)
self.syslog = syslog.Syslog(self)
self.snmp = snmp.Snmp(self)

# CAS
self.cas = cas.Cas(self)

# File system access
# TODO: self.nfs = nfs.NFS(self)

# Metering
self.billing = billing.Billing(self)

# Migration
# TODO: self.transformation = transformation.Transformation(self)

# Monitoring
self.capacity = capacity.Capacity(self)
self.dashboard = dashboard.Dashboard(self)
self.events = events.Events(self)
self.alerts = alerts.Alerts(self)

# Multi-tenancy
self.namespace = namespace.Namespace(self)
self.tenant = tenant.Tenant(self)
# Geo-replication
self.replication_group = replication_group.ReplicationGroup(self)
self.temporary_failed_zone = temporary_failed_zone.TemporaryFailedZone(self)

# Provisioning
self.base_url = base_url.BaseUrl(self)
self.bucket = bucket.Bucket(self)
self.data_store = data_store.DataStore(self)
self.node = node.Node(self)
self.storage_pool = storage_pool.StoragePool(self)
self.vdc = virtual_data_center.VirtualDataCenter(self)
self.vdc_keystore = vdc_keystore.VdcKeystore(self)

# Support
# TODO: self.call_home = call_home.CallHome(self)

# User Management
self.authentication_provider = authentication_provider.AuthenticationProvider(self)
self.password_group = password_group.PasswordGroup(self)
self.secret_key = secret_key.SecretKey(self)
self.management_user = management_user.ManagementUser(self)
self.object_user = object_user.ObjectUser(self)

# Other
self.user_info = user_info.UserInfo(self)
6 changes: 6 additions & 0 deletions ecsclient/v4/configuration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from ecsclient.common.configuration import certificate, configuration_properties, licensing, feature

certificate = certificate
configuration_properties = configuration_properties
licensing = licensing
feature = feature
Loading

0 comments on commit 5e9e6ea

Please sign in to comment.