From a3416e4631ccd0c72f56a22c5ffd04f482a763dc Mon Sep 17 00:00:00 2001 From: Sridhar G K Date: Wed, 15 Oct 2025 00:25:18 +0530 Subject: [PATCH 1/2] feat: transit-gateway vpnaas changes Signed-off-by: Sridhar G K --- .../transit_gateway_apis_v1.py | 1349 ++++++++--------- .../test_transit_gateway_apis_v1.py | 67 +- test/unit/test_transit_gateway_apis_v1.py | 104 +- 3 files changed, 755 insertions(+), 765 deletions(-) diff --git a/ibm_cloud_networking_services/transit_gateway_apis_v1.py b/ibm_cloud_networking_services/transit_gateway_apis_v1.py index 8002e18..7f1a72d 100644 --- a/ibm_cloud_networking_services/transit_gateway_apis_v1.py +++ b/ibm_cloud_networking_services/transit_gateway_apis_v1.py @@ -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.73.0-eeee85a9-20230607-165104 +# IBM OpenAPI SDK Code Generator Version: 3.107.1-41b0fbd0-20250825-080732 """ No description provided (generated by Openapi Generator @@ -25,7 +25,7 @@ from datetime import datetime from enum import Enum -from typing import Dict, List +from typing import Dict, List, Optional import json from ibm_cloud_sdk_core import BaseService, DetailedResponse @@ -100,8 +100,8 @@ def __init__( def list_transit_gateways( self, *, - limit: int = None, - start: str = None, + limit: Optional[int] = None, + start: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -153,9 +153,9 @@ def create_transit_gateway( location: str, name: str, *, - global_: bool = None, - gre_enhanced_route_propagation: bool = None, - resource_group: 'ResourceGroupIdentity' = None, + global_: Optional[bool] = None, + gre_enhanced_route_propagation: Optional[bool] = None, + resource_group: Optional['ResourceGroupIdentity'] = None, **kwargs, ) -> DetailedResponse: """ @@ -329,9 +329,9 @@ def update_transit_gateway( self, id: str, *, - global_: bool = None, - gre_enhanced_route_propagation: bool = None, - name: str = None, + global_: Optional[bool] = None, + gre_enhanced_route_propagation: Optional[bool] = None, + name: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -402,10 +402,10 @@ def update_transit_gateway( def list_connections( self, *, - limit: int = None, - start: str = None, - network_id: str = None, - network_type: str = None, + limit: Optional[int] = None, + start: Optional[str] = None, + network_id: Optional[str] = None, + network_type: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -466,9 +466,9 @@ def list_transit_gateway_connections( self, transit_gateway_id: str, *, - start: str = None, - limit: int = None, - name: str = None, + start: Optional[str] = None, + limit: Optional[int] = None, + name: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -528,21 +528,21 @@ def create_transit_gateway_connection( transit_gateway_id: str, network_type: str, *, - base_connection_id: str = None, - base_network_type: str = None, - cidr: 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, - tunnels: List['TransitGatewayTunnelTemplate'] = None, - zone: 'ZoneIdentity' = None, + base_connection_id: Optional[str] = None, + base_network_type: Optional[str] = None, + cidr: Optional[str] = None, + local_gateway_ip: Optional[str] = None, + local_tunnel_ip: Optional[str] = None, + name: Optional[str] = None, + network_account_id: Optional[str] = None, + network_id: Optional[str] = None, + prefix_filters: Optional[List['TransitGatewayConnectionPrefixFilter']] = None, + prefix_filters_default: Optional[str] = None, + remote_bgp_asn: Optional[int] = None, + remote_gateway_ip: Optional[str] = None, + remote_tunnel_ip: Optional[str] = None, + tunnels: Optional[List['TransitGatewayTunnelTemplate']] = None, + zone: Optional['ZoneIdentity'] = None, **kwargs, ) -> DetailedResponse: """ @@ -571,9 +571,7 @@ def create_transit_gateway_connection( connections. :param str cidr: (optional) network_type 'vpn_gateway' connections use 'cidr' to specify the CIDR to use for the VPN GRE tunnels. - This field is optional for network type `vpn_gateway` connections. - If left unspecified when creating a `vpn_gateway` connection, a default - cidr address of `100.64.0.0/10` will be used. + This field is required for network type `vpn_gateway` connections. This field is required to be unspecified for network type `classic`, `directlink`, `vpc`, `power_virtual_server`, `gre_tunnel`, `unbound_gre_tunnel`, and `redundant_gre` connections. @@ -845,8 +843,8 @@ def update_transit_gateway_connection( transit_gateway_id: str, id: str, *, - name: str = None, - prefix_filters_default: str = None, + name: Optional[str] = None, + prefix_filters_default: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -1040,7 +1038,7 @@ def create_transit_gateway_gre_tunnel( remote_tunnel_ip: str, zone: 'ZoneIdentity', *, - remote_bgp_asn: int = None, + remote_bgp_asn: Optional[int] = None, **kwargs, ) -> DetailedResponse: """ @@ -1474,16 +1472,18 @@ def create_transit_gateway_connection_prefix_filter( action: str, prefix: str, *, - before: str = None, - ge: int = None, - le: int = None, + before: Optional[str] = None, + ge: Optional[int] = None, + le: Optional[int] = None, **kwargs, ) -> DetailedResponse: """ Add a prefix filter to a Transit Gateway connection. Add a Prefix Filter to a Transit Gateway Connection. Prefix Filters can be added - to all Connection types. + to `vpc`, `classic`, `directlink`, and `power_virtual_server` Connection types. + Prefix Filters cannot be added to `gre_tunnel`, `unbound_gre_tunnel`, + `redundant_gre` or `vpn_gateway` Connection types. :param str transit_gateway_id: The Transit Gateway identifier. :param str id: The connection identifier. @@ -1760,11 +1760,11 @@ def update_transit_gateway_connection_prefix_filter( id: str, filter_id: str, *, - action: str = None, - before: str = None, - ge: int = None, - le: int = None, - prefix: str = None, + action: Optional[str] = None, + before: Optional[str] = None, + ge: Optional[int] = None, + le: Optional[int] = None, + prefix: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -2077,7 +2077,7 @@ class PaginationFirstConnection: """ A reference to the first page of resources. - :attr str href: url. + :param str href: url. """ def __init__( @@ -2095,8 +2095,8 @@ def __init__( 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') + if (href := _dict.get('href')) is not None: + args['href'] = href else: raise ValueError('Required property \'href\' not present in PaginationFirstConnection JSON') return cls(**args) @@ -2136,7 +2136,7 @@ class PaginationFirstTG: """ A reference to the first page of resources. - :attr str href: url. + :param str href: url. """ def __init__( @@ -2154,8 +2154,8 @@ def __init__( 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') + if (href := _dict.get('href')) is not None: + args['href'] = href else: raise ValueError('Required property \'href\' not present in PaginationFirstTG JSON') return cls(**args) @@ -2196,7 +2196,7 @@ 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. + :param str href: url. """ def __init__( @@ -2214,8 +2214,8 @@ def __init__( 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') + if (href := _dict.get('href')) is not None: + args['href'] = href else: raise ValueError('Required property \'href\' not present in PaginationFirstTGWConnection JSON') return cls(**args) @@ -2256,8 +2256,8 @@ 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. + :param str href: url. + :param str start: server generated start token for next page of resources. """ def __init__( @@ -2278,12 +2278,12 @@ def __init__( 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') + if (href := _dict.get('href')) is not None: + args['href'] = href else: raise ValueError('Required property \'href\' not present in PaginationNextConnection JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') + if (start := _dict.get('start')) is not None: + args['start'] = start else: raise ValueError('Required property \'start\' not present in PaginationNextConnection JSON') return cls(**args) @@ -2326,8 +2326,8 @@ 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. + :param str href: url. + :param str start: server generated start token for next page of resources. """ def __init__( @@ -2348,12 +2348,12 @@ def __init__( 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') + if (href := _dict.get('href')) is not None: + args['href'] = href else: raise ValueError('Required property \'href\' not present in PaginationNextTG JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') + if (start := _dict.get('start')) is not None: + args['start'] = start else: raise ValueError('Required property \'start\' not present in PaginationNextTG JSON') return cls(**args) @@ -2396,8 +2396,8 @@ 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. + :param str href: url. + :param str start: server generated start token for next page of resources. """ def __init__( @@ -2418,12 +2418,12 @@ def __init__( 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') + if (href := _dict.get('href')) is not None: + args['href'] = href else: raise ValueError('Required property \'href\' not present in PaginationNextTGWConnection JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') + if (start := _dict.get('start')) is not None: + args['start'] = start else: raise ValueError('Required property \'start\' not present in PaginationNextTGWConnection JSON') return cls(**args) @@ -2465,7 +2465,7 @@ class PrefixFilterCollection: """ prefix filters. - :attr List[PrefixFilterCust] prefix_filters: Array of prefix filters. + :param List[PrefixFilterCust] prefix_filters: Array of prefix filters. """ def __init__( @@ -2483,8 +2483,8 @@ def __init__( 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(v) for v in _dict.get('prefix_filters')] + if (prefix_filters := _dict.get('prefix_filters')) is not None: + args['prefix_filters'] = [PrefixFilterCust.from_dict(v) for v in prefix_filters] else: raise ValueError('Required property \'prefix_filters\' not present in PrefixFilterCollection JSON') return cls(**args) @@ -2530,18 +2530,18 @@ class PrefixFilterCust: """ prefix filter. - :attr str action: Whether or not this prefix filter should allow or deny + :param 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 + :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. - :attr datetime created_at: The date and time that this prefix filter was + :param datetime created_at: The date and time that this prefix filter was created. - :attr int ge: (optional) Defines the minimum matched prefix precision. If this + :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 @@ -2549,8 +2549,8 @@ class PrefixFilterCust: 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) Defines the maximum matched prefix precision. If this + :param str id: Prefix Filter identifier. + :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 @@ -2558,12 +2558,12 @@ class PrefixFilterCust: 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 + :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`. - :attr datetime updated_at: (optional) The date and time that this prefix filter + :param datetime updated_at: (optional) The date and time that this prefix filter was last updated. """ @@ -2574,10 +2574,10 @@ def __init__( id: str, prefix: str, *, - before: str = None, - ge: int = None, - le: int = None, - updated_at: datetime = None, + before: Optional[str] = None, + ge: Optional[int] = None, + le: Optional[int] = None, + updated_at: Optional[datetime] = None, ) -> None: """ Initialize a PrefixFilterCust object. @@ -2633,30 +2633,30 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'PrefixFilterCust': """Initialize a PrefixFilterCust object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') + if (action := _dict.get('action')) is not None: + args['action'] = action else: 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')) + if (before := _dict.get('before')) is not None: + args['before'] = before + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) else: 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') + if (ge := _dict.get('ge')) is not None: + args['ge'] = ge + if (id := _dict.get('id')) is not None: + args['id'] = id else: 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') + if (le := _dict.get('le')) is not None: + args['le'] = le + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix else: 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')) + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) return cls(**args) @classmethod @@ -2718,9 +2718,9 @@ class PrefixFilterPut: """ A prefix filter update template. - :attr str action: Whether or not this prefix filter should allow or deny + :param 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 + :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 @@ -2728,7 +2728,7 @@ class PrefixFilterPut: 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 + :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 @@ -2736,10 +2736,10 @@ class PrefixFilterPut: 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 + :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`. """ @@ -2748,8 +2748,8 @@ def __init__( action: str, prefix: str, *, - ge: int = None, - le: int = None, + ge: Optional[int] = None, + le: Optional[int] = None, ) -> None: """ Initialize a PrefixFilterPut object. @@ -2789,16 +2789,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'PrefixFilterPut': """Initialize a PrefixFilterPut object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') + if (action := _dict.get('action')) is not None: + args['action'] = action else: raise ValueError('Required property \'action\' not present in PrefixFilterPut JSON') - if 'ge' in _dict: - args['ge'] = _dict.get('ge') - if 'le' in _dict: - args['le'] = _dict.get('le') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (ge := _dict.get('ge')) is not None: + args['ge'] = ge + if (le := _dict.get('le')) is not None: + args['le'] = le + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix else: raise ValueError('Required property \'prefix\' not present in PrefixFilterPut JSON') return cls(**args) @@ -2855,7 +2855,7 @@ 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. - :attr str id: The unique identifier for this resource group. + :param str id: The unique identifier for this resource group. """ def __init__( @@ -2873,8 +2873,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'ResourceGroupIdentity': """Initialize a ResourceGroupIdentity object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' not present in ResourceGroupIdentity JSON') return cls(**args) @@ -2915,8 +2915,8 @@ 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. - :attr str href: The URL for this resource group. - :attr str id: The unique identifier for this resource group. + :param str href: The URL for this resource group. + :param str id: The unique identifier for this resource group. """ def __init__( @@ -2937,12 +2937,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'ResourceGroupReference': """Initialize a ResourceGroupReference object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if (href := _dict.get('href')) is not None: + args['href'] = href else: raise ValueError('Required property \'href\' not present in ResourceGroupReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' not present in ResourceGroupReference JSON') return cls(**args) @@ -2984,16 +2984,16 @@ class RouteReport: """ route report. - :attr List[RouteReportConnection] connections: Array of connections with their + :param List[RouteReportConnection] connections: Array of connections with their routes. - :attr datetime created_at: Date and time route report was requested. - :attr str id: Report identifier. - :attr List[RouteReportOverlappingRouteGroup] overlapping_routes: Array of + :param datetime created_at: Date and time route report was requested. + :param str id: Report identifier. + :param List[RouteReportOverlappingRouteGroup] overlapping_routes: Array of overlapping routes. - :attr str status: Route report status. The list of enumerated values for this + :param str status: 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. - :attr datetime updated_at: (optional) Date and time route report was last + :param datetime updated_at: (optional) Date and time route report was last modified. """ @@ -3005,7 +3005,7 @@ def __init__( overlapping_routes: List['RouteReportOverlappingRouteGroup'], status: str, *, - updated_at: datetime = None, + updated_at: Optional[datetime] = None, ) -> None: """ Initialize a RouteReport object. @@ -3033,28 +3033,28 @@ def __init__( 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(v) for v in _dict.get('connections')] + if (connections := _dict.get('connections')) is not None: + args['connections'] = [RouteReportConnection.from_dict(v) for v in connections] else: 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')) + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) else: raise ValueError('Required property \'created_at\' not present in RouteReport JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' not present in RouteReport JSON') - if 'overlapping_routes' in _dict: - args['overlapping_routes'] = [RouteReportOverlappingRouteGroup.from_dict(v) for v in _dict.get('overlapping_routes')] + if (overlapping_routes := _dict.get('overlapping_routes')) is not None: + args['overlapping_routes'] = [RouteReportOverlappingRouteGroup.from_dict(v) for v in overlapping_routes] else: raise ValueError('Required property \'overlapping_routes\' not present in RouteReport JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + if (status := _dict.get('status')) is not None: + args['status'] = status else: 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')) + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) return cls(**args) @classmethod @@ -3125,7 +3125,7 @@ class RouteReportCollection: """ route reports. - :attr List[RouteReport] route_reports: Array of route reports. + :param List[RouteReport] route_reports: Array of route reports. """ def __init__( @@ -3143,8 +3143,8 @@ def __init__( 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(v) for v in _dict.get('route_reports')] + if (route_reports := _dict.get('route_reports')) is not None: + args['route_reports'] = [RouteReport.from_dict(v) for v in route_reports] else: raise ValueError('Required property \'route_reports\' not present in RouteReportCollection JSON') return cls(**args) @@ -3190,23 +3190,23 @@ class RouteReportConnection: """ route report connection. - :attr List[RouteReportConnectionBgp] bgps: (optional) Array of connection's + :param List[RouteReportConnectionBgp] bgps: (optional) Array of connection's bgps. - :attr str id: (optional) connection ID. - :attr str name: (optional) connection name. - :attr List[RouteReportConnectionRoute] routes: (optional) Array of connection's + :param str id: (optional) connection ID. + :param str name: (optional) connection name. + :param List[RouteReportConnectionRoute] routes: (optional) Array of connection's routes. - :attr str type: (optional) connection type. + :param 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, + bgps: Optional[List['RouteReportConnectionBgp']] = None, + id: Optional[str] = None, + name: Optional[str] = None, + routes: Optional[List['RouteReportConnectionRoute']] = None, + type: Optional[str] = None, ) -> None: """ Initialize a RouteReportConnection object. @@ -3229,16 +3229,16 @@ def __init__( 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(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(v) for v in _dict.get('routes')] - if 'type' in _dict: - args['type'] = _dict.get('type') + if (bgps := _dict.get('bgps')) is not None: + args['bgps'] = [RouteReportConnectionBgp.from_dict(v) for v in bgps] + if (id := _dict.get('id')) is not None: + args['id'] = id + if (name := _dict.get('name')) is not None: + args['name'] = name + if (routes := _dict.get('routes')) is not None: + args['routes'] = [RouteReportConnectionRoute.from_dict(v) for v in routes] + if (type := _dict.get('type')) is not None: + args['type'] = type return cls(**args) @classmethod @@ -3296,19 +3296,19 @@ class RouteReportConnectionBgp: """ connection bgp details. - :attr str as_path: (optional) AS path. - :attr bool is_used: Indicates whether current route is used or not. - :attr str local_preference: (optional) local preference. - :attr str prefix: (optional) prefix. + :param str as_path: (optional) AS path. + :param bool is_used: Indicates whether current route is used or not. + :param str local_preference: (optional) local preference. + :param str prefix: (optional) prefix. """ def __init__( self, is_used: bool, *, - as_path: str = None, - local_preference: str = None, - prefix: str = None, + as_path: Optional[str] = None, + local_preference: Optional[str] = None, + prefix: Optional[str] = None, ) -> None: """ Initialize a RouteReportConnectionBgp object. @@ -3327,16 +3327,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportConnectionBgp': """Initialize a RouteReportConnectionBgp object from a json dictionary.""" args = {} - if 'as_path' in _dict: - args['as_path'] = _dict.get('as_path') - if 'is_used' in _dict: - args['is_used'] = _dict.get('is_used') + if (as_path := _dict.get('as_path')) is not None: + args['as_path'] = as_path + if (is_used := _dict.get('is_used')) is not None: + args['is_used'] = is_used else: raise ValueError('Required property \'is_used\' not present in RouteReportConnectionBgp JSON') - if 'local_preference' in _dict: - args['local_preference'] = _dict.get('local_preference') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (local_preference := _dict.get('local_preference')) is not None: + args['local_preference'] = local_preference + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix return cls(**args) @classmethod @@ -3380,13 +3380,13 @@ class RouteReportConnectionRoute: """ connection used route. - :attr str prefix: (optional) prefix. + :param str prefix: (optional) prefix. """ def __init__( self, *, - prefix: str = None, + prefix: Optional[str] = None, ) -> None: """ Initialize a RouteReportConnectionRoute object. @@ -3399,8 +3399,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportConnectionRoute': """Initialize a RouteReportConnectionRoute object from a json dictionary.""" args = {} - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix return cls(**args) @classmethod @@ -3438,15 +3438,15 @@ class RouteReportOverlappingRoute: """ overlapping route details. - :attr str connection_id: (optional) connection ID. - :attr str prefix: (optional) overlapping prefix. + :param str connection_id: (optional) connection ID. + :param str prefix: (optional) overlapping prefix. """ def __init__( self, *, - connection_id: str = None, - prefix: str = None, + connection_id: Optional[str] = None, + prefix: Optional[str] = None, ) -> None: """ Initialize a RouteReportOverlappingRoute object. @@ -3461,10 +3461,10 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRoute': """Initialize a RouteReportOverlappingRoute object from a json dictionary.""" args = {} - if 'connection_id' in _dict: - args['connection_id'] = _dict.get('connection_id') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (connection_id := _dict.get('connection_id')) is not None: + args['connection_id'] = connection_id + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix return cls(**args) @classmethod @@ -3504,14 +3504,14 @@ class RouteReportOverlappingRouteGroup: """ Collection of overlapping route. - :attr List[RouteReportOverlappingRoute] routes: (optional) Array of overlapping + :param List[RouteReportOverlappingRoute] routes: (optional) Array of overlapping connection/prefix pairs. """ def __init__( self, *, - routes: List['RouteReportOverlappingRoute'] = None, + routes: Optional[List['RouteReportOverlappingRoute']] = None, ) -> None: """ Initialize a RouteReportOverlappingRouteGroup object. @@ -3525,8 +3525,8 @@ def __init__( 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(v) for v in _dict.get('routes')] + if (routes := _dict.get('routes')) is not None: + args['routes'] = [RouteReportOverlappingRoute.from_dict(v) for v in routes] return cls(**args) @classmethod @@ -3570,7 +3570,7 @@ class TSCollection: """ A list of Transit Gateway locations. - :attr List[TSLocationBasic] locations: Collection of Transit Gateway locations. + :param List[TSLocationBasic] locations: Collection of Transit Gateway locations. """ def __init__( @@ -3589,8 +3589,8 @@ def __init__( 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(v) for v in _dict.get('locations')] + if (locations := _dict.get('locations')) is not None: + args['locations'] = [TSLocationBasic.from_dict(v) for v in locations] else: raise ValueError('Required property \'locations\' not present in TSCollection JSON') return cls(**args) @@ -3636,11 +3636,11 @@ class TSLocalLocation: """ Details of a local connection 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 + :param str display_name: A descriptive display name for the location. + :param str name: The name of the location. + :param List[str] supported_connection_types: (optional) Array of supported connection types. - :attr str type: The type of the location, determining is this a multi-zone + :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. @@ -3652,7 +3652,7 @@ def __init__( name: str, type: str, *, - supported_connection_types: List[str] = None, + supported_connection_types: Optional[List[str]] = None, ) -> None: """ Initialize a TSLocalLocation object. @@ -3675,18 +3675,18 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TSLocalLocation': """Initialize a TSLocalLocation object from a json dictionary.""" args = {} - if 'display_name' in _dict: - args['display_name'] = _dict.get('display_name') + if (display_name := _dict.get('display_name')) is not None: + args['display_name'] = display_name else: raise ValueError('Required property \'display_name\' not present in TSLocalLocation JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = 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') - if 'type' in _dict: - args['type'] = _dict.get('type') + if (supported_connection_types := _dict.get('supported_connection_types')) is not None: + args['supported_connection_types'] = supported_connection_types + if (type := _dict.get('type')) is not None: + args['type'] = type else: raise ValueError('Required property \'type\' not present in TSLocalLocation JSON') return cls(**args) @@ -3744,14 +3744,14 @@ class TSLocation: """ Details of a Transit Gateway location. - :attr str billing_location: The geographical location of this location, used for - billing purposes. - :attr str name: Name of the Location. - :attr str type: The type of the location, determining is this a multi-zone + :param str billing_location: The geographical location of this location, used + for billing purposes. + :param str name: 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. - :attr List[TSLocalLocation] local_connection_locations: The set of network + :param List[TSLocalLocation] local_connection_locations: The set of network locations that are considered local for this Transit Gateway location. - :attr List[ZoneReference] zones: List of valid zones for GRE tunnels. + :param List[ZoneReference] zones: List of valid zones for GRE tunnels. """ def __init__( @@ -3784,24 +3784,24 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TSLocation': """Initialize a TSLocation object from a json dictionary.""" args = {} - if 'billing_location' in _dict: - args['billing_location'] = _dict.get('billing_location') + if (billing_location := _dict.get('billing_location')) is not None: + args['billing_location'] = billing_location else: raise ValueError('Required property \'billing_location\' not present in TSLocation JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in TSLocation JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') + if (type := _dict.get('type')) is not None: + args['type'] = type else: raise ValueError('Required property \'type\' not present in TSLocation JSON') - if 'local_connection_locations' in _dict: - args['local_connection_locations'] = [TSLocalLocation.from_dict(v) for v in _dict.get('local_connection_locations')] + if (local_connection_locations := _dict.get('local_connection_locations')) is not None: + args['local_connection_locations'] = [TSLocalLocation.from_dict(v) for v in local_connection_locations] else: raise ValueError('Required property \'local_connection_locations\' not present in TSLocation JSON') - if 'zones' in _dict: - args['zones'] = [ZoneReference.from_dict(v) for v in _dict.get('zones')] + if (zones := _dict.get('zones')) is not None: + args['zones'] = [ZoneReference.from_dict(v) for v in zones] else: raise ValueError('Required property \'zones\' not present in TSLocation JSON') return cls(**args) @@ -3861,10 +3861,10 @@ class TSLocationBasic: """ Details of a Transit Gateway location. - :attr str billing_location: The geographical location of this location, used for - billing purposes. - :attr str name: Name of the Location. - :attr str type: The type of the location, determining is this a multi-zone + :param str billing_location: The geographical location of this location, used + for billing purposes. + :param str name: 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. """ @@ -3891,16 +3891,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TSLocationBasic': """Initialize a TSLocationBasic object from a json dictionary.""" args = {} - if 'billing_location' in _dict: - args['billing_location'] = _dict.get('billing_location') + if (billing_location := _dict.get('billing_location')) is not None: + args['billing_location'] = billing_location else: raise ValueError('Required property \'billing_location\' not present in TSLocationBasic JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in TSLocationBasic JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') + if (type := _dict.get('type')) is not None: + args['type'] = type else: raise ValueError('Required property \'type\' not present in TSLocationBasic JSON') return cls(**args) @@ -3944,62 +3944,64 @@ class TransitConnection: """ Connection included in transit gateway. - :attr str base_network_type: (optional) The type of network the GRE tunnel is + :param str base_network_type: (optional) The type of network the GRE tunnel is targeting. - :attr str name: The user-defined name for this transit gateway connection. - :attr str network_id: (optional) The ID of the network being connected via this + :param str name: The user-defined name for this transit gateway connection. + :param str network_id: (optional) The ID of the network being connected via this connection. This field is required for some types, such as `vpc`, `power_virtual_server`, `directlink`, `vpn_gateway` and `redundant_gre`. For network types `vpc`, `redundant_gre`, `power_virtual_server` and `directlink` this is the CRN of the VPC / PowerVS / VDC / Direct Link gateway respectively. - :attr str network_type: Defines what type of network is connected via this + :param str network_type: 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. - :attr str id: The unique identifier for this Transit Gateway connection. - :attr str base_connection_id: (optional) Deprecated: network_type `gre_tunnel` + :param str id: The unique identifier for this Transit Gateway connection. + :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. - :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 + :param datetime created_at: The date and time that this connection was created. + :param int local_bgp_asn: (optional) Local network BGP ASN. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str local_gateway_ip: (optional) Local gateway IP address. This field + :param str local_gateway_ip: (optional) Local gateway IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str local_tunnel_ip: (optional) Local tunnel IP address. This field only + :param str local_tunnel_ip: (optional) Local tunnel IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr int mtu: (optional) GRE tunnel MTU. This field only applies to network + :param int mtu: (optional) GRE tunnel MTU. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str network_account_id: (optional) The ID of the account which owns the + :param str network_account_id: (optional) The ID of the account which owns the connected network. Generally only used if the network is in a different IBM Cloud account than the gateway. - :attr List[TransitGatewayConnectionPrefixFilterReference] prefix_filters: + :param List[TransitGatewayConnectionPrefixFilterReference] prefix_filters: (optional) Array of prefix route filters for a transit gateway connection. This is order dependent with those first in the array being applied first, and those at the end of the array is applied last, or just before the default. - :attr str prefix_filters_default: (optional) Default setting of permit or deny + This field does not apply to the `redundant_gre` network types. + :param str prefix_filters_default: (optional) Default setting of permit or deny which applies to any routes that don't match a specified filter. - :attr int remote_bgp_asn: (optional) Remote network BGP ASN. This field only + This field does not apply to the `redundant_gre` network types. + :param int remote_bgp_asn: (optional) Remote network BGP ASN. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str remote_gateway_ip: (optional) Remote gateway IP address. This field + :param str remote_gateway_ip: (optional) Remote gateway IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str remote_tunnel_ip: (optional) Remote tunnel IP address. This field + :param str remote_tunnel_ip: (optional) Remote tunnel IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str request_status: Only visible for cross account connections, this field - represents the status of a connection request between IBM Cloud accounts. 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 status: Connection's current configuration state. The list of + :param str request_status: Only visible for cross account connections, this + field represents the status of a connection request between IBM Cloud accounts. + The list of enumerated values for this property may expand in the future. Code + and processes using this field must tolerate unexpected values. + :param str status: 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. - :attr TransitGatewayReference transit_gateway: Transit gateway reference. - :attr List[TransitGatewayTunnel] tunnels: (optional) Collection of all tunnels + :param TransitGatewayReference transit_gateway: Transit gateway reference. + :param List[TransitGatewayTunnel] tunnels: (optional) Collection of all tunnels for `redundant_gre` and `vpn_gateway` connections. - :attr datetime updated_at: The date and time that this connection was last + :param datetime updated_at: The date and time that this connection was last updated. - :attr ZoneReference zone: (optional) Availability zone reference. + :param ZoneReference zone: (optional) Availability zone reference. """ def __init__( @@ -4013,21 +4015,21 @@ def __init__( transit_gateway: 'TransitGatewayReference', updated_at: datetime, *, - 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, - prefix_filters_default: str = None, - remote_bgp_asn: int = None, - remote_gateway_ip: str = None, - remote_tunnel_ip: str = None, - tunnels: List['TransitGatewayTunnel'] = None, - zone: 'ZoneReference' = None, + base_network_type: Optional[str] = None, + network_id: Optional[str] = None, + base_connection_id: Optional[str] = None, + local_bgp_asn: Optional[int] = None, + local_gateway_ip: Optional[str] = None, + local_tunnel_ip: Optional[str] = None, + mtu: Optional[int] = None, + network_account_id: Optional[str] = None, + prefix_filters: Optional[List['TransitGatewayConnectionPrefixFilterReference']] = None, + prefix_filters_default: Optional[str] = None, + remote_bgp_asn: Optional[int] = None, + remote_gateway_ip: Optional[str] = None, + remote_tunnel_ip: Optional[str] = None, + tunnels: Optional[List['TransitGatewayTunnel']] = None, + zone: Optional['ZoneReference'] = None, ) -> None: """ Initialize a TransitConnection object. @@ -4085,8 +4087,10 @@ def __init__( This is order dependent with those first in the array being applied first, and those at the end of the array is applied last, or just before the default. + This field does not apply to the `redundant_gre` network types. :param str prefix_filters_default: (optional) Default setting of permit or deny which applies to any routes that don't match a specified filter. + This field does not apply to the `redundant_gre` network types. :param int remote_bgp_asn: (optional) Remote network BGP ASN. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. @@ -4128,68 +4132,68 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitConnection': """Initialize a TransitConnection object from a json dictionary.""" args = {} - if 'base_network_type' in _dict: - args['base_network_type'] = _dict.get('base_network_type') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (base_network_type := _dict.get('base_network_type')) is not None: + args['base_network_type'] = base_network_type + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in TransitConnection 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') + if (network_id := _dict.get('network_id')) is not None: + args['network_id'] = network_id + if (network_type := _dict.get('network_type')) is not None: + args['network_type'] = network_type else: raise ValueError('Required property \'network_type\' not present in TransitConnection JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' not present in TransitConnection 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')) + if (base_connection_id := _dict.get('base_connection_id')) is not None: + args['base_connection_id'] = base_connection_id + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) else: raise ValueError('Required property \'created_at\' 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: - args['local_gateway_ip'] = _dict.get('local_gateway_ip') - if 'local_tunnel_ip' in _dict: - args['local_tunnel_ip'] = _dict.get('local_tunnel_ip') - if 'mtu' in _dict: - args['mtu'] = _dict.get('mtu') - 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(v) for v in _dict.get('prefix_filters')] - if 'prefix_filters_default' in _dict: - args['prefix_filters_default'] = _dict.get('prefix_filters_default') - if 'remote_bgp_asn' in _dict: - args['remote_bgp_asn'] = _dict.get('remote_bgp_asn') - if 'remote_gateway_ip' in _dict: - args['remote_gateway_ip'] = _dict.get('remote_gateway_ip') - if 'remote_tunnel_ip' in _dict: - args['remote_tunnel_ip'] = _dict.get('remote_tunnel_ip') - if 'request_status' in _dict: - args['request_status'] = _dict.get('request_status') + if (local_bgp_asn := _dict.get('local_bgp_asn')) is not None: + args['local_bgp_asn'] = local_bgp_asn + if (local_gateway_ip := _dict.get('local_gateway_ip')) is not None: + args['local_gateway_ip'] = local_gateway_ip + if (local_tunnel_ip := _dict.get('local_tunnel_ip')) is not None: + args['local_tunnel_ip'] = local_tunnel_ip + if (mtu := _dict.get('mtu')) is not None: + args['mtu'] = mtu + if (network_account_id := _dict.get('network_account_id')) is not None: + args['network_account_id'] = network_account_id + if (prefix_filters := _dict.get('prefix_filters')) is not None: + args['prefix_filters'] = [TransitGatewayConnectionPrefixFilterReference.from_dict(v) for v in prefix_filters] + if (prefix_filters_default := _dict.get('prefix_filters_default')) is not None: + args['prefix_filters_default'] = prefix_filters_default + if (remote_bgp_asn := _dict.get('remote_bgp_asn')) is not None: + args['remote_bgp_asn'] = remote_bgp_asn + if (remote_gateway_ip := _dict.get('remote_gateway_ip')) is not None: + args['remote_gateway_ip'] = remote_gateway_ip + if (remote_tunnel_ip := _dict.get('remote_tunnel_ip')) is not None: + args['remote_tunnel_ip'] = remote_tunnel_ip + if (request_status := _dict.get('request_status')) is not None: + args['request_status'] = request_status else: raise ValueError('Required property \'request_status\' not present in TransitConnection JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + if (status := _dict.get('status')) is not None: + args['status'] = status else: 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')) + if (transit_gateway := _dict.get('transit_gateway')) is not None: + args['transit_gateway'] = TransitGatewayReference.from_dict(transit_gateway) else: raise ValueError('Required property \'transit_gateway\' not present in TransitConnection JSON') - if 'tunnels' in _dict: - args['tunnels'] = [TransitGatewayTunnel.from_dict(v) for v in _dict.get('tunnels')] - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + if (tunnels := _dict.get('tunnels')) is not None: + args['tunnels'] = [TransitGatewayTunnel.from_dict(v) for v in tunnels] + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) else: raise ValueError('Required property \'updated_at\' not present in TransitConnection JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + if (zone := _dict.get('zone')) is not None: + args['zone'] = ZoneReference.from_dict(zone) return cls(**args) @classmethod @@ -4315,6 +4319,7 @@ class PrefixFiltersDefaultEnum(str, Enum): """ Default setting of permit or deny which applies to any routes that don't match a specified filter. + This field does not apply to the `redundant_gre` network types. """ PERMIT = 'permit' @@ -4359,11 +4364,12 @@ class TransitConnectionCollection: """ Transit gateway connections. - :attr List[TransitConnection] connections: Array of transit gateway connections. - :attr PaginationFirstConnection first: A reference to the first page of + :param List[TransitConnection] connections: Array of transit gateway + connections. + :param 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 + :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. """ @@ -4373,7 +4379,7 @@ def __init__( first: 'PaginationFirstConnection', limit: int, *, - next: 'PaginationNextConnection' = None, + next: Optional['PaginationNextConnection'] = None, ) -> None: """ Initialize a TransitConnectionCollection object. @@ -4397,20 +4403,20 @@ def __init__( 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(v) for v in _dict.get('connections')] + if (connections := _dict.get('connections')) is not None: + args['connections'] = [TransitConnection.from_dict(v) for v in connections] else: raise ValueError('Required property \'connections\' not present in TransitConnectionCollection JSON') - if 'first' in _dict: - args['first'] = PaginationFirstConnection.from_dict(_dict.get('first')) + if (first := _dict.get('first')) is not None: + args['first'] = PaginationFirstConnection.from_dict(first) else: raise ValueError('Required property \'first\' not present in TransitConnectionCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit else: raise ValueError('Required property \'limit\' not present in TransitConnectionCollection JSON') - if 'next' in _dict: - args['next'] = PaginationNextConnection.from_dict(_dict.get('next')) + if (next := _dict.get('next')) is not None: + args['next'] = PaginationNextConnection.from_dict(next) return cls(**args) @classmethod @@ -4466,27 +4472,27 @@ class TransitGateway: """ Details of a Transit Gateway. - :attr int connection_count: (optional) The number of connections associated with - this Transit Gateway. - :attr bool connection_needs_attention: Indicates if this Transit Gateway has a + :param int connection_count: (optional) The number of connections associated + with this Transit Gateway. + :param bool connection_needs_attention: Indicates if this Transit Gateway has a connection that needs attention (Such as cross account approval). - :attr datetime created_at: The date and time that this gateway was created. - :attr str crn: (optional) Cloud Resource Name of a transit gateway. - :attr bool global_: Allow global routing for a Transit Gateway. - :attr bool gre_enhanced_route_propagation: Allow route propagation across all + :param datetime created_at: The date and time that this gateway was created. + :param str crn: (optional) Cloud Resource Name of a transit gateway. + :param bool global_: Allow global routing for a Transit Gateway. + :param bool gre_enhanced_route_propagation: Allow route propagation across all GREs connected to the same transit gateway. This affects connections on the gateway of type `redundant_gre`, `unbound_gre_tunnel` and `gre_tunnel`. - :attr str id: A unique identifier for this transit gateway. - :attr str location: Location of Transit Gateway Services. - :attr str name: A human readable name for the transit gateway. - :attr ResourceGroupReference resource_group: (optional) The resource group to + :param str id: A unique identifier for this transit gateway. + :param str location: Location of Transit Gateway Services. + :param str name: A human readable name for the transit gateway. + :param ResourceGroupReference resource_group: (optional) The resource group to use. If unspecified, the account's [default resource group](https://console.bluemix.net/apidocs/resource-manager#introduction) is used. - :attr str status: The status of the Transit Gateway. The list of enumerated + :param str status: The status of the Transit Gateway. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. - :attr datetime updated_at: (optional) The date and time that this gateway was + :param datetime updated_at: (optional) The date and time that this gateway was last updated. """ @@ -4501,10 +4507,10 @@ def __init__( name: str, status: str, *, - connection_count: int = None, - crn: str = None, - resource_group: 'ResourceGroupReference' = None, - updated_at: datetime = None, + connection_count: Optional[int] = None, + crn: Optional[str] = None, + resource_group: Optional['ResourceGroupReference'] = None, + updated_at: Optional[datetime] = None, ) -> None: """ Initialize a TransitGateway object. @@ -4550,46 +4556,46 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGateway': """Initialize a TransitGateway object from a json dictionary.""" args = {} - if 'connection_count' in _dict: - args['connection_count'] = _dict.get('connection_count') - if 'connection_needs_attention' in _dict: - args['connection_needs_attention'] = _dict.get('connection_needs_attention') + if (connection_count := _dict.get('connection_count')) is not None: + args['connection_count'] = connection_count + if (connection_needs_attention := _dict.get('connection_needs_attention')) is not None: + args['connection_needs_attention'] = connection_needs_attention else: raise ValueError('Required property \'connection_needs_attention\' not present in TransitGateway JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) else: raise ValueError('Required property \'created_at\' not present in TransitGateway JSON') - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - if 'global' in _dict: - args['global_'] = _dict.get('global') + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in TransitGateway JSON') - if 'gre_enhanced_route_propagation' in _dict: - args['gre_enhanced_route_propagation'] = _dict.get('gre_enhanced_route_propagation') + if (gre_enhanced_route_propagation := _dict.get('gre_enhanced_route_propagation')) is not None: + args['gre_enhanced_route_propagation'] = gre_enhanced_route_propagation else: raise ValueError('Required property \'gre_enhanced_route_propagation\' not present in TransitGateway JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' not present in TransitGateway JSON') - if 'location' in _dict: - args['location'] = _dict.get('location') + if (location := _dict.get('location')) is not None: + args['location'] = location else: raise ValueError('Required property \'location\' not present in TransitGateway JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in TransitGateway JSON') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - if 'status' in _dict: - args['status'] = _dict.get('status') + if (resource_group := _dict.get('resource_group')) is not None: + args['resource_group'] = ResourceGroupReference.from_dict(resource_group) + if (status := _dict.get('status')) is not None: + args['status'] = status else: 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')) + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) return cls(**args) @classmethod @@ -4667,11 +4673,11 @@ class TransitGatewayCollection: """ A list of Transit Gateways. - :attr PaginationFirstTG first: A reference to the first page of resources. - :attr int limit: The maximum number of gateways returned on one request. - :attr PaginationNextTG next: (optional) A reference to the next page of + :param PaginationFirstTG first: A reference to the first page of resources. + :param int limit: The maximum number of gateways returned on one request. + :param 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 + :param List[TransitGateway] transit_gateways: Collection of Transit Services gateways. """ @@ -4681,7 +4687,7 @@ def __init__( limit: int, transit_gateways: List['TransitGateway'], *, - next: 'PaginationNextTG' = None, + next: Optional['PaginationNextTG'] = None, ) -> None: """ Initialize a TransitGatewayCollection object. @@ -4702,18 +4708,18 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayCollection': """Initialize a TransitGatewayCollection object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = PaginationFirstTG.from_dict(_dict.get('first')) + if (first := _dict.get('first')) is not None: + args['first'] = PaginationFirstTG.from_dict(first) else: raise ValueError('Required property \'first\' not present in TransitGatewayCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit else: raise ValueError('Required property \'limit\' not present in TransitGatewayCollection JSON') - if 'next' in _dict: - args['next'] = PaginationNextTG.from_dict(_dict.get('next')) - if 'transit_gateways' in _dict: - args['transit_gateways'] = [TransitGateway.from_dict(v) for v in _dict.get('transit_gateways')] + if (next := _dict.get('next')) is not None: + args['next'] = PaginationNextTG.from_dict(next) + if (transit_gateways := _dict.get('transit_gateways')) is not None: + args['transit_gateways'] = [TransitGateway.from_dict(v) for v in transit_gateways] else: raise ValueError('Required property \'transit_gateways\' not present in TransitGatewayCollection JSON') return cls(**args) @@ -4771,18 +4777,18 @@ class TransitGatewayConnectionCollection: """ A set of Transit Gateway network connections. - :attr List[TransitGatewayConnectionCust] connections: Array of transit gateways + :param List[TransitGatewayConnectionCust] connections: Array of transit gateways network Connections. - :attr PaginationFirstTGWConnection first: A reference to the first page of + :param PaginationFirstTGWConnection first: 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: 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 + :param int limit: 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. - :attr int total_count: total number of resources across all pages (considering + :param int total_count: total number of resources across all pages (considering the supplied query parameter filters). """ @@ -4793,7 +4799,7 @@ def __init__( limit: int, total_count: int, *, - next: 'PaginationNextTGWConnection' = None, + next: Optional['PaginationNextTGWConnection'] = None, ) -> None: """ Initialize a TransitGatewayConnectionCollection object. @@ -4823,22 +4829,22 @@ def __init__( 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(v) for v in _dict.get('connections')] + if (connections := _dict.get('connections')) is not None: + args['connections'] = [TransitGatewayConnectionCust.from_dict(v) for v in connections] else: raise ValueError('Required property \'connections\' not present in TransitGatewayConnectionCollection JSON') - if 'first' in _dict: - args['first'] = PaginationFirstTGWConnection.from_dict(_dict.get('first')) + if (first := _dict.get('first')) is not None: + args['first'] = PaginationFirstTGWConnection.from_dict(first) else: raise ValueError('Required property \'first\' not present in TransitGatewayConnectionCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit else: raise ValueError('Required property \'limit\' not present in TransitGatewayConnectionCollection JSON') - if 'next' in _dict: - args['next'] = PaginationNextTGWConnection.from_dict(_dict.get('next')) - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + if (next := _dict.get('next')) is not None: + args['next'] = PaginationNextTGWConnection.from_dict(next) + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count else: raise ValueError('Required property \'total_count\' not present in TransitGatewayConnectionCollection JSON') return cls(**args) @@ -4898,42 +4904,42 @@ class TransitGatewayConnectionCust: """ Connection included in transit gateway. - :attr str base_connection_id: (optional) Deprecated: network_type `gre_tunnel` + :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. - :attr str base_network_type: (optional) The type of network the Unbound GRE + :param str base_network_type: (optional) The type of network the Unbound GRE tunnel is targeting. This field is required for network type `unbound_gre_tunnel` and must be set to `classic`. For a `redundant_gre` network type, the value is required and can be either VPC or Classic. This field is required to be unspecified for network type `classic`, `directlink`, `vpc`, `power_virtual_server`, `vpn_gateway` and `gre_tunnel` connections. - :attr str cidr: (optional) network_type 'vpn_gateway' connections use 'cidr' to + :param str cidr: (optional) network_type 'vpn_gateway' connections use 'cidr' to specify the CIDR to use for the VPN GRE tunnels. - :attr datetime created_at: The date and time that this connection was created. - :attr str id: The unique identifier for this Transit Gateway connection. - :attr int local_bgp_asn: (optional) Local network BGP ASN. This field only + :param datetime created_at: The date and time that this connection was created. + :param str id: The unique identifier for this Transit Gateway connection. + :param int local_bgp_asn: (optional) Local network BGP ASN. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str local_gateway_ip: (optional) Local gateway IP address. This field + :param str local_gateway_ip: (optional) Local gateway IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str local_tunnel_ip: (optional) Local tunnel IP address. This field only + :param str local_tunnel_ip: (optional) Local tunnel IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr int mtu: (optional) GRE tunnel MTU. This field only applies to network + :param int mtu: (optional) GRE tunnel MTU. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str name: (optional) The user-defined name for this transit gateway + :param str name: (optional) The user-defined name for this transit gateway connection. Network type `vpc` connections are defaulted to the name of the VPC. Network type `classic` connections are named `classic`. This field is required for network type `power_virtual_server`, `directlink`, `gre_tunnel`, `unbound_gre_tunnel`, `vpn_gateway` and `redundant_gre` connections. This field is optional for network type `classic`, `vpc` connections. - :attr str network_account_id: (optional) The ID of the account which owns the + :param str network_account_id: (optional) The ID of the account which owns the connected network. Generally only used if the network is in a different IBM Cloud account than the gateway. - :attr str network_id: (optional) The ID of the network being connected via this + :param str network_id: (optional) The ID of the network being connected via this connection. For network types `vpc`,`power_virtual_server`, `directlink` and `vpn_gateway` this is the CRN of the VPC / PowerVS / VDC / Direct Link / VPN gateway respectively. This field is required for network type `vpc`, @@ -4941,34 +4947,34 @@ class TransitGatewayConnectionCust: required for `redundant_gre` connections when the base_network_type is set to VPC. This field is required to be unspecified for network type `classic`, `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str network_type: (optional) Defines what type of network is connected via - this connection. - :attr List[TransitGatewayConnectionPrefixFilterReference] prefix_filters: + :param str network_type: (optional) Defines what type of network is connected + via this connection. + :param List[TransitGatewayConnectionPrefixFilterReference] prefix_filters: (optional) Array of prefix route filters for a transit gateway connection. This is order dependent with those first in the array being applied first, and those at the end of the array is applied last, or just before the default. This field does not apply to the `redundant_gre` network type. - :attr str prefix_filters_default: (optional) Default setting of permit or deny + :param str prefix_filters_default: (optional) Default setting of permit or deny which applies to any routes that don't match a specified filter. This field does not apply to the `redundant_gre` network type. - :attr int remote_bgp_asn: (optional) Remote network BGP ASN. This field only + :param int remote_bgp_asn: (optional) Remote network BGP ASN. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str remote_gateway_ip: (optional) Remote gateway IP address. This field + :param str remote_gateway_ip: (optional) Remote gateway IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str remote_tunnel_ip: (optional) Remote tunnel IP address. This field + :param str remote_tunnel_ip: (optional) Remote tunnel IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. - :attr str request_status: Only visible for cross account connections, this field - represents the status of a connection request between IBM Cloud accounts. 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 status: Connection's current configuration state. The list of + :param str request_status: Only visible for cross account connections, this + field represents the status of a connection request between IBM Cloud accounts. + The list of enumerated values for this property may expand in the future. Code + and processes using this field must tolerate unexpected values. + :param str status: 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. - :attr List[TransitGatewayTunnel] tunnels: (optional) Collection of all tunnels + :param List[TransitGatewayTunnel] tunnels: (optional) Collection of all tunnels for `redundant_gre` and `vpn_gateway` connections. - :attr datetime updated_at: The date and time that this connection was last + :param datetime updated_at: The date and time that this connection was last updated. - :attr ZoneReference zone: (optional) Location of GRE tunnel. This field is + :param ZoneReference zone: (optional) Location of GRE tunnel. This field is required for network type `gre_tunnel` and `unbound_gre_tunnel` connections. This field is optional for network type `vpn_gateway` connections. """ @@ -4981,24 +4987,24 @@ def __init__( status: str, updated_at: datetime, *, - base_connection_id: str = None, - base_network_type: str = None, - cidr: str = None, - local_bgp_asn: int = None, - local_gateway_ip: str = None, - local_tunnel_ip: str = None, - mtu: int = None, - name: str = None, - network_account_id: str = None, - network_id: str = None, - network_type: str = None, - prefix_filters: List['TransitGatewayConnectionPrefixFilterReference'] = None, - prefix_filters_default: str = None, - remote_bgp_asn: int = None, - remote_gateway_ip: str = None, - remote_tunnel_ip: str = None, - tunnels: List['TransitGatewayTunnel'] = None, - zone: 'ZoneReference' = None, + base_connection_id: Optional[str] = None, + base_network_type: Optional[str] = None, + cidr: Optional[str] = None, + local_bgp_asn: Optional[int] = None, + local_gateway_ip: Optional[str] = None, + local_tunnel_ip: Optional[str] = None, + mtu: Optional[int] = None, + name: Optional[str] = None, + network_account_id: Optional[str] = None, + network_id: Optional[str] = None, + network_type: Optional[str] = None, + prefix_filters: Optional[List['TransitGatewayConnectionPrefixFilterReference']] = None, + prefix_filters_default: Optional[str] = None, + remote_bgp_asn: Optional[int] = None, + remote_gateway_ip: Optional[str] = None, + remote_tunnel_ip: Optional[str] = None, + tunnels: Optional[List['TransitGatewayTunnel']] = None, + zone: Optional['ZoneReference'] = None, ) -> None: """ Initialize a TransitGatewayConnectionCust object. @@ -5116,62 +5122,62 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionCust': """Initialize a TransitGatewayConnectionCust object from a json dictionary.""" args = {} - if 'base_connection_id' in _dict: - args['base_connection_id'] = _dict.get('base_connection_id') - if 'base_network_type' in _dict: - args['base_network_type'] = _dict.get('base_network_type') - if 'cidr' in _dict: - args['cidr'] = _dict.get('cidr') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (base_connection_id := _dict.get('base_connection_id')) is not None: + args['base_connection_id'] = base_connection_id + if (base_network_type := _dict.get('base_network_type')) is not None: + args['base_network_type'] = base_network_type + if (cidr := _dict.get('cidr')) is not None: + args['cidr'] = cidr + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) else: raise ValueError('Required property \'created_at\' not present in TransitGatewayConnectionCust JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' 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: - args['local_gateway_ip'] = _dict.get('local_gateway_ip') - if 'local_tunnel_ip' in _dict: - args['local_tunnel_ip'] = _dict.get('local_tunnel_ip') - if 'mtu' in _dict: - args['mtu'] = _dict.get('mtu') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'network_account_id' in _dict: - args['network_account_id'] = _dict.get('network_account_id') - if 'network_id' in _dict: - args['network_id'] = _dict.get('network_id') - if 'network_type' in _dict: - args['network_type'] = _dict.get('network_type') - if 'prefix_filters' in _dict: - 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') - if 'remote_bgp_asn' in _dict: - args['remote_bgp_asn'] = _dict.get('remote_bgp_asn') - if 'remote_gateway_ip' in _dict: - args['remote_gateway_ip'] = _dict.get('remote_gateway_ip') - if 'remote_tunnel_ip' in _dict: - args['remote_tunnel_ip'] = _dict.get('remote_tunnel_ip') - if 'request_status' in _dict: - args['request_status'] = _dict.get('request_status') + if (local_bgp_asn := _dict.get('local_bgp_asn')) is not None: + args['local_bgp_asn'] = local_bgp_asn + if (local_gateway_ip := _dict.get('local_gateway_ip')) is not None: + args['local_gateway_ip'] = local_gateway_ip + if (local_tunnel_ip := _dict.get('local_tunnel_ip')) is not None: + args['local_tunnel_ip'] = local_tunnel_ip + if (mtu := _dict.get('mtu')) is not None: + args['mtu'] = mtu + if (name := _dict.get('name')) is not None: + args['name'] = name + if (network_account_id := _dict.get('network_account_id')) is not None: + args['network_account_id'] = network_account_id + if (network_id := _dict.get('network_id')) is not None: + args['network_id'] = network_id + if (network_type := _dict.get('network_type')) is not None: + args['network_type'] = network_type + if (prefix_filters := _dict.get('prefix_filters')) is not None: + args['prefix_filters'] = [TransitGatewayConnectionPrefixFilterReference.from_dict(v) for v in prefix_filters] + if (prefix_filters_default := _dict.get('prefix_filters_default')) is not None: + args['prefix_filters_default'] = prefix_filters_default + if (remote_bgp_asn := _dict.get('remote_bgp_asn')) is not None: + args['remote_bgp_asn'] = remote_bgp_asn + if (remote_gateway_ip := _dict.get('remote_gateway_ip')) is not None: + args['remote_gateway_ip'] = remote_gateway_ip + if (remote_tunnel_ip := _dict.get('remote_tunnel_ip')) is not None: + args['remote_tunnel_ip'] = remote_tunnel_ip + if (request_status := _dict.get('request_status')) is not None: + args['request_status'] = request_status else: raise ValueError('Required property \'request_status\' not present in TransitGatewayConnectionCust JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + if (status := _dict.get('status')) is not None: + args['status'] = status else: raise ValueError('Required property \'status\' not present in TransitGatewayConnectionCust JSON') - if 'tunnels' in _dict: - args['tunnels'] = [TransitGatewayTunnel.from_dict(v) for v in _dict.get('tunnels')] - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + if (tunnels := _dict.get('tunnels')) is not None: + args['tunnels'] = [TransitGatewayTunnel.from_dict(v) for v in tunnels] + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) else: raise ValueError('Required property \'updated_at\' not present in TransitGatewayConnectionCust JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + if (zone := _dict.get('zone')) is not None: + args['zone'] = ZoneReference.from_dict(zone) return cls(**args) @classmethod @@ -5341,10 +5347,10 @@ class TransitGatewayConnectionPrefixFilter: """ A prefix filter for a Transit Gateway connection. - :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. + :param str action: Whether to permit or deny prefix filter. + :param int ge: (optional) IP Prefix GE. + :param int le: (optional) IP Prefix LE. + :param str prefix: IP Prefix. """ def __init__( @@ -5352,8 +5358,8 @@ def __init__( action: str, prefix: str, *, - ge: int = None, - le: int = None, + ge: Optional[int] = None, + le: Optional[int] = None, ) -> None: """ Initialize a TransitGatewayConnectionPrefixFilter object. @@ -5372,16 +5378,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionPrefixFilter': """Initialize a TransitGatewayConnectionPrefixFilter object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') + if (action := _dict.get('action')) is not None: + args['action'] = action else: raise ValueError('Required property \'action\' not present in TransitGatewayConnectionPrefixFilter JSON') - if 'ge' in _dict: - args['ge'] = _dict.get('ge') - if 'le' in _dict: - args['le'] = _dict.get('le') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (ge := _dict.get('ge')) is not None: + args['ge'] = ge + if (le := _dict.get('le')) is not None: + args['le'] = le + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix else: raise ValueError('Required property \'prefix\' not present in TransitGatewayConnectionPrefixFilter JSON') return cls(**args) @@ -5436,8 +5442,8 @@ class TransitGatewayConnectionPrefixFilterReference: """ A prefix filter reference object for a Transit Gateway connection. - :attr str action: Whether to permit or deny prefix filter. - :attr str before: (optional) Identifier of prefix filter that handles the + :param str action: Whether to permit or deny prefix filter. + :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 @@ -5455,13 +5461,13 @@ class TransitGatewayConnectionPrefixFilterReference: 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 datetime created_at: The date and time that this prefix filter was + :param datetime created_at: The date and time that this prefix filter was created. - :attr int ge: (optional) IP Prefix GE. - :attr str id: Prefix Filter identifier. - :attr int le: (optional) IP Prefix LE. - :attr str prefix: IP Prefix. - :attr datetime updated_at: (optional) The date and time that this prefix filter + :param int ge: (optional) IP Prefix GE. + :param str id: Prefix Filter identifier. + :param int le: (optional) IP Prefix LE. + :param str prefix: IP Prefix. + :param datetime updated_at: (optional) The date and time that this prefix filter was last updated. """ @@ -5472,10 +5478,10 @@ def __init__( id: str, prefix: str, *, - before: str = None, - ge: int = None, - le: int = None, - updated_at: datetime = None, + before: Optional[str] = None, + ge: Optional[int] = None, + le: Optional[int] = None, + updated_at: Optional[datetime] = None, ) -> None: """ Initialize a TransitGatewayConnectionPrefixFilterReference object. @@ -5521,30 +5527,30 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayConnectionPrefixFilterReference': """Initialize a TransitGatewayConnectionPrefixFilterReference object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') + if (action := _dict.get('action')) is not None: + args['action'] = action else: 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')) + if (before := _dict.get('before')) is not None: + args['before'] = before + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) else: 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') + if (ge := _dict.get('ge')) is not None: + args['ge'] = ge + if (id := _dict.get('id')) is not None: + args['id'] = id else: 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') + if (le := _dict.get('le')) is not None: + args['le'] = le + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix else: 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')) + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) return cls(**args) @classmethod @@ -5605,9 +5611,9 @@ class TransitGatewayReference: """ Transit gateway reference. - :attr str crn: gateway CRN. - :attr str id: gateway ID. - :attr str name: transit gateway name. + :param str crn: gateway CRN. + :param str id: gateway ID. + :param str name: transit gateway name. """ def __init__( @@ -5631,16 +5637,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayReference': """Initialize a TransitGatewayReference object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn else: raise ValueError('Required property \'crn\' not present in TransitGatewayReference JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' not present in TransitGatewayReference JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in TransitGatewayReference JSON') return cls(**args) @@ -5684,42 +5690,36 @@ class TransitGatewayTunnel: """ Details for a redundant GRE tunnel. - :attr str base_network_type: The type of network the redundant GRE tunnel is + :param str base_network_type: The type of network the redundant GRE tunnel is targeting. - :attr datetime created_at: The date and time that this GRE tunnel was created. - :attr str id: The unique identifier for this redundant GRE tunnel. - :attr int local_bgp_asn: Local network BGP ASN. It is assigned by IBM when the + :param datetime created_at: The date and time that this GRE tunnel was created. + :param str id: The unique identifier for this redundant GRE tunnel. + :param int local_bgp_asn: Local network BGP ASN. It is assigned by IBM when the tunnel is created. - :attr str local_gateway_ip: Local gateway IP address. - :attr str local_tunnel_ip: Local tunnel IP address. The local_tunnel_ip and + :param str local_gateway_ip: Local gateway IP address. + :param str local_tunnel_ip: Local tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. - :attr int mtu: (optional) GRE tunnel MTU. - :attr str name: The user-defined name for this tunnel. - :attr str network_account_id: (optional) The ID of the account for cross account - Classic connections. This field is required when the GRE tunnel is in a + :param int mtu: (optional) GRE tunnel MTU. + :param str name: The user-defined name for this tunnel. + :param str network_account_id: (optional) The ID of the account for cross + account Classic connections. This field is required when the GRE tunnel is in a different account than the gateway and the base network is Classic. - :attr str network_id: (optional) The ID of the network VPC being connected via + :param str network_id: (optional) The ID of the network VPC being connected via this connection. - :attr List[TransitGatewayConnectionPrefixFilterReference] prefix_filters: - (optional) Array of prefix route filters for a transit gateway connection. This - is order dependent with those first in the array being applied first, and those - at the end of the array is applied last, or just before the default. - :attr str prefix_filters_default: (optional) Default setting of permit or deny - which applies to any routes that don't match a specified filter. - :attr int remote_bgp_asn: Remote network BGP ASN. The following ASN values are + :param int remote_bgp_asn: Remote network BGP ASN. The following ASN values are reserved and unavailable 0, 13884, 36351, 64512, 64513, 65100, 65200-65234, 65402-65433, 65500, 65516, 65519, 65521, 65531 and 4201065000-4201065999 If `remote_bgp_asn` is omitted on create requests, IBM will assign an ASN. - :attr str remote_gateway_ip: Remote gateway IP address. - :attr str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and + :param str remote_gateway_ip: Remote gateway IP address. + :param str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. - :attr str status: Tunnel's current configuration state. The list of enumerated + :param str status: Tunnel'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. - :attr datetime updated_at: The date and time that this tunnel was last updated. - :attr ZoneReference zone: Availability zone reference. + :param datetime updated_at: The date and time that this tunnel was last updated. + :param ZoneReference zone: Availability zone reference. """ def __init__( @@ -5738,11 +5738,9 @@ def __init__( updated_at: datetime, zone: 'ZoneReference', *, - mtu: int = None, - network_account_id: str = None, - network_id: str = None, - prefix_filters: List['TransitGatewayConnectionPrefixFilterReference'] = None, - prefix_filters_default: str = None, + mtu: Optional[int] = None, + network_account_id: Optional[str] = None, + network_id: Optional[str] = None, ) -> None: """ Initialize a TransitGatewayTunnel object. @@ -5780,13 +5778,6 @@ def __init__( in a different account than the gateway and the base network is Classic. :param str network_id: (optional) The ID of the network VPC being connected via this connection. - :param List[TransitGatewayConnectionPrefixFilterReference] prefix_filters: - (optional) Array of prefix route filters for a transit gateway connection. - This is order dependent with those first in the array being applied first, - and those at the end of the array is applied last, or just before the - default. - :param str prefix_filters_default: (optional) Default setting of permit or - deny which applies to any routes that don't match a specified filter. """ self.base_network_type = base_network_type self.created_at = created_at @@ -5798,8 +5789,6 @@ def __init__( self.name = name self.network_account_id = network_account_id self.network_id = network_id - self.prefix_filters = prefix_filters - self.prefix_filters_default = prefix_filters_default self.remote_bgp_asn = remote_bgp_asn self.remote_gateway_ip = remote_gateway_ip self.remote_tunnel_ip = remote_tunnel_ip @@ -5811,66 +5800,62 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayTunnel': """Initialize a TransitGatewayTunnel object from a json dictionary.""" args = {} - if 'base_network_type' in _dict: - args['base_network_type'] = _dict.get('base_network_type') + if (base_network_type := _dict.get('base_network_type')) is not None: + args['base_network_type'] = base_network_type else: raise ValueError('Required property \'base_network_type\' not present in TransitGatewayTunnel JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) else: raise ValueError('Required property \'created_at\' not present in TransitGatewayTunnel JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' not present in TransitGatewayTunnel JSON') - if 'local_bgp_asn' in _dict: - args['local_bgp_asn'] = _dict.get('local_bgp_asn') + if (local_bgp_asn := _dict.get('local_bgp_asn')) is not None: + args['local_bgp_asn'] = local_bgp_asn else: raise ValueError('Required property \'local_bgp_asn\' not present in TransitGatewayTunnel JSON') - if 'local_gateway_ip' in _dict: - args['local_gateway_ip'] = _dict.get('local_gateway_ip') + if (local_gateway_ip := _dict.get('local_gateway_ip')) is not None: + args['local_gateway_ip'] = local_gateway_ip else: raise ValueError('Required property \'local_gateway_ip\' not present in TransitGatewayTunnel JSON') - if 'local_tunnel_ip' in _dict: - args['local_tunnel_ip'] = _dict.get('local_tunnel_ip') + if (local_tunnel_ip := _dict.get('local_tunnel_ip')) is not None: + args['local_tunnel_ip'] = local_tunnel_ip else: raise ValueError('Required property \'local_tunnel_ip\' not present in TransitGatewayTunnel JSON') - if 'mtu' in _dict: - args['mtu'] = _dict.get('mtu') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (mtu := _dict.get('mtu')) is not None: + args['mtu'] = mtu + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in TransitGatewayTunnel JSON') - if 'network_account_id' in _dict: - args['network_account_id'] = _dict.get('network_account_id') - if 'network_id' in _dict: - args['network_id'] = _dict.get('network_id') - if 'prefix_filters' in _dict: - 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') - if 'remote_bgp_asn' in _dict: - args['remote_bgp_asn'] = _dict.get('remote_bgp_asn') + if (network_account_id := _dict.get('network_account_id')) is not None: + args['network_account_id'] = network_account_id + if (network_id := _dict.get('network_id')) is not None: + args['network_id'] = network_id + if (remote_bgp_asn := _dict.get('remote_bgp_asn')) is not None: + args['remote_bgp_asn'] = remote_bgp_asn else: raise ValueError('Required property \'remote_bgp_asn\' not present in TransitGatewayTunnel JSON') - if 'remote_gateway_ip' in _dict: - args['remote_gateway_ip'] = _dict.get('remote_gateway_ip') + if (remote_gateway_ip := _dict.get('remote_gateway_ip')) is not None: + args['remote_gateway_ip'] = remote_gateway_ip else: raise ValueError('Required property \'remote_gateway_ip\' not present in TransitGatewayTunnel JSON') - if 'remote_tunnel_ip' in _dict: - args['remote_tunnel_ip'] = _dict.get('remote_tunnel_ip') + if (remote_tunnel_ip := _dict.get('remote_tunnel_ip')) is not None: + args['remote_tunnel_ip'] = remote_tunnel_ip else: raise ValueError('Required property \'remote_tunnel_ip\' not present in TransitGatewayTunnel JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + if (status := _dict.get('status')) is not None: + args['status'] = status else: raise ValueError('Required property \'status\' not present in TransitGatewayTunnel JSON') - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) else: raise ValueError('Required property \'updated_at\' not present in TransitGatewayTunnel JSON') - if 'zone' in _dict: - args['zone'] = ZoneReference.from_dict(_dict.get('zone')) + if (zone := _dict.get('zone')) is not None: + args['zone'] = ZoneReference.from_dict(zone) else: raise ValueError('Required property \'zone\' not present in TransitGatewayTunnel JSON') return cls(**args) @@ -5903,16 +5888,6 @@ def to_dict(self) -> Dict: _dict['network_account_id'] = self.network_account_id if hasattr(self, 'network_id') and self.network_id is not None: _dict['network_id'] = self.network_id - if hasattr(self, 'prefix_filters') and self.prefix_filters is not None: - 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: _dict['remote_bgp_asn'] = self.remote_bgp_asn if hasattr(self, 'remote_gateway_ip') and self.remote_gateway_ip is not None: @@ -5958,16 +5933,6 @@ class BaseNetworkTypeEnum(str, Enum): VPN = 'vpn' - 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 StatusEnum(str, Enum): """ Tunnel's current configuration state. The list of enumerated values for this @@ -5990,7 +5955,7 @@ class TransitGatewayTunnelCollection: """ Collection of all tunnels for `redundant_gre` and `vpn_gateway` connections. - :attr List[TransitGatewayTunnel] tunnels: Collection of all tunnels for + :param List[TransitGatewayTunnel] tunnels: Collection of all tunnels for `redundant_gre` and `vpn_gateway` connections. """ @@ -6010,8 +5975,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayTunnelCollection': """Initialize a TransitGatewayTunnelCollection object from a json dictionary.""" args = {} - if 'tunnels' in _dict: - args['tunnels'] = [TransitGatewayTunnel.from_dict(v) for v in _dict.get('tunnels')] + if (tunnels := _dict.get('tunnels')) is not None: + args['tunnels'] = [TransitGatewayTunnel.from_dict(v) for v in tunnels] else: raise ValueError('Required property \'tunnels\' not present in TransitGatewayTunnelCollection JSON') return cls(**args) @@ -6057,13 +6022,13 @@ class TransitGatewayTunnelPatch: """ An update template for a Transit Gateway connection tunnel. - :attr str name: (optional) The user-defined name for this connection tunnel. + :param str name: (optional) The user-defined name for this connection tunnel. """ def __init__( self, *, - name: str = None, + name: Optional[str] = None, ) -> None: """ Initialize a TransitGatewayTunnelPatch object. @@ -6077,8 +6042,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayTunnelPatch': """Initialize a TransitGatewayTunnelPatch object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = name return cls(**args) @classmethod @@ -6116,21 +6081,21 @@ class TransitGatewayTunnelTemplate: """ A create template with information for redundant GRE tunnel. - :attr str local_gateway_ip: Local gateway IP address. - :attr str local_tunnel_ip: Local tunnel IP address. The local_tunnel_ip and + :param str local_gateway_ip: Local gateway IP address. + :param str local_tunnel_ip: Local tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. - :attr str name: The user-defined name for this tunnel connection. - :attr int remote_bgp_asn: (optional) Remote network BGP ASN. The following ASN + :param str name: The user-defined name for this tunnel connection. + :param int remote_bgp_asn: (optional) Remote network BGP ASN. The following ASN values are reserved and unavailable 0, 13884, 36351, 64512, 64513, 65100, 65200-65234, 65402-65433, 65500, 65516, 65519, 65521, 65531 and 4201065000-4201065999 If `remote_bgp_asn` is omitted on create requests, IBM will assign an ASN. - :attr str remote_gateway_ip: Remote gateway IP address. - :attr str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and + :param str remote_gateway_ip: Remote gateway IP address. + :param str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. - :attr ZoneIdentity zone: Specify the connection's location. The specified + :param ZoneIdentity zone: Specify the connection's location. The specified availability zone must reside in the gateway's region. Use the IBM Cloud global catalog to list zones within the desired region. """ @@ -6144,7 +6109,7 @@ def __init__( remote_tunnel_ip: str, zone: 'ZoneIdentity', *, - remote_bgp_asn: int = None, + remote_bgp_asn: Optional[int] = None, ) -> None: """ Initialize a TransitGatewayTunnelTemplate object. @@ -6179,30 +6144,30 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGatewayTunnelTemplate': """Initialize a TransitGatewayTunnelTemplate object from a json dictionary.""" args = {} - if 'local_gateway_ip' in _dict: - args['local_gateway_ip'] = _dict.get('local_gateway_ip') + if (local_gateway_ip := _dict.get('local_gateway_ip')) is not None: + args['local_gateway_ip'] = local_gateway_ip else: raise ValueError('Required property \'local_gateway_ip\' not present in TransitGatewayTunnelTemplate JSON') - if 'local_tunnel_ip' in _dict: - args['local_tunnel_ip'] = _dict.get('local_tunnel_ip') + if (local_tunnel_ip := _dict.get('local_tunnel_ip')) is not None: + args['local_tunnel_ip'] = local_tunnel_ip else: raise ValueError('Required property \'local_tunnel_ip\' not present in TransitGatewayTunnelTemplate JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in TransitGatewayTunnelTemplate JSON') - if 'remote_bgp_asn' in _dict: - args['remote_bgp_asn'] = _dict.get('remote_bgp_asn') - if 'remote_gateway_ip' in _dict: - args['remote_gateway_ip'] = _dict.get('remote_gateway_ip') + if (remote_bgp_asn := _dict.get('remote_bgp_asn')) is not None: + args['remote_bgp_asn'] = remote_bgp_asn + if (remote_gateway_ip := _dict.get('remote_gateway_ip')) is not None: + args['remote_gateway_ip'] = remote_gateway_ip else: raise ValueError('Required property \'remote_gateway_ip\' not present in TransitGatewayTunnelTemplate JSON') - if 'remote_tunnel_ip' in _dict: - args['remote_tunnel_ip'] = _dict.get('remote_tunnel_ip') + if (remote_tunnel_ip := _dict.get('remote_tunnel_ip')) is not None: + args['remote_tunnel_ip'] = remote_tunnel_ip else: raise ValueError('Required property \'remote_tunnel_ip\' not present in TransitGatewayTunnelTemplate JSON') - if 'zone' in _dict: - args['zone'] = _dict.get('zone') + if (zone := _dict.get('zone')) is not None: + args['zone'] = zone else: raise ValueError('Required property \'zone\' not present in TransitGatewayTunnelTemplate JSON') return cls(**args) @@ -6276,7 +6241,7 @@ class ZoneReference: """ Availability zone reference. - :attr str name: Availability zone name. + :param str name: Availability zone name. """ def __init__( @@ -6294,8 +6259,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'ZoneReference': """Initialize a ZoneReference object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in ZoneReference JSON') return cls(**args) @@ -6335,13 +6300,13 @@ class ZoneIdentityByName(ZoneIdentity): """ Availability zone. - :attr str name: (optional) Availability zone name. + :param str name: (optional) Availability zone name. """ def __init__( self, *, - name: str = None, + name: Optional[str] = None, ) -> None: """ Initialize a ZoneIdentityByName object. @@ -6355,8 +6320,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'ZoneIdentityByName': """Initialize a ZoneIdentityByName object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') + if (name := _dict.get('name')) is not None: + args['name'] = name return cls(**args) @classmethod diff --git a/test/integration/test_transit_gateway_apis_v1.py b/test/integration/test_transit_gateway_apis_v1.py index 142405a..ba8037c 100644 --- a/test/integration/test_transit_gateway_apis_v1.py +++ b/test/integration/test_transit_gateway_apis_v1.py @@ -348,6 +348,33 @@ def test_03_transit_gateway_connection_actions(self): dl_conn_id = response.get_result().get("id") assert self.is_resource_available(gateway_id=gateway_id, conn_id=dl_conn_id, rr_id="") + + ############################################# + # Success: POST Transit VPN Connection: + ############################################# + vpn_crn = os.getenv("TG_SERVICES_VPN_CRN") + vpn_name = "-VPN_" + time.strftime("%H%M%S") + vpn_name = os.getenv("TG_SERVICES_CONN_NAME") + vpn_name + vpn_cidr = "192.168.100.0/24"; + + response = self.tg.create_transit_gateway_connection( + name=vpn_name, + network_id=vpn_crn, + network_type="vpn_gateway", + cidr=vpn_cidr, + transit_gateway_id=gateway_id) + + assert response is not None + assert response.get_status_code() == 201 + assert response.get_result().get("id") != "" + assert response.get_result().get("name") == vpn_name + assert response.get_result().get("network_id") == vpn_crn + assert response.get_result().get("network_type") == "vpn_gateway" + + # wait until the Connection status = attached + vpn_conn_id = response.get_result().get("id") + assert self.is_resource_available(gateway_id=gateway_id, + conn_id=vpn_conn_id, rr_id="") ############################################# # Success: POST Transit GRE Connection: @@ -450,6 +477,20 @@ def test_03_transit_gateway_connection_actions(self): assert response.get_result().get("network_id") == dl_crn assert response.get_result().get("network_type") == "directlink" + ############################################# + # Success: GET Transit VPN Connection: + ############################################# + response = self.tg.get_transit_gateway_connection( + transit_gateway_id=gateway_id, id=vpn_conn_id) + + assert response is not None + assert response.get_status_code() == 200 + assert response.get_result().get("name") == vpn_name + assert response.get_result().get("id") == vpn_conn_id + assert response.get_result().get("network_id") == vpn_crn + assert response.get_result().get("network_type") == "vpn_gateway" + assert response.get_result().get("cidr") == vpn_cidr + ############################################# # Success: GET Transit GRE Connection: ############################################# @@ -520,6 +561,20 @@ def test_03_transit_gateway_connection_actions(self): assert response.get_result().get("id") == dl_conn_id assert response.get_result().get("name") == dl_name + ############################################# + # Success: UPDATE Transit VPN Connection: + ############################################# + dl_name = "UPDATED_" + vpn_name + response = self.tg.update_transit_gateway_connection( + transit_gateway_id=gateway_id, + name=vpn_name, + id=vpn_conn_id) + + assert response is not None + assert response.get_status_code() == 200 + assert response.get_result().get("id") == vpn_conn_id + assert response.get_result().get("name") == vpn_name + ############################################# # Success: UPDATE Transit GRE Connection: ############################################# @@ -558,13 +613,18 @@ def test_03_transit_gateway_connection_actions(self): assert response.get_status_code() == 200 assert len(response.get_result().get("connections")) > 0 - gre_found = dl_found = vpc_found = classic_found = unbound_gre_found = False + gre_found = dl_found = vpn_found = vpc_found = classic_found = unbound_gre_found = False conns = response.get_result().get("connections") for conn in conns: if conn["network_type"] == "directlink": assert conn["name"] == dl_name assert conn["id"] == dl_conn_id dl_found = True + + elif conn["network_type"] == "vpn_gateway": + assert conn["name"] == vpn_name + assert conn["id"] == vpn_conn_id + vpn_found = True elif conn["network_type"] == "gre_tunnel": assert conn["name"] == gre_name @@ -587,6 +647,7 @@ def test_03_transit_gateway_connection_actions(self): unbound_gre_found = True assert dl_found + assert vpn_found assert gre_found assert unbound_gre_found assert vpc_found @@ -926,6 +987,10 @@ def test_03_transit_gateway_connection_actions(self): assert self.delete_resource_test(gateway_id=gateway_id, conn_id=dl_conn_id, rr_id="", pf_id="") + # Delete VPN Connection + assert self.delete_resource_test(gateway_id=gateway_id, + conn_id=vpn_conn_id, rr_id="", pf_id="") + # Delete VPC Connection assert self.delete_resource_test(gateway_id=gateway_id, conn_id=vpc_conn_id, rr_id="", pf_id="") diff --git a/test/unit/test_transit_gateway_apis_v1.py b/test/unit/test_transit_gateway_apis_v1.py index 613bb14..f68fe52 100644 --- a/test/unit/test_transit_gateway_apis_v1.py +++ b/test/unit/test_transit_gateway_apis_v1.py @@ -28,7 +28,7 @@ import requests import responses import urllib -from ibm_cloud_networking_services.transit_gateway_apis_v1 import * +from ibm_cloud.transit_gateway_apis_v1 import * version = 'testString' @@ -48,23 +48,15 @@ def preprocess_url(operation_path: str): 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. + # 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: + if not request_url.endswith('/'): return request_url - else: - return re.compile(request_url.rstrip('/') + '/+') + return re.compile(request_url.rstrip('/') + '/+') ############################################################################## @@ -733,7 +725,7 @@ def test_list_connections_all_params(self): """ # Set up mock url = preprocess_url('/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": "network_account_id", "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"}, "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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"}}' + 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": "network_account_id", "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"}, "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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, @@ -784,7 +776,7 @@ def test_list_connections_required_params(self): """ # Set up mock url = preprocess_url('/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": "network_account_id", "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"}, "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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"}}' + 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": "network_account_id", "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"}, "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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, @@ -816,7 +808,7 @@ def test_list_connections_value_error(self): """ # Set up mock url = preprocess_url('/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": "network_account_id", "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"}, "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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"}}' + 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": "network_account_id", "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"}, "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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, @@ -849,8 +841,8 @@ def test_list_connections_with_pager_get_next(self): """ # Set up a two-page mock response url = preprocess_url('/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":"network_account_id","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"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","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.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"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":"network_account_id","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"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","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.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + 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":"network_account_id","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"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"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":"network_account_id","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"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' responses.add( responses.GET, url, @@ -887,8 +879,8 @@ def test_list_connections_with_pager_get_all(self): """ # Set up a two-page mock response url = preprocess_url('/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":"network_account_id","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"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","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.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"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":"network_account_id","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"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","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.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + 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":"network_account_id","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"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"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":"network_account_id","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"},"tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' responses.add( responses.GET, url, @@ -985,7 +977,7 @@ def test_list_transit_gateway_connections_all_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections') - mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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}' + mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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, @@ -1035,7 +1027,7 @@ def test_list_transit_gateway_connections_required_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections') - mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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}' + mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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, @@ -1073,7 +1065,7 @@ def test_list_transit_gateway_connections_value_error(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections') - mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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}' + mock_response = '{"connections": [{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "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, @@ -1110,8 +1102,8 @@ def test_list_transit_gateway_connections_with_pager_get_next(self): """ # 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_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","base_network_type":"classic","cidr":"192.168.0.0/24","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_BWTN_SJ_DL","network_account_id":"network_account_id","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","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","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.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"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","base_network_type":"classic","cidr":"192.168.0.0/24","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_BWTN_SJ_DL","network_account_id":"network_account_id","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","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","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.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","base_network_type":"classic","cidr":"192.168.0.0/24","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_BWTN_SJ_DL","network_account_id":"network_account_id","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","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"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","base_network_type":"classic","cidr":"192.168.0.0/24","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_BWTN_SJ_DL","network_account_id":"network_account_id","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","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' responses.add( responses.GET, url, @@ -1148,8 +1140,8 @@ def test_list_transit_gateway_connections_with_pager_get_all(self): """ # 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_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","base_network_type":"classic","cidr":"192.168.0.0/24","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_BWTN_SJ_DL","network_account_id":"network_account_id","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","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","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.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"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","base_network_type":"classic","cidr":"192.168.0.0/24","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_BWTN_SJ_DL","network_account_id":"network_account_id","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","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","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.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"connections":[{"base_connection_id":"975f58c1-afe7-469a-9727-7f3d720f2d32","base_network_type":"classic","cidr":"192.168.0.0/24","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_BWTN_SJ_DL","network_account_id":"network_account_id","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","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"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","base_network_type":"classic","cidr":"192.168.0.0/24","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_BWTN_SJ_DL","network_account_id":"network_account_id","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","tunnels":[{"base_network_type":"classic","created_at":"2019-01-01T12:00:00.000Z","id":"1a15dca5-7e33-45e1-b7c5-bc690e569531","local_bgp_asn":13,"local_gateway_ip":"10.242.63.12","local_tunnel_ip":"192.168.100.20","mtu":9000,"name":"gre1","network_account_id":"network_account_id","network_id":"crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b","remote_bgp_asn":65010,"remote_gateway_ip":"10.242.33.22","remote_tunnel_ip":"192.168.129.1","status":"attached","updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}],"updated_at":"2019-01-01T12:00:00.000Z","zone":{"name":"us-south-1"}}]}' responses.add( responses.GET, url, @@ -1189,7 +1181,7 @@ def test_create_transit_gateway_connection_all_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections') - mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.POST, url, @@ -1298,7 +1290,7 @@ def test_create_transit_gateway_connection_value_error(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections') - mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.POST, url, @@ -1458,7 +1450,7 @@ def test_get_transit_gateway_connection_all_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString') - mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.GET, url, @@ -1498,7 +1490,7 @@ def test_get_transit_gateway_connection_value_error(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString') - mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.GET, url, @@ -1543,7 +1535,7 @@ def test_update_transit_gateway_connection_all_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString') - mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.PATCH, url, @@ -1591,7 +1583,7 @@ def test_update_transit_gateway_connection_value_error(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString') - mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32", "base_network_type": "classic", "cidr": "192.168.0.0/24", "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_BWTN_SJ_DL", "network_account_id": "network_account_id", "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", "tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}], "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.PATCH, url, @@ -1724,7 +1716,7 @@ def test_list_transit_gateway_gre_tunnel_all_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString/tunnels') - mock_response = '{"tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}]}' + mock_response = '{"tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}]}' responses.add( responses.GET, url, @@ -1764,7 +1756,7 @@ def test_list_transit_gateway_gre_tunnel_value_error(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString/tunnels') - mock_response = '{"tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}]}' + mock_response = '{"tunnels": [{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}]}' responses.add( responses.GET, url, @@ -1809,7 +1801,7 @@ def test_create_transit_gateway_gre_tunnel_all_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString/tunnels') - mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.POST, url, @@ -1876,7 +1868,7 @@ def test_create_transit_gateway_gre_tunnel_value_error(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString/tunnels') - mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.POST, url, @@ -2021,7 +2013,7 @@ def test_get_transit_gateway_connection_tunnels_all_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString/tunnels/testString') - mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.GET, url, @@ -2063,7 +2055,7 @@ def test_get_transit_gateway_connection_tunnels_value_error(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString/tunnels/testString') - mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.GET, url, @@ -2110,7 +2102,7 @@ def test_update_transit_gateway_connection_tunnels_all_params(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString/tunnels/testString') - mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.PATCH, url, @@ -2161,7 +2153,7 @@ def test_update_transit_gateway_connection_tunnels_value_error(self): """ # Set up mock url = preprocess_url('/transit_gateways/testString/connections/testString/tunnels/testString') - mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "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.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' + mock_response = '{"base_network_type": "classic", "created_at": "2019-01-01T12:00:00.000Z", "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531", "local_bgp_asn": 13, "local_gateway_ip": "10.242.63.12", "local_tunnel_ip": "192.168.100.20", "mtu": 9000, "name": "gre1", "network_account_id": "network_account_id", "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b", "remote_bgp_asn": 65010, "remote_gateway_ip": "10.242.33.22", "remote_tunnel_ip": "192.168.129.1", "status": "attached", "updated_at": "2019-01-01T12:00:00.000Z", "zone": {"name": "us-south-1"}}' responses.add( responses.PATCH, url, @@ -4288,8 +4280,6 @@ def test_transit_connection_serialization(self): transit_gateway_tunnel_model['name'] = 'gre1' transit_gateway_tunnel_model['network_account_id'] = 'testString' transit_gateway_tunnel_model['network_id'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' - transit_gateway_tunnel_model['prefix_filters'] = [transit_gateway_connection_prefix_filter_reference_model] - transit_gateway_tunnel_model['prefix_filters_default'] = 'permit' transit_gateway_tunnel_model['remote_bgp_asn'] = 65010 transit_gateway_tunnel_model['remote_gateway_ip'] = '10.242.33.22' transit_gateway_tunnel_model['remote_tunnel_ip'] = '192.168.129.1' @@ -4380,8 +4370,6 @@ def test_transit_connection_collection_serialization(self): transit_gateway_tunnel_model['name'] = 'gre1' transit_gateway_tunnel_model['network_account_id'] = 'testString' transit_gateway_tunnel_model['network_id'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' - transit_gateway_tunnel_model['prefix_filters'] = [transit_gateway_connection_prefix_filter_reference_model] - transit_gateway_tunnel_model['prefix_filters_default'] = 'permit' transit_gateway_tunnel_model['remote_bgp_asn'] = 65010 transit_gateway_tunnel_model['remote_gateway_ip'] = '10.242.33.22' transit_gateway_tunnel_model['remote_tunnel_ip'] = '192.168.129.1' @@ -4587,8 +4575,6 @@ def test_transit_gateway_connection_collection_serialization(self): transit_gateway_tunnel_model['name'] = 'gre1' transit_gateway_tunnel_model['network_account_id'] = 'testString' transit_gateway_tunnel_model['network_id'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' - transit_gateway_tunnel_model['prefix_filters'] = [transit_gateway_connection_prefix_filter_reference_model] - transit_gateway_tunnel_model['prefix_filters_default'] = 'permit' transit_gateway_tunnel_model['remote_bgp_asn'] = 65010 transit_gateway_tunnel_model['remote_gateway_ip'] = '10.242.33.22' transit_gateway_tunnel_model['remote_tunnel_ip'] = '192.168.129.1' @@ -4688,8 +4674,6 @@ def test_transit_gateway_connection_cust_serialization(self): transit_gateway_tunnel_model['name'] = 'gre1' transit_gateway_tunnel_model['network_account_id'] = 'testString' transit_gateway_tunnel_model['network_id'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' - transit_gateway_tunnel_model['prefix_filters'] = [transit_gateway_connection_prefix_filter_reference_model] - transit_gateway_tunnel_model['prefix_filters_default'] = 'permit' transit_gateway_tunnel_model['remote_bgp_asn'] = 65010 transit_gateway_tunnel_model['remote_gateway_ip'] = '10.242.33.22' transit_gateway_tunnel_model['remote_tunnel_ip'] = '192.168.129.1' @@ -4853,16 +4837,6 @@ def test_transit_gateway_tunnel_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['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['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' - zone_reference_model = {} # ZoneReference zone_reference_model['name'] = 'us-south-1' @@ -4878,8 +4852,6 @@ def test_transit_gateway_tunnel_serialization(self): transit_gateway_tunnel_model_json['name'] = 'gre1' transit_gateway_tunnel_model_json['network_account_id'] = 'testString' transit_gateway_tunnel_model_json['network_id'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' - transit_gateway_tunnel_model_json['prefix_filters'] = [transit_gateway_connection_prefix_filter_reference_model] - transit_gateway_tunnel_model_json['prefix_filters_default'] = 'permit' transit_gateway_tunnel_model_json['remote_bgp_asn'] = 65010 transit_gateway_tunnel_model_json['remote_gateway_ip'] = '10.242.33.22' transit_gateway_tunnel_model_json['remote_tunnel_ip'] = '192.168.129.1' @@ -4915,16 +4887,6 @@ def test_transit_gateway_tunnel_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['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['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' - zone_reference_model = {} # ZoneReference zone_reference_model['name'] = 'us-south-1' @@ -4939,8 +4901,6 @@ def test_transit_gateway_tunnel_collection_serialization(self): transit_gateway_tunnel_model['name'] = 'gre1' transit_gateway_tunnel_model['network_account_id'] = 'testString' transit_gateway_tunnel_model['network_id'] = 'crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b' - transit_gateway_tunnel_model['prefix_filters'] = [transit_gateway_connection_prefix_filter_reference_model] - transit_gateway_tunnel_model['prefix_filters_default'] = 'permit' transit_gateway_tunnel_model['remote_bgp_asn'] = 65010 transit_gateway_tunnel_model['remote_gateway_ip'] = '10.242.33.22' transit_gateway_tunnel_model['remote_tunnel_ip'] = '192.168.129.1' From 8536d625abae96f72943b279e846b4fced013ee7 Mon Sep 17 00:00:00 2001 From: Sridhar G K Date: Mon, 3 Nov 2025 17:17:49 +0530 Subject: [PATCH 2/2] fix: updated tgw with new specs Signed-off-by: Sridhar G K --- .../transit_gateway_apis_v1.py | 450 ++++++------------ test/unit/test_transit_gateway_apis_v1.py | 141 +----- 2 files changed, 136 insertions(+), 455 deletions(-) diff --git a/ibm_cloud_networking_services/transit_gateway_apis_v1.py b/ibm_cloud_networking_services/transit_gateway_apis_v1.py index 1fcae4a..e63a86f 100644 --- a/ibm_cloud_networking_services/transit_gateway_apis_v1.py +++ b/ibm_cloud_networking_services/transit_gateway_apis_v1.py @@ -167,8 +167,10 @@ def create_transit_gateway( :param str name: A human readable name for the transit gateway. :param bool global_: (optional) Allow global routing for a Transit Gateway. If unspecified, the default value is false. - :param bool gre_enhanced_route_propagation: (optional) Allow GRE Enhanced - Route Propagation on this gateway. + :param bool gre_enhanced_route_propagation: (optional) Allow route + propagation across all GREs connected to the same transit gateway. This + affects connections on the gateway of type `redundant_gre`, + `unbound_gre_tunnel` and `gre_tunnel`. :param ResourceGroupIdentity resource_group: (optional) The resource group to use. If unspecified, the account's [default resource group](https://console.bluemix.net/apidocs/resource-manager#introduction) @@ -339,8 +341,11 @@ def update_transit_gateway( :param str id: The Transit Gateway identifier. :param bool global_: (optional) Allow global routing for a Transit Gateway. - :param bool gre_enhanced_route_propagation: (optional) Allow GRE Enhanced - Route Propagation on this gateway. + :param bool gre_enhanced_route_propagation: (optional) Allow route + propagation across all GREs connected to the same transit gateway. This + affects connections on the gateway of type `redundant_gre`, + `unbound_gre_tunnel` and `gre_tunnel`. It takes a few minutes for the + change to take effect. :param str name: (optional) A human readable name for a resource. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. @@ -623,10 +628,10 @@ def create_transit_gateway_connection( unspecified for network type `gre_tunnel`, `unbound_gre_tunnel`, `vpn_gateway` and `redundant_gre` connections. :param int remote_bgp_asn: (optional) Remote network BGP ASN. The following - 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. + ASN values are reserved and unavailable 0, 13884, 36351, 64512, 64513, + 65100, 65200-65234, 65402-65433, 65500, 65516, 65519, 65521, 65531 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`, @@ -646,14 +651,14 @@ def create_transit_gateway_connection( `directlink`, `vpc`, `power_virtual_server`, `vpn_gateway` and `redundant_gre` connections. :param List[TransitGatewayTunnelTemplate] tunnels: (optional) Array of GRE - tunnels for a transit gateway `redundant_gre` and `vpn_gateway` - connections. This field is required for `redundant_gre` and `vpn_gateway` - connections. + tunnels for a transit gateway `redundant_gre` connections. This field is + required for `redundant_gre` connections. :param ZoneIdentity zone: (optional) Specify the connection's location. The specified availability zone must reside in the gateway's region. Use the IBM Cloud global catalog to list zones within the desired region. - This field is required for network type `gre_tunnel`, `unbound_gre_tunnel` - and `vpn_gateway` connections. + This field is required for network type `gre_tunnel`, and + `unbound_gre_tunnel` connections. + This field is optional for network type `vpn_gateway` connections. This field is required to be unspecified for network type `classic`, `directlink`, `vpc`, `power_virtual_server` and `redundant_gre` connections. @@ -1056,9 +1061,10 @@ def create_transit_gateway_gre_tunnel( availability zone must reside in the gateway's region. Use the IBM Cloud global catalog to list zones within the desired region. :param int remote_bgp_asn: (optional) Remote network BGP ASN. The following - 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 create requests, IBM will assign an ASN. + ASN values are reserved and unavailable 0, 13884, 36351, 64512, 64513, + 65100, 65200-65234, 65402-65433, 65500, 65516, 65519, 65521, 65531 and + 4201065000-4201065999 If `remote_bgp_asn` is omitted on create requests, + IBM will assign an ASN. :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 `TransitGatewayTunnel` object @@ -1474,7 +1480,10 @@ def create_transit_gateway_connection_prefix_filter( """ Add a prefix filter to a Transit Gateway connection. - Add a prefix filter to a Transit Gateway connection. + Add a Prefix Filter to a Transit Gateway Connection. Prefix Filters can be added + to `vpc`, `classic`, `directlink`, and `power_virtual_server` Connection types. + Prefix Filters cannot be added to `gre_tunnel`, `unbound_gre_tunnel`, + `redundant_gre` or `vpn_gateway` Connection types. :param str transit_gateway_id: The Transit Gateway identifier. :param str id: The connection identifier. @@ -1566,72 +1575,6 @@ def create_transit_gateway_connection_prefix_filter( 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: - """ - Replaces the prefix filters of the Transit Gateway connection. - - Replaces the prefix filters of the Transit Gateway connection. - - :param str transit_gateway_id: The Transit Gateway identifier. - :param str id: The connection identifier. - :param List[PrefixFilterPut] prefix_filters: Array of prefix filters. - :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 `PrefixFilterCollection` object - """ - - if not transit_gateway_id: - raise ValueError('transit_gateway_id must be provided') - 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', - ) - headers.update(sdk_headers) - - params = { - 'version': self.version, - } - - data = { - 'prefix_filters': prefix_filters, - } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' - - 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, - ) - - response = self.send(request, **kwargs) - return response - def delete_transit_gateway_connection_prefix_filter( self, transit_gateway_id: str, @@ -2705,142 +2648,6 @@ class ActionEnum(str, Enum): -class PrefixFilterPut: - """ - A prefix filter update template. - - :param str action: Whether or not this prefix filter should allow or deny - prefixes matching this filter's prefix definition. - :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: 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: Optional[int] = None, - le: Optional[int] = None, - ) -> None: - """ - Initialize a PrefixFilterPut object. - - :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 - self.le = le - self.prefix = prefix - - @classmethod - def from_dict(cls, _dict: Dict) -> 'PrefixFilterPut': - """Initialize a PrefixFilterPut object from a json dictionary.""" - args = {} - if (action := _dict.get('action')) is not None: - args['action'] = action - else: - raise ValueError('Required property \'action\' not present in PrefixFilterPut JSON') - if (ge := _dict.get('ge')) is not None: - args['ge'] = ge - if (le := _dict.get('le')) is not None: - args['le'] = le - if (prefix := _dict.get('prefix')) is not None: - args['prefix'] = prefix - else: - raise ValueError('Required property \'prefix\' not present in PrefixFilterPut JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a PrefixFilterPut 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, 'action') and self.action is not None: - _dict['action'] = self.action - if hasattr(self, 'ge') and self.ge is not None: - _dict['ge'] = self.ge - if hasattr(self, 'le') and self.le is not None: - _dict['le'] = self.le - if hasattr(self, 'prefix') and self.prefix is not None: - _dict['prefix'] = self.prefix - 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 PrefixFilterPut object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'PrefixFilterPut') -> 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: 'PrefixFilterPut') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class ActionEnum(str, Enum): - """ - Whether or not this prefix filter should allow or deny prefixes matching this - filter's prefix definition. - """ - - PERMIT = 'permit' - DENY = 'deny' - - - class ResourceGroupIdentity: """ The resource group to use. If unspecified, the account's [default resource @@ -3287,26 +3094,25 @@ class RouteReportConnectionBgp: """ connection bgp details. - :attr str as_path: (optional) AS path. - :attr bool is_used: (optional) Indicates whether current route is used or not. - :attr str local_preference: (optional) local preference. - :attr str prefix: (optional) prefix. + :param str as_path: (optional) AS path. + :param bool is_used: Indicates whether current route is used or not. + :param str local_preference: (optional) local preference. + :param str prefix: (optional) prefix. """ def __init__( self, + is_used: bool, *, - as_path: str = None, - is_used: bool = None, - local_preference: str = None, - prefix: str = None, + as_path: Optional[str] = None, + local_preference: Optional[str] = None, + prefix: Optional[str] = None, ) -> None: """ Initialize a RouteReportConnectionBgp object. + :param bool is_used: Indicates whether current route is used or not. :param str as_path: (optional) AS path. - :param bool is_used: (optional) Indicates whether current route is used or - not. :param str local_preference: (optional) local preference. :param str prefix: (optional) prefix. """ @@ -3319,14 +3125,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportConnectionBgp': """Initialize a RouteReportConnectionBgp object from a json dictionary.""" args = {} - if 'as_path' in _dict: - args['as_path'] = _dict.get('as_path') - if 'is_used' in _dict: - args['is_used'] = _dict.get('is_used') - if 'local_preference' in _dict: - args['local_preference'] = _dict.get('local_preference') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (as_path := _dict.get('as_path')) is not None: + args['as_path'] = as_path + if (is_used := _dict.get('is_used')) is not None: + args['is_used'] = is_used + else: + raise ValueError('Required property \'is_used\' not present in RouteReportConnectionBgp JSON') + if (local_preference := _dict.get('local_preference')) is not None: + args['local_preference'] = local_preference + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix return cls(**args) @classmethod @@ -3970,10 +3778,10 @@ class TransitConnection: is order dependent with those first in the array being applied first, and those at the end of the array is applied last, or just before the default. This field does not apply to the `redundant_gre` network types. - :attr str prefix_filters_default: (optional) Default setting of permit or deny + :param str prefix_filters_default: (optional) Default setting of permit or deny which applies to any routes that don't match a specified filter. This field does not apply to the `redundant_gre` network types. - :attr int remote_bgp_asn: (optional) Remote network BGP ASN. This field only + :param int remote_bgp_asn: (optional) Remote network BGP ASN. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. :param str remote_gateway_ip: (optional) Remote gateway IP address. This field only applies to network type `gre_tunnel` and `unbound_gre_tunnel` connections. @@ -4285,6 +4093,7 @@ class BaseNetworkTypeEnum(str, Enum): CLASSIC = 'classic' VPC = 'vpc' + VPN = 'vpn' class NetworkTypeEnum(str, Enum): @@ -4461,19 +4270,20 @@ class TransitGateway: """ Details of a Transit Gateway. - :attr int connection_count: (optional) The number of connections associated with - this Transit Gateway. - :attr bool connection_needs_attention: (optional) Indicates if this Transit - Gateway has a connection that needs attention (Such as cross account approval). - :attr datetime created_at: The date and time that this gateway was created. - :attr str crn: (optional) Cloud Resource Name of a transit gateway. - :attr bool global_: Allow global routing for a Transit Gateway. - :attr bool gre_enhanced_route_propagation: (optional) Allow GRE Enhanced Route - Propagation on this gateway. - :attr str id: A unique identifier for this transit gateway. - :attr str location: Location of Transit Gateway Services. - :attr str name: A human readable name for the transit gateway. - :attr ResourceGroupReference resource_group: (optional) The resource group to + :param int connection_count: (optional) The number of connections associated + with this Transit Gateway. + :param bool connection_needs_attention: Indicates if this Transit Gateway has a + connection that needs attention (Such as cross account approval). + :param datetime created_at: The date and time that this gateway was created. + :param str crn: (optional) Cloud Resource Name of a transit gateway. + :param bool global_: Allow global routing for a Transit Gateway. + :param bool gre_enhanced_route_propagation: Allow route propagation across all + GREs connected to the same transit gateway. This affects connections on the + gateway of type `redundant_gre`, `unbound_gre_tunnel` and `gre_tunnel`. + :param str id: A unique identifier for this transit gateway. + :param str location: Location of Transit Gateway Services. + :param str name: A human readable name for the transit gateway. + :param ResourceGroupReference resource_group: (optional) The resource group to use. If unspecified, the account's [default resource group](https://console.bluemix.net/apidocs/resource-manager#introduction) is used. @@ -4486,26 +4296,31 @@ class TransitGateway: def __init__( self, + connection_needs_attention: bool, created_at: datetime, global_: bool, + gre_enhanced_route_propagation: bool, id: str, location: str, name: str, status: str, *, - connection_count: int = None, - connection_needs_attention: bool = None, - crn: str = None, - gre_enhanced_route_propagation: bool = None, - resource_group: 'ResourceGroupReference' = None, - updated_at: datetime = None, + connection_count: Optional[int] = None, + crn: Optional[str] = None, + resource_group: Optional['ResourceGroupReference'] = None, + updated_at: Optional[datetime] = None, ) -> None: """ Initialize a TransitGateway object. + :param bool connection_needs_attention: Indicates if this Transit Gateway + has a connection that needs attention (Such as cross account approval). :param datetime created_at: The date and time that this gateway was created. :param bool global_: Allow global routing for a Transit Gateway. + :param bool gre_enhanced_route_propagation: Allow route propagation across + all GREs connected to the same transit gateway. This affects connections on + the gateway of type `redundant_gre`, `unbound_gre_tunnel` and `gre_tunnel`. :param str id: A unique identifier for this transit gateway. :param str location: Location of Transit Gateway Services. :param str name: A human readable name for the transit gateway. @@ -4514,12 +4329,7 @@ def __init__( processes using this field must tolerate unexpected values. :param int connection_count: (optional) The number of connections associated with this Transit Gateway. - :param bool connection_needs_attention: (optional) Indicates if this - Transit Gateway has a connection that needs attention (Such as cross - account approval). :param str crn: (optional) Cloud Resource Name of a transit gateway. - :param bool gre_enhanced_route_propagation: (optional) Allow GRE Enhanced - Route Propagation on this gateway. :param ResourceGroupReference resource_group: (optional) The resource group to use. If unspecified, the account's [default resource group](https://console.bluemix.net/apidocs/resource-manager#introduction) @@ -4544,12 +4354,14 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'TransitGateway': """Initialize a TransitGateway object from a json dictionary.""" args = {} - if 'connection_count' in _dict: - args['connection_count'] = _dict.get('connection_count') - if 'connection_needs_attention' in _dict: - args['connection_needs_attention'] = _dict.get('connection_needs_attention') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (connection_count := _dict.get('connection_count')) is not None: + args['connection_count'] = connection_count + if (connection_needs_attention := _dict.get('connection_needs_attention')) is not None: + args['connection_needs_attention'] = connection_needs_attention + else: + raise ValueError('Required property \'connection_needs_attention\' not present in TransitGateway JSON') + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) else: raise ValueError('Required property \'created_at\' not present in TransitGateway JSON') if (crn := _dict.get('crn')) is not None: @@ -4558,10 +4370,12 @@ def from_dict(cls, _dict: Dict) -> 'TransitGateway': args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in TransitGateway JSON') - if 'gre_enhanced_route_propagation' in _dict: - args['gre_enhanced_route_propagation'] = _dict.get('gre_enhanced_route_propagation') - if 'id' in _dict: - args['id'] = _dict.get('id') + if (gre_enhanced_route_propagation := _dict.get('gre_enhanced_route_propagation')) is not None: + args['gre_enhanced_route_propagation'] = gre_enhanced_route_propagation + else: + raise ValueError('Required property \'gre_enhanced_route_propagation\' not present in TransitGateway JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id else: raise ValueError('Required property \'id\' not present in TransitGateway JSON') if (location := _dict.get('location')) is not None: @@ -4958,8 +4772,9 @@ class TransitGatewayConnectionCust: for `redundant_gre` and `vpn_gateway` connections. :param datetime updated_at: The date and time that this connection was last updated. - :attr ZoneReference zone: (optional) Location of GRE tunnel. This field is - required for network type `gre_tunnel` and `vpn_gateway` connections. + :param ZoneReference zone: (optional) Location of GRE tunnel. This field is + required for network type `gre_tunnel` and `unbound_gre_tunnel` connections. + This field is optional for network type `vpn_gateway` connections. """ def __init__( @@ -5073,7 +4888,9 @@ def __init__( :param List[TransitGatewayTunnel] tunnels: (optional) Collection of all tunnels for `redundant_gre` and `vpn_gateway` connections. :param ZoneReference zone: (optional) Location of GRE tunnel. This field is - required for network type `gre_tunnel` and `vpn_gateway` connections. + required for network type `gre_tunnel` and `unbound_gre_tunnel` + connections. + This field is optional for network type `vpn_gateway` connections. """ self.base_connection_id = base_connection_id self.base_network_type = base_network_type @@ -5262,6 +5079,7 @@ class BaseNetworkTypeEnum(str, Enum): CLASSIC = 'classic' VPC = 'vpc' + VPN = 'vpn' class NetworkTypeEnum(str, Enum): @@ -5680,19 +5498,19 @@ class TransitGatewayTunnel: :param str local_tunnel_ip: Local tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. - :attr int mtu: GRE tunnel MTU. - :attr str name: The user-defined name for this tunnel. - :attr str network_account_id: (optional) The ID of the account for cross account - Classic connections. This field is required when the GRE tunnel is in a + :param int mtu: (optional) GRE tunnel MTU. + :param str name: The user-defined name for this tunnel. + :param str network_account_id: (optional) The ID of the account for cross + account Classic connections. This field is required when the GRE tunnel is in a different account than the gateway and the base network is Classic. :param str network_id: (optional) The ID of the network VPC being connected via this connection. - :attr int remote_bgp_asn: Remote network BGP ASN. The following 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 - create requests, IBM will assign an ASN. - :attr str remote_gateway_ip: Remote gateway IP address. - :attr str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and + :param int remote_bgp_asn: Remote network BGP ASN. The following ASN values are + reserved and unavailable 0, 13884, 36351, 64512, 64513, 65100, 65200-65234, + 65402-65433, 65500, 65516, 65519, 65521, 65531 and 4201065000-4201065999 If + `remote_bgp_asn` is omitted on create requests, IBM will assign an ASN. + :param str remote_gateway_ip: Remote gateway IP address. + :param str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. :param str status: Tunnel's current configuration state. The list of enumerated @@ -5710,7 +5528,6 @@ def __init__( local_bgp_asn: int, local_gateway_ip: str, local_tunnel_ip: str, - mtu: int, name: str, remote_bgp_asn: int, remote_gateway_ip: str, @@ -5719,8 +5536,9 @@ def __init__( updated_at: datetime, zone: 'ZoneReference', *, - network_account_id: str = None, - network_id: str = None, + mtu: Optional[int] = None, + network_account_id: Optional[str] = None, + network_id: Optional[str] = None, ) -> None: """ Initialize a TransitGatewayTunnel object. @@ -5736,12 +5554,12 @@ def __init__( :param str local_tunnel_ip: Local tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. - :param int mtu: GRE tunnel MTU. :param str name: The user-defined name for this tunnel. :param int remote_bgp_asn: Remote network BGP ASN. The following 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 create requests, IBM will assign an ASN. + are reserved and unavailable 0, 13884, 36351, 64512, 64513, 65100, + 65200-65234, 65402-65433, 65500, 65516, 65519, 65521, 65531 and + 4201065000-4201065999 If `remote_bgp_asn` is omitted on create requests, + IBM will assign an ASN. :param str remote_gateway_ip: Remote gateway IP address. :param str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can @@ -5752,6 +5570,7 @@ def __init__( :param datetime updated_at: The date and time that this tunnel was last updated. :param ZoneReference zone: Availability zone reference. + :param int mtu: (optional) GRE tunnel MTU. :param str network_account_id: (optional) The ID of the account for cross account Classic connections. This field is required when the GRE tunnel is in a different account than the gateway and the base network is Classic. @@ -5803,20 +5622,18 @@ def from_dict(cls, _dict: Dict) -> 'TransitGatewayTunnel': args['local_tunnel_ip'] = local_tunnel_ip else: raise ValueError('Required property \'local_tunnel_ip\' not present in TransitGatewayTunnel JSON') - if 'mtu' in _dict: - args['mtu'] = _dict.get('mtu') - else: - raise ValueError('Required property \'mtu\' not present in TransitGatewayTunnel JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (mtu := _dict.get('mtu')) is not None: + args['mtu'] = mtu + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in TransitGatewayTunnel JSON') - if 'network_account_id' in _dict: - args['network_account_id'] = _dict.get('network_account_id') - if 'network_id' in _dict: - args['network_id'] = _dict.get('network_id') - if 'remote_bgp_asn' in _dict: - args['remote_bgp_asn'] = _dict.get('remote_bgp_asn') + if (network_account_id := _dict.get('network_account_id')) is not None: + args['network_account_id'] = network_account_id + if (network_id := _dict.get('network_id')) is not None: + args['network_id'] = network_id + if (remote_bgp_asn := _dict.get('remote_bgp_asn')) is not None: + args['remote_bgp_asn'] = remote_bgp_asn else: raise ValueError('Required property \'remote_bgp_asn\' not present in TransitGatewayTunnel JSON') if (remote_gateway_ip := _dict.get('remote_gateway_ip')) is not None: @@ -5911,6 +5728,7 @@ class BaseNetworkTypeEnum(str, Enum): CLASSIC = 'classic' VPC = 'vpc' + VPN = 'vpn' class StatusEnum(str, Enum): @@ -6065,13 +5883,14 @@ class TransitGatewayTunnelTemplate: :param str local_tunnel_ip: Local tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. - :attr str name: The user-defined name for this tunnel connection. - :attr int remote_bgp_asn: (optional) Remote network BGP ASN. The following 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 create requests, IBM will assign an ASN. - :attr str remote_gateway_ip: Remote gateway IP address. - :attr str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and + :param str name: The user-defined name for this tunnel connection. + :param int remote_bgp_asn: (optional) Remote network BGP ASN. The following ASN + values are reserved and unavailable 0, 13884, 36351, 64512, 64513, 65100, + 65200-65234, 65402-65433, 65500, 65516, 65519, 65521, 65531 and + 4201065000-4201065999 If `remote_bgp_asn` is omitted on create requests, IBM + will assign an ASN. + :param str remote_gateway_ip: Remote gateway IP address. + :param str remote_tunnel_ip: Remote tunnel IP address. The local_tunnel_ip and remote_tunnel_ip addresses must be in the same /30 network. Neither can be the network nor broadcast addresses. :param ZoneIdentity zone: Specify the connection's location. The specified @@ -6106,9 +5925,10 @@ def __init__( availability zone must reside in the gateway's region. Use the IBM Cloud global catalog to list zones within the desired region. :param int remote_bgp_asn: (optional) Remote network BGP ASN. The following - 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 create requests, IBM will assign an ASN. + ASN values are reserved and unavailable 0, 13884, 36351, 64512, 64513, + 65100, 65200-65234, 65402-65433, 65500, 65516, 65519, 65521, 65531 and + 4201065000-4201065999 If `remote_bgp_asn` is omitted on create requests, + IBM will assign an ASN. """ self.local_gateway_ip = local_gateway_ip self.local_tunnel_ip = local_tunnel_ip diff --git a/test/unit/test_transit_gateway_apis_v1.py b/test/unit/test_transit_gateway_apis_v1.py index f68fe52..94c5d09 100644 --- a/test/unit/test_transit_gateway_apis_v1.py +++ b/test/unit/test_transit_gateway_apis_v1.py @@ -28,7 +28,7 @@ import requests import responses import urllib -from ibm_cloud.transit_gateway_apis_v1 import * +from ibm_cloud_networking_services.transit_gateway_apis_v1 import * version = 'testString' @@ -2654,112 +2654,6 @@ def test_create_transit_gateway_connection_prefix_filter_value_error_with_retrie self.test_create_transit_gateway_connection_prefix_filter_value_error() -class TestReplaceTransitGatewayConnectionPrefixFilter: - """ - Test Class for replace_transit_gateway_connection_prefix_filter - """ - - @responses.activate - def test_replace_transit_gateway_connection_prefix_filter_all_params(self): - """ - replace_transit_gateway_connection_prefix_filter() - """ - # Set up mock - 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, - ) - - # Construct a dict representation of a PrefixFilterPut model - prefix_filter_put_model = {} - prefix_filter_put_model['action'] = 'permit' - prefix_filter_put_model['ge'] = 0 - prefix_filter_put_model['le'] = 32 - prefix_filter_put_model['prefix'] = '192.168.100.0/24' - - # Set up parameter values - transit_gateway_id = 'testString' - id = 'testString' - prefix_filters = [prefix_filter_put_model] - - # Invoke method - response = _service.replace_transit_gateway_connection_prefix_filter( - transit_gateway_id, - id, - prefix_filters, - headers={}, - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 201 - # Validate body params - req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['prefix_filters'] == [prefix_filter_put_model] - - def test_replace_transit_gateway_connection_prefix_filter_all_params_with_retries(self): - # Enable retries and run test_replace_transit_gateway_connection_prefix_filter_all_params. - _service.enable_retries() - self.test_replace_transit_gateway_connection_prefix_filter_all_params() - - # Disable retries and run test_replace_transit_gateway_connection_prefix_filter_all_params. - _service.disable_retries() - self.test_replace_transit_gateway_connection_prefix_filter_all_params() - - @responses.activate - def test_replace_transit_gateway_connection_prefix_filter_value_error(self): - """ - test_replace_transit_gateway_connection_prefix_filter_value_error() - """ - # Set up mock - 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, - ) - - # Construct a dict representation of a PrefixFilterPut model - prefix_filter_put_model = {} - prefix_filter_put_model['action'] = 'permit' - prefix_filter_put_model['ge'] = 0 - prefix_filter_put_model['le'] = 32 - prefix_filter_put_model['prefix'] = '192.168.100.0/24' - - # Set up parameter values - transit_gateway_id = 'testString' - id = 'testString' - prefix_filters = [prefix_filter_put_model] - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "transit_gateway_id": transit_gateway_id, - "id": id, - "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()} - 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() - self.test_replace_transit_gateway_connection_prefix_filter_value_error() - - # Disable retries and run test_replace_transit_gateway_connection_prefix_filter_value_error. - _service.disable_retries() - self.test_replace_transit_gateway_connection_prefix_filter_value_error() - - class TestDeleteTransitGatewayConnectionPrefixFilter: """ Test Class for delete_transit_gateway_connection_prefix_filter @@ -3700,39 +3594,6 @@ def test_prefix_filter_cust_serialization(self): assert prefix_filter_cust_model_json2 == prefix_filter_cust_model_json -class TestModel_PrefixFilterPut: - """ - Test Class for PrefixFilterPut - """ - - def test_prefix_filter_put_serialization(self): - """ - Test serialization/deserialization for PrefixFilterPut - """ - - # Construct a json representation of a PrefixFilterPut model - prefix_filter_put_model_json = {} - prefix_filter_put_model_json['action'] = 'permit' - prefix_filter_put_model_json['ge'] = 0 - prefix_filter_put_model_json['le'] = 32 - prefix_filter_put_model_json['prefix'] = '192.168.100.0/24' - - # Construct a model instance of PrefixFilterPut by calling from_dict on the json representation - prefix_filter_put_model = PrefixFilterPut.from_dict(prefix_filter_put_model_json) - assert prefix_filter_put_model != False - - # Construct a model instance of PrefixFilterPut by calling from_dict on the json representation - prefix_filter_put_model_dict = PrefixFilterPut.from_dict(prefix_filter_put_model_json).__dict__ - prefix_filter_put_model2 = PrefixFilterPut(**prefix_filter_put_model_dict) - - # Verify the model instances are equivalent - assert prefix_filter_put_model == prefix_filter_put_model2 - - # Convert model instance back to dict and verify no loss of data - 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: """ Test Class for ResourceGroupIdentity