From 07fb6328d083d57e612dbb6d9bda82c75f256946 Mon Sep 17 00:00:00 2001 From: BalakB Date: Thu, 21 Jan 2021 18:25:03 -0500 Subject: [PATCH 1/3] Create new v4 client and add Tenant API to it and remove the same from v3 client --- README.rst | 188 +++++++++++------------ ecsclient/client.py | 4 +- ecsclient/v3/client.py | 1 - ecsclient/v3/multitenancy/__init__.py | 2 - ecsclient/v4/__init__.py | 0 ecsclient/v4/cas/__init__.py | 0 ecsclient/v4/cas/cas.py | 25 +++ ecsclient/v4/client.py | 81 ++++++++++ ecsclient/v4/configuration/__init__.py | 6 + ecsclient/v4/configuration/snmp.py | 175 +++++++++++++++++++++ ecsclient/v4/configuration/syslog.py | 119 ++++++++++++++ ecsclient/v4/geo_replication/__init__.py | 4 + ecsclient/v4/metering/__init__.py | 3 + ecsclient/v4/monitoring/__init__.py | 6 + ecsclient/v4/multitenancy/__init__.py | 5 + ecsclient/v4/other/__init__.py | 3 + ecsclient/v4/provisioning/__init__.py | 8 + ecsclient/v4/provisioning/node.py | 20 +++ ecsclient/v4/support/__init__.py | 0 ecsclient/v4/user_management/__init__.py | 8 + tests/functional/test_tenant.py | 1 - 21 files changed, 560 insertions(+), 99 deletions(-) create mode 100644 ecsclient/v4/__init__.py create mode 100644 ecsclient/v4/cas/__init__.py create mode 100644 ecsclient/v4/cas/cas.py create mode 100644 ecsclient/v4/client.py create mode 100644 ecsclient/v4/configuration/__init__.py create mode 100644 ecsclient/v4/configuration/snmp.py create mode 100644 ecsclient/v4/configuration/syslog.py create mode 100644 ecsclient/v4/geo_replication/__init__.py create mode 100644 ecsclient/v4/metering/__init__.py create mode 100644 ecsclient/v4/monitoring/__init__.py create mode 100644 ecsclient/v4/multitenancy/__init__.py create mode 100644 ecsclient/v4/other/__init__.py create mode 100644 ecsclient/v4/provisioning/__init__.py create mode 100644 ecsclient/v4/provisioning/node.py create mode 100644 ecsclient/v4/support/__init__.py create mode 100644 ecsclient/v4/user_management/__init__.py diff --git a/README.rst b/README.rst index 46b860a..1676ad5 100644 --- a/README.rst +++ b/README.rst @@ -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 | +-----------------------+------------+------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------+ @@ -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:** diff --git a/ecsclient/client.py b/ecsclient/client.py index 3a3a893..694317f 100644 --- a/ecsclient/client.py +++ b/ecsclient/client.py @@ -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): diff --git a/ecsclient/v3/client.py b/ecsclient/v3/client.py index 9dbfd10..e0a82fb 100644 --- a/ecsclient/v3/client.py +++ b/ecsclient/v3/client.py @@ -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 diff --git a/ecsclient/v3/multitenancy/__init__.py b/ecsclient/v3/multitenancy/__init__.py index 70f0868..bd47c4c 100644 --- a/ecsclient/v3/multitenancy/__init__.py +++ b/ecsclient/v3/multitenancy/__init__.py @@ -1,5 +1,3 @@ from ecsclient.common.multitenancy import namespace -from ecsclient.common.multitenancy import tenant namespace = namespace -tenant = tenant diff --git a/ecsclient/v4/__init__.py b/ecsclient/v4/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ecsclient/v4/cas/__init__.py b/ecsclient/v4/cas/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ecsclient/v4/cas/cas.py b/ecsclient/v4/cas/cas.py new file mode 100644 index 0000000..e1ff96e --- /dev/null +++ b/ecsclient/v4/cas/cas.py @@ -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)) diff --git a/ecsclient/v4/client.py b/ecsclient/v4/client.py new file mode 100644 index 0000000..ea51951 --- /dev/null +++ b/ecsclient/v4/client.py @@ -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) diff --git a/ecsclient/v4/configuration/__init__.py b/ecsclient/v4/configuration/__init__.py new file mode 100644 index 0000000..8686404 --- /dev/null +++ b/ecsclient/v4/configuration/__init__.py @@ -0,0 +1,6 @@ +from ecsclient.common.configuration import certificate, configuration_properties, licensing, feature + +certificate = certificate +configuration_properties = configuration_properties +licensing = licensing +feature = feature diff --git a/ecsclient/v4/configuration/snmp.py b/ecsclient/v4/configuration/snmp.py new file mode 100644 index 0000000..dfdcfb0 --- /dev/null +++ b/ecsclient/v4/configuration/snmp.py @@ -0,0 +1,175 @@ +import logging + +log = logging.getLogger(__name__) + + +class Snmp(object): + def __init__(self, connection): + """ + Initialize a new instance + """ + self.conn = connection + + def get_snmp_agent(self): + """ + Get SNMP Agent configuration including targets. + + Required role(s): + + SYSTEM_ADMIN + SYSTEM_MONITOR + + Example JSON result from the API: + """ + # TODO: Add example JSON response + log.info("Fetching SNMP Agent configuration") + return self.conn.get('vdc/snmp/config') + + def update_snmp_agent(self, engine_id): + """ + Sets SNMP agent configuration + + Required role(s): + + SYSTEM_ADMIN + + There is no response body for this call + + Expect: HTTP/1.1 200 OK + + :param engine_id: Fully qualified domain name or IP and port + """ + payload = { + "engineID": engine_id + } + log.info("Setting SNMP agent configuration with Engine ID '{}'".format(engine_id)) + return self.conn.put('vdc/snmp/config', json_payload=payload) + + def get_snmp_target(self, target_id): + """ + Get SNMP target info. + + Required role(s): + + SYSTEM_ADMIN + SYSTEM_MONITOR + + Example JSON result from the API: + {} + + :param target_id: SNMP target ID + """ + # TODO: Add example JSON response + log.info("Getting SNMP target information with ID '{}'".format(target_id)) + return self.conn.get('vdc/snmp/config/target/{}'.format(target_id)) + + def create_snmp_target(self, server, port, version, community, username, auth_protocol, + auth_passphrase, privacy_protocol, privacy_passphrase): + """ + Adds SNMP Target. + + Required role(s): + + SYSTEM_ADMIN + + Example JSON result from the API: + {} + + Expect: HTTP/1.1 200 OK + + :param server: Fully qualified domain name or IP + :param port: SNMP port + :param version: SNMP version ('V2' or 'V3') + :param community: Community name (only needed when version is 'V2') + :param username: Username for authentication + :param auth_protocol: Authentication protocol ('MD5' or 'SHA') + :param auth_passphrase: Authentication passphrase + :param privacy_protocol: Encryption protocol ('DES' or 'AES') + :param privacy_passphrase: Encryption passphrase + """ + # TODO: Add example JSON response + + payload = { + "server": server, + "port": port, + "version": version, + "community": community, + "user_security_model": { + "username": username, + "authentication": { + "protocol": auth_protocol, + "passphrase": auth_passphrase + }, + "privacy": { + "protocol": privacy_protocol, + "passphrase": privacy_passphrase + } + } + } + + log.info("Creating SNMP target") + return self.conn.post('vdc/snmp/config/target', json_payload=payload) + + def update_snmp_target(self, target_id, server, port, version, community, username, + auth_protocol, auth_passphrase, privacy_protocol, + privacy_passphrase): + """ + Adds SNMP Target. + + Required role(s): + + SYSTEM_ADMIN + + There is no response body for this call + + Expect: HTTP/1.1 200 OK + + :param server: Fully qualified domain name or IP + :param port: SNMP port + :param version: SNMP version ('V2' or 'V3') + :param community: Community name (only needed when version is 'V2') + :param username: Username for authentication + :param auth_protocol: Authentication protocol ('MD5' or 'SHA') + :param auth_passphrase: Authentication passphrase + :param privacy_protocol: Encryption protocol ('DES' or 'AES') + :param privacy_passphrase: Encryption passphrase + """ + + payload = { + "server": server, + "port": port, + "version": version, + "community": community, + "user_security_model": { + "username": username, + "authentication": { + "protocol": auth_protocol, + "passphrase": auth_passphrase + }, + "privacy": { + "protocol": privacy_protocol, + "passphrase": privacy_passphrase + } + } + } + + log.info("Updating SNMP target with ID '{}'".format(target_id)) + return self.conn.put('vdc/snmp/config/target/{}'.format(target_id), + json_payload=payload) + + def delete_snmp_target(self, target_id): + """ + Delete specified SNMP target. + + Required role(s): + + SYSTEM_ADMIN + + There is no response body for this call + + Expect: HTTP/1.1 200 OK + + :param target_id: SNMP target ID + """ + log.info("Deleting SNMP target with ID '{}'".format(target_id)) + return self.conn.delete('vdc/snmp/config/target/{}'.format(target_id)) diff --git a/ecsclient/v4/configuration/syslog.py b/ecsclient/v4/configuration/syslog.py new file mode 100644 index 0000000..345a9c7 --- /dev/null +++ b/ecsclient/v4/configuration/syslog.py @@ -0,0 +1,119 @@ +import logging + +log = logging.getLogger(__name__) + + +class Syslog(object): + def __init__(self, connection): + """ + Initialize a new instance + """ + self.conn = connection + + def get_syslog_servers(self): + """ + Get list of Syslog Server info. + + Required role(s): + + SYSTEM_ADMIN + SYSTEM_MONITOR + + Example JSON result from the API: + """ + # TODO: Add example JSON response + log.info("Fetching syslog servers") + return self.conn.get('vdc/syslog/config') + + def get_syslog_server(self, syslog_id): + """ + Get Syslog Server info. + + Required role(s): + + SYSTEM_ADMIN + SYSTEM_MONITOR + + Example JSON result from the API: + {} + + :param syslog_id: Syslog server ID + """ + # TODO: Add example JSON response + log.info("Getting syslog server information with ID '{}'".format(syslog_id)) + return self.conn.get('vdc/syslog/config/{}'.format(syslog_id)) + + def create_syslog_server(self, server, port, protocol, severity): + """ + Creates a Syslog server. + + Required role(s): + + SYSTEM_ADMIN + + Example JSON result from the API: + {} + + :param server: Fully qualified domain name or IP + :param port: Syslog port + :param protocol: Protocol Syslog protocol UDP/TCP + :param severity: Severity - minimal syslog message severity for this server + """ + # TODO: Add example JSON response + + payload = { + "server": server, + "port": port, + "protocol": protocol, + "severity": severity + } + + log.info("Creating syslog server") + return self.conn.post('vdc/syslog/config', json_payload=payload) + + def update_syslog_server(self, syslog_id, server, port, protocol, severity): + """ + Update specified Syslog Server. + + Required role(s): + + SYSTEM_ADMIN + SYSTEM_MONITOR + + There is no response body for this call + + Expect: HTTP/1.1 200 OK + + :param syslog_id: Syslog server ID + :param server: Fully qualified domain name or IP + :param port: Syslog port + :param protocol: Protocol Syslog protocol UDP/TCP + :param severity: Severity - minimal syslog message severity for this server + """ + + payload = { + "server": server, + "port": port, + "protocol": protocol, + "severity": severity + } + log.info("Updating syslog server with ID '{}'".format(syslog_id)) + return self.conn.put('vdc/syslog/config/{}'.format(syslog_id), json_payload=payload) + + def delete_syslog_server(self, syslog_id): + """ + Delete specified Syslog Server. + + Required role(s): + + SYSTEM_ADMIN + SYSTEM_MONITOR + + There is no response body for this call + + Expect: HTTP/1.1 200 OK + + :param syslog_id: Syslog server ID + """ + log.info("Deleting syslog server with ID '{}'".format(syslog_id)) + return self.conn.delete('vdc/syslog/config/{}'.format(syslog_id)) diff --git a/ecsclient/v4/geo_replication/__init__.py b/ecsclient/v4/geo_replication/__init__.py new file mode 100644 index 0000000..ee4ed05 --- /dev/null +++ b/ecsclient/v4/geo_replication/__init__.py @@ -0,0 +1,4 @@ +from ecsclient.common.geo_replication import replication_group, temporary_failed_zone + +replication_group = replication_group +temporary_failed_zone = temporary_failed_zone diff --git a/ecsclient/v4/metering/__init__.py b/ecsclient/v4/metering/__init__.py new file mode 100644 index 0000000..a5eacaf --- /dev/null +++ b/ecsclient/v4/metering/__init__.py @@ -0,0 +1,3 @@ +from ecsclient.common.metering import billing + +billing = billing diff --git a/ecsclient/v4/monitoring/__init__.py b/ecsclient/v4/monitoring/__init__.py new file mode 100644 index 0000000..4c7e028 --- /dev/null +++ b/ecsclient/v4/monitoring/__init__.py @@ -0,0 +1,6 @@ +from ecsclient.common.monitoring import capacity, dashboard, events, alerts + +capacity = capacity +dashboard = dashboard +events = events +alerts = alerts diff --git a/ecsclient/v4/multitenancy/__init__.py b/ecsclient/v4/multitenancy/__init__.py new file mode 100644 index 0000000..70f0868 --- /dev/null +++ b/ecsclient/v4/multitenancy/__init__.py @@ -0,0 +1,5 @@ +from ecsclient.common.multitenancy import namespace +from ecsclient.common.multitenancy import tenant + +namespace = namespace +tenant = tenant diff --git a/ecsclient/v4/other/__init__.py b/ecsclient/v4/other/__init__.py new file mode 100644 index 0000000..7919102 --- /dev/null +++ b/ecsclient/v4/other/__init__.py @@ -0,0 +1,3 @@ +from ecsclient.common.other import user_info + +user_info = user_info diff --git a/ecsclient/v4/provisioning/__init__.py b/ecsclient/v4/provisioning/__init__.py new file mode 100644 index 0000000..28772ff --- /dev/null +++ b/ecsclient/v4/provisioning/__init__.py @@ -0,0 +1,8 @@ +from ecsclient.common.provisioning import base_url, bucket, data_store, storage_pool, virtual_data_center, vdc_keystore + +base_url = base_url +bucket = bucket +data_store = data_store +storage_pool = storage_pool +virtual_data_center = virtual_data_center +vdc_keystore = vdc_keystore diff --git a/ecsclient/v4/provisioning/node.py b/ecsclient/v4/provisioning/node.py new file mode 100644 index 0000000..6230cdf --- /dev/null +++ b/ecsclient/v4/provisioning/node.py @@ -0,0 +1,20 @@ +import logging + +from ecsclient.common.provisioning.node import Node + +log = logging.getLogger(__name__) + + +class Node(Node): + + def get_vdc_lock_status(self): + raise NotImplementedError() + + def set_vdc_lock_status(self): + raise NotImplementedError() + + def get_node_lock_status(self): + raise NotImplementedError() + + def set_node_lock_status(self): + raise NotImplementedError() diff --git a/ecsclient/v4/support/__init__.py b/ecsclient/v4/support/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ecsclient/v4/user_management/__init__.py b/ecsclient/v4/user_management/__init__.py new file mode 100644 index 0000000..1074a66 --- /dev/null +++ b/ecsclient/v4/user_management/__init__.py @@ -0,0 +1,8 @@ +from ecsclient.common.user_management import authentication_provider, secret_key, \ + password_group, management_user, object_user + +authentication_provider = authentication_provider +secret_key = secret_key +password_group = password_group +management_user = management_user +object_user = object_user diff --git a/tests/functional/test_tenant.py b/tests/functional/test_tenant.py index 8b90cd3..6d33cce 100644 --- a/tests/functional/test_tenant.py +++ b/tests/functional/test_tenant.py @@ -32,7 +32,6 @@ def __init__(self, *args, **kwargs): def setUp(self): super(TestTenant, self).setUp() - self.create_account() if self.skip_tests: self.skipTest('SKIPPING FUNCTIONAL TESTS DUE TO NO CONFIG') self.client.tenant.create(self.tenant) From f5c7c57ba513e10b99d060037a4fd68b2c59c58e Mon Sep 17 00:00:00 2001 From: BalakB Date: Fri, 22 Jan 2021 17:19:12 -0500 Subject: [PATCH 2/3] Remove tenant reference in v3 client and add simple unit test for v4 client --- ecsclient/v3/client.py | 1 - tests/unit/test_ecsclient.py | 10 +++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ecsclient/v3/client.py b/ecsclient/v3/client.py index e0a82fb..83df773 100644 --- a/ecsclient/v3/client.py +++ b/ecsclient/v3/client.py @@ -52,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) diff --git a/tests/unit/test_ecsclient.py b/tests/unit/test_ecsclient.py index d24ad9c..dc687e1 100644 --- a/tests/unit/test_ecsclient.py +++ b/tests/unit/test_ecsclient.py @@ -3,7 +3,7 @@ import mock from ecsclient import baseclient -from ecsclient import v2, v3 +from ecsclient import v2, v3, v4 from ecsclient.client import Client from ecsclient.common.exceptions import ECSClientException @@ -77,6 +77,14 @@ def test_client_without_credentials(self): exception = error.exception.message self.assertEqual("'token_endpoint' provided but missing ('username','password')", str(exception)) + def test_client_v4_class(self): + c = Client(version='4', + username='user', + password='password', + ecs_endpoint='https://192.168.1.10', + token_endpoint='https://192.168.10/login') + self.assertIsInstance(c, v4.client.Client, 'Instance is not a v4 client class') + def test_client_v3_class(self): c = Client(version='3', username='user', From 56cbb4098574e2f3821ffd07a1beafbefaf14017 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Mon, 25 Jan 2021 09:37:47 -0600 Subject: [PATCH 3/3] Update VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index cd88f16..2b15d5e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.1.12-rc3 +1.1.12-rc4