From be8cd9f8d4419ff97864e1fae96ddc674b1c3171 Mon Sep 17 00:00:00 2001 From: jkalandaibm Date: Thu, 12 Oct 2023 05:58:47 -0500 Subject: [PATCH] feat: Updating the list of reserved ASN numbers dependency: none --- .../transit_gateway_apis_v1.py | 3337 ++++++++++------- test/unit/test_transit_gateway_apis_v1.py | 2008 +++++----- 2 files changed, 3158 insertions(+), 2187 deletions(-) diff --git a/ibm_cloud_networking_services/transit_gateway_apis_v1.py b/ibm_cloud_networking_services/transit_gateway_apis_v1.py index de4a815..5f29f60 100644 --- a/ibm_cloud_networking_services/transit_gateway_apis_v1.py +++ b/ibm_cloud_networking_services/transit_gateway_apis_v1.py @@ -1,6 +1,6 @@ # coding: utf-8 -# (C) Copyright IBM Corp. 2022. +# (C) Copyright IBM Corp. 2023. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# IBM OpenAPI SDK Code Generator Version: 3.43.5-e0ec19e2-20220124-172004 +# IBM OpenAPI SDK Code Generator Version: 3.73.0-eeee85a9-20230607-165104 """ No description provided (generated by Openapi Generator @@ -47,10 +47,11 @@ class TransitGatewayApisV1(BaseService): DEFAULT_SERVICE_NAME = 'transit_gateway_apis' @classmethod - def new_instance(cls, - version: str, - service_name: str = DEFAULT_SERVICE_NAME, - ) -> 'TransitGatewayApisV1': + def new_instance( + cls, + version: str, + service_name: str = DEFAULT_SERVICE_NAME, + ) -> 'TransitGatewayApisV1': """ Return a new client for the Transit Gateway Apis service using the specified parameters and external configuration. @@ -66,14 +67,15 @@ def new_instance(cls, service = cls( version, authenticator - ) + ) service.configure_service(service_name) return service - def __init__(self, - version: str, - authenticator: Authenticator = None, - ) -> None: + def __init__( + self, + version: str, + authenticator: Authenticator = None, + ) -> None: """ Construct a new client for the Transit Gateway Apis service. @@ -88,21 +90,20 @@ def __init__(self, if version is None: raise ValueError('version must be provided') - BaseService.__init__(self, - service_url=self.DEFAULT_SERVICE_URL, - authenticator=authenticator) + BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) self.version = version ######################### # Transit Gateways ######################### - def list_transit_gateways(self, - *, - limit: int = None, - start: str = None, - **kwargs - ) -> DetailedResponse: + def list_transit_gateways( + self, + *, + limit: int = None, + start: str = None, + **kwargs, + ) -> DetailedResponse: """ Retrieves all Transit Gateways. @@ -118,38 +119,44 @@ def list_transit_gateways(self, """ headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_transit_gateways') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_transit_gateways', + ) headers.update(sdk_headers) params = { 'version': self.version, 'limit': limit, - 'start': start + 'start': start, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' url = '/transit_gateways' - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def create_transit_gateway(self, - location: str, - name: str, - *, - global_: bool = None, - resource_group: 'ResourceGroupIdentity' = None, - **kwargs - ) -> DetailedResponse: + def create_transit_gateway( + self, + location: str, + name: str, + *, + global_: bool = None, + resource_group: 'ResourceGroupIdentity' = None, + **kwargs, + ) -> DetailedResponse: """ Creates a Transit Gateway. @@ -175,20 +182,22 @@ def create_transit_gateway(self, if resource_group is not None: resource_group = convert_model(resource_group) headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='create_transit_gateway') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_transit_gateway', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } data = { 'location': location, 'name': name, 'global': global_, - 'resource_group': resource_group + 'resource_group': resource_group, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -196,22 +205,26 @@ def create_transit_gateway(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' url = '/transit_gateways' - request = self.prepare_request(method='POST', - url=url, - headers=headers, - params=params, - data=data) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + params=params, + data=data, + ) response = self.send(request, **kwargs) return response - def delete_transit_gateway(self, - id: str, - **kwargs - ) -> DetailedResponse: + def delete_transit_gateway( + self, + id: str, + **kwargs, + ) -> DetailedResponse: """ Deletes specified Transit Gateway. @@ -224,37 +237,43 @@ def delete_transit_gateway(self, :rtype: DetailedResponse """ - if id is None: + if not id: raise ValueError('id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='delete_transit_gateway') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_transit_gateway', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/transit_gateways/{id}'.format(**path_param_dict) - request = self.prepare_request(method='DELETE', - url=url, - headers=headers, - params=params) + request = self.prepare_request( + method='DELETE', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def get_transit_gateway(self, - id: str, - **kwargs - ) -> DetailedResponse: + def get_transit_gateway( + self, + id: str, + **kwargs, + ) -> DetailedResponse: """ Retrieves specified Transit Gateway. @@ -267,41 +286,47 @@ def get_transit_gateway(self, :rtype: DetailedResponse with `dict` result representing a `TransitGateway` object """ - if id is None: + if not id: raise ValueError('id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='get_transit_gateway') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_transit_gateway', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/transit_gateways/{id}'.format(**path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def update_transit_gateway(self, - id: str, - *, - global_: bool = None, - name: str = None, - **kwargs - ) -> DetailedResponse: + def update_transit_gateway( + self, + id: str, + *, + global_: bool = None, + name: str = None, + **kwargs, + ) -> DetailedResponse: """ Updates specified Transit Gateway. @@ -315,21 +340,23 @@ def update_transit_gateway(self, :rtype: DetailedResponse with `dict` result representing a `TransitGateway` object """ - if id is None: + if not id: raise ValueError('id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='update_transit_gateway') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_transit_gateway', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } data = { 'global': global_, - 'name': name + 'name': name, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -337,17 +364,20 @@ def update_transit_gateway(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/transit_gateways/{id}'.format(**path_param_dict) - request = self.prepare_request(method='PATCH', - url=url, - headers=headers, - params=params, - data=data) + request = self.prepare_request( + method='PATCH', + url=url, + headers=headers, + params=params, + data=data, + ) response = self.send(request, **kwargs) return response @@ -356,13 +386,14 @@ def update_transit_gateway(self, # Transit Connections ######################### - def list_connections(self, - *, - limit: int = None, - start: str = None, - network_id: str = None, - **kwargs - ) -> DetailedResponse: + def list_connections( + self, + *, + limit: int = None, + start: str = None, + network_id: str = None, + **kwargs, + ) -> DetailedResponse: """ Retrieves all connections. @@ -380,27 +411,32 @@ def list_connections(self, """ headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_connections') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_connections', + ) headers.update(sdk_headers) params = { 'version': self.version, 'limit': limit, 'start': start, - 'network_id': network_id + 'network_id': network_id, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' url = '/connections' - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response @@ -409,69 +445,87 @@ def list_connections(self, # Transit Gateways Network Connections ######################### - def list_transit_gateway_connections(self, - transit_gateway_id: str, - **kwargs - ) -> DetailedResponse: + def list_transit_gateway_connections( + self, + transit_gateway_id: str, + *, + start: str = None, + limit: int = None, + name: str = None, + **kwargs, + ) -> DetailedResponse: """ Retrieves all connections in a Transit Gateway. This request retrieves all connections in a Transit Gateway. :param str transit_gateway_id: The Transit Gateway identifier. + :param str start: (optional) A server supplied token determining which + resource to start the page on. + :param int limit: (optional) The maximum number of resources to return per + page. + :param str name: (optional) Search for connections with the given name. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `TransitGatewayConnectionCollection` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_transit_gateway_connections') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_transit_gateway_connections', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, + 'start': start, + 'limit': limit, + 'name': name, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id'] path_param_values = self.encode_path_vars(transit_gateway_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections'.format( - **path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/connections'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def create_transit_gateway_connection(self, - transit_gateway_id: str, - network_type: str, - *, - base_connection_id: str = None, - base_network_type: str = None, - local_gateway_ip: str = None, - local_tunnel_ip: str = None, - name: str = None, - network_account_id: str = None, - network_id: str = None, - prefix_filters: List['TransitGatewayConnectionPrefixFilter'] = None, - prefix_filters_default: str = None, - remote_bgp_asn: int = None, - remote_gateway_ip: str = None, - remote_tunnel_ip: str = None, - zone: 'ZoneIdentity' = None, - **kwargs - ) -> DetailedResponse: + def create_transit_gateway_connection( + self, + transit_gateway_id: str, + network_type: str, + *, + base_connection_id: str = None, + base_network_type: str = None, + local_gateway_ip: str = None, + local_tunnel_ip: str = None, + name: str = None, + network_account_id: str = None, + network_id: str = None, + prefix_filters: List['TransitGatewayConnectionPrefixFilter'] = None, + prefix_filters_default: str = None, + remote_bgp_asn: int = None, + remote_gateway_ip: str = None, + remote_tunnel_ip: str = None, + zone: 'ZoneIdentity' = None, + **kwargs, + ) -> DetailedResponse: """ Add connection to a Transit Gateway. @@ -481,10 +535,10 @@ def create_transit_gateway_connection(self, :param str network_type: Defines what type of network is connected via this connection. For access to gre_tunnel or unbound_gre_tunnel connections contact IBM support. - :param str base_connection_id: (optional) network_type 'gre_tunnel' - connections must be created over an existing network_type 'classic' - connection. This field must specify the ID of an active transit gateway - network_type 'classic' connection in the same transit gateway. + :param str base_connection_id: (optional) Deprecated: network_type + 'gre_tunnel' connections must be created over an existing network_type + 'classic' connection. This field must specify the ID of an active transit + gateway network_type 'classic' connection in the same transit gateway. This field is required for network type 'gre_tunnel' connections. This field is required to be unspecified for network type 'classic', 'directlink', 'vpc', 'power_virtual_server' and 'unbound_gre_tunnel' @@ -541,10 +595,10 @@ def create_transit_gateway_connection(self, unspecified for network type 'gre_tunnel' and 'unbound_gre_tunnel' connections. :param int remote_bgp_asn: (optional) Remote network BGP ASN. The following - ASN values are reserved and unavailable 64512-64513, 65100, 65201-65234, - 65402-65433, 65500 and 4201065000-4201065999. If 'remote_bgp_asn' is - omitted on gre_tunnel or unbound_gre_tunnel connection create requests IBM - will assign an ASN. + ASN values are reserved and unavailable 0, 13884, 36351, 64512-64513, + 65100, 65200-65234, 65402-65433, 65500 and 4201065000-4201065999. If + 'remote_bgp_asn' is omitted on gre_tunnel or unbound_gre_tunnel connection + create requests IBM will assign an ASN. This field is optional for network type 'gre_tunnel' and 'unbound_gre_tunnel' connections. This field is required to be unspecified for network type 'classic', @@ -572,7 +626,7 @@ def create_transit_gateway_connection(self, :rtype: DetailedResponse with `dict` result representing a `TransitGatewayConnectionCust` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') if network_type is None: raise ValueError('network_type must be provided') @@ -581,13 +635,15 @@ def create_transit_gateway_connection(self, if zone is not None: zone = convert_model(zone) headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='create_transit_gateway_connection') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_transit_gateway_connection', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } data = { @@ -604,7 +660,7 @@ def create_transit_gateway_connection(self, 'remote_bgp_asn': remote_bgp_asn, 'remote_gateway_ip': remote_gateway_ip, 'remote_tunnel_ip': remote_tunnel_ip, - 'zone': zone + 'zone': zone, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -612,27 +668,30 @@ def create_transit_gateway_connection(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id'] path_param_values = self.encode_path_vars(transit_gateway_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections'.format( - **path_param_dict) - request = self.prepare_request(method='POST', - url=url, - headers=headers, - params=params, - data=data) + url = '/transit_gateways/{transit_gateway_id}/connections'.format(**path_param_dict) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + params=params, + data=data, + ) response = self.send(request, **kwargs) return response - def delete_transit_gateway_connection(self, - transit_gateway_id: str, - id: str, - **kwargs - ) -> DetailedResponse: + def delete_transit_gateway_connection( + self, + transit_gateway_id: str, + id: str, + **kwargs, + ) -> DetailedResponse: """ Remove connection from Transit Gateway. @@ -647,41 +706,46 @@ def delete_transit_gateway_connection(self, :rtype: DetailedResponse """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='delete_transit_gateway_connection') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_transit_gateway_connection', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] path_param_keys = ['transit_gateway_id', 'id'] path_param_values = self.encode_path_vars(transit_gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}'.format( - **path_param_dict) - request = self.prepare_request(method='DELETE', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}'.format(**path_param_dict) + request = self.prepare_request( + method='DELETE', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def get_transit_gateway_connection(self, - transit_gateway_id: str, - id: str, - **kwargs - ) -> DetailedResponse: + def get_transit_gateway_connection( + self, + transit_gateway_id: str, + id: str, + **kwargs, + ) -> DetailedResponse: """ Retrieves specified Transit Gateway connection. @@ -694,45 +758,50 @@ def get_transit_gateway_connection(self, :rtype: DetailedResponse with `dict` result representing a `TransitGatewayConnectionCust` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='get_transit_gateway_connection') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_transit_gateway_connection', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id', 'id'] path_param_values = self.encode_path_vars(transit_gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}'.format( - **path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def update_transit_gateway_connection(self, - transit_gateway_id: str, - id: str, - *, - name: str = None, - prefix_filters_default: str = None, - **kwargs - ) -> DetailedResponse: + def update_transit_gateway_connection( + self, + transit_gateway_id: str, + id: str, + *, + name: str = None, + prefix_filters_default: str = None, + **kwargs, + ) -> DetailedResponse: """ Updates specified Transit Gateway connection. @@ -751,23 +820,25 @@ def update_transit_gateway_connection(self, :rtype: DetailedResponse with `dict` result representing a `TransitGatewayConnectionCust` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='update_transit_gateway_connection') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_transit_gateway_connection', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } data = { 'name': name, - 'prefix_filters_default': prefix_filters_default + 'prefix_filters_default': prefix_filters_default, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -775,28 +846,31 @@ def update_transit_gateway_connection(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id', 'id'] path_param_values = self.encode_path_vars(transit_gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}'.format( - **path_param_dict) - request = self.prepare_request(method='PATCH', - url=url, - headers=headers, - params=params, - data=data) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}'.format(**path_param_dict) + request = self.prepare_request( + method='PATCH', + url=url, + headers=headers, + params=params, + data=data, + ) response = self.send(request, **kwargs) return response - def create_transit_gateway_connection_actions(self, - transit_gateway_id: str, - id: str, - action: str, - **kwargs - ) -> DetailedResponse: + def create_transit_gateway_connection_actions( + self, + transit_gateway_id: str, + id: str, + action: str, + **kwargs, + ) -> DetailedResponse: """ Perform actions on a connection for a Transit Gateway. @@ -811,24 +885,26 @@ def create_transit_gateway_connection_actions(self, :rtype: DetailedResponse """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') if action is None: raise ValueError('action must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='create_transit_gateway_connection_actions') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_transit_gateway_connection_actions', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } data = { - 'action': action + 'action': action, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -836,17 +912,19 @@ def create_transit_gateway_connection_actions(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] path_param_keys = ['transit_gateway_id', 'id'] path_param_values = self.encode_path_vars(transit_gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}/actions'.format( - **path_param_dict) - request = self.prepare_request(method='POST', - url=url, - headers=headers, - params=params, - data=data) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}/actions'.format(**path_param_dict) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + params=params, + data=data, + ) response = self.send(request, **kwargs) return response @@ -855,9 +933,10 @@ def create_transit_gateway_connection_actions(self, # Transit Location ######################### - def list_gateway_locations(self, - **kwargs - ) -> DetailedResponse: + def list_gateway_locations( + self, + **kwargs, + ) -> DetailedResponse: """ List all locations that support Transit Gateways. @@ -869,32 +948,38 @@ def list_gateway_locations(self, """ headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_gateway_locations') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_gateway_locations', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' url = '/locations' - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def get_gateway_location(self, - name: str, - **kwargs - ) -> DetailedResponse: + def get_gateway_location( + self, + name: str, + **kwargs, + ) -> DetailedResponse: """ Show the details of a given Transit Gateway location. @@ -906,30 +991,35 @@ def get_gateway_location(self, :rtype: DetailedResponse with `dict` result representing a `TSLocation` object """ - if name is None: + if not name: raise ValueError('name must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='get_gateway_location') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_gateway_location', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['name'] path_param_values = self.encode_path_vars(name) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/locations/{name}'.format(**path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response @@ -938,11 +1028,12 @@ def get_gateway_location(self, # Transit Gateway Connection Prefix Filters ######################### - def list_transit_gateway_connection_prefix_filters(self, - transit_gateway_id: str, - id: str, - **kwargs - ) -> DetailedResponse: + def list_transit_gateway_connection_prefix_filters( + self, + transit_gateway_id: str, + id: str, + **kwargs, + ) -> DetailedResponse: """ Retrieves all prefix filters in a Transit Gateway connection. @@ -955,48 +1046,53 @@ def list_transit_gateway_connection_prefix_filters(self, :rtype: DetailedResponse with `dict` result representing a `PrefixFilterCollection` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_transit_gateway_connection_prefix_filters') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_transit_gateway_connection_prefix_filters', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id', 'id'] path_param_values = self.encode_path_vars(transit_gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters'.format( - **path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def create_transit_gateway_connection_prefix_filter(self, - transit_gateway_id: str, - id: str, - action: str, - prefix: str, - *, - before: str = None, - ge: int = None, - le: int = None, - **kwargs - ) -> DetailedResponse: + def create_transit_gateway_connection_prefix_filter( + self, + transit_gateway_id: str, + id: str, + action: str, + prefix: str, + *, + before: str = None, + ge: int = None, + le: int = None, + **kwargs, + ) -> DetailedResponse: """ Add a prefix filter to a Transit Gateway Connection. @@ -1004,49 +1100,61 @@ def create_transit_gateway_connection_prefix_filter(self, :param str transit_gateway_id: The Transit Gateway identifier. :param str id: The connection identifier. - :param str action: Whether to permit or deny prefix filter. - :param str prefix: IP Prefix. - :param str before: (optional) Identifier of prefix filter to handle the - ordering and follow semantics: - - When a filter reference another filter in it's before field, then the - filter making the reference is applied before - the referenced filter. For example: if filter A references filter B in - its before field, A is applied before B. - - When a new filter is added that has the same before as an existing - filter, then the older filter will have its before - field updated to point to the new filter. Starting with the above - example: if filter C is added and it references B in its - before field, then A's before field should be modified to point to C, so - the order of application would be A, C and finally B. - - A filter that has an empty before reference will be applied last (though - the date order mentioned above will still apply). - So continuing the above examples, if filter B has an empty before field, - then it will be applied last, but if filter D - is created with an empty before field, then B's before field will be - modified to point to D, so B will be applied before D. - :param int ge: (optional) IP Prefix GE. - :param int le: (optional) IP Prefix LE. + :param str action: Whether or not this prefix filter should allow or deny + prefixes matching this filter's prefix definition. + :param str prefix: The IPv4 Prefix to be matched by this filter. If both + the 'le' and 'ge' are zero, then this filter will only apply to routes that + exactly match this prefix, while a non-zero value for either 'le' or 'ge', + this filter can apply to multiple routes with different prefix lengths, but + will still only apply to prefixes contained in the address space defined by + 'prefix'. + :param str before: (optional) A reference to the prefix filter that will be + the next filter applied to the Transit Gateway connection. + If this field is blank, this prefix filter will be the last rule applied + before the connection's default rule. + When a prefix filter is created with the same before field as an existing + prefix filter, the existing filter will be applied before the new filter, + and the existing filter's before field will be updated accordingly. + :param int ge: (optional) Defines the minimum matched prefix precision. If + this field is non-zero then the filter will match all routes within the + 'prefix' that have a prefix length greater than or equal to this value. + This value can be zero, or a non-negative number greater than or equal to + the prefix length of the filter's prefix or less then or equal to 32. If + this value is set to zero, the filter will not use the 'ge' route matching + behavior. If the 'le' value is non-zero the the 'ge' value must between the + prefix length and the + 'le' value, inclusive. + :param int le: (optional) Defines the maximum matched prefix precision. If + this field is non-zero then the filter will match all routes within the + 'prefix' that have a prefix length less than or equal to this value. + This value can be zero, or a non-negative number greater than or equal to + the prefix length of the filter's prefix or less then or equal to 32. If + this value is set to zero, the filter will not use the 'le' route matching + behavior. If the 'ge' value is non-zero the the 'le' value must between the + 'ge' value and 32, inclusive. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `PrefixFilterCust` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') if action is None: raise ValueError('action must be provided') if prefix is None: raise ValueError('prefix must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='create_transit_gateway_connection_prefix_filter') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_transit_gateway_connection_prefix_filter', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } data = { @@ -1054,7 +1162,7 @@ def create_transit_gateway_connection_prefix_filter(self, 'prefix': prefix, 'before': before, 'ge': ge, - 'le': le + 'le': le, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -1062,28 +1170,31 @@ def create_transit_gateway_connection_prefix_filter(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id', 'id'] path_param_values = self.encode_path_vars(transit_gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters'.format( - **path_param_dict) - request = self.prepare_request(method='POST', - url=url, - headers=headers, - params=params, - data=data) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters'.format(**path_param_dict) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + params=params, + data=data, + ) response = self.send(request, **kwargs) return response - def replace_transit_gateway_connection_prefix_filter(self, - transit_gateway_id: str, - id: str, - prefix_filters: List['PrefixFilterPut'], - **kwargs - ) -> DetailedResponse: + def replace_transit_gateway_connection_prefix_filter( + self, + transit_gateway_id: str, + id: str, + prefix_filters: List['PrefixFilterPut'], + **kwargs, + ) -> DetailedResponse: """ Replaces the prefix filters of the Transit Gateway Connection. @@ -1097,25 +1208,27 @@ def replace_transit_gateway_connection_prefix_filter(self, :rtype: DetailedResponse with `dict` result representing a `PrefixFilterCollection` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') if prefix_filters is None: raise ValueError('prefix_filters must be provided') prefix_filters = [convert_model(x) for x in prefix_filters] headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='replace_transit_gateway_connection_prefix_filter') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='replace_transit_gateway_connection_prefix_filter', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } data = { - 'prefix_filters': prefix_filters + 'prefix_filters': prefix_filters, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -1123,28 +1236,31 @@ def replace_transit_gateway_connection_prefix_filter(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id', 'id'] path_param_values = self.encode_path_vars(transit_gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters'.format( - **path_param_dict) - request = self.prepare_request(method='PUT', - url=url, - headers=headers, - params=params, - data=data) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters'.format(**path_param_dict) + request = self.prepare_request( + method='PUT', + url=url, + headers=headers, + params=params, + data=data, + ) response = self.send(request, **kwargs) return response - def delete_transit_gateway_connection_prefix_filter(self, - transit_gateway_id: str, - id: str, - filter_id: str, - **kwargs - ) -> DetailedResponse: + def delete_transit_gateway_connection_prefix_filter( + self, + transit_gateway_id: str, + id: str, + filter_id: str, + **kwargs, + ) -> DetailedResponse: """ Remove prefix filter from Transit Gateway Connection. @@ -1158,45 +1274,49 @@ def delete_transit_gateway_connection_prefix_filter(self, :rtype: DetailedResponse """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') - if filter_id is None: + if not filter_id: raise ValueError('filter_id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='delete_transit_gateway_connection_prefix_filter') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_transit_gateway_connection_prefix_filter', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] path_param_keys = ['transit_gateway_id', 'id', 'filter_id'] - path_param_values = self.encode_path_vars( - transit_gateway_id, id, filter_id) + path_param_values = self.encode_path_vars(transit_gateway_id, id, filter_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters/{filter_id}'.format( - **path_param_dict) - request = self.prepare_request(method='DELETE', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters/{filter_id}'.format(**path_param_dict) + request = self.prepare_request( + method='DELETE', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def get_transit_gateway_connection_prefix_filter(self, - transit_gateway_id: str, - id: str, - filter_id: str, - **kwargs - ) -> DetailedResponse: + def get_transit_gateway_connection_prefix_filter( + self, + transit_gateway_id: str, + id: str, + filter_id: str, + **kwargs, + ) -> DetailedResponse: """ Retrieves specified Transit Gateway connection prefix filter. @@ -1210,52 +1330,56 @@ def get_transit_gateway_connection_prefix_filter(self, :rtype: DetailedResponse with `dict` result representing a `PrefixFilterCust` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') - if filter_id is None: + if not filter_id: raise ValueError('filter_id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='get_transit_gateway_connection_prefix_filter') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_transit_gateway_connection_prefix_filter', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id', 'id', 'filter_id'] - path_param_values = self.encode_path_vars( - transit_gateway_id, id, filter_id) + path_param_values = self.encode_path_vars(transit_gateway_id, id, filter_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters/{filter_id}'.format( - **path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters/{filter_id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def update_transit_gateway_connection_prefix_filter(self, - transit_gateway_id: str, - id: str, - filter_id: str, - *, - action: str = None, - before: str = None, - ge: int = None, - le: int = None, - prefix: str = None, - **kwargs - ) -> DetailedResponse: + def update_transit_gateway_connection_prefix_filter( + self, + transit_gateway_id: str, + id: str, + filter_id: str, + *, + action: str = None, + before: str = None, + ge: int = None, + le: int = None, + prefix: str = None, + **kwargs, + ) -> DetailedResponse: """ Updates specified Transit Gateway connection prefix filter. @@ -1264,47 +1388,54 @@ def update_transit_gateway_connection_prefix_filter(self, :param str transit_gateway_id: The Transit Gateway identifier. :param str id: The connection identifier. :param str filter_id: Prefix filter identifier. - :param str action: (optional) Whether to permit or deny prefix filter. - :param str before: (optional) Identifier of prefix filter to handle the - ordering and follow semantics: - - When a filter reference another filter in it's before field, then the - filter making the reference is applied before - the referenced filter. For example: if filter A references filter B in - its before field, A is applied before B. - - When a new filter is added that has the same before as an existing - filter, then the older filter will have its before - field updated to point to the new filter. Starting with the above - example: if filter C is added and it references B in its - before field, then A's before field should be modified to point to C, so - the order of application would be A, C and finally B. - - A filter that has an empty before reference will be applied last (though - the date order mentioned above will still apply). - So continuing the above examples, if filter B has an empty before field, - then it will be applied last, but if filter D - is created with an empty before field, then B's before field will be - modified to point to D, so B will be applied before D. - :param int ge: (optional) IP Prefix GE. - :param int le: (optional) IP Prefix LE. - :param str prefix: (optional) IP Prefix. + :param str action: (optional) Whether or not this prefix filter should + allow or deny prefixes matching this filter's prefix definition. + :param str before: (optional) A reference to the prefix filter that will be + the next filter applied to the Transit Gateway connection. + If this field is blank, this prefix filter will be the last rule applied + before the connection's default rule. + When a prefix filter is created with the same before field as an existing + prefix filter, the existing filter will be applied before the new filter, + and the existing filter's before field will be updated accordingly. + :param int ge: (optional) Defines the minimum matched prefix precision. If + this field is non-zero then the filter will match all routes within the + 'prefix' that have a prefix length greater or equal to this value. + This value can be zero, or a non-negative number greater than or equal to + the prefix length of the filter's prefix or less then or equal to 32. If + this value is set to zero, the filter will not use the 'ge' route matching + behavior. If the 'le' value is non-zero the the 'ge' value must between the + prefix length and the + 'le' value, inclusive. + :param int le: (optional) Defines the maximum matched prefix precision. If + this field is non-zero then the filter will match all routes within the + 'prefix' that have a prefix length less than or equal to this value. + This value can be zero, or a non-negative number greater than or equal to + the prefix length of the filter's prefix or less then or equal to 32. If + this value is set to zero, the filter will not use the 'le' route matching + behavior. If the 'ge' value is non-zero the the 'le' value must between the + 'ge' value and 32, inclusive. + :param str prefix: (optional) The IPv4 Prefix to be matched by this filter. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `PrefixFilterCust` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') - if filter_id is None: + if not filter_id: raise ValueError('filter_id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='update_transit_gateway_connection_prefix_filter') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_transit_gateway_connection_prefix_filter', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } data = { @@ -1312,7 +1443,7 @@ def update_transit_gateway_connection_prefix_filter(self, 'before': before, 'ge': ge, 'le': le, - 'prefix': prefix + 'prefix': prefix, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -1320,19 +1451,20 @@ def update_transit_gateway_connection_prefix_filter(self, if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id', 'id', 'filter_id'] - path_param_values = self.encode_path_vars( - transit_gateway_id, id, filter_id) + path_param_values = self.encode_path_vars(transit_gateway_id, id, filter_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters/{filter_id}'.format( - **path_param_dict) - request = self.prepare_request(method='PATCH', - url=url, - headers=headers, - params=params, - data=data) + url = '/transit_gateways/{transit_gateway_id}/connections/{id}/prefix_filters/{filter_id}'.format(**path_param_dict) + request = self.prepare_request( + method='PATCH', + url=url, + headers=headers, + params=params, + data=data, + ) response = self.send(request, **kwargs) return response @@ -1341,10 +1473,11 @@ def update_transit_gateway_connection_prefix_filter(self, # Transit Gateway Route Reports ######################### - def list_transit_gateway_route_reports(self, - transit_gateway_id: str, - **kwargs - ) -> DetailedResponse: + def list_transit_gateway_route_reports( + self, + transit_gateway_id: str, + **kwargs, + ) -> DetailedResponse: """ List route reports. @@ -1358,39 +1491,44 @@ def list_transit_gateway_route_reports(self, :rtype: DetailedResponse with `dict` result representing a `RouteReportCollection` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='list_transit_gateway_route_reports') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_transit_gateway_route_reports', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id'] path_param_values = self.encode_path_vars(transit_gateway_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/route_reports'.format( - **path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/route_reports'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def create_transit_gateway_route_report(self, - transit_gateway_id: str, - **kwargs - ) -> DetailedResponse: + def create_transit_gateway_route_report( + self, + transit_gateway_id: str, + **kwargs, + ) -> DetailedResponse: """ Request a route report. @@ -1404,40 +1542,45 @@ def create_transit_gateway_route_report(self, :rtype: DetailedResponse with `dict` result representing a `RouteReport` object """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='create_transit_gateway_route_report') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='create_transit_gateway_route_report', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['transit_gateway_id'] path_param_values = self.encode_path_vars(transit_gateway_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/route_reports'.format( - **path_param_dict) - request = self.prepare_request(method='POST', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/route_reports'.format(**path_param_dict) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def delete_transit_gateway_route_report(self, - transit_gateway_id: str, - id: str, - **kwargs - ) -> DetailedResponse: + def delete_transit_gateway_route_report( + self, + transit_gateway_id: str, + id: str, + **kwargs, + ) -> DetailedResponse: """ Delete route report. @@ -1450,99 +1593,498 @@ def delete_transit_gateway_route_report(self, :rtype: DetailedResponse """ - if transit_gateway_id is None: + if not transit_gateway_id: raise ValueError('transit_gateway_id must be provided') - if id is None: + if not id: raise ValueError('id must be provided') headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='delete_transit_gateway_route_report') + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='delete_transit_gateway_route_report', + ) headers.update(sdk_headers) params = { - 'version': self.version + 'version': self.version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) + del kwargs['headers'] path_param_keys = ['transit_gateway_id', 'id'] path_param_values = self.encode_path_vars(transit_gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/route_reports/{id}'.format( - **path_param_dict) - request = self.prepare_request(method='DELETE', - url=url, - headers=headers, - params=params) + url = '/transit_gateways/{transit_gateway_id}/route_reports/{id}'.format(**path_param_dict) + request = self.prepare_request( + method='DELETE', + url=url, + headers=headers, + params=params, + ) response = self.send(request, **kwargs) return response - def get_transit_gateway_route_report(self, - transit_gateway_id: str, - id: str, - **kwargs - ) -> DetailedResponse: + def get_transit_gateway_route_report( + self, + transit_gateway_id: str, + id: str, + **kwargs, + ) -> DetailedResponse: """ Retrieve route report. - Retrieve a route report. + Retrieve a route report. + + :param str transit_gateway_id: The Transit Gateway identifier. + :param str id: Route report identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `RouteReport` object + """ + + if not transit_gateway_id: + raise ValueError('transit_gateway_id must be provided') + if not id: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_transit_gateway_route_report', + ) + headers.update(sdk_headers) + + params = { + 'version': self.version, + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['transit_gateway_id', 'id'] + path_param_values = self.encode_path_vars(transit_gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/transit_gateways/{transit_gateway_id}/route_reports/{id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) + + response = self.send(request, **kwargs) + return response + + +############################################################################## +# Models +############################################################################## + + +class PaginationFirstConnection: + """ + A reference to the first page of resources. + + :attr str href: url. + """ + + def __init__( + self, + href: str, + ) -> None: + """ + Initialize a PaginationFirstConnection object. + + :param str href: url. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PaginationFirstConnection': + """Initialize a PaginationFirstConnection object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PaginationFirstConnection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PaginationFirstConnection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this PaginationFirstConnection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PaginationFirstConnection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'PaginationFirstConnection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class PaginationFirstTG: + """ + A reference to the first page of resources. + + :attr str href: url. + """ + + def __init__( + self, + href: str, + ) -> None: + """ + Initialize a PaginationFirstTG object. + + :param str href: url. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PaginationFirstTG': + """Initialize a PaginationFirstTG object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PaginationFirstTG JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PaginationFirstTG object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this PaginationFirstTG object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PaginationFirstTG') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'PaginationFirstTG') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class PaginationFirstTGWConnection: + """ + A reference to the first page of resources. This will be returned when number of + connections in response are greater than max page limit. + + :attr str href: url. + """ + + def __init__( + self, + href: str, + ) -> None: + """ + Initialize a PaginationFirstTGWConnection object. + + :param str href: url. + """ + self.href = href + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PaginationFirstTGWConnection': + """Initialize a PaginationFirstTGWConnection object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PaginationFirstTGWConnection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PaginationFirstTGWConnection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this PaginationFirstTGWConnection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PaginationFirstTGWConnection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'PaginationFirstTGWConnection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class PaginationNextConnection: + """ + A reference to the next page of resources; this reference is included for all pages + except the last page. + + :attr str href: url. + :attr str start: server generated start token for next page of resources. + """ + + def __init__( + self, + href: str, + start: str, + ) -> None: + """ + Initialize a PaginationNextConnection object. + + :param str href: url. + :param str start: server generated start token for next page of resources. + """ + self.href = href + self.start = start + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PaginationNextConnection': + """Initialize a PaginationNextConnection object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PaginationNextConnection JSON') + if 'start' in _dict: + args['start'] = _dict.get('start') + else: + raise ValueError('Required property \'start\' not present in PaginationNextConnection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PaginationNextConnection object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'start') and self.start is not None: + _dict['start'] = self.start + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this PaginationNextConnection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PaginationNextConnection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'PaginationNextConnection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class PaginationNextTG: + """ + A reference to the next page of resources; this reference is included for all pages + except the last page. + + :attr str href: url. + :attr str start: server generated start token for next page of resources. + """ + + def __init__( + self, + href: str, + start: str, + ) -> None: + """ + Initialize a PaginationNextTG object. + + :param str href: url. + :param str start: server generated start token for next page of resources. + """ + self.href = href + self.start = start + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PaginationNextTG': + """Initialize a PaginationNextTG object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PaginationNextTG JSON') + if 'start' in _dict: + args['start'] = _dict.get('start') + else: + raise ValueError('Required property \'start\' not present in PaginationNextTG JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PaginationNextTG object from a json dictionary.""" + return cls.from_dict(_dict) + + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'start') and self.start is not None: + _dict['start'] = self.start + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this PaginationNextTG object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PaginationNextTG') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ + + def __ne__(self, other: 'PaginationNextTG') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class PaginationNextTGWConnection: + """ + A reference to the next page of resources; this reference is included for all pages + except the last page. + + :attr str href: url. + :attr str start: server generated start token for next page of resources. + """ + + def __init__( + self, + href: str, + start: str, + ) -> None: + """ + Initialize a PaginationNextTGWConnection object. - :param str transit_gateway_id: The Transit Gateway identifier. - :param str id: Route report identifier. - :param dict headers: A `dict` containing the request headers - :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `RouteReport` object + :param str href: url. + :param str start: server generated start token for next page of resources. """ + self.href = href + self.start = start - if transit_gateway_id is None: - raise ValueError('transit_gateway_id must be provided') - if id is None: - raise ValueError('id must be provided') - headers = {} - sdk_headers = get_sdk_headers(service_name=self.DEFAULT_SERVICE_NAME, - service_version='V1', - operation_id='get_transit_gateway_route_report') - headers.update(sdk_headers) + @classmethod + def from_dict(cls, _dict: Dict) -> 'PaginationNextTGWConnection': + """Initialize a PaginationNextTGWConnection object from a json dictionary.""" + args = {} + if 'href' in _dict: + args['href'] = _dict.get('href') + else: + raise ValueError('Required property \'href\' not present in PaginationNextTGWConnection JSON') + if 'start' in _dict: + args['start'] = _dict.get('start') + else: + raise ValueError('Required property \'start\' not present in PaginationNextTGWConnection JSON') + return cls(**args) - params = { - 'version': self.version - } + @classmethod + def _from_dict(cls, _dict): + """Initialize a PaginationNextTGWConnection object from a json dictionary.""" + return cls.from_dict(_dict) - if 'headers' in kwargs: - headers.update(kwargs.get('headers')) - headers['Accept'] = 'application/json' + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'start') and self.start is not None: + _dict['start'] = self.start + return _dict - path_param_keys = ['transit_gateway_id', 'id'] - path_param_values = self.encode_path_vars(transit_gateway_id, id) - path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/transit_gateways/{transit_gateway_id}/route_reports/{id}'.format( - **path_param_dict) - request = self.prepare_request(method='GET', - url=url, - headers=headers, - params=params) + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() - response = self.send(request, **kwargs) - return response + def __str__(self) -> str: + """Return a `str` version of this PaginationNextTGWConnection object.""" + return json.dumps(self.to_dict(), indent=2) + def __eq__(self, other: 'PaginationNextTGWConnection') -> bool: + """Return `true` when self and other are equal, false otherwise.""" + if not isinstance(other, self.__class__): + return False + return self.__dict__ == other.__dict__ -############################################################################## -# Models -############################################################################## + def __ne__(self, other: 'PaginationNextTGWConnection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class PrefixFilterCollection(): +class PrefixFilterCollection: """ prefix filters. :attr List[PrefixFilterCust] prefix_filters: Array of prefix filters. """ - def __init__(self, - prefix_filters: List['PrefixFilterCust']) -> None: + def __init__( + self, + prefix_filters: List['PrefixFilterCust'], + ) -> None: """ Initialize a PrefixFilterCollection object. @@ -1555,11 +2097,9 @@ def from_dict(cls, _dict: Dict) -> 'PrefixFilterCollection': """Initialize a PrefixFilterCollection object from a json dictionary.""" args = {} if 'prefix_filters' in _dict: - args['prefix_filters'] = [PrefixFilterCust.from_dict( - x) for x in _dict.get('prefix_filters')] + args['prefix_filters'] = [PrefixFilterCust.from_dict(v) for v in _dict.get('prefix_filters')] else: - raise ValueError( - 'Required property \'prefix_filters\' not present in PrefixFilterCollection JSON') + raise ValueError('Required property \'prefix_filters\' not present in PrefixFilterCollection JSON') return cls(**args) @classmethod @@ -1571,8 +2111,13 @@ def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'prefix_filters') and self.prefix_filters is not None: - _dict['prefix_filters'] = [x.to_dict() - for x in self.prefix_filters] + prefix_filters_list = [] + for v in self.prefix_filters: + if isinstance(v, dict): + prefix_filters_list.append(v) + else: + prefix_filters_list.append(v.to_dict()) + _dict['prefix_filters'] = prefix_filters_list return _dict def _to_dict(self): @@ -1594,77 +2139,97 @@ def __ne__(self, other: 'PrefixFilterCollection') -> bool: return not self == other -class PrefixFilterCust(): +class PrefixFilterCust: """ prefix filter. - :attr str action: Whether to permit or deny prefix filter. - :attr str before: (optional) Identifier of prefix filter that handles the - ordering and follow semantics: - - When a filter reference another filter in it's before field, then the filter - making the reference is applied before - the referenced filter. For example: if filter A references filter B in its - before field, A is applied before B. - - When a new filter is added that has the same before as an existing filter, - then the older filter will have its before - field updated to point to the new filter. Starting with the above example: if - filter C is added and it references B in its - before field, then A's before field should be modified to point to C, so the - order of application would be A, C and finally B. - - A filter that has an empty before reference will be applied last (though the - date order mentioned above will still apply). - So continuing the above examples, if filter B has an empty before field, then - it will be applied last, but if filter D - is created with an empty before field, then B's before field will be modified - to point to D, so B will be applied before D. + :attr str action: Whether or not this prefix filter should allow or deny + prefixes matching this filter's prefix definition. + :attr str before: (optional) A reference to the prefix filter that will be the + next filter applied to the Transit Gateway connection. + If this field is blank, this prefix filter will be the last rule applied before + the connection's default rule. + When a prefix filter is created with the same before field as an existing prefix + filter, the existing filter will be applied before the new filter, and the + existing filter's before field will be updated accordingly. :attr datetime created_at: The date and time that this prefix filter was created. - :attr int ge: (optional) IP Prefix GE. + :attr int ge: (optional) Defines the minimum matched prefix precision. If this + field is non-zero then the filter will match all routes within the 'prefix' that + have a prefix length greater or equal to this value. + This value can be zero, or a non-negative number greater than or equal to the + prefix length of the filter's prefix or less then or equal to 32. If this value + is set to zero, the filter will not use the 'ge' route matching behavior. If the + 'le' value is non-zero the the 'ge' value must between the prefix length and the + 'le' value, inclusive. :attr str id: Prefix Filter identifier. - :attr int le: (optional) IP Prefix LE. - :attr str prefix: IP Prefix. + :attr int le: (optional) Defines the maximum matched prefix precision. If this + field is non-zero then the filter will match all routes within the 'prefix' that + have a prefix length less than or equal to this value. + This value can be zero, or a non-negative number greater than or equal to the + prefix length of the filter's prefix or less then or equal to 32. If this value + is set to zero, the filter will not use the 'le' route matching behavior. If the + 'ge' value is non-zero the the 'le' value must between the 'ge' value and 32, + inclusive. + :attr str prefix: The IPv4 Prefix to be matched by this filter. If both the 'le' + and 'ge' are zero, then this filter will only apply to routes that exactly match + this prefix, while a non-zero value for either 'le' or 'ge', this filter can + apply to multiple routes with different prefix lengths, but will still only + apply to prefixes contained in the address space defined by 'prefix'. :attr datetime updated_at: (optional) The date and time that this prefix filter was last updated. """ - def __init__(self, - action: str, - created_at: datetime, - id: str, - prefix: str, - *, - before: str = None, - ge: int = None, - le: int = None, - updated_at: datetime = None) -> None: + def __init__( + self, + action: str, + created_at: datetime, + id: str, + prefix: str, + *, + before: str = None, + ge: int = None, + le: int = None, + updated_at: datetime = None, + ) -> None: """ Initialize a PrefixFilterCust object. - :param str action: Whether to permit or deny prefix filter. + :param str action: Whether or not this prefix filter should allow or deny + prefixes matching this filter's prefix definition. :param datetime created_at: The date and time that this prefix filter was created. :param str id: Prefix Filter identifier. - :param str prefix: IP Prefix. - :param str before: (optional) Identifier of prefix filter that handles the - ordering and follow semantics: - - When a filter reference another filter in it's before field, then the - filter making the reference is applied before - the referenced filter. For example: if filter A references filter B in - its before field, A is applied before B. - - When a new filter is added that has the same before as an existing - filter, then the older filter will have its before - field updated to point to the new filter. Starting with the above - example: if filter C is added and it references B in its - before field, then A's before field should be modified to point to C, so - the order of application would be A, C and finally B. - - A filter that has an empty before reference will be applied last (though - the date order mentioned above will still apply). - So continuing the above examples, if filter B has an empty before field, - then it will be applied last, but if filter D - is created with an empty before field, then B's before field will be - modified to point to D, so B will be applied before D. - :param int ge: (optional) IP Prefix GE. - :param int le: (optional) IP Prefix LE. + :param str prefix: The IPv4 Prefix to be matched by this filter. If both + the 'le' and 'ge' are zero, then this filter will only apply to routes that + exactly match this prefix, while a non-zero value for either 'le' or 'ge', + this filter can apply to multiple routes with different prefix lengths, but + will still only apply to prefixes contained in the address space defined by + 'prefix'. + :param str before: (optional) A reference to the prefix filter that will be + the next filter applied to the Transit Gateway connection. + If this field is blank, this prefix filter will be the last rule applied + before the connection's default rule. + When a prefix filter is created with the same before field as an existing + prefix filter, the existing filter will be applied before the new filter, + and the existing filter's before field will be updated accordingly. + :param int ge: (optional) Defines the minimum matched prefix precision. If + this field is non-zero then the filter will match all routes within the + 'prefix' that have a prefix length greater or equal to this value. + This value can be zero, or a non-negative number greater than or equal to + the prefix length of the filter's prefix or less then or equal to 32. If + this value is set to zero, the filter will not use the 'ge' route matching + behavior. If the 'le' value is non-zero the the 'ge' value must between the + prefix length and the + 'le' value, inclusive. + :param int le: (optional) Defines the maximum matched prefix precision. If + this field is non-zero then the filter will match all routes within the + 'prefix' that have a prefix length less than or equal to this value. + This value can be zero, or a non-negative number greater than or equal to + the prefix length of the filter's prefix or less then or equal to 32. If + this value is set to zero, the filter will not use the 'le' route matching + behavior. If the 'ge' value is non-zero the the 'le' value must between the + 'ge' value and 32, inclusive. :param datetime updated_at: (optional) The date and time that this prefix filter was last updated. """ @@ -1684,29 +2249,25 @@ def from_dict(cls, _dict: Dict) -> 'PrefixFilterCust': if 'action' in _dict: args['action'] = _dict.get('action') else: - raise ValueError( - 'Required property \'action\' not present in PrefixFilterCust JSON') + raise ValueError('Required property \'action\' not present in PrefixFilterCust JSON') if 'before' in _dict: args['before'] = _dict.get('before') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError( - 'Required property \'created_at\' not present in PrefixFilterCust JSON') + raise ValueError('Required property \'created_at\' not present in PrefixFilterCust JSON') if 'ge' in _dict: args['ge'] = _dict.get('ge') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in PrefixFilterCust JSON') + raise ValueError('Required property \'id\' not present in PrefixFilterCust JSON') if 'le' in _dict: args['le'] = _dict.get('le') if 'prefix' in _dict: args['prefix'] = _dict.get('prefix') else: - raise ValueError( - 'Required property \'prefix\' not present in PrefixFilterCust JSON') + raise ValueError('Required property \'prefix\' not present in PrefixFilterCust JSON') if 'updated_at' in _dict: args['updated_at'] = string_to_datetime(_dict.get('updated_at')) return cls(**args) @@ -1757,35 +2318,80 @@ def __ne__(self, other: 'PrefixFilterCust') -> bool: class ActionEnum(str, Enum): """ - Whether to permit or deny prefix filter. + Whether or not this prefix filter should allow or deny prefixes matching this + filter's prefix definition. """ + PERMIT = 'permit' DENY = 'deny' -class PrefixFilterPut(): - """ - A prefix filter create template. - :attr str action: Whether to permit or deny prefix filter. - :attr int ge: (optional) IP Prefix GE. - :attr int le: (optional) IP Prefix LE. - :attr str prefix: IP Prefix. +class PrefixFilterPut: + """ + A prefix filter update template. + + :attr str action: Whether or not this prefix filter should allow or deny + prefixes matching this filter's prefix definition. + :attr int ge: (optional) Defines the minimum matched prefix precision. If this + field is non-zero then the filter will match all routes within the 'prefix' that + have a prefix length greater or equal to this value. + This value can be zero, or a non-negative number greater than or equal to the + prefix length of the filter's prefix or less then or equal to 32. If this value + is set to zero, the filter will not use the 'ge' route matching behavior. If the + 'le' value is non-zero the the 'ge' value must between the prefix length and the + 'le' value, inclusive. + :attr int le: (optional) Defines the maximum matched prefix precision. If this + field is non-zero then the filter will match all routes within the 'prefix' that + have a prefix length less than or equal to this value. + This value can be zero, or a non-negative number greater than or equal to the + prefix length of the filter's prefix or less then or equal to 32. If this value + is set to zero, the filter will not use the 'le' route matching behavior. If the + 'ge' value is non-zero the the 'le' value must between the 'ge' value and 32, + inclusive. + :attr str prefix: The IPv4 Prefix to be matched by this filter. If both the 'le' + and 'ge' are zero, then this filter will only apply to routes that exactly match + this prefix, while a non-zero value for either 'le' or 'ge', this filter can + apply to multiple routes with different prefix lengths, but will still only + apply to prefixes contained in the address space defined by 'prefix'. """ - def __init__(self, - action: str, - prefix: str, - *, - ge: int = None, - le: int = None) -> None: + def __init__( + self, + action: str, + prefix: str, + *, + ge: int = None, + le: int = None, + ) -> None: """ Initialize a PrefixFilterPut object. - :param str action: Whether to permit or deny prefix filter. - :param str prefix: IP Prefix. - :param int ge: (optional) IP Prefix GE. - :param int le: (optional) IP Prefix LE. + :param str action: Whether or not this prefix filter should allow or deny + prefixes matching this filter's prefix definition. + :param str prefix: The IPv4 Prefix to be matched by this filter. If both + the 'le' and 'ge' are zero, then this filter will only apply to routes that + exactly match this prefix, while a non-zero value for either 'le' or 'ge', + this filter can apply to multiple routes with different prefix lengths, but + will still only apply to prefixes contained in the address space defined by + 'prefix'. + :param int ge: (optional) Defines the minimum matched prefix precision. If + this field is non-zero then the filter will match all routes within the + 'prefix' that have a prefix length greater or equal to this value. + This value can be zero, or a non-negative number greater than or equal to + the prefix length of the filter's prefix or less then or equal to 32. If + this value is set to zero, the filter will not use the 'ge' route matching + behavior. If the 'le' value is non-zero the the 'ge' value must between the + prefix length and the + 'le' value, inclusive. + :param int le: (optional) Defines the maximum matched prefix precision. If + this field is non-zero then the filter will match all routes within the + 'prefix' that have a prefix length less than or equal to this value. + This value can be zero, or a non-negative number greater than or equal to + the prefix length of the filter's prefix or less then or equal to 32. If + this value is set to zero, the filter will not use the 'le' route matching + behavior. If the 'ge' value is non-zero the the 'le' value must between the + 'ge' value and 32, inclusive. """ self.action = action self.ge = ge @@ -1799,8 +2405,7 @@ def from_dict(cls, _dict: Dict) -> 'PrefixFilterPut': if 'action' in _dict: args['action'] = _dict.get('action') else: - raise ValueError( - 'Required property \'action\' not present in PrefixFilterPut JSON') + raise ValueError('Required property \'action\' not present in PrefixFilterPut JSON') if 'ge' in _dict: args['ge'] = _dict.get('ge') if 'le' in _dict: @@ -1808,8 +2413,7 @@ def from_dict(cls, _dict: Dict) -> 'PrefixFilterPut': if 'prefix' in _dict: args['prefix'] = _dict.get('prefix') else: - raise ValueError( - 'Required property \'prefix\' not present in PrefixFilterPut JSON') + raise ValueError('Required property \'prefix\' not present in PrefixFilterPut JSON') return cls(**args) @classmethod @@ -1850,13 +2454,16 @@ def __ne__(self, other: 'PrefixFilterPut') -> bool: class ActionEnum(str, Enum): """ - Whether to permit or deny prefix filter. + Whether or not this prefix filter should allow or deny prefixes matching this + filter's prefix definition. """ + PERMIT = 'permit' DENY = 'deny' -class ResourceGroupIdentity(): + +class ResourceGroupIdentity: """ The resource group to use. If unspecified, the account's [default resource group](https://console.bluemix.net/apidocs/resource-manager#introduction) is used. @@ -1864,8 +2471,10 @@ class ResourceGroupIdentity(): :attr str id: The unique identifier for this resource group. """ - def __init__(self, - id: str) -> None: + def __init__( + self, + id: str, + ) -> None: """ Initialize a ResourceGroupIdentity object. @@ -1880,8 +2489,7 @@ def from_dict(cls, _dict: Dict) -> 'ResourceGroupIdentity': if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in ResourceGroupIdentity JSON') + raise ValueError('Required property \'id\' not present in ResourceGroupIdentity JSON') return cls(**args) @classmethod @@ -1915,7 +2523,7 @@ def __ne__(self, other: 'ResourceGroupIdentity') -> bool: return not self == other -class ResourceGroupReference(): +class ResourceGroupReference: """ The resource group to use. If unspecified, the account's [default resource group](https://console.bluemix.net/apidocs/resource-manager#introduction) is used. @@ -1924,9 +2532,11 @@ class ResourceGroupReference(): :attr str href: The URL for this resource group. """ - def __init__(self, - id: str, - href: str) -> None: + def __init__( + self, + id: str, + href: str, + ) -> None: """ Initialize a ResourceGroupReference object. @@ -1943,13 +2553,11 @@ def from_dict(cls, _dict: Dict) -> 'ResourceGroupReference': if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in ResourceGroupReference JSON') + raise ValueError('Required property \'id\' not present in ResourceGroupReference JSON') if 'href' in _dict: args['href'] = _dict.get('href') else: - raise ValueError( - 'Required property \'href\' not present in ResourceGroupReference JSON') + raise ValueError('Required property \'href\' not present in ResourceGroupReference JSON') return cls(**args) @classmethod @@ -1985,7 +2593,7 @@ def __ne__(self, other: 'ResourceGroupReference') -> bool: return not self == other -class RouteReport(): +class RouteReport: """ route report. @@ -2002,14 +2610,16 @@ class RouteReport(): modified. """ - def __init__(self, - connections: List['RouteReportConnection'], - created_at: datetime, - id: str, - overlapping_routes: List['RouteReportOverlappingRouteGroup'], - status: str, - *, - updated_at: datetime = None) -> None: + def __init__( + self, + connections: List['RouteReportConnection'], + created_at: datetime, + id: str, + overlapping_routes: List['RouteReportOverlappingRouteGroup'], + status: str, + *, + updated_at: datetime = None, + ) -> None: """ Initialize a RouteReport object. @@ -2037,32 +2647,25 @@ def from_dict(cls, _dict: Dict) -> 'RouteReport': """Initialize a RouteReport object from a json dictionary.""" args = {} if 'connections' in _dict: - args['connections'] = [RouteReportConnection.from_dict( - x) for x in _dict.get('connections')] + args['connections'] = [RouteReportConnection.from_dict(v) for v in _dict.get('connections')] else: - raise ValueError( - 'Required property \'connections\' not present in RouteReport JSON') + raise ValueError('Required property \'connections\' not present in RouteReport JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError( - 'Required property \'created_at\' not present in RouteReport JSON') + raise ValueError('Required property \'created_at\' not present in RouteReport JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in RouteReport JSON') + raise ValueError('Required property \'id\' not present in RouteReport JSON') if 'overlapping_routes' in _dict: - args['overlapping_routes'] = [RouteReportOverlappingRouteGroup.from_dict( - x) for x in _dict.get('overlapping_routes')] + args['overlapping_routes'] = [RouteReportOverlappingRouteGroup.from_dict(v) for v in _dict.get('overlapping_routes')] else: - raise ValueError( - 'Required property \'overlapping_routes\' not present in RouteReport JSON') + raise ValueError('Required property \'overlapping_routes\' not present in RouteReport JSON') if 'status' in _dict: args['status'] = _dict.get('status') else: - raise ValueError( - 'Required property \'status\' not present in RouteReport JSON') + raise ValueError('Required property \'status\' not present in RouteReport JSON') if 'updated_at' in _dict: args['updated_at'] = string_to_datetime(_dict.get('updated_at')) return cls(**args) @@ -2076,14 +2679,25 @@ def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'connections') and self.connections is not None: - _dict['connections'] = [x.to_dict() for x in self.connections] + connections_list = [] + for v in self.connections: + if isinstance(v, dict): + connections_list.append(v) + else: + connections_list.append(v.to_dict()) + _dict['connections'] = connections_list if hasattr(self, 'created_at') and self.created_at is not None: _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id if hasattr(self, 'overlapping_routes') and self.overlapping_routes is not None: - _dict['overlapping_routes'] = [x.to_dict() - for x in self.overlapping_routes] + overlapping_routes_list = [] + for v in self.overlapping_routes: + if isinstance(v, dict): + overlapping_routes_list.append(v) + else: + overlapping_routes_list.append(v.to_dict()) + _dict['overlapping_routes'] = overlapping_routes_list if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status if hasattr(self, 'updated_at') and self.updated_at is not None: @@ -2113,19 +2727,23 @@ class StatusEnum(str, Enum): Route report status. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ + COMPLETE = 'complete' PENDING = 'pending' -class RouteReportCollection(): + +class RouteReportCollection: """ route reports. :attr List[RouteReport] route_reports: Array of route reports. """ - def __init__(self, - route_reports: List['RouteReport']) -> None: + def __init__( + self, + route_reports: List['RouteReport'], + ) -> None: """ Initialize a RouteReportCollection object. @@ -2138,11 +2756,9 @@ def from_dict(cls, _dict: Dict) -> 'RouteReportCollection': """Initialize a RouteReportCollection object from a json dictionary.""" args = {} if 'route_reports' in _dict: - args['route_reports'] = [RouteReport.from_dict( - x) for x in _dict.get('route_reports')] + args['route_reports'] = [RouteReport.from_dict(v) for v in _dict.get('route_reports')] else: - raise ValueError( - 'Required property \'route_reports\' not present in RouteReportCollection JSON') + raise ValueError('Required property \'route_reports\' not present in RouteReportCollection JSON') return cls(**args) @classmethod @@ -2154,7 +2770,13 @@ def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'route_reports') and self.route_reports is not None: - _dict['route_reports'] = [x.to_dict() for x in self.route_reports] + route_reports_list = [] + for v in self.route_reports: + if isinstance(v, dict): + route_reports_list.append(v) + else: + route_reports_list.append(v.to_dict()) + _dict['route_reports'] = route_reports_list return _dict def _to_dict(self): @@ -2176,7 +2798,7 @@ def __ne__(self, other: 'RouteReportCollection') -> bool: return not self == other -class RouteReportConnection(): +class RouteReportConnection: """ route report connection. @@ -2189,13 +2811,15 @@ class RouteReportConnection(): :attr str type: (optional) connection type. """ - def __init__(self, - *, - bgps: List['RouteReportConnectionBgp'] = None, - id: str = None, - name: str = None, - routes: List['RouteReportConnectionRoute'] = None, - type: str = None) -> None: + def __init__( + self, + *, + bgps: List['RouteReportConnectionBgp'] = None, + id: str = None, + name: str = None, + routes: List['RouteReportConnectionRoute'] = None, + type: str = None, + ) -> None: """ Initialize a RouteReportConnection object. @@ -2218,15 +2842,13 @@ def from_dict(cls, _dict: Dict) -> 'RouteReportConnection': """Initialize a RouteReportConnection object from a json dictionary.""" args = {} if 'bgps' in _dict: - args['bgps'] = [RouteReportConnectionBgp.from_dict( - x) for x in _dict.get('bgps')] + args['bgps'] = [RouteReportConnectionBgp.from_dict(v) for v in _dict.get('bgps')] if 'id' in _dict: args['id'] = _dict.get('id') if 'name' in _dict: args['name'] = _dict.get('name') if 'routes' in _dict: - args['routes'] = [RouteReportConnectionRoute.from_dict( - x) for x in _dict.get('routes')] + args['routes'] = [RouteReportConnectionRoute.from_dict(v) for v in _dict.get('routes')] if 'type' in _dict: args['type'] = _dict.get('type') return cls(**args) @@ -2240,13 +2862,25 @@ def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'bgps') and self.bgps is not None: - _dict['bgps'] = [x.to_dict() for x in self.bgps] + bgps_list = [] + for v in self.bgps: + if isinstance(v, dict): + bgps_list.append(v) + else: + bgps_list.append(v.to_dict()) + _dict['bgps'] = bgps_list if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'routes') and self.routes is not None: - _dict['routes'] = [x.to_dict() for x in self.routes] + routes_list = [] + for v in self.routes: + if isinstance(v, dict): + routes_list.append(v) + else: + routes_list.append(v.to_dict()) + _dict['routes'] = routes_list if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type return _dict @@ -2270,7 +2904,7 @@ def __ne__(self, other: 'RouteReportConnection') -> bool: return not self == other -class RouteReportConnectionBgp(): +class RouteReportConnectionBgp: """ connection bgp details. @@ -2280,12 +2914,14 @@ class RouteReportConnectionBgp(): :attr str prefix: (optional) prefix. """ - def __init__(self, - *, - as_path: str = None, - is_used: bool = None, - local_preference: str = None, - prefix: str = None) -> None: + def __init__( + self, + *, + as_path: str = None, + is_used: bool = None, + local_preference: str = None, + prefix: str = None, + ) -> None: """ Initialize a RouteReportConnectionBgp object. @@ -2351,16 +2987,18 @@ def __ne__(self, other: 'RouteReportConnectionBgp') -> bool: return not self == other -class RouteReportConnectionRoute(): +class RouteReportConnectionRoute: """ connection used route. :attr str prefix: (optional) prefix. """ - def __init__(self, - *, - prefix: str = None) -> None: + def __init__( + self, + *, + prefix: str = None, + ) -> None: """ Initialize a RouteReportConnectionRoute object. @@ -2407,7 +3045,7 @@ def __ne__(self, other: 'RouteReportConnectionRoute') -> bool: return not self == other -class RouteReportOverlappingRoute(): +class RouteReportOverlappingRoute: """ overlapping route details. @@ -2415,10 +3053,12 @@ class RouteReportOverlappingRoute(): :attr str prefix: (optional) overlapping prefix. """ - def __init__(self, - *, - connection_id: str = None, - prefix: str = None) -> None: + def __init__( + self, + *, + connection_id: str = None, + prefix: str = None, + ) -> None: """ Initialize a RouteReportOverlappingRoute object. @@ -2471,7 +3111,7 @@ def __ne__(self, other: 'RouteReportOverlappingRoute') -> bool: return not self == other -class RouteReportOverlappingRouteGroup(): +class RouteReportOverlappingRouteGroup: """ Collection of overlapping route. @@ -2479,9 +3119,11 @@ class RouteReportOverlappingRouteGroup(): connection/prefix pairs. """ - def __init__(self, - *, - routes: List['RouteReportOverlappingRoute'] = None) -> None: + def __init__( + self, + *, + routes: List['RouteReportOverlappingRoute'] = None, + ) -> None: """ Initialize a RouteReportOverlappingRouteGroup object. @@ -2495,8 +3137,7 @@ def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRouteGroup': """Initialize a RouteReportOverlappingRouteGroup object from a json dictionary.""" args = {} if 'routes' in _dict: - args['routes'] = [RouteReportOverlappingRoute.from_dict( - x) for x in _dict.get('routes')] + args['routes'] = [RouteReportOverlappingRoute.from_dict(v) for v in _dict.get('routes')] return cls(**args) @classmethod @@ -2508,7 +3149,13 @@ def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'routes') and self.routes is not None: - _dict['routes'] = [x.to_dict() for x in self.routes] + routes_list = [] + for v in self.routes: + if isinstance(v, dict): + routes_list.append(v) + else: + routes_list.append(v.to_dict()) + _dict['routes'] = routes_list return _dict def _to_dict(self): @@ -2530,15 +3177,17 @@ def __ne__(self, other: 'RouteReportOverlappingRouteGroup') -> bool: return not self == other -class TSCollection(): +class TSCollection: """ A list of Transit Gateway locations. :attr List[TSLocationBasic] locations: Collection of Transit Gateway locations. """ - def __init__(self, - locations: List['TSLocationBasic']) -> None: + def __init__( + self, + locations: List['TSLocationBasic'], + ) -> None: """ Initialize a TSCollection object. @@ -2552,11 +3201,9 @@ def from_dict(cls, _dict: Dict) -> 'TSCollection': """Initialize a TSCollection object from a json dictionary.""" args = {} if 'locations' in _dict: - args['locations'] = [TSLocationBasic.from_dict( - x) for x in _dict.get('locations')] + args['locations'] = [TSLocationBasic.from_dict(v) for v in _dict.get('locations')] else: - raise ValueError( - 'Required property \'locations\' not present in TSCollection JSON') + raise ValueError('Required property \'locations\' not present in TSCollection JSON') return cls(**args) @classmethod @@ -2568,7 +3215,13 @@ def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'locations') and self.locations is not None: - _dict['locations'] = [x.to_dict() for x in self.locations] + locations_list = [] + for v in self.locations: + if isinstance(v, dict): + locations_list.append(v) + else: + locations_list.append(v.to_dict()) + _dict['locations'] = locations_list return _dict def _to_dict(self): @@ -2590,38 +3243,39 @@ def __ne__(self, other: 'TSCollection') -> bool: return not self == other -class TSLocalLocation(): +class TSLocalLocation: """ Details of a local connection location. - :attr str display_name: (optional) A descriptive display name for the location. - :attr str name: (optional) The name of the location. + :attr str display_name: A descriptive display name for the location. + :attr str name: The name of the location. :attr List[str] supported_connection_types: (optional) Array of supported connection types. - :attr str type: (optional) The type of the location, determining is this a - multi-zone region, a single data center, or a point of presence. The list of - enumerated values for this property may expand in the future. Code and processes - using this field must tolerate unexpected values. + :attr str type: The type of the location, determining is this a multi-zone + region, a single data center, or a point of presence. The list of enumerated + values for this property may expand in the future. Code and processes using this + field must tolerate unexpected values. """ - def __init__(self, - *, - display_name: str = None, - name: str = None, - supported_connection_types: List[str] = None, - type: str = None) -> None: + def __init__( + self, + display_name: str, + name: str, + type: str, + *, + supported_connection_types: List[str] = None, + ) -> None: """ Initialize a TSLocalLocation object. - :param str display_name: (optional) A descriptive display name for the - location. - :param str name: (optional) The name of the location. + :param str display_name: A descriptive display name for the location. + :param str name: The name of the location. + :param str type: The type of the location, determining is this a multi-zone + region, a single data center, or a point of presence. The list of + enumerated values for this property may expand in the future. Code and + processes using this field must tolerate unexpected values. :param List[str] supported_connection_types: (optional) Array of supported connection types. - :param str type: (optional) The type of the location, determining is this a - multi-zone region, a single data center, or a point of presence. The list - of enumerated values for this property may expand in the future. Code and - processes using this field must tolerate unexpected values. """ self.display_name = display_name self.name = name @@ -2634,13 +3288,18 @@ def from_dict(cls, _dict: Dict) -> 'TSLocalLocation': args = {} if 'display_name' in _dict: args['display_name'] = _dict.get('display_name') + else: + raise ValueError('Required property \'display_name\' not present in TSLocalLocation JSON') if 'name' in _dict: args['name'] = _dict.get('name') + else: + raise ValueError('Required property \'name\' not present in TSLocalLocation JSON') if 'supported_connection_types' in _dict: - args['supported_connection_types'] = _dict.get( - 'supported_connection_types') + args['supported_connection_types'] = _dict.get('supported_connection_types') if 'type' in _dict: args['type'] = _dict.get('type') + else: + raise ValueError('Required property \'type\' not present in TSLocalLocation JSON') return cls(**args) @classmethod @@ -2686,11 +3345,13 @@ class TypeEnum(str, Enum): may expand in the future. Code and processes using this field must tolerate unexpected values. """ + REGION = 'region' DC = 'dc' -class TSLocation(): + +class TSLocation: """ Details of a Transit Gateway location. @@ -2703,11 +3364,13 @@ class TSLocation(): locations that are considered local for this Transit Gateway location. """ - def __init__(self, - billing_location: str, - name: str, - type: str, - local_connection_locations: List['TSLocalLocation']) -> None: + def __init__( + self, + billing_location: str, + name: str, + type: str, + local_connection_locations: List['TSLocalLocation'], + ) -> None: """ Initialize a TSLocation object. @@ -2731,24 +3394,19 @@ def from_dict(cls, _dict: Dict) -> 'TSLocation': if 'billing_location' in _dict: args['billing_location'] = _dict.get('billing_location') else: - raise ValueError( - 'Required property \'billing_location\' not present in TSLocation JSON') + raise ValueError('Required property \'billing_location\' not present in TSLocation JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError( - 'Required property \'name\' not present in TSLocation JSON') + raise ValueError('Required property \'name\' not present in TSLocation JSON') if 'type' in _dict: args['type'] = _dict.get('type') else: - raise ValueError( - 'Required property \'type\' not present in TSLocation JSON') + raise ValueError('Required property \'type\' not present in TSLocation JSON') if 'local_connection_locations' in _dict: - args['local_connection_locations'] = [TSLocalLocation.from_dict( - x) for x in _dict.get('local_connection_locations')] + args['local_connection_locations'] = [TSLocalLocation.from_dict(v) for v in _dict.get('local_connection_locations')] else: - raise ValueError( - 'Required property \'local_connection_locations\' not present in TSLocation JSON') + raise ValueError('Required property \'local_connection_locations\' not present in TSLocation JSON') return cls(**args) @classmethod @@ -2766,8 +3424,13 @@ def to_dict(self) -> Dict: if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type if hasattr(self, 'local_connection_locations') and self.local_connection_locations is not None: - _dict['local_connection_locations'] = [x.to_dict() - for x in self.local_connection_locations] + local_connection_locations_list = [] + for v in self.local_connection_locations: + if isinstance(v, dict): + local_connection_locations_list.append(v) + else: + local_connection_locations_list.append(v.to_dict()) + _dict['local_connection_locations'] = local_connection_locations_list return _dict def _to_dict(self): @@ -2789,7 +3452,7 @@ def __ne__(self, other: 'TSLocation') -> bool: return not self == other -class TSLocationBasic(): +class TSLocationBasic: """ Details of a Transit Gateway location. @@ -2800,10 +3463,12 @@ class TSLocationBasic(): region, a single data center, or a point of presence. """ - def __init__(self, - billing_location: str, - name: str, - type: str) -> None: + def __init__( + self, + billing_location: str, + name: str, + type: str, + ) -> None: """ Initialize a TSLocationBasic object. @@ -2824,18 +3489,15 @@ def from_dict(cls, _dict: Dict) -> 'TSLocationBasic': if 'billing_location' in _dict: args['billing_location'] = _dict.get('billing_location') else: - raise ValueError( - 'Required property \'billing_location\' not present in TSLocationBasic JSON') + raise ValueError('Required property \'billing_location\' not present in TSLocationBasic JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError( - 'Required property \'name\' not present in TSLocationBasic JSON') + raise ValueError('Required property \'name\' not present in TSLocationBasic JSON') if 'type' in _dict: args['type'] = _dict.get('type') else: - raise ValueError( - 'Required property \'type\' not present in TSLocationBasic JSON') + raise ValueError('Required property \'type\' not present in TSLocationBasic JSON') return cls(**args) @classmethod @@ -2873,7 +3535,7 @@ def __ne__(self, other: 'TSLocationBasic') -> bool: return not self == other -class TransitConnection(): +class TransitConnection: """ Transit gateway connection. @@ -2932,29 +3594,31 @@ class TransitConnection(): applies to network type 'gre_tunnel' connections. """ - def __init__(self, - created_at: datetime, - id: str, - name: str, - network_type: str, - prefix_filters_default: str, - status: str, - transit_gateway: 'TransitGatewayReference', - *, - base_connection_id: str = None, - local_bgp_asn: int = None, - local_gateway_ip: str = None, - local_tunnel_ip: str = None, - mtu: int = None, - network_account_id: str = None, - network_id: str = None, - prefix_filters: List['TransitGatewayConnectionPrefixFilterReference'] = None, - remote_bgp_asn: int = None, - remote_gateway_ip: str = None, - remote_tunnel_ip: str = None, - request_status: str = None, - updated_at: datetime = None, - zone: 'ZoneReference' = None) -> None: + def __init__( + self, + created_at: datetime, + id: str, + name: str, + network_type: str, + prefix_filters_default: str, + status: str, + transit_gateway: 'TransitGatewayReference', + *, + base_connection_id: str = None, + local_bgp_asn: int = None, + local_gateway_ip: str = None, + local_tunnel_ip: str = None, + mtu: int = None, + network_account_id: str = None, + network_id: str = None, + prefix_filters: List['TransitGatewayConnectionPrefixFilterReference'] = None, + remote_bgp_asn: int = None, + remote_gateway_ip: str = None, + remote_tunnel_ip: str = None, + request_status: str = None, + updated_at: datetime = None, + zone: 'ZoneReference' = None, + ) -> None: """ Initialize a TransitConnection object. @@ -3048,13 +3712,11 @@ def from_dict(cls, _dict: Dict) -> 'TransitConnection': if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError( - 'Required property \'created_at\' not present in TransitConnection JSON') + raise ValueError('Required property \'created_at\' not present in TransitConnection JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in TransitConnection JSON') + raise ValueError('Required property \'id\' not present in TransitConnection JSON') if 'local_bgp_asn' in _dict: args['local_bgp_asn'] = _dict.get('local_bgp_asn') if 'local_gateway_ip' in _dict: @@ -3066,8 +3728,7 @@ def from_dict(cls, _dict: Dict) -> 'TransitConnection': if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError( - 'Required property \'name\' not present in TransitConnection JSON') + raise ValueError('Required property \'name\' not present in TransitConnection JSON') if 'network_account_id' in _dict: args['network_account_id'] = _dict.get('network_account_id') if 'network_id' in _dict: @@ -3075,17 +3736,13 @@ def from_dict(cls, _dict: Dict) -> 'TransitConnection': if 'network_type' in _dict: args['network_type'] = _dict.get('network_type') else: - raise ValueError( - 'Required property \'network_type\' not present in TransitConnection JSON') + raise ValueError('Required property \'network_type\' not present in TransitConnection JSON') if 'prefix_filters' in _dict: - args['prefix_filters'] = [TransitGatewayConnectionPrefixFilterReference.from_dict( - x) for x in _dict.get('prefix_filters')] + args['prefix_filters'] = [TransitGatewayConnectionPrefixFilterReference.from_dict(v) for v in _dict.get('prefix_filters')] if 'prefix_filters_default' in _dict: - args['prefix_filters_default'] = _dict.get( - 'prefix_filters_default') + args['prefix_filters_default'] = _dict.get('prefix_filters_default') else: - raise ValueError( - 'Required property \'prefix_filters_default\' not present in TransitConnection JSON') + raise ValueError('Required property \'prefix_filters_default\' not present in TransitConnection JSON') if 'remote_bgp_asn' in _dict: args['remote_bgp_asn'] = _dict.get('remote_bgp_asn') if 'remote_gateway_ip' in _dict: @@ -3097,14 +3754,11 @@ def from_dict(cls, _dict: Dict) -> 'TransitConnection': if 'status' in _dict: args['status'] = _dict.get('status') else: - raise ValueError( - 'Required property \'status\' not present in TransitConnection JSON') + raise ValueError('Required property \'status\' not present in TransitConnection JSON') if 'transit_gateway' in _dict: - args['transit_gateway'] = TransitGatewayReference.from_dict( - _dict.get('transit_gateway')) + args['transit_gateway'] = TransitGatewayReference.from_dict(_dict.get('transit_gateway')) else: - raise ValueError( - 'Required property \'transit_gateway\' not present in TransitConnection JSON') + raise ValueError('Required property \'transit_gateway\' not present in TransitConnection JSON') if 'updated_at' in _dict: args['updated_at'] = string_to_datetime(_dict.get('updated_at')) if 'zone' in _dict: @@ -3142,8 +3796,13 @@ def to_dict(self) -> Dict: if hasattr(self, 'network_type') and self.network_type is not None: _dict['network_type'] = self.network_type if hasattr(self, 'prefix_filters') and self.prefix_filters is not None: - _dict['prefix_filters'] = [x.to_dict() - for x in self.prefix_filters] + prefix_filters_list = [] + for v in self.prefix_filters: + if isinstance(v, dict): + prefix_filters_list.append(v) + else: + prefix_filters_list.append(v.to_dict()) + _dict['prefix_filters'] = prefix_filters_list if hasattr(self, 'prefix_filters_default') and self.prefix_filters_default is not None: _dict['prefix_filters_default'] = self.prefix_filters_default if hasattr(self, 'remote_bgp_asn') and self.remote_bgp_asn is not None: @@ -3157,11 +3816,17 @@ def to_dict(self) -> Dict: if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status if hasattr(self, 'transit_gateway') and self.transit_gateway is not None: - _dict['transit_gateway'] = self.transit_gateway.to_dict() + if isinstance(self.transit_gateway, dict): + _dict['transit_gateway'] = self.transit_gateway + else: + _dict['transit_gateway'] = self.transit_gateway.to_dict() if hasattr(self, 'updated_at') and self.updated_at is not None: _dict['updated_at'] = datetime_to_string(self.updated_at) if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if isinstance(self.zone, dict): + _dict['zone'] = self.zone + else: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -3188,6 +3853,7 @@ class NetworkTypeEnum(str, Enum): enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ + CLASSIC = 'classic' DIRECTLINK = 'directlink' GRE_TUNNEL = 'gre_tunnel' @@ -3195,14 +3861,17 @@ class NetworkTypeEnum(str, Enum): VPC = 'vpc' POWER_VIRTUAL_SERVER = 'power_virtual_server' + class PrefixFiltersDefaultEnum(str, Enum): """ Default setting of permit or deny which applies to any routes that don't match a specified filter. """ + PERMIT = 'permit' DENY = 'deny' + class RequestStatusEnum(str, Enum): """ Only visible for cross account connections, this field represents the status of a @@ -3210,20 +3879,24 @@ class RequestStatusEnum(str, Enum): this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ + PENDING = 'pending' APPROVED = 'approved' REJECTED = 'rejected' EXPIRED = 'expired' DETACHED = 'detached' + class StatusEnum(str, Enum): """ Connection state. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ + ATTACHED = 'attached' FAILED = 'failed' PENDING = 'pending' + NETWORK_PENDING = 'network_pending' DELETING = 'deleting' DETACHING = 'detaching' DETACHED = 'detached' @@ -3231,210 +3904,93 @@ class StatusEnum(str, Enum): SUSPENDED = 'suspended' -class TransitConnectionCollection(): - """ - Transit gateway connections. - - :attr List[TransitConnection] connections: Array of transit gateway connections. - :attr TransitConnectionCollectionFirst first: A reference to the first page of - resources. - :attr int limit: The maximum number of connections returned on one request. - :attr TransitConnectionCollectionNext next: (optional) A reference to the next - page of resources; this reference is included for all pages except the last - page. - """ - - def __init__(self, - connections: List['TransitConnection'], - first: 'TransitConnectionCollectionFirst', - limit: int, - *, - next: 'TransitConnectionCollectionNext' = None) -> None: - """ - Initialize a TransitConnectionCollection object. - - :param List[TransitConnection] connections: Array of transit gateway - connections. - :param TransitConnectionCollectionFirst first: A reference to the first - page of resources. - :param int limit: The maximum number of connections returned on one - request. - :param TransitConnectionCollectionNext next: (optional) A reference to the - next page of resources; this reference is included for all pages except the - last page. - """ - self.connections = connections - self.first = first - self.limit = limit - self.next = next - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TransitConnectionCollection': - """Initialize a TransitConnectionCollection object from a json dictionary.""" - args = {} - if 'connections' in _dict: - args['connections'] = [TransitConnection.from_dict( - x) for x in _dict.get('connections')] - else: - raise ValueError( - 'Required property \'connections\' not present in TransitConnectionCollection JSON') - if 'first' in _dict: - args['first'] = TransitConnectionCollectionFirst.from_dict( - _dict.get('first')) - else: - raise ValueError( - 'Required property \'first\' not present in TransitConnectionCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError( - 'Required property \'limit\' not present in TransitConnectionCollection JSON') - if 'next' in _dict: - args['next'] = TransitConnectionCollectionNext.from_dict( - _dict.get('next')) - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TransitConnectionCollection object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'connections') and self.connections is not None: - _dict['connections'] = [x.to_dict() for x in self.connections] - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TransitConnectionCollection object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TransitConnectionCollection') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TransitConnectionCollection') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class TransitConnectionCollectionFirst(): - """ - A reference to the first page of resources. - - :attr str href: url. - """ - - def __init__(self, - href: str) -> None: - """ - Initialize a TransitConnectionCollectionFirst object. - - :param str href: url. - """ - self.href = href - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TransitConnectionCollectionFirst': - """Initialize a TransitConnectionCollectionFirst object from a json dictionary.""" - args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError( - 'Required property \'href\' not present in TransitConnectionCollectionFirst JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TransitConnectionCollectionFirst object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TransitConnectionCollectionFirst object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TransitConnectionCollectionFirst') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TransitConnectionCollectionFirst') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - -class TransitConnectionCollectionNext(): - """ - A reference to the next page of resources; this reference is included for all pages - except the last page. +class TransitConnectionCollection: + """ + Transit gateway connections. - :attr str href: (optional) url. - :attr str start: (optional) server generated start token for next page of + :attr List[TransitConnection] connections: Array of transit gateway connections. + :attr PaginationFirstConnection first: A reference to the first page of resources. + :attr int limit: The maximum number of connections returned on one request. + :attr PaginationNextConnection next: (optional) A reference to the next page of + resources; this reference is included for all pages except the last page. """ - def __init__(self, - *, - href: str = None, - start: str = None) -> None: + def __init__( + self, + connections: List['TransitConnection'], + first: 'PaginationFirstConnection', + limit: int, + *, + next: 'PaginationNextConnection' = None, + ) -> None: """ - Initialize a TransitConnectionCollectionNext object. + Initialize a TransitConnectionCollection object. - :param str href: (optional) url. - :param str start: (optional) server generated start token for next page of + :param List[TransitConnection] connections: Array of transit gateway + connections. + :param PaginationFirstConnection first: A reference to the first page of resources. + :param int limit: The maximum number of connections returned on one + request. + :param PaginationNextConnection next: (optional) A reference to the next + page of resources; this reference is included for all pages except the last + page. """ - self.href = href - self.start = start + self.connections = connections + self.first = first + self.limit = limit + self.next = next @classmethod - def from_dict(cls, _dict: Dict) -> 'TransitConnectionCollectionNext': - """Initialize a TransitConnectionCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'TransitConnectionCollection': + """Initialize a TransitConnectionCollection object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - if 'start' in _dict: - args['start'] = _dict.get('start') + if 'connections' in _dict: + args['connections'] = [TransitConnection.from_dict(v) for v in _dict.get('connections')] + else: + raise ValueError('Required property \'connections\' not present in TransitConnectionCollection JSON') + if 'first' in _dict: + args['first'] = PaginationFirstConnection.from_dict(_dict.get('first')) + else: + raise ValueError('Required property \'first\' not present in TransitConnectionCollection JSON') + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + else: + raise ValueError('Required property \'limit\' not present in TransitConnectionCollection JSON') + if 'next' in _dict: + args['next'] = PaginationNextConnection.from_dict(_dict.get('next')) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a TransitConnectionCollectionNext object from a json dictionary.""" + """Initialize a TransitConnectionCollection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'start') and self.start is not None: - _dict['start'] = self.start + if hasattr(self, 'connections') and self.connections is not None: + connections_list = [] + for v in self.connections: + if isinstance(v, dict): + connections_list.append(v) + else: + connections_list.append(v.to_dict()) + _dict['connections'] = connections_list + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() return _dict def _to_dict(self): @@ -3442,21 +3998,21 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this TransitConnectionCollectionNext object.""" + """Return a `str` version of this TransitConnectionCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'TransitConnectionCollectionNext') -> bool: + def __eq__(self, other: 'TransitConnectionCollection') -> bool: """Return `true` when self and other are equal, false otherwise.""" if not isinstance(other, self.__class__): return False return self.__dict__ == other.__dict__ - def __ne__(self, other: 'TransitConnectionCollectionNext') -> bool: + def __ne__(self, other: 'TransitConnectionCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class TransitGateway(): +class TransitGateway: """ Details of a Transit Gateway. @@ -3477,17 +4033,19 @@ class TransitGateway(): last updated. """ - def __init__(self, - id: str, - crn: str, - name: str, - location: str, - created_at: datetime, - global_: bool, - status: str, - *, - resource_group: 'ResourceGroupReference' = None, - updated_at: datetime = None) -> None: + def __init__( + self, + id: str, + crn: str, + name: str, + location: str, + created_at: datetime, + global_: bool, + status: str, + *, + resource_group: 'ResourceGroupReference' = None, + updated_at: datetime = None, + ) -> None: """ Initialize a TransitGateway object. @@ -3525,41 +4083,33 @@ def from_dict(cls, _dict: Dict) -> 'TransitGateway': if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in TransitGateway JSON') + raise ValueError('Required property \'id\' not present in TransitGateway JSON') if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError( - 'Required property \'crn\' not present in TransitGateway JSON') + raise ValueError('Required property \'crn\' not present in TransitGateway JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError( - 'Required property \'name\' not present in TransitGateway JSON') + raise ValueError('Required property \'name\' not present in TransitGateway JSON') if 'location' in _dict: args['location'] = _dict.get('location') else: - raise ValueError( - 'Required property \'location\' not present in TransitGateway JSON') + raise ValueError('Required property \'location\' not present in TransitGateway JSON') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError( - 'Required property \'created_at\' not present in TransitGateway JSON') + raise ValueError('Required property \'created_at\' not present in TransitGateway JSON') if 'global' in _dict: args['global_'] = _dict.get('global') else: - raise ValueError( - 'Required property \'global\' not present in TransitGateway JSON') + raise ValueError('Required property \'global\' not present in TransitGateway JSON') if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict( - _dict.get('resource_group')) + args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) if 'status' in _dict: args['status'] = _dict.get('status') else: - raise ValueError( - 'Required property \'status\' not present in TransitGateway JSON') + raise ValueError('Required property \'status\' not present in TransitGateway JSON') if 'updated_at' in _dict: args['updated_at'] = string_to_datetime(_dict.get('updated_at')) return cls(**args) @@ -3585,7 +4135,10 @@ def to_dict(self) -> Dict: if hasattr(self, 'global_') and self.global_ is not None: _dict['global'] = self.global_ if hasattr(self, 'resource_group') and self.resource_group is not None: - _dict['resource_group'] = self.resource_group.to_dict() + if isinstance(self.resource_group, dict): + _dict['resource_group'] = self.resource_group + else: + _dict['resource_group'] = self.resource_group.to_dict() if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status if hasattr(self, 'updated_at') and self.updated_at is not None: @@ -3616,6 +4169,7 @@ class StatusEnum(str, Enum): may expand in the future. Code and processes using this field must tolerate unexpected values. """ + AVAILABLE = 'available' FAILED = 'failed' PENDING = 'pending' @@ -3624,36 +4178,36 @@ class StatusEnum(str, Enum): SUSPENDED = 'suspended' -class TransitGatewayCollection(): + +class TransitGatewayCollection: """ A list of Transit Gateways. - :attr TransitGatewayCollectionFirst first: A reference to the first page of - resources. + :attr PaginationFirstTG first: A reference to the first page of resources. :attr int limit: The maximum number of gateways returned on one request. - :attr TransitGatewayCollectionNext next: (optional) A reference to the next page - of resources; this reference is included for all pages except the last page. + :attr PaginationNextTG next: (optional) A reference to the next page of + resources; this reference is included for all pages except the last page. :attr List[TransitGateway] transit_gateways: Collection of Transit Services gateways. """ - def __init__(self, - first: 'TransitGatewayCollectionFirst', - limit: int, - transit_gateways: List['TransitGateway'], - *, - next: 'TransitGatewayCollectionNext' = None) -> None: + def __init__( + self, + first: 'PaginationFirstTG', + limit: int, + transit_gateways: List['TransitGateway'], + *, + next: 'PaginationNextTG' = None, + ) -> None: """ Initialize a TransitGatewayCollection object. - :param TransitGatewayCollectionFirst first: A reference to the first page - of resources. + :param PaginationFirstTG first: A reference to the first page of resources. :param int limit: The maximum number of gateways returned on one request. :param List[TransitGateway] transit_gateways: Collection of Transit Services gateways. - :param TransitGatewayCollectionNext next: (optional) A reference to the - next page of resources; this reference is included for all pages except the - last page. + :param PaginationNextTG next: (optional) A reference to the next page of + resources; this reference is included for all pages except the last page. """ self.first = first self.limit = limit @@ -3665,25 +4219,19 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayCollection': """Initialize a TransitGatewayCollection object from a json dictionary.""" args = {} if 'first' in _dict: - args['first'] = TransitGatewayCollectionFirst.from_dict( - _dict.get('first')) + args['first'] = PaginationFirstTG.from_dict(_dict.get('first')) else: - raise ValueError( - 'Required property \'first\' not present in TransitGatewayCollection JSON') + raise ValueError('Required property \'first\' not present in TransitGatewayCollection JSON') if 'limit' in _dict: args['limit'] = _dict.get('limit') else: - raise ValueError( - 'Required property \'limit\' not present in TransitGatewayCollection JSON') + raise ValueError('Required property \'limit\' not present in TransitGatewayCollection JSON') if 'next' in _dict: - args['next'] = TransitGatewayCollectionNext.from_dict( - _dict.get('next')) + args['next'] = PaginationNextTG.from_dict(_dict.get('next')) if 'transit_gateways' in _dict: - args['transit_gateways'] = [TransitGateway.from_dict( - x) for x in _dict.get('transit_gateways')] + args['transit_gateways'] = [TransitGateway.from_dict(v) for v in _dict.get('transit_gateways')] else: - raise ValueError( - 'Required property \'transit_gateways\' not present in TransitGatewayCollection JSON') + raise ValueError('Required property \'transit_gateways\' not present in TransitGatewayCollection JSON') return cls(**args) @classmethod @@ -3695,14 +4243,25 @@ def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first.to_dict() + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next.to_dict() + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() if hasattr(self, 'transit_gateways') and self.transit_gateways is not None: - _dict['transit_gateways'] = [x.to_dict() - for x in self.transit_gateways] + transit_gateways_list = [] + for v in self.transit_gateways: + if isinstance(v, dict): + transit_gateways_list.append(v) + else: + transit_gateways_list.append(v.to_dict()) + _dict['transit_gateways'] = transit_gateways_list return _dict def _to_dict(self): @@ -3724,162 +4283,74 @@ def __ne__(self, other: 'TransitGatewayCollection') -> bool: return not self == other -class TransitGatewayCollectionFirst(): - """ - A reference to the first page of resources. - - :attr str href: url. - """ - - def __init__(self, - href: str) -> None: - """ - Initialize a TransitGatewayCollectionFirst object. - - :param str href: url. - """ - self.href = href - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TransitGatewayCollectionFirst': - """Initialize a TransitGatewayCollectionFirst object from a json dictionary.""" - args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError( - 'Required property \'href\' not present in TransitGatewayCollectionFirst JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TransitGatewayCollectionFirst object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TransitGatewayCollectionFirst object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TransitGatewayCollectionFirst') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TransitGatewayCollectionFirst') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class TransitGatewayCollectionNext(): - """ - A reference to the next page of resources; this reference is included for all pages - except the last page. - - :attr str href: url. - :attr str start: server generated start token for next page of resources. - """ - - def __init__(self, - href: str, - start: str) -> None: - """ - Initialize a TransitGatewayCollectionNext object. - - :param str href: url. - :param str start: server generated start token for next page of resources. - """ - self.href = href - self.start = start - - @classmethod - def from_dict(cls, _dict: Dict) -> 'TransitGatewayCollectionNext': - """Initialize a TransitGatewayCollectionNext object from a json dictionary.""" - args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError( - 'Required property \'href\' not present in TransitGatewayCollectionNext JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') - else: - raise ValueError( - 'Required property \'start\' not present in TransitGatewayCollectionNext JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a TransitGatewayCollectionNext object from a json dictionary.""" - return cls.from_dict(_dict) - - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'start') and self.start is not None: - _dict['start'] = self.start - return _dict - - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() - - def __str__(self) -> str: - """Return a `str` version of this TransitGatewayCollectionNext object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'TransitGatewayCollectionNext') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ - - def __ne__(self, other: 'TransitGatewayCollectionNext') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class TransitGatewayConnectionCollection(): +class TransitGatewayConnectionCollection: """ A set of Transit Gateway network connections. :attr List[TransitGatewayConnectionCust] connections: Array of transit gateways network Connections. + :attr PaginationFirstTGWConnection first: (optional) A reference to the first + page of resources. + This will be returned when number of connections in response are greater than + max page limit. + :attr int limit: (optional) The maximum number of connections returned on one + request. This will be returned when number of connections in response are + greater than max page limit. + :attr PaginationNextTGWConnection next: (optional) A reference to the next page + of resources; this reference is included for all pages except the last page. + :attr int total_count: (optional) total number of resources across all pages + (considering the supplied query parameter filters). """ - def __init__(self, - connections: List['TransitGatewayConnectionCust']) -> None: + def __init__( + self, + connections: List['TransitGatewayConnectionCust'], + *, + first: 'PaginationFirstTGWConnection' = None, + limit: int = None, + next: 'PaginationNextTGWConnection' = None, + total_count: int = None, + ) -> None: """ Initialize a TransitGatewayConnectionCollection object. :param List[TransitGatewayConnectionCust] connections: Array of transit gateways network Connections. + :param PaginationFirstTGWConnection first: (optional) A reference to the + first page of resources. + This will be returned when number of connections in response are greater + than max page limit. + :param int limit: (optional) The maximum number of connections returned on + one request. This will be returned when number of connections in response + are greater than max page limit. + :param PaginationNextTGWConnection next: (optional) A reference to the next + page of resources; this reference is included for all pages except the last + page. + :param int total_count: (optional) total number of resources across all + pages (considering the supplied query parameter filters). """ self.connections = connections + self.first = first + self.limit = limit + self.next = next + self.total_count = total_count @classmethod def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionCollection': """Initialize a TransitGatewayConnectionCollection object from a json dictionary.""" args = {} if 'connections' in _dict: - args['connections'] = [TransitGatewayConnectionCust.from_dict( - x) for x in _dict.get('connections')] + args['connections'] = [TransitGatewayConnectionCust.from_dict(v) for v in _dict.get('connections')] else: - raise ValueError( - 'Required property \'connections\' not present in TransitGatewayConnectionCollection JSON') + raise ValueError('Required property \'connections\' not present in TransitGatewayConnectionCollection JSON') + if 'first' in _dict: + args['first'] = PaginationFirstTGWConnection.from_dict(_dict.get('first')) + if 'limit' in _dict: + args['limit'] = _dict.get('limit') + if 'next' in _dict: + args['next'] = PaginationNextTGWConnection.from_dict(_dict.get('next')) + if 'total_count' in _dict: + args['total_count'] = _dict.get('total_count') return cls(**args) @classmethod @@ -3891,7 +4362,27 @@ def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} if hasattr(self, 'connections') and self.connections is not None: - _dict['connections'] = [x.to_dict() for x in self.connections] + connections_list = [] + for v in self.connections: + if isinstance(v, dict): + connections_list.append(v) + else: + connections_list.append(v.to_dict()) + _dict['connections'] = connections_list + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count return _dict def _to_dict(self): @@ -3913,7 +4404,7 @@ def __ne__(self, other: 'TransitGatewayConnectionCollection') -> bool: return not self == other -class TransitGatewayConnectionCust(): +class TransitGatewayConnectionCust: """ Connection included in transit gateway. @@ -3929,12 +4420,13 @@ class TransitGatewayConnectionCust(): connection. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. :attr str id: The unique identifier for this Transit Gateway Connection. - :attr str base_connection_id: (optional) network_type 'gre_tunnel' connections - use 'base_connection_id' to specify the ID of a network_type 'classic' - connection the tunnel is configured over. The specified connection must reside - in the same transit gateway and be in an active state. The 'classic' connection - cannot be deleted until any 'gre_tunnel' connections using it are deleted. This - field only applies to and is required for network type 'gre_tunnel' connections. + :attr str base_connection_id: (optional) Deprecated: network_type 'gre_tunnel' + connections use 'base_connection_id' to specify the ID of a network_type + 'classic' connection the tunnel is configured over. The specified connection + must reside in the same transit gateway and be in an active state. The 'classic' + connection cannot be deleted until any 'gre_tunnel' connections using it are + deleted. This field only applies to and is required for network type + 'gre_tunnel' connections. :attr datetime created_at: The date and time that this connection was created. :attr int local_bgp_asn: (optional) Local network BGP ASN. This field only applies to network type 'gre_tunnel' and 'unbound_gre_tunnel' connections. @@ -3973,29 +4465,31 @@ class TransitGatewayConnectionCust(): connections. """ - def __init__(self, - name: str, - network_type: str, - id: str, - created_at: datetime, - prefix_filters_default: str, - *, - base_network_type: str = None, - network_id: str = None, - base_connection_id: str = None, - local_bgp_asn: int = None, - local_gateway_ip: str = None, - local_tunnel_ip: str = None, - mtu: int = None, - network_account_id: str = None, - prefix_filters: List['TransitGatewayConnectionPrefixFilterReference'] = None, - remote_bgp_asn: int = None, - remote_gateway_ip: str = None, - remote_tunnel_ip: str = None, - request_status: str = None, - status: str = None, - updated_at: datetime = None, - zone: 'TransitGatewayConnectionCustZone' = None) -> None: + def __init__( + self, + name: str, + network_type: str, + id: str, + created_at: datetime, + prefix_filters_default: str, + *, + base_network_type: str = None, + network_id: str = None, + base_connection_id: str = None, + local_bgp_asn: int = None, + local_gateway_ip: str = None, + local_tunnel_ip: str = None, + mtu: int = None, + network_account_id: str = None, + prefix_filters: List['TransitGatewayConnectionPrefixFilterReference'] = None, + remote_bgp_asn: int = None, + remote_gateway_ip: str = None, + remote_tunnel_ip: str = None, + request_status: str = None, + status: str = None, + updated_at: datetime = None, + zone: 'TransitGatewayConnectionCustZone' = None, + ) -> None: """ Initialize a TransitGatewayConnectionCust object. @@ -4016,13 +4510,13 @@ def __init__(self, 'power_virtual_server' and 'directlink'. For network types 'vpc','power_virtual_server' and 'directlink' this is the CRN of the VPC / PowerVS / Direct Link gateway respectively. - :param str base_connection_id: (optional) network_type 'gre_tunnel' - connections use 'base_connection_id' to specify the ID of a network_type - 'classic' connection the tunnel is configured over. The specified - connection must reside in the same transit gateway and be in an active - state. The 'classic' connection cannot be deleted until any 'gre_tunnel' - connections using it are deleted. This field only applies to and is - required for network type 'gre_tunnel' connections. + :param str base_connection_id: (optional) Deprecated: network_type + 'gre_tunnel' connections use 'base_connection_id' to specify the ID of a + network_type 'classic' connection the tunnel is configured over. The + specified connection must reside in the same transit gateway and be in an + active state. The 'classic' connection cannot be deleted until any + 'gre_tunnel' connections using it are deleted. This field only applies to + and is required for network type 'gre_tunnel' connections. :param int local_bgp_asn: (optional) Local network BGP ASN. This field only applies to network type 'gre_tunnel' and 'unbound_gre_tunnel' connections. @@ -4096,27 +4590,23 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionCust': if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError( - 'Required property \'name\' not present in TransitGatewayConnectionCust JSON') + raise ValueError('Required property \'name\' not present in TransitGatewayConnectionCust JSON') if 'network_id' in _dict: args['network_id'] = _dict.get('network_id') if 'network_type' in _dict: args['network_type'] = _dict.get('network_type') else: - raise ValueError( - 'Required property \'network_type\' not present in TransitGatewayConnectionCust JSON') + raise ValueError('Required property \'network_type\' not present in TransitGatewayConnectionCust JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in TransitGatewayConnectionCust JSON') + raise ValueError('Required property \'id\' not present in TransitGatewayConnectionCust JSON') if 'base_connection_id' in _dict: args['base_connection_id'] = _dict.get('base_connection_id') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError( - 'Required property \'created_at\' not present in TransitGatewayConnectionCust JSON') + raise ValueError('Required property \'created_at\' not present in TransitGatewayConnectionCust JSON') if 'local_bgp_asn' in _dict: args['local_bgp_asn'] = _dict.get('local_bgp_asn') if 'local_gateway_ip' in _dict: @@ -4128,14 +4618,11 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionCust': if 'network_account_id' in _dict: args['network_account_id'] = _dict.get('network_account_id') if 'prefix_filters' in _dict: - args['prefix_filters'] = [TransitGatewayConnectionPrefixFilterReference.from_dict( - x) for x in _dict.get('prefix_filters')] + args['prefix_filters'] = [TransitGatewayConnectionPrefixFilterReference.from_dict(v) for v in _dict.get('prefix_filters')] if 'prefix_filters_default' in _dict: - args['prefix_filters_default'] = _dict.get( - 'prefix_filters_default') + args['prefix_filters_default'] = _dict.get('prefix_filters_default') else: - raise ValueError( - 'Required property \'prefix_filters_default\' not present in TransitGatewayConnectionCust JSON') + raise ValueError('Required property \'prefix_filters_default\' not present in TransitGatewayConnectionCust JSON') if 'remote_bgp_asn' in _dict: args['remote_bgp_asn'] = _dict.get('remote_bgp_asn') if 'remote_gateway_ip' in _dict: @@ -4149,8 +4636,7 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionCust': if 'updated_at' in _dict: args['updated_at'] = string_to_datetime(_dict.get('updated_at')) if 'zone' in _dict: - args['zone'] = TransitGatewayConnectionCustZone.from_dict( - _dict.get('zone')) + args['zone'] = TransitGatewayConnectionCustZone.from_dict(_dict.get('zone')) return cls(**args) @classmethod @@ -4186,8 +4672,13 @@ def to_dict(self) -> Dict: if hasattr(self, 'network_account_id') and self.network_account_id is not None: _dict['network_account_id'] = self.network_account_id if hasattr(self, 'prefix_filters') and self.prefix_filters is not None: - _dict['prefix_filters'] = [x.to_dict() - for x in self.prefix_filters] + prefix_filters_list = [] + for v in self.prefix_filters: + if isinstance(v, dict): + prefix_filters_list.append(v) + else: + prefix_filters_list.append(v.to_dict()) + _dict['prefix_filters'] = prefix_filters_list if hasattr(self, 'prefix_filters_default') and self.prefix_filters_default is not None: _dict['prefix_filters_default'] = self.prefix_filters_default if hasattr(self, 'remote_bgp_asn') and self.remote_bgp_asn is not None: @@ -4203,7 +4694,10 @@ def to_dict(self) -> Dict: if hasattr(self, 'updated_at') and self.updated_at is not None: _dict['updated_at'] = datetime_to_string(self.updated_at) if hasattr(self, 'zone') and self.zone is not None: - _dict['zone'] = self.zone.to_dict() + if isinstance(self.zone, dict): + _dict['zone'] = self.zone + else: + _dict['zone'] = self.zone.to_dict() return _dict def _to_dict(self): @@ -4228,14 +4722,17 @@ class BaseNetworkTypeEnum(str, Enum): """ The type of network the GRE tunnel is targeting. """ + CLASSIC = 'classic' + class NetworkTypeEnum(str, Enum): """ Defines what type of network is connected via this connection. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ + CLASSIC = 'classic' DIRECTLINK = 'directlink' GRE_TUNNEL = 'gre_tunnel' @@ -4243,14 +4740,17 @@ class NetworkTypeEnum(str, Enum): VPC = 'vpc' POWER_VIRTUAL_SERVER = 'power_virtual_server' + class PrefixFiltersDefaultEnum(str, Enum): """ Default setting of permit or deny which applies to any routes that don't match a specified filter. """ + PERMIT = 'permit' DENY = 'deny' + class RequestStatusEnum(str, Enum): """ Only visible for cross account connections, this field represents the status of a @@ -4258,21 +4758,25 @@ class RequestStatusEnum(str, Enum): this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ + PENDING = 'pending' APPROVED = 'approved' REJECTED = 'rejected' EXPIRED = 'expired' DETACHED = 'detached' + class StatusEnum(str, Enum): """ Connection's current configuration state. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ + ATTACHED = 'attached' FAILED = 'failed' PENDING = 'pending' + NETWORK_PENDING = 'network_pending' DELETING = 'deleting' DETACHING = 'detaching' DETACHED = 'detached' @@ -4280,7 +4784,8 @@ class StatusEnum(str, Enum): SUSPENDED = 'suspended' -class TransitGatewayConnectionCustZone(): + +class TransitGatewayConnectionCustZone: """ Location of GRE tunnel. This field only applies to network type 'gre_tunnel' and 'unbound_gre_tunnel' connections. @@ -4288,8 +4793,10 @@ class TransitGatewayConnectionCustZone(): :attr str name: Availability zone name. """ - def __init__(self, - name: str) -> None: + def __init__( + self, + name: str, + ) -> None: """ Initialize a TransitGatewayConnectionCustZone object. @@ -4304,8 +4811,7 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionCustZone': if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError( - 'Required property \'name\' not present in TransitGatewayConnectionCustZone JSON') + raise ValueError('Required property \'name\' not present in TransitGatewayConnectionCustZone JSON') return cls(**args) @classmethod @@ -4339,7 +4845,7 @@ def __ne__(self, other: 'TransitGatewayConnectionCustZone') -> bool: return not self == other -class TransitGatewayConnectionPrefixFilter(): +class TransitGatewayConnectionPrefixFilter: """ A prefix filter for a Transit Gateway connection. @@ -4349,12 +4855,14 @@ class TransitGatewayConnectionPrefixFilter(): :attr str prefix: IP Prefix. """ - def __init__(self, - action: str, - prefix: str, - *, - ge: int = None, - le: int = None) -> None: + def __init__( + self, + action: str, + prefix: str, + *, + ge: int = None, + le: int = None, + ) -> None: """ Initialize a TransitGatewayConnectionPrefixFilter object. @@ -4375,8 +4883,7 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionPrefixFilter': if 'action' in _dict: args['action'] = _dict.get('action') else: - raise ValueError( - 'Required property \'action\' not present in TransitGatewayConnectionPrefixFilter JSON') + raise ValueError('Required property \'action\' not present in TransitGatewayConnectionPrefixFilter JSON') if 'ge' in _dict: args['ge'] = _dict.get('ge') if 'le' in _dict: @@ -4384,8 +4891,7 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionPrefixFilter': if 'prefix' in _dict: args['prefix'] = _dict.get('prefix') else: - raise ValueError( - 'Required property \'prefix\' not present in TransitGatewayConnectionPrefixFilter JSON') + raise ValueError('Required property \'prefix\' not present in TransitGatewayConnectionPrefixFilter JSON') return cls(**args) @classmethod @@ -4428,11 +4934,13 @@ class ActionEnum(str, Enum): """ Whether to permit or deny prefix filter. """ + PERMIT = 'permit' DENY = 'deny' -class TransitGatewayConnectionPrefixFilterReference(): + +class TransitGatewayConnectionPrefixFilterReference: """ A prefix filter reference object for a Transit Gateway connection. @@ -4465,16 +4973,18 @@ class TransitGatewayConnectionPrefixFilterReference(): was last updated. """ - def __init__(self, - action: str, - created_at: datetime, - id: str, - prefix: str, - *, - before: str = None, - ge: int = None, - le: int = None, - updated_at: datetime = None) -> None: + def __init__( + self, + action: str, + created_at: datetime, + id: str, + prefix: str, + *, + before: str = None, + ge: int = None, + le: int = None, + updated_at: datetime = None, + ) -> None: """ Initialize a TransitGatewayConnectionPrefixFilterReference object. @@ -4522,29 +5032,25 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionPrefixFilterReferenc if 'action' in _dict: args['action'] = _dict.get('action') else: - raise ValueError( - 'Required property \'action\' not present in TransitGatewayConnectionPrefixFilterReference JSON') + raise ValueError('Required property \'action\' not present in TransitGatewayConnectionPrefixFilterReference JSON') if 'before' in _dict: args['before'] = _dict.get('before') if 'created_at' in _dict: args['created_at'] = string_to_datetime(_dict.get('created_at')) else: - raise ValueError( - 'Required property \'created_at\' not present in TransitGatewayConnectionPrefixFilterReference JSON') + raise ValueError('Required property \'created_at\' not present in TransitGatewayConnectionPrefixFilterReference JSON') if 'ge' in _dict: args['ge'] = _dict.get('ge') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in TransitGatewayConnectionPrefixFilterReference JSON') + raise ValueError('Required property \'id\' not present in TransitGatewayConnectionPrefixFilterReference JSON') if 'le' in _dict: args['le'] = _dict.get('le') if 'prefix' in _dict: args['prefix'] = _dict.get('prefix') else: - raise ValueError( - 'Required property \'prefix\' not present in TransitGatewayConnectionPrefixFilterReference JSON') + raise ValueError('Required property \'prefix\' not present in TransitGatewayConnectionPrefixFilterReference JSON') if 'updated_at' in _dict: args['updated_at'] = string_to_datetime(_dict.get('updated_at')) return cls(**args) @@ -4597,11 +5103,13 @@ class ActionEnum(str, Enum): """ Whether to permit or deny prefix filter. """ + PERMIT = 'permit' DENY = 'deny' -class TransitGatewayReference(): + +class TransitGatewayReference: """ Transit gateway reference. @@ -4610,10 +5118,12 @@ class TransitGatewayReference(): :attr str name: transit gateway name. """ - def __init__(self, - crn: str, - id: str, - name: str) -> None: + def __init__( + self, + crn: str, + id: str, + name: str, + ) -> None: """ Initialize a TransitGatewayReference object. @@ -4632,18 +5142,15 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayReference': if 'crn' in _dict: args['crn'] = _dict.get('crn') else: - raise ValueError( - 'Required property \'crn\' not present in TransitGatewayReference JSON') + raise ValueError('Required property \'crn\' not present in TransitGatewayReference JSON') if 'id' in _dict: args['id'] = _dict.get('id') else: - raise ValueError( - 'Required property \'id\' not present in TransitGatewayReference JSON') + raise ValueError('Required property \'id\' not present in TransitGatewayReference JSON') if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError( - 'Required property \'name\' not present in TransitGatewayReference JSON') + raise ValueError('Required property \'name\' not present in TransitGatewayReference JSON') return cls(**args) @classmethod @@ -4681,31 +5188,36 @@ def __ne__(self, other: 'TransitGatewayReference') -> bool: return not self == other -class ZoneIdentity(): +class ZoneIdentity: """ ZoneIdentity. """ - def __init__(self) -> None: + def __init__( + self, + ) -> None: """ Initialize a ZoneIdentity object. """ msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['ZoneIdentityByName'])) + ", ".join(['ZoneIdentityByName']) + ) raise Exception(msg) -class ZoneReference(): +class ZoneReference: """ Availability zone reference. :attr str name: Availability zone name. """ - def __init__(self, - name: str) -> None: + def __init__( + self, + name: str, + ) -> None: """ Initialize a ZoneReference object. @@ -4720,8 +5232,7 @@ def from_dict(cls, _dict: Dict) -> 'ZoneReference': if 'name' in _dict: args['name'] = _dict.get('name') else: - raise ValueError( - 'Required property \'name\' not present in ZoneReference JSON') + raise ValueError('Required property \'name\' not present in ZoneReference JSON') return cls(**args) @classmethod @@ -4762,9 +5273,11 @@ class ZoneIdentityByName(ZoneIdentity): :attr str name: (optional) Availability zone name. """ - def __init__(self, - *, - name: str = None) -> None: + def __init__( + self, + *, + name: str = None, + ) -> None: """ Initialize a ZoneIdentityByName object. @@ -4810,3 +5323,215 @@ def __eq__(self, other: 'ZoneIdentityByName') -> bool: def __ne__(self, other: 'ZoneIdentityByName') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + +############################################################################## +# Pagers +############################################################################## + + +class TransitGatewaysPager: + """ + TransitGatewaysPager can be used to simplify the use of the "list_transit_gateways" method. + """ + + def __init__( + self, + *, + client: TransitGatewayApisV1, + limit: int = None, + ) -> None: + """ + Initialize a TransitGatewaysPager object. + :param int limit: (optional) The maximum number of resources to return per + page. + """ + self._has_next = True + self._client = client + self._page_context = {'next': None} + self._limit = limit + + def has_next(self) -> bool: + """ + Returns true if there are potentially more results to be retrieved. + """ + return self._has_next + + def get_next(self) -> List[dict]: + """ + Returns the next page of results. + :return: A List[dict], where each element is a dict that represents an instance of TransitGateway. + :rtype: List[dict] + """ + if not self.has_next(): + raise StopIteration(message='No more results available') + + result = self._client.list_transit_gateways( + limit=self._limit, + start=self._page_context.get('next'), + ).get_result() + + next = None + next_page_link = result.get('next') + if next_page_link is not None: + next = next_page_link.get('start') + self._page_context['next'] = next + if next is None: + self._has_next = False + + return result.get('transit_gateways') + + def get_all(self) -> List[dict]: + """ + Returns all results by invoking get_next() repeatedly + until all pages of results have been retrieved. + :return: A List[dict], where each element is a dict that represents an instance of TransitGateway. + :rtype: List[dict] + """ + results = [] + while self.has_next(): + next_page = self.get_next() + results.extend(next_page) + return results + + +class ConnectionsPager: + """ + ConnectionsPager can be used to simplify the use of the "list_connections" method. + """ + + def __init__( + self, + *, + client: TransitGatewayApisV1, + limit: int = None, + network_id: str = None, + ) -> None: + """ + Initialize a ConnectionsPager object. + :param int limit: (optional) The maximum number of resources to return per + page. + :param str network_id: (optional) Search for connections with the given + network_id value. + """ + self._has_next = True + self._client = client + self._page_context = {'next': None} + self._limit = limit + self._network_id = network_id + + def has_next(self) -> bool: + """ + Returns true if there are potentially more results to be retrieved. + """ + return self._has_next + + def get_next(self) -> List[dict]: + """ + Returns the next page of results. + :return: A List[dict], where each element is a dict that represents an instance of TransitConnection. + :rtype: List[dict] + """ + if not self.has_next(): + raise StopIteration(message='No more results available') + + result = self._client.list_connections( + limit=self._limit, + network_id=self._network_id, + start=self._page_context.get('next'), + ).get_result() + + next = None + next_page_link = result.get('next') + if next_page_link is not None: + next = next_page_link.get('start') + self._page_context['next'] = next + if next is None: + self._has_next = False + + return result.get('connections') + + def get_all(self) -> List[dict]: + """ + Returns all results by invoking get_next() repeatedly + until all pages of results have been retrieved. + :return: A List[dict], where each element is a dict that represents an instance of TransitConnection. + :rtype: List[dict] + """ + results = [] + while self.has_next(): + next_page = self.get_next() + results.extend(next_page) + return results + + +class TransitGatewayConnectionsPager: + """ + TransitGatewayConnectionsPager can be used to simplify the use of the "list_transit_gateway_connections" method. + """ + + def __init__( + self, + *, + client: TransitGatewayApisV1, + transit_gateway_id: str, + limit: int = None, + name: str = None, + ) -> None: + """ + Initialize a TransitGatewayConnectionsPager object. + :param str transit_gateway_id: The Transit Gateway identifier. + :param int limit: (optional) The maximum number of resources to return per + page. + :param str name: (optional) Search for connections with the given name. + """ + self._has_next = True + self._client = client + self._page_context = {'next': None} + self._transit_gateway_id = transit_gateway_id + self._limit = limit + self._name = name + + def has_next(self) -> bool: + """ + Returns true if there are potentially more results to be retrieved. + """ + return self._has_next + + def get_next(self) -> List[dict]: + """ + Returns the next page of results. + :return: A List[dict], where each element is a dict that represents an instance of TransitGatewayConnectionCust. + :rtype: List[dict] + """ + if not self.has_next(): + raise StopIteration(message='No more results available') + + result = self._client.list_transit_gateway_connections( + transit_gateway_id=self._transit_gateway_id, + limit=self._limit, + name=self._name, + start=self._page_context.get('next'), + ).get_result() + + next = None + next_page_link = result.get('next') + if next_page_link is not None: + next = next_page_link.get('start') + self._page_context['next'] = next + if next is None: + self._has_next = False + + return result.get('connections') + + def get_all(self) -> List[dict]: + """ + Returns all results by invoking get_next() repeatedly + until all pages of results have been retrieved. + :return: A List[dict], where each element is a dict that represents an instance of TransitGatewayConnectionCust. + :rtype: List[dict] + """ + results = [] + while self.has_next(): + next_page = self.get_next() + results.extend(next_page) + return results diff --git a/test/unit/test_transit_gateway_apis_v1.py b/test/unit/test_transit_gateway_apis_v1.py index 90d1c90..8f5b6a8 100644 --- a/test/unit/test_transit_gateway_apis_v1.py +++ b/test/unit/test_transit_gateway_apis_v1.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# (C) Copyright IBM Corp. 2022. +# (C) Copyright IBM Corp. 2023. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -34,18 +34,46 @@ _service = TransitGatewayApisV1( authenticator=NoAuthAuthenticator(), - version=version + version=version, ) _base_url = 'https://transit.cloud.ibm.com/v1' _service.set_service_url(_base_url) + +def preprocess_url(operation_path: str): + """ + Returns the request url associated with the specified operation path. + This will be base_url concatenated with a quoted version of operation_path. + The returned request URL is used to register the mock response so it needs + to match the request URL that is formed by the requests library. + """ + # First, unquote the path since it might have some quoted/escaped characters in it + # due to how the generator inserts the operation paths into the unit test code. + operation_path = urllib.parse.unquote(operation_path) + + # Next, quote the path using urllib so that we approximate what will + # happen during request processing. + operation_path = urllib.parse.quote(operation_path, safe='/') + + # Finally, form the request URL from the base URL and operation path. + request_url = _base_url + operation_path + + # If the request url does NOT end with a /, then just return it as-is. + # Otherwise, return a regular expression that matches one or more trailing /. + if re.fullmatch('.*/+', request_url) is None: + return request_url + else: + return re.compile(request_url.rstrip('/') + '/+') + + ############################################################################## # Start of Service: TransitGateways ############################################################################## # region -class TestNewInstance(): + +class TestNewInstance: """ Test Class for new_instance """ @@ -89,52 +117,45 @@ def test_new_instance_required_param_none(self): service = TransitGatewayApisV1.new_instance( version=None, ) -class TestListTransitGateways(): + + +class TestListTransitGateways: """ Test Class for list_transit_gateways """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_list_transit_gateways_all_params(self): """ list_transit_gateways() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways') + url = preprocess_url('/transit_gateways') mock_response = '{"first": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}, "transit_gateways": [{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values - limit = 1 + limit = 50 start = 'testString' # Invoke method response = _service.list_transit_gateways( limit=limit, start=start, - headers={} + headers={}, ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = responses.calls[0].request.url.split('?', 1)[1] query_string = urllib.parse.unquote_plus(query_string) assert 'limit={}'.format(limit) in query_string assert 'start={}'.format(start) in query_string @@ -154,18 +175,19 @@ def test_list_transit_gateways_required_params(self): test_list_transit_gateways_required_params() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways') + url = preprocess_url('/transit_gateways') mock_response = '{"first": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}, "transit_gateways": [{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Invoke method response = _service.list_transit_gateways() - # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 @@ -185,23 +207,24 @@ def test_list_transit_gateways_value_error(self): test_list_transit_gateways_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways') + url = preprocess_url('/transit_gateways') mock_response = '{"first": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}, "transit_gateways": [{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Pass in all but one required param and check for a ValueError req_param_dict = { } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.list_transit_gateways(**req_copy) - def test_list_transit_gateways_value_error_with_retries(self): # Enable retries and run test_list_transit_gateways_value_error. _service.enable_retries() @@ -211,35 +234,96 @@ def test_list_transit_gateways_value_error_with_retries(self): _service.disable_retries() self.test_list_transit_gateways_value_error() -class TestCreateTransitGateway(): + @responses.activate + def test_list_transit_gateways_with_pager_get_next(self): + """ + test_list_transit_gateways_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/transit_gateways') + mock_response1 = '{"next":{"start":"1"},"transit_gateways":[{"id":"ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","crn":"crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","name":"my-transit-gateway-in-TransitGateway","location":"us-south","created_at":"2019-01-01T12:00:00.000Z","global":true,"resource_group":{"id":"56969d6043e9465c883cb9f7363e78e8","href":"https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"},"status":"available","updated_at":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}' + mock_response2 = '{"transit_gateways":[{"id":"ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","crn":"crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","name":"my-transit-gateway-in-TransitGateway","location":"us-south","created_at":"2019-01-01T12:00:00.000Z","global":true,"resource_group":{"id":"56969d6043e9465c883cb9f7363e78e8","href":"https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"},"status":"available","updated_at":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = TransitGatewaysPager( + client=_service, + limit=10, + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_transit_gateways_with_pager_get_all(self): + """ + test_list_transit_gateways_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/transit_gateways') + mock_response1 = '{"next":{"start":"1"},"transit_gateways":[{"id":"ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","crn":"crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","name":"my-transit-gateway-in-TransitGateway","location":"us-south","created_at":"2019-01-01T12:00:00.000Z","global":true,"resource_group":{"id":"56969d6043e9465c883cb9f7363e78e8","href":"https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"},"status":"available","updated_at":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}' + mock_response2 = '{"transit_gateways":[{"id":"ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","crn":"crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4","name":"my-transit-gateway-in-TransitGateway","location":"us-south","created_at":"2019-01-01T12:00:00.000Z","global":true,"resource_group":{"id":"56969d6043e9465c883cb9f7363e78e8","href":"https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"},"status":"available","updated_at":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = TransitGatewaysPager( + client=_service, + limit=10, + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestCreateTransitGateway: """ Test Class for create_transit_gateway """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_create_transit_gateway_all_params(self): """ create_transit_gateway() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways') + url = preprocess_url('/transit_gateways') mock_response = '{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) # Construct a dict representation of a ResourceGroupIdentity model resource_group_identity_model = {} @@ -257,7 +341,7 @@ def test_create_transit_gateway_all_params(self): name, global_=global_, resource_group=resource_group, - headers={} + headers={}, ) # Check for correct operation @@ -285,13 +369,15 @@ def test_create_transit_gateway_value_error(self): test_create_transit_gateway_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways') + url = preprocess_url('/transit_gateways') mock_response = '{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) # Construct a dict representation of a ResourceGroupIdentity model resource_group_identity_model = {} @@ -309,11 +395,10 @@ def test_create_transit_gateway_value_error(self): "name": name, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.create_transit_gateway(**req_copy) - def test_create_transit_gateway_value_error_with_retries(self): # Enable retries and run test_create_transit_gateway_value_error. _service.enable_retries() @@ -323,32 +408,24 @@ def test_create_transit_gateway_value_error_with_retries(self): _service.disable_retries() self.test_create_transit_gateway_value_error() -class TestDeleteTransitGateway(): + +class TestDeleteTransitGateway: """ Test Class for delete_transit_gateway """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_delete_transit_gateway_all_params(self): """ delete_transit_gateway() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString') - responses.add(responses.DELETE, - url, - status=204) + url = preprocess_url('/transit_gateways/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) # Set up parameter values id = 'testString' @@ -356,7 +433,7 @@ def test_delete_transit_gateway_all_params(self): # Invoke method response = _service.delete_transit_gateway( id, - headers={} + headers={}, ) # Check for correct operation @@ -378,10 +455,12 @@ def test_delete_transit_gateway_value_error(self): test_delete_transit_gateway_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString') - responses.add(responses.DELETE, - url, - status=204) + url = preprocess_url('/transit_gateways/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) # Set up parameter values id = 'testString' @@ -391,11 +470,10 @@ def test_delete_transit_gateway_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.delete_transit_gateway(**req_copy) - def test_delete_transit_gateway_value_error_with_retries(self): # Enable retries and run test_delete_transit_gateway_value_error. _service.enable_retries() @@ -405,35 +483,27 @@ def test_delete_transit_gateway_value_error_with_retries(self): _service.disable_retries() self.test_delete_transit_gateway_value_error() -class TestGetTransitGateway(): + +class TestGetTransitGateway: """ Test Class for get_transit_gateway """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_get_transit_gateway_all_params(self): """ get_transit_gateway() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString') + url = preprocess_url('/transit_gateways/testString') mock_response = '{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values id = 'testString' @@ -441,7 +511,7 @@ def test_get_transit_gateway_all_params(self): # Invoke method response = _service.get_transit_gateway( id, - headers={} + headers={}, ) # Check for correct operation @@ -463,13 +533,15 @@ def test_get_transit_gateway_value_error(self): test_get_transit_gateway_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString') + url = preprocess_url('/transit_gateways/testString') mock_response = '{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values id = 'testString' @@ -479,11 +551,10 @@ def test_get_transit_gateway_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.get_transit_gateway(**req_copy) - def test_get_transit_gateway_value_error_with_retries(self): # Enable retries and run test_get_transit_gateway_value_error. _service.enable_retries() @@ -493,35 +564,27 @@ def test_get_transit_gateway_value_error_with_retries(self): _service.disable_retries() self.test_get_transit_gateway_value_error() -class TestUpdateTransitGateway(): + +class TestUpdateTransitGateway: """ Test Class for update_transit_gateway """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_update_transit_gateway_all_params(self): """ update_transit_gateway() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString') + url = preprocess_url('/transit_gateways/testString') mock_response = '{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values id = 'testString' @@ -533,7 +596,7 @@ def test_update_transit_gateway_all_params(self): id, global_=global_, name=name, - headers={} + headers={}, ) # Check for correct operation @@ -559,13 +622,15 @@ def test_update_transit_gateway_value_error(self): test_update_transit_gateway_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString') + url = preprocess_url('/transit_gateways/testString') mock_response = '{"id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "crn": "crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "my-transit-gateway-in-TransitGateway", "location": "us-south", "created_at": "2019-01-01T12:00:00.000Z", "global": true, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8", "href": "https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8"}, "status": "available", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values id = 'testString' @@ -577,11 +642,10 @@ def test_update_transit_gateway_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.update_transit_gateway(**req_copy) - def test_update_transit_gateway_value_error_with_retries(self): # Enable retries and run test_update_transit_gateway_value_error. _service.enable_retries() @@ -591,6 +655,7 @@ def test_update_transit_gateway_value_error_with_retries(self): _service.disable_retries() self.test_update_transit_gateway_value_error() + # endregion ############################################################################## # End of Service: TransitGateways @@ -601,7 +666,8 @@ def test_update_transit_gateway_value_error_with_retries(self): ############################################################################## # region -class TestNewInstance(): + +class TestNewInstance: """ Test Class for new_instance """ @@ -645,38 +711,31 @@ def test_new_instance_required_param_none(self): service = TransitGatewayApisV1.new_instance( version=None, ) -class TestListConnections(): + + +class TestListConnections: """ Test Class for list_connections """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_list_connections_all_params(self): """ list_connections() """ # Set up mock - url = self.preprocess_url(_base_url + '/connections') - mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "name": "Transit_Service_SJ_DL", "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "transit_gateway": {"crn": "crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44", "id": "456f58c1-afe7-123a-0a0a-7f3d720f1a44", "name": "my-transit-gw100"}, "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa"}}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + url = preprocess_url('/connections') + mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "name": "Transit_Service_SJ_DL", "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "transit_gateway": {"crn": "crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44", "id": "456f58c1-afe7-123a-0a0a-7f3d720f1a44", "name": "my-transit-gw100"}, "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values - limit = 1 + limit = 50 start = 'testString' network_id = 'testString' @@ -685,14 +744,14 @@ def test_list_connections_all_params(self): limit=limit, start=start, network_id=network_id, - headers={} + headers={}, ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 # Validate query params - query_string = responses.calls[0].request.url.split('?',1)[1] + query_string = responses.calls[0].request.url.split('?', 1)[1] query_string = urllib.parse.unquote_plus(query_string) assert 'limit={}'.format(limit) in query_string assert 'start={}'.format(start) in query_string @@ -713,18 +772,19 @@ def test_list_connections_required_params(self): test_list_connections_required_params() """ # Set up mock - url = self.preprocess_url(_base_url + '/connections') - mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "name": "Transit_Service_SJ_DL", "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "transit_gateway": {"crn": "crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44", "id": "456f58c1-afe7-123a-0a0a-7f3d720f1a44", "name": "my-transit-gw100"}, "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa"}}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + url = preprocess_url('/connections') + mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "name": "Transit_Service_SJ_DL", "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "transit_gateway": {"crn": "crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44", "id": "456f58c1-afe7-123a-0a0a-7f3d720f1a44", "name": "my-transit-gw100"}, "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Invoke method response = _service.list_connections() - # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 @@ -744,23 +804,24 @@ def test_list_connections_value_error(self): test_list_connections_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/connections') - mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "name": "Transit_Service_SJ_DL", "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "transit_gateway": {"crn": "crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44", "id": "456f58c1-afe7-123a-0a0a-7f3d720f1a44", "name": "my-transit-gw100"}, "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa"}}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + url = preprocess_url('/connections') + mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "name": "Transit_Service_SJ_DL", "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "transit_gateway": {"crn": "crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44", "id": "456f58c1-afe7-123a-0a0a-7f3d720f1a44", "name": "my-transit-gw100"}, "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Pass in all but one required param and check for a ValueError req_param_dict = { } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.list_connections(**req_copy) - def test_list_connections_value_error_with_retries(self): # Enable retries and run test_list_connections_value_error. _service.enable_retries() @@ -770,6 +831,78 @@ def test_list_connections_value_error_with_retries(self): _service.disable_retries() self.test_list_connections_value_error() + @responses.activate + def test_list_connections_with_pager_get_next(self): + """ + test_list_connections_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/connections') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"name":"Transit_Service_SJ_DL","network_account_id":"28e4d90ac7504be694471ee66e70d0d5","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","transit_gateway":{"crn":"crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44","id":"456f58c1-afe7-123a-0a0a-7f3d720f1a44","name":"my-transit-gw100"},"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + mock_response2 = '{"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"name":"Transit_Service_SJ_DL","network_account_id":"28e4d90ac7504be694471ee66e70d0d5","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","transit_gateway":{"crn":"crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44","id":"456f58c1-afe7-123a-0a0a-7f3d720f1a44","name":"my-transit-gw100"},"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = ConnectionsPager( + client=_service, + limit=10, + network_id='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_connections_with_pager_get_all(self): + """ + test_list_connections_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/connections') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"name":"Transit_Service_SJ_DL","network_account_id":"28e4d90ac7504be694471ee66e70d0d5","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","transit_gateway":{"crn":"crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44","id":"456f58c1-afe7-123a-0a0a-7f3d720f1a44","name":"my-transit-gw100"},"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + mock_response2 = '{"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"name":"Transit_Service_SJ_DL","network_account_id":"28e4d90ac7504be694471ee66e70d0d5","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","transit_gateway":{"crn":"crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44","id":"456f58c1-afe7-123a-0a0a-7f3d720f1a44","name":"my-transit-gw100"},"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = ConnectionsPager( + client=_service, + limit=10, + network_id='testString', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + # endregion ############################################################################## # End of Service: TransitConnections @@ -780,7 +913,8 @@ def test_list_connections_value_error_with_retries(self): ############################################################################## # region -class TestNewInstance(): + +class TestNewInstance: """ Test Class for new_instance """ @@ -824,48 +958,53 @@ def test_new_instance_required_param_none(self): service = TransitGatewayApisV1.new_instance( version=None, ) -class TestListTransitGatewayConnections(): + + +class TestListTransitGatewayConnections: """ Test Class for list_transit_gateway_connections """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_list_transit_gateway_connections_all_params(self): """ list_transit_gateway_connections() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections') - mock_response = '{"connections": [{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + url = preprocess_url('/transit_gateways/testString/connections') + mock_response = '{"connections": [{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}, "total_count": 500}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' + start = 'testString' + limit = 50 + name = 'testString' # Invoke method response = _service.list_transit_gateway_connections( transit_gateway_id, - headers={} + start=start, + limit=limit, + name=name, + headers={}, ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'name={}'.format(name) in query_string def test_list_transit_gateway_connections_all_params_with_retries(self): # Enable retries and run test_list_transit_gateway_connections_all_params. @@ -876,19 +1015,59 @@ def test_list_transit_gateway_connections_all_params_with_retries(self): _service.disable_retries() self.test_list_transit_gateway_connections_all_params() + @responses.activate + def test_list_transit_gateway_connections_required_params(self): + """ + test_list_transit_gateway_connections_required_params() + """ + # Set up mock + url = preprocess_url('/transit_gateways/testString/connections') + mock_response = '{"connections": [{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}, "total_count": 500}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + transit_gateway_id = 'testString' + + # Invoke method + response = _service.list_transit_gateway_connections( + transit_gateway_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_transit_gateway_connections_required_params_with_retries(self): + # Enable retries and run test_list_transit_gateway_connections_required_params. + _service.enable_retries() + self.test_list_transit_gateway_connections_required_params() + + # Disable retries and run test_list_transit_gateway_connections_required_params. + _service.disable_retries() + self.test_list_transit_gateway_connections_required_params() + @responses.activate def test_list_transit_gateway_connections_value_error(self): """ test_list_transit_gateway_connections_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections') - mock_response = '{"connections": [{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + url = preprocess_url('/transit_gateways/testString/connections') + mock_response = '{"connections": [{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "first": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?limit=50"}, "limit": 50, "next": {"href": "https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50", "start": "MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa"}, "total_count": 500}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -898,11 +1077,10 @@ def test_list_transit_gateway_connections_value_error(self): "transit_gateway_id": transit_gateway_id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.list_transit_gateway_connections(**req_copy) - def test_list_transit_gateway_connections_value_error_with_retries(self): # Enable retries and run test_list_transit_gateway_connections_value_error. _service.enable_retries() @@ -912,35 +1090,100 @@ def test_list_transit_gateway_connections_value_error_with_retries(self): _service.disable_retries() self.test_list_transit_gateway_connections_value_error() -class TestCreateTransitGatewayConnection(): + @responses.activate + def test_list_transit_gateway_connections_with_pager_get_next(self): + """ + test_list_transit_gateway_connections_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/transit_gateways/testString/connections') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_network_type":"classic","name":"Transit_Service_BWTN_SJ_DL","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"network_account_id":"28e4d90ac7504be694471ee66e70d0d5","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + mock_response2 = '{"total_count":2,"limit":1,"connections":[{"base_network_type":"classic","name":"Transit_Service_BWTN_SJ_DL","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"network_account_id":"28e4d90ac7504be694471ee66e70d0d5","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = TransitGatewayConnectionsPager( + client=_service, + transit_gateway_id='testString', + limit=10, + name='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_transit_gateway_connections_with_pager_get_all(self): + """ + test_list_transit_gateway_connections_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/transit_gateways/testString/connections') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_network_type":"classic","name":"Transit_Service_BWTN_SJ_DL","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"network_account_id":"28e4d90ac7504be694471ee66e70d0d5","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + mock_response2 = '{"total_count":2,"limit":1,"connections":[{"base_network_type":"classic","name":"Transit_Service_BWTN_SJ_DL","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","network_type":"vpc","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","created_at":"2019-01-01T12:00:00.000Z","local_bgp_asn":64490,"local_gateway_ip":"192.168.100.1","local_tunnel_ip":"192.168.129.2","mtu":9000,"network_account_id":"28e4d90ac7504be694471ee66e70d0d5","prefix_filters":[{"action":"permit","before":"1a15dcab-7e40-45e1-b7c5-bc690eaa9782","created_at":"2019-01-01T12:00:00.000Z","ge":0,"id":"1a15dcab-7e30-45e1-b7c5-bc690eaa9865","le":32,"prefix":"192.168.100.0/24","updated_at":"2019-01-01T12:00:00.000Z"}],"prefix_filters_default":"permit","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.63.12","remote_tunnel_ip":"192.168.129.1","request_status":"pending","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = TransitGatewayConnectionsPager( + client=_service, + transit_gateway_id='testString', + limit=10, + name='testString', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestCreateTransitGatewayConnection: """ Test Class for create_transit_gateway_connection """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_create_transit_gateway_connection_all_params(self): """ create_transit_gateway_connection() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections') + url = preprocess_url('/transit_gateways/testString/connections') mock_response = '{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) # Construct a dict representation of a TransitGatewayConnectionPrefixFilter model transit_gateway_connection_prefix_filter_model = {} @@ -987,7 +1230,7 @@ def test_create_transit_gateway_connection_all_params(self): remote_gateway_ip=remote_gateway_ip, remote_tunnel_ip=remote_tunnel_ip, zone=zone, - headers={} + headers={}, ) # Check for correct operation @@ -1025,13 +1268,15 @@ def test_create_transit_gateway_connection_value_error(self): test_create_transit_gateway_connection_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections') + url = preprocess_url('/transit_gateways/testString/connections') mock_response = '{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) # Construct a dict representation of a TransitGatewayConnectionPrefixFilter model transit_gateway_connection_prefix_filter_model = {} @@ -1067,11 +1312,10 @@ def test_create_transit_gateway_connection_value_error(self): "network_type": network_type, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.create_transit_gateway_connection(**req_copy) - def test_create_transit_gateway_connection_value_error_with_retries(self): # Enable retries and run test_create_transit_gateway_connection_value_error. _service.enable_retries() @@ -1081,32 +1325,24 @@ def test_create_transit_gateway_connection_value_error_with_retries(self): _service.disable_retries() self.test_create_transit_gateway_connection_value_error() -class TestDeleteTransitGatewayConnection(): + +class TestDeleteTransitGatewayConnection: """ Test Class for delete_transit_gateway_connection """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_delete_transit_gateway_connection_all_params(self): """ delete_transit_gateway_connection() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString') - responses.add(responses.DELETE, - url, - status=204) + url = preprocess_url('/transit_gateways/testString/connections/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1116,7 +1352,7 @@ def test_delete_transit_gateway_connection_all_params(self): response = _service.delete_transit_gateway_connection( transit_gateway_id, id, - headers={} + headers={}, ) # Check for correct operation @@ -1138,10 +1374,12 @@ def test_delete_transit_gateway_connection_value_error(self): test_delete_transit_gateway_connection_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString') - responses.add(responses.DELETE, - url, - status=204) + url = preprocess_url('/transit_gateways/testString/connections/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1153,11 +1391,10 @@ def test_delete_transit_gateway_connection_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.delete_transit_gateway_connection(**req_copy) - def test_delete_transit_gateway_connection_value_error_with_retries(self): # Enable retries and run test_delete_transit_gateway_connection_value_error. _service.enable_retries() @@ -1167,35 +1404,27 @@ def test_delete_transit_gateway_connection_value_error_with_retries(self): _service.disable_retries() self.test_delete_transit_gateway_connection_value_error() -class TestGetTransitGatewayConnection(): + +class TestGetTransitGatewayConnection: """ Test Class for get_transit_gateway_connection """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_get_transit_gateway_connection_all_params(self): """ get_transit_gateway_connection() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString') + url = preprocess_url('/transit_gateways/testString/connections/testString') mock_response = '{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1205,7 +1434,7 @@ def test_get_transit_gateway_connection_all_params(self): response = _service.get_transit_gateway_connection( transit_gateway_id, id, - headers={} + headers={}, ) # Check for correct operation @@ -1227,13 +1456,15 @@ def test_get_transit_gateway_connection_value_error(self): test_get_transit_gateway_connection_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString') + url = preprocess_url('/transit_gateways/testString/connections/testString') mock_response = '{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1245,11 +1476,10 @@ def test_get_transit_gateway_connection_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.get_transit_gateway_connection(**req_copy) - def test_get_transit_gateway_connection_value_error_with_retries(self): # Enable retries and run test_get_transit_gateway_connection_value_error. _service.enable_retries() @@ -1259,35 +1489,27 @@ def test_get_transit_gateway_connection_value_error_with_retries(self): _service.disable_retries() self.test_get_transit_gateway_connection_value_error() -class TestUpdateTransitGatewayConnection(): + +class TestUpdateTransitGatewayConnection: """ Test Class for update_transit_gateway_connection """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_update_transit_gateway_connection_all_params(self): """ update_transit_gateway_connection() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString') + url = preprocess_url('/transit_gateways/testString/connections/testString') mock_response = '{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1301,7 +1523,7 @@ def test_update_transit_gateway_connection_all_params(self): id, name=name, prefix_filters_default=prefix_filters_default, - headers={} + headers={}, ) # Check for correct operation @@ -1327,13 +1549,15 @@ def test_update_transit_gateway_connection_value_error(self): test_update_transit_gateway_connection_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString') + url = preprocess_url('/transit_gateways/testString/connections/testString') mock_response = '{"base_network_type": "classic", "name": "Transit_Service_BWTN_SJ_DL", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "network_type": "vpc", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "created_at": "2019-01-01T12:00:00.000Z", "local_bgp_asn": 64490, "local_gateway_ip": "192.168.100.1", "local_tunnel_ip": "192.168.129.2", "mtu": 9000, "network_account_id": "28e4d90ac7504be694471ee66e70d0d5", "prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}], "prefix_filters_default": "permit", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.63.12", "remote_tunnel_ip": "192.168.129.1", "request_status": "pending", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1347,11 +1571,10 @@ def test_update_transit_gateway_connection_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.update_transit_gateway_connection(**req_copy) - def test_update_transit_gateway_connection_value_error_with_retries(self): # Enable retries and run test_update_transit_gateway_connection_value_error. _service.enable_retries() @@ -1361,32 +1584,24 @@ def test_update_transit_gateway_connection_value_error_with_retries(self): _service.disable_retries() self.test_update_transit_gateway_connection_value_error() -class TestCreateTransitGatewayConnectionActions(): + +class TestCreateTransitGatewayConnectionActions: """ Test Class for create_transit_gateway_connection_actions """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_create_transit_gateway_connection_actions_all_params(self): """ create_transit_gateway_connection_actions() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/actions') - responses.add(responses.POST, - url, - status=204) + url = preprocess_url('/transit_gateways/testString/connections/testString/actions') + responses.add( + responses.POST, + url, + status=204, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1398,7 +1613,7 @@ def test_create_transit_gateway_connection_actions_all_params(self): transit_gateway_id, id, action, - headers={} + headers={}, ) # Check for correct operation @@ -1423,10 +1638,12 @@ def test_create_transit_gateway_connection_actions_value_error(self): test_create_transit_gateway_connection_actions_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/actions') - responses.add(responses.POST, - url, - status=204) + url = preprocess_url('/transit_gateways/testString/connections/testString/actions') + responses.add( + responses.POST, + url, + status=204, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1440,11 +1657,10 @@ def test_create_transit_gateway_connection_actions_value_error(self): "action": action, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.create_transit_gateway_connection_actions(**req_copy) - def test_create_transit_gateway_connection_actions_value_error_with_retries(self): # Enable retries and run test_create_transit_gateway_connection_actions_value_error. _service.enable_retries() @@ -1454,6 +1670,7 @@ def test_create_transit_gateway_connection_actions_value_error_with_retries(self _service.disable_retries() self.test_create_transit_gateway_connection_actions_value_error() + # endregion ############################################################################## # End of Service: TransitGatewaysNetworkConnections @@ -1464,7 +1681,8 @@ def test_create_transit_gateway_connection_actions_value_error_with_retries(self ############################################################################## # region -class TestNewInstance(): + +class TestNewInstance: """ Test Class for new_instance """ @@ -1508,40 +1726,32 @@ def test_new_instance_required_param_none(self): service = TransitGatewayApisV1.new_instance( version=None, ) -class TestListGatewayLocations(): + + +class TestListGatewayLocations: """ Test Class for list_gateway_locations """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_list_gateway_locations_all_params(self): """ list_gateway_locations() """ # Set up mock - url = self.preprocess_url(_base_url + '/locations') + url = preprocess_url('/locations') mock_response = '{"locations": [{"billing_location": "us", "name": "us-south", "type": "region"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Invoke method response = _service.list_gateway_locations() - # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 @@ -1561,23 +1771,24 @@ def test_list_gateway_locations_value_error(self): test_list_gateway_locations_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/locations') + url = preprocess_url('/locations') mock_response = '{"locations": [{"billing_location": "us", "name": "us-south", "type": "region"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Pass in all but one required param and check for a ValueError req_param_dict = { } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.list_gateway_locations(**req_copy) - def test_list_gateway_locations_value_error_with_retries(self): # Enable retries and run test_list_gateway_locations_value_error. _service.enable_retries() @@ -1587,35 +1798,27 @@ def test_list_gateway_locations_value_error_with_retries(self): _service.disable_retries() self.test_list_gateway_locations_value_error() -class TestGetGatewayLocation(): + +class TestGetGatewayLocation: """ Test Class for get_gateway_location """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_get_gateway_location_all_params(self): """ get_gateway_location() """ # Set up mock - url = self.preprocess_url(_base_url + '/locations/testString') + url = preprocess_url('/locations/testString') mock_response = '{"billing_location": "us", "name": "us-south", "type": "region", "local_connection_locations": [{"display_name": "Dallas", "name": "us-south", "supported_connection_types": ["supported_connection_types"], "type": "region"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values name = 'testString' @@ -1623,7 +1826,7 @@ def test_get_gateway_location_all_params(self): # Invoke method response = _service.get_gateway_location( name, - headers={} + headers={}, ) # Check for correct operation @@ -1645,13 +1848,15 @@ def test_get_gateway_location_value_error(self): test_get_gateway_location_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/locations/testString') + url = preprocess_url('/locations/testString') mock_response = '{"billing_location": "us", "name": "us-south", "type": "region", "local_connection_locations": [{"display_name": "Dallas", "name": "us-south", "supported_connection_types": ["supported_connection_types"], "type": "region"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values name = 'testString' @@ -1661,11 +1866,10 @@ def test_get_gateway_location_value_error(self): "name": name, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.get_gateway_location(**req_copy) - def test_get_gateway_location_value_error_with_retries(self): # Enable retries and run test_get_gateway_location_value_error. _service.enable_retries() @@ -1675,6 +1879,7 @@ def test_get_gateway_location_value_error_with_retries(self): _service.disable_retries() self.test_get_gateway_location_value_error() + # endregion ############################################################################## # End of Service: TransitLocation @@ -1685,7 +1890,8 @@ def test_get_gateway_location_value_error_with_retries(self): ############################################################################## # region -class TestNewInstance(): + +class TestNewInstance: """ Test Class for new_instance """ @@ -1729,35 +1935,28 @@ def test_new_instance_required_param_none(self): service = TransitGatewayApisV1.new_instance( version=None, ) -class TestListTransitGatewayConnectionPrefixFilters(): + + +class TestListTransitGatewayConnectionPrefixFilters: """ Test Class for list_transit_gateway_connection_prefix_filters """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_list_transit_gateway_connection_prefix_filters_all_params(self): """ list_transit_gateway_connection_prefix_filters() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters') mock_response = '{"prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1767,7 +1966,7 @@ def test_list_transit_gateway_connection_prefix_filters_all_params(self): response = _service.list_transit_gateway_connection_prefix_filters( transit_gateway_id, id, - headers={} + headers={}, ) # Check for correct operation @@ -1789,13 +1988,15 @@ def test_list_transit_gateway_connection_prefix_filters_value_error(self): test_list_transit_gateway_connection_prefix_filters_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters') mock_response = '{"prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1807,11 +2008,10 @@ def test_list_transit_gateway_connection_prefix_filters_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.list_transit_gateway_connection_prefix_filters(**req_copy) - def test_list_transit_gateway_connection_prefix_filters_value_error_with_retries(self): # Enable retries and run test_list_transit_gateway_connection_prefix_filters_value_error. _service.enable_retries() @@ -1821,35 +2021,27 @@ def test_list_transit_gateway_connection_prefix_filters_value_error_with_retries _service.disable_retries() self.test_list_transit_gateway_connection_prefix_filters_value_error() -class TestCreateTransitGatewayConnectionPrefixFilter(): + +class TestCreateTransitGatewayConnectionPrefixFilter: """ Test Class for create_transit_gateway_connection_prefix_filter """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_create_transit_gateway_connection_prefix_filter_all_params(self): """ create_transit_gateway_connection_prefix_filter() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters') mock_response = '{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1869,7 +2061,7 @@ def test_create_transit_gateway_connection_prefix_filter_all_params(self): before=before, ge=ge, le=le, - headers={} + headers={}, ) # Check for correct operation @@ -1898,13 +2090,15 @@ def test_create_transit_gateway_connection_prefix_filter_value_error(self): test_create_transit_gateway_connection_prefix_filter_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters') mock_response = '{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=201) + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -1923,11 +2117,10 @@ def test_create_transit_gateway_connection_prefix_filter_value_error(self): "prefix": prefix, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.create_transit_gateway_connection_prefix_filter(**req_copy) - def test_create_transit_gateway_connection_prefix_filter_value_error_with_retries(self): # Enable retries and run test_create_transit_gateway_connection_prefix_filter_value_error. _service.enable_retries() @@ -1937,35 +2130,27 @@ def test_create_transit_gateway_connection_prefix_filter_value_error_with_retrie _service.disable_retries() self.test_create_transit_gateway_connection_prefix_filter_value_error() -class TestReplaceTransitGatewayConnectionPrefixFilter(): + +class TestReplaceTransitGatewayConnectionPrefixFilter: """ Test Class for replace_transit_gateway_connection_prefix_filter """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_replace_transit_gateway_connection_prefix_filter_all_params(self): """ replace_transit_gateway_connection_prefix_filter() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters') mock_response = '{"prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.PUT, - url, - body=mock_response, - content_type='application/json', - status=201) + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=201, + ) # Construct a dict representation of a PrefixFilterPut model prefix_filter_put_model = {} @@ -1984,7 +2169,7 @@ def test_replace_transit_gateway_connection_prefix_filter_all_params(self): transit_gateway_id, id, prefix_filters, - headers={} + headers={}, ) # Check for correct operation @@ -2009,13 +2194,15 @@ def test_replace_transit_gateway_connection_prefix_filter_value_error(self): test_replace_transit_gateway_connection_prefix_filter_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters') mock_response = '{"prefix_filters": [{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.PUT, - url, - body=mock_response, - content_type='application/json', - status=201) + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=201, + ) # Construct a dict representation of a PrefixFilterPut model prefix_filter_put_model = {} @@ -2036,11 +2223,10 @@ def test_replace_transit_gateway_connection_prefix_filter_value_error(self): "prefix_filters": prefix_filters, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.replace_transit_gateway_connection_prefix_filter(**req_copy) - def test_replace_transit_gateway_connection_prefix_filter_value_error_with_retries(self): # Enable retries and run test_replace_transit_gateway_connection_prefix_filter_value_error. _service.enable_retries() @@ -2050,32 +2236,24 @@ def test_replace_transit_gateway_connection_prefix_filter_value_error_with_retri _service.disable_retries() self.test_replace_transit_gateway_connection_prefix_filter_value_error() -class TestDeleteTransitGatewayConnectionPrefixFilter(): + +class TestDeleteTransitGatewayConnectionPrefixFilter: """ Test Class for delete_transit_gateway_connection_prefix_filter """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_delete_transit_gateway_connection_prefix_filter_all_params(self): """ delete_transit_gateway_connection_prefix_filter() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters/testString') - responses.add(responses.DELETE, - url, - status=204) + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2087,7 +2265,7 @@ def test_delete_transit_gateway_connection_prefix_filter_all_params(self): transit_gateway_id, id, filter_id, - headers={} + headers={}, ) # Check for correct operation @@ -2109,10 +2287,12 @@ def test_delete_transit_gateway_connection_prefix_filter_value_error(self): test_delete_transit_gateway_connection_prefix_filter_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters/testString') - responses.add(responses.DELETE, - url, - status=204) + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2126,11 +2306,10 @@ def test_delete_transit_gateway_connection_prefix_filter_value_error(self): "filter_id": filter_id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.delete_transit_gateway_connection_prefix_filter(**req_copy) - def test_delete_transit_gateway_connection_prefix_filter_value_error_with_retries(self): # Enable retries and run test_delete_transit_gateway_connection_prefix_filter_value_error. _service.enable_retries() @@ -2140,35 +2319,27 @@ def test_delete_transit_gateway_connection_prefix_filter_value_error_with_retrie _service.disable_retries() self.test_delete_transit_gateway_connection_prefix_filter_value_error() -class TestGetTransitGatewayConnectionPrefixFilter(): + +class TestGetTransitGatewayConnectionPrefixFilter: """ Test Class for get_transit_gateway_connection_prefix_filter """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_get_transit_gateway_connection_prefix_filter_all_params(self): """ get_transit_gateway_connection_prefix_filter() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters/testString') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters/testString') mock_response = '{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2180,7 +2351,7 @@ def test_get_transit_gateway_connection_prefix_filter_all_params(self): transit_gateway_id, id, filter_id, - headers={} + headers={}, ) # Check for correct operation @@ -2202,13 +2373,15 @@ def test_get_transit_gateway_connection_prefix_filter_value_error(self): test_get_transit_gateway_connection_prefix_filter_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters/testString') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters/testString') mock_response = '{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2222,11 +2395,10 @@ def test_get_transit_gateway_connection_prefix_filter_value_error(self): "filter_id": filter_id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.get_transit_gateway_connection_prefix_filter(**req_copy) - def test_get_transit_gateway_connection_prefix_filter_value_error_with_retries(self): # Enable retries and run test_get_transit_gateway_connection_prefix_filter_value_error. _service.enable_retries() @@ -2236,35 +2408,27 @@ def test_get_transit_gateway_connection_prefix_filter_value_error_with_retries(s _service.disable_retries() self.test_get_transit_gateway_connection_prefix_filter_value_error() -class TestUpdateTransitGatewayConnectionPrefixFilter(): + +class TestUpdateTransitGatewayConnectionPrefixFilter: """ Test Class for update_transit_gateway_connection_prefix_filter """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_update_transit_gateway_connection_prefix_filter_all_params(self): """ update_transit_gateway_connection_prefix_filter() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters/testString') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters/testString') mock_response = '{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2286,7 +2450,7 @@ def test_update_transit_gateway_connection_prefix_filter_all_params(self): ge=ge, le=le, prefix=prefix, - headers={} + headers={}, ) # Check for correct operation @@ -2315,13 +2479,15 @@ def test_update_transit_gateway_connection_prefix_filter_value_error(self): test_update_transit_gateway_connection_prefix_filter_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/connections/testString/prefix_filters/testString') + url = preprocess_url('/transit_gateways/testString/connections/testString/prefix_filters/testString') mock_response = '{"action": "permit", "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782", "created_at": "2019-01-01T12:00:00.000Z", "ge": 0, "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865", "le": 32, "prefix": "192.168.100.0/24", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.PATCH, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2340,11 +2506,10 @@ def test_update_transit_gateway_connection_prefix_filter_value_error(self): "filter_id": filter_id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.update_transit_gateway_connection_prefix_filter(**req_copy) - def test_update_transit_gateway_connection_prefix_filter_value_error_with_retries(self): # Enable retries and run test_update_transit_gateway_connection_prefix_filter_value_error. _service.enable_retries() @@ -2354,6 +2519,7 @@ def test_update_transit_gateway_connection_prefix_filter_value_error_with_retrie _service.disable_retries() self.test_update_transit_gateway_connection_prefix_filter_value_error() + # endregion ############################################################################## # End of Service: TransitGatewayConnectionPrefixFilters @@ -2364,7 +2530,8 @@ def test_update_transit_gateway_connection_prefix_filter_value_error_with_retrie ############################################################################## # region -class TestNewInstance(): + +class TestNewInstance: """ Test Class for new_instance """ @@ -2408,35 +2575,28 @@ def test_new_instance_required_param_none(self): service = TransitGatewayApisV1.new_instance( version=None, ) -class TestListTransitGatewayRouteReports(): + + +class TestListTransitGatewayRouteReports: """ Test Class for list_transit_gateway_route_reports """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_list_transit_gateway_route_reports_all_params(self): """ list_transit_gateway_route_reports() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/route_reports') + url = preprocess_url('/transit_gateways/testString/route_reports') mock_response = '{"route_reports": [{"connections": [{"bgps": [{"as_path": "(65201 4201065544) 4203065544", "is_used": true, "local_preference": "190", "prefix": "172.17.0.0/16"}], "id": "3c265a62-91da-4261-a950-950b6af0eb58", "name": "transit-connection-vpc1", "routes": [{"prefix": "192.168.0.0/16"}], "type": "vpc"}], "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "overlapping_routes": [{"routes": [{"connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff", "prefix": "prefix"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2444,7 +2604,7 @@ def test_list_transit_gateway_route_reports_all_params(self): # Invoke method response = _service.list_transit_gateway_route_reports( transit_gateway_id, - headers={} + headers={}, ) # Check for correct operation @@ -2466,13 +2626,15 @@ def test_list_transit_gateway_route_reports_value_error(self): test_list_transit_gateway_route_reports_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/route_reports') + url = preprocess_url('/transit_gateways/testString/route_reports') mock_response = '{"route_reports": [{"connections": [{"bgps": [{"as_path": "(65201 4201065544) 4203065544", "is_used": true, "local_preference": "190", "prefix": "172.17.0.0/16"}], "id": "3c265a62-91da-4261-a950-950b6af0eb58", "name": "transit-connection-vpc1", "routes": [{"prefix": "192.168.0.0/16"}], "type": "vpc"}], "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "overlapping_routes": [{"routes": [{"connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff", "prefix": "prefix"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z"}]}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2482,11 +2644,10 @@ def test_list_transit_gateway_route_reports_value_error(self): "transit_gateway_id": transit_gateway_id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.list_transit_gateway_route_reports(**req_copy) - def test_list_transit_gateway_route_reports_value_error_with_retries(self): # Enable retries and run test_list_transit_gateway_route_reports_value_error. _service.enable_retries() @@ -2496,35 +2657,27 @@ def test_list_transit_gateway_route_reports_value_error_with_retries(self): _service.disable_retries() self.test_list_transit_gateway_route_reports_value_error() -class TestCreateTransitGatewayRouteReport(): + +class TestCreateTransitGatewayRouteReport: """ Test Class for create_transit_gateway_route_report """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_create_transit_gateway_route_report_all_params(self): """ create_transit_gateway_route_report() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/route_reports') + url = preprocess_url('/transit_gateways/testString/route_reports') mock_response = '{"connections": [{"bgps": [{"as_path": "(65201 4201065544) 4203065544", "is_used": true, "local_preference": "190", "prefix": "172.17.0.0/16"}], "id": "3c265a62-91da-4261-a950-950b6af0eb58", "name": "transit-connection-vpc1", "routes": [{"prefix": "192.168.0.0/16"}], "type": "vpc"}], "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "overlapping_routes": [{"routes": [{"connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff", "prefix": "prefix"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=202) + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=202, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2532,7 +2685,7 @@ def test_create_transit_gateway_route_report_all_params(self): # Invoke method response = _service.create_transit_gateway_route_report( transit_gateway_id, - headers={} + headers={}, ) # Check for correct operation @@ -2554,13 +2707,15 @@ def test_create_transit_gateway_route_report_value_error(self): test_create_transit_gateway_route_report_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/route_reports') + url = preprocess_url('/transit_gateways/testString/route_reports') mock_response = '{"connections": [{"bgps": [{"as_path": "(65201 4201065544) 4203065544", "is_used": true, "local_preference": "190", "prefix": "172.17.0.0/16"}], "id": "3c265a62-91da-4261-a950-950b6af0eb58", "name": "transit-connection-vpc1", "routes": [{"prefix": "192.168.0.0/16"}], "type": "vpc"}], "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "overlapping_routes": [{"routes": [{"connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff", "prefix": "prefix"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.POST, - url, - body=mock_response, - content_type='application/json', - status=202) + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=202, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2570,11 +2725,10 @@ def test_create_transit_gateway_route_report_value_error(self): "transit_gateway_id": transit_gateway_id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.create_transit_gateway_route_report(**req_copy) - def test_create_transit_gateway_route_report_value_error_with_retries(self): # Enable retries and run test_create_transit_gateway_route_report_value_error. _service.enable_retries() @@ -2584,32 +2738,24 @@ def test_create_transit_gateway_route_report_value_error_with_retries(self): _service.disable_retries() self.test_create_transit_gateway_route_report_value_error() -class TestDeleteTransitGatewayRouteReport(): + +class TestDeleteTransitGatewayRouteReport: """ Test Class for delete_transit_gateway_route_report """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_delete_transit_gateway_route_report_all_params(self): """ delete_transit_gateway_route_report() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/route_reports/testString') - responses.add(responses.DELETE, - url, - status=204) + url = preprocess_url('/transit_gateways/testString/route_reports/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2619,7 +2765,7 @@ def test_delete_transit_gateway_route_report_all_params(self): response = _service.delete_transit_gateway_route_report( transit_gateway_id, id, - headers={} + headers={}, ) # Check for correct operation @@ -2641,10 +2787,12 @@ def test_delete_transit_gateway_route_report_value_error(self): test_delete_transit_gateway_route_report_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/route_reports/testString') - responses.add(responses.DELETE, - url, - status=204) + url = preprocess_url('/transit_gateways/testString/route_reports/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2656,11 +2804,10 @@ def test_delete_transit_gateway_route_report_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.delete_transit_gateway_route_report(**req_copy) - def test_delete_transit_gateway_route_report_value_error_with_retries(self): # Enable retries and run test_delete_transit_gateway_route_report_value_error. _service.enable_retries() @@ -2670,35 +2817,27 @@ def test_delete_transit_gateway_route_report_value_error_with_retries(self): _service.disable_retries() self.test_delete_transit_gateway_route_report_value_error() -class TestGetTransitGatewayRouteReport(): + +class TestGetTransitGatewayRouteReport: """ Test Class for get_transit_gateway_route_report """ - def preprocess_url(self, request_url: str): - """ - Preprocess the request URL to ensure the mock response will be found. - """ - request_url = urllib.parse.unquote(request_url) # don't double-encode if already encoded - request_url = urllib.parse.quote(request_url, safe=':/') - if re.fullmatch('.*/+', request_url) is None: - return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') - @responses.activate def test_get_transit_gateway_route_report_all_params(self): """ get_transit_gateway_route_report() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/route_reports/testString') + url = preprocess_url('/transit_gateways/testString/route_reports/testString') mock_response = '{"connections": [{"bgps": [{"as_path": "(65201 4201065544) 4203065544", "is_used": true, "local_preference": "190", "prefix": "172.17.0.0/16"}], "id": "3c265a62-91da-4261-a950-950b6af0eb58", "name": "transit-connection-vpc1", "routes": [{"prefix": "192.168.0.0/16"}], "type": "vpc"}], "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "overlapping_routes": [{"routes": [{"connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff", "prefix": "prefix"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2708,7 +2847,7 @@ def test_get_transit_gateway_route_report_all_params(self): response = _service.get_transit_gateway_route_report( transit_gateway_id, id, - headers={} + headers={}, ) # Check for correct operation @@ -2730,13 +2869,15 @@ def test_get_transit_gateway_route_report_value_error(self): test_get_transit_gateway_route_report_value_error() """ # Set up mock - url = self.preprocess_url(_base_url + '/transit_gateways/testString/route_reports/testString') + url = preprocess_url('/transit_gateways/testString/route_reports/testString') mock_response = '{"connections": [{"bgps": [{"as_path": "(65201 4201065544) 4203065544", "is_used": true, "local_preference": "190", "prefix": "172.17.0.0/16"}], "id": "3c265a62-91da-4261-a950-950b6af0eb58", "name": "transit-connection-vpc1", "routes": [{"prefix": "192.168.0.0/16"}], "type": "vpc"}], "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "overlapping_routes": [{"routes": [{"connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff", "prefix": "prefix"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z"}' - responses.add(responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200) + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) # Set up parameter values transit_gateway_id = 'testString' @@ -2748,11 +2889,10 @@ def test_get_transit_gateway_route_report_value_error(self): "id": id, } for param in req_param_dict.keys(): - req_copy = {key:val if key is not param else None for (key,val) in req_param_dict.items()} + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): _service.get_transit_gateway_route_report(**req_copy) - def test_get_transit_gateway_route_report_value_error_with_retries(self): # Enable retries and run test_get_transit_gateway_route_report_value_error. _service.enable_retries() @@ -2762,6 +2902,7 @@ def test_get_transit_gateway_route_report_value_error_with_retries(self): _service.disable_retries() self.test_get_transit_gateway_route_report_value_error() + # endregion ############################################################################## # End of Service: TransitGatewayRouteReports @@ -2772,7 +2913,192 @@ def test_get_transit_gateway_route_report_value_error_with_retries(self): # Start of Model Tests ############################################################################## # region -class TestModel_PrefixFilterCollection(): + + +class TestModel_PaginationFirstConnection: + """ + Test Class for PaginationFirstConnection + """ + + def test_pagination_first_connection_serialization(self): + """ + Test serialization/deserialization for PaginationFirstConnection + """ + + # Construct a json representation of a PaginationFirstConnection model + pagination_first_connection_model_json = {} + pagination_first_connection_model_json['href'] = 'https://transit.cloud.ibm.com/v1/connections?limit=50' + + # Construct a model instance of PaginationFirstConnection by calling from_dict on the json representation + pagination_first_connection_model = PaginationFirstConnection.from_dict(pagination_first_connection_model_json) + assert pagination_first_connection_model != False + + # Construct a model instance of PaginationFirstConnection by calling from_dict on the json representation + pagination_first_connection_model_dict = PaginationFirstConnection.from_dict(pagination_first_connection_model_json).__dict__ + pagination_first_connection_model2 = PaginationFirstConnection(**pagination_first_connection_model_dict) + + # Verify the model instances are equivalent + assert pagination_first_connection_model == pagination_first_connection_model2 + + # Convert model instance back to dict and verify no loss of data + pagination_first_connection_model_json2 = pagination_first_connection_model.to_dict() + assert pagination_first_connection_model_json2 == pagination_first_connection_model_json + + +class TestModel_PaginationFirstTG: + """ + Test Class for PaginationFirstTG + """ + + def test_pagination_first_tg_serialization(self): + """ + Test serialization/deserialization for PaginationFirstTG + """ + + # Construct a json representation of a PaginationFirstTG model + pagination_first_tg_model_json = {} + pagination_first_tg_model_json['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways?limit=50' + + # Construct a model instance of PaginationFirstTG by calling from_dict on the json representation + pagination_first_tg_model = PaginationFirstTG.from_dict(pagination_first_tg_model_json) + assert pagination_first_tg_model != False + + # Construct a model instance of PaginationFirstTG by calling from_dict on the json representation + pagination_first_tg_model_dict = PaginationFirstTG.from_dict(pagination_first_tg_model_json).__dict__ + pagination_first_tg_model2 = PaginationFirstTG(**pagination_first_tg_model_dict) + + # Verify the model instances are equivalent + assert pagination_first_tg_model == pagination_first_tg_model2 + + # Convert model instance back to dict and verify no loss of data + pagination_first_tg_model_json2 = pagination_first_tg_model.to_dict() + assert pagination_first_tg_model_json2 == pagination_first_tg_model_json + + +class TestModel_PaginationFirstTGWConnection: + """ + Test Class for PaginationFirstTGWConnection + """ + + def test_pagination_first_tgw_connection_serialization(self): + """ + Test serialization/deserialization for PaginationFirstTGWConnection + """ + + # Construct a json representation of a PaginationFirstTGWConnection model + pagination_first_tgw_connection_model_json = {} + pagination_first_tgw_connection_model_json['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?limit=50' + + # Construct a model instance of PaginationFirstTGWConnection by calling from_dict on the json representation + pagination_first_tgw_connection_model = PaginationFirstTGWConnection.from_dict(pagination_first_tgw_connection_model_json) + assert pagination_first_tgw_connection_model != False + + # Construct a model instance of PaginationFirstTGWConnection by calling from_dict on the json representation + pagination_first_tgw_connection_model_dict = PaginationFirstTGWConnection.from_dict(pagination_first_tgw_connection_model_json).__dict__ + pagination_first_tgw_connection_model2 = PaginationFirstTGWConnection(**pagination_first_tgw_connection_model_dict) + + # Verify the model instances are equivalent + assert pagination_first_tgw_connection_model == pagination_first_tgw_connection_model2 + + # Convert model instance back to dict and verify no loss of data + pagination_first_tgw_connection_model_json2 = pagination_first_tgw_connection_model.to_dict() + assert pagination_first_tgw_connection_model_json2 == pagination_first_tgw_connection_model_json + + +class TestModel_PaginationNextConnection: + """ + Test Class for PaginationNextConnection + """ + + def test_pagination_next_connection_serialization(self): + """ + Test serialization/deserialization for PaginationNextConnection + """ + + # Construct a json representation of a PaginationNextConnection model + pagination_next_connection_model_json = {} + pagination_next_connection_model_json['href'] = 'https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50' + pagination_next_connection_model_json['start'] = 'MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa' + + # Construct a model instance of PaginationNextConnection by calling from_dict on the json representation + pagination_next_connection_model = PaginationNextConnection.from_dict(pagination_next_connection_model_json) + assert pagination_next_connection_model != False + + # Construct a model instance of PaginationNextConnection by calling from_dict on the json representation + pagination_next_connection_model_dict = PaginationNextConnection.from_dict(pagination_next_connection_model_json).__dict__ + pagination_next_connection_model2 = PaginationNextConnection(**pagination_next_connection_model_dict) + + # Verify the model instances are equivalent + assert pagination_next_connection_model == pagination_next_connection_model2 + + # Convert model instance back to dict and verify no loss of data + pagination_next_connection_model_json2 = pagination_next_connection_model.to_dict() + assert pagination_next_connection_model_json2 == pagination_next_connection_model_json + + +class TestModel_PaginationNextTG: + """ + Test Class for PaginationNextTG + """ + + def test_pagination_next_tg_serialization(self): + """ + Test serialization/deserialization for PaginationNextTG + """ + + # Construct a json representation of a PaginationNextTG model + pagination_next_tg_model_json = {} + pagination_next_tg_model_json['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50' + pagination_next_tg_model_json['start'] = 'MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa' + + # Construct a model instance of PaginationNextTG by calling from_dict on the json representation + pagination_next_tg_model = PaginationNextTG.from_dict(pagination_next_tg_model_json) + assert pagination_next_tg_model != False + + # Construct a model instance of PaginationNextTG by calling from_dict on the json representation + pagination_next_tg_model_dict = PaginationNextTG.from_dict(pagination_next_tg_model_json).__dict__ + pagination_next_tg_model2 = PaginationNextTG(**pagination_next_tg_model_dict) + + # Verify the model instances are equivalent + assert pagination_next_tg_model == pagination_next_tg_model2 + + # Convert model instance back to dict and verify no loss of data + pagination_next_tg_model_json2 = pagination_next_tg_model.to_dict() + assert pagination_next_tg_model_json2 == pagination_next_tg_model_json + + +class TestModel_PaginationNextTGWConnection: + """ + Test Class for PaginationNextTGWConnection + """ + + def test_pagination_next_tgw_connection_serialization(self): + """ + Test serialization/deserialization for PaginationNextTGWConnection + """ + + # Construct a json representation of a PaginationNextTGWConnection model + pagination_next_tgw_connection_model_json = {} + pagination_next_tgw_connection_model_json['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50' + pagination_next_tgw_connection_model_json['start'] = 'MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa' + + # Construct a model instance of PaginationNextTGWConnection by calling from_dict on the json representation + pagination_next_tgw_connection_model = PaginationNextTGWConnection.from_dict(pagination_next_tgw_connection_model_json) + assert pagination_next_tgw_connection_model != False + + # Construct a model instance of PaginationNextTGWConnection by calling from_dict on the json representation + pagination_next_tgw_connection_model_dict = PaginationNextTGWConnection.from_dict(pagination_next_tgw_connection_model_json).__dict__ + pagination_next_tgw_connection_model2 = PaginationNextTGWConnection(**pagination_next_tgw_connection_model_dict) + + # Verify the model instances are equivalent + assert pagination_next_tgw_connection_model == pagination_next_tgw_connection_model2 + + # Convert model instance back to dict and verify no loss of data + pagination_next_tgw_connection_model_json2 = pagination_next_tgw_connection_model.to_dict() + assert pagination_next_tgw_connection_model_json2 == pagination_next_tgw_connection_model_json + + +class TestModel_PrefixFilterCollection: """ Test Class for PrefixFilterCollection """ @@ -2784,15 +3110,15 @@ def test_prefix_filter_collection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - prefix_filter_cust_model = {} # PrefixFilterCust + prefix_filter_cust_model = {} # PrefixFilterCust prefix_filter_cust_model['action'] = 'permit' prefix_filter_cust_model['before'] = '1a15dcab-7e40-45e1-b7c5-bc690eaa9782' - prefix_filter_cust_model['created_at'] = "2019-01-01T12:00:00Z" + prefix_filter_cust_model['created_at'] = '2019-01-01T12:00:00Z' prefix_filter_cust_model['ge'] = 0 prefix_filter_cust_model['id'] = '1a15dcab-7e30-45e1-b7c5-bc690eaa9865' prefix_filter_cust_model['le'] = 32 prefix_filter_cust_model['prefix'] = '192.168.100.0/24' - prefix_filter_cust_model['updated_at'] = "2019-01-01T12:00:00Z" + prefix_filter_cust_model['updated_at'] = '2019-01-01T12:00:00Z' # Construct a json representation of a PrefixFilterCollection model prefix_filter_collection_model_json = {} @@ -2813,7 +3139,8 @@ def test_prefix_filter_collection_serialization(self): prefix_filter_collection_model_json2 = prefix_filter_collection_model.to_dict() assert prefix_filter_collection_model_json2 == prefix_filter_collection_model_json -class TestModel_PrefixFilterCust(): + +class TestModel_PrefixFilterCust: """ Test Class for PrefixFilterCust """ @@ -2827,12 +3154,12 @@ def test_prefix_filter_cust_serialization(self): prefix_filter_cust_model_json = {} prefix_filter_cust_model_json['action'] = 'permit' prefix_filter_cust_model_json['before'] = '1a15dcab-7e40-45e1-b7c5-bc690eaa9782' - prefix_filter_cust_model_json['created_at'] = "2019-01-01T12:00:00Z" + prefix_filter_cust_model_json['created_at'] = '2019-01-01T12:00:00Z' prefix_filter_cust_model_json['ge'] = 0 prefix_filter_cust_model_json['id'] = '1a15dcab-7e30-45e1-b7c5-bc690eaa9865' prefix_filter_cust_model_json['le'] = 32 prefix_filter_cust_model_json['prefix'] = '192.168.100.0/24' - prefix_filter_cust_model_json['updated_at'] = "2019-01-01T12:00:00Z" + prefix_filter_cust_model_json['updated_at'] = '2019-01-01T12:00:00Z' # Construct a model instance of PrefixFilterCust by calling from_dict on the json representation prefix_filter_cust_model = PrefixFilterCust.from_dict(prefix_filter_cust_model_json) @@ -2849,7 +3176,8 @@ def test_prefix_filter_cust_serialization(self): prefix_filter_cust_model_json2 = prefix_filter_cust_model.to_dict() assert prefix_filter_cust_model_json2 == prefix_filter_cust_model_json -class TestModel_PrefixFilterPut(): + +class TestModel_PrefixFilterPut: """ Test Class for PrefixFilterPut """ @@ -2881,7 +3209,8 @@ def test_prefix_filter_put_serialization(self): prefix_filter_put_model_json2 = prefix_filter_put_model.to_dict() assert prefix_filter_put_model_json2 == prefix_filter_put_model_json -class TestModel_ResourceGroupIdentity(): + +class TestModel_ResourceGroupIdentity: """ Test Class for ResourceGroupIdentity """ @@ -2910,7 +3239,8 @@ def test_resource_group_identity_serialization(self): resource_group_identity_model_json2 = resource_group_identity_model.to_dict() assert resource_group_identity_model_json2 == resource_group_identity_model_json -class TestModel_ResourceGroupReference(): + +class TestModel_ResourceGroupReference: """ Test Class for ResourceGroupReference """ @@ -2940,7 +3270,8 @@ def test_resource_group_reference_serialization(self): resource_group_reference_model_json2 = resource_group_reference_model.to_dict() assert resource_group_reference_model_json2 == resource_group_reference_model_json -class TestModel_RouteReport(): + +class TestModel_RouteReport: """ Test Class for RouteReport """ @@ -2952,37 +3283,37 @@ def test_route_report_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - route_report_connection_bgp_model = {} # RouteReportConnectionBgp + route_report_connection_bgp_model = {} # RouteReportConnectionBgp route_report_connection_bgp_model['as_path'] = '(65201 4201065544) 4203065544' route_report_connection_bgp_model['is_used'] = True route_report_connection_bgp_model['local_preference'] = '190' route_report_connection_bgp_model['prefix'] = '172.17.0.0/16' - route_report_connection_route_model = {} # RouteReportConnectionRoute + route_report_connection_route_model = {} # RouteReportConnectionRoute route_report_connection_route_model['prefix'] = '192.168.0.0/16' - route_report_connection_model = {} # RouteReportConnection + route_report_connection_model = {} # RouteReportConnection route_report_connection_model['bgps'] = [route_report_connection_bgp_model] route_report_connection_model['id'] = '3c265a62-91da-4261-a950-950b6af0eb58' route_report_connection_model['name'] = 'transit-connection-vpc1' route_report_connection_model['routes'] = [route_report_connection_route_model] route_report_connection_model['type'] = 'vpc' - route_report_overlapping_route_model = {} # RouteReportOverlappingRoute + route_report_overlapping_route_model = {} # RouteReportOverlappingRoute route_report_overlapping_route_model['connection_id'] = 'd2d985d8-1d8e-4e8b-96cd-cee2290ecaff' route_report_overlapping_route_model['prefix'] = 'testString' - route_report_overlapping_route_group_model = {} # RouteReportOverlappingRouteGroup + route_report_overlapping_route_group_model = {} # RouteReportOverlappingRouteGroup route_report_overlapping_route_group_model['routes'] = [route_report_overlapping_route_model] # Construct a json representation of a RouteReport model route_report_model_json = {} route_report_model_json['connections'] = [route_report_connection_model] - route_report_model_json['created_at'] = "2019-01-01T12:00:00Z" + route_report_model_json['created_at'] = '2019-01-01T12:00:00Z' route_report_model_json['id'] = '1a15dcab-7e26-45e1-b7c5-bc690eaa9724' route_report_model_json['overlapping_routes'] = [route_report_overlapping_route_group_model] route_report_model_json['status'] = 'complete' - route_report_model_json['updated_at'] = "2019-01-01T12:00:00Z" + route_report_model_json['updated_at'] = '2019-01-01T12:00:00Z' # Construct a model instance of RouteReport by calling from_dict on the json representation route_report_model = RouteReport.from_dict(route_report_model_json) @@ -2999,7 +3330,8 @@ def test_route_report_serialization(self): route_report_model_json2 = route_report_model.to_dict() assert route_report_model_json2 == route_report_model_json -class TestModel_RouteReportCollection(): + +class TestModel_RouteReportCollection: """ Test Class for RouteReportCollection """ @@ -3011,36 +3343,36 @@ def test_route_report_collection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - route_report_connection_bgp_model = {} # RouteReportConnectionBgp + route_report_connection_bgp_model = {} # RouteReportConnectionBgp route_report_connection_bgp_model['as_path'] = '(65201 4201065544) 4203065544' route_report_connection_bgp_model['is_used'] = True route_report_connection_bgp_model['local_preference'] = '190' route_report_connection_bgp_model['prefix'] = '172.17.0.0/16' - route_report_connection_route_model = {} # RouteReportConnectionRoute + route_report_connection_route_model = {} # RouteReportConnectionRoute route_report_connection_route_model['prefix'] = '192.168.0.0/16' - route_report_connection_model = {} # RouteReportConnection + route_report_connection_model = {} # RouteReportConnection route_report_connection_model['bgps'] = [route_report_connection_bgp_model] route_report_connection_model['id'] = '3c265a62-91da-4261-a950-950b6af0eb58' route_report_connection_model['name'] = 'transit-connection-vpc1' route_report_connection_model['routes'] = [route_report_connection_route_model] route_report_connection_model['type'] = 'vpc' - route_report_overlapping_route_model = {} # RouteReportOverlappingRoute + route_report_overlapping_route_model = {} # RouteReportOverlappingRoute route_report_overlapping_route_model['connection_id'] = 'd2d985d8-1d8e-4e8b-96cd-cee2290ecaff' route_report_overlapping_route_model['prefix'] = 'testString' - route_report_overlapping_route_group_model = {} # RouteReportOverlappingRouteGroup + route_report_overlapping_route_group_model = {} # RouteReportOverlappingRouteGroup route_report_overlapping_route_group_model['routes'] = [route_report_overlapping_route_model] - route_report_model = {} # RouteReport + route_report_model = {} # RouteReport route_report_model['connections'] = [route_report_connection_model] - route_report_model['created_at'] = "2019-01-01T12:00:00Z" + route_report_model['created_at'] = '2019-01-01T12:00:00Z' route_report_model['id'] = '1a15dcab-7e26-45e1-b7c5-bc690eaa9724' route_report_model['overlapping_routes'] = [route_report_overlapping_route_group_model] route_report_model['status'] = 'complete' - route_report_model['updated_at'] = "2019-01-01T12:00:00Z" + route_report_model['updated_at'] = '2019-01-01T12:00:00Z' # Construct a json representation of a RouteReportCollection model route_report_collection_model_json = {} @@ -3061,7 +3393,8 @@ def test_route_report_collection_serialization(self): route_report_collection_model_json2 = route_report_collection_model.to_dict() assert route_report_collection_model_json2 == route_report_collection_model_json -class TestModel_RouteReportConnection(): + +class TestModel_RouteReportConnection: """ Test Class for RouteReportConnection """ @@ -3073,13 +3406,13 @@ def test_route_report_connection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - route_report_connection_bgp_model = {} # RouteReportConnectionBgp + route_report_connection_bgp_model = {} # RouteReportConnectionBgp route_report_connection_bgp_model['as_path'] = '(65201 4201065544) 4203065544' route_report_connection_bgp_model['is_used'] = True route_report_connection_bgp_model['local_preference'] = '190' route_report_connection_bgp_model['prefix'] = '172.17.0.0/16' - route_report_connection_route_model = {} # RouteReportConnectionRoute + route_report_connection_route_model = {} # RouteReportConnectionRoute route_report_connection_route_model['prefix'] = '192.168.0.0/16' # Construct a json representation of a RouteReportConnection model @@ -3105,7 +3438,8 @@ def test_route_report_connection_serialization(self): route_report_connection_model_json2 = route_report_connection_model.to_dict() assert route_report_connection_model_json2 == route_report_connection_model_json -class TestModel_RouteReportConnectionBgp(): + +class TestModel_RouteReportConnectionBgp: """ Test Class for RouteReportConnectionBgp """ @@ -3137,7 +3471,8 @@ def test_route_report_connection_bgp_serialization(self): route_report_connection_bgp_model_json2 = route_report_connection_bgp_model.to_dict() assert route_report_connection_bgp_model_json2 == route_report_connection_bgp_model_json -class TestModel_RouteReportConnectionRoute(): + +class TestModel_RouteReportConnectionRoute: """ Test Class for RouteReportConnectionRoute """ @@ -3166,7 +3501,8 @@ def test_route_report_connection_route_serialization(self): route_report_connection_route_model_json2 = route_report_connection_route_model.to_dict() assert route_report_connection_route_model_json2 == route_report_connection_route_model_json -class TestModel_RouteReportOverlappingRoute(): + +class TestModel_RouteReportOverlappingRoute: """ Test Class for RouteReportOverlappingRoute """ @@ -3196,7 +3532,8 @@ def test_route_report_overlapping_route_serialization(self): route_report_overlapping_route_model_json2 = route_report_overlapping_route_model.to_dict() assert route_report_overlapping_route_model_json2 == route_report_overlapping_route_model_json -class TestModel_RouteReportOverlappingRouteGroup(): + +class TestModel_RouteReportOverlappingRouteGroup: """ Test Class for RouteReportOverlappingRouteGroup """ @@ -3208,7 +3545,7 @@ def test_route_report_overlapping_route_group_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - route_report_overlapping_route_model = {} # RouteReportOverlappingRoute + route_report_overlapping_route_model = {} # RouteReportOverlappingRoute route_report_overlapping_route_model['connection_id'] = 'd2d985d8-1d8e-4e8b-96cd-cee2290ecaff' route_report_overlapping_route_model['prefix'] = 'testString' @@ -3231,7 +3568,8 @@ def test_route_report_overlapping_route_group_serialization(self): route_report_overlapping_route_group_model_json2 = route_report_overlapping_route_group_model.to_dict() assert route_report_overlapping_route_group_model_json2 == route_report_overlapping_route_group_model_json -class TestModel_TSCollection(): + +class TestModel_TSCollection: """ Test Class for TSCollection """ @@ -3243,7 +3581,7 @@ def test_ts_collection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - ts_location_basic_model = {} # TSLocationBasic + ts_location_basic_model = {} # TSLocationBasic ts_location_basic_model['billing_location'] = 'us' ts_location_basic_model['name'] = 'us-south' ts_location_basic_model['type'] = 'region' @@ -3267,7 +3605,8 @@ def test_ts_collection_serialization(self): ts_collection_model_json2 = ts_collection_model.to_dict() assert ts_collection_model_json2 == ts_collection_model_json -class TestModel_TSLocalLocation(): + +class TestModel_TSLocalLocation: """ Test Class for TSLocalLocation """ @@ -3281,7 +3620,7 @@ def test_ts_local_location_serialization(self): ts_local_location_model_json = {} ts_local_location_model_json['display_name'] = 'Dallas' ts_local_location_model_json['name'] = 'us-south' - ts_local_location_model_json['supported_connection_types'] = ['classic', 'vpc', 'directlink', 'gre_tunnel', 'power_virtual_server'] + ts_local_location_model_json['supported_connection_types'] = ['classic', 'vpc', 'directlink', 'gre_tunnel', 'power_virtual_server', 'unbound_gre_tunnel'] ts_local_location_model_json['type'] = 'region' # Construct a model instance of TSLocalLocation by calling from_dict on the json representation @@ -3299,7 +3638,8 @@ def test_ts_local_location_serialization(self): ts_local_location_model_json2 = ts_local_location_model.to_dict() assert ts_local_location_model_json2 == ts_local_location_model_json -class TestModel_TSLocation(): + +class TestModel_TSLocation: """ Test Class for TSLocation """ @@ -3311,10 +3651,10 @@ def test_ts_location_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - ts_local_location_model = {} # TSLocalLocation + ts_local_location_model = {} # TSLocalLocation ts_local_location_model['display_name'] = 'Dallas' ts_local_location_model['name'] = 'us-south' - ts_local_location_model['supported_connection_types'] = ['classic', 'vpc', 'directlink', 'gre_tunnel', 'power_virtual_server'] + ts_local_location_model['supported_connection_types'] = ['classic', 'vpc', 'directlink', 'gre_tunnel', 'power_virtual_server', 'unbound_gre_tunnel'] ts_local_location_model['type'] = 'region' # Construct a json representation of a TSLocation model @@ -3339,7 +3679,8 @@ def test_ts_location_serialization(self): ts_location_model_json2 = ts_location_model.to_dict() assert ts_location_model_json2 == ts_location_model_json -class TestModel_TSLocationBasic(): + +class TestModel_TSLocationBasic: """ Test Class for TSLocationBasic """ @@ -3370,7 +3711,8 @@ def test_ts_location_basic_serialization(self): ts_location_basic_model_json2 = ts_location_basic_model.to_dict() assert ts_location_basic_model_json2 == ts_location_basic_model_json -class TestModel_TransitConnection(): + +class TestModel_TransitConnection: """ Test Class for TransitConnection """ @@ -3382,28 +3724,28 @@ def test_transit_connection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - transit_gateway_connection_prefix_filter_reference_model = {} # TransitGatewayConnectionPrefixFilterReference + transit_gateway_connection_prefix_filter_reference_model = {} # TransitGatewayConnectionPrefixFilterReference transit_gateway_connection_prefix_filter_reference_model['action'] = 'permit' transit_gateway_connection_prefix_filter_reference_model['before'] = '1a15dcab-7e40-45e1-b7c5-bc690eaa9782' - transit_gateway_connection_prefix_filter_reference_model['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_prefix_filter_reference_model['ge'] = 0 transit_gateway_connection_prefix_filter_reference_model['id'] = '1a15dcab-7e30-45e1-b7c5-bc690eaa9865' transit_gateway_connection_prefix_filter_reference_model['le'] = 32 transit_gateway_connection_prefix_filter_reference_model['prefix'] = '192.168.100.0/24' - transit_gateway_connection_prefix_filter_reference_model['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model['updated_at'] = '2019-01-01T12:00:00Z' - transit_gateway_reference_model = {} # TransitGatewayReference + transit_gateway_reference_model = {} # TransitGatewayReference transit_gateway_reference_model['crn'] = 'crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44' transit_gateway_reference_model['id'] = '456f58c1-afe7-123a-0a0a-7f3d720f1a44' transit_gateway_reference_model['name'] = 'my-transit-gw100' - zone_reference_model = {} # ZoneReference + zone_reference_model = {} # ZoneReference zone_reference_model['name'] = 'us-south-1' # Construct a json representation of a TransitConnection model transit_connection_model_json = {} transit_connection_model_json['base_connection_id'] = '975f58c1-afe7-469a-9727-7f3d720f2d32' - transit_connection_model_json['created_at'] = "2019-01-01T12:00:00Z" + transit_connection_model_json['created_at'] = '2019-01-01T12:00:00Z' transit_connection_model_json['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' transit_connection_model_json['local_bgp_asn'] = 64490 transit_connection_model_json['local_gateway_ip'] = '192.168.100.1' @@ -3421,7 +3763,7 @@ def test_transit_connection_serialization(self): transit_connection_model_json['request_status'] = 'pending' transit_connection_model_json['status'] = 'attached' transit_connection_model_json['transit_gateway'] = transit_gateway_reference_model - transit_connection_model_json['updated_at'] = "2019-01-01T12:00:00Z" + transit_connection_model_json['updated_at'] = '2019-01-01T12:00:00Z' transit_connection_model_json['zone'] = zone_reference_model # Construct a model instance of TransitConnection by calling from_dict on the json representation @@ -3439,7 +3781,8 @@ def test_transit_connection_serialization(self): transit_connection_model_json2 = transit_connection_model.to_dict() assert transit_connection_model_json2 == transit_connection_model_json -class TestModel_TransitConnectionCollection(): + +class TestModel_TransitConnectionCollection: """ Test Class for TransitConnectionCollection """ @@ -3451,27 +3794,27 @@ def test_transit_connection_collection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - transit_gateway_connection_prefix_filter_reference_model = {} # TransitGatewayConnectionPrefixFilterReference + transit_gateway_connection_prefix_filter_reference_model = {} # TransitGatewayConnectionPrefixFilterReference transit_gateway_connection_prefix_filter_reference_model['action'] = 'permit' transit_gateway_connection_prefix_filter_reference_model['before'] = '1a15dcab-7e40-45e1-b7c5-bc690eaa9782' - transit_gateway_connection_prefix_filter_reference_model['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_prefix_filter_reference_model['ge'] = 0 transit_gateway_connection_prefix_filter_reference_model['id'] = '1a15dcab-7e30-45e1-b7c5-bc690eaa9865' transit_gateway_connection_prefix_filter_reference_model['le'] = 32 transit_gateway_connection_prefix_filter_reference_model['prefix'] = '192.168.100.0/24' - transit_gateway_connection_prefix_filter_reference_model['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model['updated_at'] = '2019-01-01T12:00:00Z' - transit_gateway_reference_model = {} # TransitGatewayReference + transit_gateway_reference_model = {} # TransitGatewayReference transit_gateway_reference_model['crn'] = 'crn:v1:bluemix:public:transit:us-south:a/123456::gateway:456f58c1-afe7-123a-0a0a-7f3d720f1a44' transit_gateway_reference_model['id'] = '456f58c1-afe7-123a-0a0a-7f3d720f1a44' transit_gateway_reference_model['name'] = 'my-transit-gw100' - zone_reference_model = {} # ZoneReference + zone_reference_model = {} # ZoneReference zone_reference_model['name'] = 'us-south-1' - transit_connection_model = {} # TransitConnection + transit_connection_model = {} # TransitConnection transit_connection_model['base_connection_id'] = '975f58c1-afe7-469a-9727-7f3d720f2d32' - transit_connection_model['created_at'] = "2019-01-01T12:00:00Z" + transit_connection_model['created_at'] = '2019-01-01T12:00:00Z' transit_connection_model['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' transit_connection_model['local_bgp_asn'] = 64490 transit_connection_model['local_gateway_ip'] = '192.168.100.1' @@ -3489,22 +3832,22 @@ def test_transit_connection_collection_serialization(self): transit_connection_model['request_status'] = 'pending' transit_connection_model['status'] = 'attached' transit_connection_model['transit_gateway'] = transit_gateway_reference_model - transit_connection_model['updated_at'] = "2019-01-01T12:00:00Z" + transit_connection_model['updated_at'] = '2019-01-01T12:00:00Z' transit_connection_model['zone'] = zone_reference_model - transit_connection_collection_first_model = {} # TransitConnectionCollectionFirst - transit_connection_collection_first_model['href'] = 'https://transit.cloud.ibm.com/v1/connections?limit=50' + pagination_first_connection_model = {} # PaginationFirstConnection + pagination_first_connection_model['href'] = 'https://transit.cloud.ibm.com/v1/connections?limit=50' - transit_connection_collection_next_model = {} # TransitConnectionCollectionNext - transit_connection_collection_next_model['href'] = 'https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa&limit=50' - transit_connection_collection_next_model['start'] = 'MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa' + pagination_next_connection_model = {} # PaginationNextConnection + pagination_next_connection_model['href'] = 'https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50' + pagination_next_connection_model['start'] = 'MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa' # Construct a json representation of a TransitConnectionCollection model transit_connection_collection_model_json = {} transit_connection_collection_model_json['connections'] = [transit_connection_model] - transit_connection_collection_model_json['first'] = transit_connection_collection_first_model + transit_connection_collection_model_json['first'] = pagination_first_connection_model transit_connection_collection_model_json['limit'] = 50 - transit_connection_collection_model_json['next'] = transit_connection_collection_next_model + transit_connection_collection_model_json['next'] = pagination_next_connection_model # Construct a model instance of TransitConnectionCollection by calling from_dict on the json representation transit_connection_collection_model = TransitConnectionCollection.from_dict(transit_connection_collection_model_json) @@ -3521,66 +3864,8 @@ def test_transit_connection_collection_serialization(self): transit_connection_collection_model_json2 = transit_connection_collection_model.to_dict() assert transit_connection_collection_model_json2 == transit_connection_collection_model_json -class TestModel_TransitConnectionCollectionFirst(): - """ - Test Class for TransitConnectionCollectionFirst - """ - - def test_transit_connection_collection_first_serialization(self): - """ - Test serialization/deserialization for TransitConnectionCollectionFirst - """ - - # Construct a json representation of a TransitConnectionCollectionFirst model - transit_connection_collection_first_model_json = {} - transit_connection_collection_first_model_json['href'] = 'https://transit.cloud.ibm.com/v1/connections?limit=50' - - # Construct a model instance of TransitConnectionCollectionFirst by calling from_dict on the json representation - transit_connection_collection_first_model = TransitConnectionCollectionFirst.from_dict(transit_connection_collection_first_model_json) - assert transit_connection_collection_first_model != False - # Construct a model instance of TransitConnectionCollectionFirst by calling from_dict on the json representation - transit_connection_collection_first_model_dict = TransitConnectionCollectionFirst.from_dict(transit_connection_collection_first_model_json).__dict__ - transit_connection_collection_first_model2 = TransitConnectionCollectionFirst(**transit_connection_collection_first_model_dict) - - # Verify the model instances are equivalent - assert transit_connection_collection_first_model == transit_connection_collection_first_model2 - - # Convert model instance back to dict and verify no loss of data - transit_connection_collection_first_model_json2 = transit_connection_collection_first_model.to_dict() - assert transit_connection_collection_first_model_json2 == transit_connection_collection_first_model_json - -class TestModel_TransitConnectionCollectionNext(): - """ - Test Class for TransitConnectionCollectionNext - """ - - def test_transit_connection_collection_next_serialization(self): - """ - Test serialization/deserialization for TransitConnectionCollectionNext - """ - - # Construct a json representation of a TransitConnectionCollectionNext model - transit_connection_collection_next_model_json = {} - transit_connection_collection_next_model_json['href'] = 'https://transit.cloud.ibm.com/v1/connections?start=MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa&limit=50' - transit_connection_collection_next_model_json['start'] = 'MjAyMC0wNS0wOVQxNjoyMDoyMC4yMjQ5NzNa' - - # Construct a model instance of TransitConnectionCollectionNext by calling from_dict on the json representation - transit_connection_collection_next_model = TransitConnectionCollectionNext.from_dict(transit_connection_collection_next_model_json) - assert transit_connection_collection_next_model != False - - # Construct a model instance of TransitConnectionCollectionNext by calling from_dict on the json representation - transit_connection_collection_next_model_dict = TransitConnectionCollectionNext.from_dict(transit_connection_collection_next_model_json).__dict__ - transit_connection_collection_next_model2 = TransitConnectionCollectionNext(**transit_connection_collection_next_model_dict) - - # Verify the model instances are equivalent - assert transit_connection_collection_next_model == transit_connection_collection_next_model2 - - # Convert model instance back to dict and verify no loss of data - transit_connection_collection_next_model_json2 = transit_connection_collection_next_model.to_dict() - assert transit_connection_collection_next_model_json2 == transit_connection_collection_next_model_json - -class TestModel_TransitGateway(): +class TestModel_TransitGateway: """ Test Class for TransitGateway """ @@ -3592,7 +3877,7 @@ def test_transit_gateway_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - resource_group_reference_model = {} # ResourceGroupReference + resource_group_reference_model = {} # ResourceGroupReference resource_group_reference_model['id'] = '56969d6043e9465c883cb9f7363e78e8' resource_group_reference_model['href'] = 'https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8' @@ -3602,11 +3887,11 @@ def test_transit_gateway_serialization(self): transit_gateway_model_json['crn'] = 'crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' transit_gateway_model_json['name'] = 'my-transit-gateway-in-TransitGateway' transit_gateway_model_json['location'] = 'us-south' - transit_gateway_model_json['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_model_json['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_model_json['global'] = True transit_gateway_model_json['resource_group'] = resource_group_reference_model transit_gateway_model_json['status'] = 'available' - transit_gateway_model_json['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_model_json['updated_at'] = '2019-01-01T12:00:00Z' # Construct a model instance of TransitGateway by calling from_dict on the json representation transit_gateway_model = TransitGateway.from_dict(transit_gateway_model_json) @@ -3623,7 +3908,8 @@ def test_transit_gateway_serialization(self): transit_gateway_model_json2 = transit_gateway_model.to_dict() assert transit_gateway_model_json2 == transit_gateway_model_json -class TestModel_TransitGatewayCollection(): + +class TestModel_TransitGatewayCollection: """ Test Class for TransitGatewayCollection """ @@ -3635,33 +3921,33 @@ def test_transit_gateway_collection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - transit_gateway_collection_first_model = {} # TransitGatewayCollectionFirst - transit_gateway_collection_first_model['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways?limit=50' + pagination_first_tg_model = {} # PaginationFirstTG + pagination_first_tg_model['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways?limit=50' - transit_gateway_collection_next_model = {} # TransitGatewayCollectionNext - transit_gateway_collection_next_model['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50' - transit_gateway_collection_next_model['start'] = 'MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa' + pagination_next_tg_model = {} # PaginationNextTG + pagination_next_tg_model['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50' + pagination_next_tg_model['start'] = 'MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa' - resource_group_reference_model = {} # ResourceGroupReference + resource_group_reference_model = {} # ResourceGroupReference resource_group_reference_model['id'] = '56969d6043e9465c883cb9f7363e78e8' resource_group_reference_model['href'] = 'https://resource-manager.bluemix.net/v1/resource_groups/56969d6043e9465c883cb9f7363e78e8' - transit_gateway_model = {} # TransitGateway + transit_gateway_model = {} # TransitGateway transit_gateway_model['id'] = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' transit_gateway_model['crn'] = 'crn:v1:bluemix:public:transit:dal03:a/57a7d05f36894e3cb9b46a43556d903e::gateway:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' transit_gateway_model['name'] = 'my-transit-gateway-in-TransitGateway' transit_gateway_model['location'] = 'us-south' - transit_gateway_model['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_model['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_model['global'] = True transit_gateway_model['resource_group'] = resource_group_reference_model transit_gateway_model['status'] = 'available' - transit_gateway_model['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_model['updated_at'] = '2019-01-01T12:00:00Z' # Construct a json representation of a TransitGatewayCollection model transit_gateway_collection_model_json = {} - transit_gateway_collection_model_json['first'] = transit_gateway_collection_first_model + transit_gateway_collection_model_json['first'] = pagination_first_tg_model transit_gateway_collection_model_json['limit'] = 50 - transit_gateway_collection_model_json['next'] = transit_gateway_collection_next_model + transit_gateway_collection_model_json['next'] = pagination_next_tg_model transit_gateway_collection_model_json['transit_gateways'] = [transit_gateway_model] # Construct a model instance of TransitGatewayCollection by calling from_dict on the json representation @@ -3679,66 +3965,8 @@ def test_transit_gateway_collection_serialization(self): transit_gateway_collection_model_json2 = transit_gateway_collection_model.to_dict() assert transit_gateway_collection_model_json2 == transit_gateway_collection_model_json -class TestModel_TransitGatewayCollectionFirst(): - """ - Test Class for TransitGatewayCollectionFirst - """ - - def test_transit_gateway_collection_first_serialization(self): - """ - Test serialization/deserialization for TransitGatewayCollectionFirst - """ - - # Construct a json representation of a TransitGatewayCollectionFirst model - transit_gateway_collection_first_model_json = {} - transit_gateway_collection_first_model_json['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways?limit=50' - - # Construct a model instance of TransitGatewayCollectionFirst by calling from_dict on the json representation - transit_gateway_collection_first_model = TransitGatewayCollectionFirst.from_dict(transit_gateway_collection_first_model_json) - assert transit_gateway_collection_first_model != False - - # Construct a model instance of TransitGatewayCollectionFirst by calling from_dict on the json representation - transit_gateway_collection_first_model_dict = TransitGatewayCollectionFirst.from_dict(transit_gateway_collection_first_model_json).__dict__ - transit_gateway_collection_first_model2 = TransitGatewayCollectionFirst(**transit_gateway_collection_first_model_dict) - # Verify the model instances are equivalent - assert transit_gateway_collection_first_model == transit_gateway_collection_first_model2 - - # Convert model instance back to dict and verify no loss of data - transit_gateway_collection_first_model_json2 = transit_gateway_collection_first_model.to_dict() - assert transit_gateway_collection_first_model_json2 == transit_gateway_collection_first_model_json - -class TestModel_TransitGatewayCollectionNext(): - """ - Test Class for TransitGatewayCollectionNext - """ - - def test_transit_gateway_collection_next_serialization(self): - """ - Test serialization/deserialization for TransitGatewayCollectionNext - """ - - # Construct a json representation of a TransitGatewayCollectionNext model - transit_gateway_collection_next_model_json = {} - transit_gateway_collection_next_model_json['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50' - transit_gateway_collection_next_model_json['start'] = 'MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa' - - # Construct a model instance of TransitGatewayCollectionNext by calling from_dict on the json representation - transit_gateway_collection_next_model = TransitGatewayCollectionNext.from_dict(transit_gateway_collection_next_model_json) - assert transit_gateway_collection_next_model != False - - # Construct a model instance of TransitGatewayCollectionNext by calling from_dict on the json representation - transit_gateway_collection_next_model_dict = TransitGatewayCollectionNext.from_dict(transit_gateway_collection_next_model_json).__dict__ - transit_gateway_collection_next_model2 = TransitGatewayCollectionNext(**transit_gateway_collection_next_model_dict) - - # Verify the model instances are equivalent - assert transit_gateway_collection_next_model == transit_gateway_collection_next_model2 - - # Convert model instance back to dict and verify no loss of data - transit_gateway_collection_next_model_json2 = transit_gateway_collection_next_model.to_dict() - assert transit_gateway_collection_next_model_json2 == transit_gateway_collection_next_model_json - -class TestModel_TransitGatewayConnectionCollection(): +class TestModel_TransitGatewayConnectionCollection: """ Test Class for TransitGatewayConnectionCollection """ @@ -3750,27 +3978,27 @@ def test_transit_gateway_connection_collection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - transit_gateway_connection_prefix_filter_reference_model = {} # TransitGatewayConnectionPrefixFilterReference + transit_gateway_connection_prefix_filter_reference_model = {} # TransitGatewayConnectionPrefixFilterReference transit_gateway_connection_prefix_filter_reference_model['action'] = 'permit' transit_gateway_connection_prefix_filter_reference_model['before'] = '1a15dcab-7e40-45e1-b7c5-bc690eaa9782' - transit_gateway_connection_prefix_filter_reference_model['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_prefix_filter_reference_model['ge'] = 0 transit_gateway_connection_prefix_filter_reference_model['id'] = '1a15dcab-7e30-45e1-b7c5-bc690eaa9865' transit_gateway_connection_prefix_filter_reference_model['le'] = 32 transit_gateway_connection_prefix_filter_reference_model['prefix'] = '192.168.100.0/24' - transit_gateway_connection_prefix_filter_reference_model['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model['updated_at'] = '2019-01-01T12:00:00Z' - transit_gateway_connection_cust_zone_model = {} # TransitGatewayConnectionCustZone + transit_gateway_connection_cust_zone_model = {} # TransitGatewayConnectionCustZone transit_gateway_connection_cust_zone_model['name'] = 'us-south-1' - transit_gateway_connection_cust_model = {} # TransitGatewayConnectionCust + transit_gateway_connection_cust_model = {} # TransitGatewayConnectionCust transit_gateway_connection_cust_model['base_network_type'] = 'classic' transit_gateway_connection_cust_model['name'] = 'Transit_Service_BWTN_SJ_DL' transit_gateway_connection_cust_model['network_id'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' transit_gateway_connection_cust_model['network_type'] = 'vpc' transit_gateway_connection_cust_model['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' transit_gateway_connection_cust_model['base_connection_id'] = '975f58c1-afe7-469a-9727-7f3d720f2d32' - transit_gateway_connection_cust_model['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_cust_model['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_cust_model['local_bgp_asn'] = 64490 transit_gateway_connection_cust_model['local_gateway_ip'] = '192.168.100.1' transit_gateway_connection_cust_model['local_tunnel_ip'] = '192.168.129.2' @@ -3783,12 +4011,23 @@ def test_transit_gateway_connection_collection_serialization(self): transit_gateway_connection_cust_model['remote_tunnel_ip'] = '192.168.129.1' transit_gateway_connection_cust_model['request_status'] = 'pending' transit_gateway_connection_cust_model['status'] = 'attached' - transit_gateway_connection_cust_model['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_cust_model['updated_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_cust_model['zone'] = transit_gateway_connection_cust_zone_model + pagination_first_tgw_connection_model = {} # PaginationFirstTGWConnection + pagination_first_tgw_connection_model['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?limit=50' + + pagination_next_tgw_connection_model = {} # PaginationNextTGWConnection + pagination_next_tgw_connection_model['href'] = 'https://transit.cloud.ibm.com/v1/transit_gateways/{transit_gateway_id}/connections?start=MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa&limit=50' + pagination_next_tgw_connection_model['start'] = 'MjAyMC0wNS0wOFQxNDoxNzowMy45NzQ5NzNa' + # Construct a json representation of a TransitGatewayConnectionCollection model transit_gateway_connection_collection_model_json = {} transit_gateway_connection_collection_model_json['connections'] = [transit_gateway_connection_cust_model] + transit_gateway_connection_collection_model_json['first'] = pagination_first_tgw_connection_model + transit_gateway_connection_collection_model_json['limit'] = 50 + transit_gateway_connection_collection_model_json['next'] = pagination_next_tgw_connection_model + transit_gateway_connection_collection_model_json['total_count'] = 500 # Construct a model instance of TransitGatewayConnectionCollection by calling from_dict on the json representation transit_gateway_connection_collection_model = TransitGatewayConnectionCollection.from_dict(transit_gateway_connection_collection_model_json) @@ -3805,7 +4044,8 @@ def test_transit_gateway_connection_collection_serialization(self): transit_gateway_connection_collection_model_json2 = transit_gateway_connection_collection_model.to_dict() assert transit_gateway_connection_collection_model_json2 == transit_gateway_connection_collection_model_json -class TestModel_TransitGatewayConnectionCust(): + +class TestModel_TransitGatewayConnectionCust: """ Test Class for TransitGatewayConnectionCust """ @@ -3817,17 +4057,17 @@ def test_transit_gateway_connection_cust_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - transit_gateway_connection_prefix_filter_reference_model = {} # TransitGatewayConnectionPrefixFilterReference + transit_gateway_connection_prefix_filter_reference_model = {} # TransitGatewayConnectionPrefixFilterReference transit_gateway_connection_prefix_filter_reference_model['action'] = 'permit' transit_gateway_connection_prefix_filter_reference_model['before'] = '1a15dcab-7e40-45e1-b7c5-bc690eaa9782' - transit_gateway_connection_prefix_filter_reference_model['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_prefix_filter_reference_model['ge'] = 0 transit_gateway_connection_prefix_filter_reference_model['id'] = '1a15dcab-7e30-45e1-b7c5-bc690eaa9865' transit_gateway_connection_prefix_filter_reference_model['le'] = 32 transit_gateway_connection_prefix_filter_reference_model['prefix'] = '192.168.100.0/24' - transit_gateway_connection_prefix_filter_reference_model['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model['updated_at'] = '2019-01-01T12:00:00Z' - transit_gateway_connection_cust_zone_model = {} # TransitGatewayConnectionCustZone + transit_gateway_connection_cust_zone_model = {} # TransitGatewayConnectionCustZone transit_gateway_connection_cust_zone_model['name'] = 'us-south-1' # Construct a json representation of a TransitGatewayConnectionCust model @@ -3838,7 +4078,7 @@ def test_transit_gateway_connection_cust_serialization(self): transit_gateway_connection_cust_model_json['network_type'] = 'vpc' transit_gateway_connection_cust_model_json['id'] = '1a15dca5-7e33-45e1-b7c5-bc690e569531' transit_gateway_connection_cust_model_json['base_connection_id'] = '975f58c1-afe7-469a-9727-7f3d720f2d32' - transit_gateway_connection_cust_model_json['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_cust_model_json['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_cust_model_json['local_bgp_asn'] = 64490 transit_gateway_connection_cust_model_json['local_gateway_ip'] = '192.168.100.1' transit_gateway_connection_cust_model_json['local_tunnel_ip'] = '192.168.129.2' @@ -3851,7 +4091,7 @@ def test_transit_gateway_connection_cust_serialization(self): transit_gateway_connection_cust_model_json['remote_tunnel_ip'] = '192.168.129.1' transit_gateway_connection_cust_model_json['request_status'] = 'pending' transit_gateway_connection_cust_model_json['status'] = 'attached' - transit_gateway_connection_cust_model_json['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_cust_model_json['updated_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_cust_model_json['zone'] = transit_gateway_connection_cust_zone_model # Construct a model instance of TransitGatewayConnectionCust by calling from_dict on the json representation @@ -3869,7 +4109,8 @@ def test_transit_gateway_connection_cust_serialization(self): transit_gateway_connection_cust_model_json2 = transit_gateway_connection_cust_model.to_dict() assert transit_gateway_connection_cust_model_json2 == transit_gateway_connection_cust_model_json -class TestModel_TransitGatewayConnectionCustZone(): + +class TestModel_TransitGatewayConnectionCustZone: """ Test Class for TransitGatewayConnectionCustZone """ @@ -3898,7 +4139,8 @@ def test_transit_gateway_connection_cust_zone_serialization(self): transit_gateway_connection_cust_zone_model_json2 = transit_gateway_connection_cust_zone_model.to_dict() assert transit_gateway_connection_cust_zone_model_json2 == transit_gateway_connection_cust_zone_model_json -class TestModel_TransitGatewayConnectionPrefixFilter(): + +class TestModel_TransitGatewayConnectionPrefixFilter: """ Test Class for TransitGatewayConnectionPrefixFilter """ @@ -3930,7 +4172,8 @@ def test_transit_gateway_connection_prefix_filter_serialization(self): transit_gateway_connection_prefix_filter_model_json2 = transit_gateway_connection_prefix_filter_model.to_dict() assert transit_gateway_connection_prefix_filter_model_json2 == transit_gateway_connection_prefix_filter_model_json -class TestModel_TransitGatewayConnectionPrefixFilterReference(): + +class TestModel_TransitGatewayConnectionPrefixFilterReference: """ Test Class for TransitGatewayConnectionPrefixFilterReference """ @@ -3944,12 +4187,12 @@ def test_transit_gateway_connection_prefix_filter_reference_serialization(self): transit_gateway_connection_prefix_filter_reference_model_json = {} transit_gateway_connection_prefix_filter_reference_model_json['action'] = 'permit' transit_gateway_connection_prefix_filter_reference_model_json['before'] = '1a15dcab-7e40-45e1-b7c5-bc690eaa9782' - transit_gateway_connection_prefix_filter_reference_model_json['created_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model_json['created_at'] = '2019-01-01T12:00:00Z' transit_gateway_connection_prefix_filter_reference_model_json['ge'] = 0 transit_gateway_connection_prefix_filter_reference_model_json['id'] = '1a15dcab-7e30-45e1-b7c5-bc690eaa9865' transit_gateway_connection_prefix_filter_reference_model_json['le'] = 32 transit_gateway_connection_prefix_filter_reference_model_json['prefix'] = '192.168.100.0/24' - transit_gateway_connection_prefix_filter_reference_model_json['updated_at'] = "2019-01-01T12:00:00Z" + transit_gateway_connection_prefix_filter_reference_model_json['updated_at'] = '2019-01-01T12:00:00Z' # Construct a model instance of TransitGatewayConnectionPrefixFilterReference by calling from_dict on the json representation transit_gateway_connection_prefix_filter_reference_model = TransitGatewayConnectionPrefixFilterReference.from_dict(transit_gateway_connection_prefix_filter_reference_model_json) @@ -3966,7 +4209,8 @@ def test_transit_gateway_connection_prefix_filter_reference_serialization(self): transit_gateway_connection_prefix_filter_reference_model_json2 = transit_gateway_connection_prefix_filter_reference_model.to_dict() assert transit_gateway_connection_prefix_filter_reference_model_json2 == transit_gateway_connection_prefix_filter_reference_model_json -class TestModel_TransitGatewayReference(): + +class TestModel_TransitGatewayReference: """ Test Class for TransitGatewayReference """ @@ -3997,7 +4241,8 @@ def test_transit_gateway_reference_serialization(self): transit_gateway_reference_model_json2 = transit_gateway_reference_model.to_dict() assert transit_gateway_reference_model_json2 == transit_gateway_reference_model_json -class TestModel_ZoneReference(): + +class TestModel_ZoneReference: """ Test Class for ZoneReference """ @@ -4026,7 +4271,8 @@ def test_zone_reference_serialization(self): zone_reference_model_json2 = zone_reference_model.to_dict() assert zone_reference_model_json2 == zone_reference_model_json -class TestModel_ZoneIdentityByName(): + +class TestModel_ZoneIdentityByName: """ Test Class for ZoneIdentityByName """