From 484e47e4a8a51e2b0d59f4350dcc57eef99e8068 Mon Sep 17 00:00:00 2001 From: NaoShark <49853899+NaoShark@users.noreply.github.com> Date: Wed, 16 Jun 2021 09:27:12 +0900 Subject: [PATCH] Drop MVNA day2 functions (#82) --- ecl/mvna/v1/_proxy.py | 180 +++++++++++++++++++++------------- ecl/mvna/v1/health_monitor.py | 13 ++- ecl/mvna/v1/load_balancer.py | 19 +++- ecl/mvna/v1/plan.py | 15 ++- ecl/mvna/v1/policy.py | 20 ++-- 5 files changed, 161 insertions(+), 86 deletions(-) diff --git a/ecl/mvna/v1/_proxy.py b/ecl/mvna/v1/_proxy.py index 8dcd26c..04a107a 100644 --- a/ecl/mvna/v1/_proxy.py +++ b/ecl/mvna/v1/_proxy.py @@ -20,9 +20,11 @@ def load_balancers(self, **params): return list(self._list(_load_balancer.LoadBalancer, paginated=False, **params)) + # NOTE(NaoShark): :param syslog_servers: will be available from Day 2. def create_load_balancer(self, plan_id, interfaces, name=None, description=None, tags=None, - syslog_servers=None): + # syslog_servers=None + ): """Create Managed Load Balancer. :param string plan_id: Plan ID of Managed Load Balancer @@ -30,7 +32,7 @@ def create_load_balancer(self, plan_id, interfaces, :param string name: Name of Managed Load Balancer :param string description: Description of Managed Load Balancer :param dict tags: Tags of Managed Load Balancer - :param list syslog_servers: Syslog Servers of Managed Load Balancer + # :param list syslog_servers: Syslog Servers of Managed Load Balancer :return: Managed Load Balancer """ body = {"plan_id": plan_id, "interfaces": interfaces} @@ -40,8 +42,8 @@ def create_load_balancer(self, plan_id, interfaces, body["description"] = description if tags: body["tags"] = tags - if syslog_servers: - body["syslog_servers"] = syslog_servers + # if syslog_servers: + # body["syslog_servers"] = syslog_servers return self._create(_load_balancer.LoadBalancer, **body) def get_load_balancer(self, load_balancer_id, changes=None): @@ -105,20 +107,21 @@ def action_load_balancer(self, load_balancer_id, x_mvna_request_id=None, load_balancer.action(self.session, load_balancer_id, x_mvna_request_id, **body) + # NOTE(NaoShark): :param syslog_servers: will be available from Day 2. def create_staged_load_balancer_configuration(self, load_balancer_id, - syslog_servers=None, + # syslog_servers=None, interfaces=None): """Create Staged Managed Load Balancer Configuration. :param string load_balancer_id: ID of Managed Load Balancer - :param list syslog_servers: Syslog Servers of Managed Load Balancer + # :param list syslog_servers: Syslog Servers of Managed Load Balancer :param list interfaces: Interface of Managed Load Balancer :return: Managed Load Balancer """ body = {} - if syslog_servers: - body["syslog_servers"] = syslog_servers + # if syslog_servers: + # body["syslog_servers"] = syslog_servers if interfaces: body["interfaces"] = interfaces @@ -135,20 +138,21 @@ def get_staged_load_balancer_configuration(self, load_balancer_id): """ return self._get(_load_balancer.LoadBalancer, load_balancer_id) + # NOTE(NaoShark): :param syslog_servers: will be available from Day 2. def update_staged_load_balancer_configuration(self, load_balancer_id, - syslog_servers=None, + # syslog_servers=None, interfaces=None): """Update Staged Managed Load Balancer Configuration. :param string load_balancer_id: ID of Managed Load Balancer - :param list syslog_servers: Syslog Servers of Managed Load Balancer + # :param list syslog_servers: Syslog Servers of Managed Load Balancer :param list interfaces: Interface of Managed Load Balancer :return: Managed Load Balancer """ body = {} - if syslog_servers: - body["syslog_servers"] = syslog_servers + # if syslog_servers: + # body["syslog_servers"] = syslog_servers if interfaces: body["interfaces"] = interfaces @@ -290,6 +294,10 @@ def cancel_staged_target_group_configuration(self, target_group_id): target_group = _target_group.TargetGroup() target_group.cancel_staged_configuration(self.session, target_group_id) + # NOTE(NaoShark): The following features will be available from Day 2 + # (certificates, create_certificate, get_certificate, update_certificate, + # delete_certificate, upload_certificate) + ''' def certificates(self, **params): """List Certificates.""" return list(self._list( @@ -366,6 +374,7 @@ def upload_certificate(self, body = {'type': certificate_type, 'file': certificate_file} certificate = _certificate.Certificate() certificate.upload(self.session, certificate_id, **body) + ''' def listeners(self, **params): """List Listeners.""" @@ -506,6 +515,9 @@ def cancel_staged_listener_configuration(self, listener_id): listener = _listener.Listener() listener.cancel_staged_configuration(self.session, listener_id) + # NOTE(NaoShark): The following features will be available from Day 2 + # (maintenances, get_maintenance) + ''' def maintenances(self, **params): """List Maintenances.""" return list(self._list( @@ -518,6 +530,7 @@ def get_maintenance(self, maintenance_id): :return: Maintenance """ return self._get(_maintenance.Maintenance, maintenance_id) + ''' def plans(self, **params): """List Plans.""" @@ -536,10 +549,13 @@ def health_monitors(self, **params): return list(self._list( _health_monitor.HealthMonitor, paginated=False, **params)) + # NOTE(NaoShark): :param path: and :param http_status_code: will be + # available from Day 2. def create_health_monitor(self, port, protocol, load_balancer_id, name=None, description=None, tags=None, interval=None, retry=None, timeout=None, - path=None, http_status_code=None): + # path=None, http_status_code=None + ): """Create Health Monitor. :param string port: Port of Health Monitor @@ -551,8 +567,8 @@ def create_health_monitor(self, port, protocol, load_balancer_id, :param int interval: Interval of Health Monitor :param int retry: Retry count of Health Monitor :param int timeout: Timeout of Health Monitor - :param string path: Path of Health Monitor - :param string http_status_code: HTTP Status code of Health Monitor + # :param string path: Path of Health Monitor + # :param string http_status_code: HTTP Status code of Health Monitor :return: Health Monitor """ @@ -573,10 +589,10 @@ def create_health_monitor(self, port, protocol, load_balancer_id, body["retry"] = retry if timeout: body["timeout"] = timeout - if path: - body["path"] = path - if http_status_code: - body["http_status_code"] = http_status_code + # if path: + # body["path"] = path + # if http_status_code: + # body["http_status_code"] = http_status_code return self._create(_health_monitor.HealthMonitor, **body) def get_health_monitor(self, health_monitor_id, changes=None): @@ -624,10 +640,14 @@ def delete_health_monitor(self, health_monitor_id, ignore_missing=False): self._delete(_health_monitor.HealthMonitor, health_monitor_id, ignore_missing=ignore_missing) + # NOTE(NaoShark): :param path: and :param http_status_code: will be + # available from Day 2. def create_staged_health_monitor_configuration( self, health_monitor_id, port=None, protocol=None, interval=None, retry=None, - timeout=None, path=None, http_status_code=None): + timeout=None, + # path=None, http_status_code=None + ): """Create Staged Health Monitor Configuration. :param string health_monitor_id: ID of Health Monitor @@ -636,8 +656,8 @@ def create_staged_health_monitor_configuration( :param int interval: Interval of Health Monitor :param int retry: Retry count of Health Monitor :param int timeout: Timeout of Health Monitor - :param string path: Path of Health Monitor - :param string http_status_code: HTTP Status code of Health Monitor + # :param string path: Path of Health Monitor + # :param string http_status_code: HTTP Status code of Health Monitor :return: Health Monitor """ body = {} @@ -651,10 +671,10 @@ def create_staged_health_monitor_configuration( body["retry"] = retry if timeout: body["timeout"] = timeout - if path: - body["path"] = path - if http_status_code: - body["http_status_code"] = http_status_code + # if path: + # body["path"] = path + # if http_status_code: + # body["http_status_code"] = http_status_code health_monitor = _health_monitor.HealthMonitor() return health_monitor.create_staged_configuration(self.session, @@ -669,10 +689,14 @@ def get_staged_health_monitor_configuration(self, health_monitor_id): """ return self._get(_health_monitor.HealthMonitor, health_monitor_id) + # NOTE(NaoShark): :param path: and :param http_status_code: will be + # available from Day 2. def update_staged_health_monitor_configuration( self, health_monitor_id, port=None, protocol=None, interval=None, retry=None, - timeout=None, path=None, http_status_code=None): + timeout=None, + # path=None, http_status_code=None + ): """Update Staged Health Monitor Configuration. :param string health_monitor_id: ID of Health Monitor @@ -681,8 +705,8 @@ def update_staged_health_monitor_configuration( :param int interval: Interval of Health Monitor :param int retry: Retry count of Health Monitor :param int timeout: Timeout of Health Monitor - :param string path: Path of Health Monitor - :param string http_status_code: HTTP Status code of Health Monitor + # :param string path: Path of Health Monitor + # :param string http_status_code: HTTP Status code of Health Monitor :return: Health Monitor """ body = {} @@ -696,10 +720,10 @@ def update_staged_health_monitor_configuration( body["retry"] = retry if timeout: body["timeout"] = timeout - if path: - body["path"] = path - if http_status_code: - body["http_status_code"] = http_status_code + # if path: + # body["path"] = path + # if http_status_code: + # body["http_status_code"] = http_status_code health_monitor = _health_monitor.HealthMonitor() return health_monitor.update_staged_configuration(self.session, @@ -720,11 +744,15 @@ def policies(self, **params): """List Policies.""" return list(self._list(_policy.Policy, paginated=False, **params)) + # NOTE(NaoShark): :param sorry_page_url: and :param certificate_id: and + # :param tls_security_policy_id: will be available from Day 2. def create_policy(self, health_monitor_id, listener_id, default_target_group_id, load_balancer_id, name=None, description=None, tags=None, algorithm=None, - persistence=None, sorry_page_url=None, - certificate_id=None, tls_security_policy_id=None): + persistence=None, + # sorry_page_url=None, certificate_id=None, + # tls_security_policy_id=None + ): """Create Policy. :param string health_monitor_id: Health Monitor ID of Policy @@ -736,9 +764,9 @@ def create_policy(self, health_monitor_id, listener_id, :param dict tags: Tags of Policy :param string algorithm: Algorithm of Policy :param string persistence: Persistence of Policy - :param string sorry_page_url: Sorry page URL - :param string certificate_id: Certificate ID - :param string tls_security_policy_id: TLS Security Policy ID + # :param string sorry_page_url: Sorry page URL + # :param string certificate_id: Certificate ID + # :param string tls_security_policy_id: TLS Security Policy ID :return: Policy """ body = { @@ -757,12 +785,12 @@ def create_policy(self, health_monitor_id, listener_id, body["algorithm"] = algorithm if persistence: body["persistence"] = persistence - if sorry_page_url: - body["sorry_page_url"] = sorry_page_url - if certificate_id: - body["certificate_id"] = certificate_id - if tls_security_policy_id: - body["tls_security_policy_id"] = tls_security_policy_id + # if sorry_page_url: + # body["sorry_page_url"] = sorry_page_url + # if certificate_id: + # body["certificate_id"] = certificate_id + # if tls_security_policy_id: + # body["tls_security_policy_id"] = tls_security_policy_id return self._create(_policy.Policy, **body) def get_policy(self, policy_id, changes=None): @@ -806,25 +834,28 @@ def delete_policy(self, policy_id, ignore_missing=False): """ self._delete(_policy.Policy, policy_id, ignore_missing=ignore_missing) + # NOTE(NaoShark): :param sorry_page_url: and :param certificate_id: and + # :param tls_security_policy_id: will be available from Day 2. def create_staged_policy_configuration(self, policy_id, algorithm=None, persistence=None, - sorry_page_url=None, - certificate_id=None, + # sorry_page_url=None, + # certificate_id=None, health_monitor_id=None, listener_id=None, default_target_group_id=None, - tls_security_policy_id=None): + # tls_security_policy_id=None + ): """Create Staged Policy Configuration. :param string policy_id: ID of Policy :param string algorithm: Algorithm of Policy :param string persistence: Persistence of Policy - :param string sorry_page_url: Sorry page URL - :param string certificate_id: Certificate ID + # :param string sorry_page_url: Sorry page URL + # :param string certificate_id: Certificate ID :param string health_monitor_id: Health Monitor ID of Policy :param string listener_id: Listener ID of Policy :param string default_target_group_id: Default Target Group ID - :param string tls_security_policy_id: TLS Security Policy ID + # :param string tls_security_policy_id: TLS Security Policy ID :return: Policy """ body = {} @@ -832,18 +863,18 @@ def create_staged_policy_configuration(self, policy_id, body["algorithm"] = algorithm if persistence: body["persistence"] = persistence - if sorry_page_url: - body["sorry_page_url"] = sorry_page_url - if certificate_id: - body["certificate_id"] = certificate_id + # if sorry_page_url: + # body["sorry_page_url"] = sorry_page_url + # if certificate_id: + # body["certificate_id"] = certificate_id if health_monitor_id: body["health_monitor_id"] = health_monitor_id if listener_id: body["listener_id"] = listener_id if default_target_group_id: body["default_target_group_id"] = default_target_group_id - if tls_security_policy_id: - body["tls_security_policy_id"] = tls_security_policy_id + # if tls_security_policy_id: + # body["tls_security_policy_id"] = tls_security_policy_id policy = _policy.Policy() return policy.create_staged_configuration(self.session, @@ -857,25 +888,28 @@ def get_staged_policy_configuration(self, policy_id): """ return self._get(_policy.Policy, policy_id) + # NOTE(NaoShark): :param sorry_page_url: and :param certificate_id: and + # :param tls_security_policy_id: will be available from Day 2. def update_staged_policy_configuration(self, policy_id, algorithm=None, persistence=None, - sorry_page_url=None, - certificate_id=None, + # sorry_page_url=None, + # certificate_id=None, health_monitor_id=None, listener_id=None, default_target_group_id=None, - tls_security_policy_id=None): + # tls_security_policy_id=None + ): """Update Staged Policy Configuration. :param string policy_id: ID of Policy :param string algorithm: Algorithm of Policy :param string persistence: Persistence of Policy - :param string sorry_page_url: Sorry page URL - :param string certificate_id: Certificate ID + # :param string sorry_page_url: Sorry page URL + # :param string certificate_id: Certificate ID :param string health_monitor_id: Health Monitor ID of Policy :param string listener_id: Listener ID of Policy :param string default_target_group_id: Default Target Group ID - :param string tls_security_policy_id: TLS Security Policy ID + # :param string tls_security_policy_id: TLS Security Policy ID :return: Policy """ body = {} @@ -883,18 +917,18 @@ def update_staged_policy_configuration(self, policy_id, body["algorithm"] = algorithm if persistence: body["persistence"] = persistence - if sorry_page_url: - body["sorry_page_url"] = sorry_page_url - if certificate_id: - body["certificate_id"] = certificate_id + # if sorry_page_url: + # body["sorry_page_url"] = sorry_page_url + # if certificate_id: + # body["certificate_id"] = certificate_id if health_monitor_id: body["health_monitor_id"] = health_monitor_id if listener_id: body["listener_id"] = listener_id if default_target_group_id: body["default_target_group_id"] = default_target_group_id - if tls_security_policy_id: - body["tls_security_policy_id"] = tls_security_policy_id + # if tls_security_policy_id: + # body["tls_security_policy_id"] = tls_security_policy_id policy = _policy.Policy() return policy.update_staged_configuration(self.session, @@ -1031,6 +1065,11 @@ def cancel_staged_route_configuration(self, route_id): route = _route.Route() route.cancel_staged_configuration(self.session, route_id) + # NOTE(NaoShark): The following features will be available from Day 2 + # (rules, create_rule, get_rule, update_rule, delete_rule, + # create_staged_rule_configuration, get_staged_rule_configuration, + # update_staged_rule_configuration, cancel_staged_rule_configuration) + ''' def rules(self, **params): """List Rules.""" return list(self._list(_rule.Rule, paginated=False, **params)) @@ -1163,6 +1202,7 @@ def cancel_staged_rule_configuration(self, rule_id): """ rule = _rule.Rule() rule.cancel_staged_configuration(self.session, rule_id) + ''' def operations(self, **params): """List operations.""" @@ -1177,6 +1217,9 @@ def get_operation(self, operation_id): """ return self._get(_operation.Operation, operation_id) + # NOTE(NaoShark): The following features will be available from Day 2 + # (tls_security_policies, get_tls_security_policy) + ''' def tls_security_policies(self, **params): """List TLS Security Policies.""" return list(self._list( @@ -1190,3 +1233,4 @@ def get_tls_security_policy(self, tls_security_policy_id): """ return self._get( _tls_security_policy.TLSSecurityPolicy, tls_security_policy_id) + ''' diff --git a/ecl/mvna/v1/health_monitor.py b/ecl/mvna/v1/health_monitor.py index 8e643af..5ec6e48 100644 --- a/ecl/mvna/v1/health_monitor.py +++ b/ecl/mvna/v1/health_monitor.py @@ -10,6 +10,8 @@ class HealthMonitor(base.MVNABaseResource): service = mvna_service.MVNAService("v1.0") base_path = '/' + service.version + '/health_monitors' + # NOTE(NaoShark): :param path: and :param http_status_code: will be + # available from Day 2. _query_mapping = base.MVNAQueryParameters( "id", "name", @@ -21,7 +23,8 @@ class HealthMonitor(base.MVNABaseResource): "interval", "retry", "timeout", - "path", + # "path", + # "http_status_code", "load_balancer_id", "tenant_id" ) @@ -57,10 +60,14 @@ class HealthMonitor(base.MVNABaseResource): retry = resource2.Body('retry') #: Timeout of health monitor timeout = resource2.Body('timeout') + + # NOTE(NaoShark): :param path: and :param http_status_code: will be + # available from Day 2. #: Path of health monitor - path = resource2.Body('path') + # path = resource2.Body('path') #: HTTP status code of health monitor - http_status_code = resource2.Body('http_status_code') + # http_status_code = resource2.Body('http_status_code') + #: Load balancer ID load_balancer_id = resource2.Body('load_balancer_id') #: Tenant ID of health monitor diff --git a/ecl/mvna/v1/load_balancer.py b/ecl/mvna/v1/load_balancer.py index 49c9e63..e5a2438 100644 --- a/ecl/mvna/v1/load_balancer.py +++ b/ecl/mvna/v1/load_balancer.py @@ -18,7 +18,9 @@ class LoadBalancer(base.MVNABaseResource): "configuration_status", "monitoring_status", "operation_status", - "availability_zone", + "primary_availability_zone", + "secondary_availability_zone", + "active_availability_zone", "revision", "plan_id", "tenant_id" @@ -47,16 +49,25 @@ class LoadBalancer(base.MVNABaseResource): monitoring_status = resource2.Body('monitoring_status') #: Operation status of load balancer operation_status = resource2.Body('operation_status') - #: Availability zones of load balancer - availability_zones = resource2.Body('availability_zones') + #: Primary availability zone of load balancer + primary_availability_zone = resource2.Body('primary_availability_zone') + #: Secondary availability zone of load balancer + secondary_availability_zone = resource2.Body('secondary_availability_zone') + #: Active availability zone of load balancer + active_availability_zone = resource2.Body('active_availability_zone') #: Revision of load balancer revision = resource2.Body('revision') #: Plan ID of load balancer plan_id = resource2.Body('plan_id') + #: Plan name of load balancer + plan_name = resource2.Body('plan_name') #: Tenant ID of load balancer tenant_id = resource2.Body('tenant_id') + + # NOTE(NaoShark): :param syslog_servers: will be available from Day 2. #: Syslog servers of load balancer - syslog_servers = resource2.Body('syslog_servers') + # syslog_servers = resource2.Body('syslog_servers') + #: Interfaces of load balancer interfaces = resource2.Body('interfaces') #: Current configuration of load balancer diff --git a/ecl/mvna/v1/plan.py b/ecl/mvna/v1/plan.py index 59ab5b2..34fac48 100644 --- a/ecl/mvna/v1/plan.py +++ b/ecl/mvna/v1/plan.py @@ -10,10 +10,13 @@ class Plan(resource2.Resource): service = mvna_service.MVNAService("v1.0") base_path = '/' + service.version + '/plans' + # NOTE(NaoShark): :param max_number_of_rules: and :param certificate_id: + # and :param max_number_of_conditions: will be available from Day 2. _query_mapping = base.MVNAQueryParameters( "id", "name", "description", + "bandwidth", "redundancy", "max_number_of_interfaces", "max_number_of_health_monitors", @@ -21,8 +24,8 @@ class Plan(resource2.Resource): "max_number_of_policies", "max_number_of_routes", "max_number_of_target_groups", - "max_number_of_rules", - "max_number_of_conditions", + # "max_number_of_rules", + # "max_number_of_conditions", "max_number_of_members", "enabled" ) @@ -59,10 +62,14 @@ class Plan(resource2.Resource): max_number_of_routes = resource2.Body('max_number_of_routes') #: Max number of target groups max_number_of_target_groups = resource2.Body('max_number_of_target_groups') + + # NOTE(NaoShark): :param max_number_of_rules: and :param certificate_id: + # and :param max_number_of_conditions: will be available from Day 2. #: Max number of rules - max_number_of_rules = resource2.Body('max_number_of_rules') + # max_number_of_rules = resource2.Body('max_number_of_rules') #: Max number of conditions - max_number_of_conditions = resource2.Body('max_number_of_conditions') + # max_number_of_conditions = resource2.Body('max_number_of_conditions') + #: Max number of members max_number_of_members = resource2.Body('max_number_of_members') #: Enabled or disabled diff --git a/ecl/mvna/v1/policy.py b/ecl/mvna/v1/policy.py index 2f44ddc..8eb6639 100644 --- a/ecl/mvna/v1/policy.py +++ b/ecl/mvna/v1/policy.py @@ -10,6 +10,8 @@ class Policy(base.MVNABaseResource): service = mvna_service.MVNAService("v1.0") base_path = '/' + service.version + '/policies' + # NOTE(NaoShark): :param sorry_page_url: and :param certificate_id: and + # :param tls_security_policy_id: will be available from Day 2. _query_mapping = base.MVNAQueryParameters( "id", "name", @@ -18,12 +20,12 @@ class Policy(base.MVNABaseResource): "operation_status", "algorithm", "persistence", - "sorry_page_url", - "certificate_id", + # "sorry_page_url", + # "certificate_id", "health_monitor_id", "listener_id", "default_target_group_id", - "tls_protocol", + # "tls_security_policy_id", "load_balancer_id", "tenant_id" ) @@ -53,18 +55,22 @@ class Policy(base.MVNABaseResource): algorithm = resource2.Body('algorithm') #: persistence of policy persistence = resource2.Body('persistence') + + # NOTE(NaoShark): :param sorry_page_url: and :param certificate_id: and + # :param tls_security_policy_id: will be available from Day 2. #: Sorry page URL of policy - sorry_page_url = resource2.Body('sorry_page_url') + # sorry_page_url = resource2.Body('sorry_page_url') #: Certificate ID of policy - certificate_id = resource2.Body('certificate_id') + # certificate_id = resource2.Body('certificate_id') + #: TLS security policy ID of policy + # tls_security_policy_id = resource2.Body('tls_security_policy_id') + #: Health monitor ID of policy health_monitor_id = resource2.Body('health_monitor_id') #: Listener ID of policy listener_id = resource2.Body('listener_id') #: Default target group ID of policy default_target_group_id = resource2.Body('default_target_group_id') - #: TLS security policy ID of policy - tls_security_policy_id = resource2.Body('tls_security_policy_id') #: Load balancer ID of policy load_balancer_id = resource2.Body('load_balancer_id') #: Tenant ID of policy