From 10ff9dddfcaa2b44d7af37a21f3e4d69e8784c95 Mon Sep 17 00:00:00 2001 From: Sirija Reddy Date: Wed, 7 May 2025 21:27:42 +0530 Subject: [PATCH] feat: direct link macsec changes Signed-off-by: Sirija Reddy --- .travis.yml | 9 +- .../direct_link_v1.py | 8295 ++++++++++------- .../test_direct_link_provider_v2.py | 4 +- test/integration/test_direct_link_v1.py | 164 +- test/unit/test_direct_link_v1.py | 3938 +++++--- tox.ini | 12 +- 6 files changed, 7961 insertions(+), 4461 deletions(-) diff --git a/.travis.yml b/.travis.yml index f24d1b8..809c577 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ notifications: matrix: include: - - python: 3.9 + - python: 3.10 before_script: - >- [ -z "${TRAVIS_TAG}" ] && [ "${TRAVIS_PULL_REQUEST}" == "false" ] @@ -18,9 +18,8 @@ matrix: && openssl aes-256-cbc -K $encrypted_27cb64608ff6_key -iv $encrypted_27cb64608ff6_iv -in dl.env.enc -out dl.env -d || true && openssl aes-256-cbc -K $encrypted_fc092b9428d6_key -iv $encrypted_fc092b9428d6_iv -in cis.env.enc -out cis.env -d || true && openssl aes-256-cbc -K $encrypted_89a9eb4f9417_key -iv $encrypted_89a9eb4f9417_iv -in dns.env.enc -out dns.env -d || true - - python: 3.8 - - python: 3.10 - python: 3.11 + - python: 3.12 before_install: - sudo apt-get update @@ -50,7 +49,7 @@ deploy: script: npx semantic-release skip_cleanup: true on: - python: '3.9' + python: '3.10' all_branches: true # Allow semantic-release on any branch triggered by tags #branch: master tags: true @@ -61,5 +60,5 @@ deploy: repository: https://upload.pypi.org/legacy skip_cleanup: true on: - python: '3.9' + python: '3.10' tags: true \ No newline at end of file diff --git a/ibm_cloud_networking_services/direct_link_v1.py b/ibm_cloud_networking_services/direct_link_v1.py index 32f2e37..4abd52e 100644 --- a/ibm_cloud_networking_services/direct_link_v1.py +++ b/ibm_cloud_networking_services/direct_link_v1.py @@ -1,6 +1,6 @@ # coding: utf-8 -# (C) Copyright IBM Corp. 2024. +# (C) Copyright IBM Corp. 2025. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# IBM OpenAPI SDK Code Generator Version: 3.80.0-29334a73-20230925-151553 +# IBM OpenAPI SDK Code Generator Version: 3.99.0-d27cee72-20250129-204831 """ No description provided (generated by Openapi Generator @@ -25,7 +25,7 @@ from datetime import datetime from enum import Enum -from typing import BinaryIO, Dict, List +from typing import BinaryIO, Dict, List, Optional import json from ibm_cloud_sdk_core import BaseService, DetailedResponse @@ -353,19 +353,19 @@ def create_gateway_action( self, id: str, *, - action: str = None, - as_prepends: List['AsPrependTemplate'] = None, - authentication_key: 'GatewayActionTemplateAuthenticationKey' = None, - bfd_config: 'GatewayBfdConfigActionTemplate' = None, - connection_mode: str = None, - default_export_route_filter: str = None, - default_import_route_filter: str = None, - export_route_filters: List['GatewayTemplateRouteFilter'] = None, - global_: bool = None, - import_route_filters: List['GatewayTemplateRouteFilter'] = None, - metered: bool = None, - resource_group: 'ResourceGroupIdentity' = None, - updates: List['GatewayActionTemplateUpdatesItem'] = None, + action: Optional[str] = None, + as_prepends: Optional[List['AsPrependTemplate']] = None, + authentication_key: Optional['AuthenticationKeyIdentity'] = None, + bfd_config: Optional['GatewayBfdConfigActionTemplate'] = None, + connection_mode: Optional[str] = None, + default_export_route_filter: Optional[str] = None, + default_import_route_filter: Optional[str] = None, + export_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, + global_: Optional[bool] = None, + import_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, + metered: Optional[bool] = None, + resource_group: Optional['ResourceGroupIdentity'] = None, + updates: Optional[List['GatewayActionTemplateUpdatesItem']] = None, **kwargs, ) -> DetailedResponse: """ @@ -380,12 +380,7 @@ def create_gateway_action( :param List[AsPrependTemplate] as_prepends: (optional) Applicable for create_gateway_approve requests to create AS Prepends. Contains an array of AS Prepend configuration information. - :param GatewayActionTemplateAuthenticationKey authentication_key: - (optional) Applicable for create_gateway_approve requests to select the - gateway's BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original - string must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. + :param AuthenticationKeyIdentity authentication_key: (optional) :param GatewayBfdConfigActionTemplate bfd_config: (optional) Applicable for create_gateway_approve requests to select the gateway's BFD configuration information. @@ -553,8 +548,8 @@ def create_gateway_completion_notice( self, id: str, *, - upload: BinaryIO = None, - upload_content_type: str = None, + upload: Optional[BinaryIO] = None, + upload_content_type: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -715,7 +710,7 @@ def get_gateway_status( self, id: str, *, - type: str = None, + type: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -765,6 +760,130 @@ def get_gateway_status( response = self.send(request, **kwargs) return response + ######################### + # Gateway AS Prepends + ######################### + + def list_gateway_as_prepends( + self, + gateway_id: str, + **kwargs, + ) -> DetailedResponse: + """ + List AS Prepends. + + Retrieve all AS Prepends for the specified Direct Link gateway. + + :param str gateway_id: Direct Link gateway identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `AsPrependCollection` object + """ + + if not gateway_id: + raise ValueError('gateway_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_gateway_as_prepends', + ) + headers.update(sdk_headers) + + params = { + 'version': self.version, + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['gateway_id'] + path_param_values = self.encode_path_vars(gateway_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/as_prepends'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) + + response = self.send(request, **kwargs) + return response + + def replace_gateway_as_prepends( + self, + gateway_id: str, + if_match: str, + *, + as_prepends: Optional[List['AsPrependPrefixArrayTemplate']] = None, + **kwargs, + ) -> DetailedResponse: + """ + Replace existing AS Prepends. + + Replace the given set of AS prepends on the specified gateway. Existing resources + may be reused when the individual AS Prepend item is unchanged. + + :param str gateway_id: Direct Link gateway identifier. + :param str if_match: If present, the request will fail if the specified + ETag value does not match the resource's current ETag value. + :param List[AsPrependPrefixArrayTemplate] as_prepends: (optional) array of + AS Prepend configuration information. + :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 `AsPrependCollection` object + """ + + if not gateway_id: + raise ValueError('gateway_id must be provided') + if not if_match: + raise ValueError('if_match must be provided') + if as_prepends is not None: + as_prepends = [convert_model(x) for x in as_prepends] + headers = { + 'If-Match': if_match, + } + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='replace_gateway_as_prepends', + ) + headers.update(sdk_headers) + + params = { + 'version': self.version, + } + + data = { + 'as_prepends': as_prepends, + } + 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 = ['gateway_id'] + path_param_values = self.encode_path_vars(gateway_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/as_prepends'.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 + ######################### # Gateway Export Route Filters ######################### @@ -831,9 +950,9 @@ def create_gateway_export_route_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: """ @@ -932,7 +1051,7 @@ def replace_gateway_export_route_filters( gateway_id: str, if_match: str, *, - export_route_filters: List['GatewayTemplateRouteFilter'] = None, + export_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, **kwargs, ) -> DetailedResponse: """ @@ -1245,9 +1364,9 @@ def create_gateway_import_route_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: """ @@ -1346,7 +1465,7 @@ def replace_gateway_import_route_filters( gateway_id: str, if_match: str, *, - import_route_filters: List['GatewayTemplateRouteFilter'] = None, + import_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, **kwargs, ) -> DetailedResponse: """ @@ -1595,32 +1714,32 @@ def update_gateway_import_route_filter( return response ######################### - # Gateway Route Reports + # Gateway MACsec ######################### - def list_gateway_route_reports( + def unset_gateway_macsec( self, - gateway_id: str, + id: str, **kwargs, ) -> DetailedResponse: """ - List route reports. + Unset MACsec configuration. - Retrieve all route reports for the specified Direct Link gateway. + Removes the MACsec configuration from a direct link, disabling the features. - :param str gateway_id: Direct Link gateway identifier. + :param str id: Direct Link gateway identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `RouteReportCollection` object + :rtype: DetailedResponse """ - if not gateway_id: - raise ValueError('gateway_id must be provided') + if not id: + raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_gateway_route_reports', + operation_id='unset_gateway_macsec', ) headers.update(sdk_headers) @@ -1631,14 +1750,13 @@ def list_gateway_route_reports( if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] - headers['Accept'] = 'application/json' - path_param_keys = ['gateway_id'] - path_param_values = self.encode_path_vars(gateway_id) + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/route_reports'.format(**path_param_dict) + url = '/gateways/{id}/macsec'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='DELETE', url=url, headers=headers, params=params, @@ -1647,35 +1765,29 @@ def list_gateway_route_reports( response = self.send(request, **kwargs) return response - def create_gateway_route_report( + def get_gateway_macsec( self, - gateway_id: str, + id: str, **kwargs, ) -> DetailedResponse: """ - Request a route report. + Get MACsec configuration. - Request route report generation. While report generation is in progress, - additional requests to generate a report are ignored and return the current - pending report. While `status` is `pending`, `gateway_routes`, `on_prem_routes`, - `virtual_connection_routes`, and `overlapping_routes` will be empty arrays. These - fields will be filled when the `status` enters the `complete` status. Call - `get_gateway_route_report` with the pending route report's `id` to check on the - current status of the report. + Retrieve the MACsec configuration of a direct link. - :param str gateway_id: Direct Link gateway identifier. + :param str id: Direct Link gateway identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `RouteReport` object + :rtype: DetailedResponse with `dict` result representing a `GatewayMacsec` object """ - if not gateway_id: - raise ValueError('gateway_id must be provided') + if not id: + raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_gateway_route_report', + operation_id='get_gateway_macsec', ) headers.update(sdk_headers) @@ -1688,12 +1800,12 @@ def create_gateway_route_report( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['gateway_id'] - path_param_values = self.encode_path_vars(gateway_id) + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/route_reports'.format(**path_param_dict) + url = '/gateways/{id}/macsec'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='GET', url=url, headers=headers, params=params, @@ -1702,33 +1814,36 @@ def create_gateway_route_report( response = self.send(request, **kwargs) return response - def delete_gateway_route_report( + def update_gateway_macsec( self, - gateway_id: str, id: str, + gateway_macsec_patch: 'GatewayMacsecPatch', **kwargs, ) -> DetailedResponse: """ - Delete route report. + Update MACsec configuration. - Delete a route report. + Updates the MACsec configuration on a direct link. - :param str gateway_id: Direct Link gateway identifier. - :param str id: Route report identifier. + :param str id: Direct Link gateway identifier. + :param GatewayMacsecPatch gateway_macsec_patch: The MACsec configuration + patch. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse + :rtype: DetailedResponse with `dict` result representing a `GatewayMacsec` object """ - if not gateway_id: - raise ValueError('gateway_id must be provided') if not id: raise ValueError('id must be provided') + if gateway_macsec_patch is None: + raise ValueError('gateway_macsec_patch must be provided') + if isinstance(gateway_macsec_patch, GatewayMacsecPatch): + gateway_macsec_patch = convert_model(gateway_macsec_patch) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_gateway_route_report', + operation_id='update_gateway_macsec', ) headers.update(sdk_headers) @@ -1736,51 +1851,94 @@ def delete_gateway_route_report( 'version': self.version, } + data = json.dumps(gateway_macsec_patch) + headers['content-type'] = 'application/merge-patch+json' + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] + headers['Accept'] = 'application/json' - path_param_keys = ['gateway_id', 'id'] - path_param_values = self.encode_path_vars(gateway_id, id) + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/route_reports/{id}'.format(**path_param_dict) + url = '/gateways/{id}/macsec'.format(**path_param_dict) request = self.prepare_request( - method='DELETE', + method='PATCH', url=url, headers=headers, params=params, + data=data, ) response = self.send(request, **kwargs) return response - def get_gateway_route_report( + def set_gateway_macsec( self, - gateway_id: str, id: str, + active: bool, + caks: List['GatewayMacsecCakPrototype'], + sak_rekey: 'SakRekeyPrototype', + security_policy: str, + *, + window_size: Optional[int] = None, + if_match: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Retrieve route report. + Set MACsec configuration. - Retrieve a route report. + Sets the MACsec configuration on a direct link, enabling the feature. - :param str gateway_id: Direct Link gateway identifier. - :param str id: Route report identifier. + :param str id: Direct Link gateway identifier. + :param bool active: Determines if the MACsec feature should initially be + active (true) or inactive (false) for a gateway. + :param List[GatewayMacsecCakPrototype] caks: List of all connectivity + association keys (CAKs) to be associated associated with the MACsec feature + on a direct link. + There must be at least one CAK with `session`: `primary`. There can be at + most one CAK with `session`: `fallback` + All CAKs must reference a unique key. + :param SakRekeyPrototype sak_rekey: Determines how SAK rekeying occurs. It + is either timer based or based on the amount of used packet numbers. + :param str security_policy: Determines how packets without MACsec headers + are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy + should be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy + should be used to prefer network availability over security. + :param int window_size: (optional) The window size determines the number of + frames in a window for replay protection. + Replay protection is used to counter replay attacks. Frames within a window + size can be out of order and are not replay protected. + :param str if_match: (optional) If present, the request will fail if the + specified ETag value does not match the resource's current ETag value. + `If-Match` is required when the resource exists and has an ETag value. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `RouteReport` object + :rtype: DetailedResponse with `dict` result representing a `GatewayMacsec` object """ - if not gateway_id: - raise ValueError('gateway_id must be provided') if not id: raise ValueError('id must be provided') - headers = {} + if active is None: + raise ValueError('active must be provided') + if caks is None: + raise ValueError('caks must be provided') + if sak_rekey is None: + raise ValueError('sak_rekey must be provided') + if security_policy is None: + raise ValueError('security_policy must be provided') + caks = [convert_model(x) for x in caks] + sak_rekey = convert_model(sak_rekey) + headers = { + 'If-Match': if_match, + } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_gateway_route_report', + operation_id='set_gateway_macsec', ) headers.update(sdk_headers) @@ -1788,54 +1946,60 @@ def get_gateway_route_report( 'version': self.version, } + data = { + 'active': active, + 'caks': caks, + 'sak_rekey': sak_rekey, + 'security_policy': security_policy, + 'window_size': window_size, + } + 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 = ['gateway_id', 'id'] - path_param_values = self.encode_path_vars(gateway_id, id) + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/route_reports/{id}'.format(**path_param_dict) + url = '/gateways/{id}/macsec'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='PUT', url=url, headers=headers, params=params, + data=data, ) response = self.send(request, **kwargs) return response - ######################### - # Virtual Connections - ######################### - - def list_gateway_virtual_connections( + def list_gateway_macsec_caks( self, - gateway_id: str, + id: str, **kwargs, ) -> DetailedResponse: """ - List virtual connections. + List MACsec CAKs. - List a gateway's virtual connections. For gateway in other account with virtual - connections that connect to network in this account. Only virtual connections - that connect to this account are returned. + List the CAKs associated with the MACsec configuration of a direct link. - :param str gateway_id: Direct Link gateway identifier. + :param str id: Direct Link gateway identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `GatewayVirtualConnectionCollection` object + :rtype: DetailedResponse with `dict` result representing a `GatewayMacsecCakCollection` object """ - if not gateway_id: - raise ValueError('gateway_id must be provided') + if not id: + raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_gateway_virtual_connections', + operation_id='list_gateway_macsec_caks', ) headers.update(sdk_headers) @@ -1848,10 +2012,10 @@ def list_gateway_virtual_connections( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['gateway_id'] - path_param_values = self.encode_path_vars(gateway_id) + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/virtual_connections'.format(**path_param_dict) + url = '/gateways/{id}/macsec/caks'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -1862,45 +2026,51 @@ def list_gateway_virtual_connections( response = self.send(request, **kwargs) return response - def create_gateway_virtual_connection( + def create_gateway_macsec_cak( self, - gateway_id: str, + id: str, + key: 'HpcsKeyIdentity', name: str, - type: str, - *, - network_id: str = None, + session: str, **kwargs, ) -> DetailedResponse: """ - Create virtual connection. + Create MACsec CAK. - Create a virtual connection to the specified network. + Creates a CAK associated with the MACsec configuration of a direct link. - :param str gateway_id: Direct Link gateway identifier. - :param str name: The user-defined name for this virtual connection. - Virtual connection names are unique within a gateway. This is the name of - the virtual connection itself, the network being connected may have its own - name attribute. - :param str type: The type of virtual connection. - :param str network_id: (optional) Unique identifier of the target network. - For type=vpc virtual connections this is the CRN of the target VPC. This - field does not apply to type=classic connections. + :param str id: Direct Link gateway identifier. + :param HpcsKeyIdentity key: A [Hyper Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: The name identifies the connectivity association key (CAK) + within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to + 64 inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. + :param str session: The intended session the key will be used to secure. + If the `primary` MACsec session fails due to a key/key name mismatch on the + peers, the `fallback` session can take over. + There must be a `primary` session CAK. A `fallback` CAK is optional. :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 `GatewayVirtualConnection` object + :rtype: DetailedResponse with `dict` result representing a `GatewayMacsecCak` object """ - if not gateway_id: - raise ValueError('gateway_id must be provided') + if not id: + raise ValueError('id must be provided') + if key is None: + raise ValueError('key must be provided') if name is None: raise ValueError('name must be provided') - if type is None: - raise ValueError('type must be provided') + if session is None: + raise ValueError('session must be provided') + key = convert_model(key) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='create_gateway_virtual_connection', + operation_id='create_gateway_macsec_cak', ) headers.update(sdk_headers) @@ -1909,9 +2079,9 @@ def create_gateway_virtual_connection( } data = { + 'key': key, 'name': name, - 'type': type, - 'network_id': network_id, + 'session': session, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -1922,10 +2092,10 @@ def create_gateway_virtual_connection( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['gateway_id'] - path_param_values = self.encode_path_vars(gateway_id) + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/virtual_connections'.format(**path_param_dict) + url = '/gateways/{id}/macsec/caks'.format(**path_param_dict) request = self.prepare_request( method='POST', url=url, @@ -1937,33 +2107,33 @@ def create_gateway_virtual_connection( response = self.send(request, **kwargs) return response - def delete_gateway_virtual_connection( + def delete_gateway_macsec_cak( self, - gateway_id: str, id: str, + cak_id: str, **kwargs, ) -> DetailedResponse: """ - Delete virtual connection. + Delete MACsec CAK. - Delete the virtual connection. + Deletes the CAK from the MACsec configuration of a direct link. - :param str gateway_id: Direct Link gateway identifier. - :param str id: The virtual connection identifier. + :param str id: Direct Link gateway identifier. + :param str cak_id: MACsec CAK identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ - if not gateway_id: - raise ValueError('gateway_id must be provided') if not id: raise ValueError('id must be provided') + if not cak_id: + raise ValueError('cak_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='delete_gateway_virtual_connection', + operation_id='delete_gateway_macsec_cak', ) headers.update(sdk_headers) @@ -1975,10 +2145,10 @@ def delete_gateway_virtual_connection( headers.update(kwargs.get('headers')) del kwargs['headers'] - path_param_keys = ['gateway_id', 'id'] - path_param_values = self.encode_path_vars(gateway_id, id) + path_param_keys = ['id', 'cak_id'] + path_param_values = self.encode_path_vars(id, cak_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/virtual_connections/{id}'.format(**path_param_dict) + url = '/gateways/{id}/macsec/caks/{cak_id}'.format(**path_param_dict) request = self.prepare_request( method='DELETE', url=url, @@ -1989,33 +2159,33 @@ def delete_gateway_virtual_connection( response = self.send(request, **kwargs) return response - def get_gateway_virtual_connection( + def get_gateway_macsec_cak( self, - gateway_id: str, id: str, + cak_id: str, **kwargs, ) -> DetailedResponse: """ - Get virtual connection. + Get MACsec CAK. - Retrieve a virtual connection. + Get a MACsec CAK by its identifier. - :param str gateway_id: Direct Link gateway identifier. - :param str id: The virtual connection identifier. + :param str id: Direct Link gateway identifier. + :param str cak_id: MACsec CAK identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `GatewayVirtualConnection` object + :rtype: DetailedResponse with `dict` result representing a `GatewayMacsecCak` object """ - if not gateway_id: - raise ValueError('gateway_id must be provided') if not id: raise ValueError('id must be provided') + if not cak_id: + raise ValueError('cak_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_gateway_virtual_connection', + operation_id='get_gateway_macsec_cak', ) headers.update(sdk_headers) @@ -2028,10 +2198,10 @@ def get_gateway_virtual_connection( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['gateway_id', 'id'] - path_param_values = self.encode_path_vars(gateway_id, id) + path_param_keys = ['id', 'cak_id'] + path_param_values = self.encode_path_vars(id, cak_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/virtual_connections/{id}'.format(**path_param_dict) + url = '/gateways/{id}/macsec/caks/{cak_id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2042,44 +2212,40 @@ def get_gateway_virtual_connection( response = self.send(request, **kwargs) return response - def update_gateway_virtual_connection( + def update_gateway_macsec_cak( self, - gateway_id: str, id: str, - *, - name: str = None, - status: str = None, + cak_id: str, + gateway_macsec_cak_patch: 'GatewayMacsecCakPatch', **kwargs, ) -> DetailedResponse: """ - Update virtual connection. + Update MACsec CAK. - Update a virtual connection. + Updates the CAK on the MACsec configuration of a direct link. - :param str gateway_id: Direct Link gateway identifier. - :param str id: The virtual connection identifier. - :param str name: (optional) The user-defined name for this virtual - connection. Virtual connection names are unique within a gateway. This is - the name of the virtual connection itself, the network being connected may - have its own name attribute. - :param str status: (optional) Status of the virtual connection. Virtual - connections that span IBM Cloud Accounts are created in approval_pending - status. The owner of the target network can accept or reject connection - requests by patching status to attached or rejected respectively. + :param str id: Direct Link gateway identifier. + :param str cak_id: MACsec CAK identifier. + :param GatewayMacsecCakPatch gateway_macsec_cak_patch: The MACsec CAK + patch. :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 `GatewayVirtualConnection` object + :rtype: DetailedResponse with `dict` result representing a `GatewayMacsecCak` object """ - if not gateway_id: - raise ValueError('gateway_id must be provided') if not id: raise ValueError('id must be provided') + if not cak_id: + raise ValueError('cak_id must be provided') + if gateway_macsec_cak_patch is None: + raise ValueError('gateway_macsec_cak_patch must be provided') + if isinstance(gateway_macsec_cak_patch, GatewayMacsecCakPatch): + gateway_macsec_cak_patch = convert_model(gateway_macsec_cak_patch) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='update_gateway_virtual_connection', + operation_id='update_gateway_macsec_cak', ) headers.update(sdk_headers) @@ -2087,23 +2253,18 @@ def update_gateway_virtual_connection( 'version': self.version, } - data = { - 'name': name, - 'status': status, - } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' + data = json.dumps(gateway_macsec_cak_patch) + headers['content-type'] = 'application/merge-patch+json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['gateway_id', 'id'] - path_param_values = self.encode_path_vars(gateway_id, id) + path_param_keys = ['id', 'cak_id'] + path_param_values = self.encode_path_vars(id, cak_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/virtual_connections/{id}'.format(**path_param_dict) + url = '/gateways/{id}/macsec/caks/{cak_id}'.format(**path_param_dict) request = self.prepare_request( method='PATCH', url=url, @@ -2116,33 +2277,32 @@ def update_gateway_virtual_connection( return response ######################### - # Offering Information + # Gateway Route Reports ######################### - def list_offering_type_locations( + def list_gateway_route_reports( self, - offering_type: str, + gateway_id: str, **kwargs, ) -> DetailedResponse: """ - List available locations. + List route reports. - Retrieve the list of valid locations for the specified Direct Link offering. + Retrieve all route reports for the specified Direct Link gateway. - :param str offering_type: The Direct Link offering type. Current supported - values are `"dedicated"` and `"connect"`. + :param str gateway_id: Direct Link gateway identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LocationCollection` object + :rtype: DetailedResponse with `dict` result representing a `RouteReportCollection` object """ - if not offering_type: - raise ValueError('offering_type must be provided') + if not gateway_id: + raise ValueError('gateway_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_offering_type_locations', + operation_id='list_gateway_route_reports', ) headers.update(sdk_headers) @@ -2155,10 +2315,10 @@ def list_offering_type_locations( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['offering_type'] - path_param_values = self.encode_path_vars(offering_type) + path_param_keys = ['gateway_id'] + path_param_values = self.encode_path_vars(gateway_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/offering_types/{offering_type}/locations'.format(**path_param_dict) + url = '/gateways/{gateway_id}/route_reports'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2169,35 +2329,35 @@ def list_offering_type_locations( response = self.send(request, **kwargs) return response - def list_offering_type_location_cross_connect_routers( + def create_gateway_route_report( self, - offering_type: str, - location_name: str, + gateway_id: str, **kwargs, ) -> DetailedResponse: """ - List routers. + Request a route report. - Retrieve location specific cross connect router information. Only valid for - offering_type=dedicated locations. + Request route report generation. While report generation is in progress, + additional requests to generate a report are ignored and return the current + pending report. While `status` is `pending`, `gateway_routes`, `on_prem_routes`, + `virtual_connection_routes`, and `overlapping_routes` will be empty arrays. These + fields will be filled when the `status` enters the `complete` status. Call + `get_gateway_route_report` with the pending route report's `id` to check on the + current status of the report. - :param str offering_type: The Direct Link offering type. Current supported - values are `"dedicated"` and `"connect"`. - :param str location_name: The name of the Direct Link location. + :param str gateway_id: Direct Link gateway identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `LocationCrossConnectRouterCollection` object + :rtype: DetailedResponse with `dict` result representing a `RouteReport` object """ - if not offering_type: - raise ValueError('offering_type must be provided') - if not location_name: - raise ValueError('location_name must be provided') + if not gateway_id: + raise ValueError('gateway_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_offering_type_location_cross_connect_routers', + operation_id='create_gateway_route_report', ) headers.update(sdk_headers) @@ -2210,12 +2370,12 @@ def list_offering_type_location_cross_connect_routers( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['offering_type', 'location_name'] - path_param_values = self.encode_path_vars(offering_type, location_name) + path_param_keys = ['gateway_id'] + path_param_values = self.encode_path_vars(gateway_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/offering_types/{offering_type}/locations/{location_name}/cross_connect_routers'.format(**path_param_dict) + url = '/gateways/{gateway_id}/route_reports'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='POST', url=url, headers=headers, params=params, @@ -2224,30 +2384,33 @@ def list_offering_type_location_cross_connect_routers( response = self.send(request, **kwargs) return response - def list_offering_type_speeds( + def delete_gateway_route_report( self, - offering_type: str, + gateway_id: str, + id: str, **kwargs, ) -> DetailedResponse: """ - List speed options. + Delete route report. - List the available Direct Link speeds. + Delete a route report. - :param str offering_type: The Direct Link offering type. Current supported - values are `"dedicated"` and `"connect"`. + :param str gateway_id: Direct Link gateway identifier. + :param str id: Route report identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `OfferingSpeedCollection` object + :rtype: DetailedResponse """ - if not offering_type: - raise ValueError('offering_type must be provided') + if not gateway_id: + raise ValueError('gateway_id must be provided') + if not id: + raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_offering_type_speeds', + operation_id='delete_gateway_route_report', ) headers.update(sdk_headers) @@ -2258,14 +2421,13 @@ def list_offering_type_speeds( if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] - headers['Accept'] = 'application/json' - path_param_keys = ['offering_type'] - path_param_values = self.encode_path_vars(offering_type) + path_param_keys = ['gateway_id', 'id'] + path_param_values = self.encode_path_vars(gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/offering_types/{offering_type}/speeds'.format(**path_param_dict) + url = '/gateways/{gateway_id}/route_reports/{id}'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='DELETE', url=url, headers=headers, params=params, @@ -2274,46 +2436,38 @@ def list_offering_type_speeds( response = self.send(request, **kwargs) return response - ######################### - # Ports - ######################### - - def list_ports( + def get_gateway_route_report( self, - *, - start: str = None, - limit: int = None, - location_name: str = None, + gateway_id: str, + id: str, **kwargs, ) -> DetailedResponse: """ - List ports. + Retrieve route report. - Retrieve list of available Direct Link connect ports. These ports can be used to - create Direct Link connect gateways. + Retrieve a route report. - :param str start: (optional) A server-supplied token determining which - resource to start the page on. - :param int limit: (optional) The number of resources to return on a page. - :param str location_name: (optional) Direct Link location short name. + :param str gateway_id: Direct Link gateway identifier. + :param str id: Route report identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `PortCollection` object + :rtype: DetailedResponse with `dict` result representing a `RouteReport` object """ + if not gateway_id: + raise ValueError('gateway_id must be provided') + if not id: + raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_ports', + operation_id='get_gateway_route_report', ) headers.update(sdk_headers) params = { 'version': self.version, - 'start': start, - 'limit': limit, - 'location_name': location_name, } if 'headers' in kwargs: @@ -2321,7 +2475,10 @@ def list_ports( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/ports' + path_param_keys = ['gateway_id', 'id'] + path_param_values = self.encode_path_vars(gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/route_reports/{id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2332,29 +2489,35 @@ def list_ports( response = self.send(request, **kwargs) return response - def get_port( + ######################### + # Virtual Connections + ######################### + + def list_gateway_virtual_connections( self, - id: str, + gateway_id: str, **kwargs, ) -> DetailedResponse: """ - Get port. + List virtual connections. - Retrieve Direct Link Connect provider port. + List a gateway's virtual connections. For gateway in other account with virtual + connections that connect to network in this account. Only virtual connections + that connect to this account are returned. - :param str id: The port identifier. + :param str gateway_id: Direct Link gateway identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `Port` object + :rtype: DetailedResponse with `dict` result representing a `GatewayVirtualConnectionCollection` object """ - if not id: - raise ValueError('id must be provided') + if not gateway_id: + raise ValueError('gateway_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='get_port', + operation_id='list_gateway_virtual_connections', ) headers.update(sdk_headers) @@ -2367,10 +2530,10 @@ def get_port( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['id'] - path_param_values = self.encode_path_vars(id) + path_param_keys = ['gateway_id'] + path_param_values = self.encode_path_vars(gateway_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/ports/{id}'.format(**path_param_dict) + url = '/gateways/{gateway_id}/virtual_connections'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2381,33 +2544,45 @@ def get_port( response = self.send(request, **kwargs) return response - ######################### - # gatewayASPrepends - ######################### - - def list_gateway_as_prepends( + def create_gateway_virtual_connection( self, gateway_id: str, + name: str, + type: str, + *, + network_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - List AS Prepends. + Create virtual connection. - Retrieve all AS Prepends for the specified Direct Link gateway. + Create a virtual connection to the specified network. :param str gateway_id: Direct Link gateway identifier. + :param str name: The user-defined name for this virtual connection. + Virtual connection names are unique within a gateway. This is the name of + the virtual connection itself, the network being connected may have its own + name attribute. + :param str type: The type of virtual connection. + :param str network_id: (optional) Unique identifier of the target network. + For type=vpc virtual connections this is the CRN of the target VPC. This + field does not apply to type=classic connections. :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 `AsPrependCollection` object + :rtype: DetailedResponse with `dict` result representing a `GatewayVirtualConnection` object """ if not gateway_id: raise ValueError('gateway_id must be provided') + if name is None: + raise ValueError('name must be provided') + if type is None: + raise ValueError('type must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='list_gateway_as_prepends', + operation_id='create_gateway_virtual_connection', ) headers.update(sdk_headers) @@ -2415,6 +2590,15 @@ def list_gateway_as_prepends( 'version': self.version, } + data = { + 'name': name, + 'type': type, + 'network_id': network_id, + } + 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'] @@ -2423,54 +2607,45 @@ def list_gateway_as_prepends( path_param_keys = ['gateway_id'] path_param_values = self.encode_path_vars(gateway_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/as_prepends'.format(**path_param_dict) + url = '/gateways/{gateway_id}/virtual_connections'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='POST', url=url, headers=headers, params=params, + data=data, ) response = self.send(request, **kwargs) return response - def replace_gateway_as_prepends( + def delete_gateway_virtual_connection( self, gateway_id: str, - if_match: str, - *, - as_prepends: List['AsPrependPrefixArrayTemplate'] = None, + id: str, **kwargs, ) -> DetailedResponse: """ - Replace existing AS Prepends. + Delete virtual connection. - Replace the given set of AS prepends on the specified gateway. Existing resources - may be reused when the individual AS Prepend item is unchanged. + Delete the virtual connection. :param str gateway_id: Direct Link gateway identifier. - :param str if_match: If present, the request will fail if the specified - ETag value does not match the resource's current ETag value. - :param List[AsPrependPrefixArrayTemplate] as_prepends: (optional) array of - AS Prepend configuration information. + :param str id: The virtual connection identifier. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse with `dict` result representing a `AsPrependCollection` object + :rtype: DetailedResponse """ if not gateway_id: raise ValueError('gateway_id must be provided') - if not if_match: - raise ValueError('if_match must be provided') - if as_prepends is not None: - as_prepends = [convert_model(x) for x in as_prepends] - headers = { - 'If-Match': if_match, - } + if not id: + raise ValueError('id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', - operation_id='replace_gateway_as_prepends', + operation_id='delete_gateway_virtual_connection', ) headers.update(sdk_headers) @@ -2478,336 +2653,522 @@ def replace_gateway_as_prepends( 'version': self.version, } - data = { - 'as_prepends': as_prepends, - } - 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 = ['gateway_id'] - path_param_values = self.encode_path_vars(gateway_id) + path_param_keys = ['gateway_id', 'id'] + path_param_values = self.encode_path_vars(gateway_id, id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/gateways/{gateway_id}/as_prepends'.format(**path_param_dict) + url = '/gateways/{gateway_id}/virtual_connections/{id}'.format(**path_param_dict) request = self.prepare_request( - method='PUT', + method='DELETE', url=url, headers=headers, params=params, - data=data, ) response = self.send(request, **kwargs) return response + def get_gateway_virtual_connection( + self, + gateway_id: str, + id: str, + **kwargs, + ) -> DetailedResponse: + """ + Get virtual connection. -class GetGatewayStatisticsEnums: - """ - Enums for get_gateway_statistics parameters. - """ + Retrieve a virtual connection. - class Type(str, Enum): - """ - Specify statistic to retrieve. + :param str gateway_id: Direct Link gateway identifier. + :param str id: The virtual connection identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `GatewayVirtualConnection` object """ - MACSEC_MKA_SESSION = 'macsec_mka_session' - MACSEC_POLICY = 'macsec_policy' - MACSEC_MKA_STATISTICS = 'macsec_mka_statistics' - BFD_SESSION = 'bfd_session' + if not gateway_id: + raise ValueError('gateway_id must be provided') + if not id: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_gateway_virtual_connection', + ) + headers.update(sdk_headers) + params = { + 'version': self.version, + } -class GetGatewayStatusEnums: - """ - Enums for get_gateway_status parameters. - """ + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' - class Type(str, Enum): - """ - Specify status to retrieve. - """ + path_param_keys = ['gateway_id', 'id'] + path_param_values = self.encode_path_vars(gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/virtual_connections/{id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) - BGP = 'bgp' - BFD = 'bfd' - LINK = 'link' + response = self.send(request, **kwargs) + return response + def update_gateway_virtual_connection( + self, + gateway_id: str, + id: str, + gateway_virtual_connection_patch_template: 'GatewayVirtualConnectionPatchTemplate', + **kwargs, + ) -> DetailedResponse: + """ + Update virtual connection. -class ListOfferingTypeLocationsEnums: - """ - Enums for list_offering_type_locations parameters. - """ + Update a virtual connection. - class OfferingType(str, Enum): - """ - The Direct Link offering type. Current supported values are `"dedicated"` and - `"connect"`. + :param str gateway_id: Direct Link gateway identifier. + :param str id: The virtual connection identifier. + :param GatewayVirtualConnectionPatchTemplate + gateway_virtual_connection_patch_template: The virtual connection patch + template. + :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 `GatewayVirtualConnection` object """ - DEDICATED = 'dedicated' - CONNECT = 'connect' + if not gateway_id: + raise ValueError('gateway_id must be provided') + if not id: + raise ValueError('id must be provided') + if gateway_virtual_connection_patch_template is None: + raise ValueError('gateway_virtual_connection_patch_template must be provided') + if isinstance(gateway_virtual_connection_patch_template, GatewayVirtualConnectionPatchTemplate): + gateway_virtual_connection_patch_template = convert_model(gateway_virtual_connection_patch_template) + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='update_gateway_virtual_connection', + ) + headers.update(sdk_headers) + params = { + 'version': self.version, + } -class ListOfferingTypeLocationCrossConnectRoutersEnums: - """ - Enums for list_offering_type_location_cross_connect_routers parameters. - """ + data = json.dumps(gateway_virtual_connection_patch_template) + headers['content-type'] = 'application/merge-patch+json' - class OfferingType(str, Enum): - """ - The Direct Link offering type. Current supported values are `"dedicated"` and - `"connect"`. - """ + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' - DEDICATED = 'dedicated' - CONNECT = 'connect' + path_param_keys = ['gateway_id', 'id'] + path_param_values = self.encode_path_vars(gateway_id, id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/gateways/{gateway_id}/virtual_connections/{id}'.format(**path_param_dict) + request = self.prepare_request( + method='PATCH', + url=url, + headers=headers, + params=params, + data=data, + ) + response = self.send(request, **kwargs) + return response -class ListOfferingTypeSpeedsEnums: - """ - Enums for list_offering_type_speeds parameters. - """ + ######################### + # Offering Information + ######################### - class OfferingType(str, Enum): - """ - The Direct Link offering type. Current supported values are `"dedicated"` and - `"connect"`. + def list_offering_type_locations( + self, + offering_type: str, + **kwargs, + ) -> DetailedResponse: """ + List available locations. - DEDICATED = 'dedicated' - CONNECT = 'connect' + Retrieve the list of valid locations for the specified Direct Link offering. + :param str offering_type: The Direct Link offering type. Current supported + values are `"dedicated"` and `"connect"`. + :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 `LocationCollection` object + """ -############################################################################## -# Models -############################################################################## + if not offering_type: + raise ValueError('offering_type must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_offering_type_locations', + ) + headers.update(sdk_headers) + params = { + 'version': self.version, + } -class AsPrepend: - """ - Gateway AS Prepend object. + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' - :attr datetime created_at: (optional) The date and time resource was created. - :attr str id: (optional) The unique identifier for this AS Prepend. - :attr int length: (optional) Number of times the ASN to appended to the AS Path. - :attr str policy: (optional) Route type this AS Prepend applies to. - :attr str prefix: (optional) Deprecated: Comma separated list of prefixes this - AS Prepend applies to. If empty, this applies to all prefixes. - :attr List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend - applies to. This parameter is not returned when AS Prepend applies to all - prefixes. Note that ordering is not significant and may differ from request - order. - :attr datetime updated_at: (optional) The date and time resource was last - updated. - """ + path_param_keys = ['offering_type'] + path_param_values = self.encode_path_vars(offering_type) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/offering_types/{offering_type}/locations'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) - def __init__( + response = self.send(request, **kwargs) + return response + + def list_offering_type_location_cross_connect_routers( self, - *, - created_at: datetime = None, - id: str = None, - length: int = None, - policy: str = None, - prefix: str = None, - specific_prefixes: List[str] = None, - updated_at: datetime = None, - ) -> None: + offering_type: str, + location_name: str, + **kwargs, + ) -> DetailedResponse: """ - Initialize a AsPrepend object. + List routers. - :param datetime created_at: (optional) The date and time resource was - created. - :param str id: (optional) The unique identifier for this AS Prepend. - :param int length: (optional) Number of times the ASN to appended to the AS - Path. - :param str policy: (optional) Route type this AS Prepend applies to. - :param str prefix: (optional) Deprecated: Comma separated list of prefixes - this AS Prepend applies to. If empty, this applies to all prefixes. - :param List[str] specific_prefixes: (optional) Array of prefixes this AS - Prepend applies to. This parameter is not returned when AS Prepend applies - to all prefixes. Note that ordering is not significant and may differ from - request order. - :param datetime updated_at: (optional) The date and time resource was last - updated. + Retrieve location specific cross connect router information. Only valid for + offering_type=dedicated locations. + + :param str offering_type: The Direct Link offering type. Current supported + values are `"dedicated"` and `"connect"`. + :param str location_name: The name of the Direct Link location. + :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 `LocationCrossConnectRouterCollection` object """ - self.created_at = created_at - self.id = id - self.length = length - self.policy = policy - self.prefix = prefix - self.specific_prefixes = specific_prefixes - self.updated_at = updated_at - @classmethod - def from_dict(cls, _dict: Dict) -> 'AsPrepend': - """Initialize a AsPrepend object from a json dictionary.""" - args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'length' in _dict: - args['length'] = _dict.get('length') - if 'policy' in _dict: - args['policy'] = _dict.get('policy') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') - if 'specific_prefixes' in _dict: - args['specific_prefixes'] = _dict.get('specific_prefixes') - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) - return cls(**args) + if not offering_type: + raise ValueError('offering_type must be provided') + if not location_name: + raise ValueError('location_name must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_offering_type_location_cross_connect_routers', + ) + headers.update(sdk_headers) - @classmethod - def _from_dict(cls, _dict): - """Initialize a AsPrepend object from a json dictionary.""" - return cls.from_dict(_dict) + params = { + 'version': self.version, + } - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'length') and self.length is not None: - _dict['length'] = self.length - if hasattr(self, 'policy') and self.policy is not None: - _dict['policy'] = self.policy - if hasattr(self, 'prefix') and self.prefix is not None: - _dict['prefix'] = self.prefix - if hasattr(self, 'specific_prefixes') and self.specific_prefixes is not None: - _dict['specific_prefixes'] = self.specific_prefixes - if hasattr(self, 'updated_at') and self.updated_at is not None: - _dict['updated_at'] = datetime_to_string(self.updated_at) - return _dict + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + path_param_keys = ['offering_type', 'location_name'] + path_param_values = self.encode_path_vars(offering_type, location_name) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/offering_types/{offering_type}/locations/{location_name}/cross_connect_routers'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) - def __str__(self) -> str: - """Return a `str` version of this AsPrepend object.""" - return json.dumps(self.to_dict(), indent=2) + response = self.send(request, **kwargs) + return response - def __eq__(self, other: 'AsPrepend') -> 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 list_offering_type_speeds( + self, + offering_type: str, + **kwargs, + ) -> DetailedResponse: + """ + List speed options. - def __ne__(self, other: 'AsPrepend') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + List the available Direct Link speeds. - class PolicyEnum(str, Enum): - """ - Route type this AS Prepend applies to. + :param str offering_type: The Direct Link offering type. Current supported + values are `"dedicated"` and `"connect"`. + :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 `OfferingSpeedCollection` object """ - IMPORT = 'import' - EXPORT = 'export' + if not offering_type: + raise ValueError('offering_type must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_offering_type_speeds', + ) + headers.update(sdk_headers) + params = { + 'version': self.version, + } + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' -class AsPrependCollection: - """ - array of AS Prepends. + path_param_keys = ['offering_type'] + path_param_values = self.encode_path_vars(offering_type) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/offering_types/{offering_type}/speeds'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) - :attr List[AsPrependEntry] as_prepends: (optional) array of AS Prepend - information. - """ + response = self.send(request, **kwargs) + return response - def __init__( + ######################### + # Ports + ######################### + + def list_ports( self, *, - as_prepends: List['AsPrependEntry'] = None, - ) -> None: - """ - Initialize a AsPrependCollection object. - - :param List[AsPrependEntry] as_prepends: (optional) array of AS Prepend - information. + start: Optional[str] = None, + limit: Optional[int] = None, + location_name: Optional[str] = None, + **kwargs, + ) -> DetailedResponse: """ - self.as_prepends = as_prepends + List ports. - @classmethod - def from_dict(cls, _dict: Dict) -> 'AsPrependCollection': - """Initialize a AsPrependCollection object from a json dictionary.""" - args = {} - if 'as_prepends' in _dict: - args['as_prepends'] = [AsPrependEntry.from_dict(v) for v in _dict.get('as_prepends')] - return cls(**args) + Retrieve list of available Direct Link connect ports. These ports can be used to + create Direct Link connect gateways. - @classmethod - def _from_dict(cls, _dict): - """Initialize a AsPrependCollection object from a json dictionary.""" - return cls.from_dict(_dict) + :param str start: (optional) A server-supplied token determining which + resource to start the page on. + :param int limit: (optional) The number of resources to return on a page. + :param str location_name: (optional) Direct Link location short name. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `PortCollection` object + """ - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'as_prepends') and self.as_prepends is not None: - as_prepends_list = [] - for v in self.as_prepends: - if isinstance(v, dict): - as_prepends_list.append(v) - else: - as_prepends_list.append(v.to_dict()) - _dict['as_prepends'] = as_prepends_list - return _dict + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='list_ports', + ) + headers.update(sdk_headers) - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + params = { + 'version': self.version, + 'start': start, + 'limit': limit, + 'location_name': location_name, + } - def __str__(self) -> str: - """Return a `str` version of this AsPrependCollection object.""" - return json.dumps(self.to_dict(), indent=2) + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' - def __eq__(self, other: 'AsPrependCollection') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + url = '/ports' + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) - def __ne__(self, other: 'AsPrependCollection') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + response = self.send(request, **kwargs) + return response + + def get_port( + self, + id: str, + **kwargs, + ) -> DetailedResponse: + """ + Get port. + Retrieve Direct Link Connect provider port. -class AsPrependEntry: + :param str id: The port identifier. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse with `dict` result representing a `Port` object + """ + + if not id: + raise ValueError('id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V1', + operation_id='get_port', + ) + headers.update(sdk_headers) + + params = { + 'version': self.version, + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['id'] + path_param_values = self.encode_path_vars(id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/ports/{id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) + + response = self.send(request, **kwargs) + return response + + +class GetGatewayStatisticsEnums: """ - AS Prepends API object. + Enums for get_gateway_statistics parameters. + """ + + class Type(str, Enum): + """ + Specify statistic to retrieve. + """ + + MACSEC_MKA_SESSION = 'macsec_mka_session' + MACSEC_POLICY = 'macsec_policy' + MACSEC_MKA_STATISTICS = 'macsec_mka_statistics' + BFD_SESSION = 'bfd_session' + + +class GetGatewayStatusEnums: + """ + Enums for get_gateway_status parameters. + """ + + class Type(str, Enum): + """ + Specify status to retrieve. + """ + + BGP = 'bgp' + BFD = 'bfd' + LINK = 'link' + + +class ListOfferingTypeLocationsEnums: + """ + Enums for list_offering_type_locations parameters. + """ + + class OfferingType(str, Enum): + """ + The Direct Link offering type. Current supported values are `"dedicated"` and + `"connect"`. + """ + + DEDICATED = 'dedicated' + CONNECT = 'connect' + + +class ListOfferingTypeLocationCrossConnectRoutersEnums: + """ + Enums for list_offering_type_location_cross_connect_routers parameters. + """ + + class OfferingType(str, Enum): + """ + The Direct Link offering type. Current supported values are `"dedicated"` and + `"connect"`. + """ + + DEDICATED = 'dedicated' + CONNECT = 'connect' + + +class ListOfferingTypeSpeedsEnums: + """ + Enums for list_offering_type_speeds parameters. + """ + + class OfferingType(str, Enum): + """ + The Direct Link offering type. Current supported values are `"dedicated"` and + `"connect"`. + """ + + DEDICATED = 'dedicated' + CONNECT = 'connect' + + +############################################################################## +# Models +############################################################################## + + +class AsPrepend: + """ + Gateway AS Prepend object. - :attr datetime created_at: (optional) The date and time resource was created. - :attr str id: (optional) The unique identifier for this AS Prepend. - :attr int length: (optional) Number of times the ASN to appended to the AS Path. - :attr str policy: (optional) Route type this AS Prepend applies to. - :attr List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend + :param datetime created_at: (optional) The date and time resource was created. + :param str id: (optional) The unique identifier for this AS Prepend. + :param int length: (optional) Number of times the ASN to appended to the AS + Path. + :param str policy: (optional) Route type this AS Prepend applies to. + :param str prefix: (optional) Deprecated: Comma separated list of prefixes this + AS Prepend applies to. If empty, this applies to all prefixes. + :param List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend applies to. This parameter is not returned when AS Prepend applies to all prefixes. Note that ordering is not significant and may differ from request order. - :attr datetime updated_at: (optional) The date and time resource was last + :param datetime updated_at: (optional) The date and time resource was last updated. """ def __init__( self, *, - created_at: datetime = None, - id: str = None, - length: int = None, - policy: str = None, - specific_prefixes: List[str] = None, - updated_at: datetime = None, + created_at: Optional[datetime] = None, + id: Optional[str] = None, + length: Optional[int] = None, + policy: Optional[str] = None, + prefix: Optional[str] = None, + specific_prefixes: Optional[List[str]] = None, + updated_at: Optional[datetime] = None, ) -> None: """ - Initialize a AsPrependEntry object. + Initialize a AsPrepend object. :param datetime created_at: (optional) The date and time resource was created. @@ -2815,6 +3176,8 @@ def __init__( :param int length: (optional) Number of times the ASN to appended to the AS Path. :param str policy: (optional) Route type this AS Prepend applies to. + :param str prefix: (optional) Deprecated: Comma separated list of prefixes + this AS Prepend applies to. If empty, this applies to all prefixes. :param List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend applies to. This parameter is not returned when AS Prepend applies to all prefixes. Note that ordering is not significant and may differ from @@ -2826,30 +3189,33 @@ def __init__( self.id = id self.length = length self.policy = policy + self.prefix = prefix self.specific_prefixes = specific_prefixes self.updated_at = updated_at @classmethod - def from_dict(cls, _dict: Dict) -> 'AsPrependEntry': - """Initialize a AsPrependEntry object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'AsPrepend': + """Initialize a AsPrepend object from a json dictionary.""" args = {} - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'length' in _dict: - args['length'] = _dict.get('length') - if 'policy' in _dict: - args['policy'] = _dict.get('policy') - if 'specific_prefixes' in _dict: - args['specific_prefixes'] = _dict.get('specific_prefixes') - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) + if (id := _dict.get('id')) is not None: + args['id'] = id + if (length := _dict.get('length')) is not None: + args['length'] = length + if (policy := _dict.get('policy')) is not None: + args['policy'] = policy + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix + if (specific_prefixes := _dict.get('specific_prefixes')) is not None: + args['specific_prefixes'] = specific_prefixes + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AsPrependEntry object from a json dictionary.""" + """Initialize a AsPrepend object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -2863,6 +3229,8 @@ def to_dict(self) -> Dict: _dict['length'] = self.length if hasattr(self, 'policy') and self.policy is not None: _dict['policy'] = self.policy + if hasattr(self, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix if hasattr(self, 'specific_prefixes') and self.specific_prefixes is not None: _dict['specific_prefixes'] = self.specific_prefixes if hasattr(self, 'updated_at') and self.updated_at is not None: @@ -2874,16 +3242,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AsPrependEntry object.""" + """Return a `str` version of this AsPrepend object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AsPrependEntry') -> bool: + def __eq__(self, other: 'AsPrepend') -> 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: 'AsPrependEntry') -> bool: + def __ne__(self, other: 'AsPrepend') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -2897,68 +3265,51 @@ class PolicyEnum(str, Enum): -class AsPrependPrefixArrayTemplate: +class AsPrependCollection: """ - Create AS Prepend Configuration template. + array of AS Prepends. - :attr int length: Number of times the ASN to be prepended to the AS Path. - :attr str policy: Route type this AS Prepend applies to. - :attr List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend - applies to. If this property is absent, the AS Prepend applies to all prefixes. - Note that ordering is not significant and may differ from request order. + :param List[AsPrependEntry] as_prepends: (optional) array of AS Prepend + information. """ def __init__( self, - length: int, - policy: str, *, - specific_prefixes: List[str] = None, + as_prepends: Optional[List['AsPrependEntry']] = None, ) -> None: """ - Initialize a AsPrependPrefixArrayTemplate object. + Initialize a AsPrependCollection object. - :param int length: Number of times the ASN to be prepended to the AS Path. - :param str policy: Route type this AS Prepend applies to. - :param List[str] specific_prefixes: (optional) Array of prefixes this AS - Prepend applies to. If this property is absent, the AS Prepend applies to - all prefixes. Note that ordering is not significant and may differ from - request order. + :param List[AsPrependEntry] as_prepends: (optional) array of AS Prepend + information. """ - self.length = length - self.policy = policy - self.specific_prefixes = specific_prefixes + self.as_prepends = as_prepends @classmethod - def from_dict(cls, _dict: Dict) -> 'AsPrependPrefixArrayTemplate': - """Initialize a AsPrependPrefixArrayTemplate object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'AsPrependCollection': + """Initialize a AsPrependCollection object from a json dictionary.""" args = {} - if 'length' in _dict: - args['length'] = _dict.get('length') - else: - raise ValueError('Required property \'length\' not present in AsPrependPrefixArrayTemplate JSON') - if 'policy' in _dict: - args['policy'] = _dict.get('policy') - else: - raise ValueError('Required property \'policy\' not present in AsPrependPrefixArrayTemplate JSON') - if 'specific_prefixes' in _dict: - args['specific_prefixes'] = _dict.get('specific_prefixes') + if (as_prepends := _dict.get('as_prepends')) is not None: + args['as_prepends'] = [AsPrependEntry.from_dict(v) for v in as_prepends] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AsPrependPrefixArrayTemplate object from a json dictionary.""" + """Initialize a AsPrependCollection 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, 'length') and self.length is not None: - _dict['length'] = self.length - if hasattr(self, 'policy') and self.policy is not None: - _dict['policy'] = self.policy - if hasattr(self, 'specific_prefixes') and self.specific_prefixes is not None: - _dict['specific_prefixes'] = self.specific_prefixes + if hasattr(self, 'as_prepends') and self.as_prepends is not None: + as_prepends_list = [] + for v in self.as_prepends: + if isinstance(v, dict): + as_prepends_list.append(v) + else: + as_prepends_list.append(v.to_dict()) + _dict['as_prepends'] = as_prepends_list return _dict def _to_dict(self): @@ -2966,88 +3317,189 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AsPrependPrefixArrayTemplate object.""" + """Return a `str` version of this AsPrependCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AsPrependPrefixArrayTemplate') -> bool: + def __eq__(self, other: 'AsPrependCollection') -> 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: 'AsPrependPrefixArrayTemplate') -> bool: + def __ne__(self, other: 'AsPrependCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class PolicyEnum(str, Enum): - """ - Route type this AS Prepend applies to. - """ - - IMPORT = 'import' - EXPORT = 'export' - - -class AsPrependTemplate: +class AsPrependEntry: """ - Create AS Prepend Configuration template. + AS Prepends API object. - :attr int length: Number of times the ASN to be prepended to the AS Path. - :attr str policy: Route type this AS Prepend applies to. - :attr str prefix: (optional) Deprecated: Comma separated list of prefixes this - AS Prepend applies to. Maximum of 10 prefixes. If not specified, this AS - Prepend applies to all prefixes. - :attr List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend - applies to. If this property is absent, the AS Prepend applies to all prefixes. + :param datetime created_at: (optional) The date and time resource was created. + :param str id: (optional) The unique identifier for this AS Prepend. + :param int length: (optional) Number of times the ASN to appended to the AS + Path. + :param str policy: (optional) Route type this AS Prepend applies to. + :param List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend + applies to. This parameter is not returned when AS Prepend applies to all + prefixes. Note that ordering is not significant and may differ from request + order. + :param datetime updated_at: (optional) The date and time resource was last + updated. """ def __init__( self, - length: int, - policy: str, *, - prefix: str = None, - specific_prefixes: List[str] = None, + created_at: Optional[datetime] = None, + id: Optional[str] = None, + length: Optional[int] = None, + policy: Optional[str] = None, + specific_prefixes: Optional[List[str]] = None, + updated_at: Optional[datetime] = None, ) -> None: """ - Initialize a AsPrependTemplate object. + Initialize a AsPrependEntry object. - :param int length: Number of times the ASN to be prepended to the AS Path. - :param str policy: Route type this AS Prepend applies to. - :param str prefix: (optional) Deprecated: Comma separated list of prefixes - this AS Prepend applies to. Maximum of 10 prefixes. If not specified, - this AS Prepend applies to all prefixes. - :param List[str] specific_prefixes: (optional) Array of prefixes this AS - Prepend applies to. If this property is absent, the AS Prepend applies to - all prefixes. + :param datetime created_at: (optional) The date and time resource was + created. + :param str id: (optional) The unique identifier for this AS Prepend. + :param int length: (optional) Number of times the ASN to appended to the AS + Path. + :param str policy: (optional) Route type this AS Prepend applies to. + :param List[str] specific_prefixes: (optional) Array of prefixes this AS + Prepend applies to. This parameter is not returned when AS Prepend applies + to all prefixes. Note that ordering is not significant and may differ from + request order. + :param datetime updated_at: (optional) The date and time resource was last + updated. """ + self.created_at = created_at + self.id = id self.length = length self.policy = policy - self.prefix = prefix self.specific_prefixes = specific_prefixes + self.updated_at = updated_at @classmethod - def from_dict(cls, _dict: Dict) -> 'AsPrependTemplate': - """Initialize a AsPrependTemplate object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'AsPrependEntry': + """Initialize a AsPrependEntry object from a json dictionary.""" + args = {} + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) + if (id := _dict.get('id')) is not None: + args['id'] = id + if (length := _dict.get('length')) is not None: + args['length'] = length + if (policy := _dict.get('policy')) is not None: + args['policy'] = policy + if (specific_prefixes := _dict.get('specific_prefixes')) is not None: + args['specific_prefixes'] = specific_prefixes + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AsPrependEntry 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, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'length') and self.length is not None: + _dict['length'] = self.length + if hasattr(self, 'policy') and self.policy is not None: + _dict['policy'] = self.policy + if hasattr(self, 'specific_prefixes') and self.specific_prefixes is not None: + _dict['specific_prefixes'] = self.specific_prefixes + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) + 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 AsPrependEntry object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AsPrependEntry') -> 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: 'AsPrependEntry') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class PolicyEnum(str, Enum): + """ + Route type this AS Prepend applies to. + """ + + IMPORT = 'import' + EXPORT = 'export' + + + +class AsPrependPrefixArrayTemplate: + """ + Create AS Prepend Configuration template. + + :param int length: Number of times the ASN to be prepended to the AS Path. + :param str policy: Route type this AS Prepend applies to. + :param List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend + applies to. If this property is absent, the AS Prepend applies to all prefixes. + Note that ordering is not significant and may differ from request order. + """ + + def __init__( + self, + length: int, + policy: str, + *, + specific_prefixes: Optional[List[str]] = None, + ) -> None: + """ + Initialize a AsPrependPrefixArrayTemplate object. + + :param int length: Number of times the ASN to be prepended to the AS Path. + :param str policy: Route type this AS Prepend applies to. + :param List[str] specific_prefixes: (optional) Array of prefixes this AS + Prepend applies to. If this property is absent, the AS Prepend applies to + all prefixes. Note that ordering is not significant and may differ from + request order. + """ + self.length = length + self.policy = policy + self.specific_prefixes = specific_prefixes + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AsPrependPrefixArrayTemplate': + """Initialize a AsPrependPrefixArrayTemplate object from a json dictionary.""" args = {} - if 'length' in _dict: - args['length'] = _dict.get('length') + if (length := _dict.get('length')) is not None: + args['length'] = length else: - raise ValueError('Required property \'length\' not present in AsPrependTemplate JSON') - if 'policy' in _dict: - args['policy'] = _dict.get('policy') + raise ValueError('Required property \'length\' not present in AsPrependPrefixArrayTemplate JSON') + if (policy := _dict.get('policy')) is not None: + args['policy'] = policy else: - raise ValueError('Required property \'policy\' not present in AsPrependTemplate JSON') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') - if 'specific_prefixes' in _dict: - args['specific_prefixes'] = _dict.get('specific_prefixes') + raise ValueError('Required property \'policy\' not present in AsPrependPrefixArrayTemplate JSON') + if (specific_prefixes := _dict.get('specific_prefixes')) is not None: + args['specific_prefixes'] = specific_prefixes return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AsPrependTemplate object from a json dictionary.""" + """Initialize a AsPrependPrefixArrayTemplate object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -3057,8 +3509,6 @@ def to_dict(self) -> Dict: _dict['length'] = self.length if hasattr(self, 'policy') and self.policy is not None: _dict['policy'] = self.policy - if hasattr(self, 'prefix') and self.prefix is not None: - _dict['prefix'] = self.prefix if hasattr(self, 'specific_prefixes') and self.specific_prefixes is not None: _dict['specific_prefixes'] = self.specific_prefixes return _dict @@ -3068,16 +3518,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AsPrependTemplate object.""" + """Return a `str` version of this AsPrependPrefixArrayTemplate object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AsPrependTemplate') -> bool: + def __eq__(self, other: 'AsPrependPrefixArrayTemplate') -> 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: 'AsPrependTemplate') -> bool: + def __ne__(self, other: 'AsPrependPrefixArrayTemplate') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -3091,44 +3541,78 @@ class PolicyEnum(str, Enum): -class CrossAccountGatewayPort: +class AsPrependTemplate: """ - gateway port for type=connect gateways. + Create AS Prepend Configuration template. - :attr str id: Port Identifier. + :param int length: Number of times the ASN to be prepended to the AS Path. + :param str policy: Route type this AS Prepend applies to. + :param str prefix: (optional) Deprecated: Comma separated list of prefixes this + AS Prepend applies to. Maximum of 10 prefixes. If not specified, this AS + Prepend applies to all prefixes. + :param List[str] specific_prefixes: (optional) Array of prefixes this AS Prepend + applies to. If this property is absent, the AS Prepend applies to all prefixes. """ def __init__( self, - id: str, + length: int, + policy: str, + *, + prefix: Optional[str] = None, + specific_prefixes: Optional[List[str]] = None, ) -> None: """ - Initialize a CrossAccountGatewayPort object. + Initialize a AsPrependTemplate object. - :param str id: Port Identifier. + :param int length: Number of times the ASN to be prepended to the AS Path. + :param str policy: Route type this AS Prepend applies to. + :param str prefix: (optional) Deprecated: Comma separated list of prefixes + this AS Prepend applies to. Maximum of 10 prefixes. If not specified, + this AS Prepend applies to all prefixes. + :param List[str] specific_prefixes: (optional) Array of prefixes this AS + Prepend applies to. If this property is absent, the AS Prepend applies to + all prefixes. """ - self.id = id + self.length = length + self.policy = policy + self.prefix = prefix + self.specific_prefixes = specific_prefixes @classmethod - def from_dict(cls, _dict: Dict) -> 'CrossAccountGatewayPort': - """Initialize a CrossAccountGatewayPort object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'AsPrependTemplate': + """Initialize a AsPrependTemplate object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') + if (length := _dict.get('length')) is not None: + args['length'] = length else: - raise ValueError('Required property \'id\' not present in CrossAccountGatewayPort JSON') + raise ValueError('Required property \'length\' not present in AsPrependTemplate JSON') + if (policy := _dict.get('policy')) is not None: + args['policy'] = policy + else: + raise ValueError('Required property \'policy\' not present in AsPrependTemplate JSON') + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix + if (specific_prefixes := _dict.get('specific_prefixes')) is not None: + args['specific_prefixes'] = specific_prefixes return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a CrossAccountGatewayPort object from a json dictionary.""" + """Initialize a AsPrependTemplate 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, 'id') and self.id is not None: - _dict['id'] = self.id + if hasattr(self, 'length') and self.length is not None: + _dict['length'] = self.length + if hasattr(self, 'policy') and self.policy is not None: + _dict['policy'] = self.policy + if hasattr(self, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix + if hasattr(self, 'specific_prefixes') and self.specific_prefixes is not None: + _dict['specific_prefixes'] = self.specific_prefixes return _dict def _to_dict(self): @@ -3136,42 +3620,95 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this CrossAccountGatewayPort object.""" + """Return a `str` version of this AsPrependTemplate object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'CrossAccountGatewayPort') -> bool: + def __eq__(self, other: 'AsPrependTemplate') -> 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: 'CrossAccountGatewayPort') -> bool: + def __ne__(self, other: 'AsPrependTemplate') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class PolicyEnum(str, Enum): + """ + Route type this AS Prepend applies to. + """ + + IMPORT = 'import' + EXPORT = 'export' + + + +class AuthenticationKeyIdentity: + """ + AuthenticationKeyIdentity. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a AuthenticationKeyIdentity object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity', 'AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity']) + ) + raise Exception(msg) + + +class AuthenticationKeyReference: + """ + AuthenticationKeyReference. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a AuthenticationKeyReference object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference', 'AuthenticationKeyReferenceHpcsAuthenticationKeyReference']) + ) + raise Exception(msg) + class CrossConnectRouter: """ Cross Connect Router details. - :attr List[str] capabilities: (optional) Array of capabilities for this router. - :attr str router_name: (optional) The name of the Router. - :attr int total_connections: (optional) Count of existing Direct Link Dedicated + :param List[str] capabilities: (optional) List of capabilities for this router. + Listed `MacsecCapability` values indicate the router is associated with switch + ports with that capability, and is able to provision direct links with that + capability. Multiple `MacsecCapability` values may be listed. + :param str router_name: (optional) The name of the Router. + :param int total_connections: (optional) Count of existing Direct Link Dedicated gateways on this router for this account. """ def __init__( self, *, - capabilities: List[str] = None, - router_name: str = None, - total_connections: int = None, + capabilities: Optional[List[str]] = None, + router_name: Optional[str] = None, + total_connections: Optional[int] = None, ) -> None: """ Initialize a CrossConnectRouter object. - :param List[str] capabilities: (optional) Array of capabilities for this + :param List[str] capabilities: (optional) List of capabilities for this router. + Listed `MacsecCapability` values indicate the router is associated with + switch ports with that capability, and is able to provision direct links + with that capability. Multiple `MacsecCapability` values may be listed. :param str router_name: (optional) The name of the Router. :param int total_connections: (optional) Count of existing Direct Link Dedicated gateways on this router for this account. @@ -3184,12 +3721,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'CrossConnectRouter': """Initialize a CrossConnectRouter object from a json dictionary.""" args = {} - if 'capabilities' in _dict: - args['capabilities'] = _dict.get('capabilities') - if 'router_name' in _dict: - args['router_name'] = _dict.get('router_name') - if 'total_connections' in _dict: - args['total_connections'] = _dict.get('total_connections') + if (capabilities := _dict.get('capabilities')) is not None: + args['capabilities'] = capabilities + if (router_name := _dict.get('router_name')) is not None: + args['router_name'] = router_name + if (total_connections := _dict.get('total_connections')) is not None: + args['total_connections'] = total_connections return cls(**args) @classmethod @@ -3231,7 +3768,7 @@ class ExportRouteFilterCollection: """ Collection of export route filters. - :attr List[RouteFilter] export_route_filters: Array of export route filters. + :param List[RouteFilter] export_route_filters: Array of export route filters. """ def __init__( @@ -3250,8 +3787,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'ExportRouteFilterCollection': """Initialize a ExportRouteFilterCollection object from a json dictionary.""" args = {} - if 'export_route_filters' in _dict: - args['export_route_filters'] = [RouteFilter.from_dict(v) for v in _dict.get('export_route_filters')] + if (export_route_filters := _dict.get('export_route_filters')) is not None: + args['export_route_filters'] = [RouteFilter.from_dict(v) for v in export_route_filters] else: raise ValueError('Required property \'export_route_filters\' not present in ExportRouteFilterCollection JSON') return cls(**args) @@ -3297,86 +3834,94 @@ class Gateway: """ gateway. - :attr List[AsPrepend] as_prepends: (optional) array of AS Prepend information. - :attr GatewayAuthenticationKey authentication_key: (optional) The identity of - the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original string - must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. - :attr GatewayBfdConfig bfd_config: (optional) BFD configuration information. - :attr int bgp_asn: Customer BGP ASN. - :attr str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated and - no longer recognized by the Direct Link APIs. + :param List[AsPrepend] as_prepends: (optional) array of AS Prepend information. + :param AuthenticationKeyReference authentication_key: (optional) + :param GatewayBfdConfig bfd_config: (optional) BFD configuration information. + :param int bgp_asn: Customer BGP ASN. + :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated + and no longer recognized by the Direct Link APIs. See bgp_cer_cidr and bgp_ibm_cidr fields instead for IP related information. - Deprecated field bgp_base_cidr will be removed from the API specificiation after + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR. - :attr int bgp_ibm_asn: (optional) IBM BGP ASN. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR. - :attr str bgp_status: (optional) Gateway BGP status. The list of enumerated + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. + :param int bgp_ibm_asn: (optional) IBM BGP ASN. + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR. + :param str bgp_status: (optional) Gateway BGP 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 bgp_status_updated_at: (optional) Date and time bgp status was + :param datetime bgp_status_updated_at: (optional) Date and time bgp status was updated. - :attr str carrier_name: (optional) Carrier name. Only set for type=dedicated + :param str carrier_name: (optional) Carrier name. Only set for type=dedicated gateways. - :attr GatewayChangeRequest change_request: (optional) Changes pending approval + :param GatewayChangeRequest change_request: (optional) Changes pending approval for provider managed Direct Link Connect gateways. - :attr str completion_notice_reject_reason: (optional) Reason for completion + :param str completion_notice_reject_reason: (optional) Reason for completion notice rejection. Only included on type=dedicated gateways with a rejected completion notice. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 datetime created_at: The date and time resource was created. - :attr str crn: The CRN (Cloud Resource Name) of this gateway. - :attr bool cross_account: Indicates whether this gateway is cross account + :param datetime created_at: The date and time resource was created. + :param str crn: The CRN (Cloud Resource Name) of this gateway. + :param bool cross_account: Indicates whether this gateway is cross account gateway. - :attr str cross_connect_router: (optional) Cross connect router. Only included + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. - :attr str customer_name: (optional) Customer name. Only set for type=dedicated + :param str customer_name: (optional) Customer name. Only set for type=dedicated gateways. - :attr str default_export_route_filter: The default directional route filter + :param str default_export_route_filter: The default directional route filter action that applies to routes that do not match any directional route filters. - :attr str default_import_route_filter: The default directional route filter + :param str default_import_route_filter: The default directional route filter action that applies to routes that do not match any directional route filters. - :attr bool global_: Gateways with global routing (`true`) can connect to + :param bool global_: Gateways with global routing (`true`) can connect to networks outside their associated region. - :attr str id: The unique identifier of this gateway. - :attr str link_status: (optional) Gateway link status. Only included on + :param str id: The unique identifier of this gateway. + :param str link_status: (optional) Gateway link status. Only included on type=dedicated gateways. 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 link_status_updated_at: (optional) Date and time link status was + :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :attr str location_display_name: Gateway location long name. - :attr str location_name: Gateway location. - :attr GatewayMacsecConfig macsec_config: (optional) MACsec configuration - information. For Dedicated Gateways with MACsec configured, return - configuration information. Contact IBM support for access to MACsec. - :attr bool metered: Metered billing option. When `true` gateway usage is billed - per gigabyte. When `false` there is no per gigabyte usage charge, instead a - flat rate is charged for the gateway. - :attr str name: The unique user-defined name for this gateway. - :attr str operational_status: Gateway operational 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 GatewayPort port: (optional) gateway port for type=connect gateways. - :attr bool provider_api_managed: (optional) Indicates whether gateway changes + :param str location_display_name: Gateway location long name. + :param str location_name: Gateway location. + :param GatewayMacsecReference macsec: (optional) MACsec configuration + information of a Direct Link gateway. + :param str macsec_capability: (optional) Indicates the direct link's MACsec + capability. It must match one of the MACsec related `capabilities` of the + `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is not + required and can be enabled after direct link creation. + :param bool metered: Metered billing option. When `true` gateway usage is + billed per gigabyte. When `false` there is no per gigabyte usage charge, + instead a flat rate is charged for the gateway. + :param str name: The unique user-defined name for this gateway. + :param str operational_status: Gateway operational status. The list of + enumerated values for this property may expand in the future. Code and processes + using this field must tolerate unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. + :param List[GatewayStatusReason] operational_status_reasons: Context for certain + values of `operational_status`. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param GatewayPortReference port: (optional) Port information for type=connect + gateways. + :param bool provider_api_managed: (optional) Indicates whether gateway changes must be made via a provider portal. - :attr ResourceGroupReference resource_group: (optional) Resource group + :param ResourceGroupReference resource_group: (optional) Resource group reference. - :attr int speed_mbps: Gateway speed in megabits per second. - :attr str patch_panel_completion_notice: (optional) Gateway patch panel complete - notification from implementation team. - :attr str type: Offering type. The list of enumerated values for this property + :param int speed_mbps: Gateway speed in megabits per second. + :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. - :attr int vlan: (optional) VLAN configured for this gateway. If there is no vlan - configured for the gateway, the vlan will be absent. This property will also be - absent if this gateway's `crn` is in another account. + :param int vlan: (optional) VLAN configured for this gateway. If there is no + vlan configured for the gateway, the vlan will be absent. This property will + also be absent if this gateway's `crn` is in another account. """ def __init__( @@ -3394,32 +3939,34 @@ def __init__( metered: bool, name: str, operational_status: str, + operational_status_reasons: List['GatewayStatusReason'], speed_mbps: int, type: str, *, - as_prepends: List['AsPrepend'] = None, - authentication_key: 'GatewayAuthenticationKey' = None, - bfd_config: 'GatewayBfdConfig' = None, - bgp_base_cidr: str = None, - bgp_cer_cidr: str = None, - bgp_ibm_asn: int = None, - bgp_ibm_cidr: str = None, - bgp_status: str = None, - bgp_status_updated_at: datetime = None, - carrier_name: str = None, - change_request: 'GatewayChangeRequest' = None, - completion_notice_reject_reason: str = None, - connection_mode: str = None, - cross_connect_router: str = None, - customer_name: str = None, - link_status: str = None, - link_status_updated_at: datetime = None, - macsec_config: 'GatewayMacsecConfig' = None, - port: 'GatewayPort' = None, - provider_api_managed: bool = None, - resource_group: 'ResourceGroupReference' = None, - patch_panel_completion_notice: str = None, - vlan: int = None, + as_prepends: Optional[List['AsPrepend']] = None, + authentication_key: Optional['AuthenticationKeyReference'] = None, + bfd_config: Optional['GatewayBfdConfig'] = None, + bgp_base_cidr: Optional[str] = None, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_asn: Optional[int] = None, + bgp_ibm_cidr: Optional[str] = None, + bgp_status: Optional[str] = None, + bgp_status_updated_at: Optional[datetime] = None, + carrier_name: Optional[str] = None, + change_request: Optional['GatewayChangeRequest'] = None, + completion_notice_reject_reason: Optional[str] = None, + connection_mode: Optional[str] = None, + cross_connect_router: Optional[str] = None, + customer_name: Optional[str] = None, + link_status: Optional[str] = None, + link_status_updated_at: Optional[datetime] = None, + macsec: Optional['GatewayMacsecReference'] = None, + macsec_capability: Optional[str] = None, + patch_panel_completion_notice: Optional[str] = None, + port: Optional['GatewayPortReference'] = None, + provider_api_managed: Optional[bool] = None, + resource_group: Optional['ResourceGroupReference'] = None, + vlan: Optional[int] = None, ) -> None: """ Initialize a Gateway object. @@ -3447,24 +3994,24 @@ def __init__( :param str operational_status: Gateway operational status. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. + :param List[GatewayStatusReason] operational_status_reasons: Context for + certain values of `operational_status`. :param int speed_mbps: Gateway speed in megabits per second. :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. :param List[AsPrepend] as_prepends: (optional) array of AS Prepend information. - :param GatewayAuthenticationKey authentication_key: (optional) The identity - of the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original - string must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. + :param AuthenticationKeyReference authentication_key: (optional) :param GatewayBfdConfig bfd_config: (optional) BFD configuration information. :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated and no longer recognized by the Direct Link APIs. See bgp_cer_cidr and bgp_ibm_cidr fields instead for IP related information. - Deprecated field bgp_base_cidr will be removed from the API specificiation + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. :param int bgp_ibm_asn: (optional) IBM BGP ASN. @@ -3487,7 +4034,7 @@ def __init__( classic connection. 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 cross_connect_router: (optional) Cross connect router. Only + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. :param str customer_name: (optional) Customer name. Only set for type=dedicated gateways. @@ -3497,16 +4044,25 @@ def __init__( tolerate unexpected values. :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :param GatewayMacsecConfig macsec_config: (optional) MACsec configuration - information. For Dedicated Gateways with MACsec configured, return - configuration information. Contact IBM support for access to MACsec. - :param GatewayPort port: (optional) gateway port for type=connect gateways. + :param GatewayMacsecReference macsec: (optional) MACsec configuration + information of a Direct Link gateway. + :param str macsec_capability: (optional) Indicates the direct link's MACsec + capability. It must match one of the MACsec related `capabilities` of the + `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be + enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is + not required and can be enabled after direct link creation. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param GatewayPortReference port: (optional) Port information for + type=connect gateways. :param bool provider_api_managed: (optional) Indicates whether gateway changes must be made via a provider portal. :param ResourceGroupReference resource_group: (optional) Resource group reference. - :param str patch_panel_completion_notice: (optional) Gateway patch panel - complete notification from implementation team. :param int vlan: (optional) VLAN configured for this gateway. If there is no vlan configured for the gateway, the vlan will be absent. This property will also be absent if this gateway's `crn` is in another account. @@ -3538,15 +4094,17 @@ def __init__( self.link_status_updated_at = link_status_updated_at self.location_display_name = location_display_name self.location_name = location_name - self.macsec_config = macsec_config + self.macsec = macsec + self.macsec_capability = macsec_capability self.metered = metered self.name = name self.operational_status = operational_status + self.operational_status_reasons = operational_status_reasons + self.patch_panel_completion_notice = patch_panel_completion_notice self.port = port self.provider_api_managed = provider_api_managed self.resource_group = resource_group self.speed_mbps = speed_mbps - self.patch_panel_completion_notice = patch_panel_completion_notice self.type = type self.vlan = vlan @@ -3554,112 +4112,118 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'Gateway': """Initialize a Gateway object from a json dictionary.""" args = {} - if 'as_prepends' in _dict: - args['as_prepends'] = [AsPrepend.from_dict(v) for v in _dict.get('as_prepends')] - if 'authentication_key' in _dict: - args['authentication_key'] = GatewayAuthenticationKey.from_dict(_dict.get('authentication_key')) - if 'bfd_config' in _dict: - args['bfd_config'] = GatewayBfdConfig.from_dict(_dict.get('bfd_config')) - if 'bgp_asn' in _dict: - args['bgp_asn'] = _dict.get('bgp_asn') + if (as_prepends := _dict.get('as_prepends')) is not None: + args['as_prepends'] = [AsPrepend.from_dict(v) for v in as_prepends] + if (authentication_key := _dict.get('authentication_key')) is not None: + args['authentication_key'] = authentication_key + if (bfd_config := _dict.get('bfd_config')) is not None: + args['bfd_config'] = GatewayBfdConfig.from_dict(bfd_config) + if (bgp_asn := _dict.get('bgp_asn')) is not None: + args['bgp_asn'] = bgp_asn else: raise ValueError('Required property \'bgp_asn\' not present in Gateway JSON') - if 'bgp_base_cidr' in _dict: - args['bgp_base_cidr'] = _dict.get('bgp_base_cidr') - if 'bgp_cer_cidr' in _dict: - args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr') - if 'bgp_ibm_asn' in _dict: - args['bgp_ibm_asn'] = _dict.get('bgp_ibm_asn') - if 'bgp_ibm_cidr' in _dict: - args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr') - if 'bgp_status' in _dict: - args['bgp_status'] = _dict.get('bgp_status') - if 'bgp_status_updated_at' in _dict: - args['bgp_status_updated_at'] = string_to_datetime(_dict.get('bgp_status_updated_at')) - if 'carrier_name' in _dict: - args['carrier_name'] = _dict.get('carrier_name') - if 'change_request' in _dict: - args['change_request'] = _dict.get('change_request') - if 'completion_notice_reject_reason' in _dict: - args['completion_notice_reject_reason'] = _dict.get('completion_notice_reject_reason') - if 'connection_mode' in _dict: - args['connection_mode'] = _dict.get('connection_mode') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (bgp_base_cidr := _dict.get('bgp_base_cidr')) is not None: + args['bgp_base_cidr'] = bgp_base_cidr + if (bgp_cer_cidr := _dict.get('bgp_cer_cidr')) is not None: + args['bgp_cer_cidr'] = bgp_cer_cidr + if (bgp_ibm_asn := _dict.get('bgp_ibm_asn')) is not None: + args['bgp_ibm_asn'] = bgp_ibm_asn + if (bgp_ibm_cidr := _dict.get('bgp_ibm_cidr')) is not None: + args['bgp_ibm_cidr'] = bgp_ibm_cidr + if (bgp_status := _dict.get('bgp_status')) is not None: + args['bgp_status'] = bgp_status + if (bgp_status_updated_at := _dict.get('bgp_status_updated_at')) is not None: + args['bgp_status_updated_at'] = string_to_datetime(bgp_status_updated_at) + if (carrier_name := _dict.get('carrier_name')) is not None: + args['carrier_name'] = carrier_name + if (change_request := _dict.get('change_request')) is not None: + args['change_request'] = change_request + if (completion_notice_reject_reason := _dict.get('completion_notice_reject_reason')) is not None: + args['completion_notice_reject_reason'] = completion_notice_reject_reason + if (connection_mode := _dict.get('connection_mode')) is not None: + args['connection_mode'] = connection_mode + 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 Gateway JSON') - 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 Gateway JSON') - if 'cross_account' in _dict: - args['cross_account'] = _dict.get('cross_account') + if (cross_account := _dict.get('cross_account')) is not None: + args['cross_account'] = cross_account else: raise ValueError('Required property \'cross_account\' not present in Gateway JSON') - if 'cross_connect_router' in _dict: - args['cross_connect_router'] = _dict.get('cross_connect_router') - if 'customer_name' in _dict: - args['customer_name'] = _dict.get('customer_name') - if 'default_export_route_filter' in _dict: - args['default_export_route_filter'] = _dict.get('default_export_route_filter') + if (cross_connect_router := _dict.get('cross_connect_router')) is not None: + args['cross_connect_router'] = cross_connect_router + if (customer_name := _dict.get('customer_name')) is not None: + args['customer_name'] = customer_name + if (default_export_route_filter := _dict.get('default_export_route_filter')) is not None: + args['default_export_route_filter'] = default_export_route_filter else: raise ValueError('Required property \'default_export_route_filter\' not present in Gateway JSON') - if 'default_import_route_filter' in _dict: - args['default_import_route_filter'] = _dict.get('default_import_route_filter') + if (default_import_route_filter := _dict.get('default_import_route_filter')) is not None: + args['default_import_route_filter'] = default_import_route_filter else: raise ValueError('Required property \'default_import_route_filter\' not present in Gateway JSON') - if 'global' in _dict: - args['global_'] = _dict.get('global') + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in Gateway 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 Gateway JSON') - if 'link_status' in _dict: - args['link_status'] = _dict.get('link_status') - if 'link_status_updated_at' in _dict: - args['link_status_updated_at'] = string_to_datetime(_dict.get('link_status_updated_at')) - if 'location_display_name' in _dict: - args['location_display_name'] = _dict.get('location_display_name') + if (link_status := _dict.get('link_status')) is not None: + args['link_status'] = link_status + if (link_status_updated_at := _dict.get('link_status_updated_at')) is not None: + args['link_status_updated_at'] = string_to_datetime(link_status_updated_at) + if (location_display_name := _dict.get('location_display_name')) is not None: + args['location_display_name'] = location_display_name else: raise ValueError('Required property \'location_display_name\' not present in Gateway JSON') - if 'location_name' in _dict: - args['location_name'] = _dict.get('location_name') + if (location_name := _dict.get('location_name')) is not None: + args['location_name'] = location_name else: raise ValueError('Required property \'location_name\' not present in Gateway JSON') - if 'macsec_config' in _dict: - args['macsec_config'] = GatewayMacsecConfig.from_dict(_dict.get('macsec_config')) - if 'metered' in _dict: - args['metered'] = _dict.get('metered') + if (macsec := _dict.get('macsec')) is not None: + args['macsec'] = GatewayMacsecReference.from_dict(macsec) + if (macsec_capability := _dict.get('macsec_capability')) is not None: + args['macsec_capability'] = macsec_capability + if (metered := _dict.get('metered')) is not None: + args['metered'] = metered else: raise ValueError('Required property \'metered\' not present in Gateway 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 Gateway JSON') - if 'operational_status' in _dict: - args['operational_status'] = _dict.get('operational_status') + if (operational_status := _dict.get('operational_status')) is not None: + args['operational_status'] = operational_status else: raise ValueError('Required property \'operational_status\' not present in Gateway JSON') - if 'port' in _dict: - args['port'] = GatewayPort.from_dict(_dict.get('port')) - if 'provider_api_managed' in _dict: - args['provider_api_managed'] = _dict.get('provider_api_managed') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (operational_status_reasons := _dict.get('operational_status_reasons')) is not None: + args['operational_status_reasons'] = [GatewayStatusReason.from_dict(v) for v in operational_status_reasons] + else: + raise ValueError('Required property \'operational_status_reasons\' not present in Gateway JSON') + if (patch_panel_completion_notice := _dict.get('patch_panel_completion_notice')) is not None: + args['patch_panel_completion_notice'] = patch_panel_completion_notice + if (port := _dict.get('port')) is not None: + args['port'] = GatewayPortReference.from_dict(port) + if (provider_api_managed := _dict.get('provider_api_managed')) is not None: + args['provider_api_managed'] = provider_api_managed + if (resource_group := _dict.get('resource_group')) is not None: + args['resource_group'] = ResourceGroupReference.from_dict(resource_group) + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps else: raise ValueError('Required property \'speed_mbps\' not present in Gateway JSON') - if 'patch_panel_completion_notice' in _dict: - args['patch_panel_completion_notice'] = _dict.get('patch_panel_completion_notice') - 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 Gateway JSON') - if 'vlan' in _dict: - args['vlan'] = _dict.get('vlan') + if (vlan := _dict.get('vlan')) is not None: + args['vlan'] = vlan return cls(**args) @classmethod @@ -3739,17 +4303,29 @@ def to_dict(self) -> Dict: _dict['location_display_name'] = self.location_display_name if hasattr(self, 'location_name') and self.location_name is not None: _dict['location_name'] = self.location_name - if hasattr(self, 'macsec_config') and self.macsec_config is not None: - if isinstance(self.macsec_config, dict): - _dict['macsec_config'] = self.macsec_config + if hasattr(self, 'macsec') and self.macsec is not None: + if isinstance(self.macsec, dict): + _dict['macsec'] = self.macsec else: - _dict['macsec_config'] = self.macsec_config.to_dict() + _dict['macsec'] = self.macsec.to_dict() + if hasattr(self, 'macsec_capability') and self.macsec_capability is not None: + _dict['macsec_capability'] = self.macsec_capability if hasattr(self, 'metered') and self.metered is not None: _dict['metered'] = self.metered if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'operational_status') and self.operational_status is not None: _dict['operational_status'] = self.operational_status + if hasattr(self, 'operational_status_reasons') and self.operational_status_reasons is not None: + operational_status_reasons_list = [] + for v in self.operational_status_reasons: + if isinstance(v, dict): + operational_status_reasons_list.append(v) + else: + operational_status_reasons_list.append(v.to_dict()) + _dict['operational_status_reasons'] = operational_status_reasons_list + if hasattr(self, 'patch_panel_completion_notice') and self.patch_panel_completion_notice is not None: + _dict['patch_panel_completion_notice'] = self.patch_panel_completion_notice if hasattr(self, 'port') and self.port is not None: if isinstance(self.port, dict): _dict['port'] = self.port @@ -3764,8 +4340,6 @@ def to_dict(self) -> Dict: _dict['resource_group'] = self.resource_group.to_dict() if hasattr(self, 'speed_mbps') and self.speed_mbps is not None: _dict['speed_mbps'] = self.speed_mbps - if hasattr(self, 'patch_panel_completion_notice') and self.patch_panel_completion_notice is not None: - _dict['patch_panel_completion_notice'] = self.patch_panel_completion_notice if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type if hasattr(self, 'vlan') and self.vlan is not None: @@ -3846,11 +4420,29 @@ class LinkStatusEnum(str, Enum): UP = 'up' + class MacsecCapabilityEnum(str, Enum): + """ + Indicates the direct link's MACsec capability. It must match one of the MACsec + related `capabilities` of the `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is not + required and can be enabled after direct link creation. + """ + + NON_MACSEC = 'non_macsec' + MACSEC = 'macsec' + MACSEC_OPTIONAL = 'macsec_optional' + + class OperationalStatusEnum(str, Enum): """ Gateway operational status. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. """ AWAITING_COMPLETION_NOTICE = 'awaiting_completion_notice' @@ -3866,6 +4458,7 @@ class OperationalStatusEnum(str, Enum): LOA_CREATED = 'loa_created' LOA_REJECTED = 'loa_rejected' PROVISIONED = 'provisioned' + FAILED = 'failed' class TypeEnum(str, Enum): @@ -3879,188 +4472,48 @@ class TypeEnum(str, Enum): -class GatewayActionTemplateAuthenticationKey: +class GatewayActionTemplateUpdatesItem: """ - Applicable for create_gateway_approve requests to select the gateway's BGP MD5 - authentication key. The key material that you provide must be base64 encoded and - original string must be maximum 126 ASCII characters in length. To clear the optional - `authentication_key` field patch its crn to `""`. + GatewayActionTemplateUpdatesItem. - :attr str crn: The CRN of the [Key Protect Standard - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Standard - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this - resource. """ def __init__( self, - crn: str, ) -> None: """ - Initialize a GatewayActionTemplateAuthenticationKey object. + Initialize a GatewayActionTemplateUpdatesItem object. - :param str crn: The CRN of the [Key Protect Standard - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Standard - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for - this resource. """ - self.crn = crn + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['GatewayActionTemplateUpdatesItemGatewayClientSpeedUpdate', 'GatewayActionTemplateUpdatesItemGatewayClientBGPIPUpdate', 'GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate', 'GatewayActionTemplateUpdatesItemGatewayClientVLANUpdate']) + ) + raise Exception(msg) - @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayActionTemplateAuthenticationKey': - """Initialize a GatewayActionTemplateAuthenticationKey object from a json dictionary.""" - args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in GatewayActionTemplateAuthenticationKey JSON') - return cls(**args) - @classmethod - def _from_dict(cls, _dict): - """Initialize a GatewayActionTemplateAuthenticationKey object from a json dictionary.""" - return cls.from_dict(_dict) +class GatewayBfdConfig: + """ + BFD configuration information. - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - 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 GatewayActionTemplateAuthenticationKey object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'GatewayActionTemplateAuthenticationKey') -> 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: 'GatewayActionTemplateAuthenticationKey') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class GatewayActionTemplateUpdatesItem: - """ - GatewayActionTemplateUpdatesItem. - - """ - - def __init__( - self, - ) -> None: - """ - Initialize a GatewayActionTemplateUpdatesItem object. - - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['GatewayActionTemplateUpdatesItemGatewayClientSpeedUpdate', 'GatewayActionTemplateUpdatesItemGatewayClientBGPIPUpdate', 'GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate', 'GatewayActionTemplateUpdatesItemGatewayClientVLANUpdate']) - ) - raise Exception(msg) - - -class GatewayAuthenticationKey: - """ - The identity of the standard key to use for BGP MD5 authentication key. The key - material that you provide must be base64 encoded and original string must be maximum - 126 ASCII characters in length. To clear the optional `authentication_key` field patch - its crn to `""`. - - :attr str crn: The CRN of the [Key Protect Standard - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Standard - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this - resource. - """ - - def __init__( - self, - crn: str, - ) -> None: - """ - Initialize a GatewayAuthenticationKey object. - - :param str crn: The CRN of the [Key Protect Standard - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Standard - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for - this resource. - """ - self.crn = crn - - @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayAuthenticationKey': - """Initialize a GatewayAuthenticationKey object from a json dictionary.""" - args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in GatewayAuthenticationKey JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a GatewayAuthenticationKey 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - 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 GatewayAuthenticationKey object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'GatewayAuthenticationKey') -> 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: 'GatewayAuthenticationKey') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class GatewayBfdConfig: - """ - BFD configuration information. - - :attr str bfd_status: (optional) Gateway BFD 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 bfd_status_updated_at: (optional) Date and time bfd status was - updated. - :attr int interval: Minimum interval in milliseconds at which the local routing - device transmits hello packets and then expects to receive a reply from a - neighbor with which it has established a BFD session. - :attr int multiplier: The number of hello packets not received by a neighbor - that causes the originating interface to be declared down. - """ + :param str bfd_status: (optional) Gateway BFD status. The list of enumerated + values for this property may expand in the future. Code and processes using this + field must tolerate unexpected values. + :param datetime bfd_status_updated_at: (optional) Date and time bfd status was + updated. + :param int interval: Minimum interval in milliseconds at which the local routing + device transmits hello packets and then expects to receive a reply from a + neighbor with which it has established a BFD session. + :param int multiplier: The number of hello packets not received by a neighbor + that causes the originating interface to be declared down. + """ def __init__( self, interval: int, multiplier: int, *, - bfd_status: str = None, - bfd_status_updated_at: datetime = None, + bfd_status: Optional[str] = None, + bfd_status_updated_at: Optional[datetime] = None, ) -> None: """ Initialize a GatewayBfdConfig object. @@ -4085,16 +4538,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayBfdConfig': """Initialize a GatewayBfdConfig object from a json dictionary.""" args = {} - if 'bfd_status' in _dict: - args['bfd_status'] = _dict.get('bfd_status') - if 'bfd_status_updated_at' in _dict: - args['bfd_status_updated_at'] = string_to_datetime(_dict.get('bfd_status_updated_at')) - if 'interval' in _dict: - args['interval'] = _dict.get('interval') + if (bfd_status := _dict.get('bfd_status')) is not None: + args['bfd_status'] = bfd_status + if (bfd_status_updated_at := _dict.get('bfd_status_updated_at')) is not None: + args['bfd_status_updated_at'] = string_to_datetime(bfd_status_updated_at) + if (interval := _dict.get('interval')) is not None: + args['interval'] = interval else: raise ValueError('Required property \'interval\' not present in GatewayBfdConfig JSON') - if 'multiplier' in _dict: - args['multiplier'] = _dict.get('multiplier') + if (multiplier := _dict.get('multiplier')) is not None: + args['multiplier'] = multiplier else: raise ValueError('Required property \'multiplier\' not present in GatewayBfdConfig JSON') return cls(**args) @@ -4152,10 +4605,10 @@ class GatewayBfdConfigActionTemplate: Applicable for create_gateway_approve requests to select the gateway's BFD configuration information. - :attr int interval: Minimum interval in milliseconds at which the local routing + :param int interval: Minimum interval in milliseconds at which the local routing device transmits hello packets and then expects to receive a reply from a neighbor with which it has established a BFD session. - :attr int multiplier: (optional) The number of hello packets not received by a + :param int multiplier: (optional) The number of hello packets not received by a neighbor that causes the originating interface to be declared down. """ @@ -4163,7 +4616,7 @@ def __init__( self, interval: int, *, - multiplier: int = None, + multiplier: Optional[int] = None, ) -> None: """ Initialize a GatewayBfdConfigActionTemplate object. @@ -4181,12 +4634,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayBfdConfigActionTemplate': """Initialize a GatewayBfdConfigActionTemplate object from a json dictionary.""" args = {} - if 'interval' in _dict: - args['interval'] = _dict.get('interval') + if (interval := _dict.get('interval')) is not None: + args['interval'] = interval else: raise ValueError('Required property \'interval\' not present in GatewayBfdConfigActionTemplate JSON') - if 'multiplier' in _dict: - args['multiplier'] = _dict.get('multiplier') + if (multiplier := _dict.get('multiplier')) is not None: + args['multiplier'] = multiplier return cls(**args) @classmethod @@ -4226,10 +4679,10 @@ class GatewayBfdConfigTemplate: """ BFD configuration information. - :attr int interval: Minimum interval in milliseconds at which the local routing + :param int interval: Minimum interval in milliseconds at which the local routing device transmits hello packets and then expects to receive a reply from a neighbor with which it has established a BFD session. - :attr int multiplier: (optional) The number of hello packets not received by a + :param int multiplier: (optional) The number of hello packets not received by a neighbor that causes the originating interface to be declared down. """ @@ -4237,7 +4690,7 @@ def __init__( self, interval: int, *, - multiplier: int = None, + multiplier: Optional[int] = None, ) -> None: """ Initialize a GatewayBfdConfigTemplate object. @@ -4255,12 +4708,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayBfdConfigTemplate': """Initialize a GatewayBfdConfigTemplate object from a json dictionary.""" args = {} - if 'interval' in _dict: - args['interval'] = _dict.get('interval') + if (interval := _dict.get('interval')) is not None: + args['interval'] = interval else: raise ValueError('Required property \'interval\' not present in GatewayBfdConfigTemplate JSON') - if 'multiplier' in _dict: - args['multiplier'] = _dict.get('multiplier') + if (multiplier := _dict.get('multiplier')) is not None: + args['multiplier'] = multiplier return cls(**args) @classmethod @@ -4300,19 +4753,19 @@ class GatewayBfdPatchTemplate: """ BFD configuration information. - :attr int interval: (optional) Minimum interval in milliseconds at which the + :param int interval: (optional) Minimum interval in milliseconds at which the local routing device transmits hello packets and then expects to receive a reply from a neighbor with which it has established a BFD session. To clear the BFD configuration patch its interval to 0. - :attr int multiplier: (optional) The number of hello packets not received by a + :param int multiplier: (optional) The number of hello packets not received by a neighbor that causes the originating interface to be declared down. """ def __init__( self, *, - interval: int = None, - multiplier: int = None, + interval: Optional[int] = None, + multiplier: Optional[int] = None, ) -> None: """ Initialize a GatewayBfdPatchTemplate object. @@ -4332,10 +4785,10 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayBfdPatchTemplate': """Initialize a GatewayBfdPatchTemplate object from a json dictionary.""" args = {} - if 'interval' in _dict: - args['interval'] = _dict.get('interval') - if 'multiplier' in _dict: - args['multiplier'] = _dict.get('multiplier') + if (interval := _dict.get('interval')) is not None: + args['interval'] = interval + if (multiplier := _dict.get('multiplier')) is not None: + args['multiplier'] = multiplier return cls(**args) @classmethod @@ -4413,7 +4866,7 @@ class GatewayCollection: """ List of gateways. - :attr List[GatewayCollectionGatewaysItem] gateways: Collection of Direct Link + :param List[GatewayCollectionGatewaysItem] gateways: Collection of Direct Link gateways. """ @@ -4433,8 +4886,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayCollection': """Initialize a GatewayCollection object from a json dictionary.""" args = {} - if 'gateways' in _dict: - args['gateways'] = _dict.get('gateways') + if (gateways := _dict.get('gateways')) is not None: + args['gateways'] = gateways else: raise ValueError('Required property \'gateways\' not present in GatewayCollection JSON') return cls(**args) @@ -4495,131 +4948,161 @@ def __init__( raise Exception(msg) -class GatewayMacsecConfig: - """ - MACsec configuration information. For Dedicated Gateways with MACsec configured, - return configuration information. Contact IBM support for access to MACsec. - - :attr bool active: Indicate whether MACsec should currently be active (true) or - inactive (false) for a MACsec enabled gateway. To be MACsec enabled a - `macsec_config` must be specified at gateway create time. - :attr GatewayMacsecConfigActiveCak active_cak: (optional) Active connectivity - association key. - During normal operation `active_cak` will match the desired `primary_cak`. - During CAK changes this field can be used to indicate which key is currently - active on the gateway. - :attr str cipher_suite: (optional) SAK cipher suite. - :attr int confidentiality_offset: (optional) confidentiality offset. - :attr str cryptographic_algorithm: (optional) cryptographic algorithm. - :attr GatewayMacsecConfigFallbackCak fallback_cak: (optional) fallback - connectivity association key. - :attr int key_server_priority: (optional) key server priority. - :attr GatewayMacsecConfigPrimaryCak primary_cak: desired primary connectivity - association key. - :attr int sak_expiry_time: (optional) Secure Association Key (SAK) expiry time - in seconds. - :attr str security_policy: (optional) Packets without MACsec headers are dropped - when security_policy is `must_secure`. - :attr str status: Current status of MACsec on this gateway. - Status 'offline' is returned during gateway creation and deletion. - :attr int window_size: (optional) replay protection window size. +class GatewayMacsec: + """ + MACsec configuration information of a Direct Link gateway. + + :param bool active: Indicates if the MACsec feature is currently active (true) + or inactive (false) for a gateway. + :param str cipher_suite: The cipher suite used in generating the security + association key (SAK). + :param int confidentiality_offset: The confidentiality offset determines the + number of octets in an Ethernet frame that are not encrypted. + :param datetime created_at: The date and time the resource was created. + :param int key_server_priority: Used in the MACsec Key Agreement (MKA) protocol + to determine which peer acts as the key server. + Lower values indicate a higher preference to be the key server. + The MACsec configuration on the direct link will always set this value to 255. + :param SakRekey sak_rekey: Determines how SAK rekeying occurs. It is either + timer based or based on the amount of used packet numbers. + :param str security_policy: Determines how packets without MACsec headers are + handled. + `must_secure` - Packets without MACsec headers are dropped. This policy should + be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy should + be used to prefer network availability over security. + :param str status: Current status of MACsec on this direct link. + Status `offline` is returned when MACsec is inactive and during direct link + creation. + Status `deleting` is returned when MACsec during removal of MACsec from the + direct link and during direct link deletion. + See `status_reasons[]` for possible remediation of the `failed` `status`. + :param List[GatewayMacsecStatusReason] status_reasons: Context for certain + values of `status`. + :param datetime updated_at: The date and time the resource was last updated. + :param int window_size: The window size determines the number of frames in a + window for replay protection. + Replay protection is used to counter replay attacks. Frames within a window size + can be out of order and are not replay protected. """ def __init__( self, active: bool, - primary_cak: 'GatewayMacsecConfigPrimaryCak', + cipher_suite: str, + confidentiality_offset: int, + created_at: datetime, + key_server_priority: int, + sak_rekey: 'SakRekey', + security_policy: str, status: str, - *, - active_cak: 'GatewayMacsecConfigActiveCak' = None, - cipher_suite: str = None, - confidentiality_offset: int = None, - cryptographic_algorithm: str = None, - fallback_cak: 'GatewayMacsecConfigFallbackCak' = None, - key_server_priority: int = None, - sak_expiry_time: int = None, - security_policy: str = None, - window_size: int = None, + status_reasons: List['GatewayMacsecStatusReason'], + updated_at: datetime, + window_size: int, ) -> None: """ - Initialize a GatewayMacsecConfig object. - - :param bool active: Indicate whether MACsec should currently be active - (true) or inactive (false) for a MACsec enabled gateway. To be MACsec - enabled a `macsec_config` must be specified at gateway create time. - :param GatewayMacsecConfigPrimaryCak primary_cak: desired primary - connectivity association key. - :param str status: Current status of MACsec on this gateway. - Status 'offline' is returned during gateway creation and deletion. - :param GatewayMacsecConfigActiveCak active_cak: (optional) Active - connectivity association key. - During normal operation `active_cak` will match the desired `primary_cak`. - During CAK changes this field can be used to indicate which key is - currently active on the gateway. - :param str cipher_suite: (optional) SAK cipher suite. - :param int confidentiality_offset: (optional) confidentiality offset. - :param str cryptographic_algorithm: (optional) cryptographic algorithm. - :param GatewayMacsecConfigFallbackCak fallback_cak: (optional) fallback - connectivity association key. - :param int key_server_priority: (optional) key server priority. - :param int sak_expiry_time: (optional) Secure Association Key (SAK) expiry - time in seconds. - :param str security_policy: (optional) Packets without MACsec headers are - dropped when security_policy is `must_secure`. - :param int window_size: (optional) replay protection window size. + Initialize a GatewayMacsec object. + + :param bool active: Indicates if the MACsec feature is currently active + (true) or inactive (false) for a gateway. + :param str cipher_suite: The cipher suite used in generating the security + association key (SAK). + :param int confidentiality_offset: The confidentiality offset determines + the number of octets in an Ethernet frame that are not encrypted. + :param datetime created_at: The date and time the resource was created. + :param int key_server_priority: Used in the MACsec Key Agreement (MKA) + protocol to determine which peer acts as the key server. + Lower values indicate a higher preference to be the key server. + The MACsec configuration on the direct link will always set this value to + 255. + :param SakRekey sak_rekey: Determines how SAK rekeying occurs. It is either + timer based or based on the amount of used packet numbers. + :param str security_policy: Determines how packets without MACsec headers + are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy + should be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy + should be used to prefer network availability over security. + :param str status: Current status of MACsec on this direct link. + Status `offline` is returned when MACsec is inactive and during direct link + creation. + Status `deleting` is returned when MACsec during removal of MACsec from the + direct link and during direct link deletion. + See `status_reasons[]` for possible remediation of the `failed` `status`. + :param List[GatewayMacsecStatusReason] status_reasons: Context for certain + values of `status`. + :param datetime updated_at: The date and time the resource was last + updated. + :param int window_size: The window size determines the number of frames in + a window for replay protection. + Replay protection is used to counter replay attacks. Frames within a window + size can be out of order and are not replay protected. """ self.active = active - self.active_cak = active_cak self.cipher_suite = cipher_suite self.confidentiality_offset = confidentiality_offset - self.cryptographic_algorithm = cryptographic_algorithm - self.fallback_cak = fallback_cak + self.created_at = created_at self.key_server_priority = key_server_priority - self.primary_cak = primary_cak - self.sak_expiry_time = sak_expiry_time + self.sak_rekey = sak_rekey self.security_policy = security_policy self.status = status + self.status_reasons = status_reasons + self.updated_at = updated_at self.window_size = window_size @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfig': - """Initialize a GatewayMacsecConfig object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsec': + """Initialize a GatewayMacsec object from a json dictionary.""" args = {} - if 'active' in _dict: - args['active'] = _dict.get('active') - else: - raise ValueError('Required property \'active\' not present in GatewayMacsecConfig JSON') - if 'active_cak' in _dict: - args['active_cak'] = GatewayMacsecConfigActiveCak.from_dict(_dict.get('active_cak')) - if 'cipher_suite' in _dict: - args['cipher_suite'] = _dict.get('cipher_suite') - if 'confidentiality_offset' in _dict: - args['confidentiality_offset'] = _dict.get('confidentiality_offset') - if 'cryptographic_algorithm' in _dict: - args['cryptographic_algorithm'] = _dict.get('cryptographic_algorithm') - if 'fallback_cak' in _dict: - args['fallback_cak'] = GatewayMacsecConfigFallbackCak.from_dict(_dict.get('fallback_cak')) - if 'key_server_priority' in _dict: - args['key_server_priority'] = _dict.get('key_server_priority') - if 'primary_cak' in _dict: - args['primary_cak'] = GatewayMacsecConfigPrimaryCak.from_dict(_dict.get('primary_cak')) - else: - raise ValueError('Required property \'primary_cak\' not present in GatewayMacsecConfig JSON') - if 'sak_expiry_time' in _dict: - args['sak_expiry_time'] = _dict.get('sak_expiry_time') - if 'security_policy' in _dict: - args['security_policy'] = _dict.get('security_policy') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in GatewayMacsecConfig JSON') - if 'window_size' in _dict: - args['window_size'] = _dict.get('window_size') + if (active := _dict.get('active')) is not None: + args['active'] = active + else: + raise ValueError('Required property \'active\' not present in GatewayMacsec JSON') + if (cipher_suite := _dict.get('cipher_suite')) is not None: + args['cipher_suite'] = cipher_suite + else: + raise ValueError('Required property \'cipher_suite\' not present in GatewayMacsec JSON') + if (confidentiality_offset := _dict.get('confidentiality_offset')) is not None: + args['confidentiality_offset'] = confidentiality_offset + else: + raise ValueError('Required property \'confidentiality_offset\' not present in GatewayMacsec 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 GatewayMacsec JSON') + if (key_server_priority := _dict.get('key_server_priority')) is not None: + args['key_server_priority'] = key_server_priority + else: + raise ValueError('Required property \'key_server_priority\' not present in GatewayMacsec JSON') + if (sak_rekey := _dict.get('sak_rekey')) is not None: + args['sak_rekey'] = sak_rekey + else: + raise ValueError('Required property \'sak_rekey\' not present in GatewayMacsec JSON') + if (security_policy := _dict.get('security_policy')) is not None: + args['security_policy'] = security_policy + else: + raise ValueError('Required property \'security_policy\' not present in GatewayMacsec JSON') + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in GatewayMacsec JSON') + if (status_reasons := _dict.get('status_reasons')) is not None: + args['status_reasons'] = [GatewayMacsecStatusReason.from_dict(v) for v in status_reasons] + else: + raise ValueError('Required property \'status_reasons\' not present in GatewayMacsec JSON') + 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 GatewayMacsec JSON') + if (window_size := _dict.get('window_size')) is not None: + args['window_size'] = window_size + else: + raise ValueError('Required property \'window_size\' not present in GatewayMacsec JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfig object from a json dictionary.""" + """Initialize a GatewayMacsec object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -4627,35 +5110,33 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'active') and self.active is not None: _dict['active'] = self.active - if hasattr(self, 'active_cak') and self.active_cak is not None: - if isinstance(self.active_cak, dict): - _dict['active_cak'] = self.active_cak - else: - _dict['active_cak'] = self.active_cak.to_dict() if hasattr(self, 'cipher_suite') and self.cipher_suite is not None: _dict['cipher_suite'] = self.cipher_suite if hasattr(self, 'confidentiality_offset') and self.confidentiality_offset is not None: _dict['confidentiality_offset'] = self.confidentiality_offset - if hasattr(self, 'cryptographic_algorithm') and self.cryptographic_algorithm is not None: - _dict['cryptographic_algorithm'] = self.cryptographic_algorithm - if hasattr(self, 'fallback_cak') and self.fallback_cak is not None: - if isinstance(self.fallback_cak, dict): - _dict['fallback_cak'] = self.fallback_cak - else: - _dict['fallback_cak'] = self.fallback_cak.to_dict() + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) if hasattr(self, 'key_server_priority') and self.key_server_priority is not None: _dict['key_server_priority'] = self.key_server_priority - if hasattr(self, 'primary_cak') and self.primary_cak is not None: - if isinstance(self.primary_cak, dict): - _dict['primary_cak'] = self.primary_cak + if hasattr(self, 'sak_rekey') and self.sak_rekey is not None: + if isinstance(self.sak_rekey, dict): + _dict['sak_rekey'] = self.sak_rekey else: - _dict['primary_cak'] = self.primary_cak.to_dict() - if hasattr(self, 'sak_expiry_time') and self.sak_expiry_time is not None: - _dict['sak_expiry_time'] = self.sak_expiry_time + _dict['sak_rekey'] = self.sak_rekey.to_dict() if hasattr(self, 'security_policy') and self.security_policy is not None: _dict['security_policy'] = self.security_policy if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status + if hasattr(self, 'status_reasons') and self.status_reasons is not None: + status_reasons_list = [] + for v in self.status_reasons: + if isinstance(v, dict): + status_reasons_list.append(v) + else: + status_reasons_list.append(v.to_dict()) + _dict['status_reasons'] = status_reasons_list + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) if hasattr(self, 'window_size') and self.window_size is not None: _dict['window_size'] = self.window_size return _dict @@ -4665,107 +5146,251 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfig object.""" + """Return a `str` version of this GatewayMacsec object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfig') -> bool: + def __eq__(self, other: 'GatewayMacsec') -> 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: 'GatewayMacsecConfig') -> bool: + def __ne__(self, other: 'GatewayMacsec') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other class CipherSuiteEnum(str, Enum): """ - SAK cipher suite. + The cipher suite used in generating the security association key (SAK). """ GCM_AES_XPN_256 = 'gcm_aes_xpn_256' - class CryptographicAlgorithmEnum(str, Enum): - """ - cryptographic algorithm. - """ - - AES_256_CMAC = 'aes_256_cmac' - - class SecurityPolicyEnum(str, Enum): """ - Packets without MACsec headers are dropped when security_policy is `must_secure`. + Determines how packets without MACsec headers are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy should be + used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy should + be used to prefer network availability over security. """ MUST_SECURE = 'must_secure' + SHOULD_SECURE = 'should_secure' class StatusEnum(str, Enum): """ - Current status of MACsec on this gateway. - Status 'offline' is returned during gateway creation and deletion. + Current status of MACsec on this direct link. + Status `offline` is returned when MACsec is inactive and during direct link + creation. + Status `deleting` is returned when MACsec during removal of MACsec from the direct + link and during direct link deletion. + See `status_reasons[]` for possible remediation of the `failed` `status`. """ INIT = 'init' PENDING = 'pending' OFFLINE = 'offline' SECURED = 'secured' + FAILED = 'failed' + DELETING = 'deleting' -class GatewayMacsecConfigActiveCak: - """ - Active connectivity association key. - During normal operation `active_cak` will match the desired `primary_cak`. During CAK - changes this field can be used to indicate which key is currently active on the - gateway. - - :attr str crn: connectivity association key crn. - :attr str status: connectivity association key status. +class GatewayMacsecCak: + """ + A connectivity association key (CAK) used in the MACsec Key Agreement (MKA) protocol. + MACsec CAKs consist of both a name and key. The CAK's `name` must be a hexadecimal + string of even lengths between 2 to 64 inclusive. The CAK's `key` must be a [Hyper + Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) type=standard + with key material a hexadecimal string exactly 64 characters in length. + + :param GatewayMacsecCakActiveDelta active_delta: (optional) This field will be + present when the `status` of the MACsec CAK is `rotating` or `inactive`. It may + be present when the CAK `status` is `failed`. + This object denotes the MACsec CAK's values prior to beginning a CAK rotation + and represents the previous key still configured in the direct link's MACsec key + chain. + This object will be removed when the MACsec CAK rotation completes, indicating + that the previous key has been removed from the key chain, and the current CAK's + values are in use. + :param datetime created_at: The date and time the resource was created. + :param str id: The unique identifier for this connectivity association key + (CAK). + :param HpcsKeyReference key: A reference to a [Hyper Protect Crypto Service + Standard Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: The name identifies the connectivity association key (CAK) + within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to 64 + inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. + :param str session: The intended session the key will be used to secure. + If the `primary` MACsec session fails due to a key/key name mismatch on the + peers, the `fallback` session can take over. + There must be a `primary` session CAK. A `fallback` CAK is optional. + :param str status: Current status of the CAK. + Status `operational` is returned when the CAK is configured successfully. + Status `rotating` is returned during a key rotation. The CAK defined by + `active_delta` is still configured on the device and could be securing the + MACsec session. In the case of a primary CAK, the status will be `rotating` for + a period of time while waiting for the MACsec session to be secured with the new + CAK. After that time, the CAK will either enter `active` or `inactive` status. + Status `active` is returned when the CAK is configured successfully and is + currently used to secure the MACsec session. + Status `inactive` is returned when the CAK is configured successfully, but is + not currently used to secure the MACsec session. The CAK may enter `rotating` + status, and ultimately the `active` status, if it is found to be used to secure + the MACsec session. The CAK may never leave this status on its own (e.g. if + there is a key/key name mismatch). You are allowed to patch the CAK in this + state to start the rotation procedure again. + Status `failed` is returned when the CAK cannot be configured. To recover, first + resolve any issues with your HPCS key, then patch this CAK with the same or new + key. Alternatively, you can delete this CAK if used for the `fallback` session. + :param datetime updated_at: The date and time the resource was last updated. """ def __init__( self, - crn: str, + created_at: datetime, + id: str, + key: 'HpcsKeyReference', + name: str, + session: str, status: str, + updated_at: datetime, + *, + active_delta: Optional['GatewayMacsecCakActiveDelta'] = None, ) -> None: """ - Initialize a GatewayMacsecConfigActiveCak object. - - :param str crn: connectivity association key crn. - :param str status: connectivity association key status. - """ - self.crn = crn + Initialize a GatewayMacsecCak object. + + :param datetime created_at: The date and time the resource was created. + :param str id: The unique identifier for this connectivity association key + (CAK). + :param HpcsKeyReference key: A reference to a [Hyper Protect Crypto Service + Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: The name identifies the connectivity association key (CAK) + within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to + 64 inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. + :param str session: The intended session the key will be used to secure. + If the `primary` MACsec session fails due to a key/key name mismatch on the + peers, the `fallback` session can take over. + There must be a `primary` session CAK. A `fallback` CAK is optional. + :param str status: Current status of the CAK. + Status `operational` is returned when the CAK is configured successfully. + Status `rotating` is returned during a key rotation. The CAK defined by + `active_delta` is still configured on the device and could be securing the + MACsec session. In the case of a primary CAK, the status will be `rotating` + for a period of time while waiting for the MACsec session to be secured + with the new CAK. After that time, the CAK will either enter `active` or + `inactive` status. + Status `active` is returned when the CAK is configured successfully and is + currently used to secure the MACsec session. + Status `inactive` is returned when the CAK is configured successfully, but + is not currently used to secure the MACsec session. The CAK may enter + `rotating` status, and ultimately the `active` status, if it is found to be + used to secure the MACsec session. The CAK may never leave this status on + its own (e.g. if there is a key/key name mismatch). You are allowed to + patch the CAK in this state to start the rotation procedure again. + Status `failed` is returned when the CAK cannot be configured. To recover, + first resolve any issues with your HPCS key, then patch this CAK with the + same or new key. Alternatively, you can delete this CAK if used for the + `fallback` session. + :param datetime updated_at: The date and time the resource was last + updated. + :param GatewayMacsecCakActiveDelta active_delta: (optional) This field will + be present when the `status` of the MACsec CAK is `rotating` or `inactive`. + It may be present when the CAK `status` is `failed`. + This object denotes the MACsec CAK's values prior to beginning a CAK + rotation and represents the previous key still configured in the direct + link's MACsec key chain. + This object will be removed when the MACsec CAK rotation completes, + indicating that the previous key has been removed from the key chain, and + the current CAK's values are in use. + """ + self.active_delta = active_delta + self.created_at = created_at + self.id = id + self.key = key + self.name = name + self.session = session self.status = status + self.updated_at = updated_at @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigActiveCak': - """Initialize a GatewayMacsecConfigActiveCak object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecCak': + """Initialize a GatewayMacsecCak object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if (active_delta := _dict.get('active_delta')) is not None: + args['active_delta'] = GatewayMacsecCakActiveDelta.from_dict(active_delta) + 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 GatewayMacsecCak JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in GatewayMacsecCak JSON') + if (key := _dict.get('key')) is not None: + args['key'] = HpcsKeyReference.from_dict(key) else: - raise ValueError('Required property \'crn\' not present in GatewayMacsecConfigActiveCak JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + raise ValueError('Required property \'key\' not present in GatewayMacsecCak JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name else: - raise ValueError('Required property \'status\' not present in GatewayMacsecConfigActiveCak JSON') + raise ValueError('Required property \'name\' not present in GatewayMacsecCak JSON') + if (session := _dict.get('session')) is not None: + args['session'] = session + else: + raise ValueError('Required property \'session\' not present in GatewayMacsecCak JSON') + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in GatewayMacsecCak JSON') + 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 GatewayMacsecCak JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigActiveCak object from a json dictionary.""" + """Initialize a GatewayMacsecCak 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'active_delta') and self.active_delta is not None: + if isinstance(self.active_delta, dict): + _dict['active_delta'] = self.active_delta + else: + _dict['active_delta'] = self.active_delta.to_dict() + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'key') and self.key is not None: + if isinstance(self.key, dict): + _dict['key'] = self.key + else: + _dict['key'] = self.key.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'session') and self.session is not None: + _dict['session'] = self.session if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) return _dict def _to_dict(self): @@ -4773,66 +5398,175 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigActiveCak object.""" + """Return a `str` version of this GatewayMacsecCak object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigActiveCak') -> bool: + def __eq__(self, other: 'GatewayMacsecCak') -> 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: 'GatewayMacsecConfigActiveCak') -> bool: + def __ne__(self, other: 'GatewayMacsecCak') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class SessionEnum(str, Enum): + """ + The intended session the key will be used to secure. + If the `primary` MACsec session fails due to a key/key name mismatch on the peers, + the `fallback` session can take over. + There must be a `primary` session CAK. A `fallback` CAK is optional. + """ + + PRIMARY = 'primary' + FALLBACK = 'fallback' -class GatewayMacsecConfigFallbackCak: - """ - fallback connectivity association key. - :attr str crn: connectivity association key crn. - :attr str status: connectivity association key status. + class StatusEnum(str, Enum): + """ + Current status of the CAK. + Status `operational` is returned when the CAK is configured successfully. + Status `rotating` is returned during a key rotation. The CAK defined by + `active_delta` is still configured on the device and could be securing the MACsec + session. In the case of a primary CAK, the status will be `rotating` for a period + of time while waiting for the MACsec session to be secured with the new CAK. After + that time, the CAK will either enter `active` or `inactive` status. + Status `active` is returned when the CAK is configured successfully and is + currently used to secure the MACsec session. + Status `inactive` is returned when the CAK is configured successfully, but is not + currently used to secure the MACsec session. The CAK may enter `rotating` status, + and ultimately the `active` status, if it is found to be used to secure the MACsec + session. The CAK may never leave this status on its own (e.g. if there is a + key/key name mismatch). You are allowed to patch the CAK in this state to start + the rotation procedure again. + Status `failed` is returned when the CAK cannot be configured. To recover, first + resolve any issues with your HPCS key, then patch this CAK with the same or new + key. Alternatively, you can delete this CAK if used for the `fallback` session. + """ + + OPERATIONAL = 'operational' + ROTATING = 'rotating' + ACTIVE = 'active' + INACTIVE = 'inactive' + FAILED = 'failed' + + + +class GatewayMacsecCakActiveDelta: + """ + This field will be present when the `status` of the MACsec CAK is `rotating` or + `inactive`. It may be present when the CAK `status` is `failed`. + This object denotes the MACsec CAK's values prior to beginning a CAK rotation and + represents the previous key still configured in the direct link's MACsec key chain. + This object will be removed when the MACsec CAK rotation completes, indicating that + the previous key has been removed from the key chain, and the current CAK's values are + in use. + + :param HpcsKeyReference key: A reference to a [Hyper Protect Crypto Service + Standard Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: The name identifies the connectivity association key (CAK) + within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to 64 + inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. + :param str status: Current status of the CAK. + Status `operational` is returned when the CAK is configured successfully. + Status `rotating` is returned during a key rotation. The CAK defined by + `active_delta` is still configured on the device and could be securing the + MACsec session. In the case of a primary CAK, the status will be `rotating` for + a period of time while waiting for the MACsec session to be secured with the new + CAK. After that time, the CAK will either enter `active` or `inactive` status. + Status `active` is returned when the CAK is configured successfully and is + currently used to secure the MACsec session. + Status `inactive` is returned when the CAK is configured successfully, but is + not currently used to secure the MACsec session. The CAK may enter `rotating` + status, and ultimately the `active` status, if it is found to be used to secure + the MACsec session. The CAK may never leave this status on its own (e.g. if + there is a key/key name mismatch). You are allowed to patch the CAK in this + state to start the rotation procedure again. + Status `failed` is returned when the CAK cannot be configured. To recover, first + resolve any issues with your HPCS key, then patch this CAK with the same or new + key. Alternatively, you can delete this CAK if used for the `fallback` session. """ def __init__( self, - crn: str, + key: 'HpcsKeyReference', + name: str, status: str, ) -> None: """ - Initialize a GatewayMacsecConfigFallbackCak object. - - :param str crn: connectivity association key crn. - :param str status: connectivity association key status. - """ - self.crn = crn + Initialize a GatewayMacsecCakActiveDelta object. + + :param HpcsKeyReference key: A reference to a [Hyper Protect Crypto Service + Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: The name identifies the connectivity association key (CAK) + within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to + 64 inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. + :param str status: Current status of the CAK. + Status `operational` is returned when the CAK is configured successfully. + Status `rotating` is returned during a key rotation. The CAK defined by + `active_delta` is still configured on the device and could be securing the + MACsec session. In the case of a primary CAK, the status will be `rotating` + for a period of time while waiting for the MACsec session to be secured + with the new CAK. After that time, the CAK will either enter `active` or + `inactive` status. + Status `active` is returned when the CAK is configured successfully and is + currently used to secure the MACsec session. + Status `inactive` is returned when the CAK is configured successfully, but + is not currently used to secure the MACsec session. The CAK may enter + `rotating` status, and ultimately the `active` status, if it is found to be + used to secure the MACsec session. The CAK may never leave this status on + its own (e.g. if there is a key/key name mismatch). You are allowed to + patch the CAK in this state to start the rotation procedure again. + Status `failed` is returned when the CAK cannot be configured. To recover, + first resolve any issues with your HPCS key, then patch this CAK with the + same or new key. Alternatively, you can delete this CAK if used for the + `fallback` session. + """ + self.key = key + self.name = name self.status = status @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigFallbackCak': - """Initialize a GatewayMacsecConfigFallbackCak object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecCakActiveDelta': + """Initialize a GatewayMacsecCakActiveDelta object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if (key := _dict.get('key')) is not None: + args['key'] = HpcsKeyReference.from_dict(key) else: - raise ValueError('Required property \'crn\' not present in GatewayMacsecConfigFallbackCak JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') + raise ValueError('Required property \'key\' not present in GatewayMacsecCakActiveDelta JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name else: - raise ValueError('Required property \'status\' not present in GatewayMacsecConfigFallbackCak JSON') + raise ValueError('Required property \'name\' not present in GatewayMacsecCakActiveDelta JSON') + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in GatewayMacsecCakActiveDelta JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigFallbackCak object from a json dictionary.""" + """Initialize a GatewayMacsecCakActiveDelta 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'key') and self.key is not None: + if isinstance(self.key, dict): + _dict['key'] = self.key + else: + _dict['key'] = self.key.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name if hasattr(self, 'status') and self.status is not None: _dict['status'] = self.status return _dict @@ -4842,118 +5576,96 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigFallbackCak object.""" + """Return a `str` version of this GatewayMacsecCakActiveDelta object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigFallbackCak') -> bool: + def __eq__(self, other: 'GatewayMacsecCakActiveDelta') -> 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: 'GatewayMacsecConfigFallbackCak') -> bool: + def __ne__(self, other: 'GatewayMacsecCakActiveDelta') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class StatusEnum(str, Enum): + """ + Current status of the CAK. + Status `operational` is returned when the CAK is configured successfully. + Status `rotating` is returned during a key rotation. The CAK defined by + `active_delta` is still configured on the device and could be securing the MACsec + session. In the case of a primary CAK, the status will be `rotating` for a period + of time while waiting for the MACsec session to be secured with the new CAK. After + that time, the CAK will either enter `active` or `inactive` status. + Status `active` is returned when the CAK is configured successfully and is + currently used to secure the MACsec session. + Status `inactive` is returned when the CAK is configured successfully, but is not + currently used to secure the MACsec session. The CAK may enter `rotating` status, + and ultimately the `active` status, if it is found to be used to secure the MACsec + session. The CAK may never leave this status on its own (e.g. if there is a + key/key name mismatch). You are allowed to patch the CAK in this state to start + the rotation procedure again. + Status `failed` is returned when the CAK cannot be configured. To recover, first + resolve any issues with your HPCS key, then patch this CAK with the same or new + key. Alternatively, you can delete this CAK if used for the `fallback` session. + """ + + OPERATIONAL = 'operational' + ROTATING = 'rotating' + ACTIVE = 'active' + INACTIVE = 'inactive' + FAILED = 'failed' + + + +class GatewayMacsecCakCollection: + """ + List of all connectivity association keys (CAKs) associated with the MACsec feature on + a direct link. -class GatewayMacsecConfigPatchTemplate: - """ - MACsec configuration information. When patching any macsec_config fields, no other - fields may be specified in the patch request. Contact IBM support for access to - MACsec. - A MACsec config cannot be added to a gateway created without MACsec. - - :attr bool active: (optional) Indicate whether MACsec protection should be - active (true) or inactive (false) for this MACsec enabled gateway. - :attr GatewayMacsecConfigPatchTemplateFallbackCak fallback_cak: (optional) - Fallback connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 - inclusive and contain only characters [a-fA-F0-9]. - The key material must be exactly 64 characters in length and contain only - [a-fA-F0-9]. - To clear the optional `fallback_cak` field patch its crn to `""`. - A gateway's `fallback_cak` crn cannot match its `primary_cak` crn. - :attr GatewayMacsecConfigPatchTemplatePrimaryCak primary_cak: (optional) Desired - primary connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 - inclusive and contain only characters [a-fA-F0-9]. - The key material must be exactly 64 characters in length and contain only - [a-fA-F0-9]. - A gateway's `primary_cak` crn cannot match its `fallback_cak` crn. - :attr int window_size: (optional) replay protection window size. + :param List[GatewayMacsecCak] caks: (optional) List of all connectivity + association keys (CAKs) associated with the MACsec feature on a direct link. """ def __init__( self, *, - active: bool = None, - fallback_cak: 'GatewayMacsecConfigPatchTemplateFallbackCak' = None, - primary_cak: 'GatewayMacsecConfigPatchTemplatePrimaryCak' = None, - window_size: int = None, + caks: Optional[List['GatewayMacsecCak']] = None, ) -> None: """ - Initialize a GatewayMacsecConfigPatchTemplate object. - - :param bool active: (optional) Indicate whether MACsec protection should be - active (true) or inactive (false) for this MACsec enabled gateway. - :param GatewayMacsecConfigPatchTemplateFallbackCak fallback_cak: (optional) - Fallback connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 - inclusive and contain only characters [a-fA-F0-9]. - The key material must be exactly 64 characters in length and contain only - [a-fA-F0-9]. - To clear the optional `fallback_cak` field patch its crn to `""`. - A gateway's `fallback_cak` crn cannot match its `primary_cak` crn. - :param GatewayMacsecConfigPatchTemplatePrimaryCak primary_cak: (optional) - Desired primary connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 - inclusive and contain only characters [a-fA-F0-9]. - The key material must be exactly 64 characters in length and contain only - [a-fA-F0-9]. - A gateway's `primary_cak` crn cannot match its `fallback_cak` crn. - :param int window_size: (optional) replay protection window size. + Initialize a GatewayMacsecCakCollection object. + + :param List[GatewayMacsecCak] caks: (optional) List of all connectivity + association keys (CAKs) associated with the MACsec feature on a direct + link. """ - self.active = active - self.fallback_cak = fallback_cak - self.primary_cak = primary_cak - self.window_size = window_size + self.caks = caks @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigPatchTemplate': - """Initialize a GatewayMacsecConfigPatchTemplate object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecCakCollection': + """Initialize a GatewayMacsecCakCollection object from a json dictionary.""" args = {} - if 'active' in _dict: - args['active'] = _dict.get('active') - if 'fallback_cak' in _dict: - args['fallback_cak'] = GatewayMacsecConfigPatchTemplateFallbackCak.from_dict(_dict.get('fallback_cak')) - if 'primary_cak' in _dict: - args['primary_cak'] = GatewayMacsecConfigPatchTemplatePrimaryCak.from_dict(_dict.get('primary_cak')) - if 'window_size' in _dict: - args['window_size'] = _dict.get('window_size') + if (caks := _dict.get('caks')) is not None: + args['caks'] = [GatewayMacsecCak.from_dict(v) for v in caks] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigPatchTemplate object from a json dictionary.""" + """Initialize a GatewayMacsecCakCollection 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, 'active') and self.active is not None: - _dict['active'] = self.active - if hasattr(self, 'fallback_cak') and self.fallback_cak is not None: - if isinstance(self.fallback_cak, dict): - _dict['fallback_cak'] = self.fallback_cak - else: - _dict['fallback_cak'] = self.fallback_cak.to_dict() - if hasattr(self, 'primary_cak') and self.primary_cak is not None: - if isinstance(self.primary_cak, dict): - _dict['primary_cak'] = self.primary_cak - else: - _dict['primary_cak'] = self.primary_cak.to_dict() - if hasattr(self, 'window_size') and self.window_size is not None: - _dict['window_size'] = self.window_size + if hasattr(self, 'caks') and self.caks is not None: + caks_list = [] + for v in self.caks: + if isinstance(v, dict): + caks_list.append(v) + else: + caks_list.append(v.to_dict()) + _dict['caks'] = caks_list return _dict def _to_dict(self): @@ -4961,63 +5673,84 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigPatchTemplate object.""" + """Return a `str` version of this GatewayMacsecCakCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigPatchTemplate') -> bool: + def __eq__(self, other: 'GatewayMacsecCakCollection') -> 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: 'GatewayMacsecConfigPatchTemplate') -> bool: + def __ne__(self, other: 'GatewayMacsecCakCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class GatewayMacsecConfigPatchTemplateFallbackCak: +class GatewayMacsecCakPatch: """ - Fallback connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and - contain only characters [a-fA-F0-9]. The key material must be exactly 64 characters in - length and contain only [a-fA-F0-9]. - To clear the optional `fallback_cak` field patch its crn to `""`. - A gateway's `fallback_cak` crn cannot match its `primary_cak` crn. + Patch fields for CAK of MACsec configuration on a direct link. + When rotating a CAK, patch both the `name` and `key` fields simultaneously. Both must + have new values and cannot match with another CAK. Neither `name` nor `key` is allowed + to be patched on its own. - :attr str crn: connectivity association key crn. + :param HpcsKeyIdentity key: (optional) A [Hyper Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: (optional) The name identifies the connectivity association key + (CAK) within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to 64 + inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. """ def __init__( self, - crn: str, + *, + key: Optional['HpcsKeyIdentity'] = None, + name: Optional[str] = None, ) -> None: """ - Initialize a GatewayMacsecConfigPatchTemplateFallbackCak object. + Initialize a GatewayMacsecCakPatch object. - :param str crn: connectivity association key crn. + :param HpcsKeyIdentity key: (optional) A [Hyper Protect Crypto Service + Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: (optional) The name identifies the connectivity + association key (CAK) within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to + 64 inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. """ - self.crn = crn + self.key = key + self.name = name @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigPatchTemplateFallbackCak': - """Initialize a GatewayMacsecConfigPatchTemplateFallbackCak object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecCakPatch': + """Initialize a GatewayMacsecCakPatch object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in GatewayMacsecConfigPatchTemplateFallbackCak JSON') + if (key := _dict.get('key')) is not None: + args['key'] = HpcsKeyIdentity.from_dict(key) + if (name := _dict.get('name')) is not None: + args['name'] = name return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigPatchTemplateFallbackCak object from a json dictionary.""" + """Initialize a GatewayMacsecCakPatch 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'key') and self.key is not None: + if isinstance(self.key, dict): + _dict['key'] = self.key + else: + _dict['key'] = self.key.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name return _dict def _to_dict(self): @@ -5025,62 +5758,100 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigPatchTemplateFallbackCak object.""" + """Return a `str` version of this GatewayMacsecCakPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigPatchTemplateFallbackCak') -> bool: + def __eq__(self, other: 'GatewayMacsecCakPatch') -> 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: 'GatewayMacsecConfigPatchTemplateFallbackCak') -> bool: + def __ne__(self, other: 'GatewayMacsecCakPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class GatewayMacsecConfigPatchTemplatePrimaryCak: +class GatewayMacsecCakPrototype: """ - Desired primary connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and - contain only characters [a-fA-F0-9]. The key material must be exactly 64 characters in - length and contain only [a-fA-F0-9]. - A gateway's `primary_cak` crn cannot match its `fallback_cak` crn. + The prototype for a connectivity association key (CAK) used in the MACsec Key + Agreement (MKA) protocol. - :attr str crn: connectivity association key crn. + :param HpcsKeyIdentity key: A [Hyper Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: The name identifies the connectivity association key (CAK) + within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to 64 + inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. + :param str session: The intended session the key will be used to secure. + If the `primary` MACsec session fails due to a key/key name mismatch on the + peers, the `fallback` session can take over. + There must be a `primary` session CAK. A `fallback` CAK is optional. """ def __init__( self, - crn: str, + key: 'HpcsKeyIdentity', + name: str, + session: str, ) -> None: """ - Initialize a GatewayMacsecConfigPatchTemplatePrimaryCak object. - - :param str crn: connectivity association key crn. - """ - self.crn = crn + Initialize a GatewayMacsecCakPrototype object. + + :param HpcsKeyIdentity key: A [Hyper Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + :param str name: The name identifies the connectivity association key (CAK) + within the MACsec key chain. + The CAK's `name` must be a hexadecimal string of even lengths between 2 to + 64 inclusive. + This value, along with the material of the `key`, must match on the MACsec + peers. + :param str session: The intended session the key will be used to secure. + If the `primary` MACsec session fails due to a key/key name mismatch on the + peers, the `fallback` session can take over. + There must be a `primary` session CAK. A `fallback` CAK is optional. + """ + self.key = key + self.name = name + self.session = session @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigPatchTemplatePrimaryCak': - """Initialize a GatewayMacsecConfigPatchTemplatePrimaryCak object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecCakPrototype': + """Initialize a GatewayMacsecCakPrototype object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if (key := _dict.get('key')) is not None: + args['key'] = HpcsKeyIdentity.from_dict(key) else: - raise ValueError('Required property \'crn\' not present in GatewayMacsecConfigPatchTemplatePrimaryCak JSON') + raise ValueError('Required property \'key\' not present in GatewayMacsecCakPrototype JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in GatewayMacsecCakPrototype JSON') + if (session := _dict.get('session')) is not None: + args['session'] = session + else: + raise ValueError('Required property \'session\' not present in GatewayMacsecCakPrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigPatchTemplatePrimaryCak object from a json dictionary.""" + """Initialize a GatewayMacsecCakPrototype 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'key') and self.key is not None: + if isinstance(self.key, dict): + _dict['key'] = self.key + else: + _dict['key'] = self.key.to_dict() + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'session') and self.session is not None: + _dict['session'] = self.session return _dict def _to_dict(self): @@ -5088,68 +5859,117 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigPatchTemplatePrimaryCak object.""" + """Return a `str` version of this GatewayMacsecCakPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigPatchTemplatePrimaryCak') -> bool: + def __eq__(self, other: 'GatewayMacsecCakPrototype') -> 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: 'GatewayMacsecConfigPatchTemplatePrimaryCak') -> bool: + def __ne__(self, other: 'GatewayMacsecCakPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class SessionEnum(str, Enum): + """ + The intended session the key will be used to secure. + If the `primary` MACsec session fails due to a key/key name mismatch on the peers, + the `fallback` session can take over. + There must be a `primary` session CAK. A `fallback` CAK is optional. + """ + + PRIMARY = 'primary' + FALLBACK = 'fallback' + + -class GatewayMacsecConfigPrimaryCak: +class GatewayMacsecPatch: """ - desired primary connectivity association key. + Patch fields for MACsec configuration of a Direct Link gateway. - :attr str crn: connectivity association key crn. - :attr str status: connectivity association key status. + :param bool active: (optional) Sets the MACsec feature to be active (true) or + inactive (false) for a gateway. + :param SakRekeyPatch sak_rekey: (optional) Determines how SAK rekeying occurs. + It is either timer based or based on the amount of used packet numbers. + :param str security_policy: (optional) Determines how packets without MACsec + headers are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy should + be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy should + be used to prefer network availability over security. + :param int window_size: (optional) The window size determines the number of + frames in a window for replay protection. + Replay protection is used to counter replay attacks. Frames within a window size + can be out of order and are not replay protected. """ def __init__( self, - crn: str, - status: str, + *, + active: Optional[bool] = None, + sak_rekey: Optional['SakRekeyPatch'] = None, + security_policy: Optional[str] = None, + window_size: Optional[int] = None, ) -> None: """ - Initialize a GatewayMacsecConfigPrimaryCak object. - - :param str crn: connectivity association key crn. - :param str status: connectivity association key status. + Initialize a GatewayMacsecPatch object. + + :param bool active: (optional) Sets the MACsec feature to be active (true) + or inactive (false) for a gateway. + :param SakRekeyPatch sak_rekey: (optional) Determines how SAK rekeying + occurs. It is either timer based or based on the amount of used packet + numbers. + :param str security_policy: (optional) Determines how packets without + MACsec headers are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy + should be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy + should be used to prefer network availability over security. + :param int window_size: (optional) The window size determines the number of + frames in a window for replay protection. + Replay protection is used to counter replay attacks. Frames within a window + size can be out of order and are not replay protected. """ - self.crn = crn - self.status = status + self.active = active + self.sak_rekey = sak_rekey + self.security_policy = security_policy + self.window_size = window_size @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigPrimaryCak': - """Initialize a GatewayMacsecConfigPrimaryCak object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecPatch': + """Initialize a GatewayMacsecPatch object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in GatewayMacsecConfigPrimaryCak JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in GatewayMacsecConfigPrimaryCak JSON') + if (active := _dict.get('active')) is not None: + args['active'] = active + if (sak_rekey := _dict.get('sak_rekey')) is not None: + args['sak_rekey'] = sak_rekey + if (security_policy := _dict.get('security_policy')) is not None: + args['security_policy'] = security_policy + if (window_size := _dict.get('window_size')) is not None: + args['window_size'] = window_size return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigPrimaryCak object from a json dictionary.""" + """Initialize a GatewayMacsecPatch 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'active') and self.active is not None: + _dict['active'] = self.active + if hasattr(self, 'sak_rekey') and self.sak_rekey is not None: + if isinstance(self.sak_rekey, dict): + _dict['sak_rekey'] = self.sak_rekey + else: + _dict['sak_rekey'] = self.sak_rekey.to_dict() + if hasattr(self, 'security_policy') and self.security_policy is not None: + _dict['security_policy'] = self.security_policy + if hasattr(self, 'window_size') and self.window_size is not None: + _dict['window_size'] = self.window_size return _dict def _to_dict(self): @@ -5157,96 +5977,125 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigPrimaryCak object.""" + """Return a `str` version of this GatewayMacsecPatch object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigPrimaryCak') -> bool: + def __eq__(self, other: 'GatewayMacsecPatch') -> 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: 'GatewayMacsecConfigPrimaryCak') -> bool: + def __ne__(self, other: 'GatewayMacsecPatch') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class SecurityPolicyEnum(str, Enum): + """ + Determines how packets without MACsec headers are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy should be + used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy should + be used to prefer network availability over security. + """ + + MUST_SECURE = 'must_secure' + SHOULD_SECURE = 'should_secure' + -class GatewayMacsecConfigTemplate: + +class GatewayMacsecPrototype: """ - MACsec configuration information. Contact IBM support for access to MACsec. + MACsec configuration information of a Direct Link gateway. - :attr bool active: Indicate whether MACsec protection should be active (true) or - inactive (false) for this MACsec enabled gateway. - :attr GatewayMacsecConfigTemplateFallbackCak fallback_cak: (optional) Fallback - connectivity association key. - The `fallback_cak` crn cannot match the `primary_cak` crn. - MACsec keys must be type=standard with key name lengths between 2 to 64 - inclusive and contain only characters [a-fA-F0-9]. - The key material must be exactly 64 characters in length and contain only - [a-fA-F0-9]. - :attr GatewayMacsecConfigTemplatePrimaryCak primary_cak: Desired primary - connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 - inclusive and contain only characters [a-fA-F0-9]. - The key material must be exactly 64 characters in length and contain only - [a-fA-F0-9]. - :attr int window_size: (optional) replay protection window size. + :param bool active: Determines if the MACsec feature should initially be active + (true) or inactive (false) for a gateway. + :param List[GatewayMacsecCakPrototype] caks: List of all connectivity + association keys (CAKs) to be associated associated with the MACsec feature on a + direct link. + There must be at least one CAK with `session`: `primary`. There can be at most + one CAK with `session`: `fallback` + All CAKs must reference a unique key. + :param SakRekeyPrototype sak_rekey: Determines how SAK rekeying occurs. It is + either timer based or based on the amount of used packet numbers. + :param str security_policy: Determines how packets without MACsec headers are + handled. + `must_secure` - Packets without MACsec headers are dropped. This policy should + be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy should + be used to prefer network availability over security. + :param int window_size: (optional) The window size determines the number of + frames in a window for replay protection. + Replay protection is used to counter replay attacks. Frames within a window size + can be out of order and are not replay protected. """ def __init__( self, active: bool, - primary_cak: 'GatewayMacsecConfigTemplatePrimaryCak', + caks: List['GatewayMacsecCakPrototype'], + sak_rekey: 'SakRekeyPrototype', + security_policy: str, *, - fallback_cak: 'GatewayMacsecConfigTemplateFallbackCak' = None, - window_size: int = None, + window_size: Optional[int] = None, ) -> None: """ - Initialize a GatewayMacsecConfigTemplate object. - - :param bool active: Indicate whether MACsec protection should be active - (true) or inactive (false) for this MACsec enabled gateway. - :param GatewayMacsecConfigTemplatePrimaryCak primary_cak: Desired primary - connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 - inclusive and contain only characters [a-fA-F0-9]. - The key material must be exactly 64 characters in length and contain only - [a-fA-F0-9]. - :param GatewayMacsecConfigTemplateFallbackCak fallback_cak: (optional) - Fallback connectivity association key. - The `fallback_cak` crn cannot match the `primary_cak` crn. - MACsec keys must be type=standard with key name lengths between 2 to 64 - inclusive and contain only characters [a-fA-F0-9]. - The key material must be exactly 64 characters in length and contain only - [a-fA-F0-9]. - :param int window_size: (optional) replay protection window size. + Initialize a GatewayMacsecPrototype object. + + :param bool active: Determines if the MACsec feature should initially be + active (true) or inactive (false) for a gateway. + :param List[GatewayMacsecCakPrototype] caks: List of all connectivity + association keys (CAKs) to be associated associated with the MACsec feature + on a direct link. + There must be at least one CAK with `session`: `primary`. There can be at + most one CAK with `session`: `fallback` + All CAKs must reference a unique key. + :param SakRekeyPrototype sak_rekey: Determines how SAK rekeying occurs. It + is either timer based or based on the amount of used packet numbers. + :param str security_policy: Determines how packets without MACsec headers + are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy + should be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy + should be used to prefer network availability over security. + :param int window_size: (optional) The window size determines the number of + frames in a window for replay protection. + Replay protection is used to counter replay attacks. Frames within a window + size can be out of order and are not replay protected. """ self.active = active - self.fallback_cak = fallback_cak - self.primary_cak = primary_cak + self.caks = caks + self.sak_rekey = sak_rekey + self.security_policy = security_policy self.window_size = window_size @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigTemplate': - """Initialize a GatewayMacsecConfigTemplate object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecPrototype': + """Initialize a GatewayMacsecPrototype object from a json dictionary.""" args = {} - if 'active' in _dict: - args['active'] = _dict.get('active') - else: - raise ValueError('Required property \'active\' not present in GatewayMacsecConfigTemplate JSON') - if 'fallback_cak' in _dict: - args['fallback_cak'] = GatewayMacsecConfigTemplateFallbackCak.from_dict(_dict.get('fallback_cak')) - if 'primary_cak' in _dict: - args['primary_cak'] = GatewayMacsecConfigTemplatePrimaryCak.from_dict(_dict.get('primary_cak')) - else: - raise ValueError('Required property \'primary_cak\' not present in GatewayMacsecConfigTemplate JSON') - if 'window_size' in _dict: - args['window_size'] = _dict.get('window_size') + if (active := _dict.get('active')) is not None: + args['active'] = active + else: + raise ValueError('Required property \'active\' not present in GatewayMacsecPrototype JSON') + if (caks := _dict.get('caks')) is not None: + args['caks'] = [GatewayMacsecCakPrototype.from_dict(v) for v in caks] + else: + raise ValueError('Required property \'caks\' not present in GatewayMacsecPrototype JSON') + if (sak_rekey := _dict.get('sak_rekey')) is not None: + args['sak_rekey'] = sak_rekey + else: + raise ValueError('Required property \'sak_rekey\' not present in GatewayMacsecPrototype JSON') + if (security_policy := _dict.get('security_policy')) is not None: + args['security_policy'] = security_policy + else: + raise ValueError('Required property \'security_policy\' not present in GatewayMacsecPrototype JSON') + if (window_size := _dict.get('window_size')) is not None: + args['window_size'] = window_size return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigTemplate object from a json dictionary.""" + """Initialize a GatewayMacsecPrototype object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -5254,16 +6103,21 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'active') and self.active is not None: _dict['active'] = self.active - if hasattr(self, 'fallback_cak') and self.fallback_cak is not None: - if isinstance(self.fallback_cak, dict): - _dict['fallback_cak'] = self.fallback_cak + if hasattr(self, 'caks') and self.caks is not None: + caks_list = [] + for v in self.caks: + if isinstance(v, dict): + caks_list.append(v) + else: + caks_list.append(v.to_dict()) + _dict['caks'] = caks_list + if hasattr(self, 'sak_rekey') and self.sak_rekey is not None: + if isinstance(self.sak_rekey, dict): + _dict['sak_rekey'] = self.sak_rekey else: - _dict['fallback_cak'] = self.fallback_cak.to_dict() - if hasattr(self, 'primary_cak') and self.primary_cak is not None: - if isinstance(self.primary_cak, dict): - _dict['primary_cak'] = self.primary_cak - else: - _dict['primary_cak'] = self.primary_cak.to_dict() + _dict['sak_rekey'] = self.sak_rekey.to_dict() + if hasattr(self, 'security_policy') and self.security_policy is not None: + _dict['security_policy'] = self.security_policy if hasattr(self, 'window_size') and self.window_size is not None: _dict['window_size'] = self.window_size return _dict @@ -5273,62 +6127,131 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigTemplate object.""" + """Return a `str` version of this GatewayMacsecPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigTemplate') -> bool: + def __eq__(self, other: 'GatewayMacsecPrototype') -> 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: 'GatewayMacsecConfigTemplate') -> bool: + def __ne__(self, other: 'GatewayMacsecPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class SecurityPolicyEnum(str, Enum): + """ + Determines how packets without MACsec headers are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy should be + used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy should + be used to prefer network availability over security. + """ + + MUST_SECURE = 'must_secure' + SHOULD_SECURE = 'should_secure' + + -class GatewayMacsecConfigTemplateFallbackCak: +class GatewayMacsecReference: """ - Fallback connectivity association key. - The `fallback_cak` crn cannot match the `primary_cak` crn. MACsec keys must be - type=standard with key name lengths between 2 to 64 inclusive and contain only - characters [a-fA-F0-9]. The key material must be exactly 64 characters in length and - contain only [a-fA-F0-9]. + MACsec configuration information of a Direct Link gateway. - :attr str crn: connectivity association key crn. + :param bool active: Indicates if the MACsec feature is currently active (true) + or inactive (false) for a gateway. + :param str security_policy: Determines how packets without MACsec headers are + handled. + `must_secure` - Packets without MACsec headers are dropped. This policy should + be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy should + be used to prefer network availability over security. + :param str status: Current status of MACsec on this direct link. + Status `offline` is returned when MACsec is inactive and during direct link + creation. + Status `deleting` is returned when MACsec during removal of MACsec from the + direct link and during direct link deletion. + See `status_reasons[]` for possible remediation of the `failed` `status`. + :param List[GatewayMacsecStatusReason] status_reasons: Context for certain + values of `status`. """ def __init__( self, - crn: str, + active: bool, + security_policy: str, + status: str, + status_reasons: List['GatewayMacsecStatusReason'], ) -> None: """ - Initialize a GatewayMacsecConfigTemplateFallbackCak object. - - :param str crn: connectivity association key crn. + Initialize a GatewayMacsecReference object. + + :param bool active: Indicates if the MACsec feature is currently active + (true) or inactive (false) for a gateway. + :param str security_policy: Determines how packets without MACsec headers + are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy + should be used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy + should be used to prefer network availability over security. + :param str status: Current status of MACsec on this direct link. + Status `offline` is returned when MACsec is inactive and during direct link + creation. + Status `deleting` is returned when MACsec during removal of MACsec from the + direct link and during direct link deletion. + See `status_reasons[]` for possible remediation of the `failed` `status`. + :param List[GatewayMacsecStatusReason] status_reasons: Context for certain + values of `status`. """ - self.crn = crn + self.active = active + self.security_policy = security_policy + self.status = status + self.status_reasons = status_reasons @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigTemplateFallbackCak': - """Initialize a GatewayMacsecConfigTemplateFallbackCak object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecReference': + """Initialize a GatewayMacsecReference object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if (active := _dict.get('active')) is not None: + args['active'] = active + else: + raise ValueError('Required property \'active\' not present in GatewayMacsecReference JSON') + if (security_policy := _dict.get('security_policy')) is not None: + args['security_policy'] = security_policy + else: + raise ValueError('Required property \'security_policy\' not present in GatewayMacsecReference JSON') + if (status := _dict.get('status')) is not None: + args['status'] = status else: - raise ValueError('Required property \'crn\' not present in GatewayMacsecConfigTemplateFallbackCak JSON') + raise ValueError('Required property \'status\' not present in GatewayMacsecReference JSON') + if (status_reasons := _dict.get('status_reasons')) is not None: + args['status_reasons'] = [GatewayMacsecStatusReason.from_dict(v) for v in status_reasons] + else: + raise ValueError('Required property \'status_reasons\' not present in GatewayMacsecReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigTemplateFallbackCak object from a json dictionary.""" + """Initialize a GatewayMacsecReference 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'active') and self.active is not None: + _dict['active'] = self.active + if hasattr(self, 'security_policy') and self.security_policy is not None: + _dict['security_policy'] = self.security_policy + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'status_reasons') and self.status_reasons is not None: + status_reasons_list = [] + for v in self.status_reasons: + if isinstance(v, dict): + status_reasons_list.append(v) + else: + status_reasons_list.append(v.to_dict()) + _dict['status_reasons'] = status_reasons_list return _dict def _to_dict(self): @@ -5336,61 +6259,117 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigTemplateFallbackCak object.""" + """Return a `str` version of this GatewayMacsecReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigTemplateFallbackCak') -> bool: + def __eq__(self, other: 'GatewayMacsecReference') -> 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: 'GatewayMacsecConfigTemplateFallbackCak') -> bool: + def __ne__(self, other: 'GatewayMacsecReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class SecurityPolicyEnum(str, Enum): + """ + Determines how packets without MACsec headers are handled. + `must_secure` - Packets without MACsec headers are dropped. This policy should be + used to prefer security over network availability. + `should_secure` - Packets without MACsec headers are allowed. This policy should + be used to prefer network availability over security. + """ + + MUST_SECURE = 'must_secure' + SHOULD_SECURE = 'should_secure' + + + class StatusEnum(str, Enum): + """ + Current status of MACsec on this direct link. + Status `offline` is returned when MACsec is inactive and during direct link + creation. + Status `deleting` is returned when MACsec during removal of MACsec from the direct + link and during direct link deletion. + See `status_reasons[]` for possible remediation of the `failed` `status`. + """ + + INIT = 'init' + PENDING = 'pending' + OFFLINE = 'offline' + SECURED = 'secured' + FAILED = 'failed' + DELETING = 'deleting' + -class GatewayMacsecConfigTemplatePrimaryCak: + +class GatewayMacsecStatusReason: """ - Desired primary connectivity association key. - MACsec keys must be type=standard with key name lengths between 2 to 64 inclusive and - contain only characters [a-fA-F0-9]. The key material must be exactly 64 characters in - length and contain only [a-fA-F0-9]. + A reason for the current `status`. - :attr str crn: connectivity association key crn. + :param str code: A reason code for the status: + - `macsec_cak_failed`: At least one of the connectivity association keys (CAKs) + associated with the MACsec configuration was unable to be configured on the + direct link gateway. Refer to the `status` of the CAKs associated with the + MACsec configuration to find the the source of this reason. + :param str message: An explanation of the status reason. + :param str more_info: (optional) Link to documentation about this status reason. """ def __init__( self, - crn: str, + code: str, + message: str, + *, + more_info: Optional[str] = None, ) -> None: """ - Initialize a GatewayMacsecConfigTemplatePrimaryCak object. + Initialize a GatewayMacsecStatusReason object. - :param str crn: connectivity association key crn. + :param str code: A reason code for the status: + - `macsec_cak_failed`: At least one of the connectivity association keys + (CAKs) associated with the MACsec configuration was unable to be configured + on the direct link gateway. Refer to the `status` of the CAKs associated + with the MACsec configuration to find the the source of this reason. + :param str message: An explanation of the status reason. + :param str more_info: (optional) Link to documentation about this status + reason. """ - self.crn = crn + self.code = code + self.message = message + self.more_info = more_info @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayMacsecConfigTemplatePrimaryCak': - """Initialize a GatewayMacsecConfigTemplatePrimaryCak object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayMacsecStatusReason': + """Initialize a GatewayMacsecStatusReason object from a json dictionary.""" args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') + if (code := _dict.get('code')) is not None: + args['code'] = code else: - raise ValueError('Required property \'crn\' not present in GatewayMacsecConfigTemplatePrimaryCak JSON') + raise ValueError('Required property \'code\' not present in GatewayMacsecStatusReason JSON') + if (message := _dict.get('message')) is not None: + args['message'] = message + else: + raise ValueError('Required property \'message\' not present in GatewayMacsecStatusReason JSON') + if (more_info := _dict.get('more_info')) is not None: + args['more_info'] = more_info return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayMacsecConfigTemplatePrimaryCak object from a json dictionary.""" + """Initialize a GatewayMacsecStatusReason 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn + if hasattr(self, 'code') and self.code is not None: + _dict['code'] = self.code + if hasattr(self, 'message') and self.message is not None: + _dict['message'] = self.message + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info return _dict def _to_dict(self): @@ -5398,43 +6377,53 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayMacsecConfigTemplatePrimaryCak object.""" + """Return a `str` version of this GatewayMacsecStatusReason object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayMacsecConfigTemplatePrimaryCak') -> bool: + def __eq__(self, other: 'GatewayMacsecStatusReason') -> 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: 'GatewayMacsecConfigTemplatePrimaryCak') -> bool: + def __ne__(self, other: 'GatewayMacsecStatusReason') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class CodeEnum(str, Enum): + """ + A reason code for the status: + - `macsec_cak_failed`: At least one of the connectivity association keys (CAKs) + associated with the MACsec configuration was unable to be configured on the direct + link gateway. Refer to the `status` of the CAKs associated with the MACsec + configuration to find the the source of this reason. + """ + + MACSEC_CAK_FAILED = 'macsec_cak_failed' + + class GatewayPatchTemplate: """ patch gateway template. - :attr GatewayPatchTemplateAuthenticationKey authentication_key: (optional) The - identity of the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original string - must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. - :attr GatewayBfdPatchTemplate bfd_config: (optional) BFD configuration + :param AuthenticationKeyIdentity authentication_key: (optional) A reference to a + key to use as the BGP MD5 authentication key. + Patch to `null` to disable BGP MD5 authentication. + :param GatewayBfdPatchTemplate bfd_config: (optional) BFD configuration information. - :attr int bgp_asn: (optional) The autonomous system number (ASN) of Border + :param int bgp_asn: (optional) The autonomous system number (ASN) of Border Gateway Protocol (BGP) configuration for the IBM side of the DL 2.0 gateway. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR is the new CIDR - (Classless Inter-Domain Routing) value to be updated on customer edge router for - the DL 2.0 gateway. + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR is the new + CIDR (Classless Inter-Domain Routing) value to be updated on customer edge + router for the DL 2.0 gateway. Customer edge IP and IBM IP should be in the same network. Updating customer edge router CIDR should be accompanied with IBM CIDR in the request. Update customer edge router IP to a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR is the new CIDR (Classless + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR is the new CIDR (Classless Inter-Domain Routing) value to be updated on IBM edge router for the DL 2.0 gateway. IBM IP and customer edge IP should be in the same network. Updating IBM CIDR @@ -5443,40 +6432,35 @@ class GatewayPatchTemplate: of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 default_export_route_filter: (optional) The default directional route + :param str default_export_route_filter: (optional) The default directional route filter action that applies to routes that do not match any directional route filters. - :attr str default_import_route_filter: (optional) The default directional route + :param str default_import_route_filter: (optional) The default directional route filter action that applies to routes that do not match any directional route filters. - :attr bool global_: (optional) Gateways with global routing (`true`) can connect - to networks outside of their associated region. - :attr str loa_reject_reason: (optional) Use this field during LOA rejection to + :param bool global_: (optional) Gateways with global routing (`true`) can + connect to networks outside of their associated region. + :param str loa_reject_reason: (optional) Use this field during LOA rejection to provide the reason for the rejection. Only allowed for type=dedicated gateways. - :attr GatewayMacsecConfigPatchTemplate macsec_config: (optional) MACsec - configuration information. When patching any macsec_config fields, no other - fields may be specified in the patch request. Contact IBM support for access to - MACsec. - A MACsec config cannot be added to a gateway created without MACsec. - :attr bool metered: (optional) Metered billing option. When `true` gateway + :param bool metered: (optional) Metered billing option. When `true` gateway usage is billed per gigabyte. When `false` there is no per gigabyte usage charge, instead a flat rate is charged for the gateway. - :attr str name: (optional) The unique user-defined name for this gateway. - :attr str operational_status: (optional) Gateway operational status. + :param str name: (optional) The unique user-defined name for this gateway. + :param str operational_status: (optional) Gateway operational status. For gateways pending LOA approval, patch operational_status to the appropriate value to approve or reject its LOA. When rejecting an LOA, provide reject reasoning in `loa_reject_reason`. Only allowed for type=dedicated gateways. - :attr str patch_panel_completion_notice: (optional) Gateway patch panel complete - notification from implementation team. - :attr int speed_mbps: (optional) Gateway speed in megabits per second. - :attr int vlan: (optional) The VLAN to configure for this gateway. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param int speed_mbps: (optional) Gateway speed in megabits per second. + :param int vlan: (optional) The VLAN to configure for this gateway. Specify `null` to remove an existing VLAN configuration. The gateway must have a `type` of `dedicated`. """ @@ -5484,32 +6468,29 @@ class GatewayPatchTemplate: def __init__( self, *, - authentication_key: 'GatewayPatchTemplateAuthenticationKey' = None, - bfd_config: 'GatewayBfdPatchTemplate' = None, - bgp_asn: int = None, - bgp_cer_cidr: str = None, - bgp_ibm_cidr: str = None, - connection_mode: str = None, - default_export_route_filter: str = None, - default_import_route_filter: str = None, - global_: bool = None, - loa_reject_reason: str = None, - macsec_config: 'GatewayMacsecConfigPatchTemplate' = None, - metered: bool = None, - name: str = None, - operational_status: str = None, - patch_panel_completion_notice: str = None, - speed_mbps: int = None, - vlan: int = None, + authentication_key: Optional['AuthenticationKeyIdentity'] = None, + bfd_config: Optional['GatewayBfdPatchTemplate'] = None, + bgp_asn: Optional[int] = None, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_cidr: Optional[str] = None, + connection_mode: Optional[str] = None, + default_export_route_filter: Optional[str] = None, + default_import_route_filter: Optional[str] = None, + global_: Optional[bool] = None, + loa_reject_reason: Optional[str] = None, + metered: Optional[bool] = None, + name: Optional[str] = None, + operational_status: Optional[str] = None, + patch_panel_completion_notice: Optional[str] = None, + speed_mbps: Optional[int] = None, + vlan: Optional[int] = None, ) -> None: """ Initialize a GatewayPatchTemplate object. - :param GatewayPatchTemplateAuthenticationKey authentication_key: (optional) - The identity of the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original - string must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. + :param AuthenticationKeyIdentity authentication_key: (optional) A reference + to a key to use as the BGP MD5 authentication key. + Patch to `null` to disable BGP MD5 authentication. :param GatewayBfdPatchTemplate bfd_config: (optional) BFD configuration information. :param int bgp_asn: (optional) The autonomous system number (ASN) of Border @@ -5551,11 +6532,6 @@ def __init__( :param str loa_reject_reason: (optional) Use this field during LOA rejection to provide the reason for the rejection. Only allowed for type=dedicated gateways. - :param GatewayMacsecConfigPatchTemplate macsec_config: (optional) MACsec - configuration information. When patching any macsec_config fields, no - other fields may be specified in the patch request. Contact IBM support - for access to MACsec. - A MACsec config cannot be added to a gateway created without MACsec. :param bool metered: (optional) Metered billing option. When `true` gateway usage is billed per gigabyte. When `false` there is no per gigabyte usage charge, instead a flat rate is charged for the gateway. @@ -5582,7 +6558,6 @@ def __init__( self.default_import_route_filter = default_import_route_filter self.global_ = global_ self.loa_reject_reason = loa_reject_reason - self.macsec_config = macsec_config self.metered = metered self.name = name self.operational_status = operational_status @@ -5594,40 +6569,38 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayPatchTemplate': """Initialize a GatewayPatchTemplate object from a json dictionary.""" args = {} - if 'authentication_key' in _dict: - args['authentication_key'] = GatewayPatchTemplateAuthenticationKey.from_dict(_dict.get('authentication_key')) - if 'bfd_config' in _dict: - args['bfd_config'] = GatewayBfdPatchTemplate.from_dict(_dict.get('bfd_config')) - if 'bgp_asn' in _dict: - args['bgp_asn'] = _dict.get('bgp_asn') - if 'bgp_cer_cidr' in _dict: - args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr') - if 'bgp_ibm_cidr' in _dict: - args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr') - if 'connection_mode' in _dict: - args['connection_mode'] = _dict.get('connection_mode') - if 'default_export_route_filter' in _dict: - args['default_export_route_filter'] = _dict.get('default_export_route_filter') - if 'default_import_route_filter' in _dict: - args['default_import_route_filter'] = _dict.get('default_import_route_filter') - if 'global' in _dict: - args['global_'] = _dict.get('global') - if 'loa_reject_reason' in _dict: - args['loa_reject_reason'] = _dict.get('loa_reject_reason') - if 'macsec_config' in _dict: - args['macsec_config'] = GatewayMacsecConfigPatchTemplate.from_dict(_dict.get('macsec_config')) - if 'metered' in _dict: - args['metered'] = _dict.get('metered') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'operational_status' in _dict: - args['operational_status'] = _dict.get('operational_status') - if 'patch_panel_completion_notice' in _dict: - args['patch_panel_completion_notice'] = _dict.get('patch_panel_completion_notice') - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') - if 'vlan' in _dict: - args['vlan'] = _dict.get('vlan') + if (authentication_key := _dict.get('authentication_key')) is not None: + args['authentication_key'] = authentication_key + if (bfd_config := _dict.get('bfd_config')) is not None: + args['bfd_config'] = GatewayBfdPatchTemplate.from_dict(bfd_config) + if (bgp_asn := _dict.get('bgp_asn')) is not None: + args['bgp_asn'] = bgp_asn + if (bgp_cer_cidr := _dict.get('bgp_cer_cidr')) is not None: + args['bgp_cer_cidr'] = bgp_cer_cidr + if (bgp_ibm_cidr := _dict.get('bgp_ibm_cidr')) is not None: + args['bgp_ibm_cidr'] = bgp_ibm_cidr + if (connection_mode := _dict.get('connection_mode')) is not None: + args['connection_mode'] = connection_mode + if (default_export_route_filter := _dict.get('default_export_route_filter')) is not None: + args['default_export_route_filter'] = default_export_route_filter + if (default_import_route_filter := _dict.get('default_import_route_filter')) is not None: + args['default_import_route_filter'] = default_import_route_filter + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ + if (loa_reject_reason := _dict.get('loa_reject_reason')) is not None: + args['loa_reject_reason'] = loa_reject_reason + if (metered := _dict.get('metered')) is not None: + args['metered'] = metered + if (name := _dict.get('name')) is not None: + args['name'] = name + if (operational_status := _dict.get('operational_status')) is not None: + args['operational_status'] = operational_status + if (patch_panel_completion_notice := _dict.get('patch_panel_completion_notice')) is not None: + args['patch_panel_completion_notice'] = patch_panel_completion_notice + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps + if (vlan := _dict.get('vlan')) is not None: + args['vlan'] = vlan return cls(**args) @classmethod @@ -5664,11 +6637,6 @@ def to_dict(self) -> Dict: _dict['global'] = self.global_ if hasattr(self, 'loa_reject_reason') and self.loa_reject_reason is not None: _dict['loa_reject_reason'] = self.loa_reject_reason - if hasattr(self, 'macsec_config') and self.macsec_config is not None: - if isinstance(self.macsec_config, dict): - _dict['macsec_config'] = self.macsec_config - else: - _dict['macsec_config'] = self.macsec_config.to_dict() if hasattr(self, 'metered') and self.metered is not None: _dict['metered'] = self.metered if hasattr(self, 'name') and self.name is not None: @@ -5748,81 +6716,11 @@ class OperationalStatusEnum(str, Enum): -class GatewayPatchTemplateAuthenticationKey: - """ - The identity of the standard key to use for BGP MD5 authentication key. The key - material that you provide must be base64 encoded and original string must be maximum - 126 ASCII characters in length. To clear the optional `authentication_key` field patch - its crn to `""`. - - :attr str crn: The CRN of the [Key Protect Standard - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Standard - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this - resource. - """ - - def __init__( - self, - crn: str, - ) -> None: - """ - Initialize a GatewayPatchTemplateAuthenticationKey object. - - :param str crn: The CRN of the [Key Protect Standard - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Standard - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for - this resource. - """ - self.crn = crn - - @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayPatchTemplateAuthenticationKey': - """Initialize a GatewayPatchTemplateAuthenticationKey object from a json dictionary.""" - args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in GatewayPatchTemplateAuthenticationKey JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a GatewayPatchTemplateAuthenticationKey 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - 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 GatewayPatchTemplateAuthenticationKey object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'GatewayPatchTemplateAuthenticationKey') -> 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: 'GatewayPatchTemplateAuthenticationKey') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - -class GatewayPort: +class GatewayPortIdentity: """ - gateway port for type=connect gateways. + Select Port Label for new type=connect gateway. - :attr str id: Port Identifier. + :param str id: port id. """ def __init__( @@ -5830,25 +6728,25 @@ def __init__( id: str, ) -> None: """ - Initialize a GatewayPort object. + Initialize a GatewayPortIdentity object. - :param str id: Port Identifier. + :param str id: port id. """ self.id = id @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayPort': - """Initialize a GatewayPort object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayPortIdentity': + """Initialize a GatewayPortIdentity 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 GatewayPort JSON') + raise ValueError('Required property \'id\' not present in GatewayPortIdentity JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayPort object from a json dictionary.""" + """Initialize a GatewayPortIdentity object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -5863,25 +6761,25 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayPort object.""" + """Return a `str` version of this GatewayPortIdentity object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayPort') -> bool: + def __eq__(self, other: 'GatewayPortIdentity') -> 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: 'GatewayPort') -> bool: + def __ne__(self, other: 'GatewayPortIdentity') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class GatewayPortIdentity: +class GatewayPortReference: """ - Select Port Label for new type=connect gateway. + Port information for type=connect gateways. - :attr str id: port id. + :param str id: Port Identifier. """ def __init__( @@ -5889,25 +6787,25 @@ def __init__( id: str, ) -> None: """ - Initialize a GatewayPortIdentity object. + Initialize a GatewayPortReference object. - :param str id: port id. + :param str id: Port Identifier. """ self.id = id @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayPortIdentity': - """Initialize a GatewayPortIdentity object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'GatewayPortReference': + """Initialize a GatewayPortReference 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 GatewayPortIdentity JSON') + raise ValueError('Required property \'id\' not present in GatewayPortReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayPortIdentity object from a json dictionary.""" + """Initialize a GatewayPortReference object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -5922,16 +6820,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayPortIdentity object.""" + """Return a `str` version of this GatewayPortReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayPortIdentity') -> bool: + def __eq__(self, other: 'GatewayPortReference') -> 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: 'GatewayPortIdentity') -> bool: + def __ne__(self, other: 'GatewayPortReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -5940,9 +6838,9 @@ class GatewayStatistic: """ Gateway statistics and debug commands. - :attr datetime created_at: Date and time data was collected. - :attr str data: statistics output. - :attr str type: statistic type. + :param datetime created_at: Date and time data was collected. + :param str data: statistics output. + :param str type: statistic type. """ def __init__( @@ -5966,16 +6864,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayStatistic': """Initialize a GatewayStatistic object from a json dictionary.""" args = {} - 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 GatewayStatistic JSON') - if 'data' in _dict: - args['data'] = _dict.get('data') + if (data := _dict.get('data')) is not None: + args['data'] = data else: raise ValueError('Required property \'data\' not present in GatewayStatistic 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 GatewayStatistic JSON') return cls(**args) @@ -6030,7 +6928,7 @@ class GatewayStatisticCollection: """ gateway statistics. - :attr List[GatewayStatistic] statistics: Collection of gateway statistics. + :param List[GatewayStatistic] statistics: Collection of gateway statistics. """ def __init__( @@ -6048,8 +6946,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayStatisticCollection': """Initialize a GatewayStatisticCollection object from a json dictionary.""" args = {} - if 'statistics' in _dict: - args['statistics'] = [GatewayStatistic.from_dict(v) for v in _dict.get('statistics')] + if (statistics := _dict.get('statistics')) is not None: + args['statistics'] = [GatewayStatistic.from_dict(v) for v in statistics] else: raise ValueError('Required property \'statistics\' not present in GatewayStatisticCollection JSON') return cls(**args) @@ -6114,13 +7012,13 @@ class GatewayStatusCollection: """ gateway status. - :attr List[GatewayStatus] status: (optional) array of status. + :param List[GatewayStatus] status: (optional) array of status. """ def __init__( self, *, - status: List['GatewayStatus'] = None, + status: Optional[List['GatewayStatus']] = None, ) -> None: """ Initialize a GatewayStatusCollection object. @@ -6133,8 +7031,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayStatusCollection': """Initialize a GatewayStatusCollection object from a json dictionary.""" args = {} - if 'status' in _dict: - args['status'] = _dict.get('status') + if (status := _dict.get('status')) is not None: + args['status'] = status return cls(**args) @classmethod @@ -6174,72 +7072,164 @@ def __ne__(self, other: 'GatewayStatusCollection') -> bool: return not self == other +class GatewayStatusReason: + """ + A reason for the current `operational_status`. + + :param str code: A reason code for the status: + - `authentication_key_failed`: `authentication_key` was unable to be configured + on the direct link gateway. To recover, first resolve any issues with your key, + then patch the gateway with the same or new key. + :param str message: An explanation of the status reason. + :param str more_info: (optional) Link to documentation about this status reason. + """ + + def __init__( + self, + code: str, + message: str, + *, + more_info: Optional[str] = None, + ) -> None: + """ + Initialize a GatewayStatusReason object. + + :param str code: A reason code for the status: + - `authentication_key_failed`: `authentication_key` was unable to be + configured on the direct link gateway. To recover, first resolve any issues + with your key, then patch the gateway with the same or new key. + :param str message: An explanation of the status reason. + :param str more_info: (optional) Link to documentation about this status + reason. + """ + self.code = code + self.message = message + self.more_info = more_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'GatewayStatusReason': + """Initialize a GatewayStatusReason object from a json dictionary.""" + args = {} + if (code := _dict.get('code')) is not None: + args['code'] = code + else: + raise ValueError('Required property \'code\' not present in GatewayStatusReason JSON') + if (message := _dict.get('message')) is not None: + args['message'] = message + else: + raise ValueError('Required property \'message\' not present in GatewayStatusReason JSON') + if (more_info := _dict.get('more_info')) is not None: + args['more_info'] = more_info + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a GatewayStatusReason 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, 'code') and self.code is not None: + _dict['code'] = self.code + if hasattr(self, 'message') and self.message is not None: + _dict['message'] = self.message + if hasattr(self, 'more_info') and self.more_info is not None: + _dict['more_info'] = self.more_info + 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 GatewayStatusReason object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'GatewayStatusReason') -> 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: 'GatewayStatusReason') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class CodeEnum(str, Enum): + """ + A reason code for the status: + - `authentication_key_failed`: `authentication_key` was unable to be configured on + the direct link gateway. To recover, first resolve any issues with your key, then + patch the gateway with the same or new key. + """ + + AUTHENTICATION_KEY_FAILED = 'authentication_key_failed' + + + class GatewayTemplate: """ Create gateway template. - :attr List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend configuration information. - :attr GatewayTemplateAuthenticationKey authentication_key: (optional) The - identity of the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original string - must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. - :attr GatewayBfdConfigTemplate bfd_config: (optional) BFD configuration + :param AuthenticationKeyIdentity authentication_key: (optional) + :param GatewayBfdConfigTemplate bfd_config: (optional) BFD configuration information. - :attr int bgp_asn: BGP ASN. - :attr str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. + :param int bgp_asn: BGP ASN. + :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. Field is deprecated. See bgp_ibm_cidr and bgp_cer_cidr for details on how to create a gateway using either automatic or explicit IP assignment. Any bgp_base_cidr value set will be ignored. - Deprecated field bgp_base_cidr will be removed from the API specificiation after + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR. + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will automatically select values for bgp_cer_cidr and bgp_ibm_cidr. For explicit IP assignment set a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR. + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will automatically select values for bgp_cer_cidr and bgp_ibm_cidr. For explicit IP assignment set a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 default_export_route_filter: (optional) The default directional route + :param str default_export_route_filter: (optional) The default directional route filter action that applies to routes that do not match any directional route filters. - :attr str default_import_route_filter: (optional) The default directional route + :param str default_import_route_filter: (optional) The default directional route filter action that applies to routes that do not match any directional route filters. - :attr List[GatewayTemplateRouteFilter] export_route_filters: (optional) Array of - directional route filters for a Direct Link gateway. When creating a gateway or - replacing existing route filters, the order of the items in the array will set - the ordering of the list of route filters. - :attr bool global_: Gateways with global routing (`true`) can connect to + :param List[GatewayTemplateRouteFilter] export_route_filters: (optional) Array + of directional route filters for a Direct Link gateway. When creating a gateway + or replacing existing route filters, the order of the items in the array will + set the ordering of the list of route filters. + :param bool global_: Gateways with global routing (`true`) can connect to networks outside their associated region. - :attr List[GatewayTemplateRouteFilter] import_route_filters: (optional) Array of - directional route filters for a Direct Link gateway. When creating a gateway or - replacing existing route filters, the order of the items in the array will set - the ordering of the list of route filters. - :attr bool metered: Metered billing option. When `true` gateway usage is billed - per gigabyte. When `false` there is no per gigabyte usage charge, instead a - flat rate is charged for the gateway. - :attr str name: The unique user-defined name for this gateway. - :attr str patch_panel_completion_notice: (optional) Gateway patch panel complete - notification from implementation team. - :attr ResourceGroupIdentity resource_group: (optional) Resource group for this + :param List[GatewayTemplateRouteFilter] import_route_filters: (optional) Array + of directional route filters for a Direct Link gateway. When creating a gateway + or replacing existing route filters, the order of the items in the array will + set the ordering of the list of route filters. + :param bool metered: Metered billing option. When `true` gateway usage is + billed per gigabyte. When `false` there is no per gigabyte usage charge, + instead a flat rate is charged for the gateway. + :param str name: The unique user-defined name for this gateway. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param ResourceGroupIdentity resource_group: (optional) Resource group for this resource. If unspecified, the account's [default resource group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :attr int speed_mbps: Gateway speed in megabits per second. - :attr str type: Offering type. + :param int speed_mbps: Gateway speed in megabits per second. + :param str type: Offering type. """ def __init__( @@ -6251,19 +7241,19 @@ def __init__( speed_mbps: int, type: str, *, - as_prepends: List['AsPrependTemplate'] = None, - authentication_key: 'GatewayTemplateAuthenticationKey' = None, - bfd_config: 'GatewayBfdConfigTemplate' = None, - bgp_base_cidr: str = None, - bgp_cer_cidr: str = None, - bgp_ibm_cidr: str = None, - connection_mode: str = None, - default_export_route_filter: str = None, - default_import_route_filter: str = None, - export_route_filters: List['GatewayTemplateRouteFilter'] = None, - import_route_filters: List['GatewayTemplateRouteFilter'] = None, - patch_panel_completion_notice: str = None, - resource_group: 'ResourceGroupIdentity' = None, + as_prepends: Optional[List['AsPrependTemplate']] = None, + authentication_key: Optional['AuthenticationKeyIdentity'] = None, + bfd_config: Optional['GatewayBfdConfigTemplate'] = None, + bgp_base_cidr: Optional[str] = None, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_cidr: Optional[str] = None, + connection_mode: Optional[str] = None, + default_export_route_filter: Optional[str] = None, + default_import_route_filter: Optional[str] = None, + export_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, + import_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, + patch_panel_completion_notice: Optional[str] = None, + resource_group: Optional['ResourceGroupIdentity'] = None, ) -> None: """ Initialize a GatewayTemplate object. @@ -6279,18 +7269,14 @@ def __init__( :param str type: Offering type. :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend configuration information. - :param GatewayTemplateAuthenticationKey authentication_key: (optional) The - identity of the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original - string must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. + :param AuthenticationKeyIdentity authentication_key: (optional) :param GatewayBfdConfigTemplate bfd_config: (optional) BFD configuration information. :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. Field is deprecated. See bgp_ibm_cidr and bgp_cer_cidr for details on how to create a gateway using either automatic or explicit IP assignment. Any bgp_base_cidr value set will be ignored. - Deprecated field bgp_base_cidr will be removed from the API specificiation + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will @@ -6381,87 +7367,17 @@ class TypeEnum(str, Enum): -class GatewayTemplateAuthenticationKey: - """ - The identity of the standard key to use for BGP MD5 authentication key. The key - material that you provide must be base64 encoded and original string must be maximum - 126 ASCII characters in length. To clear the optional `authentication_key` field patch - its crn to `""`. - - :attr str crn: The CRN of the [Key Protect Standard - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Standard - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for this - resource. - """ - - def __init__( - self, - crn: str, - ) -> None: - """ - Initialize a GatewayTemplateAuthenticationKey object. - - :param str crn: The CRN of the [Key Protect Standard - Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial) - or [Hyper Protect Crypto Service Standard - Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started) for - this resource. - """ - self.crn = crn - - @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayTemplateAuthenticationKey': - """Initialize a GatewayTemplateAuthenticationKey object from a json dictionary.""" - args = {} - if 'crn' in _dict: - args['crn'] = _dict.get('crn') - else: - raise ValueError('Required property \'crn\' not present in GatewayTemplateAuthenticationKey JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a GatewayTemplateAuthenticationKey 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, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - 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 GatewayTemplateAuthenticationKey object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'GatewayTemplateAuthenticationKey') -> 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: 'GatewayTemplateAuthenticationKey') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class GatewayTemplateRouteFilter: """ The route filter create template within the Direct Link gateway create template. - :attr str action: Determines whether routes that match the prefix-set will be + :param str action: Determines whether routes that match the prefix-set will be allowed (permit) or rejected (deny) through the filter. - :attr int ge: (optional) The minimum matching length of the prefix-set (mnemonic - for greater than or equal to). - :attr int le: (optional) The maximum matching length of the prefix-set (mnemonic - for less than or equal to). - :attr str prefix: IP prefix representing an address and mask length of the + :param int ge: (optional) The minimum matching length of the prefix-set + (mnemonic for greater than or equal to). + :param int le: (optional) The maximum matching length of the prefix-set + (mnemonic for less than or equal to). + :param str prefix: IP prefix representing an address and mask length of the prefix-set. """ @@ -6470,8 +7386,8 @@ def __init__( action: str, prefix: str, *, - ge: int = None, - le: int = None, + ge: Optional[int] = None, + le: Optional[int] = None, ) -> None: """ Initialize a GatewayTemplateRouteFilter object. @@ -6494,16 +7410,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayTemplateRouteFilter': """Initialize a GatewayTemplateRouteFilter 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 GatewayTemplateRouteFilter 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 GatewayTemplateRouteFilter JSON') return cls(**args) @@ -6559,21 +7475,21 @@ class GatewayVirtualConnection: """ Virtual connection. - :attr datetime created_at: The date and time resource was created. - :attr str id: The unique identifier for this virtual connection. - :attr str name: The user-defined name for this virtual connection. Virtual + :param datetime created_at: The date and time resource was created. + :param str id: The unique identifier for this virtual connection. + :param str name: The user-defined name for this virtual connection. Virtual connection names are unique within a gateway. This is the name of the virtual connection itself, the network being connected may have its own name attribute. - :attr str network_account: (optional) For virtual connections across two + :param str network_account: (optional) For virtual connections across two different IBM Cloud Accounts network_account indicates the account that owns the target network. - :attr str network_id: (optional) Unique identifier of the target network. For + :param str network_id: (optional) Unique identifier of the target network. For type=vpc virtual connections this is the CRN of the target VPC. This field does not apply to type=classic connections. - :attr str status: Status of the virtual connection. + :param str status: Status of the virtual 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 type: Virtual connection type. + :param str type: Virtual connection type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ @@ -6586,8 +7502,8 @@ def __init__( status: str, type: str, *, - network_account: str = None, - network_id: str = None, + network_account: Optional[str] = None, + network_id: Optional[str] = None, ) -> None: """ Initialize a GatewayVirtualConnection object. @@ -6623,28 +7539,28 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayVirtualConnection': """Initialize a GatewayVirtualConnection object from a json dictionary.""" args = {} - 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 GatewayVirtualConnection 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 GatewayVirtualConnection 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 GatewayVirtualConnection JSON') - if 'network_account' in _dict: - args['network_account'] = _dict.get('network_account') - if 'network_id' in _dict: - args['network_id'] = _dict.get('network_id') - if 'status' in _dict: - args['status'] = _dict.get('status') + if (network_account := _dict.get('network_account')) is not None: + args['network_account'] = network_account + if (network_id := _dict.get('network_id')) is not None: + args['network_id'] = network_id + if (status := _dict.get('status')) is not None: + args['status'] = status else: raise ValueError('Required property \'status\' not present in GatewayVirtualConnection 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 GatewayVirtualConnection JSON') return cls(**args) @@ -6725,7 +7641,7 @@ class GatewayVirtualConnectionCollection: """ Virtual connection collection. - :attr List[GatewayVirtualConnection] virtual_connections: virtual connection + :param List[GatewayVirtualConnection] virtual_connections: virtual connection array. """ @@ -6745,8 +7661,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayVirtualConnectionCollection': """Initialize a GatewayVirtualConnectionCollection object from a json dictionary.""" args = {} - if 'virtual_connections' in _dict: - args['virtual_connections'] = [GatewayVirtualConnection.from_dict(v) for v in _dict.get('virtual_connections')] + if (virtual_connections := _dict.get('virtual_connections')) is not None: + args['virtual_connections'] = [GatewayVirtualConnection.from_dict(v) for v in virtual_connections] else: raise ValueError('Required property \'virtual_connections\' not present in GatewayVirtualConnectionCollection JSON') return cls(**args) @@ -6788,36 +7704,246 @@ def __ne__(self, other: 'GatewayVirtualConnectionCollection') -> bool: return not self == other -class GetGatewayResponse: +class GatewayVirtualConnectionPatchTemplate: """ - GetGatewayResponse. + Patch virtual connection template. + :param str name: (optional) The user-defined name for this virtual connection. + Virtual connection names are unique within a gateway. This is the name of the + virtual connection itself, the network being connected may have its own name + attribute. + :param str status: (optional) Status of the virtual connection. Virtual + connections that span IBM Cloud Accounts are created in approval_pending status. + The owner of the target network can accept or reject connection requests by + patching status to attached or rejected respectively. """ def __init__( self, + *, + name: Optional[str] = None, + status: Optional[str] = None, ) -> None: """ - Initialize a GetGatewayResponse object. + Initialize a GatewayVirtualConnectionPatchTemplate object. + :param str name: (optional) The user-defined name for this virtual + connection. Virtual connection names are unique within a gateway. This is + the name of the virtual connection itself, the network being connected may + have its own name attribute. + :param str status: (optional) Status of the virtual connection. Virtual + connections that span IBM Cloud Accounts are created in approval_pending + status. The owner of the target network can accept or reject connection + requests by patching status to attached or rejected respectively. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['GetGatewayResponseGateway', 'GetGatewayResponseCrossAccountGateway']) - ) - raise Exception(msg) - + self.name = name + self.status = status -class ImportRouteFilterCollection: - """ - Collection of import route filters. + @classmethod + def from_dict(cls, _dict: Dict) -> 'GatewayVirtualConnectionPatchTemplate': + """Initialize a GatewayVirtualConnectionPatchTemplate object from a json dictionary.""" + args = {} + if (name := _dict.get('name')) is not None: + args['name'] = name + if (status := _dict.get('status')) is not None: + args['status'] = status + return cls(**args) - :attr List[RouteFilter] import_route_filters: Array of import route filters. - """ + @classmethod + def _from_dict(cls, _dict): + """Initialize a GatewayVirtualConnectionPatchTemplate object from a json dictionary.""" + return cls.from_dict(_dict) - def __init__( - self, - import_route_filters: List['RouteFilter'], - ) -> None: + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + 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 GatewayVirtualConnectionPatchTemplate object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'GatewayVirtualConnectionPatchTemplate') -> 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: 'GatewayVirtualConnectionPatchTemplate') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class StatusEnum(str, Enum): + """ + Status of the virtual connection. Virtual connections that span IBM Cloud + Accounts are created in approval_pending status. The owner of the target network + can accept or reject connection requests by patching status to attached or + rejected respectively. + """ + + ATTACHED = 'attached' + REJECTED = 'rejected' + + + +class GetGatewayResponse: + """ + GetGatewayResponse. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a GetGatewayResponse object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['GetGatewayResponseGateway', 'GetGatewayResponseCrossAccountGateway']) + ) + raise Exception(msg) + + +class HpcsKeyIdentity: + """ + A [Hyper Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + + :param str crn: The CRN of the key. + """ + + def __init__( + self, + crn: str, + ) -> None: + """ + Initialize a HpcsKeyIdentity object. + + :param str crn: The CRN of the key. + """ + self.crn = crn + + @classmethod + def from_dict(cls, _dict: Dict) -> 'HpcsKeyIdentity': + """Initialize a HpcsKeyIdentity object from a json dictionary.""" + args = {} + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + else: + raise ValueError('Required property \'crn\' not present in HpcsKeyIdentity JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a HpcsKeyIdentity 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, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + 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 HpcsKeyIdentity object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'HpcsKeyIdentity') -> 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: 'HpcsKeyIdentity') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class HpcsKeyReference: + """ + A reference to a [Hyper Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + + :param str crn: The CRN of the referenced key. + """ + + def __init__( + self, + crn: str, + ) -> None: + """ + Initialize a HpcsKeyReference object. + + :param str crn: The CRN of the referenced key. + """ + self.crn = crn + + @classmethod + def from_dict(cls, _dict: Dict) -> 'HpcsKeyReference': + """Initialize a HpcsKeyReference object from a json dictionary.""" + args = {} + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + else: + raise ValueError('Required property \'crn\' not present in HpcsKeyReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a HpcsKeyReference 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, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + 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 HpcsKeyReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'HpcsKeyReference') -> 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: 'HpcsKeyReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ImportRouteFilterCollection: + """ + Collection of import route filters. + + :param List[RouteFilter] import_route_filters: Array of import route filters. + """ + + def __init__( + self, + import_route_filters: List['RouteFilter'], + ) -> None: """ Initialize a ImportRouteFilterCollection object. @@ -6830,8 +7956,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'ImportRouteFilterCollection': """Initialize a ImportRouteFilterCollection object from a json dictionary.""" args = {} - if 'import_route_filters' in _dict: - args['import_route_filters'] = [RouteFilter.from_dict(v) for v in _dict.get('import_route_filters')] + if (import_route_filters := _dict.get('import_route_filters')) is not None: + args['import_route_filters'] = [RouteFilter.from_dict(v) for v in import_route_filters] else: raise ValueError('Required property \'import_route_filters\' not present in ImportRouteFilterCollection JSON') return cls(**args) @@ -6877,7 +8003,7 @@ class LocationCollection: """ location collection. - :attr List[LocationOutput] locations: Collection of Direct Link locations. + :param List[LocationOutput] locations: Collection of Direct Link locations. """ def __init__( @@ -6895,8 +8021,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'LocationCollection': """Initialize a LocationCollection object from a json dictionary.""" args = {} - if 'locations' in _dict: - args['locations'] = [LocationOutput.from_dict(v) for v in _dict.get('locations')] + if (locations := _dict.get('locations')) is not None: + args['locations'] = [LocationOutput.from_dict(v) for v in locations] else: raise ValueError('Required property \'locations\' not present in LocationCollection JSON') return cls(**args) @@ -6942,14 +8068,14 @@ class LocationCrossConnectRouterCollection: """ List of cross connect router details. - :attr List[CrossConnectRouter] cross_connect_routers: (optional) Array of + :param List[CrossConnectRouter] cross_connect_routers: (optional) Array of Routers for this location. """ def __init__( self, *, - cross_connect_routers: List['CrossConnectRouter'] = None, + cross_connect_routers: Optional[List['CrossConnectRouter']] = None, ) -> None: """ Initialize a LocationCrossConnectRouterCollection object. @@ -6963,8 +8089,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'LocationCrossConnectRouterCollection': """Initialize a LocationCrossConnectRouterCollection object from a json dictionary.""" args = {} - if 'cross_connect_routers' in _dict: - args['cross_connect_routers'] = [CrossConnectRouter.from_dict(v) for v in _dict.get('cross_connect_routers')] + if (cross_connect_routers := _dict.get('cross_connect_routers')) is not None: + args['cross_connect_routers'] = [CrossConnectRouter.from_dict(v) for v in cross_connect_routers] return cls(**args) @classmethod @@ -7008,25 +8134,26 @@ class LocationOutput: """ location. - :attr str billing_location: (optional) Billing location. Only present for + :param str billing_location: (optional) Billing location. Only present for locations where provisioning is enabled. - :attr str building_colocation_owner: (optional) Building colocation owner. Only - present for offering_type=dedicated locations where provisioning is enabled. - :attr str display_name: Location long name. - :attr str location_type: Location type. - :attr bool macsec_enabled: (optional) Indicate whether location supports MACsec. - Only returned for gateway type=dedicated locations. Contact IBM support for - access to MACsec. - :attr str market: Location market. - :attr str market_geography: (optional) Location geography. Only present for + :param str building_colocation_owner: (optional) Building colocation owner. + Only present for offering_type=dedicated locations where provisioning is + enabled. + :param str display_name: Location long name. + :param str location_type: Location type. + :param bool macsec_enabled: (optional) Indicate whether location supports + MACsec. Only returned for gateway type=dedicated locations. Contact IBM + support for access to MACsec. + :param str market: Location market. + :param str market_geography: (optional) Location geography. Only present for locations where provisioning is enabled. - :attr bool mzr: (optional) Is location a multi-zone region (MZR). Only present + :param bool mzr: (optional) Is location a multi-zone region (MZR). Only present for locations where provisioning is enabled. - :attr str name: Location short name. - :attr str offering_type: Location offering type. - :attr bool provision_enabled: Indicates for the specific offering_type whether + :param str name: Location short name. + :param str offering_type: Location offering type. + :param bool provision_enabled: Indicates for the specific offering_type whether this location supports gateway provisioning. - :attr str vpc_region: (optional) Location's VPC region. Only present for + :param str vpc_region: (optional) Location's VPC region. Only present for locations where provisioning is enabled. """ @@ -7039,12 +8166,12 @@ def __init__( offering_type: str, provision_enabled: bool, *, - billing_location: str = None, - building_colocation_owner: str = None, - macsec_enabled: bool = None, - market_geography: str = None, - mzr: bool = None, - vpc_region: str = None, + billing_location: Optional[str] = None, + building_colocation_owner: Optional[str] = None, + macsec_enabled: Optional[bool] = None, + market_geography: Optional[str] = None, + mzr: Optional[bool] = None, + vpc_region: Optional[str] = None, ) -> None: """ Initialize a LocationOutput object. @@ -7088,42 +8215,42 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'LocationOutput': """Initialize a LocationOutput object from a json dictionary.""" args = {} - if 'billing_location' in _dict: - args['billing_location'] = _dict.get('billing_location') - if 'building_colocation_owner' in _dict: - args['building_colocation_owner'] = _dict.get('building_colocation_owner') - if 'display_name' in _dict: - args['display_name'] = _dict.get('display_name') + if (billing_location := _dict.get('billing_location')) is not None: + args['billing_location'] = billing_location + if (building_colocation_owner := _dict.get('building_colocation_owner')) is not None: + args['building_colocation_owner'] = building_colocation_owner + 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 LocationOutput JSON') - if 'location_type' in _dict: - args['location_type'] = _dict.get('location_type') + if (location_type := _dict.get('location_type')) is not None: + args['location_type'] = location_type else: raise ValueError('Required property \'location_type\' not present in LocationOutput JSON') - if 'macsec_enabled' in _dict: - args['macsec_enabled'] = _dict.get('macsec_enabled') - if 'market' in _dict: - args['market'] = _dict.get('market') + if (macsec_enabled := _dict.get('macsec_enabled')) is not None: + args['macsec_enabled'] = macsec_enabled + if (market := _dict.get('market')) is not None: + args['market'] = market else: raise ValueError('Required property \'market\' not present in LocationOutput JSON') - if 'market_geography' in _dict: - args['market_geography'] = _dict.get('market_geography') - if 'mzr' in _dict: - args['mzr'] = _dict.get('mzr') - if 'name' in _dict: - args['name'] = _dict.get('name') + if (market_geography := _dict.get('market_geography')) is not None: + args['market_geography'] = market_geography + if (mzr := _dict.get('mzr')) is not None: + args['mzr'] = mzr + if (name := _dict.get('name')) is not None: + args['name'] = name else: raise ValueError('Required property \'name\' not present in LocationOutput JSON') - if 'offering_type' in _dict: - args['offering_type'] = _dict.get('offering_type') + if (offering_type := _dict.get('offering_type')) is not None: + args['offering_type'] = offering_type else: raise ValueError('Required property \'offering_type\' not present in LocationOutput JSON') - if 'provision_enabled' in _dict: - args['provision_enabled'] = _dict.get('provision_enabled') + if (provision_enabled := _dict.get('provision_enabled')) is not None: + args['provision_enabled'] = provision_enabled else: raise ValueError('Required property \'provision_enabled\' not present in LocationOutput JSON') - if 'vpc_region' in _dict: - args['vpc_region'] = _dict.get('vpc_region') + if (vpc_region := _dict.get('vpc_region')) is not None: + args['vpc_region'] = vpc_region return cls(**args) @classmethod @@ -7183,9 +8310,9 @@ class OfferingSpeed: """ Speed. - :attr List[str] capabilities: Array of capabilities for billing option. - :attr int link_speed: Link speed in megabits per second. - :attr bool macsec_enabled: (optional) Indicate whether speed supports MACsec. + :param List[str] capabilities: Array of capabilities for billing option. + :param int link_speed: Link speed in megabits per second. + :param bool macsec_enabled: (optional) Indicate whether speed supports MACsec. Only returned for gateway type=dedicated speeds. Contact IBM support for access to MACsec. """ @@ -7195,7 +8322,7 @@ def __init__( capabilities: List[str], link_speed: int, *, - macsec_enabled: bool = None, + macsec_enabled: Optional[bool] = None, ) -> None: """ Initialize a OfferingSpeed object. @@ -7214,16 +8341,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'OfferingSpeed': """Initialize a OfferingSpeed object from a json dictionary.""" args = {} - if 'capabilities' in _dict: - args['capabilities'] = _dict.get('capabilities') + if (capabilities := _dict.get('capabilities')) is not None: + args['capabilities'] = capabilities else: raise ValueError('Required property \'capabilities\' not present in OfferingSpeed JSON') - if 'link_speed' in _dict: - args['link_speed'] = _dict.get('link_speed') + if (link_speed := _dict.get('link_speed')) is not None: + args['link_speed'] = link_speed else: raise ValueError('Required property \'link_speed\' not present in OfferingSpeed JSON') - if 'macsec_enabled' in _dict: - args['macsec_enabled'] = _dict.get('macsec_enabled') + if (macsec_enabled := _dict.get('macsec_enabled')) is not None: + args['macsec_enabled'] = macsec_enabled return cls(**args) @classmethod @@ -7265,7 +8392,7 @@ class OfferingSpeedCollection: """ List of speeds. - :attr List[OfferingSpeed] speeds: speed list. + :param List[OfferingSpeed] speeds: speed list. """ def __init__( @@ -7283,8 +8410,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'OfferingSpeedCollection': """Initialize a OfferingSpeedCollection object from a json dictionary.""" args = {} - if 'speeds' in _dict: - args['speeds'] = [OfferingSpeed.from_dict(v) for v in _dict.get('speeds')] + if (speeds := _dict.get('speeds')) is not None: + args['speeds'] = [OfferingSpeed.from_dict(v) for v in speeds] else: raise ValueError('Required property \'speeds\' not present in OfferingSpeedCollection JSON') return cls(**args) @@ -7330,14 +8457,14 @@ class Port: """ Provider port details. - :attr int direct_link_count: Count of existing Direct Link gateways in this + :param int direct_link_count: Count of existing Direct Link gateways in this account on this port. - :attr str id: Port identifier. - :attr str label: Port Label. - :attr str location_display_name: Port location long name. - :attr str location_name: Port location name identifier. - :attr str provider_name: Port's provider name. - :attr List[int] supported_link_speeds: Port's supported speeds in megabits per + :param str id: Port identifier. + :param str label: Port Label. + :param str location_display_name: Port location long name. + :param str location_name: Port location name identifier. + :param str provider_name: Port's provider name. + :param List[int] supported_link_speeds: Port's supported speeds in megabits per second. """ @@ -7376,32 +8503,32 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'Port': """Initialize a Port object from a json dictionary.""" args = {} - if 'direct_link_count' in _dict: - args['direct_link_count'] = _dict.get('direct_link_count') + if (direct_link_count := _dict.get('direct_link_count')) is not None: + args['direct_link_count'] = direct_link_count else: raise ValueError('Required property \'direct_link_count\' not present in Port 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 Port JSON') - if 'label' in _dict: - args['label'] = _dict.get('label') + if (label := _dict.get('label')) is not None: + args['label'] = label else: raise ValueError('Required property \'label\' not present in Port JSON') - if 'location_display_name' in _dict: - args['location_display_name'] = _dict.get('location_display_name') + if (location_display_name := _dict.get('location_display_name')) is not None: + args['location_display_name'] = location_display_name else: raise ValueError('Required property \'location_display_name\' not present in Port JSON') - if 'location_name' in _dict: - args['location_name'] = _dict.get('location_name') + if (location_name := _dict.get('location_name')) is not None: + args['location_name'] = location_name else: raise ValueError('Required property \'location_name\' not present in Port JSON') - if 'provider_name' in _dict: - args['provider_name'] = _dict.get('provider_name') + if (provider_name := _dict.get('provider_name')) is not None: + args['provider_name'] = provider_name else: raise ValueError('Required property \'provider_name\' not present in Port JSON') - if 'supported_link_speeds' in _dict: - args['supported_link_speeds'] = _dict.get('supported_link_speeds') + if (supported_link_speeds := _dict.get('supported_link_speeds')) is not None: + args['supported_link_speeds'] = supported_link_speeds else: raise ValueError('Required property \'supported_link_speeds\' not present in Port JSON') return cls(**args) @@ -7453,13 +8580,15 @@ class PortCollection: """ List of port label details. - :attr PortsPaginatedCollectionFirst first: A reference to the first page of + :param PortsPaginatedCollectionFirst first: A reference to the first page of resources. - :attr int limit: The maximum number of resources can be returned by the request. - :attr PortsPaginatedCollectionNext 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: The total number of resources across all pages. - :attr List[Port] ports: (optional) Array of ports. + :param int limit: The maximum number of resources can be returned by the + request. + :param PortsPaginatedCollectionNext next: (optional) A reference to the next + page of resources; this reference is included for all pages except the last + page. + :param int total_count: The total number of resources across all pages. + :param List[Port] ports: (optional) Array of ports. """ def __init__( @@ -7468,8 +8597,8 @@ def __init__( limit: int, total_count: int, *, - next: 'PortsPaginatedCollectionNext' = None, - ports: List['Port'] = None, + next: Optional['PortsPaginatedCollectionNext'] = None, + ports: Optional[List['Port']] = None, ) -> None: """ Initialize a PortCollection object. @@ -7494,22 +8623,22 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'PortCollection': """Initialize a PortCollection object from a json dictionary.""" args = {} - if 'first' in _dict: - args['first'] = PortsPaginatedCollectionFirst.from_dict(_dict.get('first')) + if (first := _dict.get('first')) is not None: + args['first'] = PortsPaginatedCollectionFirst.from_dict(first) else: raise ValueError('Required property \'first\' not present in PortCollection 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 PortCollection JSON') - if 'next' in _dict: - args['next'] = PortsPaginatedCollectionNext.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'] = PortsPaginatedCollectionNext.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 PortCollection JSON') - if 'ports' in _dict: - args['ports'] = [Port.from_dict(v) for v in _dict.get('ports')] + if (ports := _dict.get('ports')) is not None: + args['ports'] = [Port.from_dict(v) for v in ports] return cls(**args) @classmethod @@ -7567,7 +8696,7 @@ class PortsPaginatedCollectionFirst: """ A reference to the first page of resources. - :attr str href: The URL for the first page of resources. + :param str href: The URL for the first page of resources. """ def __init__( @@ -7585,8 +8714,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'PortsPaginatedCollectionFirst': """Initialize a PortsPaginatedCollectionFirst 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 PortsPaginatedCollectionFirst JSON') return cls(**args) @@ -7627,15 +8756,15 @@ class PortsPaginatedCollectionNext: A reference to the next page of resources; this reference is included for all pages except the last page. - :attr str href: URL for the next page of resources. - :attr str start: (optional) start token for the next page of resources. + :param str href: URL for the next page of resources. + :param str start: (optional) start token for the next page of resources. """ def __init__( self, href: str, *, - start: str = None, + start: Optional[str] = None, ) -> None: """ Initialize a PortsPaginatedCollectionNext object. @@ -7650,12 +8779,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'PortsPaginatedCollectionNext': """Initialize a PortsPaginatedCollectionNext 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 PortsPaginatedCollectionNext JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') + if (start := _dict.get('start')) is not None: + args['start'] = start return cls(**args) @classmethod @@ -7696,7 +8825,7 @@ class ResourceGroupIdentity: Resource group for this resource. If unspecified, the account's [default resource group](https://cloud.ibm.com/apidocs/resource-manager#introduction) is used. - :attr str id: Resource group identifier. + :param str id: Resource group identifier. """ def __init__( @@ -7714,8 +8843,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) @@ -7755,7 +8884,7 @@ class ResourceGroupReference: """ Resource group reference. - :attr str id: Resource group identifier. + :param str id: Resource group identifier. """ def __init__( @@ -7773,8 +8902,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'ResourceGroupReference': """Initialize a ResourceGroupReference 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 ResourceGroupReference JSON') return cls(**args) @@ -7814,11 +8943,11 @@ class RouteFilter: """ Route filter. - :attr str action: Determines whether routes that match the prefix-set will be + :param str action: Determines whether routes that match the prefix-set will be allowed (permit) or rejected (deny) through the filter. - :attr str before: (optional) Identifier of the next route filter considered if a - route does not match the current filter. This property builds the ordering among - route filters and follows semantics: + :param str before: (optional) Identifier of the next route filter considered if + a route does not match the current filter. This property builds the ordering + among route filters and follows semantics: - When before is an identifier of a route filter that exists and is in the same collection, a route will first attempt to match on the current filter before preceding to the filter referenced in this property. @@ -7829,16 +8958,16 @@ class RouteFilter: - When a filter is created without a before, it takes the lowest precedence. The existing filter of lowest precedence will be updated to refer to the newly created filter. - :attr datetime created_at: The date and time the route filter was created in ISO - 8601 format. - :attr int ge: (optional) The minimum matching length of the prefix-set (mnemonic - for greater than or equal to). - :attr str id: The identifier of a route filter. - :attr int le: (optional) The maximum matching length of the prefix-set (mnemonic - for less than or equal to). - :attr str prefix: IP prefix representing an address and mask length of the + :param datetime created_at: The date and time the route filter was created in + ISO 8601 format. + :param int ge: (optional) The minimum matching length of the prefix-set + (mnemonic for greater than or equal to). + :param str id: The identifier of a route filter. + :param int le: (optional) The maximum matching length of the prefix-set + (mnemonic for less than or equal to). + :param str prefix: IP prefix representing an address and mask length of the prefix-set. - :attr datetime updated_at: The date and time the route filter was last updated. + :param datetime updated_at: The date and time the route filter was last updated. """ def __init__( @@ -7849,9 +8978,9 @@ def __init__( prefix: str, updated_at: datetime, *, - before: str = None, - ge: int = None, - le: int = None, + before: Optional[str] = None, + ge: Optional[int] = None, + le: Optional[int] = None, ) -> None: """ Initialize a RouteFilter object. @@ -7897,30 +9026,30 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteFilter': """Initialize a RouteFilter 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 RouteFilter 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 RouteFilter 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 RouteFilter 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 RouteFilter 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 RouteFilter JSON') return cls(**args) @@ -7984,22 +9113,22 @@ class RouteReport: """ route report. - :attr List[RouteReportAdvertisedRoute] advertised_routes: (optional) Array of + :param List[RouteReportAdvertisedRoute] advertised_routes: (optional) Array of connection prefixes advertised to the on-prem network. This parameter is not returned when the route report was generated prior to inclusion of this parameter. - :attr datetime created_at: Date and time route report was requested. - :attr List[RouteReportRoute] gateway_routes: Array of local/direct routes. - :attr str id: Report identifier. - :attr List[RouteReportOnPremRoute] on_prem_routes: Array of on premises routes. - :attr List[RouteReportOverlappingRouteGroup] overlapping_routes: Array of + :param datetime created_at: Date and time route report was requested. + :param List[RouteReportRoute] gateway_routes: Array of local/direct routes. + :param str id: Report identifier. + :param List[RouteReportOnPremRoute] on_prem_routes: Array of on premises routes. + :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. - :attr List[RouteReportConnection] virtual_connection_routes: Array of routes on + :param List[RouteReportConnection] virtual_connection_routes: Array of routes on virtual connections. """ @@ -8013,8 +9142,8 @@ def __init__( status: str, virtual_connection_routes: List['RouteReportConnection'], *, - advertised_routes: List['RouteReportAdvertisedRoute'] = None, - updated_at: datetime = None, + advertised_routes: Optional[List['RouteReportAdvertisedRoute']] = None, + updated_at: Optional[datetime] = None, ) -> None: """ Initialize a RouteReport object. @@ -8052,36 +9181,36 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReport': """Initialize a RouteReport object from a json dictionary.""" args = {} - if 'advertised_routes' in _dict: - args['advertised_routes'] = [RouteReportAdvertisedRoute.from_dict(v) for v in _dict.get('advertised_routes')] - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (advertised_routes := _dict.get('advertised_routes')) is not None: + args['advertised_routes'] = [RouteReportAdvertisedRoute.from_dict(v) for v in advertised_routes] + 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 'gateway_routes' in _dict: - args['gateway_routes'] = [RouteReportRoute.from_dict(v) for v in _dict.get('gateway_routes')] + if (gateway_routes := _dict.get('gateway_routes')) is not None: + args['gateway_routes'] = [RouteReportRoute.from_dict(v) for v in gateway_routes] else: raise ValueError('Required property \'gateway_routes\' 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 'on_prem_routes' in _dict: - args['on_prem_routes'] = [RouteReportOnPremRoute.from_dict(v) for v in _dict.get('on_prem_routes')] + if (on_prem_routes := _dict.get('on_prem_routes')) is not None: + args['on_prem_routes'] = [RouteReportOnPremRoute.from_dict(v) for v in on_prem_routes] else: raise ValueError('Required property \'on_prem_routes\' 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 'virtual_connection_routes' in _dict: - args['virtual_connection_routes'] = [RouteReportConnection.from_dict(v) for v in _dict.get('virtual_connection_routes')] + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) + if (virtual_connection_routes := _dict.get('virtual_connection_routes')) is not None: + args['virtual_connection_routes'] = [RouteReportConnection.from_dict(v) for v in virtual_connection_routes] else: raise ValueError('Required property \'virtual_connection_routes\' not present in RouteReport JSON') return cls(**args) @@ -8177,8 +9306,8 @@ class RouteReportAdvertisedRoute: """ Route advertised to the on-prem network. - :attr str as_path: The BGP AS path of the route. - :attr str prefix: prefix. + :param str as_path: The BGP AS path of the route. + :param str prefix: prefix. """ def __init__( @@ -8199,12 +9328,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportAdvertisedRoute': """Initialize a RouteReportAdvertisedRoute object from a json dictionary.""" args = {} - if 'as_path' in _dict: - args['as_path'] = _dict.get('as_path') + if (as_path := _dict.get('as_path')) is not None: + args['as_path'] = as_path else: raise ValueError('Required property \'as_path\' not present in RouteReportAdvertisedRoute JSON') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix else: raise ValueError('Required property \'prefix\' not present in RouteReportAdvertisedRoute JSON') return cls(**args) @@ -8246,7 +9375,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__( @@ -8264,8 +9393,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) @@ -8311,20 +9440,20 @@ class RouteReportConnection: """ Routes of a virtual connection. - :attr List[RouteReportVirtualConnectionRoute] routes: Array of virtual + :param List[RouteReportVirtualConnectionRoute] routes: Array of virtual connection's routes. - :attr str virtual_connection_id: (optional) ID of virtual connection. - :attr str virtual_connection_name: (optional) name of virtual connection. - :attr str virtual_connection_type: (optional) type of virtual connection. + :param str virtual_connection_id: (optional) ID of virtual connection. + :param str virtual_connection_name: (optional) name of virtual connection. + :param str virtual_connection_type: (optional) type of virtual connection. """ def __init__( self, routes: List['RouteReportVirtualConnectionRoute'], *, - virtual_connection_id: str = None, - virtual_connection_name: str = None, - virtual_connection_type: str = None, + virtual_connection_id: Optional[str] = None, + virtual_connection_name: Optional[str] = None, + virtual_connection_type: Optional[str] = None, ) -> None: """ Initialize a RouteReportConnection object. @@ -8344,16 +9473,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportConnection': """Initialize a RouteReportConnection object from a json dictionary.""" args = {} - if 'routes' in _dict: - args['routes'] = [RouteReportVirtualConnectionRoute.from_dict(v) for v in _dict.get('routes')] + if (routes := _dict.get('routes')) is not None: + args['routes'] = [RouteReportVirtualConnectionRoute.from_dict(v) for v in routes] else: raise ValueError('Required property \'routes\' not present in RouteReportConnection JSON') - if 'virtual_connection_id' in _dict: - args['virtual_connection_id'] = _dict.get('virtual_connection_id') - if 'virtual_connection_name' in _dict: - args['virtual_connection_name'] = _dict.get('virtual_connection_name') - if 'virtual_connection_type' in _dict: - args['virtual_connection_type'] = _dict.get('virtual_connection_type') + if (virtual_connection_id := _dict.get('virtual_connection_id')) is not None: + args['virtual_connection_id'] = virtual_connection_id + if (virtual_connection_name := _dict.get('virtual_connection_name')) is not None: + args['virtual_connection_name'] = virtual_connection_name + if (virtual_connection_type := _dict.get('virtual_connection_type')) is not None: + args['virtual_connection_type'] = virtual_connection_type return cls(**args) @classmethod @@ -8403,17 +9532,17 @@ class RouteReportOnPremRoute: """ on-prem route. - :attr str as_path: (optional) The BGP AS path of the route. - :attr str next_hop: (optional) Next hop address. - :attr str prefix: (optional) prefix. + :param str as_path: (optional) The BGP AS path of the route. + :param str next_hop: (optional) Next hop address. + :param str prefix: (optional) prefix. """ def __init__( self, *, - as_path: str = None, - next_hop: str = None, - prefix: str = None, + as_path: Optional[str] = None, + next_hop: Optional[str] = None, + prefix: Optional[str] = None, ) -> None: """ Initialize a RouteReportOnPremRoute object. @@ -8430,12 +9559,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportOnPremRoute': """Initialize a RouteReportOnPremRoute object from a json dictionary.""" args = {} - if 'as_path' in _dict: - args['as_path'] = _dict.get('as_path') - if 'next_hop' in _dict: - args['next_hop'] = _dict.get('next_hop') - 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 (next_hop := _dict.get('next_hop')) is not None: + args['next_hop'] = next_hop + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix return cls(**args) @classmethod @@ -8496,14 +9625,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. @@ -8517,8 +9646,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'] = _dict.get('routes') + if (routes := _dict.get('routes')) is not None: + args['routes'] = routes return cls(**args) @classmethod @@ -8562,13 +9691,13 @@ class RouteReportRoute: """ route. - :attr str prefix: (optional) prefix. + :param str prefix: (optional) prefix. """ def __init__( self, *, - prefix: str = None, + prefix: Optional[str] = None, ) -> None: """ Initialize a RouteReportRoute object. @@ -8581,8 +9710,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportRoute': """Initialize a RouteReportRoute 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 @@ -8620,19 +9749,19 @@ class RouteReportVirtualConnectionRoute: """ A route originating from an attached virtual connection. - :attr bool active: (optional) Indicates whether the route is the preferred path + :param bool active: (optional) Indicates whether the route is the preferred path of the prefix. - :attr str local_preference: (optional) The local preference of the route. This + :param str local_preference: (optional) The local preference of the route. This attribute can manipulate the chosen path on routes. - :attr str prefix: prefix. + :param str prefix: prefix. """ def __init__( self, prefix: str, *, - active: bool = None, - local_preference: str = None, + active: Optional[bool] = None, + local_preference: Optional[str] = None, ) -> None: """ Initialize a RouteReportVirtualConnectionRoute object. @@ -8651,12 +9780,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'RouteReportVirtualConnectionRoute': """Initialize a RouteReportVirtualConnectionRoute object from a json dictionary.""" args = {} - if 'active' in _dict: - args['active'] = _dict.get('active') - if 'local_preference' in _dict: - args['local_preference'] = _dict.get('local_preference') - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (active := _dict.get('active')) is not None: + args['active'] = active + 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 else: raise ValueError('Required property \'prefix\' not present in RouteReportVirtualConnectionRoute JSON') return cls(**args) @@ -8696,15 +9825,75 @@ def __ne__(self, other: 'RouteReportVirtualConnectionRoute') -> bool: return not self == other +class SakRekey: + """ + Determines how SAK rekeying occurs. It is either timer based or based on the amount of + used packet numbers. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a SakRekey object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SakRekeyTimerMode', 'SakRekeyPacketNumberRolloverMode']) + ) + raise Exception(msg) + + +class SakRekeyPatch: + """ + Determines how SAK rekeying occurs. It is either timer based or based on the amount of + used packet numbers. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a SakRekeyPatch object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SakRekeyPatchSakRekeyTimerModePatch', 'SakRekeyPatchSakRekeyPacketNumberRolloverModePatch']) + ) + raise Exception(msg) + + +class SakRekeyPrototype: + """ + Determines how SAK rekeying occurs. It is either timer based or based on the amount of + used packet numbers. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a SakRekeyPrototype object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['SakRekeyPrototypeSakRekeyTimerModePrototype', 'SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype']) + ) + raise Exception(msg) + + class UpdateRouteFilterTemplate: """ The route filter update template. - :attr str action: (optional) Determines whether routes that match the prefix-set - will be allowed (permit) or rejected (deny) through the filter. - :attr str before: (optional) Identifier of the next route filter considered if a - route does not match the current filter. This property builds the ordering among - route filters and follows semantics: + :param str action: (optional) Determines whether routes that match the + prefix-set will be allowed (permit) or rejected (deny) through the filter. + :param str before: (optional) Identifier of the next route filter considered if + a route does not match the current filter. This property builds the ordering + among route filters and follows semantics: - When before is an identifier of a route filter that exists and is in the same collection, a route will first attempt to match on the current filter before preceding to the filter referenced in this property. @@ -8715,24 +9904,24 @@ class UpdateRouteFilterTemplate: - When a filter is created without a before, it takes the lowest precedence. The existing filter of lowest precedence will be updated to refer to the newly created filter. - :attr int ge: (optional) The minimum matching length of the prefix-set (mnemonic - for greater than or equal to). + :param int ge: (optional) The minimum matching length of the prefix-set + (mnemonic for greater than or equal to). To clear the minimum matching length of the filter, patch the value to `0`. - :attr int le: (optional) The maximum matching length of the prefix-set (mnemonic - for less than or equal to). + :param int le: (optional) The maximum matching length of the prefix-set + (mnemonic for less than or equal to). To clear the maximum matching length of the filter, patch the value to `0`. - :attr str prefix: (optional) IP prefix representing an address and mask length + :param str prefix: (optional) IP prefix representing an address and mask length of the prefix-set. """ def __init__( self, *, - 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, ) -> None: """ Initialize a UpdateRouteFilterTemplate object. @@ -8772,16 +9961,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'UpdateRouteFilterTemplate': """Initialize a UpdateRouteFilterTemplate object from a json dictionary.""" args = {} - if 'action' in _dict: - args['action'] = _dict.get('action') - if 'before' in _dict: - args['before'] = _dict.get('before') - 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 (action := _dict.get('action')) is not None: + args['action'] = action + if (before := _dict.get('before')) is not None: + args['before'] = before + 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 return cls(**args) @classmethod @@ -8833,45 +10022,46 @@ class ActionEnum(str, Enum): -class GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate(GatewayActionTemplateUpdatesItem): +class AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity(AuthenticationKeyIdentity): """ - The autonomous system number (ASN) of Border Gateway Protocol - (BGP) configuration for the IBM side of the DL 2.0 gateway. + A [Hyper Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). - :attr int bgp_asn: (optional) New gateway BGP ASN. + :param str crn: The CRN of the key. """ def __init__( self, - *, - bgp_asn: int = None, + crn: str, ) -> None: """ - Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate object. + Initialize a AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity object. - :param int bgp_asn: (optional) New gateway BGP ASN. + :param str crn: The CRN of the key. """ # pylint: disable=super-init-not-called - self.bgp_asn = bgp_asn + self.crn = crn @classmethod - def from_dict(cls, _dict: Dict) -> 'GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate': - """Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity': + """Initialize a AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity object from a json dictionary.""" args = {} - if 'bgp_asn' in _dict: - args['bgp_asn'] = _dict.get('bgp_asn') + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + else: + raise ValueError('Required property \'crn\' not present in AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate object from a json dictionary.""" + """Initialize a AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity 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, 'bgp_asn') and self.bgp_asn is not None: - _dict['bgp_asn'] = self.bgp_asn + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn return _dict def _to_dict(self): @@ -8879,85 +10069,328 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate object.""" + """Return a `str` version of this AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate') -> bool: + def __eq__(self, other: 'AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity') -> 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: 'GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate') -> bool: + def __ne__(self, other: 'AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class GatewayActionTemplateUpdatesItemGatewayClientBGPIPUpdate(GatewayActionTemplateUpdatesItem): +class AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity(AuthenticationKeyIdentity): """ - Update BGP customer and IBM CIDR. + A [Key Protect Standard + Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial). - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR is the new CIDR - (Classless Inter-Domain Routing) value to be updated on customer edge router for - the DL 2.0 gateway. - Customer edge IP and IBM IP should be in the same network. Updating customer - edge router CIDR should be accompanied with IBM CIDR in the request. Update - customer edge router IP to a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value - must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", - "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must - have matching network and subnet mask values. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR is the new CIDR (Classless - Inter-Domain Routing) value to be updated on IBM edge router for the DL 2.0 - gateway. - IBM IP and customer edge IP should be in the same network. Updating IBM CIDR - should be accompanied with customer edge router CIDR in the request. Update IBM - CIDR to a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one - of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an - owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and - subnet mask values. + :param str crn: The CRN of the key. """ def __init__( self, - *, - bgp_cer_cidr: str = None, - bgp_ibm_cidr: str = None, + crn: str, ) -> None: """ - Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPIPUpdate object. + Initialize a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity object. - :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR is the - new CIDR (Classless Inter-Domain Routing) value to be updated on customer - edge router for the DL 2.0 gateway. - Customer edge IP and IBM IP should be in the same network. Updating - customer edge router CIDR should be accompanied with IBM CIDR in the - request. Update customer edge router IP to a valid bgp_cer_cidr and - bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", - "172.16.0.0/12", "192.168.0.0/16", - "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr - must have matching network and subnet mask values. - :param str bgp_ibm_cidr: (optional) BGP IBM CIDR is the new CIDR (Classless - Inter-Domain Routing) value to be updated on IBM edge router for the DL 2.0 - gateway. - IBM IP and customer edge IP should be in the same network. Updating IBM - CIDR should be accompanied with customer edge router CIDR in the request. - Update IBM CIDR to a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value - must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", - "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr - must have matching network and subnet mask values. + :param str crn: The CRN of the key. """ # pylint: disable=super-init-not-called - self.bgp_cer_cidr = bgp_cer_cidr + self.crn = crn + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity': + """Initialize a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity object from a json dictionary.""" + args = {} + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + else: + raise ValueError('Required property \'crn\' not present in AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity 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, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + 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 AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity') -> 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: 'AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AuthenticationKeyReferenceHpcsAuthenticationKeyReference(AuthenticationKeyReference): + """ + A reference to a [Hyper Protect Crypto Service Standard + Key](https://cloud.ibm.com/docs/hs-crypto?topic=hs-crypto-get-started). + + :param str crn: The CRN of the referenced key. + """ + + def __init__( + self, + crn: str, + ) -> None: + """ + Initialize a AuthenticationKeyReferenceHpcsAuthenticationKeyReference object. + + :param str crn: The CRN of the referenced key. + """ + # pylint: disable=super-init-not-called + self.crn = crn + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AuthenticationKeyReferenceHpcsAuthenticationKeyReference': + """Initialize a AuthenticationKeyReferenceHpcsAuthenticationKeyReference object from a json dictionary.""" + args = {} + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + else: + raise ValueError('Required property \'crn\' not present in AuthenticationKeyReferenceHpcsAuthenticationKeyReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AuthenticationKeyReferenceHpcsAuthenticationKeyReference 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, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + 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 AuthenticationKeyReferenceHpcsAuthenticationKeyReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AuthenticationKeyReferenceHpcsAuthenticationKeyReference') -> 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: 'AuthenticationKeyReferenceHpcsAuthenticationKeyReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference(AuthenticationKeyReference): + """ + A reference to a [Key Protect Standard + Key](https://cloud.ibm.com/docs/key-protect?topic=key-protect-getting-started-tutorial). + + :param str crn: The CRN of the referenced key. + """ + + def __init__( + self, + crn: str, + ) -> None: + """ + Initialize a AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference object. + + :param str crn: The CRN of the referenced key. + """ + # pylint: disable=super-init-not-called + self.crn = crn + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference': + """Initialize a AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference object from a json dictionary.""" + args = {} + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + else: + raise ValueError('Required property \'crn\' not present in AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference 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, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + 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 AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference') -> 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: 'AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate(GatewayActionTemplateUpdatesItem): + """ + The autonomous system number (ASN) of Border Gateway Protocol + (BGP) configuration for the IBM side of the DL 2.0 gateway. + + :param int bgp_asn: (optional) New gateway BGP ASN. + """ + + def __init__( + self, + *, + bgp_asn: Optional[int] = None, + ) -> None: + """ + Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate object. + + :param int bgp_asn: (optional) New gateway BGP ASN. + """ + # pylint: disable=super-init-not-called + self.bgp_asn = bgp_asn + + @classmethod + def from_dict(cls, _dict: Dict) -> 'GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate': + """Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate object from a json dictionary.""" + args = {} + if (bgp_asn := _dict.get('bgp_asn')) is not None: + args['bgp_asn'] = bgp_asn + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate 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, 'bgp_asn') and self.bgp_asn is not None: + _dict['bgp_asn'] = self.bgp_asn + 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 GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate') -> 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: 'GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class GatewayActionTemplateUpdatesItemGatewayClientBGPIPUpdate(GatewayActionTemplateUpdatesItem): + """ + Update BGP customer and IBM CIDR. + + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR is the new + CIDR (Classless Inter-Domain Routing) value to be updated on customer edge + router for the DL 2.0 gateway. + Customer edge IP and IBM IP should be in the same network. Updating customer + edge router CIDR should be accompanied with IBM CIDR in the request. Update + customer edge router IP to a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value + must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", + "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must + have matching network and subnet mask values. + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR is the new CIDR (Classless + Inter-Domain Routing) value to be updated on IBM edge router for the DL 2.0 + gateway. + IBM IP and customer edge IP should be in the same network. Updating IBM CIDR + should be accompanied with customer edge router CIDR in the request. Update IBM + CIDR to a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one + of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an + owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and + subnet mask values. + """ + + def __init__( + self, + *, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_cidr: Optional[str] = None, + ) -> None: + """ + Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPIPUpdate object. + + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR is the + new CIDR (Classless Inter-Domain Routing) value to be updated on customer + edge router for the DL 2.0 gateway. + Customer edge IP and IBM IP should be in the same network. Updating + customer edge router CIDR should be accompanied with IBM CIDR in the + request. Update customer edge router IP to a valid bgp_cer_cidr and + bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", + "172.16.0.0/12", "192.168.0.0/16", + "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr + must have matching network and subnet mask values. + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR is the new CIDR (Classless + Inter-Domain Routing) value to be updated on IBM edge router for the DL 2.0 + gateway. + IBM IP and customer edge IP should be in the same network. Updating IBM + CIDR should be accompanied with customer edge router CIDR in the request. + Update IBM CIDR to a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value + must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", + "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr + must have matching network and subnet mask values. + """ + # pylint: disable=super-init-not-called + self.bgp_cer_cidr = bgp_cer_cidr self.bgp_ibm_cidr = bgp_ibm_cidr @classmethod def from_dict(cls, _dict: Dict) -> 'GatewayActionTemplateUpdatesItemGatewayClientBGPIPUpdate': """Initialize a GatewayActionTemplateUpdatesItemGatewayClientBGPIPUpdate object from a json dictionary.""" args = {} - if 'bgp_cer_cidr' in _dict: - args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr') - if 'bgp_ibm_cidr' in _dict: - args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr') + if (bgp_cer_cidr := _dict.get('bgp_cer_cidr')) is not None: + args['bgp_cer_cidr'] = bgp_cer_cidr + if (bgp_ibm_cidr := _dict.get('bgp_ibm_cidr')) is not None: + args['bgp_ibm_cidr'] = bgp_ibm_cidr return cls(**args) @classmethod @@ -8997,13 +10430,13 @@ class GatewayActionTemplateUpdatesItemGatewayClientSpeedUpdate(GatewayActionTemp """ gateway speed change. - :attr int speed_mbps: (optional) New gateway speed in megabits per second. + :param int speed_mbps: (optional) New gateway speed in megabits per second. """ def __init__( self, *, - speed_mbps: int = None, + speed_mbps: Optional[int] = None, ) -> None: """ Initialize a GatewayActionTemplateUpdatesItemGatewayClientSpeedUpdate object. @@ -9017,8 +10450,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayActionTemplateUpdatesItemGatewayClientSpeedUpdate': """Initialize a GatewayActionTemplateUpdatesItemGatewayClientSpeedUpdate object from a json dictionary.""" args = {} - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps return cls(**args) @classmethod @@ -9057,13 +10490,13 @@ class GatewayActionTemplateUpdatesItemGatewayClientVLANUpdate(GatewayActionTempl Update VLAN for this gateway VLAN provided should be in the range 2 to 3967. - :attr int vlan: (optional) VLAN to be updated for this gateway. + :param int vlan: (optional) VLAN to be updated for this gateway. """ def __init__( self, *, - vlan: int = None, + vlan: Optional[int] = None, ) -> None: """ Initialize a GatewayActionTemplateUpdatesItemGatewayClientVLANUpdate object. @@ -9077,8 +10510,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayActionTemplateUpdatesItemGatewayClientVLANUpdate': """Initialize a GatewayActionTemplateUpdatesItemGatewayClientVLANUpdate object from a json dictionary.""" args = {} - if 'vlan' in _dict: - args['vlan'] = _dict.get('vlan') + if (vlan := _dict.get('vlan')) is not None: + args['vlan'] = vlan return cls(**args) @classmethod @@ -9117,13 +10550,13 @@ class GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGateway The autonomous system number (ASN) of Border Gateway Protocol (BGP) configuration for the IBM side of the DL 2.0 gateway. - :attr int bgp_asn: (optional) New gateway BGP ASN. + :param int bgp_asn: (optional) New gateway BGP ASN. """ def __init__( self, *, - bgp_asn: int = None, + bgp_asn: Optional[int] = None, ) -> None: """ Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientBGPASNUpdate object. @@ -9137,8 +10570,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientBGPASNUpdate': """Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientBGPASNUpdate object from a json dictionary.""" args = {} - if 'bgp_asn' in _dict: - args['bgp_asn'] = _dict.get('bgp_asn') + if (bgp_asn := _dict.get('bgp_asn')) is not None: + args['bgp_asn'] = bgp_asn return cls(**args) @classmethod @@ -9176,16 +10609,16 @@ class GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGateway """ Update BGP customer and IBM CIDR. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR is the new CIDR - (Classless Inter-Domain Routing) value to be updated on customer edge router for - the DL 2.0 gateway. + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR is the new + CIDR (Classless Inter-Domain Routing) value to be updated on customer edge + router for the DL 2.0 gateway. Customer edge IP and IBM IP should be in the same network. Updating customer edge router CIDR should be accompanied with IBM CIDR in the request. Update customer edge router IP to a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR is the new CIDR (Classless + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR is the new CIDR (Classless Inter-Domain Routing) value to be updated on IBM edge router for the DL 2.0 gateway. IBM IP and customer edge IP should be in the same network. Updating IBM CIDR @@ -9199,8 +10632,8 @@ class GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGateway def __init__( self, *, - bgp_cer_cidr: str = None, - bgp_ibm_cidr: str = None, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_cidr: Optional[str] = None, ) -> None: """ Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientBGPIPUpdate object. @@ -9233,10 +10666,10 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientBGPIPUpdate': """Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientBGPIPUpdate object from a json dictionary.""" args = {} - if 'bgp_cer_cidr' in _dict: - args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr') - if 'bgp_ibm_cidr' in _dict: - args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr') + if (bgp_cer_cidr := _dict.get('bgp_cer_cidr')) is not None: + args['bgp_cer_cidr'] = bgp_cer_cidr + if (bgp_ibm_cidr := _dict.get('bgp_ibm_cidr')) is not None: + args['bgp_ibm_cidr'] = bgp_ibm_cidr return cls(**args) @classmethod @@ -9276,13 +10709,13 @@ class GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGateway """ gateway speed change. - :attr int speed_mbps: (optional) New gateway speed in megabits per second. + :param int speed_mbps: (optional) New gateway speed in megabits per second. """ def __init__( self, *, - speed_mbps: int = None, + speed_mbps: Optional[int] = None, ) -> None: """ Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientSpeedUpdate object. @@ -9296,8 +10729,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientSpeedUpdate': """Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientSpeedUpdate object from a json dictionary.""" args = {} - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps return cls(**args) @classmethod @@ -9336,13 +10769,13 @@ class GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGateway Update VLAN for this gateway VLAN provided should be in the range 2 to 3967. - :attr int vlan: (optional) VLAN to be updated for this gateway. + :param int vlan: (optional) VLAN to be updated for this gateway. """ def __init__( self, *, - vlan: int = None, + vlan: Optional[int] = None, ) -> None: """ Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientVLANUpdate object. @@ -9356,8 +10789,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientVLANUpdate': """Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItemGatewayClientVLANUpdate object from a json dictionary.""" args = {} - if 'vlan' in _dict: - args['vlan'] = _dict.get('vlan') + if (vlan := _dict.get('vlan')) is not None: + args['vlan'] = vlan return cls(**args) @classmethod @@ -9395,7 +10828,7 @@ class GatewayChangeRequestGatewayClientGatewayCreate(GatewayChangeRequest): """ gateway create. - :attr str type: type of gateway change request. + :param str type: type of gateway change request. """ def __init__( @@ -9414,8 +10847,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayChangeRequestGatewayClientGatewayCreate': """Initialize a GatewayChangeRequestGatewayClientGatewayCreate object from a json dictionary.""" args = {} - 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 GatewayChangeRequestGatewayClientGatewayCreate JSON') return cls(**args) @@ -9463,7 +10896,7 @@ class GatewayChangeRequestGatewayClientGatewayDelete(GatewayChangeRequest): """ gateway delete. - :attr str type: type of gateway change request. + :param str type: type of gateway change request. """ def __init__( @@ -9482,8 +10915,8 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayChangeRequestGatewayClientGatewayDelete': """Initialize a GatewayChangeRequestGatewayClientGatewayDelete object from a json dictionary.""" args = {} - 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 GatewayChangeRequestGatewayClientGatewayDelete JSON') return cls(**args) @@ -9531,8 +10964,8 @@ class GatewayChangeRequestGatewayClientGatewayUpdateAttributes(GatewayChangeRequ """ gateway attributes update. - :attr str type: type of gateway change request. - :attr List[GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItem] + :param str type: type of gateway change request. + :param List[GatewayChangeRequestGatewayClientGatewayUpdateAttributesUpdatesItem] updates: array of pending updates. """ @@ -9557,12 +10990,12 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayChangeRequestGatewayClientGatewayUpdateAttributes': """Initialize a GatewayChangeRequestGatewayClientGatewayUpdateAttributes object from a json dictionary.""" args = {} - 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 GatewayChangeRequestGatewayClientGatewayUpdateAttributes JSON') - if 'updates' in _dict: - args['updates'] = _dict.get('updates') + if (updates := _dict.get('updates')) is not None: + args['updates'] = updates else: raise ValueError('Required property \'updates\' not present in GatewayChangeRequestGatewayClientGatewayUpdateAttributes JSON') return cls(**args) @@ -9618,41 +11051,41 @@ class GatewayCollectionGatewaysItemCrossAccountGateway(GatewayCollectionGateways """ cross-account gateway read-only view. - :attr str bgp_status: (optional) Gateway BGP status. The list of enumerated + :param str bgp_status: (optional) Gateway BGP 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 bgp_status_updated_at: (optional) Date and time bgp status was + :param datetime bgp_status_updated_at: (optional) Date and time bgp status was updated. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 datetime created_at: The date and time resource was created. - :attr str crn: The CRN (Cloud Resource Name) of this gateway. - :attr bool cross_account: Indicates whether this gateway is cross account + :param datetime created_at: The date and time resource was created. + :param str crn: The CRN (Cloud Resource Name) of this gateway. + :param bool cross_account: Indicates whether this gateway is cross account gateway. - :attr str cross_connect_router: (optional) Cross connect router. Only included + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. - :attr bool global_: Gateways with global routing (`true`) can connect to + :param bool global_: Gateways with global routing (`true`) can connect to networks outside their associated region. - :attr str id: The unique identifier of this gateway. - :attr str link_status: (optional) Gateway link status. Only included on + :param str id: The unique identifier of this gateway. + :param str link_status: (optional) Gateway link status. Only included on type=dedicated gateways. 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 link_status_updated_at: (optional) Date and time link status was + :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :attr str location_display_name: Gateway location long name. - :attr str location_name: Gateway location. - :attr str name: The unique user-defined name for this gateway. - :attr str operational_status: Gateway operational 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 CrossAccountGatewayPort port: (optional) gateway port for type=connect + :param str location_display_name: Gateway location long name. + :param str location_name: Gateway location. + :param str name: The unique user-defined name for this gateway. + :param str operational_status: Gateway operational status. The list of + enumerated values for this property may expand in the future. Code and processes + using this field must tolerate unexpected values. + :param GatewayPortReference port: (optional) Port information for type=connect gateways. - :attr int speed_mbps: Gateway speed in megabits per second. - :attr str type: Offering type. The list of enumerated values for this property + :param int speed_mbps: Gateway speed in megabits per second. + :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ @@ -9671,13 +11104,13 @@ def __init__( speed_mbps: int, type: str, *, - bgp_status: str = None, - bgp_status_updated_at: datetime = None, - connection_mode: str = None, - cross_connect_router: str = None, - link_status: str = None, - link_status_updated_at: datetime = None, - port: 'CrossAccountGatewayPort' = None, + bgp_status: Optional[str] = None, + bgp_status_updated_at: Optional[datetime] = None, + connection_mode: Optional[str] = None, + cross_connect_router: Optional[str] = None, + link_status: Optional[str] = None, + link_status_updated_at: Optional[datetime] = None, + port: Optional['GatewayPortReference'] = None, ) -> None: """ Initialize a GatewayCollectionGatewaysItemCrossAccountGateway object. @@ -9710,7 +11143,7 @@ def __init__( classic connection. 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 cross_connect_router: (optional) Cross connect router. Only + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. :param str link_status: (optional) Gateway link status. Only included on type=dedicated gateways. The list of enumerated values for this property @@ -9718,7 +11151,7 @@ def __init__( tolerate unexpected values. :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :param CrossAccountGatewayPort port: (optional) gateway port for + :param GatewayPortReference port: (optional) Port information for type=connect gateways. """ # pylint: disable=super-init-not-called @@ -9745,62 +11178,62 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayCollectionGatewaysItemCrossAccountGateway': """Initialize a GatewayCollectionGatewaysItemCrossAccountGateway object from a json dictionary.""" args = {} - if 'bgp_status' in _dict: - args['bgp_status'] = _dict.get('bgp_status') - if 'bgp_status_updated_at' in _dict: - args['bgp_status_updated_at'] = string_to_datetime(_dict.get('bgp_status_updated_at')) - if 'connection_mode' in _dict: - args['connection_mode'] = _dict.get('connection_mode') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (bgp_status := _dict.get('bgp_status')) is not None: + args['bgp_status'] = bgp_status + if (bgp_status_updated_at := _dict.get('bgp_status_updated_at')) is not None: + args['bgp_status_updated_at'] = string_to_datetime(bgp_status_updated_at) + if (connection_mode := _dict.get('connection_mode')) is not None: + args['connection_mode'] = connection_mode + 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 GatewayCollectionGatewaysItemCrossAccountGateway JSON') - 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 GatewayCollectionGatewaysItemCrossAccountGateway JSON') - if 'cross_account' in _dict: - args['cross_account'] = _dict.get('cross_account') + if (cross_account := _dict.get('cross_account')) is not None: + args['cross_account'] = cross_account else: raise ValueError('Required property \'cross_account\' not present in GatewayCollectionGatewaysItemCrossAccountGateway JSON') - if 'cross_connect_router' in _dict: - args['cross_connect_router'] = _dict.get('cross_connect_router') - if 'global' in _dict: - args['global_'] = _dict.get('global') + if (cross_connect_router := _dict.get('cross_connect_router')) is not None: + args['cross_connect_router'] = cross_connect_router + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in GatewayCollectionGatewaysItemCrossAccountGateway 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 GatewayCollectionGatewaysItemCrossAccountGateway JSON') - if 'link_status' in _dict: - args['link_status'] = _dict.get('link_status') - if 'link_status_updated_at' in _dict: - args['link_status_updated_at'] = string_to_datetime(_dict.get('link_status_updated_at')) - if 'location_display_name' in _dict: - args['location_display_name'] = _dict.get('location_display_name') + if (link_status := _dict.get('link_status')) is not None: + args['link_status'] = link_status + if (link_status_updated_at := _dict.get('link_status_updated_at')) is not None: + args['link_status_updated_at'] = string_to_datetime(link_status_updated_at) + if (location_display_name := _dict.get('location_display_name')) is not None: + args['location_display_name'] = location_display_name else: raise ValueError('Required property \'location_display_name\' not present in GatewayCollectionGatewaysItemCrossAccountGateway JSON') - if 'location_name' in _dict: - args['location_name'] = _dict.get('location_name') + if (location_name := _dict.get('location_name')) is not None: + args['location_name'] = location_name else: raise ValueError('Required property \'location_name\' not present in GatewayCollectionGatewaysItemCrossAccountGateway 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 GatewayCollectionGatewaysItemCrossAccountGateway JSON') - if 'operational_status' in _dict: - args['operational_status'] = _dict.get('operational_status') + if (operational_status := _dict.get('operational_status')) is not None: + args['operational_status'] = operational_status else: raise ValueError('Required property \'operational_status\' not present in GatewayCollectionGatewaysItemCrossAccountGateway JSON') - if 'port' in _dict: - args['port'] = CrossAccountGatewayPort.from_dict(_dict.get('port')) - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (port := _dict.get('port')) is not None: + args['port'] = GatewayPortReference.from_dict(port) + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps else: raise ValueError('Required property \'speed_mbps\' not present in GatewayCollectionGatewaysItemCrossAccountGateway 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 GatewayCollectionGatewaysItemCrossAccountGateway JSON') return cls(**args) @@ -9945,86 +11378,94 @@ class GatewayCollectionGatewaysItemGateway(GatewayCollectionGatewaysItem): """ gateway. - :attr List[AsPrepend] as_prepends: (optional) array of AS Prepend information. - :attr GatewayAuthenticationKey authentication_key: (optional) The identity of - the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original string - must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. - :attr GatewayBfdConfig bfd_config: (optional) BFD configuration information. - :attr int bgp_asn: Customer BGP ASN. - :attr str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated and - no longer recognized by the Direct Link APIs. + :param List[AsPrepend] as_prepends: (optional) array of AS Prepend information. + :param AuthenticationKeyReference authentication_key: (optional) + :param GatewayBfdConfig bfd_config: (optional) BFD configuration information. + :param int bgp_asn: Customer BGP ASN. + :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated + and no longer recognized by the Direct Link APIs. See bgp_cer_cidr and bgp_ibm_cidr fields instead for IP related information. - Deprecated field bgp_base_cidr will be removed from the API specificiation after + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR. - :attr int bgp_ibm_asn: (optional) IBM BGP ASN. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR. - :attr str bgp_status: (optional) Gateway BGP status. The list of enumerated + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. + :param int bgp_ibm_asn: (optional) IBM BGP ASN. + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR. + :param str bgp_status: (optional) Gateway BGP 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 bgp_status_updated_at: (optional) Date and time bgp status was + :param datetime bgp_status_updated_at: (optional) Date and time bgp status was updated. - :attr str carrier_name: (optional) Carrier name. Only set for type=dedicated + :param str carrier_name: (optional) Carrier name. Only set for type=dedicated gateways. - :attr GatewayChangeRequest change_request: (optional) Changes pending approval + :param GatewayChangeRequest change_request: (optional) Changes pending approval for provider managed Direct Link Connect gateways. - :attr str completion_notice_reject_reason: (optional) Reason for completion + :param str completion_notice_reject_reason: (optional) Reason for completion notice rejection. Only included on type=dedicated gateways with a rejected completion notice. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 datetime created_at: The date and time resource was created. - :attr str crn: The CRN (Cloud Resource Name) of this gateway. - :attr bool cross_account: Indicates whether this gateway is cross account + :param datetime created_at: The date and time resource was created. + :param str crn: The CRN (Cloud Resource Name) of this gateway. + :param bool cross_account: Indicates whether this gateway is cross account gateway. - :attr str cross_connect_router: (optional) Cross connect router. Only included + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. - :attr str customer_name: (optional) Customer name. Only set for type=dedicated + :param str customer_name: (optional) Customer name. Only set for type=dedicated gateways. - :attr str default_export_route_filter: The default directional route filter + :param str default_export_route_filter: The default directional route filter action that applies to routes that do not match any directional route filters. - :attr str default_import_route_filter: The default directional route filter + :param str default_import_route_filter: The default directional route filter action that applies to routes that do not match any directional route filters. - :attr bool global_: Gateways with global routing (`true`) can connect to + :param bool global_: Gateways with global routing (`true`) can connect to networks outside their associated region. - :attr str id: The unique identifier of this gateway. - :attr str link_status: (optional) Gateway link status. Only included on + :param str id: The unique identifier of this gateway. + :param str link_status: (optional) Gateway link status. Only included on type=dedicated gateways. 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 link_status_updated_at: (optional) Date and time link status was + :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :attr str location_display_name: Gateway location long name. - :attr str location_name: Gateway location. - :attr GatewayMacsecConfig macsec_config: (optional) MACsec configuration - information. For Dedicated Gateways with MACsec configured, return - configuration information. Contact IBM support for access to MACsec. - :attr bool metered: Metered billing option. When `true` gateway usage is billed - per gigabyte. When `false` there is no per gigabyte usage charge, instead a - flat rate is charged for the gateway. - :attr str name: The unique user-defined name for this gateway. - :attr str operational_status: Gateway operational 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 GatewayPort port: (optional) gateway port for type=connect gateways. - :attr bool provider_api_managed: (optional) Indicates whether gateway changes + :param str location_display_name: Gateway location long name. + :param str location_name: Gateway location. + :param GatewayMacsecReference macsec: (optional) MACsec configuration + information of a Direct Link gateway. + :param str macsec_capability: (optional) Indicates the direct link's MACsec + capability. It must match one of the MACsec related `capabilities` of the + `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is not + required and can be enabled after direct link creation. + :param bool metered: Metered billing option. When `true` gateway usage is + billed per gigabyte. When `false` there is no per gigabyte usage charge, + instead a flat rate is charged for the gateway. + :param str name: The unique user-defined name for this gateway. + :param str operational_status: Gateway operational status. The list of + enumerated values for this property may expand in the future. Code and processes + using this field must tolerate unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. + :param List[GatewayStatusReason] operational_status_reasons: Context for certain + values of `operational_status`. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param GatewayPortReference port: (optional) Port information for type=connect + gateways. + :param bool provider_api_managed: (optional) Indicates whether gateway changes must be made via a provider portal. - :attr ResourceGroupReference resource_group: (optional) Resource group + :param ResourceGroupReference resource_group: (optional) Resource group reference. - :attr int speed_mbps: Gateway speed in megabits per second. - :attr str patch_panel_completion_notice: (optional) Gateway patch panel complete - notification from implementation team. - :attr str type: Offering type. The list of enumerated values for this property + :param int speed_mbps: Gateway speed in megabits per second. + :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. - :attr int vlan: (optional) VLAN configured for this gateway. If there is no vlan - configured for the gateway, the vlan will be absent. This property will also be - absent if this gateway's `crn` is in another account. + :param int vlan: (optional) VLAN configured for this gateway. If there is no + vlan configured for the gateway, the vlan will be absent. This property will + also be absent if this gateway's `crn` is in another account. """ def __init__( @@ -10042,32 +11483,34 @@ def __init__( metered: bool, name: str, operational_status: str, + operational_status_reasons: List['GatewayStatusReason'], speed_mbps: int, type: str, *, - as_prepends: List['AsPrepend'] = None, - authentication_key: 'GatewayAuthenticationKey' = None, - bfd_config: 'GatewayBfdConfig' = None, - bgp_base_cidr: str = None, - bgp_cer_cidr: str = None, - bgp_ibm_asn: int = None, - bgp_ibm_cidr: str = None, - bgp_status: str = None, - bgp_status_updated_at: datetime = None, - carrier_name: str = None, - change_request: 'GatewayChangeRequest' = None, - completion_notice_reject_reason: str = None, - connection_mode: str = None, - cross_connect_router: str = None, - customer_name: str = None, - link_status: str = None, - link_status_updated_at: datetime = None, - macsec_config: 'GatewayMacsecConfig' = None, - port: 'GatewayPort' = None, - provider_api_managed: bool = None, - resource_group: 'ResourceGroupReference' = None, - patch_panel_completion_notice: str = None, - vlan: int = None, + as_prepends: Optional[List['AsPrepend']] = None, + authentication_key: Optional['AuthenticationKeyReference'] = None, + bfd_config: Optional['GatewayBfdConfig'] = None, + bgp_base_cidr: Optional[str] = None, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_asn: Optional[int] = None, + bgp_ibm_cidr: Optional[str] = None, + bgp_status: Optional[str] = None, + bgp_status_updated_at: Optional[datetime] = None, + carrier_name: Optional[str] = None, + change_request: Optional['GatewayChangeRequest'] = None, + completion_notice_reject_reason: Optional[str] = None, + connection_mode: Optional[str] = None, + cross_connect_router: Optional[str] = None, + customer_name: Optional[str] = None, + link_status: Optional[str] = None, + link_status_updated_at: Optional[datetime] = None, + macsec: Optional['GatewayMacsecReference'] = None, + macsec_capability: Optional[str] = None, + patch_panel_completion_notice: Optional[str] = None, + port: Optional['GatewayPortReference'] = None, + provider_api_managed: Optional[bool] = None, + resource_group: Optional['ResourceGroupReference'] = None, + vlan: Optional[int] = None, ) -> None: """ Initialize a GatewayCollectionGatewaysItemGateway object. @@ -10095,24 +11538,24 @@ def __init__( :param str operational_status: Gateway operational status. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. + :param List[GatewayStatusReason] operational_status_reasons: Context for + certain values of `operational_status`. :param int speed_mbps: Gateway speed in megabits per second. :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. :param List[AsPrepend] as_prepends: (optional) array of AS Prepend information. - :param GatewayAuthenticationKey authentication_key: (optional) The identity - of the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original - string must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. + :param AuthenticationKeyReference authentication_key: (optional) :param GatewayBfdConfig bfd_config: (optional) BFD configuration information. :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated and no longer recognized by the Direct Link APIs. See bgp_cer_cidr and bgp_ibm_cidr fields instead for IP related information. - Deprecated field bgp_base_cidr will be removed from the API specificiation + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. :param int bgp_ibm_asn: (optional) IBM BGP ASN. @@ -10135,7 +11578,7 @@ def __init__( classic connection. 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 cross_connect_router: (optional) Cross connect router. Only + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. :param str customer_name: (optional) Customer name. Only set for type=dedicated gateways. @@ -10145,16 +11588,25 @@ def __init__( tolerate unexpected values. :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :param GatewayMacsecConfig macsec_config: (optional) MACsec configuration - information. For Dedicated Gateways with MACsec configured, return - configuration information. Contact IBM support for access to MACsec. - :param GatewayPort port: (optional) gateway port for type=connect gateways. + :param GatewayMacsecReference macsec: (optional) MACsec configuration + information of a Direct Link gateway. + :param str macsec_capability: (optional) Indicates the direct link's MACsec + capability. It must match one of the MACsec related `capabilities` of the + `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be + enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is + not required and can be enabled after direct link creation. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param GatewayPortReference port: (optional) Port information for + type=connect gateways. :param bool provider_api_managed: (optional) Indicates whether gateway changes must be made via a provider portal. :param ResourceGroupReference resource_group: (optional) Resource group reference. - :param str patch_panel_completion_notice: (optional) Gateway patch panel - complete notification from implementation team. :param int vlan: (optional) VLAN configured for this gateway. If there is no vlan configured for the gateway, the vlan will be absent. This property will also be absent if this gateway's `crn` is in another account. @@ -10187,15 +11639,17 @@ def __init__( self.link_status_updated_at = link_status_updated_at self.location_display_name = location_display_name self.location_name = location_name - self.macsec_config = macsec_config + self.macsec = macsec + self.macsec_capability = macsec_capability self.metered = metered self.name = name self.operational_status = operational_status + self.operational_status_reasons = operational_status_reasons + self.patch_panel_completion_notice = patch_panel_completion_notice self.port = port self.provider_api_managed = provider_api_managed self.resource_group = resource_group self.speed_mbps = speed_mbps - self.patch_panel_completion_notice = patch_panel_completion_notice self.type = type self.vlan = vlan @@ -10203,112 +11657,118 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayCollectionGatewaysItemGateway': """Initialize a GatewayCollectionGatewaysItemGateway object from a json dictionary.""" args = {} - if 'as_prepends' in _dict: - args['as_prepends'] = [AsPrepend.from_dict(v) for v in _dict.get('as_prepends')] - if 'authentication_key' in _dict: - args['authentication_key'] = GatewayAuthenticationKey.from_dict(_dict.get('authentication_key')) - if 'bfd_config' in _dict: - args['bfd_config'] = GatewayBfdConfig.from_dict(_dict.get('bfd_config')) - if 'bgp_asn' in _dict: - args['bgp_asn'] = _dict.get('bgp_asn') + if (as_prepends := _dict.get('as_prepends')) is not None: + args['as_prepends'] = [AsPrepend.from_dict(v) for v in as_prepends] + if (authentication_key := _dict.get('authentication_key')) is not None: + args['authentication_key'] = authentication_key + if (bfd_config := _dict.get('bfd_config')) is not None: + args['bfd_config'] = GatewayBfdConfig.from_dict(bfd_config) + if (bgp_asn := _dict.get('bgp_asn')) is not None: + args['bgp_asn'] = bgp_asn else: raise ValueError('Required property \'bgp_asn\' not present in GatewayCollectionGatewaysItemGateway JSON') - if 'bgp_base_cidr' in _dict: - args['bgp_base_cidr'] = _dict.get('bgp_base_cidr') - if 'bgp_cer_cidr' in _dict: - args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr') - if 'bgp_ibm_asn' in _dict: - args['bgp_ibm_asn'] = _dict.get('bgp_ibm_asn') - if 'bgp_ibm_cidr' in _dict: - args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr') - if 'bgp_status' in _dict: - args['bgp_status'] = _dict.get('bgp_status') - if 'bgp_status_updated_at' in _dict: - args['bgp_status_updated_at'] = string_to_datetime(_dict.get('bgp_status_updated_at')) - if 'carrier_name' in _dict: - args['carrier_name'] = _dict.get('carrier_name') - if 'change_request' in _dict: - args['change_request'] = _dict.get('change_request') - if 'completion_notice_reject_reason' in _dict: - args['completion_notice_reject_reason'] = _dict.get('completion_notice_reject_reason') - if 'connection_mode' in _dict: - args['connection_mode'] = _dict.get('connection_mode') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (bgp_base_cidr := _dict.get('bgp_base_cidr')) is not None: + args['bgp_base_cidr'] = bgp_base_cidr + if (bgp_cer_cidr := _dict.get('bgp_cer_cidr')) is not None: + args['bgp_cer_cidr'] = bgp_cer_cidr + if (bgp_ibm_asn := _dict.get('bgp_ibm_asn')) is not None: + args['bgp_ibm_asn'] = bgp_ibm_asn + if (bgp_ibm_cidr := _dict.get('bgp_ibm_cidr')) is not None: + args['bgp_ibm_cidr'] = bgp_ibm_cidr + if (bgp_status := _dict.get('bgp_status')) is not None: + args['bgp_status'] = bgp_status + if (bgp_status_updated_at := _dict.get('bgp_status_updated_at')) is not None: + args['bgp_status_updated_at'] = string_to_datetime(bgp_status_updated_at) + if (carrier_name := _dict.get('carrier_name')) is not None: + args['carrier_name'] = carrier_name + if (change_request := _dict.get('change_request')) is not None: + args['change_request'] = change_request + if (completion_notice_reject_reason := _dict.get('completion_notice_reject_reason')) is not None: + args['completion_notice_reject_reason'] = completion_notice_reject_reason + if (connection_mode := _dict.get('connection_mode')) is not None: + args['connection_mode'] = connection_mode + 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 GatewayCollectionGatewaysItemGateway JSON') - 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 GatewayCollectionGatewaysItemGateway JSON') - if 'cross_account' in _dict: - args['cross_account'] = _dict.get('cross_account') + if (cross_account := _dict.get('cross_account')) is not None: + args['cross_account'] = cross_account else: raise ValueError('Required property \'cross_account\' not present in GatewayCollectionGatewaysItemGateway JSON') - if 'cross_connect_router' in _dict: - args['cross_connect_router'] = _dict.get('cross_connect_router') - if 'customer_name' in _dict: - args['customer_name'] = _dict.get('customer_name') - if 'default_export_route_filter' in _dict: - args['default_export_route_filter'] = _dict.get('default_export_route_filter') + if (cross_connect_router := _dict.get('cross_connect_router')) is not None: + args['cross_connect_router'] = cross_connect_router + if (customer_name := _dict.get('customer_name')) is not None: + args['customer_name'] = customer_name + if (default_export_route_filter := _dict.get('default_export_route_filter')) is not None: + args['default_export_route_filter'] = default_export_route_filter else: raise ValueError('Required property \'default_export_route_filter\' not present in GatewayCollectionGatewaysItemGateway JSON') - if 'default_import_route_filter' in _dict: - args['default_import_route_filter'] = _dict.get('default_import_route_filter') + if (default_import_route_filter := _dict.get('default_import_route_filter')) is not None: + args['default_import_route_filter'] = default_import_route_filter else: raise ValueError('Required property \'default_import_route_filter\' not present in GatewayCollectionGatewaysItemGateway JSON') - if 'global' in _dict: - args['global_'] = _dict.get('global') + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in GatewayCollectionGatewaysItemGateway 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 GatewayCollectionGatewaysItemGateway JSON') - if 'link_status' in _dict: - args['link_status'] = _dict.get('link_status') - if 'link_status_updated_at' in _dict: - args['link_status_updated_at'] = string_to_datetime(_dict.get('link_status_updated_at')) - if 'location_display_name' in _dict: - args['location_display_name'] = _dict.get('location_display_name') + if (link_status := _dict.get('link_status')) is not None: + args['link_status'] = link_status + if (link_status_updated_at := _dict.get('link_status_updated_at')) is not None: + args['link_status_updated_at'] = string_to_datetime(link_status_updated_at) + if (location_display_name := _dict.get('location_display_name')) is not None: + args['location_display_name'] = location_display_name else: raise ValueError('Required property \'location_display_name\' not present in GatewayCollectionGatewaysItemGateway JSON') - if 'location_name' in _dict: - args['location_name'] = _dict.get('location_name') + if (location_name := _dict.get('location_name')) is not None: + args['location_name'] = location_name else: raise ValueError('Required property \'location_name\' not present in GatewayCollectionGatewaysItemGateway JSON') - if 'macsec_config' in _dict: - args['macsec_config'] = GatewayMacsecConfig.from_dict(_dict.get('macsec_config')) - if 'metered' in _dict: - args['metered'] = _dict.get('metered') + if (macsec := _dict.get('macsec')) is not None: + args['macsec'] = GatewayMacsecReference.from_dict(macsec) + if (macsec_capability := _dict.get('macsec_capability')) is not None: + args['macsec_capability'] = macsec_capability + if (metered := _dict.get('metered')) is not None: + args['metered'] = metered else: raise ValueError('Required property \'metered\' not present in GatewayCollectionGatewaysItemGateway 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 GatewayCollectionGatewaysItemGateway JSON') - if 'operational_status' in _dict: - args['operational_status'] = _dict.get('operational_status') + if (operational_status := _dict.get('operational_status')) is not None: + args['operational_status'] = operational_status else: raise ValueError('Required property \'operational_status\' not present in GatewayCollectionGatewaysItemGateway JSON') - if 'port' in _dict: - args['port'] = GatewayPort.from_dict(_dict.get('port')) - if 'provider_api_managed' in _dict: - args['provider_api_managed'] = _dict.get('provider_api_managed') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (operational_status_reasons := _dict.get('operational_status_reasons')) is not None: + args['operational_status_reasons'] = [GatewayStatusReason.from_dict(v) for v in operational_status_reasons] + else: + raise ValueError('Required property \'operational_status_reasons\' not present in GatewayCollectionGatewaysItemGateway JSON') + if (patch_panel_completion_notice := _dict.get('patch_panel_completion_notice')) is not None: + args['patch_panel_completion_notice'] = patch_panel_completion_notice + if (port := _dict.get('port')) is not None: + args['port'] = GatewayPortReference.from_dict(port) + if (provider_api_managed := _dict.get('provider_api_managed')) is not None: + args['provider_api_managed'] = provider_api_managed + if (resource_group := _dict.get('resource_group')) is not None: + args['resource_group'] = ResourceGroupReference.from_dict(resource_group) + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps else: raise ValueError('Required property \'speed_mbps\' not present in GatewayCollectionGatewaysItemGateway JSON') - if 'patch_panel_completion_notice' in _dict: - args['patch_panel_completion_notice'] = _dict.get('patch_panel_completion_notice') - 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 GatewayCollectionGatewaysItemGateway JSON') - if 'vlan' in _dict: - args['vlan'] = _dict.get('vlan') + if (vlan := _dict.get('vlan')) is not None: + args['vlan'] = vlan return cls(**args) @classmethod @@ -10388,17 +11848,29 @@ def to_dict(self) -> Dict: _dict['location_display_name'] = self.location_display_name if hasattr(self, 'location_name') and self.location_name is not None: _dict['location_name'] = self.location_name - if hasattr(self, 'macsec_config') and self.macsec_config is not None: - if isinstance(self.macsec_config, dict): - _dict['macsec_config'] = self.macsec_config + if hasattr(self, 'macsec') and self.macsec is not None: + if isinstance(self.macsec, dict): + _dict['macsec'] = self.macsec else: - _dict['macsec_config'] = self.macsec_config.to_dict() + _dict['macsec'] = self.macsec.to_dict() + if hasattr(self, 'macsec_capability') and self.macsec_capability is not None: + _dict['macsec_capability'] = self.macsec_capability if hasattr(self, 'metered') and self.metered is not None: _dict['metered'] = self.metered if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'operational_status') and self.operational_status is not None: _dict['operational_status'] = self.operational_status + if hasattr(self, 'operational_status_reasons') and self.operational_status_reasons is not None: + operational_status_reasons_list = [] + for v in self.operational_status_reasons: + if isinstance(v, dict): + operational_status_reasons_list.append(v) + else: + operational_status_reasons_list.append(v.to_dict()) + _dict['operational_status_reasons'] = operational_status_reasons_list + if hasattr(self, 'patch_panel_completion_notice') and self.patch_panel_completion_notice is not None: + _dict['patch_panel_completion_notice'] = self.patch_panel_completion_notice if hasattr(self, 'port') and self.port is not None: if isinstance(self.port, dict): _dict['port'] = self.port @@ -10413,8 +11885,6 @@ def to_dict(self) -> Dict: _dict['resource_group'] = self.resource_group.to_dict() if hasattr(self, 'speed_mbps') and self.speed_mbps is not None: _dict['speed_mbps'] = self.speed_mbps - if hasattr(self, 'patch_panel_completion_notice') and self.patch_panel_completion_notice is not None: - _dict['patch_panel_completion_notice'] = self.patch_panel_completion_notice if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type if hasattr(self, 'vlan') and self.vlan is not None: @@ -10495,11 +11965,29 @@ class LinkStatusEnum(str, Enum): UP = 'up' + class MacsecCapabilityEnum(str, Enum): + """ + Indicates the direct link's MACsec capability. It must match one of the MACsec + related `capabilities` of the `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is not + required and can be enabled after direct link creation. + """ + + NON_MACSEC = 'non_macsec' + MACSEC = 'macsec' + MACSEC_OPTIONAL = 'macsec_optional' + + class OperationalStatusEnum(str, Enum): """ Gateway operational status. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. """ AWAITING_COMPLETION_NOTICE = 'awaiting_completion_notice' @@ -10515,6 +12003,7 @@ class OperationalStatusEnum(str, Enum): LOA_CREATED = 'loa_created' LOA_REJECTED = 'loa_rejected' PROVISIONED = 'provisioned' + FAILED = 'failed' class TypeEnum(str, Enum): @@ -10532,9 +12021,9 @@ class GatewayStatusGatewayBFDStatus(GatewayStatus): """ Gateway bfd status. - :attr str type: Status type. - :attr datetime updated_at: Date and time status was collected. - :attr str value: Status. + :param str type: Status type. + :param datetime updated_at: Date and time status was collected. + :param str value: Status. """ def __init__( @@ -10559,16 +12048,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayStatusGatewayBFDStatus': """Initialize a GatewayStatusGatewayBFDStatus object from a json dictionary.""" args = {} - 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 GatewayStatusGatewayBFDStatus 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 GatewayStatusGatewayBFDStatus JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + if (value := _dict.get('value')) is not None: + args['value'] = value else: raise ValueError('Required property \'value\' not present in GatewayStatusGatewayBFDStatus JSON') return cls(**args) @@ -10631,9 +12120,9 @@ class GatewayStatusGatewayBGPStatus(GatewayStatus): """ Gateway bgp status. - :attr str type: Status type. - :attr datetime updated_at: Date and time status was collected. - :attr str value: Status. + :param str type: Status type. + :param datetime updated_at: Date and time status was collected. + :param str value: Status. """ def __init__( @@ -10658,16 +12147,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayStatusGatewayBGPStatus': """Initialize a GatewayStatusGatewayBGPStatus object from a json dictionary.""" args = {} - 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 GatewayStatusGatewayBGPStatus 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 GatewayStatusGatewayBGPStatus JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + if (value := _dict.get('value')) is not None: + args['value'] = value else: raise ValueError('Required property \'value\' not present in GatewayStatusGatewayBGPStatus JSON') return cls(**args) @@ -10730,9 +12219,9 @@ class GatewayStatusGatewayLinkStatus(GatewayStatus): """ Gateway link status. Only available for dedicated gateways. - :attr str type: Status type. - :attr datetime updated_at: Date and time status was collected. - :attr str value: Status. + :param str type: Status type. + :param datetime updated_at: Date and time status was collected. + :param str value: Status. """ def __init__( @@ -10757,16 +12246,16 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayStatusGatewayLinkStatus': """Initialize a GatewayStatusGatewayLinkStatus object from a json dictionary.""" args = {} - 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 GatewayStatusGatewayLinkStatus 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 GatewayStatusGatewayLinkStatus JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + if (value := _dict.get('value')) is not None: + args['value'] = value else: raise ValueError('Required property \'value\' not present in GatewayStatusGatewayLinkStatus JSON') return cls(**args) @@ -10827,62 +12316,62 @@ class GatewayTemplateGatewayTypeConnectTemplate(GatewayTemplate): """ Gateway fields specific to type=connect gateway create. - :attr List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend configuration information. - :attr GatewayTemplateAuthenticationKey authentication_key: (optional) - :attr GatewayBfdConfigTemplate bfd_config: (optional) - :attr int bgp_asn: BGP ASN. - :attr str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. + :param AuthenticationKeyIdentity authentication_key: (optional) + :param GatewayBfdConfigTemplate bfd_config: (optional) + :param int bgp_asn: BGP ASN. + :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. Field is deprecated. See bgp_ibm_cidr and bgp_cer_cidr for details on how to create a gateway using either automatic or explicit IP assignment. Any bgp_base_cidr value set will be ignored. - Deprecated field bgp_base_cidr will be removed from the API specificiation after + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR. + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will automatically select values for bgp_cer_cidr and bgp_ibm_cidr. For explicit IP assignment set a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR. + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will automatically select values for bgp_cer_cidr and bgp_ibm_cidr. For explicit IP assignment set a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 default_export_route_filter: (optional) The default directional route + :param str default_export_route_filter: (optional) The default directional route filter action that applies to routes that do not match any directional route filters. - :attr str default_import_route_filter: (optional) The default directional route + :param str default_import_route_filter: (optional) The default directional route filter action that applies to routes that do not match any directional route filters. - :attr List[GatewayTemplateRouteFilter] export_route_filters: (optional) Array of - directional route filters for a Direct Link gateway. When creating a gateway or - replacing existing route filters, the order of the items in the array will set - the ordering of the list of route filters. - :attr bool global_: Gateways with global routing (`true`) can connect to + :param List[GatewayTemplateRouteFilter] export_route_filters: (optional) Array + of directional route filters for a Direct Link gateway. When creating a gateway + or replacing existing route filters, the order of the items in the array will + set the ordering of the list of route filters. + :param bool global_: Gateways with global routing (`true`) can connect to networks outside their associated region. - :attr List[GatewayTemplateRouteFilter] import_route_filters: (optional) Array of - directional route filters for a Direct Link gateway. When creating a gateway or - replacing existing route filters, the order of the items in the array will set - the ordering of the list of route filters. - :attr bool metered: Metered billing option. When `true` gateway usage is billed - per gigabyte. When `false` there is no per gigabyte usage charge, instead a - flat rate is charged for the gateway. - :attr str name: The unique user-defined name for this gateway. - :attr str patch_panel_completion_notice: (optional) Gateway patch panel complete - notification from implementation team. - :attr ResourceGroupIdentity resource_group: (optional) - :attr int speed_mbps: Gateway speed in megabits per second. - :attr str type: Offering type. - :attr GatewayPortIdentity port: Select Port Label for new type=connect gateway. + :param List[GatewayTemplateRouteFilter] import_route_filters: (optional) Array + of directional route filters for a Direct Link gateway. When creating a gateway + or replacing existing route filters, the order of the items in the array will + set the ordering of the list of route filters. + :param bool metered: Metered billing option. When `true` gateway usage is + billed per gigabyte. When `false` there is no per gigabyte usage charge, + instead a flat rate is charged for the gateway. + :param str name: The unique user-defined name for this gateway. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param ResourceGroupIdentity resource_group: (optional) + :param int speed_mbps: Gateway speed in megabits per second. + :param str type: Offering type. + :param GatewayPortIdentity port: Select Port Label for new type=connect gateway. """ def __init__( @@ -10895,19 +12384,19 @@ def __init__( type: str, port: 'GatewayPortIdentity', *, - as_prepends: List['AsPrependTemplate'] = None, - authentication_key: 'GatewayTemplateAuthenticationKey' = None, - bfd_config: 'GatewayBfdConfigTemplate' = None, - bgp_base_cidr: str = None, - bgp_cer_cidr: str = None, - bgp_ibm_cidr: str = None, - connection_mode: str = None, - default_export_route_filter: str = None, - default_import_route_filter: str = None, - export_route_filters: List['GatewayTemplateRouteFilter'] = None, - import_route_filters: List['GatewayTemplateRouteFilter'] = None, - patch_panel_completion_notice: str = None, - resource_group: 'ResourceGroupIdentity' = None, + as_prepends: Optional[List['AsPrependTemplate']] = None, + authentication_key: Optional['AuthenticationKeyIdentity'] = None, + bfd_config: Optional['GatewayBfdConfigTemplate'] = None, + bgp_base_cidr: Optional[str] = None, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_cidr: Optional[str] = None, + connection_mode: Optional[str] = None, + default_export_route_filter: Optional[str] = None, + default_import_route_filter: Optional[str] = None, + export_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, + import_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, + patch_panel_completion_notice: Optional[str] = None, + resource_group: Optional['ResourceGroupIdentity'] = None, ) -> None: """ Initialize a GatewayTemplateGatewayTypeConnectTemplate object. @@ -10925,13 +12414,13 @@ def __init__( gateway. :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend configuration information. - :param GatewayTemplateAuthenticationKey authentication_key: (optional) + :param AuthenticationKeyIdentity authentication_key: (optional) :param GatewayBfdConfigTemplate bfd_config: (optional) :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. Field is deprecated. See bgp_ibm_cidr and bgp_cer_cidr for details on how to create a gateway using either automatic or explicit IP assignment. Any bgp_base_cidr value set will be ignored. - Deprecated field bgp_base_cidr will be removed from the API specificiation + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will @@ -10997,58 +12486,58 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GatewayTemplateGatewayTypeConnectTemplate': """Initialize a GatewayTemplateGatewayTypeConnectTemplate object from a json dictionary.""" args = {} - if 'as_prepends' in _dict: - args['as_prepends'] = [AsPrependTemplate.from_dict(v) for v in _dict.get('as_prepends')] - if 'authentication_key' in _dict: - args['authentication_key'] = GatewayTemplateAuthenticationKey.from_dict(_dict.get('authentication_key')) - if 'bfd_config' in _dict: - args['bfd_config'] = GatewayBfdConfigTemplate.from_dict(_dict.get('bfd_config')) - if 'bgp_asn' in _dict: - args['bgp_asn'] = _dict.get('bgp_asn') + if (as_prepends := _dict.get('as_prepends')) is not None: + args['as_prepends'] = [AsPrependTemplate.from_dict(v) for v in as_prepends] + if (authentication_key := _dict.get('authentication_key')) is not None: + args['authentication_key'] = authentication_key + if (bfd_config := _dict.get('bfd_config')) is not None: + args['bfd_config'] = GatewayBfdConfigTemplate.from_dict(bfd_config) + if (bgp_asn := _dict.get('bgp_asn')) is not None: + args['bgp_asn'] = bgp_asn else: raise ValueError('Required property \'bgp_asn\' not present in GatewayTemplateGatewayTypeConnectTemplate JSON') - if 'bgp_base_cidr' in _dict: - args['bgp_base_cidr'] = _dict.get('bgp_base_cidr') - if 'bgp_cer_cidr' in _dict: - args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr') - if 'bgp_ibm_cidr' in _dict: - args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr') - if 'connection_mode' in _dict: - args['connection_mode'] = _dict.get('connection_mode') - if 'default_export_route_filter' in _dict: - args['default_export_route_filter'] = _dict.get('default_export_route_filter') - if 'default_import_route_filter' in _dict: - args['default_import_route_filter'] = _dict.get('default_import_route_filter') - if 'export_route_filters' in _dict: - args['export_route_filters'] = [GatewayTemplateRouteFilter.from_dict(v) for v in _dict.get('export_route_filters')] - if 'global' in _dict: - args['global_'] = _dict.get('global') + if (bgp_base_cidr := _dict.get('bgp_base_cidr')) is not None: + args['bgp_base_cidr'] = bgp_base_cidr + if (bgp_cer_cidr := _dict.get('bgp_cer_cidr')) is not None: + args['bgp_cer_cidr'] = bgp_cer_cidr + if (bgp_ibm_cidr := _dict.get('bgp_ibm_cidr')) is not None: + args['bgp_ibm_cidr'] = bgp_ibm_cidr + if (connection_mode := _dict.get('connection_mode')) is not None: + args['connection_mode'] = connection_mode + if (default_export_route_filter := _dict.get('default_export_route_filter')) is not None: + args['default_export_route_filter'] = default_export_route_filter + if (default_import_route_filter := _dict.get('default_import_route_filter')) is not None: + args['default_import_route_filter'] = default_import_route_filter + if (export_route_filters := _dict.get('export_route_filters')) is not None: + args['export_route_filters'] = [GatewayTemplateRouteFilter.from_dict(v) for v in export_route_filters] + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in GatewayTemplateGatewayTypeConnectTemplate JSON') - if 'import_route_filters' in _dict: - args['import_route_filters'] = [GatewayTemplateRouteFilter.from_dict(v) for v in _dict.get('import_route_filters')] - if 'metered' in _dict: - args['metered'] = _dict.get('metered') + if (import_route_filters := _dict.get('import_route_filters')) is not None: + args['import_route_filters'] = [GatewayTemplateRouteFilter.from_dict(v) for v in import_route_filters] + if (metered := _dict.get('metered')) is not None: + args['metered'] = metered else: raise ValueError('Required property \'metered\' not present in GatewayTemplateGatewayTypeConnectTemplate 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 GatewayTemplateGatewayTypeConnectTemplate JSON') - if 'patch_panel_completion_notice' in _dict: - args['patch_panel_completion_notice'] = _dict.get('patch_panel_completion_notice') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupIdentity.from_dict(_dict.get('resource_group')) - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (patch_panel_completion_notice := _dict.get('patch_panel_completion_notice')) is not None: + args['patch_panel_completion_notice'] = patch_panel_completion_notice + if (resource_group := _dict.get('resource_group')) is not None: + args['resource_group'] = ResourceGroupIdentity.from_dict(resource_group) + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps else: raise ValueError('Required property \'speed_mbps\' not present in GatewayTemplateGatewayTypeConnectTemplate 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 GatewayTemplateGatewayTypeConnectTemplate JSON') - if 'port' in _dict: - args['port'] = GatewayPortIdentity.from_dict(_dict.get('port')) + if (port := _dict.get('port')) is not None: + args['port'] = GatewayPortIdentity.from_dict(port) else: raise ValueError('Required property \'port\' not present in GatewayTemplateGatewayTypeConnectTemplate JSON') return cls(**args) @@ -11198,68 +12687,83 @@ class GatewayTemplateGatewayTypeDedicatedTemplate(GatewayTemplate): """ Gateway fields specific to type=dedicated gateway create. - :attr List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend + :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend configuration information. - :attr GatewayTemplateAuthenticationKey authentication_key: (optional) - :attr GatewayBfdConfigTemplate bfd_config: (optional) - :attr int bgp_asn: BGP ASN. - :attr str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. + :param AuthenticationKeyIdentity authentication_key: (optional) + :param GatewayBfdConfigTemplate bfd_config: (optional) + :param int bgp_asn: BGP ASN. + :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. Field is deprecated. See bgp_ibm_cidr and bgp_cer_cidr for details on how to create a gateway using either automatic or explicit IP assignment. Any bgp_base_cidr value set will be ignored. - Deprecated field bgp_base_cidr will be removed from the API specificiation after + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR. + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will automatically select values for bgp_cer_cidr and bgp_ibm_cidr. For explicit IP assignment set a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR. + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will automatically select values for bgp_cer_cidr and bgp_ibm_cidr. For explicit IP assignment set a valid bgp_cer_cidr and bgp_ibm_cidr CIDR, the value must reside in one of "10.254.0.0/16", "172.16.0.0/12", "192.168.0.0/16", "169.254.0.0/16" or an owned public CIDR. bgp_cer_cidr and bgp_ibm_cidr must have matching network and subnet mask values. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 default_export_route_filter: (optional) The default directional route + :param str default_export_route_filter: (optional) The default directional route filter action that applies to routes that do not match any directional route filters. - :attr str default_import_route_filter: (optional) The default directional route + :param str default_import_route_filter: (optional) The default directional route filter action that applies to routes that do not match any directional route filters. - :attr List[GatewayTemplateRouteFilter] export_route_filters: (optional) Array of - directional route filters for a Direct Link gateway. When creating a gateway or - replacing existing route filters, the order of the items in the array will set - the ordering of the list of route filters. - :attr bool global_: Gateways with global routing (`true`) can connect to + :param List[GatewayTemplateRouteFilter] export_route_filters: (optional) Array + of directional route filters for a Direct Link gateway. When creating a gateway + or replacing existing route filters, the order of the items in the array will + set the ordering of the list of route filters. + :param bool global_: Gateways with global routing (`true`) can connect to networks outside their associated region. - :attr List[GatewayTemplateRouteFilter] import_route_filters: (optional) Array of - directional route filters for a Direct Link gateway. When creating a gateway or - replacing existing route filters, the order of the items in the array will set - the ordering of the list of route filters. - :attr bool metered: Metered billing option. When `true` gateway usage is billed - per gigabyte. When `false` there is no per gigabyte usage charge, instead a - flat rate is charged for the gateway. - :attr str name: The unique user-defined name for this gateway. - :attr str patch_panel_completion_notice: (optional) Gateway patch panel complete - notification from implementation team. - :attr ResourceGroupIdentity resource_group: (optional) - :attr int speed_mbps: Gateway speed in megabits per second. - :attr str type: Offering type. - :attr str carrier_name: Carrier name. - :attr str cross_connect_router: Cross connect router. - :attr str customer_name: Customer name. - :attr str location_name: Gateway location. - :attr GatewayMacsecConfigTemplate macsec_config: (optional) MACsec configuration - information. Contact IBM support for access to MACsec. - :attr int vlan: (optional) The VLAN to configure for this gateway. + :param List[GatewayTemplateRouteFilter] import_route_filters: (optional) Array + of directional route filters for a Direct Link gateway. When creating a gateway + or replacing existing route filters, the order of the items in the array will + set the ordering of the list of route filters. + :param bool metered: Metered billing option. When `true` gateway usage is + billed per gigabyte. When `false` there is no per gigabyte usage charge, + instead a flat rate is charged for the gateway. + :param str name: The unique user-defined name for this gateway. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param ResourceGroupIdentity resource_group: (optional) + :param int speed_mbps: Gateway speed in megabits per second. + :param str type: Offering type. + :param str carrier_name: Carrier name. + :param str cross_connect_router: Cross connect router. + :param str customer_name: Customer name. + :param str location_name: Gateway location. + :param GatewayMacsecPrototype macsec: (optional) MACsec configuration + information of a Direct Link gateway. + :param str macsec_capability: (optional) Indicates the direct link's MACsec + capability. It must match one of the MACsec related `capabilities` of the + `cross_connect_router`. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is not + required and can be enabled after direct link creation. + If not explicitly provided, the field will be assigned with the following + priorities based on `cross_connect_router` capabilities and available ports: + - `macsec` was not provided in the request + - `non_macsec` + - `macsec_optional` + - `macsec` was provided in the request + - `macsec_optional` + - `macsec`. + :param int vlan: (optional) The VLAN to configure for this gateway. """ def __init__( @@ -11275,21 +12779,22 @@ def __init__( customer_name: str, location_name: str, *, - as_prepends: List['AsPrependTemplate'] = None, - authentication_key: 'GatewayTemplateAuthenticationKey' = None, - bfd_config: 'GatewayBfdConfigTemplate' = None, - bgp_base_cidr: str = None, - bgp_cer_cidr: str = None, - bgp_ibm_cidr: str = None, - connection_mode: str = None, - default_export_route_filter: str = None, - default_import_route_filter: str = None, - export_route_filters: List['GatewayTemplateRouteFilter'] = None, - import_route_filters: List['GatewayTemplateRouteFilter'] = None, - patch_panel_completion_notice: str = None, - resource_group: 'ResourceGroupIdentity' = None, - macsec_config: 'GatewayMacsecConfigTemplate' = None, - vlan: int = None, + as_prepends: Optional[List['AsPrependTemplate']] = None, + authentication_key: Optional['AuthenticationKeyIdentity'] = None, + bfd_config: Optional['GatewayBfdConfigTemplate'] = None, + bgp_base_cidr: Optional[str] = None, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_cidr: Optional[str] = None, + connection_mode: Optional[str] = None, + default_export_route_filter: Optional[str] = None, + default_import_route_filter: Optional[str] = None, + export_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, + import_route_filters: Optional[List['GatewayTemplateRouteFilter']] = None, + patch_panel_completion_notice: Optional[str] = None, + resource_group: Optional['ResourceGroupIdentity'] = None, + macsec: Optional['GatewayMacsecPrototype'] = None, + macsec_capability: Optional[str] = None, + vlan: Optional[int] = None, ) -> None: """ Initialize a GatewayTemplateGatewayTypeDedicatedTemplate object. @@ -11309,13 +12814,13 @@ def __init__( :param str location_name: Gateway location. :param List[AsPrependTemplate] as_prepends: (optional) array of AS Prepend configuration information. - :param GatewayTemplateAuthenticationKey authentication_key: (optional) + :param AuthenticationKeyIdentity authentication_key: (optional) :param GatewayBfdConfigTemplate bfd_config: (optional) :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR. Field is deprecated. See bgp_ibm_cidr and bgp_cer_cidr for details on how to create a gateway using either automatic or explicit IP assignment. Any bgp_base_cidr value set will be ignored. - Deprecated field bgp_base_cidr will be removed from the API specificiation + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. For auto IP assignment, omit bgp_cer_cidr and bgp_ibm_cidr. IBM will @@ -11354,8 +12859,25 @@ def __init__( :param str patch_panel_completion_notice: (optional) Gateway patch panel complete notification from implementation team. :param ResourceGroupIdentity resource_group: (optional) - :param GatewayMacsecConfigTemplate macsec_config: (optional) MACsec - configuration information. Contact IBM support for access to MACsec. + :param GatewayMacsecPrototype macsec: (optional) MACsec configuration + information of a Direct Link gateway. + :param str macsec_capability: (optional) Indicates the direct link's MACsec + capability. It must match one of the MACsec related `capabilities` of the + `cross_connect_router`. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be + enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is + not required and can be enabled after direct link creation. + If not explicitly provided, the field will be assigned with the following + priorities based on `cross_connect_router` capabilities and available + ports: + - `macsec` was not provided in the request + - `non_macsec` + - `macsec_optional` + - `macsec` was provided in the request + - `macsec_optional` + - `macsec`. :param int vlan: (optional) The VLAN to configure for this gateway. """ # pylint: disable=super-init-not-called @@ -11382,83 +12904,86 @@ def __init__( self.cross_connect_router = cross_connect_router self.customer_name = customer_name self.location_name = location_name - self.macsec_config = macsec_config + self.macsec = macsec + self.macsec_capability = macsec_capability self.vlan = vlan @classmethod def from_dict(cls, _dict: Dict) -> 'GatewayTemplateGatewayTypeDedicatedTemplate': """Initialize a GatewayTemplateGatewayTypeDedicatedTemplate object from a json dictionary.""" args = {} - if 'as_prepends' in _dict: - args['as_prepends'] = [AsPrependTemplate.from_dict(v) for v in _dict.get('as_prepends')] - if 'authentication_key' in _dict: - args['authentication_key'] = GatewayTemplateAuthenticationKey.from_dict(_dict.get('authentication_key')) - if 'bfd_config' in _dict: - args['bfd_config'] = GatewayBfdConfigTemplate.from_dict(_dict.get('bfd_config')) - if 'bgp_asn' in _dict: - args['bgp_asn'] = _dict.get('bgp_asn') + if (as_prepends := _dict.get('as_prepends')) is not None: + args['as_prepends'] = [AsPrependTemplate.from_dict(v) for v in as_prepends] + if (authentication_key := _dict.get('authentication_key')) is not None: + args['authentication_key'] = authentication_key + if (bfd_config := _dict.get('bfd_config')) is not None: + args['bfd_config'] = GatewayBfdConfigTemplate.from_dict(bfd_config) + if (bgp_asn := _dict.get('bgp_asn')) is not None: + args['bgp_asn'] = bgp_asn else: raise ValueError('Required property \'bgp_asn\' not present in GatewayTemplateGatewayTypeDedicatedTemplate JSON') - if 'bgp_base_cidr' in _dict: - args['bgp_base_cidr'] = _dict.get('bgp_base_cidr') - if 'bgp_cer_cidr' in _dict: - args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr') - if 'bgp_ibm_cidr' in _dict: - args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr') - if 'connection_mode' in _dict: - args['connection_mode'] = _dict.get('connection_mode') - if 'default_export_route_filter' in _dict: - args['default_export_route_filter'] = _dict.get('default_export_route_filter') - if 'default_import_route_filter' in _dict: - args['default_import_route_filter'] = _dict.get('default_import_route_filter') - if 'export_route_filters' in _dict: - args['export_route_filters'] = [GatewayTemplateRouteFilter.from_dict(v) for v in _dict.get('export_route_filters')] - if 'global' in _dict: - args['global_'] = _dict.get('global') + if (bgp_base_cidr := _dict.get('bgp_base_cidr')) is not None: + args['bgp_base_cidr'] = bgp_base_cidr + if (bgp_cer_cidr := _dict.get('bgp_cer_cidr')) is not None: + args['bgp_cer_cidr'] = bgp_cer_cidr + if (bgp_ibm_cidr := _dict.get('bgp_ibm_cidr')) is not None: + args['bgp_ibm_cidr'] = bgp_ibm_cidr + if (connection_mode := _dict.get('connection_mode')) is not None: + args['connection_mode'] = connection_mode + if (default_export_route_filter := _dict.get('default_export_route_filter')) is not None: + args['default_export_route_filter'] = default_export_route_filter + if (default_import_route_filter := _dict.get('default_import_route_filter')) is not None: + args['default_import_route_filter'] = default_import_route_filter + if (export_route_filters := _dict.get('export_route_filters')) is not None: + args['export_route_filters'] = [GatewayTemplateRouteFilter.from_dict(v) for v in export_route_filters] + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in GatewayTemplateGatewayTypeDedicatedTemplate JSON') - if 'import_route_filters' in _dict: - args['import_route_filters'] = [GatewayTemplateRouteFilter.from_dict(v) for v in _dict.get('import_route_filters')] - if 'metered' in _dict: - args['metered'] = _dict.get('metered') + if (import_route_filters := _dict.get('import_route_filters')) is not None: + args['import_route_filters'] = [GatewayTemplateRouteFilter.from_dict(v) for v in import_route_filters] + if (metered := _dict.get('metered')) is not None: + args['metered'] = metered else: raise ValueError('Required property \'metered\' not present in GatewayTemplateGatewayTypeDedicatedTemplate 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 GatewayTemplateGatewayTypeDedicatedTemplate JSON') - if 'patch_panel_completion_notice' in _dict: - args['patch_panel_completion_notice'] = _dict.get('patch_panel_completion_notice') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupIdentity.from_dict(_dict.get('resource_group')) - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (patch_panel_completion_notice := _dict.get('patch_panel_completion_notice')) is not None: + args['patch_panel_completion_notice'] = patch_panel_completion_notice + if (resource_group := _dict.get('resource_group')) is not None: + args['resource_group'] = ResourceGroupIdentity.from_dict(resource_group) + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps else: raise ValueError('Required property \'speed_mbps\' not present in GatewayTemplateGatewayTypeDedicatedTemplate 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 GatewayTemplateGatewayTypeDedicatedTemplate JSON') - if 'carrier_name' in _dict: - args['carrier_name'] = _dict.get('carrier_name') + if (carrier_name := _dict.get('carrier_name')) is not None: + args['carrier_name'] = carrier_name else: raise ValueError('Required property \'carrier_name\' not present in GatewayTemplateGatewayTypeDedicatedTemplate JSON') - if 'cross_connect_router' in _dict: - args['cross_connect_router'] = _dict.get('cross_connect_router') + if (cross_connect_router := _dict.get('cross_connect_router')) is not None: + args['cross_connect_router'] = cross_connect_router else: raise ValueError('Required property \'cross_connect_router\' not present in GatewayTemplateGatewayTypeDedicatedTemplate JSON') - if 'customer_name' in _dict: - args['customer_name'] = _dict.get('customer_name') + if (customer_name := _dict.get('customer_name')) is not None: + args['customer_name'] = customer_name else: raise ValueError('Required property \'customer_name\' not present in GatewayTemplateGatewayTypeDedicatedTemplate JSON') - if 'location_name' in _dict: - args['location_name'] = _dict.get('location_name') + if (location_name := _dict.get('location_name')) is not None: + args['location_name'] = location_name else: raise ValueError('Required property \'location_name\' not present in GatewayTemplateGatewayTypeDedicatedTemplate JSON') - if 'macsec_config' in _dict: - args['macsec_config'] = GatewayMacsecConfigTemplate.from_dict(_dict.get('macsec_config')) - if 'vlan' in _dict: - args['vlan'] = _dict.get('vlan') + if (macsec := _dict.get('macsec')) is not None: + args['macsec'] = GatewayMacsecPrototype.from_dict(macsec) + if (macsec_capability := _dict.get('macsec_capability')) is not None: + args['macsec_capability'] = macsec_capability + if (vlan := _dict.get('vlan')) is not None: + args['vlan'] = vlan return cls(**args) @classmethod @@ -11542,11 +13067,13 @@ def to_dict(self) -> Dict: _dict['customer_name'] = self.customer_name if hasattr(self, 'location_name') and self.location_name is not None: _dict['location_name'] = self.location_name - if hasattr(self, 'macsec_config') and self.macsec_config is not None: - if isinstance(self.macsec_config, dict): - _dict['macsec_config'] = self.macsec_config + if hasattr(self, 'macsec') and self.macsec is not None: + if isinstance(self.macsec, dict): + _dict['macsec'] = self.macsec else: - _dict['macsec_config'] = self.macsec_config.to_dict() + _dict['macsec'] = self.macsec.to_dict() + if hasattr(self, 'macsec_capability') and self.macsec_capability is not None: + _dict['macsec_capability'] = self.macsec_capability if hasattr(self, 'vlan') and self.vlan is not None: _dict['vlan'] = self.vlan return _dict @@ -11611,46 +13138,69 @@ class TypeEnum(str, Enum): DEDICATED = 'dedicated' + class MacsecCapabilityEnum(str, Enum): + """ + Indicates the direct link's MACsec capability. It must match one of the MACsec + related `capabilities` of the `cross_connect_router`. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is not + required and can be enabled after direct link creation. + If not explicitly provided, the field will be assigned with the following + priorities based on `cross_connect_router` capabilities and available ports: + - `macsec` was not provided in the request + - `non_macsec` + - `macsec_optional` + - `macsec` was provided in the request + - `macsec_optional` + - `macsec`. + """ + + NON_MACSEC = 'non_macsec' + MACSEC = 'macsec' + MACSEC_OPTIONAL = 'macsec_optional' + + class GetGatewayResponseCrossAccountGateway(GetGatewayResponse): """ cross-account gateway read-only view. - :attr str bgp_status: (optional) Gateway BGP status. The list of enumerated + :param str bgp_status: (optional) Gateway BGP 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 bgp_status_updated_at: (optional) Date and time bgp status was + :param datetime bgp_status_updated_at: (optional) Date and time bgp status was updated. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 datetime created_at: The date and time resource was created. - :attr str crn: The CRN (Cloud Resource Name) of this gateway. - :attr bool cross_account: Indicates whether this gateway is cross account + :param datetime created_at: The date and time resource was created. + :param str crn: The CRN (Cloud Resource Name) of this gateway. + :param bool cross_account: Indicates whether this gateway is cross account gateway. - :attr str cross_connect_router: (optional) Cross connect router. Only included + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. - :attr bool global_: Gateways with global routing (`true`) can connect to + :param bool global_: Gateways with global routing (`true`) can connect to networks outside their associated region. - :attr str id: The unique identifier of this gateway. - :attr str link_status: (optional) Gateway link status. Only included on + :param str id: The unique identifier of this gateway. + :param str link_status: (optional) Gateway link status. Only included on type=dedicated gateways. 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 link_status_updated_at: (optional) Date and time link status was + :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :attr str location_display_name: Gateway location long name. - :attr str location_name: Gateway location. - :attr str name: The unique user-defined name for this gateway. - :attr str operational_status: Gateway operational 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 CrossAccountGatewayPort port: (optional) gateway port for type=connect + :param str location_display_name: Gateway location long name. + :param str location_name: Gateway location. + :param str name: The unique user-defined name for this gateway. + :param str operational_status: Gateway operational status. The list of + enumerated values for this property may expand in the future. Code and processes + using this field must tolerate unexpected values. + :param GatewayPortReference port: (optional) Port information for type=connect gateways. - :attr int speed_mbps: Gateway speed in megabits per second. - :attr str type: Offering type. The list of enumerated values for this property + :param int speed_mbps: Gateway speed in megabits per second. + :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. """ @@ -11669,13 +13219,13 @@ def __init__( speed_mbps: int, type: str, *, - bgp_status: str = None, - bgp_status_updated_at: datetime = None, - connection_mode: str = None, - cross_connect_router: str = None, - link_status: str = None, - link_status_updated_at: datetime = None, - port: 'CrossAccountGatewayPort' = None, + bgp_status: Optional[str] = None, + bgp_status_updated_at: Optional[datetime] = None, + connection_mode: Optional[str] = None, + cross_connect_router: Optional[str] = None, + link_status: Optional[str] = None, + link_status_updated_at: Optional[datetime] = None, + port: Optional['GatewayPortReference'] = None, ) -> None: """ Initialize a GetGatewayResponseCrossAccountGateway object. @@ -11708,7 +13258,7 @@ def __init__( classic connection. 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 cross_connect_router: (optional) Cross connect router. Only + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. :param str link_status: (optional) Gateway link status. Only included on type=dedicated gateways. The list of enumerated values for this property @@ -11716,7 +13266,7 @@ def __init__( tolerate unexpected values. :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :param CrossAccountGatewayPort port: (optional) gateway port for + :param GatewayPortReference port: (optional) Port information for type=connect gateways. """ # pylint: disable=super-init-not-called @@ -11743,62 +13293,62 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GetGatewayResponseCrossAccountGateway': """Initialize a GetGatewayResponseCrossAccountGateway object from a json dictionary.""" args = {} - if 'bgp_status' in _dict: - args['bgp_status'] = _dict.get('bgp_status') - if 'bgp_status_updated_at' in _dict: - args['bgp_status_updated_at'] = string_to_datetime(_dict.get('bgp_status_updated_at')) - if 'connection_mode' in _dict: - args['connection_mode'] = _dict.get('connection_mode') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (bgp_status := _dict.get('bgp_status')) is not None: + args['bgp_status'] = bgp_status + if (bgp_status_updated_at := _dict.get('bgp_status_updated_at')) is not None: + args['bgp_status_updated_at'] = string_to_datetime(bgp_status_updated_at) + if (connection_mode := _dict.get('connection_mode')) is not None: + args['connection_mode'] = connection_mode + 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 GetGatewayResponseCrossAccountGateway JSON') - 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 GetGatewayResponseCrossAccountGateway JSON') - if 'cross_account' in _dict: - args['cross_account'] = _dict.get('cross_account') + if (cross_account := _dict.get('cross_account')) is not None: + args['cross_account'] = cross_account else: raise ValueError('Required property \'cross_account\' not present in GetGatewayResponseCrossAccountGateway JSON') - if 'cross_connect_router' in _dict: - args['cross_connect_router'] = _dict.get('cross_connect_router') - if 'global' in _dict: - args['global_'] = _dict.get('global') + if (cross_connect_router := _dict.get('cross_connect_router')) is not None: + args['cross_connect_router'] = cross_connect_router + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in GetGatewayResponseCrossAccountGateway 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 GetGatewayResponseCrossAccountGateway JSON') - if 'link_status' in _dict: - args['link_status'] = _dict.get('link_status') - if 'link_status_updated_at' in _dict: - args['link_status_updated_at'] = string_to_datetime(_dict.get('link_status_updated_at')) - if 'location_display_name' in _dict: - args['location_display_name'] = _dict.get('location_display_name') + if (link_status := _dict.get('link_status')) is not None: + args['link_status'] = link_status + if (link_status_updated_at := _dict.get('link_status_updated_at')) is not None: + args['link_status_updated_at'] = string_to_datetime(link_status_updated_at) + if (location_display_name := _dict.get('location_display_name')) is not None: + args['location_display_name'] = location_display_name else: raise ValueError('Required property \'location_display_name\' not present in GetGatewayResponseCrossAccountGateway JSON') - if 'location_name' in _dict: - args['location_name'] = _dict.get('location_name') + if (location_name := _dict.get('location_name')) is not None: + args['location_name'] = location_name else: raise ValueError('Required property \'location_name\' not present in GetGatewayResponseCrossAccountGateway 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 GetGatewayResponseCrossAccountGateway JSON') - if 'operational_status' in _dict: - args['operational_status'] = _dict.get('operational_status') + if (operational_status := _dict.get('operational_status')) is not None: + args['operational_status'] = operational_status else: raise ValueError('Required property \'operational_status\' not present in GetGatewayResponseCrossAccountGateway JSON') - if 'port' in _dict: - args['port'] = CrossAccountGatewayPort.from_dict(_dict.get('port')) - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (port := _dict.get('port')) is not None: + args['port'] = GatewayPortReference.from_dict(port) + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps else: raise ValueError('Required property \'speed_mbps\' not present in GetGatewayResponseCrossAccountGateway 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 GetGatewayResponseCrossAccountGateway JSON') return cls(**args) @@ -11943,86 +13493,94 @@ class GetGatewayResponseGateway(GetGatewayResponse): """ gateway. - :attr List[AsPrepend] as_prepends: (optional) array of AS Prepend information. - :attr GatewayAuthenticationKey authentication_key: (optional) The identity of - the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original string - must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. - :attr GatewayBfdConfig bfd_config: (optional) BFD configuration information. - :attr int bgp_asn: Customer BGP ASN. - :attr str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated and - no longer recognized by the Direct Link APIs. + :param List[AsPrepend] as_prepends: (optional) array of AS Prepend information. + :param AuthenticationKeyReference authentication_key: (optional) + :param GatewayBfdConfig bfd_config: (optional) BFD configuration information. + :param int bgp_asn: Customer BGP ASN. + :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated + and no longer recognized by the Direct Link APIs. See bgp_cer_cidr and bgp_ibm_cidr fields instead for IP related information. - Deprecated field bgp_base_cidr will be removed from the API specificiation after + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. - :attr str bgp_cer_cidr: (optional) BGP customer edge router CIDR. - :attr int bgp_ibm_asn: (optional) IBM BGP ASN. - :attr str bgp_ibm_cidr: (optional) BGP IBM CIDR. - :attr str bgp_status: (optional) Gateway BGP status. The list of enumerated + :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. + :param int bgp_ibm_asn: (optional) IBM BGP ASN. + :param str bgp_ibm_cidr: (optional) BGP IBM CIDR. + :param str bgp_status: (optional) Gateway BGP 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 bgp_status_updated_at: (optional) Date and time bgp status was + :param datetime bgp_status_updated_at: (optional) Date and time bgp status was updated. - :attr str carrier_name: (optional) Carrier name. Only set for type=dedicated + :param str carrier_name: (optional) Carrier name. Only set for type=dedicated gateways. - :attr GatewayChangeRequest change_request: (optional) Changes pending approval + :param GatewayChangeRequest change_request: (optional) Changes pending approval for provider managed Direct Link Connect gateways. - :attr str completion_notice_reject_reason: (optional) Reason for completion + :param str completion_notice_reject_reason: (optional) Reason for completion notice rejection. Only included on type=dedicated gateways with a rejected completion notice. - :attr str connection_mode: (optional) Type of services this Gateway is attached + :param str connection_mode: (optional) Type of services this Gateway is attached to. Mode transit means this Gateway will be attached to Transit Gateway Service and direct means this Gateway will be attached to vpc or classic 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 datetime created_at: The date and time resource was created. - :attr str crn: The CRN (Cloud Resource Name) of this gateway. - :attr bool cross_account: Indicates whether this gateway is cross account + :param datetime created_at: The date and time resource was created. + :param str crn: The CRN (Cloud Resource Name) of this gateway. + :param bool cross_account: Indicates whether this gateway is cross account gateway. - :attr str cross_connect_router: (optional) Cross connect router. Only included + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. - :attr str customer_name: (optional) Customer name. Only set for type=dedicated + :param str customer_name: (optional) Customer name. Only set for type=dedicated gateways. - :attr str default_export_route_filter: The default directional route filter + :param str default_export_route_filter: The default directional route filter action that applies to routes that do not match any directional route filters. - :attr str default_import_route_filter: The default directional route filter + :param str default_import_route_filter: The default directional route filter action that applies to routes that do not match any directional route filters. - :attr bool global_: Gateways with global routing (`true`) can connect to + :param bool global_: Gateways with global routing (`true`) can connect to networks outside their associated region. - :attr str id: The unique identifier of this gateway. - :attr str link_status: (optional) Gateway link status. Only included on + :param str id: The unique identifier of this gateway. + :param str link_status: (optional) Gateway link status. Only included on type=dedicated gateways. 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 link_status_updated_at: (optional) Date and time link status was + :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :attr str location_display_name: Gateway location long name. - :attr str location_name: Gateway location. - :attr GatewayMacsecConfig macsec_config: (optional) MACsec configuration - information. For Dedicated Gateways with MACsec configured, return - configuration information. Contact IBM support for access to MACsec. - :attr bool metered: Metered billing option. When `true` gateway usage is billed - per gigabyte. When `false` there is no per gigabyte usage charge, instead a - flat rate is charged for the gateway. - :attr str name: The unique user-defined name for this gateway. - :attr str operational_status: Gateway operational 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 GatewayPort port: (optional) gateway port for type=connect gateways. - :attr bool provider_api_managed: (optional) Indicates whether gateway changes + :param str location_display_name: Gateway location long name. + :param str location_name: Gateway location. + :param GatewayMacsecReference macsec: (optional) MACsec configuration + information of a Direct Link gateway. + :param str macsec_capability: (optional) Indicates the direct link's MACsec + capability. It must match one of the MACsec related `capabilities` of the + `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is not + required and can be enabled after direct link creation. + :param bool metered: Metered billing option. When `true` gateway usage is + billed per gigabyte. When `false` there is no per gigabyte usage charge, + instead a flat rate is charged for the gateway. + :param str name: The unique user-defined name for this gateway. + :param str operational_status: Gateway operational status. The list of + enumerated values for this property may expand in the future. Code and processes + using this field must tolerate unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. + :param List[GatewayStatusReason] operational_status_reasons: Context for certain + values of `operational_status`. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param GatewayPortReference port: (optional) Port information for type=connect + gateways. + :param bool provider_api_managed: (optional) Indicates whether gateway changes must be made via a provider portal. - :attr ResourceGroupReference resource_group: (optional) Resource group + :param ResourceGroupReference resource_group: (optional) Resource group reference. - :attr int speed_mbps: Gateway speed in megabits per second. - :attr str patch_panel_completion_notice: (optional) Gateway patch panel complete - notification from implementation team. - :attr str type: Offering type. The list of enumerated values for this property + :param int speed_mbps: Gateway speed in megabits per second. + :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. - :attr int vlan: (optional) VLAN configured for this gateway. If there is no vlan - configured for the gateway, the vlan will be absent. This property will also be - absent if this gateway's `crn` is in another account. + :param int vlan: (optional) VLAN configured for this gateway. If there is no + vlan configured for the gateway, the vlan will be absent. This property will + also be absent if this gateway's `crn` is in another account. """ def __init__( @@ -12040,32 +13598,34 @@ def __init__( metered: bool, name: str, operational_status: str, + operational_status_reasons: List['GatewayStatusReason'], speed_mbps: int, type: str, *, - as_prepends: List['AsPrepend'] = None, - authentication_key: 'GatewayAuthenticationKey' = None, - bfd_config: 'GatewayBfdConfig' = None, - bgp_base_cidr: str = None, - bgp_cer_cidr: str = None, - bgp_ibm_asn: int = None, - bgp_ibm_cidr: str = None, - bgp_status: str = None, - bgp_status_updated_at: datetime = None, - carrier_name: str = None, - change_request: 'GatewayChangeRequest' = None, - completion_notice_reject_reason: str = None, - connection_mode: str = None, - cross_connect_router: str = None, - customer_name: str = None, - link_status: str = None, - link_status_updated_at: datetime = None, - macsec_config: 'GatewayMacsecConfig' = None, - port: 'GatewayPort' = None, - provider_api_managed: bool = None, - resource_group: 'ResourceGroupReference' = None, - patch_panel_completion_notice: str = None, - vlan: int = None, + as_prepends: Optional[List['AsPrepend']] = None, + authentication_key: Optional['AuthenticationKeyReference'] = None, + bfd_config: Optional['GatewayBfdConfig'] = None, + bgp_base_cidr: Optional[str] = None, + bgp_cer_cidr: Optional[str] = None, + bgp_ibm_asn: Optional[int] = None, + bgp_ibm_cidr: Optional[str] = None, + bgp_status: Optional[str] = None, + bgp_status_updated_at: Optional[datetime] = None, + carrier_name: Optional[str] = None, + change_request: Optional['GatewayChangeRequest'] = None, + completion_notice_reject_reason: Optional[str] = None, + connection_mode: Optional[str] = None, + cross_connect_router: Optional[str] = None, + customer_name: Optional[str] = None, + link_status: Optional[str] = None, + link_status_updated_at: Optional[datetime] = None, + macsec: Optional['GatewayMacsecReference'] = None, + macsec_capability: Optional[str] = None, + patch_panel_completion_notice: Optional[str] = None, + port: Optional['GatewayPortReference'] = None, + provider_api_managed: Optional[bool] = None, + resource_group: Optional['ResourceGroupReference'] = None, + vlan: Optional[int] = None, ) -> None: """ Initialize a GetGatewayResponseGateway object. @@ -12093,24 +13653,24 @@ def __init__( :param str operational_status: Gateway operational status. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. + :param List[GatewayStatusReason] operational_status_reasons: Context for + certain values of `operational_status`. :param int speed_mbps: Gateway speed in megabits per second. :param str type: Offering type. The list of enumerated values for this property may expand in the future. Code and processes using this field must tolerate unexpected values. :param List[AsPrepend] as_prepends: (optional) array of AS Prepend information. - :param GatewayAuthenticationKey authentication_key: (optional) The identity - of the standard key to use for BGP MD5 authentication key. - The key material that you provide must be base64 encoded and original - string must be maximum 126 ASCII characters in length. - To clear the optional `authentication_key` field patch its crn to `""`. + :param AuthenticationKeyReference authentication_key: (optional) :param GatewayBfdConfig bfd_config: (optional) BFD configuration information. :param str bgp_base_cidr: (optional) (DEPRECATED) BGP base CIDR is deprecated and no longer recognized by the Direct Link APIs. See bgp_cer_cidr and bgp_ibm_cidr fields instead for IP related information. - Deprecated field bgp_base_cidr will be removed from the API specificiation + Deprecated field bgp_base_cidr will be removed from the API specification after 15-MAR-2021. :param str bgp_cer_cidr: (optional) BGP customer edge router CIDR. :param int bgp_ibm_asn: (optional) IBM BGP ASN. @@ -12133,7 +13693,7 @@ def __init__( classic connection. 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 cross_connect_router: (optional) Cross connect router. Only + :param str cross_connect_router: (optional) Cross connect router. Only included on type=dedicated gateways. :param str customer_name: (optional) Customer name. Only set for type=dedicated gateways. @@ -12143,16 +13703,25 @@ def __init__( tolerate unexpected values. :param datetime link_status_updated_at: (optional) Date and time link status was updated. - :param GatewayMacsecConfig macsec_config: (optional) MACsec configuration - information. For Dedicated Gateways with MACsec configured, return - configuration information. Contact IBM support for access to MACsec. - :param GatewayPort port: (optional) gateway port for type=connect gateways. + :param GatewayMacsecReference macsec: (optional) MACsec configuration + information of a Direct Link gateway. + :param str macsec_capability: (optional) Indicates the direct link's MACsec + capability. It must match one of the MACsec related `capabilities` of the + `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be + enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is + not required and can be enabled after direct link creation. + :param str patch_panel_completion_notice: (optional) Gateway patch panel + complete notification from implementation team. + :param GatewayPortReference port: (optional) Port information for + type=connect gateways. :param bool provider_api_managed: (optional) Indicates whether gateway changes must be made via a provider portal. :param ResourceGroupReference resource_group: (optional) Resource group reference. - :param str patch_panel_completion_notice: (optional) Gateway patch panel - complete notification from implementation team. :param int vlan: (optional) VLAN configured for this gateway. If there is no vlan configured for the gateway, the vlan will be absent. This property will also be absent if this gateway's `crn` is in another account. @@ -12185,15 +13754,17 @@ def __init__( self.link_status_updated_at = link_status_updated_at self.location_display_name = location_display_name self.location_name = location_name - self.macsec_config = macsec_config + self.macsec = macsec + self.macsec_capability = macsec_capability self.metered = metered self.name = name self.operational_status = operational_status + self.operational_status_reasons = operational_status_reasons + self.patch_panel_completion_notice = patch_panel_completion_notice self.port = port self.provider_api_managed = provider_api_managed self.resource_group = resource_group self.speed_mbps = speed_mbps - self.patch_panel_completion_notice = patch_panel_completion_notice self.type = type self.vlan = vlan @@ -12201,112 +13772,118 @@ def __init__( def from_dict(cls, _dict: Dict) -> 'GetGatewayResponseGateway': """Initialize a GetGatewayResponseGateway object from a json dictionary.""" args = {} - if 'as_prepends' in _dict: - args['as_prepends'] = [AsPrepend.from_dict(v) for v in _dict.get('as_prepends')] - if 'authentication_key' in _dict: - args['authentication_key'] = GatewayAuthenticationKey.from_dict(_dict.get('authentication_key')) - if 'bfd_config' in _dict: - args['bfd_config'] = GatewayBfdConfig.from_dict(_dict.get('bfd_config')) - if 'bgp_asn' in _dict: - args['bgp_asn'] = _dict.get('bgp_asn') + if (as_prepends := _dict.get('as_prepends')) is not None: + args['as_prepends'] = [AsPrepend.from_dict(v) for v in as_prepends] + if (authentication_key := _dict.get('authentication_key')) is not None: + args['authentication_key'] = authentication_key + if (bfd_config := _dict.get('bfd_config')) is not None: + args['bfd_config'] = GatewayBfdConfig.from_dict(bfd_config) + if (bgp_asn := _dict.get('bgp_asn')) is not None: + args['bgp_asn'] = bgp_asn else: raise ValueError('Required property \'bgp_asn\' not present in GetGatewayResponseGateway JSON') - if 'bgp_base_cidr' in _dict: - args['bgp_base_cidr'] = _dict.get('bgp_base_cidr') - if 'bgp_cer_cidr' in _dict: - args['bgp_cer_cidr'] = _dict.get('bgp_cer_cidr') - if 'bgp_ibm_asn' in _dict: - args['bgp_ibm_asn'] = _dict.get('bgp_ibm_asn') - if 'bgp_ibm_cidr' in _dict: - args['bgp_ibm_cidr'] = _dict.get('bgp_ibm_cidr') - if 'bgp_status' in _dict: - args['bgp_status'] = _dict.get('bgp_status') - if 'bgp_status_updated_at' in _dict: - args['bgp_status_updated_at'] = string_to_datetime(_dict.get('bgp_status_updated_at')) - if 'carrier_name' in _dict: - args['carrier_name'] = _dict.get('carrier_name') - if 'change_request' in _dict: - args['change_request'] = _dict.get('change_request') - if 'completion_notice_reject_reason' in _dict: - args['completion_notice_reject_reason'] = _dict.get('completion_notice_reject_reason') - if 'connection_mode' in _dict: - args['connection_mode'] = _dict.get('connection_mode') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) + if (bgp_base_cidr := _dict.get('bgp_base_cidr')) is not None: + args['bgp_base_cidr'] = bgp_base_cidr + if (bgp_cer_cidr := _dict.get('bgp_cer_cidr')) is not None: + args['bgp_cer_cidr'] = bgp_cer_cidr + if (bgp_ibm_asn := _dict.get('bgp_ibm_asn')) is not None: + args['bgp_ibm_asn'] = bgp_ibm_asn + if (bgp_ibm_cidr := _dict.get('bgp_ibm_cidr')) is not None: + args['bgp_ibm_cidr'] = bgp_ibm_cidr + if (bgp_status := _dict.get('bgp_status')) is not None: + args['bgp_status'] = bgp_status + if (bgp_status_updated_at := _dict.get('bgp_status_updated_at')) is not None: + args['bgp_status_updated_at'] = string_to_datetime(bgp_status_updated_at) + if (carrier_name := _dict.get('carrier_name')) is not None: + args['carrier_name'] = carrier_name + if (change_request := _dict.get('change_request')) is not None: + args['change_request'] = change_request + if (completion_notice_reject_reason := _dict.get('completion_notice_reject_reason')) is not None: + args['completion_notice_reject_reason'] = completion_notice_reject_reason + if (connection_mode := _dict.get('connection_mode')) is not None: + args['connection_mode'] = connection_mode + 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 GetGatewayResponseGateway JSON') - 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 GetGatewayResponseGateway JSON') - if 'cross_account' in _dict: - args['cross_account'] = _dict.get('cross_account') + if (cross_account := _dict.get('cross_account')) is not None: + args['cross_account'] = cross_account else: raise ValueError('Required property \'cross_account\' not present in GetGatewayResponseGateway JSON') - if 'cross_connect_router' in _dict: - args['cross_connect_router'] = _dict.get('cross_connect_router') - if 'customer_name' in _dict: - args['customer_name'] = _dict.get('customer_name') - if 'default_export_route_filter' in _dict: - args['default_export_route_filter'] = _dict.get('default_export_route_filter') + if (cross_connect_router := _dict.get('cross_connect_router')) is not None: + args['cross_connect_router'] = cross_connect_router + if (customer_name := _dict.get('customer_name')) is not None: + args['customer_name'] = customer_name + if (default_export_route_filter := _dict.get('default_export_route_filter')) is not None: + args['default_export_route_filter'] = default_export_route_filter else: raise ValueError('Required property \'default_export_route_filter\' not present in GetGatewayResponseGateway JSON') - if 'default_import_route_filter' in _dict: - args['default_import_route_filter'] = _dict.get('default_import_route_filter') + if (default_import_route_filter := _dict.get('default_import_route_filter')) is not None: + args['default_import_route_filter'] = default_import_route_filter else: raise ValueError('Required property \'default_import_route_filter\' not present in GetGatewayResponseGateway JSON') - if 'global' in _dict: - args['global_'] = _dict.get('global') + if (global_ := _dict.get('global')) is not None: + args['global_'] = global_ else: raise ValueError('Required property \'global\' not present in GetGatewayResponseGateway 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 GetGatewayResponseGateway JSON') - if 'link_status' in _dict: - args['link_status'] = _dict.get('link_status') - if 'link_status_updated_at' in _dict: - args['link_status_updated_at'] = string_to_datetime(_dict.get('link_status_updated_at')) - if 'location_display_name' in _dict: - args['location_display_name'] = _dict.get('location_display_name') + if (link_status := _dict.get('link_status')) is not None: + args['link_status'] = link_status + if (link_status_updated_at := _dict.get('link_status_updated_at')) is not None: + args['link_status_updated_at'] = string_to_datetime(link_status_updated_at) + if (location_display_name := _dict.get('location_display_name')) is not None: + args['location_display_name'] = location_display_name else: raise ValueError('Required property \'location_display_name\' not present in GetGatewayResponseGateway JSON') - if 'location_name' in _dict: - args['location_name'] = _dict.get('location_name') + if (location_name := _dict.get('location_name')) is not None: + args['location_name'] = location_name else: raise ValueError('Required property \'location_name\' not present in GetGatewayResponseGateway JSON') - if 'macsec_config' in _dict: - args['macsec_config'] = GatewayMacsecConfig.from_dict(_dict.get('macsec_config')) - if 'metered' in _dict: - args['metered'] = _dict.get('metered') + if (macsec := _dict.get('macsec')) is not None: + args['macsec'] = GatewayMacsecReference.from_dict(macsec) + if (macsec_capability := _dict.get('macsec_capability')) is not None: + args['macsec_capability'] = macsec_capability + if (metered := _dict.get('metered')) is not None: + args['metered'] = metered else: raise ValueError('Required property \'metered\' not present in GetGatewayResponseGateway 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 GetGatewayResponseGateway JSON') - if 'operational_status' in _dict: - args['operational_status'] = _dict.get('operational_status') + if (operational_status := _dict.get('operational_status')) is not None: + args['operational_status'] = operational_status else: raise ValueError('Required property \'operational_status\' not present in GetGatewayResponseGateway JSON') - if 'port' in _dict: - args['port'] = GatewayPort.from_dict(_dict.get('port')) - if 'provider_api_managed' in _dict: - args['provider_api_managed'] = _dict.get('provider_api_managed') - if 'resource_group' in _dict: - args['resource_group'] = ResourceGroupReference.from_dict(_dict.get('resource_group')) - if 'speed_mbps' in _dict: - args['speed_mbps'] = _dict.get('speed_mbps') + if (operational_status_reasons := _dict.get('operational_status_reasons')) is not None: + args['operational_status_reasons'] = [GatewayStatusReason.from_dict(v) for v in operational_status_reasons] + else: + raise ValueError('Required property \'operational_status_reasons\' not present in GetGatewayResponseGateway JSON') + if (patch_panel_completion_notice := _dict.get('patch_panel_completion_notice')) is not None: + args['patch_panel_completion_notice'] = patch_panel_completion_notice + if (port := _dict.get('port')) is not None: + args['port'] = GatewayPortReference.from_dict(port) + if (provider_api_managed := _dict.get('provider_api_managed')) is not None: + args['provider_api_managed'] = provider_api_managed + if (resource_group := _dict.get('resource_group')) is not None: + args['resource_group'] = ResourceGroupReference.from_dict(resource_group) + if (speed_mbps := _dict.get('speed_mbps')) is not None: + args['speed_mbps'] = speed_mbps else: raise ValueError('Required property \'speed_mbps\' not present in GetGatewayResponseGateway JSON') - if 'patch_panel_completion_notice' in _dict: - args['patch_panel_completion_notice'] = _dict.get('patch_panel_completion_notice') - 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 GetGatewayResponseGateway JSON') - if 'vlan' in _dict: - args['vlan'] = _dict.get('vlan') + if (vlan := _dict.get('vlan')) is not None: + args['vlan'] = vlan return cls(**args) @classmethod @@ -12386,17 +13963,29 @@ def to_dict(self) -> Dict: _dict['location_display_name'] = self.location_display_name if hasattr(self, 'location_name') and self.location_name is not None: _dict['location_name'] = self.location_name - if hasattr(self, 'macsec_config') and self.macsec_config is not None: - if isinstance(self.macsec_config, dict): - _dict['macsec_config'] = self.macsec_config + if hasattr(self, 'macsec') and self.macsec is not None: + if isinstance(self.macsec, dict): + _dict['macsec'] = self.macsec else: - _dict['macsec_config'] = self.macsec_config.to_dict() + _dict['macsec'] = self.macsec.to_dict() + if hasattr(self, 'macsec_capability') and self.macsec_capability is not None: + _dict['macsec_capability'] = self.macsec_capability if hasattr(self, 'metered') and self.metered is not None: _dict['metered'] = self.metered if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name if hasattr(self, 'operational_status') and self.operational_status is not None: _dict['operational_status'] = self.operational_status + if hasattr(self, 'operational_status_reasons') and self.operational_status_reasons is not None: + operational_status_reasons_list = [] + for v in self.operational_status_reasons: + if isinstance(v, dict): + operational_status_reasons_list.append(v) + else: + operational_status_reasons_list.append(v.to_dict()) + _dict['operational_status_reasons'] = operational_status_reasons_list + if hasattr(self, 'patch_panel_completion_notice') and self.patch_panel_completion_notice is not None: + _dict['patch_panel_completion_notice'] = self.patch_panel_completion_notice if hasattr(self, 'port') and self.port is not None: if isinstance(self.port, dict): _dict['port'] = self.port @@ -12411,8 +14000,6 @@ def to_dict(self) -> Dict: _dict['resource_group'] = self.resource_group.to_dict() if hasattr(self, 'speed_mbps') and self.speed_mbps is not None: _dict['speed_mbps'] = self.speed_mbps - if hasattr(self, 'patch_panel_completion_notice') and self.patch_panel_completion_notice is not None: - _dict['patch_panel_completion_notice'] = self.patch_panel_completion_notice if hasattr(self, 'type') and self.type is not None: _dict['type'] = self.type if hasattr(self, 'vlan') and self.vlan is not None: @@ -12424,167 +14011,638 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this GetGatewayResponseGateway object.""" + """Return a `str` version of this GetGatewayResponseGateway object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'GetGatewayResponseGateway') -> 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: 'GetGatewayResponseGateway') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class BgpStatusEnum(str, Enum): + """ + Gateway BGP status. The list of enumerated values for this property may expand in + the future. Code and processes using this field must tolerate unexpected values. + """ + + ACTIVE = 'active' + CONNECT = 'connect' + ESTABLISHED = 'established' + IDLE = 'idle' + + + class ConnectionModeEnum(str, Enum): + """ + Type of services this Gateway is attached to. Mode transit means this Gateway will + be attached to Transit Gateway Service and direct means this Gateway will be + attached to vpc or classic connection. The list of enumerated values for this + property may expand in the future. Code and processes using this field must + tolerate unexpected values. + """ + + DIRECT = 'direct' + TRANSIT = 'transit' + + + class DefaultExportRouteFilterEnum(str, Enum): + """ + The default directional route filter action that applies to routes that do not + match any directional route filters. + """ + + PERMIT = 'permit' + DENY = 'deny' + + + class DefaultImportRouteFilterEnum(str, Enum): + """ + The default directional route filter action that applies to routes that do not + match any directional route filters. + """ + + PERMIT = 'permit' + DENY = 'deny' + + + class LinkStatusEnum(str, Enum): + """ + Gateway link status. Only included on type=dedicated gateways. The list of + enumerated values for this property may expand in the future. Code and processes + using this field must tolerate unexpected values. + """ + + DOWN = 'down' + UP = 'up' + + + class MacsecCapabilityEnum(str, Enum): + """ + Indicates the direct link's MACsec capability. It must match one of the MACsec + related `capabilities` of the `cross_connect_router`. + Only included on type=dedicated direct links. + - non_macsec: The direct link does not support MACsec. + - macsec: The direct link supports MACsec. The MACsec feature must be enabled. + - macsec_optional: The direct link supports MACsec. The MACsec feature is not + required and can be enabled after direct link creation. + """ + + NON_MACSEC = 'non_macsec' + MACSEC = 'macsec' + MACSEC_OPTIONAL = 'macsec_optional' + + + class OperationalStatusEnum(str, Enum): + """ + Gateway operational status. The list of enumerated values for this property may + expand in the future. Code and processes using this field must tolerate + unexpected values. + See `operational_status_reasons[]` for possible remediation of the `failed` + `operational_status`. + """ + + AWAITING_COMPLETION_NOTICE = 'awaiting_completion_notice' + AWAITING_LOA = 'awaiting_loa' + CONFIGURING = 'configuring' + CREATE_PENDING = 'create_pending' + CREATE_REJECTED = 'create_rejected' + COMPLETION_NOTICE_APPROVED = 'completion_notice_approved' + COMPLETION_NOTICE_RECEIVED = 'completion_notice_received' + COMPLETION_NOTICE_REJECTED = 'completion_notice_rejected' + DELETE_PENDING = 'delete_pending' + LOA_ACCEPTED = 'loa_accepted' + LOA_CREATED = 'loa_created' + LOA_REJECTED = 'loa_rejected' + PROVISIONED = 'provisioned' + FAILED = 'failed' + + + class TypeEnum(str, Enum): + """ + Offering type. The list of enumerated values for this property may expand in the + future. Code and processes using this field must tolerate unexpected values. + """ + + CONNECT = 'connect' + DEDICATED = 'dedicated' + + + +class RouteReportOverlappingRouteForConnection(RouteReportOverlappingRoute): + """ + overlapping route details. + + :param str prefix: overlapping prefix. + :param str type: type of the route. + :param str virtual_connection_id: virtual connection ID. + """ + + def __init__( + self, + prefix: str, + type: str, + virtual_connection_id: str, + ) -> None: + """ + Initialize a RouteReportOverlappingRouteForConnection object. + + :param str prefix: overlapping prefix. + :param str type: type of the route. + :param str virtual_connection_id: virtual connection ID. + """ + # pylint: disable=super-init-not-called + self.prefix = prefix + self.type = type + self.virtual_connection_id = virtual_connection_id + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRouteForConnection': + """Initialize a RouteReportOverlappingRouteForConnection object from a json dictionary.""" + args = {} + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix + else: + raise ValueError('Required property \'prefix\' not present in RouteReportOverlappingRouteForConnection JSON') + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in RouteReportOverlappingRouteForConnection JSON') + if (virtual_connection_id := _dict.get('virtual_connection_id')) is not None: + args['virtual_connection_id'] = virtual_connection_id + else: + raise ValueError('Required property \'virtual_connection_id\' not present in RouteReportOverlappingRouteForConnection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RouteReportOverlappingRouteForConnection 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, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'virtual_connection_id') and self.virtual_connection_id is not None: + _dict['virtual_connection_id'] = self.virtual_connection_id + 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 RouteReportOverlappingRouteForConnection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'RouteReportOverlappingRouteForConnection') -> 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: 'RouteReportOverlappingRouteForConnection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class TypeEnum(str, Enum): + """ + type of the route. + """ + + VIRTUAL_CONNECTION = 'virtual_connection' + + + +class RouteReportOverlappingRouteForOthers(RouteReportOverlappingRoute): + """ + overlapping route details. + + :param str prefix: overlapping prefix. + :param str type: type of the route. + """ + + def __init__( + self, + prefix: str, + type: str, + ) -> None: + """ + Initialize a RouteReportOverlappingRouteForOthers object. + + :param str prefix: overlapping prefix. + :param str type: type of the route. + """ + # pylint: disable=super-init-not-called + self.prefix = prefix + self.type = type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRouteForOthers': + """Initialize a RouteReportOverlappingRouteForOthers object from a json dictionary.""" + args = {} + if (prefix := _dict.get('prefix')) is not None: + args['prefix'] = prefix + else: + raise ValueError('Required property \'prefix\' not present in RouteReportOverlappingRouteForOthers JSON') + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in RouteReportOverlappingRouteForOthers JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RouteReportOverlappingRouteForOthers 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, 'prefix') and self.prefix is not None: + _dict['prefix'] = self.prefix + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + 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 RouteReportOverlappingRouteForOthers object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'RouteReportOverlappingRouteForOthers') -> 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: 'RouteReportOverlappingRouteForOthers') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class TypeEnum(str, Enum): + """ + type of the route. + """ + + GATEWAY = 'gateway' + ON_PREM = 'on_prem' + + + +class SakRekeyPacketNumberRolloverMode(SakRekey): + """ + SAK rekey mode based on a high proportion of used packet numbers with the current SAK + (the exact threshold determined at the system's discretion). + + :param str mode: Determines that the SAK rekey occurs based on the used packet + numbers. + """ + + def __init__( + self, + mode: str, + ) -> None: + """ + Initialize a SakRekeyPacketNumberRolloverMode object. + + :param str mode: Determines that the SAK rekey occurs based on the used + packet numbers. + """ + # pylint: disable=super-init-not-called + self.mode = mode + + @classmethod + def from_dict(cls, _dict: Dict) -> 'SakRekeyPacketNumberRolloverMode': + """Initialize a SakRekeyPacketNumberRolloverMode object from a json dictionary.""" + args = {} + if (mode := _dict.get('mode')) is not None: + args['mode'] = mode + else: + raise ValueError('Required property \'mode\' not present in SakRekeyPacketNumberRolloverMode JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SakRekeyPacketNumberRolloverMode 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, 'mode') and self.mode is not None: + _dict['mode'] = self.mode + 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 SakRekeyPacketNumberRolloverMode object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'GetGatewayResponseGateway') -> bool: + def __eq__(self, other: 'SakRekeyPacketNumberRolloverMode') -> 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: 'GetGatewayResponseGateway') -> bool: + def __ne__(self, other: 'SakRekeyPacketNumberRolloverMode') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class BgpStatusEnum(str, Enum): + class ModeEnum(str, Enum): """ - Gateway BGP status. The list of enumerated values for this property may expand in - the future. Code and processes using this field must tolerate unexpected values. + Determines that the SAK rekey occurs based on the used packet numbers. """ - ACTIVE = 'active' - CONNECT = 'connect' - ESTABLISHED = 'established' - IDLE = 'idle' + PACKET_NUMBER_ROLLOVER = 'packet_number_rollover' - class ConnectionModeEnum(str, Enum): + +class SakRekeyPatchSakRekeyPacketNumberRolloverModePatch(SakRekeyPatch): + """ + SAK rekey mode based on a high proportion of used packet numbers with the current SAK + (the exact threshold determined at the system's discretion). + + :param str mode: Determines that the SAK rekey occurs based on the used packet + numbers. + """ + + def __init__( + self, + mode: str, + ) -> None: """ - Type of services this Gateway is attached to. Mode transit means this Gateway will - be attached to Transit Gateway Service and direct means this Gateway will be - attached to vpc or classic connection. The list of enumerated values for this - property may expand in the future. Code and processes using this field must - tolerate unexpected values. + Initialize a SakRekeyPatchSakRekeyPacketNumberRolloverModePatch object. + + :param str mode: Determines that the SAK rekey occurs based on the used + packet numbers. """ + # pylint: disable=super-init-not-called + self.mode = mode - DIRECT = 'direct' - TRANSIT = 'transit' + @classmethod + def from_dict(cls, _dict: Dict) -> 'SakRekeyPatchSakRekeyPacketNumberRolloverModePatch': + """Initialize a SakRekeyPatchSakRekeyPacketNumberRolloverModePatch object from a json dictionary.""" + args = {} + if (mode := _dict.get('mode')) is not None: + args['mode'] = mode + else: + raise ValueError('Required property \'mode\' not present in SakRekeyPatchSakRekeyPacketNumberRolloverModePatch JSON') + return cls(**args) + @classmethod + def _from_dict(cls, _dict): + """Initialize a SakRekeyPatchSakRekeyPacketNumberRolloverModePatch object from a json dictionary.""" + return cls.from_dict(_dict) - class DefaultExportRouteFilterEnum(str, Enum): + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'mode') and self.mode is not None: + _dict['mode'] = self.mode + 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 SakRekeyPatchSakRekeyPacketNumberRolloverModePatch object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SakRekeyPatchSakRekeyPacketNumberRolloverModePatch') -> 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: 'SakRekeyPatchSakRekeyPacketNumberRolloverModePatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ModeEnum(str, Enum): """ - The default directional route filter action that applies to routes that do not - match any directional route filters. + Determines that the SAK rekey occurs based on the used packet numbers. """ - PERMIT = 'permit' - DENY = 'deny' + PACKET_NUMBER_ROLLOVER = 'packet_number_rollover' - class DefaultImportRouteFilterEnum(str, Enum): + +class SakRekeyPatchSakRekeyTimerModePatch(SakRekeyPatch): + """ + SAK rekey mode based on length of time since last rekey. + + :param int interval: The time, in seconds, to force a Secure Association Key + (SAK) rekey. + :param str mode: Determines that the SAK rekey occurs based on a timer. + """ + + def __init__( + self, + interval: int, + mode: str, + ) -> None: """ - The default directional route filter action that applies to routes that do not - match any directional route filters. + Initialize a SakRekeyPatchSakRekeyTimerModePatch object. + + :param int interval: The time, in seconds, to force a Secure Association + Key (SAK) rekey. + :param str mode: Determines that the SAK rekey occurs based on a timer. """ + # pylint: disable=super-init-not-called + self.interval = interval + self.mode = mode - PERMIT = 'permit' - DENY = 'deny' + @classmethod + def from_dict(cls, _dict: Dict) -> 'SakRekeyPatchSakRekeyTimerModePatch': + """Initialize a SakRekeyPatchSakRekeyTimerModePatch object from a json dictionary.""" + args = {} + if (interval := _dict.get('interval')) is not None: + args['interval'] = interval + else: + raise ValueError('Required property \'interval\' not present in SakRekeyPatchSakRekeyTimerModePatch JSON') + if (mode := _dict.get('mode')) is not None: + args['mode'] = mode + else: + raise ValueError('Required property \'mode\' not present in SakRekeyPatchSakRekeyTimerModePatch JSON') + return cls(**args) + @classmethod + def _from_dict(cls, _dict): + """Initialize a SakRekeyPatchSakRekeyTimerModePatch object from a json dictionary.""" + return cls.from_dict(_dict) - class LinkStatusEnum(str, Enum): + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'interval') and self.interval is not None: + _dict['interval'] = self.interval + if hasattr(self, 'mode') and self.mode is not None: + _dict['mode'] = self.mode + 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 SakRekeyPatchSakRekeyTimerModePatch object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SakRekeyPatchSakRekeyTimerModePatch') -> 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: 'SakRekeyPatchSakRekeyTimerModePatch') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ModeEnum(str, Enum): """ - Gateway link status. Only included on type=dedicated gateways. The list of - enumerated values for this property may expand in the future. Code and processes - using this field must tolerate unexpected values. + Determines that the SAK rekey occurs based on a timer. """ - DOWN = 'down' - UP = 'up' + TIMER = 'timer' - class OperationalStatusEnum(str, Enum): + +class SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype(SakRekeyPrototype): + """ + Packet number (PN) rollover SAK rekey mode. The SAK is rekeyed based on the proportion + of used packet numbers with the current SAK. + + :param str mode: Determines that the SAK rekey occurs based on the used packet + numbers. + """ + + def __init__( + self, + mode: str, + ) -> None: """ - Gateway operational status. The list of enumerated values for this property may - expand in the future. Code and processes using this field must tolerate - unexpected values. + Initialize a SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype object. + + :param str mode: Determines that the SAK rekey occurs based on the used + packet numbers. """ + # pylint: disable=super-init-not-called + self.mode = mode - AWAITING_COMPLETION_NOTICE = 'awaiting_completion_notice' - AWAITING_LOA = 'awaiting_loa' - CONFIGURING = 'configuring' - CREATE_PENDING = 'create_pending' - CREATE_REJECTED = 'create_rejected' - COMPLETION_NOTICE_APPROVED = 'completion_notice_approved' - COMPLETION_NOTICE_RECEIVED = 'completion_notice_received' - COMPLETION_NOTICE_REJECTED = 'completion_notice_rejected' - DELETE_PENDING = 'delete_pending' - LOA_ACCEPTED = 'loa_accepted' - LOA_CREATED = 'loa_created' - LOA_REJECTED = 'loa_rejected' - PROVISIONED = 'provisioned' + @classmethod + def from_dict(cls, _dict: Dict) -> 'SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype': + """Initialize a SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype object from a json dictionary.""" + args = {} + if (mode := _dict.get('mode')) is not None: + args['mode'] = mode + else: + raise ValueError('Required property \'mode\' not present in SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype JSON') + return cls(**args) + @classmethod + def _from_dict(cls, _dict): + """Initialize a SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype object from a json dictionary.""" + return cls.from_dict(_dict) - class TypeEnum(str, Enum): + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'mode') and self.mode is not None: + _dict['mode'] = self.mode + 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 SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype') -> 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: 'SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ModeEnum(str, Enum): """ - Offering type. The list of enumerated values for this property may expand in the - future. Code and processes using this field must tolerate unexpected values. + Determines that the SAK rekey occurs based on the used packet numbers. """ - CONNECT = 'connect' - DEDICATED = 'dedicated' + PACKET_NUMBER_ROLLOVER = 'packet_number_rollover' -class RouteReportOverlappingRouteForConnection(RouteReportOverlappingRoute): +class SakRekeyPrototypeSakRekeyTimerModePrototype(SakRekeyPrototype): """ - overlapping route details. + SAK rekey mode based on length of time since last rekey. - :attr str prefix: overlapping prefix. - :attr str type: type of the route. - :attr str virtual_connection_id: virtual connection ID. + :param int interval: The time, in seconds, to force a Secure Association Key + (SAK) rekey. + :param str mode: Determines that the SAK rekey occurs based on a timer. """ def __init__( self, - prefix: str, - type: str, - virtual_connection_id: str, + interval: int, + mode: str, ) -> None: """ - Initialize a RouteReportOverlappingRouteForConnection object. + Initialize a SakRekeyPrototypeSakRekeyTimerModePrototype object. - :param str prefix: overlapping prefix. - :param str type: type of the route. - :param str virtual_connection_id: virtual connection ID. + :param int interval: The time, in seconds, to force a Secure Association + Key (SAK) rekey. + :param str mode: Determines that the SAK rekey occurs based on a timer. """ # pylint: disable=super-init-not-called - self.prefix = prefix - self.type = type - self.virtual_connection_id = virtual_connection_id + self.interval = interval + self.mode = mode @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRouteForConnection': - """Initialize a RouteReportOverlappingRouteForConnection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SakRekeyPrototypeSakRekeyTimerModePrototype': + """Initialize a SakRekeyPrototypeSakRekeyTimerModePrototype object from a json dictionary.""" args = {} - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (interval := _dict.get('interval')) is not None: + args['interval'] = interval else: - raise ValueError('Required property \'prefix\' not present in RouteReportOverlappingRouteForConnection JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in RouteReportOverlappingRouteForConnection JSON') - if 'virtual_connection_id' in _dict: - args['virtual_connection_id'] = _dict.get('virtual_connection_id') + raise ValueError('Required property \'interval\' not present in SakRekeyPrototypeSakRekeyTimerModePrototype JSON') + if (mode := _dict.get('mode')) is not None: + args['mode'] = mode else: - raise ValueError('Required property \'virtual_connection_id\' not present in RouteReportOverlappingRouteForConnection JSON') + raise ValueError('Required property \'mode\' not present in SakRekeyPrototypeSakRekeyTimerModePrototype JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteReportOverlappingRouteForConnection object from a json dictionary.""" + """Initialize a SakRekeyPrototypeSakRekeyTimerModePrototype 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, 'prefix') and self.prefix is not None: - _dict['prefix'] = self.prefix - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'virtual_connection_id') and self.virtual_connection_id is not None: - _dict['virtual_connection_id'] = self.virtual_connection_id + if hasattr(self, 'interval') and self.interval is not None: + _dict['interval'] = self.interval + if hasattr(self, 'mode') and self.mode is not None: + _dict['mode'] = self.mode return _dict def _to_dict(self): @@ -12592,77 +14650,79 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteReportOverlappingRouteForConnection object.""" + """Return a `str` version of this SakRekeyPrototypeSakRekeyTimerModePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteReportOverlappingRouteForConnection') -> bool: + def __eq__(self, other: 'SakRekeyPrototypeSakRekeyTimerModePrototype') -> 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: 'RouteReportOverlappingRouteForConnection') -> bool: + def __ne__(self, other: 'SakRekeyPrototypeSakRekeyTimerModePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): + class ModeEnum(str, Enum): """ - type of the route. + Determines that the SAK rekey occurs based on a timer. """ - VIRTUAL_CONNECTION = 'virtual_connection' + TIMER = 'timer' -class RouteReportOverlappingRouteForOthers(RouteReportOverlappingRoute): +class SakRekeyTimerMode(SakRekey): """ - overlapping route details. + SAK rekey mode based on length of time since last rekey. - :attr str prefix: overlapping prefix. - :attr str type: type of the route. + :param int interval: The time, in seconds, to force a Secure Association Key + (SAK) rekey. + :param str mode: Determines that the SAK rekey occurs based on a timer. """ def __init__( self, - prefix: str, - type: str, + interval: int, + mode: str, ) -> None: """ - Initialize a RouteReportOverlappingRouteForOthers object. + Initialize a SakRekeyTimerMode object. - :param str prefix: overlapping prefix. - :param str type: type of the route. + :param int interval: The time, in seconds, to force a Secure Association + Key (SAK) rekey. + :param str mode: Determines that the SAK rekey occurs based on a timer. """ # pylint: disable=super-init-not-called - self.prefix = prefix - self.type = type + self.interval = interval + self.mode = mode @classmethod - def from_dict(cls, _dict: Dict) -> 'RouteReportOverlappingRouteForOthers': - """Initialize a RouteReportOverlappingRouteForOthers object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SakRekeyTimerMode': + """Initialize a SakRekeyTimerMode object from a json dictionary.""" args = {} - if 'prefix' in _dict: - args['prefix'] = _dict.get('prefix') + if (interval := _dict.get('interval')) is not None: + args['interval'] = interval else: - raise ValueError('Required property \'prefix\' not present in RouteReportOverlappingRouteForOthers JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') + raise ValueError('Required property \'interval\' not present in SakRekeyTimerMode JSON') + if (mode := _dict.get('mode')) is not None: + args['mode'] = mode else: - raise ValueError('Required property \'type\' not present in RouteReportOverlappingRouteForOthers JSON') + raise ValueError('Required property \'mode\' not present in SakRekeyTimerMode JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RouteReportOverlappingRouteForOthers object from a json dictionary.""" + """Initialize a SakRekeyTimerMode 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, 'prefix') and self.prefix is not None: - _dict['prefix'] = self.prefix - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + if hasattr(self, 'interval') and self.interval is not None: + _dict['interval'] = self.interval + if hasattr(self, 'mode') and self.mode is not None: + _dict['mode'] = self.mode return _dict def _to_dict(self): @@ -12670,26 +14730,25 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RouteReportOverlappingRouteForOthers object.""" + """Return a `str` version of this SakRekeyTimerMode object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RouteReportOverlappingRouteForOthers') -> bool: + def __eq__(self, other: 'SakRekeyTimerMode') -> 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: 'RouteReportOverlappingRouteForOthers') -> bool: + def __ne__(self, other: 'SakRekeyTimerMode') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): + class ModeEnum(str, Enum): """ - type of the route. + Determines that the SAK rekey occurs based on a timer. """ - GATEWAY = 'gateway' - ON_PREM = 'on_prem' + TIMER = 'timer' ############################################################################## @@ -12762,4 +14821,4 @@ def get_all(self) -> List[dict]: while self.has_next(): next_page = self.get_next() results.extend(next_page) - return results + return results \ No newline at end of file diff --git a/test/integration/test_direct_link_provider_v2.py b/test/integration/test_direct_link_provider_v2.py index 4717be5..fdf87db 100644 --- a/test/integration/test_direct_link_provider_v2.py +++ b/test/integration/test_direct_link_provider_v2.py @@ -13,7 +13,7 @@ from ibm_cloud_networking_services import DirectLinkV1 from ibm_cloud_networking_services import DirectLinkProviderV2 from ibm_cloud_networking_services.direct_link_provider_v2 import ProviderGatewayPortIdentity -from ibm_cloud_networking_services.direct_link_v1 import (GatewayActionTemplateAuthenticationKey, GatewayBfdConfigActionTemplate) +from ibm_cloud_networking_services.direct_link_v1 import (AuthenticationKeyIdentity, GatewayBfdConfigActionTemplate) from dotenv import load_dotenv, find_dotenv @@ -414,7 +414,7 @@ def test_provider_gateway_actions_with_client_api_md5(self): customerAccount = os.getenv("DL_PROVIDER_SERVICES_CUSTOMER_ACCT_ID") speedMbps = 1000 authenticationKeyCRN = os.getenv("DL_SERVICES_AUTHENTICATION_KEY") - authenticationKey = GatewayActionTemplateAuthenticationKey(authenticationKeyCRN) + authenticationKey = AuthenticationKeyIdentity(authenticationKeyCRN) """ successfully get a provider port id """ response = self.dl_provider.list_provider_ports() diff --git a/test/integration/test_direct_link_v1.py b/test/integration/test_direct_link_v1.py index 05ef48b..494496f 100644 --- a/test/integration/test_direct_link_v1.py +++ b/test/integration/test_direct_link_v1.py @@ -27,8 +27,7 @@ from ibm_cloud_networking_services import DirectLinkV1 from ibm_cloud_networking_services.direct_link_v1 import ( GatewayTemplateGatewayTypeDedicatedTemplate, - GatewayTemplateAuthenticationKey, - GatewayPatchTemplateAuthenticationKey, + AuthenticationKeyIdentity, GatewayTemplateGatewayTypeConnectTemplate, GatewayPatchTemplate, GatewayPortIdentity, @@ -465,7 +464,7 @@ def test_gateway_with_md5(self): customerName = "customer1" gatewayType = "dedicated" authKeyCrn = os.getenv("DL_SERVICES_AUTHENTICATION_KEY") - authKey = GatewayTemplateAuthenticationKey(crn= authKeyCrn) + authKey = AuthenticationKeyIdentity(crn= authKeyCrn) """ test create/update/delete gateway with authentication ket success """ # create gateway with authentication key @@ -487,7 +486,7 @@ def test_gateway_with_md5(self): assert response.get_result().get("authentication_key") is not None # clear the authentication for the created gateway\ - updAuthKey = GatewayPatchTemplateAuthenticationKey(crn="") + updAuthKey = AuthenticationKeyIdentity(crn="") response = self.dl.update_gateway(id=gateway_id, authentication_key=updAuthKey) assert response is not None @@ -1120,6 +1119,163 @@ def test_gateway_export_import_route_filter(self): # delete gateway self.delete_gateway(gateway_id) + ################## Direct Link Gateway MACsec ############################ + def test_gateway_macsec(self): + + """ test create gateway """ + bgpAsn = 64999 + crossConnectRouter = "LAB-xcr02.dal09" + global_bool = True + locationName = os.getenv("DL_SERVICES_LOCATION_NAME") + speedMbps = 10000 + metered = True + carrierName = "PYSDK_TEST_CARRIER" + customerName = "PYSDK_TEST_CUSTOMER" + gatewayType = "dedicated" + + # create a dedicated gateway + name = os.getenv("DL_SERVICES_GW_NAME") + \ + str("-DEDICATED-MACsec-") + str(int(time.time())) + gtw_template = GatewayTemplateGatewayTypeDedicatedTemplate(name=name, + type=gatewayType, speed_mbps=speedMbps, global_=global_bool, + bgp_asn=bgpAsn, metered=metered, carrier_name=carrierName, + cross_connect_router=crossConnectRouter, customer_name=customerName, + location_name=locationName) + response = self.dl.create_gateway(gateway_template=gtw_template) + print(response) + assert response is not None + assert response.get_status_code() == 201 + gateway_id = response.get_result().get("id") + time.sleep(15) + + # macsec + + # Construct of HpcsKeyIdentity + hpcs_key_identity = {} + hpcs_key_identity['crn'] = 'crn:v1:staging:public:hs-crypto:us-south:a/3f455c4c574447adbc14bda52f80e62f:b2044455-b89e-4c57-96ae-3f17c092dd31:key:ebc0fbe6-fd7c-4971-b127-71a385c8f602' + + # Construct of GatewayMacsecCakPrototype + gateway_macsec_cak_prototype = {} + gateway_macsec_cak_prototype['key'] = hpcs_key_identity + gateway_macsec_cak_prototype['name'] = 'AA01' + gateway_macsec_cak_prototype['session'] = 'primary' + + # Construct of SakRekeyPrototypeSakRekeyTimerModePrototype + sak_rekey_prototype = {} + sak_rekey_prototype['interval'] = 76 + sak_rekey_prototype['mode'] = 'timer' + + # Parameter values + active = True + caks = [gateway_macsec_cak_prototype] + sak_rekey = sak_rekey_prototype + security_policy = 'must_secure' + window_size = 522 + + """ Test set gateway macsec""" + macsec_set_response = self.dl.set_gateway_macsec( + gateway_id, + active, + caks, + sak_rekey, + security_policy, + window_size=window_size + ) + assert macsec_set_response.status_code == 200 + macsec_set_result = macsec_set_response.get_result() + assert macsec_set_result['active'] == True + assert macsec_set_result['sak_rekey'] == sak_rekey + assert macsec_set_result['security_policy'] == 'must_secure' + assert macsec_set_result['window_size'] == 522 + + """ Test get gateway macsec""" + macsec_get_response = self.dl.get_gateway_macsec(gateway_id) + assert macsec_get_response.status_code == 200 + macsec_get_result = macsec_get_response.get_result() + assert macsec_get_result['active'] == True + assert macsec_get_result['security_policy'] == 'must_secure' + assert macsec_get_result['window_size'] == 522 + + """ Test list gateway macsec caks""" + macsec_list_caks_response = self.dl.list_gateway_macsec_caks(gateway_id) + assert macsec_list_caks_response.status_code == 200 + macsec_list_caks_result = macsec_list_caks_response.get_result() + assert len(macsec_list_caks_result['caks']) == 1 + get_macsec_caks_id = macsec_list_caks_result['caks'][0]['id'] + + """ Test get gateway macsec cak""" + macsec_get_cak_response = self.dl.get_gateway_macsec_cak(gateway_id, get_macsec_caks_id) + assert macsec_get_cak_response.status_code == 200 + macsec_get_cak_result = macsec_get_cak_response.get_result() + assert macsec_get_cak_result['id'] == get_macsec_caks_id + + # Construct of HpcsKeyIdentity for create cak + create_cak_hpcs_key_identity = {} + create_cak_hpcs_key_identity['crn'] = 'crn:v1:staging:public:hs-crypto:us-south:a/3f455c4c574447adbc14bda52f80e62f:b2044455-b89e-4c57-96ae-3f17c092dd31:key:6f79b964-229c-45ab-b1d9-47e111cd03f6' + + create_cak_key = create_cak_hpcs_key_identity + create_cak_name = 'BB02' + create_cak_session = 'fallback' + + """ Test create gateway macsec cak""" + macsec_create_cak_response = self.dl.create_gateway_macsec_cak( + gateway_id, + create_cak_key, + create_cak_name, + create_cak_session, + ) + assert macsec_create_cak_response.status_code == 201 + macsec_create_cak_result = macsec_create_cak_response.get_result() + assert macsec_create_cak_result['key'] == create_cak_key + assert macsec_create_cak_result['name'] == create_cak_name + assert macsec_create_cak_result['session'] == create_cak_session + macsec_new_cak_id = macsec_create_cak_result['id'] + + # Construct of HpcsKeyIdentity for update cak + update_cak_hpcs_key_identity = {} + update_cak_hpcs_key_identity['crn'] = 'crn:v1:staging:public:hs-crypto:us-south:a/3f455c4c574447adbc14bda52f80e62f:b2044455-b89e-4c57-96ae-3f17c092dd31:key:6f79b964-229c-45ab-b1d9-47e111cd03f6' + + # Construct of GatewayMacsecCakPatch for update cak + gateway_macsec_cak_patch = {} + gateway_macsec_cak_patch['key'] = update_cak_hpcs_key_identity + gateway_macsec_cak_patch['name'] = 'AA02' + + """ Test update gateway macsec cak""" + macsec_update_cak_response = self.dl.update_gateway_macsec_cak( + gateway_id, + macsec_new_cak_id, + gateway_macsec_cak_patch, + ) + assert macsec_update_cak_response.status_code == 201 + macsec_update_cak_result = macsec_update_cak_response.get_result() + assert macsec_update_cak_result['name'] == 'AA02' + + """ Test delete gateway macsec cak""" + macsec_delete_cak_response = self.dl.delete_gateway_macsec_cak(gateway_id, macsec_new_cak_id) + assert macsec_delete_cak_response.status_code == 204 + + gateway_macsec_patch = {} + gateway_macsec_patch['active'] = True + gateway_macsec_patch['sak_rekey'] = sak_rekey_prototype + gateway_macsec_patch['security_policy'] = 'must_secure' + gateway_macsec_patch['window_size'] = 74 + + """ Test update gateway macsec""" + macsec_update_response = self.dl.update_gateway_macsec( + gateway_id, + gateway_macsec_patch + ) + assert macsec_update_response.get_status_code() == 200 + macsec_update_result = macsec_update_response.get_result() + assert macsec_update_result['window_size'] == gateway_macsec_patch['window_size'] + + """ Test unset gateway macsec""" + macsec_unset_response = self.dl.unset_gateway_macsec(gateway_id) + assert macsec_unset_response.status_code == 204 + + # delete gateway + self.delete_gateway(gateway_id) + ################## Direct Link Route Reports ############################ def test_gateway_route_reports(self): pytest.skip("skipping it due to travis timeout") diff --git a/test/unit/test_direct_link_v1.py b/test/unit/test_direct_link_v1.py index 64576b5..e219514 100644 --- a/test/unit/test_direct_link_v1.py +++ b/test/unit/test_direct_link_v1.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# (C) Copyright IBM Corp. 2024. +# (C) Copyright IBM Corp. 2025. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -50,23 +50,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('/') + '/+') ############################################################################## @@ -133,7 +125,7 @@ def test_list_gateways_all_params(self): """ # Set up mock url = preprocess_url('/gateways') - mock_response = '{"gateways": [{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}]}' + mock_response = '{"gateways": [{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}]}' responses.add( responses.GET, url, @@ -165,7 +157,7 @@ def test_list_gateways_value_error(self): """ # Set up mock url = preprocess_url('/gateways') - mock_response = '{"gateways": [{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}]}' + mock_response = '{"gateways": [{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}]}' responses.add( responses.GET, url, @@ -204,7 +196,7 @@ def test_create_gateway_all_params(self): """ # Set up mock url = preprocess_url('/gateways') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add( responses.POST, url, @@ -220,9 +212,9 @@ def test_create_gateway_all_params(self): as_prepend_template_model['prefix'] = '172.17.0.0/16' as_prepend_template_model['specific_prefixes'] = ['192.168.3.0/24'] - # Construct a dict representation of a GatewayTemplateAuthenticationKey model - gateway_template_authentication_key_model = {} - gateway_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + # Construct a dict representation of a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity model + authentication_key_identity_model = {} + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' # Construct a dict representation of a GatewayBfdConfigTemplate model gateway_bfd_config_template_model = {} @@ -240,25 +232,33 @@ def test_create_gateway_all_params(self): resource_group_identity_model = {} resource_group_identity_model['id'] = '56969d6043e9465c883cb9f7363e78e8' - # Construct a dict representation of a GatewayMacsecConfigTemplateFallbackCak model - gateway_macsec_config_template_fallback_cak_model = {} - gateway_macsec_config_template_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - # Construct a dict representation of a GatewayMacsecConfigTemplatePrimaryCak model - gateway_macsec_config_template_primary_cak_model = {} - gateway_macsec_config_template_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - # Construct a dict representation of a GatewayMacsecConfigTemplate model - gateway_macsec_config_template_model = {} - gateway_macsec_config_template_model['active'] = True - gateway_macsec_config_template_model['fallback_cak'] = gateway_macsec_config_template_fallback_cak_model - gateway_macsec_config_template_model['primary_cak'] = gateway_macsec_config_template_primary_cak_model - gateway_macsec_config_template_model['window_size'] = 148809600 + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a dict representation of a GatewayMacsecCakPrototype model + gateway_macsec_cak_prototype_model = {} + gateway_macsec_cak_prototype_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_prototype_model['name'] = '1000' + gateway_macsec_cak_prototype_model['session'] = 'primary' + + # Construct a dict representation of a SakRekeyPrototypeSakRekeyTimerModePrototype model + sak_rekey_prototype_model = {} + sak_rekey_prototype_model['interval'] = 3600 + sak_rekey_prototype_model['mode'] = 'timer' + + # Construct a dict representation of a GatewayMacsecPrototype model + gateway_macsec_prototype_model = {} + gateway_macsec_prototype_model['active'] = True + gateway_macsec_prototype_model['caks'] = [gateway_macsec_cak_prototype_model] + gateway_macsec_prototype_model['sak_rekey'] = sak_rekey_prototype_model + gateway_macsec_prototype_model['security_policy'] = 'must_secure' + gateway_macsec_prototype_model['window_size'] = 64 # Construct a dict representation of a GatewayTemplateGatewayTypeDedicatedTemplate model gateway_template_model = {} gateway_template_model['as_prepends'] = [as_prepend_template_model] - gateway_template_model['authentication_key'] = gateway_template_authentication_key_model + gateway_template_model['authentication_key'] = authentication_key_identity_model gateway_template_model['bfd_config'] = gateway_bfd_config_template_model gateway_template_model['bgp_asn'] = 64999 gateway_template_model['bgp_base_cidr'] = 'testString' @@ -280,7 +280,8 @@ def test_create_gateway_all_params(self): gateway_template_model['cross_connect_router'] = 'xcr01.dal03' gateway_template_model['customer_name'] = 'newCustomerName' gateway_template_model['location_name'] = 'dal03' - gateway_template_model['macsec_config'] = gateway_macsec_config_template_model + gateway_template_model['macsec'] = gateway_macsec_prototype_model + gateway_template_model['macsec_capability'] = 'non_macsec' gateway_template_model['vlan'] = 10 # Set up parameter values @@ -315,7 +316,7 @@ def test_create_gateway_value_error(self): """ # Set up mock url = preprocess_url('/gateways') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add( responses.POST, url, @@ -331,9 +332,9 @@ def test_create_gateway_value_error(self): as_prepend_template_model['prefix'] = '172.17.0.0/16' as_prepend_template_model['specific_prefixes'] = ['192.168.3.0/24'] - # Construct a dict representation of a GatewayTemplateAuthenticationKey model - gateway_template_authentication_key_model = {} - gateway_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + # Construct a dict representation of a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity model + authentication_key_identity_model = {} + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' # Construct a dict representation of a GatewayBfdConfigTemplate model gateway_bfd_config_template_model = {} @@ -351,25 +352,33 @@ def test_create_gateway_value_error(self): resource_group_identity_model = {} resource_group_identity_model['id'] = '56969d6043e9465c883cb9f7363e78e8' - # Construct a dict representation of a GatewayMacsecConfigTemplateFallbackCak model - gateway_macsec_config_template_fallback_cak_model = {} - gateway_macsec_config_template_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - # Construct a dict representation of a GatewayMacsecConfigTemplatePrimaryCak model - gateway_macsec_config_template_primary_cak_model = {} - gateway_macsec_config_template_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - # Construct a dict representation of a GatewayMacsecConfigTemplate model - gateway_macsec_config_template_model = {} - gateway_macsec_config_template_model['active'] = True - gateway_macsec_config_template_model['fallback_cak'] = gateway_macsec_config_template_fallback_cak_model - gateway_macsec_config_template_model['primary_cak'] = gateway_macsec_config_template_primary_cak_model - gateway_macsec_config_template_model['window_size'] = 148809600 + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a dict representation of a GatewayMacsecCakPrototype model + gateway_macsec_cak_prototype_model = {} + gateway_macsec_cak_prototype_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_prototype_model['name'] = '1000' + gateway_macsec_cak_prototype_model['session'] = 'primary' + + # Construct a dict representation of a SakRekeyPrototypeSakRekeyTimerModePrototype model + sak_rekey_prototype_model = {} + sak_rekey_prototype_model['interval'] = 3600 + sak_rekey_prototype_model['mode'] = 'timer' + + # Construct a dict representation of a GatewayMacsecPrototype model + gateway_macsec_prototype_model = {} + gateway_macsec_prototype_model['active'] = True + gateway_macsec_prototype_model['caks'] = [gateway_macsec_cak_prototype_model] + gateway_macsec_prototype_model['sak_rekey'] = sak_rekey_prototype_model + gateway_macsec_prototype_model['security_policy'] = 'must_secure' + gateway_macsec_prototype_model['window_size'] = 64 # Construct a dict representation of a GatewayTemplateGatewayTypeDedicatedTemplate model gateway_template_model = {} gateway_template_model['as_prepends'] = [as_prepend_template_model] - gateway_template_model['authentication_key'] = gateway_template_authentication_key_model + gateway_template_model['authentication_key'] = authentication_key_identity_model gateway_template_model['bfd_config'] = gateway_bfd_config_template_model gateway_template_model['bgp_asn'] = 64999 gateway_template_model['bgp_base_cidr'] = 'testString' @@ -391,7 +400,8 @@ def test_create_gateway_value_error(self): gateway_template_model['cross_connect_router'] = 'xcr01.dal03' gateway_template_model['customer_name'] = 'newCustomerName' gateway_template_model['location_name'] = 'dal03' - gateway_template_model['macsec_config'] = gateway_macsec_config_template_model + gateway_template_model['macsec'] = gateway_macsec_prototype_model + gateway_template_model['macsec_capability'] = 'non_macsec' gateway_template_model['vlan'] = 10 # Set up parameter values @@ -503,7 +513,7 @@ def test_get_gateway_all_params(self): """ # Set up mock url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add( responses.GET, url, @@ -541,7 +551,7 @@ def test_get_gateway_value_error(self): """ # Set up mock url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add( responses.GET, url, @@ -584,7 +594,7 @@ def test_update_gateway_all_params(self): """ # Set up mock url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add( responses.PATCH, url, @@ -593,33 +603,18 @@ def test_update_gateway_all_params(self): status=200, ) - # Construct a dict representation of a GatewayPatchTemplateAuthenticationKey model - gateway_patch_template_authentication_key_model = {} - gateway_patch_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + # Construct a dict representation of a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity model + authentication_key_identity_model = {} + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' # Construct a dict representation of a GatewayBfdPatchTemplate model gateway_bfd_patch_template_model = {} gateway_bfd_patch_template_model['interval'] = 2000 gateway_bfd_patch_template_model['multiplier'] = 10 - # Construct a dict representation of a GatewayMacsecConfigPatchTemplateFallbackCak model - gateway_macsec_config_patch_template_fallback_cak_model = {} - gateway_macsec_config_patch_template_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - # Construct a dict representation of a GatewayMacsecConfigPatchTemplatePrimaryCak model - gateway_macsec_config_patch_template_primary_cak_model = {} - gateway_macsec_config_patch_template_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - # Construct a dict representation of a GatewayMacsecConfigPatchTemplate model - gateway_macsec_config_patch_template_model = {} - gateway_macsec_config_patch_template_model['active'] = True - gateway_macsec_config_patch_template_model['fallback_cak'] = gateway_macsec_config_patch_template_fallback_cak_model - gateway_macsec_config_patch_template_model['primary_cak'] = gateway_macsec_config_patch_template_primary_cak_model - gateway_macsec_config_patch_template_model['window_size'] = 512 - # Construct a dict representation of a GatewayPatchTemplate model gateway_patch_template_model = {} - gateway_patch_template_model['authentication_key'] = gateway_patch_template_authentication_key_model + gateway_patch_template_model['authentication_key'] = authentication_key_identity_model gateway_patch_template_model['bfd_config'] = gateway_bfd_patch_template_model gateway_patch_template_model['bgp_asn'] = 64999 gateway_patch_template_model['bgp_cer_cidr'] = '169.254.0.10/30' @@ -629,7 +624,6 @@ def test_update_gateway_all_params(self): gateway_patch_template_model['default_import_route_filter'] = 'permit' gateway_patch_template_model['global'] = True gateway_patch_template_model['loa_reject_reason'] = 'The port mentioned was incorrect' - gateway_patch_template_model['macsec_config'] = gateway_macsec_config_patch_template_model gateway_patch_template_model['metered'] = False gateway_patch_template_model['name'] = 'testGateway' gateway_patch_template_model['operational_status'] = 'loa_accepted' @@ -671,7 +665,7 @@ def test_update_gateway_value_error(self): """ # Set up mock url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add( responses.PATCH, url, @@ -680,33 +674,18 @@ def test_update_gateway_value_error(self): status=200, ) - # Construct a dict representation of a GatewayPatchTemplateAuthenticationKey model - gateway_patch_template_authentication_key_model = {} - gateway_patch_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + # Construct a dict representation of a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity model + authentication_key_identity_model = {} + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' # Construct a dict representation of a GatewayBfdPatchTemplate model gateway_bfd_patch_template_model = {} gateway_bfd_patch_template_model['interval'] = 2000 gateway_bfd_patch_template_model['multiplier'] = 10 - # Construct a dict representation of a GatewayMacsecConfigPatchTemplateFallbackCak model - gateway_macsec_config_patch_template_fallback_cak_model = {} - gateway_macsec_config_patch_template_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - # Construct a dict representation of a GatewayMacsecConfigPatchTemplatePrimaryCak model - gateway_macsec_config_patch_template_primary_cak_model = {} - gateway_macsec_config_patch_template_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - # Construct a dict representation of a GatewayMacsecConfigPatchTemplate model - gateway_macsec_config_patch_template_model = {} - gateway_macsec_config_patch_template_model['active'] = True - gateway_macsec_config_patch_template_model['fallback_cak'] = gateway_macsec_config_patch_template_fallback_cak_model - gateway_macsec_config_patch_template_model['primary_cak'] = gateway_macsec_config_patch_template_primary_cak_model - gateway_macsec_config_patch_template_model['window_size'] = 512 - # Construct a dict representation of a GatewayPatchTemplate model gateway_patch_template_model = {} - gateway_patch_template_model['authentication_key'] = gateway_patch_template_authentication_key_model + gateway_patch_template_model['authentication_key'] = authentication_key_identity_model gateway_patch_template_model['bfd_config'] = gateway_bfd_patch_template_model gateway_patch_template_model['bgp_asn'] = 64999 gateway_patch_template_model['bgp_cer_cidr'] = '169.254.0.10/30' @@ -716,7 +695,6 @@ def test_update_gateway_value_error(self): gateway_patch_template_model['default_import_route_filter'] = 'permit' gateway_patch_template_model['global'] = True gateway_patch_template_model['loa_reject_reason'] = 'The port mentioned was incorrect' - gateway_patch_template_model['macsec_config'] = gateway_macsec_config_patch_template_model gateway_patch_template_model['metered'] = False gateway_patch_template_model['name'] = 'testGateway' gateway_patch_template_model['operational_status'] = 'loa_accepted' @@ -760,7 +738,7 @@ def test_create_gateway_action_all_params(self): """ # Set up mock url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/actions') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add( responses.POST, url, @@ -776,9 +754,9 @@ def test_create_gateway_action_all_params(self): as_prepend_template_model['prefix'] = '172.17.0.0/16' as_prepend_template_model['specific_prefixes'] = ['192.168.3.0/24'] - # Construct a dict representation of a GatewayActionTemplateAuthenticationKey model - gateway_action_template_authentication_key_model = {} - gateway_action_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + # Construct a dict representation of a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity model + authentication_key_identity_model = {} + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' # Construct a dict representation of a GatewayBfdConfigActionTemplate model gateway_bfd_config_action_template_model = {} @@ -804,7 +782,7 @@ def test_create_gateway_action_all_params(self): id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' action = 'create_gateway_approve' as_prepends = [as_prepend_template_model] - authentication_key = gateway_action_template_authentication_key_model + authentication_key = authentication_key_identity_model bfd_config = gateway_bfd_config_action_template_model connection_mode = 'transit' default_export_route_filter = 'permit' @@ -842,7 +820,7 @@ def test_create_gateway_action_all_params(self): req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) assert req_body['action'] == 'create_gateway_approve' assert req_body['as_prepends'] == [as_prepend_template_model] - assert req_body['authentication_key'] == gateway_action_template_authentication_key_model + assert req_body['authentication_key'] == authentication_key_identity_model assert req_body['bfd_config'] == gateway_bfd_config_action_template_model assert req_body['connection_mode'] == 'transit' assert req_body['default_export_route_filter'] == 'permit' @@ -870,7 +848,7 @@ def test_create_gateway_action_value_error(self): """ # Set up mock url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/actions') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec_config": {"active": true, "active_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "cryptographic_algorithm": "aes_256_cmac", "fallback_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "key_server_priority": 255, "primary_cak": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222", "status": "status"}, "sak_expiry_time": 3600, "security_policy": "must_secure", "status": "secured", "window_size": 64}, "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "patch_panel_completion_notice": "patch panel configuration details", "type": "dedicated", "vlan": 10}' + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "prefix": "172.17.0.0/16", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}], "authentication_key": {"crn": "crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "bfd_config": {"bfd_status": "up", "bfd_status_updated_at": "2020-08-20T06:58:41.909Z", "interval": 2000, "multiplier": 10}, "bgp_asn": 64999, "bgp_base_cidr": "bgp_base_cidr", "bgp_cer_cidr": "10.254.30.78/30", "bgp_ibm_asn": 13884, "bgp_ibm_cidr": "10.254.30.77/30", "bgp_status": "active", "bgp_status_updated_at": "2020-08-20T06:58:41.909Z", "carrier_name": "myCarrierName", "change_request": {"type": "create_gateway"}, "completion_notice_reject_reason": "The completion notice file was blank", "connection_mode": "transit", "created_at": "2019-01-01T12:00:00.000Z", "crn": "crn:v1:bluemix:public:directlink:dal03:a/4111d05f36894e3cb9b46a43556d9000::dedicated:ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "cross_account": false, "cross_connect_router": "xcr01.dal03", "customer_name": "newCustomerName", "default_export_route_filter": "permit", "default_import_route_filter": "permit", "global": true, "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "link_status": "up", "link_status_updated_at": "2020-08-20T06:58:41.909Z", "location_display_name": "Dallas 03", "location_name": "dal03", "macsec": {"active": true, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}]}, "macsec_capability": "non_macsec", "metered": false, "name": "myGateway", "operational_status": "awaiting_completion_notice", "operational_status_reasons": [{"code": "authentication_key_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "patch_panel_completion_notice": "patch panel configuration details", "port": {"id": "54321b1a-fee4-41c7-9e11-9cd99e000aaa"}, "provider_api_managed": false, "resource_group": {"id": "56969d6043e9465c883cb9f7363e78e8"}, "speed_mbps": 1000, "type": "dedicated", "vlan": 10}' responses.add( responses.POST, url, @@ -886,9 +864,9 @@ def test_create_gateway_action_value_error(self): as_prepend_template_model['prefix'] = '172.17.0.0/16' as_prepend_template_model['specific_prefixes'] = ['192.168.3.0/24'] - # Construct a dict representation of a GatewayActionTemplateAuthenticationKey model - gateway_action_template_authentication_key_model = {} - gateway_action_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + # Construct a dict representation of a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity model + authentication_key_identity_model = {} + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' # Construct a dict representation of a GatewayBfdConfigActionTemplate model gateway_bfd_config_action_template_model = {} @@ -914,7 +892,7 @@ def test_create_gateway_action_value_error(self): id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' action = 'create_gateway_approve' as_prepends = [as_prepend_template_model] - authentication_key = gateway_action_template_authentication_key_model + authentication_key = authentication_key_identity_model bfd_config = gateway_bfd_config_action_template_model connection_mode = 'transit' default_export_route_filter = 'permit' @@ -1440,6 +1418,247 @@ def test_get_gateway_status_value_error_with_retries(self): # End of Service: Gateways ############################################################################## +############################################################################## +# Start of Service: GatewayASPrepends +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = DirectLinkV1.new_instance( + version=version, + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, DirectLinkV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = DirectLinkV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = DirectLinkV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = DirectLinkV1.new_instance( + version=None, + ) + + +class TestListGatewayAsPrepends: + """ + Test Class for list_gateway_as_prepends + """ + + @responses.activate + def test_list_gateway_as_prepends_all_params(self): + """ + list_gateway_as_prepends() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/as_prepends') + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Invoke method + response = _service.list_gateway_as_prepends( + gateway_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_gateway_as_prepends_all_params_with_retries(self): + # Enable retries and run test_list_gateway_as_prepends_all_params. + _service.enable_retries() + self.test_list_gateway_as_prepends_all_params() + + # Disable retries and run test_list_gateway_as_prepends_all_params. + _service.disable_retries() + self.test_list_gateway_as_prepends_all_params() + + @responses.activate + def test_list_gateway_as_prepends_value_error(self): + """ + test_list_gateway_as_prepends_value_error() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/as_prepends') + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_gateway_as_prepends(**req_copy) + + def test_list_gateway_as_prepends_value_error_with_retries(self): + # Enable retries and run test_list_gateway_as_prepends_value_error. + _service.enable_retries() + self.test_list_gateway_as_prepends_value_error() + + # Disable retries and run test_list_gateway_as_prepends_value_error. + _service.disable_retries() + self.test_list_gateway_as_prepends_value_error() + + +class TestReplaceGatewayAsPrepends: + """ + Test Class for replace_gateway_as_prepends + """ + + @responses.activate + def test_replace_gateway_as_prepends_all_params(self): + """ + replace_gateway_as_prepends() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/as_prepends') + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "specific_prefixes": ["192.168.3.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 AsPrependPrefixArrayTemplate model + as_prepend_prefix_array_template_model = {} + as_prepend_prefix_array_template_model['length'] = 4 + as_prepend_prefix_array_template_model['policy'] = 'import' + as_prepend_prefix_array_template_model['specific_prefixes'] = ['192.168.3.0/24'] + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' + as_prepends = [as_prepend_prefix_array_template_model] + + # Invoke method + response = _service.replace_gateway_as_prepends( + gateway_id, + if_match, + as_prepends=as_prepends, + 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['as_prepends'] == [as_prepend_prefix_array_template_model] + + def test_replace_gateway_as_prepends_all_params_with_retries(self): + # Enable retries and run test_replace_gateway_as_prepends_all_params. + _service.enable_retries() + self.test_replace_gateway_as_prepends_all_params() + + # Disable retries and run test_replace_gateway_as_prepends_all_params. + _service.disable_retries() + self.test_replace_gateway_as_prepends_all_params() + + @responses.activate + def test_replace_gateway_as_prepends_value_error(self): + """ + test_replace_gateway_as_prepends_value_error() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/as_prepends') + mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "specific_prefixes": ["192.168.3.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 AsPrependPrefixArrayTemplate model + as_prepend_prefix_array_template_model = {} + as_prepend_prefix_array_template_model['length'] = 4 + as_prepend_prefix_array_template_model['policy'] = 'import' + as_prepend_prefix_array_template_model['specific_prefixes'] = ['192.168.3.0/24'] + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' + as_prepends = [as_prepend_prefix_array_template_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + "if_match": if_match, + } + 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_gateway_as_prepends(**req_copy) + + def test_replace_gateway_as_prepends_value_error_with_retries(self): + # Enable retries and run test_replace_gateway_as_prepends_value_error. + _service.enable_retries() + self.test_replace_gateway_as_prepends_value_error() + + # Disable retries and run test_replace_gateway_as_prepends_value_error. + _service.disable_retries() + self.test_replace_gateway_as_prepends_value_error() + + +# endregion +############################################################################## +# End of Service: GatewayASPrepends +############################################################################## + ############################################################################## # Start of Service: GatewayExportRouteFilters ############################################################################## @@ -2745,7 +2964,7 @@ def test_update_gateway_import_route_filter_value_error_with_retries(self): ############################################################################## ############################################################################## -# Start of Service: GatewayRouteReports +# Start of Service: GatewayMACsec ############################################################################## # region @@ -2796,19 +3015,94 @@ def test_new_instance_required_param_none(self): ) -class TestListGatewayRouteReports: +class TestUnsetGatewayMacsec: """ - Test Class for list_gateway_route_reports + Test Class for unset_gateway_macsec """ @responses.activate - def test_list_gateway_route_reports_all_params(self): + def test_unset_gateway_macsec_all_params(self): """ - list_gateway_route_reports() + unset_gateway_macsec() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports') - mock_response = '{"route_reports": [{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Invoke method + response = _service.unset_gateway_macsec( + id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_unset_gateway_macsec_all_params_with_retries(self): + # Enable retries and run test_unset_gateway_macsec_all_params. + _service.enable_retries() + self.test_unset_gateway_macsec_all_params() + + # Disable retries and run test_unset_gateway_macsec_all_params. + _service.disable_retries() + self.test_unset_gateway_macsec_all_params() + + @responses.activate + def test_unset_gateway_macsec_value_error(self): + """ + test_unset_gateway_macsec_value_error() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.unset_gateway_macsec(**req_copy) + + def test_unset_gateway_macsec_value_error_with_retries(self): + # Enable retries and run test_unset_gateway_macsec_value_error. + _service.enable_retries() + self.test_unset_gateway_macsec_value_error() + + # Disable retries and run test_unset_gateway_macsec_value_error. + _service.disable_retries() + self.test_unset_gateway_macsec_value_error() + + +class TestGetGatewayMacsec: + """ + Test Class for get_gateway_macsec + """ + + @responses.activate + def test_get_gateway_macsec_all_params(self): + """ + get_gateway_macsec() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + mock_response = '{"active": true, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "created_at": "2020-11-02T20:40:29.622Z", "key_server_priority": 255, "sak_rekey": {"interval": 3600, "mode": "timer"}, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "updated_at": "2020-11-02T20:40:29.622Z", "window_size": 512}' responses.add( responses.GET, url, @@ -2818,11 +3112,11 @@ def test_list_gateway_route_reports_all_params(self): ) # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Invoke method - response = _service.list_gateway_route_reports( - gateway_id, + response = _service.get_gateway_macsec( + id, headers={}, ) @@ -2830,23 +3124,23 @@ def test_list_gateway_route_reports_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_gateway_route_reports_all_params_with_retries(self): - # Enable retries and run test_list_gateway_route_reports_all_params. + def test_get_gateway_macsec_all_params_with_retries(self): + # Enable retries and run test_get_gateway_macsec_all_params. _service.enable_retries() - self.test_list_gateway_route_reports_all_params() + self.test_get_gateway_macsec_all_params() - # Disable retries and run test_list_gateway_route_reports_all_params. + # Disable retries and run test_get_gateway_macsec_all_params. _service.disable_retries() - self.test_list_gateway_route_reports_all_params() + self.test_get_gateway_macsec_all_params() @responses.activate - def test_list_gateway_route_reports_value_error(self): + def test_get_gateway_macsec_value_error(self): """ - test_list_gateway_route_reports_value_error() + test_get_gateway_macsec_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports') - mock_response = '{"route_reports": [{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + mock_response = '{"active": true, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "created_at": "2020-11-02T20:40:29.622Z", "key_server_priority": 255, "sak_rekey": {"interval": 3600, "mode": "timer"}, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "updated_at": "2020-11-02T20:40:29.622Z", "window_size": 512}' responses.add( responses.GET, url, @@ -2856,200 +3150,361 @@ def test_list_gateway_route_reports_value_error(self): ) # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, + "id": id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_gateway_route_reports(**req_copy) + _service.get_gateway_macsec(**req_copy) - def test_list_gateway_route_reports_value_error_with_retries(self): - # Enable retries and run test_list_gateway_route_reports_value_error. + def test_get_gateway_macsec_value_error_with_retries(self): + # Enable retries and run test_get_gateway_macsec_value_error. _service.enable_retries() - self.test_list_gateway_route_reports_value_error() + self.test_get_gateway_macsec_value_error() - # Disable retries and run test_list_gateway_route_reports_value_error. + # Disable retries and run test_get_gateway_macsec_value_error. _service.disable_retries() - self.test_list_gateway_route_reports_value_error() + self.test_get_gateway_macsec_value_error() -class TestCreateGatewayRouteReport: +class TestUpdateGatewayMacsec: """ - Test Class for create_gateway_route_report + Test Class for update_gateway_macsec """ @responses.activate - def test_create_gateway_route_report_all_params(self): + def test_update_gateway_macsec_all_params(self): """ - create_gateway_route_report() + update_gateway_macsec() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports') - mock_response = '{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + mock_response = '{"active": true, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "created_at": "2020-11-02T20:40:29.622Z", "key_server_priority": 255, "sak_rekey": {"interval": 3600, "mode": "timer"}, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "updated_at": "2020-11-02T20:40:29.622Z", "window_size": 512}' responses.add( - responses.POST, + responses.PATCH, url, body=mock_response, content_type='application/json', - status=202, + status=200, ) + # Construct a dict representation of a SakRekeyPatchSakRekeyTimerModePatch model + sak_rekey_patch_model = {} + sak_rekey_patch_model['interval'] = 3600 + sak_rekey_patch_model['mode'] = 'timer' + + # Construct a dict representation of a GatewayMacsecPatch model + gateway_macsec_patch_model = {} + gateway_macsec_patch_model['active'] = True + gateway_macsec_patch_model['sak_rekey'] = sak_rekey_patch_model + gateway_macsec_patch_model['security_policy'] = 'must_secure' + gateway_macsec_patch_model['window_size'] = 64 + # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + gateway_macsec_patch = gateway_macsec_patch_model # Invoke method - response = _service.create_gateway_route_report( - gateway_id, + response = _service.update_gateway_macsec( + id, + gateway_macsec_patch, headers={}, ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 202 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == gateway_macsec_patch - def test_create_gateway_route_report_all_params_with_retries(self): - # Enable retries and run test_create_gateway_route_report_all_params. + def test_update_gateway_macsec_all_params_with_retries(self): + # Enable retries and run test_update_gateway_macsec_all_params. _service.enable_retries() - self.test_create_gateway_route_report_all_params() + self.test_update_gateway_macsec_all_params() - # Disable retries and run test_create_gateway_route_report_all_params. + # Disable retries and run test_update_gateway_macsec_all_params. _service.disable_retries() - self.test_create_gateway_route_report_all_params() + self.test_update_gateway_macsec_all_params() @responses.activate - def test_create_gateway_route_report_value_error(self): + def test_update_gateway_macsec_value_error(self): """ - test_create_gateway_route_report_value_error() + test_update_gateway_macsec_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports') - mock_response = '{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + mock_response = '{"active": true, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "created_at": "2020-11-02T20:40:29.622Z", "key_server_priority": 255, "sak_rekey": {"interval": 3600, "mode": "timer"}, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "updated_at": "2020-11-02T20:40:29.622Z", "window_size": 512}' responses.add( - responses.POST, + responses.PATCH, url, body=mock_response, content_type='application/json', - status=202, + status=200, ) + # Construct a dict representation of a SakRekeyPatchSakRekeyTimerModePatch model + sak_rekey_patch_model = {} + sak_rekey_patch_model['interval'] = 3600 + sak_rekey_patch_model['mode'] = 'timer' + + # Construct a dict representation of a GatewayMacsecPatch model + gateway_macsec_patch_model = {} + gateway_macsec_patch_model['active'] = True + gateway_macsec_patch_model['sak_rekey'] = sak_rekey_patch_model + gateway_macsec_patch_model['security_policy'] = 'must_secure' + gateway_macsec_patch_model['window_size'] = 64 + # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + gateway_macsec_patch = gateway_macsec_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, + "id": id, + "gateway_macsec_patch": gateway_macsec_patch, } 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.create_gateway_route_report(**req_copy) + _service.update_gateway_macsec(**req_copy) - def test_create_gateway_route_report_value_error_with_retries(self): - # Enable retries and run test_create_gateway_route_report_value_error. + def test_update_gateway_macsec_value_error_with_retries(self): + # Enable retries and run test_update_gateway_macsec_value_error. _service.enable_retries() - self.test_create_gateway_route_report_value_error() + self.test_update_gateway_macsec_value_error() - # Disable retries and run test_create_gateway_route_report_value_error. + # Disable retries and run test_update_gateway_macsec_value_error. _service.disable_retries() - self.test_create_gateway_route_report_value_error() + self.test_update_gateway_macsec_value_error() -class TestDeleteGatewayRouteReport: +class TestSetGatewayMacsec: """ - Test Class for delete_gateway_route_report + Test Class for set_gateway_macsec """ @responses.activate - def test_delete_gateway_route_report_all_params(self): + def test_set_gateway_macsec_all_params(self): """ - delete_gateway_route_report() + set_gateway_macsec() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + mock_response = '{"active": true, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "created_at": "2020-11-02T20:40:29.622Z", "key_server_priority": 255, "sak_rekey": {"interval": 3600, "mode": "timer"}, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "updated_at": "2020-11-02T20:40:29.622Z", "window_size": 512}' responses.add( - responses.DELETE, + responses.PUT, url, - status=204, + body=mock_response, + content_type='application/json', + status=200, ) + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a dict representation of a GatewayMacsecCakPrototype model + gateway_macsec_cak_prototype_model = {} + gateway_macsec_cak_prototype_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_prototype_model['name'] = '1000' + gateway_macsec_cak_prototype_model['session'] = 'primary' + + # Construct a dict representation of a SakRekeyPrototypeSakRekeyTimerModePrototype model + sak_rekey_prototype_model = {} + sak_rekey_prototype_model['interval'] = 3600 + sak_rekey_prototype_model['mode'] = 'timer' + # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + active = True + caks = [gateway_macsec_cak_prototype_model] + sak_rekey = sak_rekey_prototype_model + security_policy = 'must_secure' + window_size = 64 + if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' # Invoke method - response = _service.delete_gateway_route_report( - gateway_id, + response = _service.set_gateway_macsec( id, + active, + caks, + sak_rekey, + security_policy, + window_size=window_size, + if_match=if_match, headers={}, ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 204 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['active'] == True + assert req_body['caks'] == [gateway_macsec_cak_prototype_model] + assert req_body['sak_rekey'] == sak_rekey_prototype_model + assert req_body['security_policy'] == 'must_secure' + assert req_body['window_size'] == 64 + + def test_set_gateway_macsec_all_params_with_retries(self): + # Enable retries and run test_set_gateway_macsec_all_params. + _service.enable_retries() + self.test_set_gateway_macsec_all_params() - def test_delete_gateway_route_report_all_params_with_retries(self): - # Enable retries and run test_delete_gateway_route_report_all_params. + # Disable retries and run test_set_gateway_macsec_all_params. + _service.disable_retries() + self.test_set_gateway_macsec_all_params() + + @responses.activate + def test_set_gateway_macsec_required_params(self): + """ + test_set_gateway_macsec_required_params() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + mock_response = '{"active": true, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "created_at": "2020-11-02T20:40:29.622Z", "key_server_priority": 255, "sak_rekey": {"interval": 3600, "mode": "timer"}, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "updated_at": "2020-11-02T20:40:29.622Z", "window_size": 512}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a dict representation of a GatewayMacsecCakPrototype model + gateway_macsec_cak_prototype_model = {} + gateway_macsec_cak_prototype_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_prototype_model['name'] = '1000' + gateway_macsec_cak_prototype_model['session'] = 'primary' + + # Construct a dict representation of a SakRekeyPrototypeSakRekeyTimerModePrototype model + sak_rekey_prototype_model = {} + sak_rekey_prototype_model['interval'] = 3600 + sak_rekey_prototype_model['mode'] = 'timer' + + # Set up parameter values + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + active = True + caks = [gateway_macsec_cak_prototype_model] + sak_rekey = sak_rekey_prototype_model + security_policy = 'must_secure' + window_size = 64 + + # Invoke method + response = _service.set_gateway_macsec( + id, + active, + caks, + sak_rekey, + security_policy, + window_size=window_size, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['active'] == True + assert req_body['caks'] == [gateway_macsec_cak_prototype_model] + assert req_body['sak_rekey'] == sak_rekey_prototype_model + assert req_body['security_policy'] == 'must_secure' + assert req_body['window_size'] == 64 + + def test_set_gateway_macsec_required_params_with_retries(self): + # Enable retries and run test_set_gateway_macsec_required_params. _service.enable_retries() - self.test_delete_gateway_route_report_all_params() + self.test_set_gateway_macsec_required_params() - # Disable retries and run test_delete_gateway_route_report_all_params. + # Disable retries and run test_set_gateway_macsec_required_params. _service.disable_retries() - self.test_delete_gateway_route_report_all_params() + self.test_set_gateway_macsec_required_params() @responses.activate - def test_delete_gateway_route_report_value_error(self): + def test_set_gateway_macsec_value_error(self): """ - test_delete_gateway_route_report_value_error() + test_set_gateway_macsec_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec') + mock_response = '{"active": true, "cipher_suite": "gcm_aes_xpn_256", "confidentiality_offset": 0, "created_at": "2020-11-02T20:40:29.622Z", "key_server_priority": 255, "sak_rekey": {"interval": 3600, "mode": "timer"}, "security_policy": "must_secure", "status": "secured", "status_reasons": [{"code": "macsec_cak_failed", "message": "The `authentication_key` failed configuration.", "more_info": "https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK"}], "updated_at": "2020-11-02T20:40:29.622Z", "window_size": 512}' responses.add( - responses.DELETE, + responses.PUT, url, - status=204, + body=mock_response, + content_type='application/json', + status=200, ) + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a dict representation of a GatewayMacsecCakPrototype model + gateway_macsec_cak_prototype_model = {} + gateway_macsec_cak_prototype_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_prototype_model['name'] = '1000' + gateway_macsec_cak_prototype_model['session'] = 'primary' + + # Construct a dict representation of a SakRekeyPrototypeSakRekeyTimerModePrototype model + sak_rekey_prototype_model = {} + sak_rekey_prototype_model['interval'] = 3600 + sak_rekey_prototype_model['mode'] = 'timer' + # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + active = True + caks = [gateway_macsec_cak_prototype_model] + sak_rekey = sak_rekey_prototype_model + security_policy = 'must_secure' + window_size = 64 # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, "id": id, + "active": active, + "caks": caks, + "sak_rekey": sak_rekey, + "security_policy": security_policy, } 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.delete_gateway_route_report(**req_copy) + _service.set_gateway_macsec(**req_copy) - def test_delete_gateway_route_report_value_error_with_retries(self): - # Enable retries and run test_delete_gateway_route_report_value_error. + def test_set_gateway_macsec_value_error_with_retries(self): + # Enable retries and run test_set_gateway_macsec_value_error. _service.enable_retries() - self.test_delete_gateway_route_report_value_error() + self.test_set_gateway_macsec_value_error() - # Disable retries and run test_delete_gateway_route_report_value_error. + # Disable retries and run test_set_gateway_macsec_value_error. _service.disable_retries() - self.test_delete_gateway_route_report_value_error() + self.test_set_gateway_macsec_value_error() -class TestGetGatewayRouteReport: +class TestListGatewayMacsecCaks: """ - Test Class for get_gateway_route_report + Test Class for list_gateway_macsec_caks """ @responses.activate - def test_get_gateway_route_report_all_params(self): + def test_list_gateway_macsec_caks_all_params(self): """ - get_gateway_route_report() + list_gateway_macsec_caks() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks') + mock_response = '{"caks": [{"active_delta": {"key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "status": "active"}, "created_at": "2020-11-02T20:40:29.622Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "session": "primary", "status": "active", "updated_at": "2020-11-02T20:40:29.622Z"}]}' responses.add( responses.GET, url, @@ -3059,12 +3514,10 @@ def test_get_gateway_route_report_all_params(self): ) # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Invoke method - response = _service.get_gateway_route_report( - gateway_id, + response = _service.list_gateway_macsec_caks( id, headers={}, ) @@ -3073,23 +3526,23 @@ def test_get_gateway_route_report_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_gateway_route_report_all_params_with_retries(self): - # Enable retries and run test_get_gateway_route_report_all_params. + def test_list_gateway_macsec_caks_all_params_with_retries(self): + # Enable retries and run test_list_gateway_macsec_caks_all_params. _service.enable_retries() - self.test_get_gateway_route_report_all_params() + self.test_list_gateway_macsec_caks_all_params() - # Disable retries and run test_get_gateway_route_report_all_params. + # Disable retries and run test_list_gateway_macsec_caks_all_params. _service.disable_retries() - self.test_get_gateway_route_report_all_params() + self.test_list_gateway_macsec_caks_all_params() @responses.activate - def test_get_gateway_route_report_value_error(self): + def test_list_gateway_macsec_caks_value_error(self): """ - test_get_gateway_route_report_value_error() + test_list_gateway_macsec_caks_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks') + mock_response = '{"caks": [{"active_delta": {"key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "status": "active"}, "created_at": "2020-11-02T20:40:29.622Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "session": "primary", "status": "active", "updated_at": "2020-11-02T20:40:29.622Z"}]}' responses.add( responses.GET, url, @@ -3099,180 +3552,40 @@ def test_get_gateway_route_report_value_error(self): ) # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, "id": id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_gateway_route_report(**req_copy) + _service.list_gateway_macsec_caks(**req_copy) - def test_get_gateway_route_report_value_error_with_retries(self): - # Enable retries and run test_get_gateway_route_report_value_error. + def test_list_gateway_macsec_caks_value_error_with_retries(self): + # Enable retries and run test_list_gateway_macsec_caks_value_error. _service.enable_retries() - self.test_get_gateway_route_report_value_error() + self.test_list_gateway_macsec_caks_value_error() - # Disable retries and run test_get_gateway_route_report_value_error. + # Disable retries and run test_list_gateway_macsec_caks_value_error. _service.disable_retries() - self.test_get_gateway_route_report_value_error() - - -# endregion -############################################################################## -# End of Service: GatewayRouteReports -############################################################################## - -############################################################################## -# Start of Service: VirtualConnections -############################################################################## -# region + self.test_list_gateway_macsec_caks_value_error() -class TestNewInstance: +class TestCreateGatewayMacsecCak: """ - Test Class for new_instance + Test Class for create_gateway_macsec_cak """ - def test_new_instance(self): + @responses.activate + def test_create_gateway_macsec_cak_all_params(self): """ - new_instance() - """ - os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' - - service = DirectLinkV1.new_instance( - version=version, - service_name='TEST_SERVICE', - ) - - assert service is not None - assert isinstance(service, DirectLinkV1) - - def test_new_instance_without_authenticator(self): - """ - new_instance_without_authenticator() - """ - with pytest.raises(ValueError, match='authenticator must be provided'): - service = DirectLinkV1.new_instance( - version=version, - service_name='TEST_SERVICE_NOT_FOUND', - ) - - def test_new_instance_without_required_params(self): - """ - new_instance_without_required_params() - """ - with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): - service = DirectLinkV1.new_instance() - - def test_new_instance_required_param_none(self): - """ - new_instance_required_param_none() - """ - with pytest.raises(ValueError, match='version must be provided'): - service = DirectLinkV1.new_instance( - version=None, - ) - - -class TestListGatewayVirtualConnections: - """ - Test Class for list_gateway_virtual_connections - """ - - @responses.activate - def test_list_gateway_virtual_connections_all_params(self): - """ - list_gateway_virtual_connections() - """ - # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections') - mock_response = '{"virtual_connections": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}]}' - responses.add( - responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200, - ) - - # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - - # Invoke method - response = _service.list_gateway_virtual_connections( - gateway_id, - headers={}, - ) - - # Check for correct operation - assert len(responses.calls) == 1 - assert response.status_code == 200 - - def test_list_gateway_virtual_connections_all_params_with_retries(self): - # Enable retries and run test_list_gateway_virtual_connections_all_params. - _service.enable_retries() - self.test_list_gateway_virtual_connections_all_params() - - # Disable retries and run test_list_gateway_virtual_connections_all_params. - _service.disable_retries() - self.test_list_gateway_virtual_connections_all_params() - - @responses.activate - def test_list_gateway_virtual_connections_value_error(self): - """ - test_list_gateway_virtual_connections_value_error() - """ - # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections') - mock_response = '{"virtual_connections": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}]}' - responses.add( - responses.GET, - url, - body=mock_response, - content_type='application/json', - status=200, - ) - - # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - - # Pass in all but one required param and check for a ValueError - req_param_dict = { - "gateway_id": gateway_id, - } - for param in req_param_dict.keys(): - req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} - with pytest.raises(ValueError): - _service.list_gateway_virtual_connections(**req_copy) - - def test_list_gateway_virtual_connections_value_error_with_retries(self): - # Enable retries and run test_list_gateway_virtual_connections_value_error. - _service.enable_retries() - self.test_list_gateway_virtual_connections_value_error() - - # Disable retries and run test_list_gateway_virtual_connections_value_error. - _service.disable_retries() - self.test_list_gateway_virtual_connections_value_error() - - -class TestCreateGatewayVirtualConnection: - """ - Test Class for create_gateway_virtual_connection - """ - - @responses.activate - def test_create_gateway_virtual_connection_all_params(self): - """ - create_gateway_virtual_connection() + create_gateway_macsec_cak() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks') + mock_response = '{"active_delta": {"key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "status": "active"}, "created_at": "2020-11-02T20:40:29.622Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "session": "primary", "status": "active", "updated_at": "2020-11-02T20:40:29.622Z"}' responses.add( responses.POST, url, @@ -3281,18 +3594,22 @@ def test_create_gateway_virtual_connection_all_params(self): status=201, ) + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - name = 'newVC' - type = 'vpc' - network_id = 'crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + key = hpcs_key_identity_model + name = '1000' + session = 'primary' # Invoke method - response = _service.create_gateway_virtual_connection( - gateway_id, + response = _service.create_gateway_macsec_cak( + id, + key, name, - type, - network_id=network_id, + session, headers={}, ) @@ -3301,27 +3618,27 @@ def test_create_gateway_virtual_connection_all_params(self): assert response.status_code == 201 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['name'] == 'newVC' - assert req_body['type'] == 'vpc' - assert req_body['network_id'] == 'crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb' + assert req_body['key'] == hpcs_key_identity_model + assert req_body['name'] == '1000' + assert req_body['session'] == 'primary' - def test_create_gateway_virtual_connection_all_params_with_retries(self): - # Enable retries and run test_create_gateway_virtual_connection_all_params. + def test_create_gateway_macsec_cak_all_params_with_retries(self): + # Enable retries and run test_create_gateway_macsec_cak_all_params. _service.enable_retries() - self.test_create_gateway_virtual_connection_all_params() + self.test_create_gateway_macsec_cak_all_params() - # Disable retries and run test_create_gateway_virtual_connection_all_params. + # Disable retries and run test_create_gateway_macsec_cak_all_params. _service.disable_retries() - self.test_create_gateway_virtual_connection_all_params() + self.test_create_gateway_macsec_cak_all_params() @responses.activate - def test_create_gateway_virtual_connection_value_error(self): + def test_create_gateway_macsec_cak_value_error(self): """ - test_create_gateway_virtual_connection_value_error() + test_create_gateway_macsec_cak_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks') + mock_response = '{"active_delta": {"key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "status": "active"}, "created_at": "2020-11-02T20:40:29.622Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "session": "primary", "status": "active", "updated_at": "2020-11-02T20:40:29.622Z"}' responses.add( responses.POST, url, @@ -3330,45 +3647,50 @@ def test_create_gateway_virtual_connection_value_error(self): status=201, ) + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - name = 'newVC' - type = 'vpc' - network_id = 'crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + key = hpcs_key_identity_model + name = '1000' + session = 'primary' # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, + "id": id, + "key": key, "name": name, - "type": type, + "session": session, } 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.create_gateway_virtual_connection(**req_copy) + _service.create_gateway_macsec_cak(**req_copy) - def test_create_gateway_virtual_connection_value_error_with_retries(self): - # Enable retries and run test_create_gateway_virtual_connection_value_error. + def test_create_gateway_macsec_cak_value_error_with_retries(self): + # Enable retries and run test_create_gateway_macsec_cak_value_error. _service.enable_retries() - self.test_create_gateway_virtual_connection_value_error() + self.test_create_gateway_macsec_cak_value_error() - # Disable retries and run test_create_gateway_virtual_connection_value_error. + # Disable retries and run test_create_gateway_macsec_cak_value_error. _service.disable_retries() - self.test_create_gateway_virtual_connection_value_error() + self.test_create_gateway_macsec_cak_value_error() -class TestDeleteGatewayVirtualConnection: +class TestDeleteGatewayMacsecCak: """ - Test Class for delete_gateway_virtual_connection + Test Class for delete_gateway_macsec_cak """ @responses.activate - def test_delete_gateway_virtual_connection_all_params(self): + def test_delete_gateway_macsec_cak_all_params(self): """ - delete_gateway_virtual_connection() + delete_gateway_macsec_cak() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks/ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4') responses.add( responses.DELETE, url, @@ -3376,13 +3698,13 @@ def test_delete_gateway_virtual_connection_all_params(self): ) # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + cak_id = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' # Invoke method - response = _service.delete_gateway_virtual_connection( - gateway_id, + response = _service.delete_gateway_macsec_cak( id, + cak_id, headers={}, ) @@ -3390,22 +3712,22 @@ def test_delete_gateway_virtual_connection_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 204 - def test_delete_gateway_virtual_connection_all_params_with_retries(self): - # Enable retries and run test_delete_gateway_virtual_connection_all_params. + def test_delete_gateway_macsec_cak_all_params_with_retries(self): + # Enable retries and run test_delete_gateway_macsec_cak_all_params. _service.enable_retries() - self.test_delete_gateway_virtual_connection_all_params() + self.test_delete_gateway_macsec_cak_all_params() - # Disable retries and run test_delete_gateway_virtual_connection_all_params. + # Disable retries and run test_delete_gateway_macsec_cak_all_params. _service.disable_retries() - self.test_delete_gateway_virtual_connection_all_params() + self.test_delete_gateway_macsec_cak_all_params() @responses.activate - def test_delete_gateway_virtual_connection_value_error(self): + def test_delete_gateway_macsec_cak_value_error(self): """ - test_delete_gateway_virtual_connection_value_error() + test_delete_gateway_macsec_cak_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks/ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4') responses.add( responses.DELETE, url, @@ -3413,42 +3735,42 @@ def test_delete_gateway_virtual_connection_value_error(self): ) # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + cak_id = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, "id": id, + "cak_id": cak_id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.delete_gateway_virtual_connection(**req_copy) + _service.delete_gateway_macsec_cak(**req_copy) - def test_delete_gateway_virtual_connection_value_error_with_retries(self): - # Enable retries and run test_delete_gateway_virtual_connection_value_error. + def test_delete_gateway_macsec_cak_value_error_with_retries(self): + # Enable retries and run test_delete_gateway_macsec_cak_value_error. _service.enable_retries() - self.test_delete_gateway_virtual_connection_value_error() + self.test_delete_gateway_macsec_cak_value_error() - # Disable retries and run test_delete_gateway_virtual_connection_value_error. + # Disable retries and run test_delete_gateway_macsec_cak_value_error. _service.disable_retries() - self.test_delete_gateway_virtual_connection_value_error() + self.test_delete_gateway_macsec_cak_value_error() -class TestGetGatewayVirtualConnection: +class TestGetGatewayMacsecCak: """ - Test Class for get_gateway_virtual_connection + Test Class for get_gateway_macsec_cak """ @responses.activate - def test_get_gateway_virtual_connection_all_params(self): + def test_get_gateway_macsec_cak_all_params(self): """ - get_gateway_virtual_connection() + get_gateway_macsec_cak() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks/ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4') + mock_response = '{"active_delta": {"key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "status": "active"}, "created_at": "2020-11-02T20:40:29.622Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "session": "primary", "status": "active", "updated_at": "2020-11-02T20:40:29.622Z"}' responses.add( responses.GET, url, @@ -3458,13 +3780,13 @@ def test_get_gateway_virtual_connection_all_params(self): ) # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + cak_id = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' # Invoke method - response = _service.get_gateway_virtual_connection( - gateway_id, + response = _service.get_gateway_macsec_cak( id, + cak_id, headers={}, ) @@ -3472,23 +3794,23 @@ def test_get_gateway_virtual_connection_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_gateway_virtual_connection_all_params_with_retries(self): - # Enable retries and run test_get_gateway_virtual_connection_all_params. + def test_get_gateway_macsec_cak_all_params_with_retries(self): + # Enable retries and run test_get_gateway_macsec_cak_all_params. _service.enable_retries() - self.test_get_gateway_virtual_connection_all_params() + self.test_get_gateway_macsec_cak_all_params() - # Disable retries and run test_get_gateway_virtual_connection_all_params. + # Disable retries and run test_get_gateway_macsec_cak_all_params. _service.disable_retries() - self.test_get_gateway_virtual_connection_all_params() + self.test_get_gateway_macsec_cak_all_params() @responses.activate - def test_get_gateway_virtual_connection_value_error(self): + def test_get_gateway_macsec_cak_value_error(self): """ - test_get_gateway_virtual_connection_value_error() + test_get_gateway_macsec_cak_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks/ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4') + mock_response = '{"active_delta": {"key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "status": "active"}, "created_at": "2020-11-02T20:40:29.622Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "session": "primary", "status": "active", "updated_at": "2020-11-02T20:40:29.622Z"}' responses.add( responses.GET, url, @@ -3498,42 +3820,42 @@ def test_get_gateway_virtual_connection_value_error(self): ) # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + cak_id = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, "id": id, + "cak_id": cak_id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_gateway_virtual_connection(**req_copy) + _service.get_gateway_macsec_cak(**req_copy) - def test_get_gateway_virtual_connection_value_error_with_retries(self): - # Enable retries and run test_get_gateway_virtual_connection_value_error. + def test_get_gateway_macsec_cak_value_error_with_retries(self): + # Enable retries and run test_get_gateway_macsec_cak_value_error. _service.enable_retries() - self.test_get_gateway_virtual_connection_value_error() + self.test_get_gateway_macsec_cak_value_error() - # Disable retries and run test_get_gateway_virtual_connection_value_error. + # Disable retries and run test_get_gateway_macsec_cak_value_error. _service.disable_retries() - self.test_get_gateway_virtual_connection_value_error() + self.test_get_gateway_macsec_cak_value_error() -class TestUpdateGatewayVirtualConnection: +class TestUpdateGatewayMacsecCak: """ - Test Class for update_gateway_virtual_connection + Test Class for update_gateway_macsec_cak """ @responses.activate - def test_update_gateway_virtual_connection_all_params(self): + def test_update_gateway_macsec_cak_all_params(self): """ - update_gateway_virtual_connection() + update_gateway_macsec_cak() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks/ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4') + mock_response = '{"active_delta": {"key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "status": "active"}, "created_at": "2020-11-02T20:40:29.622Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "session": "primary", "status": "active", "updated_at": "2020-11-02T20:40:29.622Z"}' responses.add( responses.PATCH, url, @@ -3542,18 +3864,25 @@ def test_update_gateway_virtual_connection_all_params(self): status=200, ) + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a dict representation of a GatewayMacsecCakPatch model + gateway_macsec_cak_patch_model = {} + gateway_macsec_cak_patch_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_patch_model['name'] = '1000' + # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - name = 'newConnectionName' - status = 'attached' + cak_id = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' + gateway_macsec_cak_patch = gateway_macsec_cak_patch_model # Invoke method - response = _service.update_gateway_virtual_connection( - gateway_id, + response = _service.update_gateway_macsec_cak( id, - name=name, - status=status, + cak_id, + gateway_macsec_cak_patch, headers={}, ) @@ -3562,26 +3891,25 @@ def test_update_gateway_virtual_connection_all_params(self): assert response.status_code == 200 # Validate body params req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) - assert req_body['name'] == 'newConnectionName' - assert req_body['status'] == 'attached' + assert req_body == gateway_macsec_cak_patch - def test_update_gateway_virtual_connection_all_params_with_retries(self): - # Enable retries and run test_update_gateway_virtual_connection_all_params. + def test_update_gateway_macsec_cak_all_params_with_retries(self): + # Enable retries and run test_update_gateway_macsec_cak_all_params. _service.enable_retries() - self.test_update_gateway_virtual_connection_all_params() + self.test_update_gateway_macsec_cak_all_params() - # Disable retries and run test_update_gateway_virtual_connection_all_params. + # Disable retries and run test_update_gateway_macsec_cak_all_params. _service.disable_retries() - self.test_update_gateway_virtual_connection_all_params() + self.test_update_gateway_macsec_cak_all_params() @responses.activate - def test_update_gateway_virtual_connection_value_error(self): + def test_update_gateway_macsec_cak_value_error(self): """ - test_update_gateway_virtual_connection_value_error() + test_update_gateway_macsec_cak_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/macsec/caks/ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4') + mock_response = '{"active_delta": {"key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "status": "active"}, "created_at": "2020-11-02T20:40:29.622Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "key": {"crn": "crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222"}, "name": "1000", "session": "primary", "status": "active", "updated_at": "2020-11-02T20:40:29.622Z"}' responses.add( responses.PATCH, url, @@ -3590,39 +3918,48 @@ def test_update_gateway_virtual_connection_value_error(self): status=200, ) + # Construct a dict representation of a HpcsKeyIdentity model + hpcs_key_identity_model = {} + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a dict representation of a GatewayMacsecCakPatch model + gateway_macsec_cak_patch_model = {} + gateway_macsec_cak_patch_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_patch_model['name'] = '1000' + # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - name = 'newConnectionName' - status = 'attached' + cak_id = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' + gateway_macsec_cak_patch = gateway_macsec_cak_patch_model # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, "id": id, + "cak_id": cak_id, + "gateway_macsec_cak_patch": gateway_macsec_cak_patch, } 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.update_gateway_virtual_connection(**req_copy) + _service.update_gateway_macsec_cak(**req_copy) - def test_update_gateway_virtual_connection_value_error_with_retries(self): - # Enable retries and run test_update_gateway_virtual_connection_value_error. + def test_update_gateway_macsec_cak_value_error_with_retries(self): + # Enable retries and run test_update_gateway_macsec_cak_value_error. _service.enable_retries() - self.test_update_gateway_virtual_connection_value_error() + self.test_update_gateway_macsec_cak_value_error() - # Disable retries and run test_update_gateway_virtual_connection_value_error. + # Disable retries and run test_update_gateway_macsec_cak_value_error. _service.disable_retries() - self.test_update_gateway_virtual_connection_value_error() + self.test_update_gateway_macsec_cak_value_error() # endregion ############################################################################## -# End of Service: VirtualConnections +# End of Service: GatewayMACsec ############################################################################## ############################################################################## -# Start of Service: OfferingInformation +# Start of Service: GatewayRouteReports ############################################################################## # region @@ -3673,19 +4010,19 @@ def test_new_instance_required_param_none(self): ) -class TestListOfferingTypeLocations: +class TestListGatewayRouteReports: """ - Test Class for list_offering_type_locations + Test Class for list_gateway_route_reports """ @responses.activate - def test_list_offering_type_locations_all_params(self): + def test_list_gateway_route_reports_all_params(self): """ - list_offering_type_locations() + list_gateway_route_reports() """ # Set up mock - url = preprocess_url('/offering_types/dedicated/locations') - mock_response = '{"locations": [{"billing_location": "us", "building_colocation_owner": "MyProvider", "display_name": "Dallas 9", "location_type": "PoP", "macsec_enabled": false, "market": "Dallas", "market_geography": "N/S America", "mzr": true, "name": "dal03", "offering_type": "dedicated", "provision_enabled": true, "vpc_region": "us-south"}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports') + mock_response = '{"route_reports": [{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}]}' responses.add( responses.GET, url, @@ -3695,11 +4032,11 @@ def test_list_offering_type_locations_all_params(self): ) # Set up parameter values - offering_type = 'dedicated' + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Invoke method - response = _service.list_offering_type_locations( - offering_type, + response = _service.list_gateway_route_reports( + gateway_id, headers={}, ) @@ -3707,23 +4044,23 @@ def test_list_offering_type_locations_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_offering_type_locations_all_params_with_retries(self): - # Enable retries and run test_list_offering_type_locations_all_params. + def test_list_gateway_route_reports_all_params_with_retries(self): + # Enable retries and run test_list_gateway_route_reports_all_params. _service.enable_retries() - self.test_list_offering_type_locations_all_params() + self.test_list_gateway_route_reports_all_params() - # Disable retries and run test_list_offering_type_locations_all_params. + # Disable retries and run test_list_gateway_route_reports_all_params. _service.disable_retries() - self.test_list_offering_type_locations_all_params() + self.test_list_gateway_route_reports_all_params() @responses.activate - def test_list_offering_type_locations_value_error(self): + def test_list_gateway_route_reports_value_error(self): """ - test_list_offering_type_locations_value_error() + test_list_gateway_route_reports_value_error() """ # Set up mock - url = preprocess_url('/offering_types/dedicated/locations') - mock_response = '{"locations": [{"billing_location": "us", "building_colocation_owner": "MyProvider", "display_name": "Dallas 9", "location_type": "PoP", "macsec_enabled": false, "market": "Dallas", "market_geography": "N/S America", "mzr": true, "name": "dal03", "offering_type": "dedicated", "provision_enabled": true, "vpc_region": "us-south"}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports') + mock_response = '{"route_reports": [{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}]}' responses.add( responses.GET, url, @@ -3733,125 +4070,200 @@ def test_list_offering_type_locations_value_error(self): ) # Set up parameter values - offering_type = 'dedicated' + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Pass in all but one required param and check for a ValueError req_param_dict = { - "offering_type": offering_type, + "gateway_id": gateway_id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_offering_type_locations(**req_copy) + _service.list_gateway_route_reports(**req_copy) - def test_list_offering_type_locations_value_error_with_retries(self): - # Enable retries and run test_list_offering_type_locations_value_error. + def test_list_gateway_route_reports_value_error_with_retries(self): + # Enable retries and run test_list_gateway_route_reports_value_error. _service.enable_retries() - self.test_list_offering_type_locations_value_error() + self.test_list_gateway_route_reports_value_error() - # Disable retries and run test_list_offering_type_locations_value_error. + # Disable retries and run test_list_gateway_route_reports_value_error. _service.disable_retries() - self.test_list_offering_type_locations_value_error() + self.test_list_gateway_route_reports_value_error() -class TestListOfferingTypeLocationCrossConnectRouters: +class TestCreateGatewayRouteReport: """ - Test Class for list_offering_type_location_cross_connect_routers + Test Class for create_gateway_route_report """ @responses.activate - def test_list_offering_type_location_cross_connect_routers_all_params(self): + def test_create_gateway_route_report_all_params(self): """ - list_offering_type_location_cross_connect_routers() + create_gateway_route_report() """ # Set up mock - url = preprocess_url('/offering_types/dedicated/locations/testString/cross_connect_routers') - mock_response = '{"cross_connect_routers": [{"capabilities": ["capabilities"], "router_name": "xcr01.dal03", "total_connections": 1}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports') + mock_response = '{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' responses.add( - responses.GET, + responses.POST, url, body=mock_response, content_type='application/json', - status=200, + status=202, ) # Set up parameter values - offering_type = 'dedicated' - location_name = 'testString' + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Invoke method - response = _service.list_offering_type_location_cross_connect_routers( - offering_type, - location_name, + response = _service.create_gateway_route_report( + gateway_id, headers={}, ) # Check for correct operation assert len(responses.calls) == 1 - assert response.status_code == 200 + assert response.status_code == 202 - def test_list_offering_type_location_cross_connect_routers_all_params_with_retries(self): - # Enable retries and run test_list_offering_type_location_cross_connect_routers_all_params. + def test_create_gateway_route_report_all_params_with_retries(self): + # Enable retries and run test_create_gateway_route_report_all_params. _service.enable_retries() - self.test_list_offering_type_location_cross_connect_routers_all_params() + self.test_create_gateway_route_report_all_params() - # Disable retries and run test_list_offering_type_location_cross_connect_routers_all_params. + # Disable retries and run test_create_gateway_route_report_all_params. _service.disable_retries() - self.test_list_offering_type_location_cross_connect_routers_all_params() + self.test_create_gateway_route_report_all_params() @responses.activate - def test_list_offering_type_location_cross_connect_routers_value_error(self): + def test_create_gateway_route_report_value_error(self): """ - test_list_offering_type_location_cross_connect_routers_value_error() + test_create_gateway_route_report_value_error() """ # Set up mock - url = preprocess_url('/offering_types/dedicated/locations/testString/cross_connect_routers') - mock_response = '{"cross_connect_routers": [{"capabilities": ["capabilities"], "router_name": "xcr01.dal03", "total_connections": 1}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports') + mock_response = '{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' responses.add( - responses.GET, + responses.POST, url, body=mock_response, content_type='application/json', - status=200, + status=202, ) # Set up parameter values - offering_type = 'dedicated' - location_name = 'testString' + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Pass in all but one required param and check for a ValueError req_param_dict = { - "offering_type": offering_type, - "location_name": location_name, + "gateway_id": gateway_id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_offering_type_location_cross_connect_routers(**req_copy) + _service.create_gateway_route_report(**req_copy) - def test_list_offering_type_location_cross_connect_routers_value_error_with_retries(self): - # Enable retries and run test_list_offering_type_location_cross_connect_routers_value_error. + def test_create_gateway_route_report_value_error_with_retries(self): + # Enable retries and run test_create_gateway_route_report_value_error. _service.enable_retries() - self.test_list_offering_type_location_cross_connect_routers_value_error() + self.test_create_gateway_route_report_value_error() - # Disable retries and run test_list_offering_type_location_cross_connect_routers_value_error. + # Disable retries and run test_create_gateway_route_report_value_error. _service.disable_retries() - self.test_list_offering_type_location_cross_connect_routers_value_error() + self.test_create_gateway_route_report_value_error() -class TestListOfferingTypeSpeeds: +class TestDeleteGatewayRouteReport: """ - Test Class for list_offering_type_speeds + Test Class for delete_gateway_route_report """ @responses.activate - def test_list_offering_type_speeds_all_params(self): + def test_delete_gateway_route_report_all_params(self): """ - list_offering_type_speeds() + delete_gateway_route_report() """ # Set up mock - url = preprocess_url('/offering_types/dedicated/speeds') - mock_response = '{"speeds": [{"capabilities": ["capabilities"], "link_speed": 2000, "macsec_enabled": false}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Invoke method + response = _service.delete_gateway_route_report( + gateway_id, + id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_gateway_route_report_all_params_with_retries(self): + # Enable retries and run test_delete_gateway_route_report_all_params. + _service.enable_retries() + self.test_delete_gateway_route_report_all_params() + + # Disable retries and run test_delete_gateway_route_report_all_params. + _service.disable_retries() + self.test_delete_gateway_route_report_all_params() + + @responses.activate + def test_delete_gateway_route_report_value_error(self): + """ + test_delete_gateway_route_report_value_error() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_gateway_route_report(**req_copy) + + def test_delete_gateway_route_report_value_error_with_retries(self): + # Enable retries and run test_delete_gateway_route_report_value_error. + _service.enable_retries() + self.test_delete_gateway_route_report_value_error() + + # Disable retries and run test_delete_gateway_route_report_value_error. + _service.disable_retries() + self.test_delete_gateway_route_report_value_error() + + +class TestGetGatewayRouteReport: + """ + Test Class for get_gateway_route_report + """ + + @responses.activate + def test_get_gateway_route_report_all_params(self): + """ + get_gateway_route_report() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + mock_response = '{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' responses.add( responses.GET, url, @@ -3861,11 +4273,13 @@ def test_list_offering_type_speeds_all_params(self): ) # Set up parameter values - offering_type = 'dedicated' + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Invoke method - response = _service.list_offering_type_speeds( - offering_type, + response = _service.get_gateway_route_report( + gateway_id, + id, headers={}, ) @@ -3873,23 +4287,23 @@ def test_list_offering_type_speeds_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_offering_type_speeds_all_params_with_retries(self): - # Enable retries and run test_list_offering_type_speeds_all_params. + def test_get_gateway_route_report_all_params_with_retries(self): + # Enable retries and run test_get_gateway_route_report_all_params. _service.enable_retries() - self.test_list_offering_type_speeds_all_params() + self.test_get_gateway_route_report_all_params() - # Disable retries and run test_list_offering_type_speeds_all_params. + # Disable retries and run test_get_gateway_route_report_all_params. _service.disable_retries() - self.test_list_offering_type_speeds_all_params() + self.test_get_gateway_route_report_all_params() @responses.activate - def test_list_offering_type_speeds_value_error(self): + def test_get_gateway_route_report_value_error(self): """ - test_list_offering_type_speeds_value_error() + test_get_gateway_route_report_value_error() """ # Set up mock - url = preprocess_url('/offering_types/dedicated/speeds') - mock_response = '{"speeds": [{"capabilities": ["capabilities"], "link_speed": 2000, "macsec_enabled": false}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/route_reports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + mock_response = '{"advertised_routes": [{"as_path": "64999 64999 64998 I", "prefix": "172.17.0.0/16"}], "created_at": "2019-01-01T12:00:00.000Z", "gateway_routes": [{"prefix": "172.17.0.0/16"}], "id": "1a15dcab-7e26-45e1-b7c5-bc690eaa9724", "on_prem_routes": [{"as_path": "64999 64999 64998 I", "next_hop": "172.17.0.0", "prefix": "172.17.0.0/16"}], "overlapping_routes": [{"routes": [{"prefix": "172.17.0.0/16", "type": "virtual_connection", "virtual_connection_id": "d2d985d8-1d8e-4e8b-96cd-cee2290ecaff"}]}], "status": "complete", "updated_at": "2019-01-01T12:00:00.000Z", "virtual_connection_routes": [{"routes": [{"active": true, "local_preference": "200", "prefix": "172.17.0.0/16"}], "virtual_connection_id": "3c265a62-91da-4261-a950-950b6af0eb58", "virtual_connection_name": "vpc1", "virtual_connection_type": "vpc"}]}' responses.add( responses.GET, url, @@ -3899,34 +4313,36 @@ def test_list_offering_type_speeds_value_error(self): ) # Set up parameter values - offering_type = 'dedicated' + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Pass in all but one required param and check for a ValueError req_param_dict = { - "offering_type": offering_type, + "gateway_id": gateway_id, + "id": id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_offering_type_speeds(**req_copy) + _service.get_gateway_route_report(**req_copy) - def test_list_offering_type_speeds_value_error_with_retries(self): - # Enable retries and run test_list_offering_type_speeds_value_error. + def test_get_gateway_route_report_value_error_with_retries(self): + # Enable retries and run test_get_gateway_route_report_value_error. _service.enable_retries() - self.test_list_offering_type_speeds_value_error() + self.test_get_gateway_route_report_value_error() - # Disable retries and run test_list_offering_type_speeds_value_error. + # Disable retries and run test_get_gateway_route_report_value_error. _service.disable_retries() - self.test_list_offering_type_speeds_value_error() + self.test_get_gateway_route_report_value_error() # endregion ############################################################################## -# End of Service: OfferingInformation +# End of Service: GatewayRouteReports ############################################################################## ############################################################################## -# Start of Service: Ports +# Start of Service: VirtualConnections ############################################################################## # region @@ -3977,19 +4393,19 @@ def test_new_instance_required_param_none(self): ) -class TestListPorts: +class TestListGatewayVirtualConnections: """ - Test Class for list_ports + Test Class for list_gateway_virtual_connections """ @responses.activate - def test_list_ports_all_params(self): + def test_list_gateway_virtual_connections_all_params(self): """ - list_ports() + list_gateway_virtual_connections() """ # Set up mock - url = preprocess_url('/ports') - mock_response = '{"first": {"href": "https://directlink.cloud.ibm.com/v1/ports?limit=100"}, "limit": 100, "next": {"href": "https://directlink.cloud.ibm.com/v1/ports?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=100", "start": "9d5a91a3e2cbd233b5a5b33436855ed1"}, "total_count": 132, "ports": [{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections') + mock_response = '{"virtual_connections": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}]}' responses.add( responses.GET, url, @@ -3999,45 +4415,35 @@ def test_list_ports_all_params(self): ) # Set up parameter values - start = 'testString' - limit = 50 - location_name = 'testString' + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Invoke method - response = _service.list_ports( - start=start, - limit=limit, - location_name=location_name, + response = _service.list_gateway_virtual_connections( + gateway_id, headers={}, ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - # Validate query params - query_string = responses.calls[0].request.url.split('?', 1)[1] - query_string = urllib.parse.unquote_plus(query_string) - assert 'start={}'.format(start) in query_string - assert 'limit={}'.format(limit) in query_string - assert 'location_name={}'.format(location_name) in query_string - def test_list_ports_all_params_with_retries(self): - # Enable retries and run test_list_ports_all_params. + def test_list_gateway_virtual_connections_all_params_with_retries(self): + # Enable retries and run test_list_gateway_virtual_connections_all_params. _service.enable_retries() - self.test_list_ports_all_params() + self.test_list_gateway_virtual_connections_all_params() - # Disable retries and run test_list_ports_all_params. + # Disable retries and run test_list_gateway_virtual_connections_all_params. _service.disable_retries() - self.test_list_ports_all_params() + self.test_list_gateway_virtual_connections_all_params() @responses.activate - def test_list_ports_required_params(self): + def test_list_gateway_virtual_connections_value_error(self): """ - test_list_ports_required_params() + test_list_gateway_virtual_connections_value_error() """ # Set up mock - url = preprocess_url('/ports') - mock_response = '{"first": {"href": "https://directlink.cloud.ibm.com/v1/ports?limit=100"}, "limit": 100, "next": {"href": "https://directlink.cloud.ibm.com/v1/ports?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=100", "start": "9d5a91a3e2cbd233b5a5b33436855ed1"}, "total_count": 132, "ports": [{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}]}' + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections') + mock_response = '{"virtual_connections": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}]}' responses.add( responses.GET, url, @@ -4046,30 +4452,499 @@ def test_list_ports_required_params(self): status=200, ) + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_gateway_virtual_connections(**req_copy) + + def test_list_gateway_virtual_connections_value_error_with_retries(self): + # Enable retries and run test_list_gateway_virtual_connections_value_error. + _service.enable_retries() + self.test_list_gateway_virtual_connections_value_error() + + # Disable retries and run test_list_gateway_virtual_connections_value_error. + _service.disable_retries() + self.test_list_gateway_virtual_connections_value_error() + + +class TestCreateGatewayVirtualConnection: + """ + Test Class for create_gateway_virtual_connection + """ + + @responses.activate + def test_create_gateway_virtual_connection_all_params(self): + """ + create_gateway_virtual_connection() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + name = 'newVC' + type = 'vpc' + network_id = 'crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb' + # Invoke method - response = _service.list_ports() + response = _service.create_gateway_virtual_connection( + gateway_id, + name, + type, + network_id=network_id, + 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['name'] == 'newVC' + assert req_body['type'] == 'vpc' + assert req_body['network_id'] == 'crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb' + + def test_create_gateway_virtual_connection_all_params_with_retries(self): + # Enable retries and run test_create_gateway_virtual_connection_all_params. + _service.enable_retries() + self.test_create_gateway_virtual_connection_all_params() + + # Disable retries and run test_create_gateway_virtual_connection_all_params. + _service.disable_retries() + self.test_create_gateway_virtual_connection_all_params() + + @responses.activate + def test_create_gateway_virtual_connection_value_error(self): + """ + test_create_gateway_virtual_connection_value_error() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + name = 'newVC' + type = 'vpc' + network_id = 'crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + "name": name, + "type": type, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_gateway_virtual_connection(**req_copy) + + def test_create_gateway_virtual_connection_value_error_with_retries(self): + # Enable retries and run test_create_gateway_virtual_connection_value_error. + _service.enable_retries() + self.test_create_gateway_virtual_connection_value_error() + + # Disable retries and run test_create_gateway_virtual_connection_value_error. + _service.disable_retries() + self.test_create_gateway_virtual_connection_value_error() + + +class TestDeleteGatewayVirtualConnection: + """ + Test Class for delete_gateway_virtual_connection + """ + + @responses.activate + def test_delete_gateway_virtual_connection_all_params(self): + """ + delete_gateway_virtual_connection() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Invoke method + response = _service.delete_gateway_virtual_connection( + gateway_id, + id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_gateway_virtual_connection_all_params_with_retries(self): + # Enable retries and run test_delete_gateway_virtual_connection_all_params. + _service.enable_retries() + self.test_delete_gateway_virtual_connection_all_params() + + # Disable retries and run test_delete_gateway_virtual_connection_all_params. + _service.disable_retries() + self.test_delete_gateway_virtual_connection_all_params() + + @responses.activate + def test_delete_gateway_virtual_connection_value_error(self): + """ + test_delete_gateway_virtual_connection_value_error() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_gateway_virtual_connection(**req_copy) + + def test_delete_gateway_virtual_connection_value_error_with_retries(self): + # Enable retries and run test_delete_gateway_virtual_connection_value_error. + _service.enable_retries() + self.test_delete_gateway_virtual_connection_value_error() + + # Disable retries and run test_delete_gateway_virtual_connection_value_error. + _service.disable_retries() + self.test_delete_gateway_virtual_connection_value_error() + + +class TestGetGatewayVirtualConnection: + """ + Test Class for get_gateway_virtual_connection + """ + + @responses.activate + def test_get_gateway_virtual_connection_all_params(self): + """ + get_gateway_virtual_connection() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Invoke method + response = _service.get_gateway_virtual_connection( + gateway_id, + id, + headers={}, + ) # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_ports_required_params_with_retries(self): - # Enable retries and run test_list_ports_required_params. + def test_get_gateway_virtual_connection_all_params_with_retries(self): + # Enable retries and run test_get_gateway_virtual_connection_all_params. + _service.enable_retries() + self.test_get_gateway_virtual_connection_all_params() + + # Disable retries and run test_get_gateway_virtual_connection_all_params. + _service.disable_retries() + self.test_get_gateway_virtual_connection_all_params() + + @responses.activate + def test_get_gateway_virtual_connection_value_error(self): + """ + test_get_gateway_virtual_connection_value_error() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + "id": id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_gateway_virtual_connection(**req_copy) + + def test_get_gateway_virtual_connection_value_error_with_retries(self): + # Enable retries and run test_get_gateway_virtual_connection_value_error. + _service.enable_retries() + self.test_get_gateway_virtual_connection_value_error() + + # Disable retries and run test_get_gateway_virtual_connection_value_error. + _service.disable_retries() + self.test_get_gateway_virtual_connection_value_error() + + +class TestUpdateGatewayVirtualConnection: + """ + Test Class for update_gateway_virtual_connection + """ + + @responses.activate + def test_update_gateway_virtual_connection_all_params(self): + """ + update_gateway_virtual_connection() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a GatewayVirtualConnectionPatchTemplate model + gateway_virtual_connection_patch_template_model = {} + gateway_virtual_connection_patch_template_model['name'] = 'newConnectionName' + gateway_virtual_connection_patch_template_model['status'] = 'attached' + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + gateway_virtual_connection_patch_template = gateway_virtual_connection_patch_template_model + + # Invoke method + response = _service.update_gateway_virtual_connection( + gateway_id, + id, + gateway_virtual_connection_patch_template, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body == gateway_virtual_connection_patch_template + + def test_update_gateway_virtual_connection_all_params_with_retries(self): + # Enable retries and run test_update_gateway_virtual_connection_all_params. + _service.enable_retries() + self.test_update_gateway_virtual_connection_all_params() + + # Disable retries and run test_update_gateway_virtual_connection_all_params. + _service.disable_retries() + self.test_update_gateway_virtual_connection_all_params() + + @responses.activate + def test_update_gateway_virtual_connection_value_error(self): + """ + test_update_gateway_virtual_connection_value_error() + """ + # Set up mock + url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/virtual_connections/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + mock_response = '{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "name": "newVC", "network_account": "00aa14a2e0fb102c8995ebefff865555", "network_id": "crn:v1:bluemix:public:is:us-east:a/28e4d90ac7504be69447111122223333::vpc:aaa81ac8-5e96-42a0-a4b7-6c2e2d1bbbbb", "status": "attached", "type": "vpc"}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a GatewayVirtualConnectionPatchTemplate model + gateway_virtual_connection_patch_template_model = {} + gateway_virtual_connection_patch_template_model['name'] = 'newConnectionName' + gateway_virtual_connection_patch_template_model['status'] = 'attached' + + # Set up parameter values + gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + gateway_virtual_connection_patch_template = gateway_virtual_connection_patch_template_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "gateway_id": gateway_id, + "id": id, + "gateway_virtual_connection_patch_template": gateway_virtual_connection_patch_template, + } + 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.update_gateway_virtual_connection(**req_copy) + + def test_update_gateway_virtual_connection_value_error_with_retries(self): + # Enable retries and run test_update_gateway_virtual_connection_value_error. + _service.enable_retries() + self.test_update_gateway_virtual_connection_value_error() + + # Disable retries and run test_update_gateway_virtual_connection_value_error. + _service.disable_retries() + self.test_update_gateway_virtual_connection_value_error() + + +# endregion +############################################################################## +# End of Service: VirtualConnections +############################################################################## + +############################################################################## +# Start of Service: OfferingInformation +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = DirectLinkV1.new_instance( + version=version, + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, DirectLinkV1) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = DirectLinkV1.new_instance( + version=version, + service_name='TEST_SERVICE_NOT_FOUND', + ) + + def test_new_instance_without_required_params(self): + """ + new_instance_without_required_params() + """ + with pytest.raises(TypeError, match='new_instance\\(\\) missing \\d required positional arguments?: \'.*\''): + service = DirectLinkV1.new_instance() + + def test_new_instance_required_param_none(self): + """ + new_instance_required_param_none() + """ + with pytest.raises(ValueError, match='version must be provided'): + service = DirectLinkV1.new_instance( + version=None, + ) + + +class TestListOfferingTypeLocations: + """ + Test Class for list_offering_type_locations + """ + + @responses.activate + def test_list_offering_type_locations_all_params(self): + """ + list_offering_type_locations() + """ + # Set up mock + url = preprocess_url('/offering_types/dedicated/locations') + mock_response = '{"locations": [{"billing_location": "us", "building_colocation_owner": "MyProvider", "display_name": "Dallas 9", "location_type": "PoP", "macsec_enabled": false, "market": "Dallas", "market_geography": "N/S America", "mzr": true, "name": "dal03", "offering_type": "dedicated", "provision_enabled": true, "vpc_region": "us-south"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + offering_type = 'dedicated' + + # Invoke method + response = _service.list_offering_type_locations( + offering_type, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_offering_type_locations_all_params_with_retries(self): + # Enable retries and run test_list_offering_type_locations_all_params. _service.enable_retries() - self.test_list_ports_required_params() + self.test_list_offering_type_locations_all_params() - # Disable retries and run test_list_ports_required_params. + # Disable retries and run test_list_offering_type_locations_all_params. _service.disable_retries() - self.test_list_ports_required_params() + self.test_list_offering_type_locations_all_params() @responses.activate - def test_list_ports_value_error(self): + def test_list_offering_type_locations_value_error(self): """ - test_list_ports_value_error() + test_list_offering_type_locations_value_error() """ # Set up mock - url = preprocess_url('/ports') - mock_response = '{"first": {"href": "https://directlink.cloud.ibm.com/v1/ports?limit=100"}, "limit": 100, "next": {"href": "https://directlink.cloud.ibm.com/v1/ports?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=100", "start": "9d5a91a3e2cbd233b5a5b33436855ed1"}, "total_count": 132, "ports": [{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}]}' + url = preprocess_url('/offering_types/dedicated/locations') + mock_response = '{"locations": [{"billing_location": "us", "building_colocation_owner": "MyProvider", "display_name": "Dallas 9", "location_type": "PoP", "macsec_enabled": false, "market": "Dallas", "market_geography": "N/S America", "mzr": true, "name": "dal03", "offering_type": "dedicated", "provision_enabled": true, "vpc_region": "us-south"}]}' responses.add( responses.GET, url, @@ -4078,108 +4953,126 @@ def test_list_ports_value_error(self): status=200, ) + # Set up parameter values + offering_type = 'dedicated' + # Pass in all but one required param and check for a ValueError req_param_dict = { + "offering_type": offering_type, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_ports(**req_copy) + _service.list_offering_type_locations(**req_copy) - def test_list_ports_value_error_with_retries(self): - # Enable retries and run test_list_ports_value_error. + def test_list_offering_type_locations_value_error_with_retries(self): + # Enable retries and run test_list_offering_type_locations_value_error. _service.enable_retries() - self.test_list_ports_value_error() + self.test_list_offering_type_locations_value_error() - # Disable retries and run test_list_ports_value_error. + # Disable retries and run test_list_offering_type_locations_value_error. _service.disable_retries() - self.test_list_ports_value_error() + self.test_list_offering_type_locations_value_error() + + +class TestListOfferingTypeLocationCrossConnectRouters: + """ + Test Class for list_offering_type_location_cross_connect_routers + """ @responses.activate - def test_list_ports_with_pager_get_next(self): + def test_list_offering_type_location_cross_connect_routers_all_params(self): """ - test_list_ports_with_pager_get_next() + list_offering_type_location_cross_connect_routers() """ - # Set up a two-page mock response - url = preprocess_url('/ports') - mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"ports":[{"direct_link_count":1,"id":"01122b9b-820f-4c44-8a31-77f1f0806765","label":"XCR-FRK-CS-SEC-01","location_display_name":"Dallas 03","location_name":"dal03","provider_name":"provider_1","supported_link_speeds":[21]}]}' - mock_response2 = '{"total_count":2,"limit":1,"ports":[{"direct_link_count":1,"id":"01122b9b-820f-4c44-8a31-77f1f0806765","label":"XCR-FRK-CS-SEC-01","location_display_name":"Dallas 03","location_name":"dal03","provider_name":"provider_1","supported_link_speeds":[21]}]}' - responses.add( - responses.GET, - url, - body=mock_response1, - content_type='application/json', - status=200, - ) + # Set up mock + url = preprocess_url('/offering_types/dedicated/locations/testString/cross_connect_routers') + mock_response = '{"cross_connect_routers": [{"capabilities": ["capabilities"], "router_name": "xcr01.dal03", "total_connections": 1}]}' responses.add( responses.GET, url, - body=mock_response2, + body=mock_response, content_type='application/json', status=200, ) - # Exercise the pager class for this operation - all_results = [] - pager = PortsPager( - client=_service, - limit=10, - location_name='testString', + # Set up parameter values + offering_type = 'dedicated' + location_name = 'testString' + + # Invoke method + response = _service.list_offering_type_location_cross_connect_routers( + offering_type, + location_name, + headers={}, ) - while pager.has_next(): - next_page = pager.get_next() - assert next_page is not None - all_results.extend(next_page) - assert len(all_results) == 2 + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_offering_type_location_cross_connect_routers_all_params_with_retries(self): + # Enable retries and run test_list_offering_type_location_cross_connect_routers_all_params. + _service.enable_retries() + self.test_list_offering_type_location_cross_connect_routers_all_params() + + # Disable retries and run test_list_offering_type_location_cross_connect_routers_all_params. + _service.disable_retries() + self.test_list_offering_type_location_cross_connect_routers_all_params() @responses.activate - def test_list_ports_with_pager_get_all(self): + def test_list_offering_type_location_cross_connect_routers_value_error(self): """ - test_list_ports_with_pager_get_all() + test_list_offering_type_location_cross_connect_routers_value_error() """ - # Set up a two-page mock response - url = preprocess_url('/ports') - mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"ports":[{"direct_link_count":1,"id":"01122b9b-820f-4c44-8a31-77f1f0806765","label":"XCR-FRK-CS-SEC-01","location_display_name":"Dallas 03","location_name":"dal03","provider_name":"provider_1","supported_link_speeds":[21]}]}' - mock_response2 = '{"total_count":2,"limit":1,"ports":[{"direct_link_count":1,"id":"01122b9b-820f-4c44-8a31-77f1f0806765","label":"XCR-FRK-CS-SEC-01","location_display_name":"Dallas 03","location_name":"dal03","provider_name":"provider_1","supported_link_speeds":[21]}]}' - responses.add( - responses.GET, - url, - body=mock_response1, - content_type='application/json', - status=200, - ) + # Set up mock + url = preprocess_url('/offering_types/dedicated/locations/testString/cross_connect_routers') + mock_response = '{"cross_connect_routers": [{"capabilities": ["capabilities"], "router_name": "xcr01.dal03", "total_connections": 1}]}' responses.add( responses.GET, url, - body=mock_response2, + body=mock_response, content_type='application/json', status=200, ) - # Exercise the pager class for this operation - pager = PortsPager( - client=_service, - limit=10, - location_name='testString', - ) - all_results = pager.get_all() - assert all_results is not None - assert len(all_results) == 2 + # Set up parameter values + offering_type = 'dedicated' + location_name = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "offering_type": offering_type, + "location_name": location_name, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_offering_type_location_cross_connect_routers(**req_copy) + + def test_list_offering_type_location_cross_connect_routers_value_error_with_retries(self): + # Enable retries and run test_list_offering_type_location_cross_connect_routers_value_error. + _service.enable_retries() + self.test_list_offering_type_location_cross_connect_routers_value_error() + + # Disable retries and run test_list_offering_type_location_cross_connect_routers_value_error. + _service.disable_retries() + self.test_list_offering_type_location_cross_connect_routers_value_error() -class TestGetPort: +class TestListOfferingTypeSpeeds: """ - Test Class for get_port + Test Class for list_offering_type_speeds """ @responses.activate - def test_get_port_all_params(self): + def test_list_offering_type_speeds_all_params(self): """ - get_port() + list_offering_type_speeds() """ # Set up mock - url = preprocess_url('/ports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}' + url = preprocess_url('/offering_types/dedicated/speeds') + mock_response = '{"speeds": [{"capabilities": ["capabilities"], "link_speed": 2000, "macsec_enabled": false}]}' responses.add( responses.GET, url, @@ -4189,11 +5082,11 @@ def test_get_port_all_params(self): ) # Set up parameter values - id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + offering_type = 'dedicated' # Invoke method - response = _service.get_port( - id, + response = _service.list_offering_type_speeds( + offering_type, headers={}, ) @@ -4201,23 +5094,23 @@ def test_get_port_all_params(self): assert len(responses.calls) == 1 assert response.status_code == 200 - def test_get_port_all_params_with_retries(self): - # Enable retries and run test_get_port_all_params. + def test_list_offering_type_speeds_all_params_with_retries(self): + # Enable retries and run test_list_offering_type_speeds_all_params. _service.enable_retries() - self.test_get_port_all_params() + self.test_list_offering_type_speeds_all_params() - # Disable retries and run test_get_port_all_params. + # Disable retries and run test_list_offering_type_speeds_all_params. _service.disable_retries() - self.test_get_port_all_params() + self.test_list_offering_type_speeds_all_params() @responses.activate - def test_get_port_value_error(self): + def test_list_offering_type_speeds_value_error(self): """ - test_get_port_value_error() + test_list_offering_type_speeds_value_error() """ # Set up mock - url = preprocess_url('/ports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') - mock_response = '{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}' + url = preprocess_url('/offering_types/dedicated/speeds') + mock_response = '{"speeds": [{"capabilities": ["capabilities"], "link_speed": 2000, "macsec_enabled": false}]}' responses.add( responses.GET, url, @@ -4227,34 +5120,34 @@ def test_get_port_value_error(self): ) # Set up parameter values - id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' + offering_type = 'dedicated' # Pass in all but one required param and check for a ValueError req_param_dict = { - "id": id, + "offering_type": offering_type, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.get_port(**req_copy) + _service.list_offering_type_speeds(**req_copy) - def test_get_port_value_error_with_retries(self): - # Enable retries and run test_get_port_value_error. + def test_list_offering_type_speeds_value_error_with_retries(self): + # Enable retries and run test_list_offering_type_speeds_value_error. _service.enable_retries() - self.test_get_port_value_error() + self.test_list_offering_type_speeds_value_error() - # Disable retries and run test_get_port_value_error. + # Disable retries and run test_list_offering_type_speeds_value_error. _service.disable_retries() - self.test_get_port_value_error() + self.test_list_offering_type_speeds_value_error() # endregion ############################################################################## -# End of Service: Ports +# End of Service: OfferingInformation ############################################################################## ############################################################################## -# Start of Service: GatewayASPrepends +# Start of Service: Ports ############################################################################## # region @@ -4305,19 +5198,67 @@ def test_new_instance_required_param_none(self): ) -class TestListGatewayAsPrepends: +class TestListPorts: """ - Test Class for list_gateway_as_prepends + Test Class for list_ports """ @responses.activate - def test_list_gateway_as_prepends_all_params(self): + def test_list_ports_all_params(self): """ - list_gateway_as_prepends() + list_ports() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/as_prepends') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}]}' + url = preprocess_url('/ports') + mock_response = '{"first": {"href": "https://directlink.cloud.ibm.com/v1/ports?limit=100"}, "limit": 100, "next": {"href": "https://directlink.cloud.ibm.com/v1/ports?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=100", "start": "9d5a91a3e2cbd233b5a5b33436855ed1"}, "total_count": 132, "ports": [{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + start = 'testString' + limit = 50 + location_name = 'testString' + + # Invoke method + response = _service.list_ports( + start=start, + limit=limit, + location_name=location_name, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'location_name={}'.format(location_name) in query_string + + def test_list_ports_all_params_with_retries(self): + # Enable retries and run test_list_ports_all_params. + _service.enable_retries() + self.test_list_ports_all_params() + + # Disable retries and run test_list_ports_all_params. + _service.disable_retries() + self.test_list_ports_all_params() + + @responses.activate + def test_list_ports_required_params(self): + """ + test_list_ports_required_params() + """ + # Set up mock + url = preprocess_url('/ports') + mock_response = '{"first": {"href": "https://directlink.cloud.ibm.com/v1/ports?limit=100"}, "limit": 100, "next": {"href": "https://directlink.cloud.ibm.com/v1/ports?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=100", "start": "9d5a91a3e2cbd233b5a5b33436855ed1"}, "total_count": 132, "ports": [{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}]}' responses.add( responses.GET, url, @@ -4326,36 +5267,30 @@ def test_list_gateway_as_prepends_all_params(self): status=200, ) - # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - # Invoke method - response = _service.list_gateway_as_prepends( - gateway_id, - headers={}, - ) + response = _service.list_ports() # Check for correct operation assert len(responses.calls) == 1 assert response.status_code == 200 - def test_list_gateway_as_prepends_all_params_with_retries(self): - # Enable retries and run test_list_gateway_as_prepends_all_params. + def test_list_ports_required_params_with_retries(self): + # Enable retries and run test_list_ports_required_params. _service.enable_retries() - self.test_list_gateway_as_prepends_all_params() + self.test_list_ports_required_params() - # Disable retries and run test_list_gateway_as_prepends_all_params. + # Disable retries and run test_list_ports_required_params. _service.disable_retries() - self.test_list_gateway_as_prepends_all_params() + self.test_list_ports_required_params() @responses.activate - def test_list_gateway_as_prepends_value_error(self): + def test_list_ports_value_error(self): """ - test_list_gateway_as_prepends_value_error() + test_list_ports_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/as_prepends') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}]}' + url = preprocess_url('/ports') + mock_response = '{"first": {"href": "https://directlink.cloud.ibm.com/v1/ports?limit=100"}, "limit": 100, "next": {"href": "https://directlink.cloud.ibm.com/v1/ports?start=9d5a91a3e2cbd233b5a5b33436855ed1&limit=100", "start": "9d5a91a3e2cbd233b5a5b33436855ed1"}, "total_count": 132, "ports": [{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}]}' responses.add( responses.GET, url, @@ -4364,134 +5299,179 @@ def test_list_gateway_as_prepends_value_error(self): status=200, ) - # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.list_gateway_as_prepends(**req_copy) + _service.list_ports(**req_copy) - def test_list_gateway_as_prepends_value_error_with_retries(self): - # Enable retries and run test_list_gateway_as_prepends_value_error. + def test_list_ports_value_error_with_retries(self): + # Enable retries and run test_list_ports_value_error. _service.enable_retries() - self.test_list_gateway_as_prepends_value_error() + self.test_list_ports_value_error() - # Disable retries and run test_list_gateway_as_prepends_value_error. + # Disable retries and run test_list_ports_value_error. _service.disable_retries() - self.test_list_gateway_as_prepends_value_error() + self.test_list_ports_value_error() + + @responses.activate + def test_list_ports_with_pager_get_next(self): + """ + test_list_ports_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/ports') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"ports":[{"direct_link_count":1,"id":"01122b9b-820f-4c44-8a31-77f1f0806765","label":"XCR-FRK-CS-SEC-01","location_display_name":"Dallas 03","location_name":"dal03","provider_name":"provider_1","supported_link_speeds":[21]}]}' + mock_response2 = '{"total_count":2,"limit":1,"ports":[{"direct_link_count":1,"id":"01122b9b-820f-4c44-8a31-77f1f0806765","label":"XCR-FRK-CS-SEC-01","location_display_name":"Dallas 03","location_name":"dal03","provider_name":"provider_1","supported_link_speeds":[21]}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + # Exercise the pager class for this operation + all_results = [] + pager = PortsPager( + client=_service, + limit=10, + location_name='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 -class TestReplaceGatewayAsPrepends: + @responses.activate + def test_list_ports_with_pager_get_all(self): + """ + test_list_ports_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/ports') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"ports":[{"direct_link_count":1,"id":"01122b9b-820f-4c44-8a31-77f1f0806765","label":"XCR-FRK-CS-SEC-01","location_display_name":"Dallas 03","location_name":"dal03","provider_name":"provider_1","supported_link_speeds":[21]}]}' + mock_response2 = '{"total_count":2,"limit":1,"ports":[{"direct_link_count":1,"id":"01122b9b-820f-4c44-8a31-77f1f0806765","label":"XCR-FRK-CS-SEC-01","location_display_name":"Dallas 03","location_name":"dal03","provider_name":"provider_1","supported_link_speeds":[21]}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = PortsPager( + client=_service, + limit=10, + location_name='testString', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestGetPort: """ - Test Class for replace_gateway_as_prepends + Test Class for get_port """ @responses.activate - def test_replace_gateway_as_prepends_all_params(self): + def test_get_port_all_params(self): """ - replace_gateway_as_prepends() + get_port() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/as_prepends') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}]}' + url = preprocess_url('/ports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + mock_response = '{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}' responses.add( - responses.PUT, + responses.GET, url, body=mock_response, content_type='application/json', - status=201, + status=200, ) - # Construct a dict representation of a AsPrependPrefixArrayTemplate model - as_prepend_prefix_array_template_model = {} - as_prepend_prefix_array_template_model['length'] = 4 - as_prepend_prefix_array_template_model['policy'] = 'import' - as_prepend_prefix_array_template_model['specific_prefixes'] = ['192.168.3.0/24'] - # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' - as_prepends = [as_prepend_prefix_array_template_model] + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Invoke method - response = _service.replace_gateway_as_prepends( - gateway_id, - if_match, - as_prepends=as_prepends, + response = _service.get_port( + id, 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['as_prepends'] == [as_prepend_prefix_array_template_model] + assert response.status_code == 200 - def test_replace_gateway_as_prepends_all_params_with_retries(self): - # Enable retries and run test_replace_gateway_as_prepends_all_params. + def test_get_port_all_params_with_retries(self): + # Enable retries and run test_get_port_all_params. _service.enable_retries() - self.test_replace_gateway_as_prepends_all_params() + self.test_get_port_all_params() - # Disable retries and run test_replace_gateway_as_prepends_all_params. + # Disable retries and run test_get_port_all_params. _service.disable_retries() - self.test_replace_gateway_as_prepends_all_params() + self.test_get_port_all_params() @responses.activate - def test_replace_gateway_as_prepends_value_error(self): + def test_get_port_value_error(self): """ - test_replace_gateway_as_prepends_value_error() + test_get_port_value_error() """ # Set up mock - url = preprocess_url('/gateways/0a06fb9b-820f-4c44-8a31-77f1f0806d28/as_prepends') - mock_response = '{"as_prepends": [{"created_at": "2019-01-01T12:00:00.000Z", "id": "ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4", "length": 4, "policy": "import", "specific_prefixes": ["192.168.3.0/24"], "updated_at": "2019-01-01T12:00:00.000Z"}]}' + url = preprocess_url('/ports/0a06fb9b-820f-4c44-8a31-77f1f0806d28') + mock_response = '{"direct_link_count": 1, "id": "01122b9b-820f-4c44-8a31-77f1f0806765", "label": "XCR-FRK-CS-SEC-01", "location_display_name": "Dallas 03", "location_name": "dal03", "provider_name": "provider_1", "supported_link_speeds": [21]}' responses.add( - responses.PUT, + responses.GET, url, body=mock_response, content_type='application/json', - status=201, + status=200, ) - # Construct a dict representation of a AsPrependPrefixArrayTemplate model - as_prepend_prefix_array_template_model = {} - as_prepend_prefix_array_template_model['length'] = 4 - as_prepend_prefix_array_template_model['policy'] = 'import' - as_prepend_prefix_array_template_model['specific_prefixes'] = ['192.168.3.0/24'] - # Set up parameter values - gateway_id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' - if_match = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' - as_prepends = [as_prepend_prefix_array_template_model] + id = '0a06fb9b-820f-4c44-8a31-77f1f0806d28' # Pass in all but one required param and check for a ValueError req_param_dict = { - "gateway_id": gateway_id, - "if_match": if_match, + "id": id, } for param in req_param_dict.keys(): req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} with pytest.raises(ValueError): - _service.replace_gateway_as_prepends(**req_copy) + _service.get_port(**req_copy) - def test_replace_gateway_as_prepends_value_error_with_retries(self): - # Enable retries and run test_replace_gateway_as_prepends_value_error. + def test_get_port_value_error_with_retries(self): + # Enable retries and run test_get_port_value_error. _service.enable_retries() - self.test_replace_gateway_as_prepends_value_error() + self.test_get_port_value_error() - # Disable retries and run test_replace_gateway_as_prepends_value_error. + # Disable retries and run test_get_port_value_error. _service.disable_retries() - self.test_replace_gateway_as_prepends_value_error() + self.test_get_port_value_error() # endregion ############################################################################## -# End of Service: GatewayASPrepends +# End of Service: Ports ############################################################################## @@ -4677,36 +5657,6 @@ def test_as_prepend_template_serialization(self): assert as_prepend_template_model_json2 == as_prepend_template_model_json -class TestModel_CrossAccountGatewayPort: - """ - Test Class for CrossAccountGatewayPort - """ - - def test_cross_account_gateway_port_serialization(self): - """ - Test serialization/deserialization for CrossAccountGatewayPort - """ - - # Construct a json representation of a CrossAccountGatewayPort model - cross_account_gateway_port_model_json = {} - cross_account_gateway_port_model_json['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' - - # Construct a model instance of CrossAccountGatewayPort by calling from_dict on the json representation - cross_account_gateway_port_model = CrossAccountGatewayPort.from_dict(cross_account_gateway_port_model_json) - assert cross_account_gateway_port_model != False - - # Construct a model instance of CrossAccountGatewayPort by calling from_dict on the json representation - cross_account_gateway_port_model_dict = CrossAccountGatewayPort.from_dict(cross_account_gateway_port_model_json).__dict__ - cross_account_gateway_port_model2 = CrossAccountGatewayPort(**cross_account_gateway_port_model_dict) - - # Verify the model instances are equivalent - assert cross_account_gateway_port_model == cross_account_gateway_port_model2 - - # Convert model instance back to dict and verify no loss of data - cross_account_gateway_port_model_json2 = cross_account_gateway_port_model.to_dict() - assert cross_account_gateway_port_model_json2 == cross_account_gateway_port_model_json - - class TestModel_CrossConnectRouter: """ Test Class for CrossConnectRouter @@ -4719,7 +5669,7 @@ def test_cross_connect_router_serialization(self): # Construct a json representation of a CrossConnectRouter model cross_connect_router_model_json = {} - cross_connect_router_model_json['capabilities'] = ['non_macsec', 'macsec'] + cross_connect_router_model_json['capabilities'] = ['testString'] cross_connect_router_model_json['router_name'] = 'xcr01.dal03' cross_connect_router_model_json['total_connections'] = 1 @@ -4802,8 +5752,8 @@ def test_gateway_serialization(self): as_prepend_model['specific_prefixes'] = ['192.168.3.0/24'] as_prepend_model['updated_at'] = '2019-01-01T12:00:00Z' - gateway_authentication_key_model = {} # GatewayAuthenticationKey - gateway_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + authentication_key_reference_model = {} # AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference + authentication_key_reference_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' gateway_bfd_config_model = {} # GatewayBfdConfig gateway_bfd_config_model['bfd_status'] = 'up' @@ -4814,34 +5764,24 @@ def test_gateway_serialization(self): gateway_change_request_model = {} # GatewayChangeRequestGatewayClientGatewayCreate gateway_change_request_model['type'] = 'create_gateway' - gateway_macsec_config_active_cak_model = {} # GatewayMacsecConfigActiveCak - gateway_macsec_config_active_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_active_cak_model['status'] = 'testString' - - gateway_macsec_config_fallback_cak_model = {} # GatewayMacsecConfigFallbackCak - gateway_macsec_config_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_fallback_cak_model['status'] = 'testString' - - gateway_macsec_config_primary_cak_model = {} # GatewayMacsecConfigPrimaryCak - gateway_macsec_config_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_primary_cak_model['status'] = 'testString' - - gateway_macsec_config_model = {} # GatewayMacsecConfig - gateway_macsec_config_model['active'] = True - gateway_macsec_config_model['active_cak'] = gateway_macsec_config_active_cak_model - gateway_macsec_config_model['cipher_suite'] = 'gcm_aes_xpn_256' - gateway_macsec_config_model['confidentiality_offset'] = 0 - gateway_macsec_config_model['cryptographic_algorithm'] = 'aes_256_cmac' - gateway_macsec_config_model['fallback_cak'] = gateway_macsec_config_fallback_cak_model - gateway_macsec_config_model['key_server_priority'] = 255 - gateway_macsec_config_model['primary_cak'] = gateway_macsec_config_primary_cak_model - gateway_macsec_config_model['sak_expiry_time'] = 3600 - gateway_macsec_config_model['security_policy'] = 'must_secure' - gateway_macsec_config_model['status'] = 'secured' - gateway_macsec_config_model['window_size'] = 64 - - gateway_port_model = {} # GatewayPort - gateway_port_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' + gateway_macsec_status_reason_model = {} # GatewayMacsecStatusReason + gateway_macsec_status_reason_model['code'] = 'macsec_cak_failed' + gateway_macsec_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_macsec_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + gateway_macsec_reference_model = {} # GatewayMacsecReference + gateway_macsec_reference_model['active'] = True + gateway_macsec_reference_model['security_policy'] = 'must_secure' + gateway_macsec_reference_model['status'] = 'secured' + gateway_macsec_reference_model['status_reasons'] = [gateway_macsec_status_reason_model] + + gateway_status_reason_model = {} # GatewayStatusReason + gateway_status_reason_model['code'] = 'authentication_key_failed' + gateway_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + gateway_port_reference_model = {} # GatewayPortReference + gateway_port_reference_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' resource_group_reference_model = {} # ResourceGroupReference resource_group_reference_model['id'] = '56969d6043e9465c883cb9f7363e78e8' @@ -4849,7 +5789,7 @@ def test_gateway_serialization(self): # Construct a json representation of a Gateway model gateway_model_json = {} gateway_model_json['as_prepends'] = [as_prepend_model] - gateway_model_json['authentication_key'] = gateway_authentication_key_model + gateway_model_json['authentication_key'] = authentication_key_reference_model gateway_model_json['bfd_config'] = gateway_bfd_config_model gateway_model_json['bgp_asn'] = 64999 gateway_model_json['bgp_base_cidr'] = 'testString' @@ -4875,15 +5815,17 @@ def test_gateway_serialization(self): gateway_model_json['link_status_updated_at'] = '2020-08-20T06:58:41.909000Z' gateway_model_json['location_display_name'] = 'Dallas 03' gateway_model_json['location_name'] = 'dal03' - gateway_model_json['macsec_config'] = gateway_macsec_config_model + gateway_model_json['macsec'] = gateway_macsec_reference_model + gateway_model_json['macsec_capability'] = 'non_macsec' gateway_model_json['metered'] = False gateway_model_json['name'] = 'myGateway' gateway_model_json['operational_status'] = 'awaiting_completion_notice' - gateway_model_json['port'] = gateway_port_model + gateway_model_json['operational_status_reasons'] = [gateway_status_reason_model] + gateway_model_json['patch_panel_completion_notice'] = 'patch panel configuration details' + gateway_model_json['port'] = gateway_port_reference_model gateway_model_json['provider_api_managed'] = False gateway_model_json['resource_group'] = resource_group_reference_model gateway_model_json['speed_mbps'] = 1000 - gateway_model_json['patch_panel_completion_notice'] = 'patch panel configuration details' gateway_model_json['type'] = 'dedicated' gateway_model_json['vlan'] = 10 @@ -4903,66 +5845,6 @@ def test_gateway_serialization(self): assert gateway_model_json2 == gateway_model_json -class TestModel_GatewayActionTemplateAuthenticationKey: - """ - Test Class for GatewayActionTemplateAuthenticationKey - """ - - def test_gateway_action_template_authentication_key_serialization(self): - """ - Test serialization/deserialization for GatewayActionTemplateAuthenticationKey - """ - - # Construct a json representation of a GatewayActionTemplateAuthenticationKey model - gateway_action_template_authentication_key_model_json = {} - gateway_action_template_authentication_key_model_json['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' - - # Construct a model instance of GatewayActionTemplateAuthenticationKey by calling from_dict on the json representation - gateway_action_template_authentication_key_model = GatewayActionTemplateAuthenticationKey.from_dict(gateway_action_template_authentication_key_model_json) - assert gateway_action_template_authentication_key_model != False - - # Construct a model instance of GatewayActionTemplateAuthenticationKey by calling from_dict on the json representation - gateway_action_template_authentication_key_model_dict = GatewayActionTemplateAuthenticationKey.from_dict(gateway_action_template_authentication_key_model_json).__dict__ - gateway_action_template_authentication_key_model2 = GatewayActionTemplateAuthenticationKey(**gateway_action_template_authentication_key_model_dict) - - # Verify the model instances are equivalent - assert gateway_action_template_authentication_key_model == gateway_action_template_authentication_key_model2 - - # Convert model instance back to dict and verify no loss of data - gateway_action_template_authentication_key_model_json2 = gateway_action_template_authentication_key_model.to_dict() - assert gateway_action_template_authentication_key_model_json2 == gateway_action_template_authentication_key_model_json - - -class TestModel_GatewayAuthenticationKey: - """ - Test Class for GatewayAuthenticationKey - """ - - def test_gateway_authentication_key_serialization(self): - """ - Test serialization/deserialization for GatewayAuthenticationKey - """ - - # Construct a json representation of a GatewayAuthenticationKey model - gateway_authentication_key_model_json = {} - gateway_authentication_key_model_json['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' - - # Construct a model instance of GatewayAuthenticationKey by calling from_dict on the json representation - gateway_authentication_key_model = GatewayAuthenticationKey.from_dict(gateway_authentication_key_model_json) - assert gateway_authentication_key_model != False - - # Construct a model instance of GatewayAuthenticationKey by calling from_dict on the json representation - gateway_authentication_key_model_dict = GatewayAuthenticationKey.from_dict(gateway_authentication_key_model_json).__dict__ - gateway_authentication_key_model2 = GatewayAuthenticationKey(**gateway_authentication_key_model_dict) - - # Verify the model instances are equivalent - assert gateway_authentication_key_model == gateway_authentication_key_model2 - - # Convert model instance back to dict and verify no loss of data - gateway_authentication_key_model_json2 = gateway_authentication_key_model.to_dict() - assert gateway_authentication_key_model_json2 == gateway_authentication_key_model_json - - class TestModel_GatewayBfdConfig: """ Test Class for GatewayBfdConfig @@ -5110,8 +5992,8 @@ def test_gateway_collection_serialization(self): as_prepend_model['specific_prefixes'] = ['192.168.3.0/24'] as_prepend_model['updated_at'] = '2019-01-01T12:00:00Z' - gateway_authentication_key_model = {} # GatewayAuthenticationKey - gateway_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + authentication_key_reference_model = {} # AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference + authentication_key_reference_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' gateway_bfd_config_model = {} # GatewayBfdConfig gateway_bfd_config_model['bfd_status'] = 'up' @@ -5122,41 +6004,31 @@ def test_gateway_collection_serialization(self): gateway_change_request_model = {} # GatewayChangeRequestGatewayClientGatewayCreate gateway_change_request_model['type'] = 'create_gateway' - gateway_macsec_config_active_cak_model = {} # GatewayMacsecConfigActiveCak - gateway_macsec_config_active_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_active_cak_model['status'] = 'testString' - - gateway_macsec_config_fallback_cak_model = {} # GatewayMacsecConfigFallbackCak - gateway_macsec_config_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_fallback_cak_model['status'] = 'testString' - - gateway_macsec_config_primary_cak_model = {} # GatewayMacsecConfigPrimaryCak - gateway_macsec_config_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_primary_cak_model['status'] = 'testString' - - gateway_macsec_config_model = {} # GatewayMacsecConfig - gateway_macsec_config_model['active'] = True - gateway_macsec_config_model['active_cak'] = gateway_macsec_config_active_cak_model - gateway_macsec_config_model['cipher_suite'] = 'gcm_aes_xpn_256' - gateway_macsec_config_model['confidentiality_offset'] = 0 - gateway_macsec_config_model['cryptographic_algorithm'] = 'aes_256_cmac' - gateway_macsec_config_model['fallback_cak'] = gateway_macsec_config_fallback_cak_model - gateway_macsec_config_model['key_server_priority'] = 255 - gateway_macsec_config_model['primary_cak'] = gateway_macsec_config_primary_cak_model - gateway_macsec_config_model['sak_expiry_time'] = 3600 - gateway_macsec_config_model['security_policy'] = 'must_secure' - gateway_macsec_config_model['status'] = 'secured' - gateway_macsec_config_model['window_size'] = 64 - - gateway_port_model = {} # GatewayPort - gateway_port_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' + gateway_macsec_status_reason_model = {} # GatewayMacsecStatusReason + gateway_macsec_status_reason_model['code'] = 'macsec_cak_failed' + gateway_macsec_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_macsec_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + gateway_macsec_reference_model = {} # GatewayMacsecReference + gateway_macsec_reference_model['active'] = True + gateway_macsec_reference_model['security_policy'] = 'must_secure' + gateway_macsec_reference_model['status'] = 'secured' + gateway_macsec_reference_model['status_reasons'] = [gateway_macsec_status_reason_model] + + gateway_status_reason_model = {} # GatewayStatusReason + gateway_status_reason_model['code'] = 'authentication_key_failed' + gateway_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + gateway_port_reference_model = {} # GatewayPortReference + gateway_port_reference_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' resource_group_reference_model = {} # ResourceGroupReference resource_group_reference_model['id'] = '56969d6043e9465c883cb9f7363e78e8' gateway_collection_gateways_item_model = {} # GatewayCollectionGatewaysItemGateway gateway_collection_gateways_item_model['as_prepends'] = [as_prepend_model] - gateway_collection_gateways_item_model['authentication_key'] = gateway_authentication_key_model + gateway_collection_gateways_item_model['authentication_key'] = authentication_key_reference_model gateway_collection_gateways_item_model['bfd_config'] = gateway_bfd_config_model gateway_collection_gateways_item_model['bgp_asn'] = 64999 gateway_collection_gateways_item_model['bgp_base_cidr'] = 'testString' @@ -5182,15 +6054,17 @@ def test_gateway_collection_serialization(self): gateway_collection_gateways_item_model['link_status_updated_at'] = '2020-08-20T06:58:41.909000Z' gateway_collection_gateways_item_model['location_display_name'] = 'Dallas 03' gateway_collection_gateways_item_model['location_name'] = 'dal03' - gateway_collection_gateways_item_model['macsec_config'] = gateway_macsec_config_model + gateway_collection_gateways_item_model['macsec'] = gateway_macsec_reference_model + gateway_collection_gateways_item_model['macsec_capability'] = 'non_macsec' gateway_collection_gateways_item_model['metered'] = False gateway_collection_gateways_item_model['name'] = 'myGateway' gateway_collection_gateways_item_model['operational_status'] = 'awaiting_completion_notice' - gateway_collection_gateways_item_model['port'] = gateway_port_model + gateway_collection_gateways_item_model['operational_status_reasons'] = [gateway_status_reason_model] + gateway_collection_gateways_item_model['patch_panel_completion_notice'] = 'patch panel configuration details' + gateway_collection_gateways_item_model['port'] = gateway_port_reference_model gateway_collection_gateways_item_model['provider_api_managed'] = False gateway_collection_gateways_item_model['resource_group'] = resource_group_reference_model gateway_collection_gateways_item_model['speed_mbps'] = 1000 - gateway_collection_gateways_item_model['patch_panel_completion_notice'] = 'patch panel configuration details' gateway_collection_gateways_item_model['type'] = 'dedicated' gateway_collection_gateways_item_model['vlan'] = 10 @@ -5214,354 +6088,421 @@ def test_gateway_collection_serialization(self): assert gateway_collection_model_json2 == gateway_collection_model_json -class TestModel_GatewayMacsecConfig: +class TestModel_GatewayMacsec: """ - Test Class for GatewayMacsecConfig + Test Class for GatewayMacsec """ - def test_gateway_macsec_config_serialization(self): + def test_gateway_macsec_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfig + Test serialization/deserialization for GatewayMacsec """ # Construct dict forms of any model objects needed in order to build this model. - gateway_macsec_config_active_cak_model = {} # GatewayMacsecConfigActiveCak - gateway_macsec_config_active_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_active_cak_model['status'] = 'testString' - - gateway_macsec_config_fallback_cak_model = {} # GatewayMacsecConfigFallbackCak - gateway_macsec_config_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_fallback_cak_model['status'] = 'testString' - - gateway_macsec_config_primary_cak_model = {} # GatewayMacsecConfigPrimaryCak - gateway_macsec_config_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_primary_cak_model['status'] = 'testString' - - # Construct a json representation of a GatewayMacsecConfig model - gateway_macsec_config_model_json = {} - gateway_macsec_config_model_json['active'] = True - gateway_macsec_config_model_json['active_cak'] = gateway_macsec_config_active_cak_model - gateway_macsec_config_model_json['cipher_suite'] = 'gcm_aes_xpn_256' - gateway_macsec_config_model_json['confidentiality_offset'] = 0 - gateway_macsec_config_model_json['cryptographic_algorithm'] = 'aes_256_cmac' - gateway_macsec_config_model_json['fallback_cak'] = gateway_macsec_config_fallback_cak_model - gateway_macsec_config_model_json['key_server_priority'] = 255 - gateway_macsec_config_model_json['primary_cak'] = gateway_macsec_config_primary_cak_model - gateway_macsec_config_model_json['sak_expiry_time'] = 3600 - gateway_macsec_config_model_json['security_policy'] = 'must_secure' - gateway_macsec_config_model_json['status'] = 'secured' - gateway_macsec_config_model_json['window_size'] = 64 - - # Construct a model instance of GatewayMacsecConfig by calling from_dict on the json representation - gateway_macsec_config_model = GatewayMacsecConfig.from_dict(gateway_macsec_config_model_json) - assert gateway_macsec_config_model != False - - # Construct a model instance of GatewayMacsecConfig by calling from_dict on the json representation - gateway_macsec_config_model_dict = GatewayMacsecConfig.from_dict(gateway_macsec_config_model_json).__dict__ - gateway_macsec_config_model2 = GatewayMacsecConfig(**gateway_macsec_config_model_dict) + sak_rekey_model = {} # SakRekeyTimerMode + sak_rekey_model['interval'] = 3600 + sak_rekey_model['mode'] = 'timer' + + gateway_macsec_status_reason_model = {} # GatewayMacsecStatusReason + gateway_macsec_status_reason_model['code'] = 'macsec_cak_failed' + gateway_macsec_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_macsec_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + # Construct a json representation of a GatewayMacsec model + gateway_macsec_model_json = {} + gateway_macsec_model_json['active'] = True + gateway_macsec_model_json['cipher_suite'] = 'gcm_aes_xpn_256' + gateway_macsec_model_json['confidentiality_offset'] = 0 + gateway_macsec_model_json['created_at'] = '2020-11-02T20:40:29.622000Z' + gateway_macsec_model_json['key_server_priority'] = 255 + gateway_macsec_model_json['sak_rekey'] = sak_rekey_model + gateway_macsec_model_json['security_policy'] = 'must_secure' + gateway_macsec_model_json['status'] = 'secured' + gateway_macsec_model_json['status_reasons'] = [gateway_macsec_status_reason_model] + gateway_macsec_model_json['updated_at'] = '2020-11-02T20:40:29.622000Z' + gateway_macsec_model_json['window_size'] = 512 + + # Construct a model instance of GatewayMacsec by calling from_dict on the json representation + gateway_macsec_model = GatewayMacsec.from_dict(gateway_macsec_model_json) + assert gateway_macsec_model != False + + # Construct a model instance of GatewayMacsec by calling from_dict on the json representation + gateway_macsec_model_dict = GatewayMacsec.from_dict(gateway_macsec_model_json).__dict__ + gateway_macsec_model2 = GatewayMacsec(**gateway_macsec_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_model == gateway_macsec_config_model2 + assert gateway_macsec_model == gateway_macsec_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_model_json2 = gateway_macsec_config_model.to_dict() - assert gateway_macsec_config_model_json2 == gateway_macsec_config_model_json + gateway_macsec_model_json2 = gateway_macsec_model.to_dict() + assert gateway_macsec_model_json2 == gateway_macsec_model_json -class TestModel_GatewayMacsecConfigActiveCak: +class TestModel_GatewayMacsecCak: """ - Test Class for GatewayMacsecConfigActiveCak + Test Class for GatewayMacsecCak """ - def test_gateway_macsec_config_active_cak_serialization(self): + def test_gateway_macsec_cak_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigActiveCak + Test serialization/deserialization for GatewayMacsecCak """ - # Construct a json representation of a GatewayMacsecConfigActiveCak model - gateway_macsec_config_active_cak_model_json = {} - gateway_macsec_config_active_cak_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_active_cak_model_json['status'] = 'testString' - - # Construct a model instance of GatewayMacsecConfigActiveCak by calling from_dict on the json representation - gateway_macsec_config_active_cak_model = GatewayMacsecConfigActiveCak.from_dict(gateway_macsec_config_active_cak_model_json) - assert gateway_macsec_config_active_cak_model != False + # Construct dict forms of any model objects needed in order to build this model. - # Construct a model instance of GatewayMacsecConfigActiveCak by calling from_dict on the json representation - gateway_macsec_config_active_cak_model_dict = GatewayMacsecConfigActiveCak.from_dict(gateway_macsec_config_active_cak_model_json).__dict__ - gateway_macsec_config_active_cak_model2 = GatewayMacsecConfigActiveCak(**gateway_macsec_config_active_cak_model_dict) + hpcs_key_reference_model = {} # HpcsKeyReference + hpcs_key_reference_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + gateway_macsec_cak_active_delta_model = {} # GatewayMacsecCakActiveDelta + gateway_macsec_cak_active_delta_model['key'] = hpcs_key_reference_model + gateway_macsec_cak_active_delta_model['name'] = '1000' + gateway_macsec_cak_active_delta_model['status'] = 'active' + + # Construct a json representation of a GatewayMacsecCak model + gateway_macsec_cak_model_json = {} + gateway_macsec_cak_model_json['active_delta'] = gateway_macsec_cak_active_delta_model + gateway_macsec_cak_model_json['created_at'] = '2020-11-02T20:40:29.622000Z' + gateway_macsec_cak_model_json['id'] = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' + gateway_macsec_cak_model_json['key'] = hpcs_key_reference_model + gateway_macsec_cak_model_json['name'] = '1000' + gateway_macsec_cak_model_json['session'] = 'primary' + gateway_macsec_cak_model_json['status'] = 'active' + gateway_macsec_cak_model_json['updated_at'] = '2020-11-02T20:40:29.622000Z' + + # Construct a model instance of GatewayMacsecCak by calling from_dict on the json representation + gateway_macsec_cak_model = GatewayMacsecCak.from_dict(gateway_macsec_cak_model_json) + assert gateway_macsec_cak_model != False + + # Construct a model instance of GatewayMacsecCak by calling from_dict on the json representation + gateway_macsec_cak_model_dict = GatewayMacsecCak.from_dict(gateway_macsec_cak_model_json).__dict__ + gateway_macsec_cak_model2 = GatewayMacsecCak(**gateway_macsec_cak_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_active_cak_model == gateway_macsec_config_active_cak_model2 + assert gateway_macsec_cak_model == gateway_macsec_cak_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_active_cak_model_json2 = gateway_macsec_config_active_cak_model.to_dict() - assert gateway_macsec_config_active_cak_model_json2 == gateway_macsec_config_active_cak_model_json + gateway_macsec_cak_model_json2 = gateway_macsec_cak_model.to_dict() + assert gateway_macsec_cak_model_json2 == gateway_macsec_cak_model_json -class TestModel_GatewayMacsecConfigFallbackCak: +class TestModel_GatewayMacsecCakActiveDelta: """ - Test Class for GatewayMacsecConfigFallbackCak + Test Class for GatewayMacsecCakActiveDelta """ - def test_gateway_macsec_config_fallback_cak_serialization(self): + def test_gateway_macsec_cak_active_delta_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigFallbackCak + Test serialization/deserialization for GatewayMacsecCakActiveDelta """ - # Construct a json representation of a GatewayMacsecConfigFallbackCak model - gateway_macsec_config_fallback_cak_model_json = {} - gateway_macsec_config_fallback_cak_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_fallback_cak_model_json['status'] = 'testString' + # Construct dict forms of any model objects needed in order to build this model. + + hpcs_key_reference_model = {} # HpcsKeyReference + hpcs_key_reference_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - # Construct a model instance of GatewayMacsecConfigFallbackCak by calling from_dict on the json representation - gateway_macsec_config_fallback_cak_model = GatewayMacsecConfigFallbackCak.from_dict(gateway_macsec_config_fallback_cak_model_json) - assert gateway_macsec_config_fallback_cak_model != False + # Construct a json representation of a GatewayMacsecCakActiveDelta model + gateway_macsec_cak_active_delta_model_json = {} + gateway_macsec_cak_active_delta_model_json['key'] = hpcs_key_reference_model + gateway_macsec_cak_active_delta_model_json['name'] = '1000' + gateway_macsec_cak_active_delta_model_json['status'] = 'active' - # Construct a model instance of GatewayMacsecConfigFallbackCak by calling from_dict on the json representation - gateway_macsec_config_fallback_cak_model_dict = GatewayMacsecConfigFallbackCak.from_dict(gateway_macsec_config_fallback_cak_model_json).__dict__ - gateway_macsec_config_fallback_cak_model2 = GatewayMacsecConfigFallbackCak(**gateway_macsec_config_fallback_cak_model_dict) + # Construct a model instance of GatewayMacsecCakActiveDelta by calling from_dict on the json representation + gateway_macsec_cak_active_delta_model = GatewayMacsecCakActiveDelta.from_dict(gateway_macsec_cak_active_delta_model_json) + assert gateway_macsec_cak_active_delta_model != False + + # Construct a model instance of GatewayMacsecCakActiveDelta by calling from_dict on the json representation + gateway_macsec_cak_active_delta_model_dict = GatewayMacsecCakActiveDelta.from_dict(gateway_macsec_cak_active_delta_model_json).__dict__ + gateway_macsec_cak_active_delta_model2 = GatewayMacsecCakActiveDelta(**gateway_macsec_cak_active_delta_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_fallback_cak_model == gateway_macsec_config_fallback_cak_model2 + assert gateway_macsec_cak_active_delta_model == gateway_macsec_cak_active_delta_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_fallback_cak_model_json2 = gateway_macsec_config_fallback_cak_model.to_dict() - assert gateway_macsec_config_fallback_cak_model_json2 == gateway_macsec_config_fallback_cak_model_json + gateway_macsec_cak_active_delta_model_json2 = gateway_macsec_cak_active_delta_model.to_dict() + assert gateway_macsec_cak_active_delta_model_json2 == gateway_macsec_cak_active_delta_model_json -class TestModel_GatewayMacsecConfigPatchTemplate: +class TestModel_GatewayMacsecCakCollection: """ - Test Class for GatewayMacsecConfigPatchTemplate + Test Class for GatewayMacsecCakCollection """ - def test_gateway_macsec_config_patch_template_serialization(self): + def test_gateway_macsec_cak_collection_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigPatchTemplate + Test serialization/deserialization for GatewayMacsecCakCollection """ # Construct dict forms of any model objects needed in order to build this model. - gateway_macsec_config_patch_template_fallback_cak_model = {} # GatewayMacsecConfigPatchTemplateFallbackCak - gateway_macsec_config_patch_template_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + hpcs_key_reference_model = {} # HpcsKeyReference + hpcs_key_reference_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + gateway_macsec_cak_active_delta_model = {} # GatewayMacsecCakActiveDelta + gateway_macsec_cak_active_delta_model['key'] = hpcs_key_reference_model + gateway_macsec_cak_active_delta_model['name'] = '1000' + gateway_macsec_cak_active_delta_model['status'] = 'active' - gateway_macsec_config_patch_template_primary_cak_model = {} # GatewayMacsecConfigPatchTemplatePrimaryCak - gateway_macsec_config_patch_template_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + gateway_macsec_cak_model = {} # GatewayMacsecCak + gateway_macsec_cak_model['active_delta'] = gateway_macsec_cak_active_delta_model + gateway_macsec_cak_model['created_at'] = '2020-11-02T20:40:29.622000Z' + gateway_macsec_cak_model['id'] = 'ef4dcb1a-fee4-41c7-9e11-9cd99e65c1f4' + gateway_macsec_cak_model['key'] = hpcs_key_reference_model + gateway_macsec_cak_model['name'] = '1000' + gateway_macsec_cak_model['session'] = 'primary' + gateway_macsec_cak_model['status'] = 'active' + gateway_macsec_cak_model['updated_at'] = '2020-11-02T20:40:29.622000Z' - # Construct a json representation of a GatewayMacsecConfigPatchTemplate model - gateway_macsec_config_patch_template_model_json = {} - gateway_macsec_config_patch_template_model_json['active'] = True - gateway_macsec_config_patch_template_model_json['fallback_cak'] = gateway_macsec_config_patch_template_fallback_cak_model - gateway_macsec_config_patch_template_model_json['primary_cak'] = gateway_macsec_config_patch_template_primary_cak_model - gateway_macsec_config_patch_template_model_json['window_size'] = 512 + # Construct a json representation of a GatewayMacsecCakCollection model + gateway_macsec_cak_collection_model_json = {} + gateway_macsec_cak_collection_model_json['caks'] = [gateway_macsec_cak_model] - # Construct a model instance of GatewayMacsecConfigPatchTemplate by calling from_dict on the json representation - gateway_macsec_config_patch_template_model = GatewayMacsecConfigPatchTemplate.from_dict(gateway_macsec_config_patch_template_model_json) - assert gateway_macsec_config_patch_template_model != False + # Construct a model instance of GatewayMacsecCakCollection by calling from_dict on the json representation + gateway_macsec_cak_collection_model = GatewayMacsecCakCollection.from_dict(gateway_macsec_cak_collection_model_json) + assert gateway_macsec_cak_collection_model != False - # Construct a model instance of GatewayMacsecConfigPatchTemplate by calling from_dict on the json representation - gateway_macsec_config_patch_template_model_dict = GatewayMacsecConfigPatchTemplate.from_dict(gateway_macsec_config_patch_template_model_json).__dict__ - gateway_macsec_config_patch_template_model2 = GatewayMacsecConfigPatchTemplate(**gateway_macsec_config_patch_template_model_dict) + # Construct a model instance of GatewayMacsecCakCollection by calling from_dict on the json representation + gateway_macsec_cak_collection_model_dict = GatewayMacsecCakCollection.from_dict(gateway_macsec_cak_collection_model_json).__dict__ + gateway_macsec_cak_collection_model2 = GatewayMacsecCakCollection(**gateway_macsec_cak_collection_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_patch_template_model == gateway_macsec_config_patch_template_model2 + assert gateway_macsec_cak_collection_model == gateway_macsec_cak_collection_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_patch_template_model_json2 = gateway_macsec_config_patch_template_model.to_dict() - assert gateway_macsec_config_patch_template_model_json2 == gateway_macsec_config_patch_template_model_json + gateway_macsec_cak_collection_model_json2 = gateway_macsec_cak_collection_model.to_dict() + assert gateway_macsec_cak_collection_model_json2 == gateway_macsec_cak_collection_model_json -class TestModel_GatewayMacsecConfigPatchTemplateFallbackCak: +class TestModel_GatewayMacsecCakPatch: """ - Test Class for GatewayMacsecConfigPatchTemplateFallbackCak + Test Class for GatewayMacsecCakPatch """ - def test_gateway_macsec_config_patch_template_fallback_cak_serialization(self): + def test_gateway_macsec_cak_patch_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigPatchTemplateFallbackCak + Test serialization/deserialization for GatewayMacsecCakPatch """ - # Construct a json representation of a GatewayMacsecConfigPatchTemplateFallbackCak model - gateway_macsec_config_patch_template_fallback_cak_model_json = {} - gateway_macsec_config_patch_template_fallback_cak_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + # Construct dict forms of any model objects needed in order to build this model. + + hpcs_key_identity_model = {} # HpcsKeyIdentity + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - # Construct a model instance of GatewayMacsecConfigPatchTemplateFallbackCak by calling from_dict on the json representation - gateway_macsec_config_patch_template_fallback_cak_model = GatewayMacsecConfigPatchTemplateFallbackCak.from_dict(gateway_macsec_config_patch_template_fallback_cak_model_json) - assert gateway_macsec_config_patch_template_fallback_cak_model != False + # Construct a json representation of a GatewayMacsecCakPatch model + gateway_macsec_cak_patch_model_json = {} + gateway_macsec_cak_patch_model_json['key'] = hpcs_key_identity_model + gateway_macsec_cak_patch_model_json['name'] = '1000' - # Construct a model instance of GatewayMacsecConfigPatchTemplateFallbackCak by calling from_dict on the json representation - gateway_macsec_config_patch_template_fallback_cak_model_dict = GatewayMacsecConfigPatchTemplateFallbackCak.from_dict(gateway_macsec_config_patch_template_fallback_cak_model_json).__dict__ - gateway_macsec_config_patch_template_fallback_cak_model2 = GatewayMacsecConfigPatchTemplateFallbackCak(**gateway_macsec_config_patch_template_fallback_cak_model_dict) + # Construct a model instance of GatewayMacsecCakPatch by calling from_dict on the json representation + gateway_macsec_cak_patch_model = GatewayMacsecCakPatch.from_dict(gateway_macsec_cak_patch_model_json) + assert gateway_macsec_cak_patch_model != False + + # Construct a model instance of GatewayMacsecCakPatch by calling from_dict on the json representation + gateway_macsec_cak_patch_model_dict = GatewayMacsecCakPatch.from_dict(gateway_macsec_cak_patch_model_json).__dict__ + gateway_macsec_cak_patch_model2 = GatewayMacsecCakPatch(**gateway_macsec_cak_patch_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_patch_template_fallback_cak_model == gateway_macsec_config_patch_template_fallback_cak_model2 + assert gateway_macsec_cak_patch_model == gateway_macsec_cak_patch_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_patch_template_fallback_cak_model_json2 = gateway_macsec_config_patch_template_fallback_cak_model.to_dict() - assert gateway_macsec_config_patch_template_fallback_cak_model_json2 == gateway_macsec_config_patch_template_fallback_cak_model_json + gateway_macsec_cak_patch_model_json2 = gateway_macsec_cak_patch_model.to_dict() + assert gateway_macsec_cak_patch_model_json2 == gateway_macsec_cak_patch_model_json -class TestModel_GatewayMacsecConfigPatchTemplatePrimaryCak: +class TestModel_GatewayMacsecCakPrototype: """ - Test Class for GatewayMacsecConfigPatchTemplatePrimaryCak + Test Class for GatewayMacsecCakPrototype """ - def test_gateway_macsec_config_patch_template_primary_cak_serialization(self): + def test_gateway_macsec_cak_prototype_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigPatchTemplatePrimaryCak + Test serialization/deserialization for GatewayMacsecCakPrototype """ - # Construct a json representation of a GatewayMacsecConfigPatchTemplatePrimaryCak model - gateway_macsec_config_patch_template_primary_cak_model_json = {} - gateway_macsec_config_patch_template_primary_cak_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + # Construct dict forms of any model objects needed in order to build this model. + + hpcs_key_identity_model = {} # HpcsKeyIdentity + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a json representation of a GatewayMacsecCakPrototype model + gateway_macsec_cak_prototype_model_json = {} + gateway_macsec_cak_prototype_model_json['key'] = hpcs_key_identity_model + gateway_macsec_cak_prototype_model_json['name'] = '1000' + gateway_macsec_cak_prototype_model_json['session'] = 'primary' - # Construct a model instance of GatewayMacsecConfigPatchTemplatePrimaryCak by calling from_dict on the json representation - gateway_macsec_config_patch_template_primary_cak_model = GatewayMacsecConfigPatchTemplatePrimaryCak.from_dict(gateway_macsec_config_patch_template_primary_cak_model_json) - assert gateway_macsec_config_patch_template_primary_cak_model != False + # Construct a model instance of GatewayMacsecCakPrototype by calling from_dict on the json representation + gateway_macsec_cak_prototype_model = GatewayMacsecCakPrototype.from_dict(gateway_macsec_cak_prototype_model_json) + assert gateway_macsec_cak_prototype_model != False - # Construct a model instance of GatewayMacsecConfigPatchTemplatePrimaryCak by calling from_dict on the json representation - gateway_macsec_config_patch_template_primary_cak_model_dict = GatewayMacsecConfigPatchTemplatePrimaryCak.from_dict(gateway_macsec_config_patch_template_primary_cak_model_json).__dict__ - gateway_macsec_config_patch_template_primary_cak_model2 = GatewayMacsecConfigPatchTemplatePrimaryCak(**gateway_macsec_config_patch_template_primary_cak_model_dict) + # Construct a model instance of GatewayMacsecCakPrototype by calling from_dict on the json representation + gateway_macsec_cak_prototype_model_dict = GatewayMacsecCakPrototype.from_dict(gateway_macsec_cak_prototype_model_json).__dict__ + gateway_macsec_cak_prototype_model2 = GatewayMacsecCakPrototype(**gateway_macsec_cak_prototype_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_patch_template_primary_cak_model == gateway_macsec_config_patch_template_primary_cak_model2 + assert gateway_macsec_cak_prototype_model == gateway_macsec_cak_prototype_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_patch_template_primary_cak_model_json2 = gateway_macsec_config_patch_template_primary_cak_model.to_dict() - assert gateway_macsec_config_patch_template_primary_cak_model_json2 == gateway_macsec_config_patch_template_primary_cak_model_json + gateway_macsec_cak_prototype_model_json2 = gateway_macsec_cak_prototype_model.to_dict() + assert gateway_macsec_cak_prototype_model_json2 == gateway_macsec_cak_prototype_model_json -class TestModel_GatewayMacsecConfigPrimaryCak: +class TestModel_GatewayMacsecPatch: """ - Test Class for GatewayMacsecConfigPrimaryCak + Test Class for GatewayMacsecPatch """ - def test_gateway_macsec_config_primary_cak_serialization(self): + def test_gateway_macsec_patch_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigPrimaryCak + Test serialization/deserialization for GatewayMacsecPatch """ - # Construct a json representation of a GatewayMacsecConfigPrimaryCak model - gateway_macsec_config_primary_cak_model_json = {} - gateway_macsec_config_primary_cak_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_primary_cak_model_json['status'] = 'testString' + # Construct dict forms of any model objects needed in order to build this model. + + sak_rekey_patch_model = {} # SakRekeyPatchSakRekeyTimerModePatch + sak_rekey_patch_model['interval'] = 3600 + sak_rekey_patch_model['mode'] = 'timer' - # Construct a model instance of GatewayMacsecConfigPrimaryCak by calling from_dict on the json representation - gateway_macsec_config_primary_cak_model = GatewayMacsecConfigPrimaryCak.from_dict(gateway_macsec_config_primary_cak_model_json) - assert gateway_macsec_config_primary_cak_model != False + # Construct a json representation of a GatewayMacsecPatch model + gateway_macsec_patch_model_json = {} + gateway_macsec_patch_model_json['active'] = True + gateway_macsec_patch_model_json['sak_rekey'] = sak_rekey_patch_model + gateway_macsec_patch_model_json['security_policy'] = 'must_secure' + gateway_macsec_patch_model_json['window_size'] = 64 - # Construct a model instance of GatewayMacsecConfigPrimaryCak by calling from_dict on the json representation - gateway_macsec_config_primary_cak_model_dict = GatewayMacsecConfigPrimaryCak.from_dict(gateway_macsec_config_primary_cak_model_json).__dict__ - gateway_macsec_config_primary_cak_model2 = GatewayMacsecConfigPrimaryCak(**gateway_macsec_config_primary_cak_model_dict) + # Construct a model instance of GatewayMacsecPatch by calling from_dict on the json representation + gateway_macsec_patch_model = GatewayMacsecPatch.from_dict(gateway_macsec_patch_model_json) + assert gateway_macsec_patch_model != False + + # Construct a model instance of GatewayMacsecPatch by calling from_dict on the json representation + gateway_macsec_patch_model_dict = GatewayMacsecPatch.from_dict(gateway_macsec_patch_model_json).__dict__ + gateway_macsec_patch_model2 = GatewayMacsecPatch(**gateway_macsec_patch_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_primary_cak_model == gateway_macsec_config_primary_cak_model2 + assert gateway_macsec_patch_model == gateway_macsec_patch_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_primary_cak_model_json2 = gateway_macsec_config_primary_cak_model.to_dict() - assert gateway_macsec_config_primary_cak_model_json2 == gateway_macsec_config_primary_cak_model_json + gateway_macsec_patch_model_json2 = gateway_macsec_patch_model.to_dict() + assert gateway_macsec_patch_model_json2 == gateway_macsec_patch_model_json -class TestModel_GatewayMacsecConfigTemplate: +class TestModel_GatewayMacsecPrototype: """ - Test Class for GatewayMacsecConfigTemplate + Test Class for GatewayMacsecPrototype """ - def test_gateway_macsec_config_template_serialization(self): + def test_gateway_macsec_prototype_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigTemplate + Test serialization/deserialization for GatewayMacsecPrototype """ # Construct dict forms of any model objects needed in order to build this model. - gateway_macsec_config_template_fallback_cak_model = {} # GatewayMacsecConfigTemplateFallbackCak - gateway_macsec_config_template_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + hpcs_key_identity_model = {} # HpcsKeyIdentity + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + gateway_macsec_cak_prototype_model = {} # GatewayMacsecCakPrototype + gateway_macsec_cak_prototype_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_prototype_model['name'] = '1000' + gateway_macsec_cak_prototype_model['session'] = 'primary' - gateway_macsec_config_template_primary_cak_model = {} # GatewayMacsecConfigTemplatePrimaryCak - gateway_macsec_config_template_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + sak_rekey_prototype_model = {} # SakRekeyPrototypeSakRekeyTimerModePrototype + sak_rekey_prototype_model['interval'] = 3600 + sak_rekey_prototype_model['mode'] = 'timer' - # Construct a json representation of a GatewayMacsecConfigTemplate model - gateway_macsec_config_template_model_json = {} - gateway_macsec_config_template_model_json['active'] = True - gateway_macsec_config_template_model_json['fallback_cak'] = gateway_macsec_config_template_fallback_cak_model - gateway_macsec_config_template_model_json['primary_cak'] = gateway_macsec_config_template_primary_cak_model - gateway_macsec_config_template_model_json['window_size'] = 148809600 + # Construct a json representation of a GatewayMacsecPrototype model + gateway_macsec_prototype_model_json = {} + gateway_macsec_prototype_model_json['active'] = True + gateway_macsec_prototype_model_json['caks'] = [gateway_macsec_cak_prototype_model] + gateway_macsec_prototype_model_json['sak_rekey'] = sak_rekey_prototype_model + gateway_macsec_prototype_model_json['security_policy'] = 'must_secure' + gateway_macsec_prototype_model_json['window_size'] = 64 - # Construct a model instance of GatewayMacsecConfigTemplate by calling from_dict on the json representation - gateway_macsec_config_template_model = GatewayMacsecConfigTemplate.from_dict(gateway_macsec_config_template_model_json) - assert gateway_macsec_config_template_model != False + # Construct a model instance of GatewayMacsecPrototype by calling from_dict on the json representation + gateway_macsec_prototype_model = GatewayMacsecPrototype.from_dict(gateway_macsec_prototype_model_json) + assert gateway_macsec_prototype_model != False - # Construct a model instance of GatewayMacsecConfigTemplate by calling from_dict on the json representation - gateway_macsec_config_template_model_dict = GatewayMacsecConfigTemplate.from_dict(gateway_macsec_config_template_model_json).__dict__ - gateway_macsec_config_template_model2 = GatewayMacsecConfigTemplate(**gateway_macsec_config_template_model_dict) + # Construct a model instance of GatewayMacsecPrototype by calling from_dict on the json representation + gateway_macsec_prototype_model_dict = GatewayMacsecPrototype.from_dict(gateway_macsec_prototype_model_json).__dict__ + gateway_macsec_prototype_model2 = GatewayMacsecPrototype(**gateway_macsec_prototype_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_template_model == gateway_macsec_config_template_model2 + assert gateway_macsec_prototype_model == gateway_macsec_prototype_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_template_model_json2 = gateway_macsec_config_template_model.to_dict() - assert gateway_macsec_config_template_model_json2 == gateway_macsec_config_template_model_json + gateway_macsec_prototype_model_json2 = gateway_macsec_prototype_model.to_dict() + assert gateway_macsec_prototype_model_json2 == gateway_macsec_prototype_model_json -class TestModel_GatewayMacsecConfigTemplateFallbackCak: +class TestModel_GatewayMacsecReference: """ - Test Class for GatewayMacsecConfigTemplateFallbackCak + Test Class for GatewayMacsecReference """ - def test_gateway_macsec_config_template_fallback_cak_serialization(self): + def test_gateway_macsec_reference_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigTemplateFallbackCak + Test serialization/deserialization for GatewayMacsecReference """ - # Construct a json representation of a GatewayMacsecConfigTemplateFallbackCak model - gateway_macsec_config_template_fallback_cak_model_json = {} - gateway_macsec_config_template_fallback_cak_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + # Construct dict forms of any model objects needed in order to build this model. + + gateway_macsec_status_reason_model = {} # GatewayMacsecStatusReason + gateway_macsec_status_reason_model['code'] = 'macsec_cak_failed' + gateway_macsec_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_macsec_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' - # Construct a model instance of GatewayMacsecConfigTemplateFallbackCak by calling from_dict on the json representation - gateway_macsec_config_template_fallback_cak_model = GatewayMacsecConfigTemplateFallbackCak.from_dict(gateway_macsec_config_template_fallback_cak_model_json) - assert gateway_macsec_config_template_fallback_cak_model != False + # Construct a json representation of a GatewayMacsecReference model + gateway_macsec_reference_model_json = {} + gateway_macsec_reference_model_json['active'] = True + gateway_macsec_reference_model_json['security_policy'] = 'must_secure' + gateway_macsec_reference_model_json['status'] = 'secured' + gateway_macsec_reference_model_json['status_reasons'] = [gateway_macsec_status_reason_model] - # Construct a model instance of GatewayMacsecConfigTemplateFallbackCak by calling from_dict on the json representation - gateway_macsec_config_template_fallback_cak_model_dict = GatewayMacsecConfigTemplateFallbackCak.from_dict(gateway_macsec_config_template_fallback_cak_model_json).__dict__ - gateway_macsec_config_template_fallback_cak_model2 = GatewayMacsecConfigTemplateFallbackCak(**gateway_macsec_config_template_fallback_cak_model_dict) + # Construct a model instance of GatewayMacsecReference by calling from_dict on the json representation + gateway_macsec_reference_model = GatewayMacsecReference.from_dict(gateway_macsec_reference_model_json) + assert gateway_macsec_reference_model != False + + # Construct a model instance of GatewayMacsecReference by calling from_dict on the json representation + gateway_macsec_reference_model_dict = GatewayMacsecReference.from_dict(gateway_macsec_reference_model_json).__dict__ + gateway_macsec_reference_model2 = GatewayMacsecReference(**gateway_macsec_reference_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_template_fallback_cak_model == gateway_macsec_config_template_fallback_cak_model2 + assert gateway_macsec_reference_model == gateway_macsec_reference_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_template_fallback_cak_model_json2 = gateway_macsec_config_template_fallback_cak_model.to_dict() - assert gateway_macsec_config_template_fallback_cak_model_json2 == gateway_macsec_config_template_fallback_cak_model_json + gateway_macsec_reference_model_json2 = gateway_macsec_reference_model.to_dict() + assert gateway_macsec_reference_model_json2 == gateway_macsec_reference_model_json -class TestModel_GatewayMacsecConfigTemplatePrimaryCak: +class TestModel_GatewayMacsecStatusReason: """ - Test Class for GatewayMacsecConfigTemplatePrimaryCak + Test Class for GatewayMacsecStatusReason """ - def test_gateway_macsec_config_template_primary_cak_serialization(self): + def test_gateway_macsec_status_reason_serialization(self): """ - Test serialization/deserialization for GatewayMacsecConfigTemplatePrimaryCak + Test serialization/deserialization for GatewayMacsecStatusReason """ - # Construct a json representation of a GatewayMacsecConfigTemplatePrimaryCak model - gateway_macsec_config_template_primary_cak_model_json = {} - gateway_macsec_config_template_primary_cak_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + # Construct a json representation of a GatewayMacsecStatusReason model + gateway_macsec_status_reason_model_json = {} + gateway_macsec_status_reason_model_json['code'] = 'macsec_cak_failed' + gateway_macsec_status_reason_model_json['message'] = 'The `authentication_key` failed configuration.' + gateway_macsec_status_reason_model_json['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' - # Construct a model instance of GatewayMacsecConfigTemplatePrimaryCak by calling from_dict on the json representation - gateway_macsec_config_template_primary_cak_model = GatewayMacsecConfigTemplatePrimaryCak.from_dict(gateway_macsec_config_template_primary_cak_model_json) - assert gateway_macsec_config_template_primary_cak_model != False + # Construct a model instance of GatewayMacsecStatusReason by calling from_dict on the json representation + gateway_macsec_status_reason_model = GatewayMacsecStatusReason.from_dict(gateway_macsec_status_reason_model_json) + assert gateway_macsec_status_reason_model != False - # Construct a model instance of GatewayMacsecConfigTemplatePrimaryCak by calling from_dict on the json representation - gateway_macsec_config_template_primary_cak_model_dict = GatewayMacsecConfigTemplatePrimaryCak.from_dict(gateway_macsec_config_template_primary_cak_model_json).__dict__ - gateway_macsec_config_template_primary_cak_model2 = GatewayMacsecConfigTemplatePrimaryCak(**gateway_macsec_config_template_primary_cak_model_dict) + # Construct a model instance of GatewayMacsecStatusReason by calling from_dict on the json representation + gateway_macsec_status_reason_model_dict = GatewayMacsecStatusReason.from_dict(gateway_macsec_status_reason_model_json).__dict__ + gateway_macsec_status_reason_model2 = GatewayMacsecStatusReason(**gateway_macsec_status_reason_model_dict) # Verify the model instances are equivalent - assert gateway_macsec_config_template_primary_cak_model == gateway_macsec_config_template_primary_cak_model2 + assert gateway_macsec_status_reason_model == gateway_macsec_status_reason_model2 # Convert model instance back to dict and verify no loss of data - gateway_macsec_config_template_primary_cak_model_json2 = gateway_macsec_config_template_primary_cak_model.to_dict() - assert gateway_macsec_config_template_primary_cak_model_json2 == gateway_macsec_config_template_primary_cak_model_json + gateway_macsec_status_reason_model_json2 = gateway_macsec_status_reason_model.to_dict() + assert gateway_macsec_status_reason_model_json2 == gateway_macsec_status_reason_model_json class TestModel_GatewayPatchTemplate: @@ -5576,28 +6517,16 @@ def test_gateway_patch_template_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - gateway_patch_template_authentication_key_model = {} # GatewayPatchTemplateAuthenticationKey - gateway_patch_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + authentication_key_identity_model = {} # AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' gateway_bfd_patch_template_model = {} # GatewayBfdPatchTemplate gateway_bfd_patch_template_model['interval'] = 2000 gateway_bfd_patch_template_model['multiplier'] = 10 - gateway_macsec_config_patch_template_fallback_cak_model = {} # GatewayMacsecConfigPatchTemplateFallbackCak - gateway_macsec_config_patch_template_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - gateway_macsec_config_patch_template_primary_cak_model = {} # GatewayMacsecConfigPatchTemplatePrimaryCak - gateway_macsec_config_patch_template_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - - gateway_macsec_config_patch_template_model = {} # GatewayMacsecConfigPatchTemplate - gateway_macsec_config_patch_template_model['active'] = True - gateway_macsec_config_patch_template_model['fallback_cak'] = gateway_macsec_config_patch_template_fallback_cak_model - gateway_macsec_config_patch_template_model['primary_cak'] = gateway_macsec_config_patch_template_primary_cak_model - gateway_macsec_config_patch_template_model['window_size'] = 512 - # Construct a json representation of a GatewayPatchTemplate model gateway_patch_template_model_json = {} - gateway_patch_template_model_json['authentication_key'] = gateway_patch_template_authentication_key_model + gateway_patch_template_model_json['authentication_key'] = authentication_key_identity_model gateway_patch_template_model_json['bfd_config'] = gateway_bfd_patch_template_model gateway_patch_template_model_json['bgp_asn'] = 64999 gateway_patch_template_model_json['bgp_cer_cidr'] = '169.254.0.10/30' @@ -5607,7 +6536,6 @@ def test_gateway_patch_template_serialization(self): gateway_patch_template_model_json['default_import_route_filter'] = 'permit' gateway_patch_template_model_json['global'] = True gateway_patch_template_model_json['loa_reject_reason'] = 'The port mentioned was incorrect' - gateway_patch_template_model_json['macsec_config'] = gateway_macsec_config_patch_template_model gateway_patch_template_model_json['metered'] = False gateway_patch_template_model_json['name'] = 'testGateway' gateway_patch_template_model_json['operational_status'] = 'loa_accepted' @@ -5631,66 +6559,6 @@ def test_gateway_patch_template_serialization(self): assert gateway_patch_template_model_json2 == gateway_patch_template_model_json -class TestModel_GatewayPatchTemplateAuthenticationKey: - """ - Test Class for GatewayPatchTemplateAuthenticationKey - """ - - def test_gateway_patch_template_authentication_key_serialization(self): - """ - Test serialization/deserialization for GatewayPatchTemplateAuthenticationKey - """ - - # Construct a json representation of a GatewayPatchTemplateAuthenticationKey model - gateway_patch_template_authentication_key_model_json = {} - gateway_patch_template_authentication_key_model_json['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' - - # Construct a model instance of GatewayPatchTemplateAuthenticationKey by calling from_dict on the json representation - gateway_patch_template_authentication_key_model = GatewayPatchTemplateAuthenticationKey.from_dict(gateway_patch_template_authentication_key_model_json) - assert gateway_patch_template_authentication_key_model != False - - # Construct a model instance of GatewayPatchTemplateAuthenticationKey by calling from_dict on the json representation - gateway_patch_template_authentication_key_model_dict = GatewayPatchTemplateAuthenticationKey.from_dict(gateway_patch_template_authentication_key_model_json).__dict__ - gateway_patch_template_authentication_key_model2 = GatewayPatchTemplateAuthenticationKey(**gateway_patch_template_authentication_key_model_dict) - - # Verify the model instances are equivalent - assert gateway_patch_template_authentication_key_model == gateway_patch_template_authentication_key_model2 - - # Convert model instance back to dict and verify no loss of data - gateway_patch_template_authentication_key_model_json2 = gateway_patch_template_authentication_key_model.to_dict() - assert gateway_patch_template_authentication_key_model_json2 == gateway_patch_template_authentication_key_model_json - - -class TestModel_GatewayPort: - """ - Test Class for GatewayPort - """ - - def test_gateway_port_serialization(self): - """ - Test serialization/deserialization for GatewayPort - """ - - # Construct a json representation of a GatewayPort model - gateway_port_model_json = {} - gateway_port_model_json['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' - - # Construct a model instance of GatewayPort by calling from_dict on the json representation - gateway_port_model = GatewayPort.from_dict(gateway_port_model_json) - assert gateway_port_model != False - - # Construct a model instance of GatewayPort by calling from_dict on the json representation - gateway_port_model_dict = GatewayPort.from_dict(gateway_port_model_json).__dict__ - gateway_port_model2 = GatewayPort(**gateway_port_model_dict) - - # Verify the model instances are equivalent - assert gateway_port_model == gateway_port_model2 - - # Convert model instance back to dict and verify no loss of data - gateway_port_model_json2 = gateway_port_model.to_dict() - assert gateway_port_model_json2 == gateway_port_model_json - - class TestModel_GatewayPortIdentity: """ Test Class for GatewayPortIdentity @@ -5721,6 +6589,36 @@ def test_gateway_port_identity_serialization(self): assert gateway_port_identity_model_json2 == gateway_port_identity_model_json +class TestModel_GatewayPortReference: + """ + Test Class for GatewayPortReference + """ + + def test_gateway_port_reference_serialization(self): + """ + Test serialization/deserialization for GatewayPortReference + """ + + # Construct a json representation of a GatewayPortReference model + gateway_port_reference_model_json = {} + gateway_port_reference_model_json['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' + + # Construct a model instance of GatewayPortReference by calling from_dict on the json representation + gateway_port_reference_model = GatewayPortReference.from_dict(gateway_port_reference_model_json) + assert gateway_port_reference_model != False + + # Construct a model instance of GatewayPortReference by calling from_dict on the json representation + gateway_port_reference_model_dict = GatewayPortReference.from_dict(gateway_port_reference_model_json).__dict__ + gateway_port_reference_model2 = GatewayPortReference(**gateway_port_reference_model_dict) + + # Verify the model instances are equivalent + assert gateway_port_reference_model == gateway_port_reference_model2 + + # Convert model instance back to dict and verify no loss of data + gateway_port_reference_model_json2 = gateway_port_reference_model.to_dict() + assert gateway_port_reference_model_json2 == gateway_port_reference_model_json + + class TestModel_GatewayStatistic: """ Test Class for GatewayStatistic @@ -5827,34 +6725,36 @@ def test_gateway_status_collection_serialization(self): assert gateway_status_collection_model_json2 == gateway_status_collection_model_json -class TestModel_GatewayTemplateAuthenticationKey: +class TestModel_GatewayStatusReason: """ - Test Class for GatewayTemplateAuthenticationKey + Test Class for GatewayStatusReason """ - def test_gateway_template_authentication_key_serialization(self): + def test_gateway_status_reason_serialization(self): """ - Test serialization/deserialization for GatewayTemplateAuthenticationKey + Test serialization/deserialization for GatewayStatusReason """ - # Construct a json representation of a GatewayTemplateAuthenticationKey model - gateway_template_authentication_key_model_json = {} - gateway_template_authentication_key_model_json['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + # Construct a json representation of a GatewayStatusReason model + gateway_status_reason_model_json = {} + gateway_status_reason_model_json['code'] = 'authentication_key_failed' + gateway_status_reason_model_json['message'] = 'The `authentication_key` failed configuration.' + gateway_status_reason_model_json['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' - # Construct a model instance of GatewayTemplateAuthenticationKey by calling from_dict on the json representation - gateway_template_authentication_key_model = GatewayTemplateAuthenticationKey.from_dict(gateway_template_authentication_key_model_json) - assert gateway_template_authentication_key_model != False + # Construct a model instance of GatewayStatusReason by calling from_dict on the json representation + gateway_status_reason_model = GatewayStatusReason.from_dict(gateway_status_reason_model_json) + assert gateway_status_reason_model != False - # Construct a model instance of GatewayTemplateAuthenticationKey by calling from_dict on the json representation - gateway_template_authentication_key_model_dict = GatewayTemplateAuthenticationKey.from_dict(gateway_template_authentication_key_model_json).__dict__ - gateway_template_authentication_key_model2 = GatewayTemplateAuthenticationKey(**gateway_template_authentication_key_model_dict) + # Construct a model instance of GatewayStatusReason by calling from_dict on the json representation + gateway_status_reason_model_dict = GatewayStatusReason.from_dict(gateway_status_reason_model_json).__dict__ + gateway_status_reason_model2 = GatewayStatusReason(**gateway_status_reason_model_dict) # Verify the model instances are equivalent - assert gateway_template_authentication_key_model == gateway_template_authentication_key_model2 + assert gateway_status_reason_model == gateway_status_reason_model2 # Convert model instance back to dict and verify no loss of data - gateway_template_authentication_key_model_json2 = gateway_template_authentication_key_model.to_dict() - assert gateway_template_authentication_key_model_json2 == gateway_template_authentication_key_model_json + gateway_status_reason_model_json2 = gateway_status_reason_model.to_dict() + assert gateway_status_reason_model_json2 == gateway_status_reason_model_json class TestModel_GatewayTemplateRouteFilter: @@ -5967,6 +6867,97 @@ def test_gateway_virtual_connection_collection_serialization(self): assert gateway_virtual_connection_collection_model_json2 == gateway_virtual_connection_collection_model_json +class TestModel_GatewayVirtualConnectionPatchTemplate: + """ + Test Class for GatewayVirtualConnectionPatchTemplate + """ + + def test_gateway_virtual_connection_patch_template_serialization(self): + """ + Test serialization/deserialization for GatewayVirtualConnectionPatchTemplate + """ + + # Construct a json representation of a GatewayVirtualConnectionPatchTemplate model + gateway_virtual_connection_patch_template_model_json = {} + gateway_virtual_connection_patch_template_model_json['name'] = 'newConnectionName' + gateway_virtual_connection_patch_template_model_json['status'] = 'attached' + + # Construct a model instance of GatewayVirtualConnectionPatchTemplate by calling from_dict on the json representation + gateway_virtual_connection_patch_template_model = GatewayVirtualConnectionPatchTemplate.from_dict(gateway_virtual_connection_patch_template_model_json) + assert gateway_virtual_connection_patch_template_model != False + + # Construct a model instance of GatewayVirtualConnectionPatchTemplate by calling from_dict on the json representation + gateway_virtual_connection_patch_template_model_dict = GatewayVirtualConnectionPatchTemplate.from_dict(gateway_virtual_connection_patch_template_model_json).__dict__ + gateway_virtual_connection_patch_template_model2 = GatewayVirtualConnectionPatchTemplate(**gateway_virtual_connection_patch_template_model_dict) + + # Verify the model instances are equivalent + assert gateway_virtual_connection_patch_template_model == gateway_virtual_connection_patch_template_model2 + + # Convert model instance back to dict and verify no loss of data + gateway_virtual_connection_patch_template_model_json2 = gateway_virtual_connection_patch_template_model.to_dict() + assert gateway_virtual_connection_patch_template_model_json2 == gateway_virtual_connection_patch_template_model_json + + +class TestModel_HpcsKeyIdentity: + """ + Test Class for HpcsKeyIdentity + """ + + def test_hpcs_key_identity_serialization(self): + """ + Test serialization/deserialization for HpcsKeyIdentity + """ + + # Construct a json representation of a HpcsKeyIdentity model + hpcs_key_identity_model_json = {} + hpcs_key_identity_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a model instance of HpcsKeyIdentity by calling from_dict on the json representation + hpcs_key_identity_model = HpcsKeyIdentity.from_dict(hpcs_key_identity_model_json) + assert hpcs_key_identity_model != False + + # Construct a model instance of HpcsKeyIdentity by calling from_dict on the json representation + hpcs_key_identity_model_dict = HpcsKeyIdentity.from_dict(hpcs_key_identity_model_json).__dict__ + hpcs_key_identity_model2 = HpcsKeyIdentity(**hpcs_key_identity_model_dict) + + # Verify the model instances are equivalent + assert hpcs_key_identity_model == hpcs_key_identity_model2 + + # Convert model instance back to dict and verify no loss of data + hpcs_key_identity_model_json2 = hpcs_key_identity_model.to_dict() + assert hpcs_key_identity_model_json2 == hpcs_key_identity_model_json + + +class TestModel_HpcsKeyReference: + """ + Test Class for HpcsKeyReference + """ + + def test_hpcs_key_reference_serialization(self): + """ + Test serialization/deserialization for HpcsKeyReference + """ + + # Construct a json representation of a HpcsKeyReference model + hpcs_key_reference_model_json = {} + hpcs_key_reference_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a model instance of HpcsKeyReference by calling from_dict on the json representation + hpcs_key_reference_model = HpcsKeyReference.from_dict(hpcs_key_reference_model_json) + assert hpcs_key_reference_model != False + + # Construct a model instance of HpcsKeyReference by calling from_dict on the json representation + hpcs_key_reference_model_dict = HpcsKeyReference.from_dict(hpcs_key_reference_model_json).__dict__ + hpcs_key_reference_model2 = HpcsKeyReference(**hpcs_key_reference_model_dict) + + # Verify the model instances are equivalent + assert hpcs_key_reference_model == hpcs_key_reference_model2 + + # Convert model instance back to dict and verify no loss of data + hpcs_key_reference_model_json2 = hpcs_key_reference_model.to_dict() + assert hpcs_key_reference_model_json2 == hpcs_key_reference_model_json + + class TestModel_ImportRouteFilterCollection: """ Test Class for ImportRouteFilterCollection @@ -6068,7 +7059,7 @@ def test_location_cross_connect_router_collection_serialization(self): # Construct dict forms of any model objects needed in order to build this model. cross_connect_router_model = {} # CrossConnectRouter - cross_connect_router_model['capabilities'] = ['non_macsec', 'macsec'] + cross_connect_router_model['capabilities'] = ['testString'] cross_connect_router_model['router_name'] = 'xcr01.dal03' cross_connect_router_model['total_connections'] = 1 @@ -6829,6 +7820,126 @@ def test_update_route_filter_template_serialization(self): assert update_route_filter_template_model_json2 == update_route_filter_template_model_json +class TestModel_AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity: + """ + Test Class for AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity + """ + + def test_authentication_key_identity_hpcs_authentication_key_identity_serialization(self): + """ + Test serialization/deserialization for AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity + """ + + # Construct a json representation of a AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity model + authentication_key_identity_hpcs_authentication_key_identity_model_json = {} + authentication_key_identity_hpcs_authentication_key_identity_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a model instance of AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity by calling from_dict on the json representation + authentication_key_identity_hpcs_authentication_key_identity_model = AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity.from_dict(authentication_key_identity_hpcs_authentication_key_identity_model_json) + assert authentication_key_identity_hpcs_authentication_key_identity_model != False + + # Construct a model instance of AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity by calling from_dict on the json representation + authentication_key_identity_hpcs_authentication_key_identity_model_dict = AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity.from_dict(authentication_key_identity_hpcs_authentication_key_identity_model_json).__dict__ + authentication_key_identity_hpcs_authentication_key_identity_model2 = AuthenticationKeyIdentityHpcsAuthenticationKeyIdentity(**authentication_key_identity_hpcs_authentication_key_identity_model_dict) + + # Verify the model instances are equivalent + assert authentication_key_identity_hpcs_authentication_key_identity_model == authentication_key_identity_hpcs_authentication_key_identity_model2 + + # Convert model instance back to dict and verify no loss of data + authentication_key_identity_hpcs_authentication_key_identity_model_json2 = authentication_key_identity_hpcs_authentication_key_identity_model.to_dict() + assert authentication_key_identity_hpcs_authentication_key_identity_model_json2 == authentication_key_identity_hpcs_authentication_key_identity_model_json + + +class TestModel_AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity: + """ + Test Class for AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity + """ + + def test_authentication_key_identity_key_protect_authentication_key_identity_serialization(self): + """ + Test serialization/deserialization for AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity + """ + + # Construct a json representation of a AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity model + authentication_key_identity_key_protect_authentication_key_identity_model_json = {} + authentication_key_identity_key_protect_authentication_key_identity_model_json['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a model instance of AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity by calling from_dict on the json representation + authentication_key_identity_key_protect_authentication_key_identity_model = AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity.from_dict(authentication_key_identity_key_protect_authentication_key_identity_model_json) + assert authentication_key_identity_key_protect_authentication_key_identity_model != False + + # Construct a model instance of AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity by calling from_dict on the json representation + authentication_key_identity_key_protect_authentication_key_identity_model_dict = AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity.from_dict(authentication_key_identity_key_protect_authentication_key_identity_model_json).__dict__ + authentication_key_identity_key_protect_authentication_key_identity_model2 = AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity(**authentication_key_identity_key_protect_authentication_key_identity_model_dict) + + # Verify the model instances are equivalent + assert authentication_key_identity_key_protect_authentication_key_identity_model == authentication_key_identity_key_protect_authentication_key_identity_model2 + + # Convert model instance back to dict and verify no loss of data + authentication_key_identity_key_protect_authentication_key_identity_model_json2 = authentication_key_identity_key_protect_authentication_key_identity_model.to_dict() + assert authentication_key_identity_key_protect_authentication_key_identity_model_json2 == authentication_key_identity_key_protect_authentication_key_identity_model_json + + +class TestModel_AuthenticationKeyReferenceHpcsAuthenticationKeyReference: + """ + Test Class for AuthenticationKeyReferenceHpcsAuthenticationKeyReference + """ + + def test_authentication_key_reference_hpcs_authentication_key_reference_serialization(self): + """ + Test serialization/deserialization for AuthenticationKeyReferenceHpcsAuthenticationKeyReference + """ + + # Construct a json representation of a AuthenticationKeyReferenceHpcsAuthenticationKeyReference model + authentication_key_reference_hpcs_authentication_key_reference_model_json = {} + authentication_key_reference_hpcs_authentication_key_reference_model_json['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a model instance of AuthenticationKeyReferenceHpcsAuthenticationKeyReference by calling from_dict on the json representation + authentication_key_reference_hpcs_authentication_key_reference_model = AuthenticationKeyReferenceHpcsAuthenticationKeyReference.from_dict(authentication_key_reference_hpcs_authentication_key_reference_model_json) + assert authentication_key_reference_hpcs_authentication_key_reference_model != False + + # Construct a model instance of AuthenticationKeyReferenceHpcsAuthenticationKeyReference by calling from_dict on the json representation + authentication_key_reference_hpcs_authentication_key_reference_model_dict = AuthenticationKeyReferenceHpcsAuthenticationKeyReference.from_dict(authentication_key_reference_hpcs_authentication_key_reference_model_json).__dict__ + authentication_key_reference_hpcs_authentication_key_reference_model2 = AuthenticationKeyReferenceHpcsAuthenticationKeyReference(**authentication_key_reference_hpcs_authentication_key_reference_model_dict) + + # Verify the model instances are equivalent + assert authentication_key_reference_hpcs_authentication_key_reference_model == authentication_key_reference_hpcs_authentication_key_reference_model2 + + # Convert model instance back to dict and verify no loss of data + authentication_key_reference_hpcs_authentication_key_reference_model_json2 = authentication_key_reference_hpcs_authentication_key_reference_model.to_dict() + assert authentication_key_reference_hpcs_authentication_key_reference_model_json2 == authentication_key_reference_hpcs_authentication_key_reference_model_json + + +class TestModel_AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference: + """ + Test Class for AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference + """ + + def test_authentication_key_reference_key_protect_authentication_key_reference_serialization(self): + """ + Test serialization/deserialization for AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference + """ + + # Construct a json representation of a AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference model + authentication_key_reference_key_protect_authentication_key_reference_model_json = {} + authentication_key_reference_key_protect_authentication_key_reference_model_json['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + # Construct a model instance of AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference by calling from_dict on the json representation + authentication_key_reference_key_protect_authentication_key_reference_model = AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference.from_dict(authentication_key_reference_key_protect_authentication_key_reference_model_json) + assert authentication_key_reference_key_protect_authentication_key_reference_model != False + + # Construct a model instance of AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference by calling from_dict on the json representation + authentication_key_reference_key_protect_authentication_key_reference_model_dict = AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference.from_dict(authentication_key_reference_key_protect_authentication_key_reference_model_json).__dict__ + authentication_key_reference_key_protect_authentication_key_reference_model2 = AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference(**authentication_key_reference_key_protect_authentication_key_reference_model_dict) + + # Verify the model instances are equivalent + assert authentication_key_reference_key_protect_authentication_key_reference_model == authentication_key_reference_key_protect_authentication_key_reference_model2 + + # Convert model instance back to dict and verify no loss of data + authentication_key_reference_key_protect_authentication_key_reference_model_json2 = authentication_key_reference_key_protect_authentication_key_reference_model.to_dict() + assert authentication_key_reference_key_protect_authentication_key_reference_model_json2 == authentication_key_reference_key_protect_authentication_key_reference_model_json + + class TestModel_GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate: """ Test Class for GatewayActionTemplateUpdatesItemGatewayClientBGPASNUpdate @@ -7179,8 +8290,8 @@ def test_gateway_collection_gateways_item_cross_account_gateway_serialization(se # Construct dict forms of any model objects needed in order to build this model. - cross_account_gateway_port_model = {} # CrossAccountGatewayPort - cross_account_gateway_port_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' + gateway_port_reference_model = {} # GatewayPortReference + gateway_port_reference_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' # Construct a json representation of a GatewayCollectionGatewaysItemCrossAccountGateway model gateway_collection_gateways_item_cross_account_gateway_model_json = {} @@ -7199,7 +8310,7 @@ def test_gateway_collection_gateways_item_cross_account_gateway_serialization(se gateway_collection_gateways_item_cross_account_gateway_model_json['location_name'] = 'dal03' gateway_collection_gateways_item_cross_account_gateway_model_json['name'] = 'myGateway' gateway_collection_gateways_item_cross_account_gateway_model_json['operational_status'] = 'awaiting_completion_notice' - gateway_collection_gateways_item_cross_account_gateway_model_json['port'] = cross_account_gateway_port_model + gateway_collection_gateways_item_cross_account_gateway_model_json['port'] = gateway_port_reference_model gateway_collection_gateways_item_cross_account_gateway_model_json['speed_mbps'] = 1000 gateway_collection_gateways_item_cross_account_gateway_model_json['type'] = 'dedicated' @@ -7240,8 +8351,8 @@ def test_gateway_collection_gateways_item_gateway_serialization(self): as_prepend_model['specific_prefixes'] = ['192.168.3.0/24'] as_prepend_model['updated_at'] = '2019-01-01T12:00:00Z' - gateway_authentication_key_model = {} # GatewayAuthenticationKey - gateway_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + authentication_key_reference_model = {} # AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference + authentication_key_reference_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' gateway_bfd_config_model = {} # GatewayBfdConfig gateway_bfd_config_model['bfd_status'] = 'up' @@ -7252,34 +8363,24 @@ def test_gateway_collection_gateways_item_gateway_serialization(self): gateway_change_request_model = {} # GatewayChangeRequestGatewayClientGatewayCreate gateway_change_request_model['type'] = 'create_gateway' - gateway_macsec_config_active_cak_model = {} # GatewayMacsecConfigActiveCak - gateway_macsec_config_active_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_active_cak_model['status'] = 'testString' - - gateway_macsec_config_fallback_cak_model = {} # GatewayMacsecConfigFallbackCak - gateway_macsec_config_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_fallback_cak_model['status'] = 'testString' - - gateway_macsec_config_primary_cak_model = {} # GatewayMacsecConfigPrimaryCak - gateway_macsec_config_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_primary_cak_model['status'] = 'testString' - - gateway_macsec_config_model = {} # GatewayMacsecConfig - gateway_macsec_config_model['active'] = True - gateway_macsec_config_model['active_cak'] = gateway_macsec_config_active_cak_model - gateway_macsec_config_model['cipher_suite'] = 'gcm_aes_xpn_256' - gateway_macsec_config_model['confidentiality_offset'] = 0 - gateway_macsec_config_model['cryptographic_algorithm'] = 'aes_256_cmac' - gateway_macsec_config_model['fallback_cak'] = gateway_macsec_config_fallback_cak_model - gateway_macsec_config_model['key_server_priority'] = 255 - gateway_macsec_config_model['primary_cak'] = gateway_macsec_config_primary_cak_model - gateway_macsec_config_model['sak_expiry_time'] = 3600 - gateway_macsec_config_model['security_policy'] = 'must_secure' - gateway_macsec_config_model['status'] = 'secured' - gateway_macsec_config_model['window_size'] = 64 - - gateway_port_model = {} # GatewayPort - gateway_port_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' + gateway_macsec_status_reason_model = {} # GatewayMacsecStatusReason + gateway_macsec_status_reason_model['code'] = 'macsec_cak_failed' + gateway_macsec_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_macsec_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + gateway_macsec_reference_model = {} # GatewayMacsecReference + gateway_macsec_reference_model['active'] = True + gateway_macsec_reference_model['security_policy'] = 'must_secure' + gateway_macsec_reference_model['status'] = 'secured' + gateway_macsec_reference_model['status_reasons'] = [gateway_macsec_status_reason_model] + + gateway_status_reason_model = {} # GatewayStatusReason + gateway_status_reason_model['code'] = 'authentication_key_failed' + gateway_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + gateway_port_reference_model = {} # GatewayPortReference + gateway_port_reference_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' resource_group_reference_model = {} # ResourceGroupReference resource_group_reference_model['id'] = '56969d6043e9465c883cb9f7363e78e8' @@ -7287,7 +8388,7 @@ def test_gateway_collection_gateways_item_gateway_serialization(self): # Construct a json representation of a GatewayCollectionGatewaysItemGateway model gateway_collection_gateways_item_gateway_model_json = {} gateway_collection_gateways_item_gateway_model_json['as_prepends'] = [as_prepend_model] - gateway_collection_gateways_item_gateway_model_json['authentication_key'] = gateway_authentication_key_model + gateway_collection_gateways_item_gateway_model_json['authentication_key'] = authentication_key_reference_model gateway_collection_gateways_item_gateway_model_json['bfd_config'] = gateway_bfd_config_model gateway_collection_gateways_item_gateway_model_json['bgp_asn'] = 64999 gateway_collection_gateways_item_gateway_model_json['bgp_base_cidr'] = 'testString' @@ -7313,15 +8414,17 @@ def test_gateway_collection_gateways_item_gateway_serialization(self): gateway_collection_gateways_item_gateway_model_json['link_status_updated_at'] = '2020-08-20T06:58:41.909000Z' gateway_collection_gateways_item_gateway_model_json['location_display_name'] = 'Dallas 03' gateway_collection_gateways_item_gateway_model_json['location_name'] = 'dal03' - gateway_collection_gateways_item_gateway_model_json['macsec_config'] = gateway_macsec_config_model + gateway_collection_gateways_item_gateway_model_json['macsec'] = gateway_macsec_reference_model + gateway_collection_gateways_item_gateway_model_json['macsec_capability'] = 'non_macsec' gateway_collection_gateways_item_gateway_model_json['metered'] = False gateway_collection_gateways_item_gateway_model_json['name'] = 'myGateway' gateway_collection_gateways_item_gateway_model_json['operational_status'] = 'awaiting_completion_notice' - gateway_collection_gateways_item_gateway_model_json['port'] = gateway_port_model + gateway_collection_gateways_item_gateway_model_json['operational_status_reasons'] = [gateway_status_reason_model] + gateway_collection_gateways_item_gateway_model_json['patch_panel_completion_notice'] = 'patch panel configuration details' + gateway_collection_gateways_item_gateway_model_json['port'] = gateway_port_reference_model gateway_collection_gateways_item_gateway_model_json['provider_api_managed'] = False gateway_collection_gateways_item_gateway_model_json['resource_group'] = resource_group_reference_model gateway_collection_gateways_item_gateway_model_json['speed_mbps'] = 1000 - gateway_collection_gateways_item_gateway_model_json['patch_panel_completion_notice'] = 'patch panel configuration details' gateway_collection_gateways_item_gateway_model_json['type'] = 'dedicated' gateway_collection_gateways_item_gateway_model_json['vlan'] = 10 @@ -7455,8 +8558,8 @@ def test_gateway_template_gateway_type_connect_template_serialization(self): as_prepend_template_model['prefix'] = '172.17.0.0/16' as_prepend_template_model['specific_prefixes'] = ['192.168.3.0/24'] - gateway_template_authentication_key_model = {} # GatewayTemplateAuthenticationKey - gateway_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + authentication_key_identity_model = {} # AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' gateway_bfd_config_template_model = {} # GatewayBfdConfigTemplate gateway_bfd_config_template_model['interval'] = 2000 @@ -7477,7 +8580,7 @@ def test_gateway_template_gateway_type_connect_template_serialization(self): # Construct a json representation of a GatewayTemplateGatewayTypeConnectTemplate model gateway_template_gateway_type_connect_template_model_json = {} gateway_template_gateway_type_connect_template_model_json['as_prepends'] = [as_prepend_template_model] - gateway_template_gateway_type_connect_template_model_json['authentication_key'] = gateway_template_authentication_key_model + gateway_template_gateway_type_connect_template_model_json['authentication_key'] = authentication_key_identity_model gateway_template_gateway_type_connect_template_model_json['bfd_config'] = gateway_bfd_config_template_model gateway_template_gateway_type_connect_template_model_json['bgp_asn'] = 64999 gateway_template_gateway_type_connect_template_model_json['bgp_base_cidr'] = 'testString' @@ -7531,8 +8634,8 @@ def test_gateway_template_gateway_type_dedicated_template_serialization(self): as_prepend_template_model['prefix'] = '172.17.0.0/16' as_prepend_template_model['specific_prefixes'] = ['192.168.3.0/24'] - gateway_template_authentication_key_model = {} # GatewayTemplateAuthenticationKey - gateway_template_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + authentication_key_identity_model = {} # AuthenticationKeyIdentityKeyProtectAuthenticationKeyIdentity + authentication_key_identity_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' gateway_bfd_config_template_model = {} # GatewayBfdConfigTemplate gateway_bfd_config_template_model['interval'] = 2000 @@ -7547,22 +8650,29 @@ def test_gateway_template_gateway_type_dedicated_template_serialization(self): resource_group_identity_model = {} # ResourceGroupIdentity resource_group_identity_model['id'] = '56969d6043e9465c883cb9f7363e78e8' - gateway_macsec_config_template_fallback_cak_model = {} # GatewayMacsecConfigTemplateFallbackCak - gateway_macsec_config_template_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + hpcs_key_identity_model = {} # HpcsKeyIdentity + hpcs_key_identity_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + + gateway_macsec_cak_prototype_model = {} # GatewayMacsecCakPrototype + gateway_macsec_cak_prototype_model['key'] = hpcs_key_identity_model + gateway_macsec_cak_prototype_model['name'] = '1000' + gateway_macsec_cak_prototype_model['session'] = 'primary' - gateway_macsec_config_template_primary_cak_model = {} # GatewayMacsecConfigTemplatePrimaryCak - gateway_macsec_config_template_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' + sak_rekey_prototype_model = {} # SakRekeyPrototypeSakRekeyTimerModePrototype + sak_rekey_prototype_model['interval'] = 3600 + sak_rekey_prototype_model['mode'] = 'timer' - gateway_macsec_config_template_model = {} # GatewayMacsecConfigTemplate - gateway_macsec_config_template_model['active'] = True - gateway_macsec_config_template_model['fallback_cak'] = gateway_macsec_config_template_fallback_cak_model - gateway_macsec_config_template_model['primary_cak'] = gateway_macsec_config_template_primary_cak_model - gateway_macsec_config_template_model['window_size'] = 148809600 + gateway_macsec_prototype_model = {} # GatewayMacsecPrototype + gateway_macsec_prototype_model['active'] = True + gateway_macsec_prototype_model['caks'] = [gateway_macsec_cak_prototype_model] + gateway_macsec_prototype_model['sak_rekey'] = sak_rekey_prototype_model + gateway_macsec_prototype_model['security_policy'] = 'must_secure' + gateway_macsec_prototype_model['window_size'] = 64 # Construct a json representation of a GatewayTemplateGatewayTypeDedicatedTemplate model gateway_template_gateway_type_dedicated_template_model_json = {} gateway_template_gateway_type_dedicated_template_model_json['as_prepends'] = [as_prepend_template_model] - gateway_template_gateway_type_dedicated_template_model_json['authentication_key'] = gateway_template_authentication_key_model + gateway_template_gateway_type_dedicated_template_model_json['authentication_key'] = authentication_key_identity_model gateway_template_gateway_type_dedicated_template_model_json['bfd_config'] = gateway_bfd_config_template_model gateway_template_gateway_type_dedicated_template_model_json['bgp_asn'] = 64999 gateway_template_gateway_type_dedicated_template_model_json['bgp_base_cidr'] = 'testString' @@ -7584,7 +8694,8 @@ def test_gateway_template_gateway_type_dedicated_template_serialization(self): gateway_template_gateway_type_dedicated_template_model_json['cross_connect_router'] = 'xcr01.dal03' gateway_template_gateway_type_dedicated_template_model_json['customer_name'] = 'newCustomerName' gateway_template_gateway_type_dedicated_template_model_json['location_name'] = 'dal03' - gateway_template_gateway_type_dedicated_template_model_json['macsec_config'] = gateway_macsec_config_template_model + gateway_template_gateway_type_dedicated_template_model_json['macsec'] = gateway_macsec_prototype_model + gateway_template_gateway_type_dedicated_template_model_json['macsec_capability'] = 'non_macsec' gateway_template_gateway_type_dedicated_template_model_json['vlan'] = 10 # Construct a model instance of GatewayTemplateGatewayTypeDedicatedTemplate by calling from_dict on the json representation @@ -7615,8 +8726,8 @@ def test_get_gateway_response_cross_account_gateway_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - cross_account_gateway_port_model = {} # CrossAccountGatewayPort - cross_account_gateway_port_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' + gateway_port_reference_model = {} # GatewayPortReference + gateway_port_reference_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' # Construct a json representation of a GetGatewayResponseCrossAccountGateway model get_gateway_response_cross_account_gateway_model_json = {} @@ -7635,7 +8746,7 @@ def test_get_gateway_response_cross_account_gateway_serialization(self): get_gateway_response_cross_account_gateway_model_json['location_name'] = 'dal03' get_gateway_response_cross_account_gateway_model_json['name'] = 'myGateway' get_gateway_response_cross_account_gateway_model_json['operational_status'] = 'awaiting_completion_notice' - get_gateway_response_cross_account_gateway_model_json['port'] = cross_account_gateway_port_model + get_gateway_response_cross_account_gateway_model_json['port'] = gateway_port_reference_model get_gateway_response_cross_account_gateway_model_json['speed_mbps'] = 1000 get_gateway_response_cross_account_gateway_model_json['type'] = 'dedicated' @@ -7676,8 +8787,8 @@ def test_get_gateway_response_gateway_serialization(self): as_prepend_model['specific_prefixes'] = ['192.168.3.0/24'] as_prepend_model['updated_at'] = '2019-01-01T12:00:00Z' - gateway_authentication_key_model = {} # GatewayAuthenticationKey - gateway_authentication_key_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/766d8d374a484f029d0fca5a40a52a1c:5d343839-07d3-4213-a950-0f71ed45423f:key:7fc1a0ba-4633-48cb-997b-5749787c952c' + authentication_key_reference_model = {} # AuthenticationKeyReferenceKeyProtectAuthenticationKeyReference + authentication_key_reference_model['crn'] = 'crn:v1:bluemix:public:kms:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' gateway_bfd_config_model = {} # GatewayBfdConfig gateway_bfd_config_model['bfd_status'] = 'up' @@ -7688,34 +8799,24 @@ def test_get_gateway_response_gateway_serialization(self): gateway_change_request_model = {} # GatewayChangeRequestGatewayClientGatewayCreate gateway_change_request_model['type'] = 'create_gateway' - gateway_macsec_config_active_cak_model = {} # GatewayMacsecConfigActiveCak - gateway_macsec_config_active_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_active_cak_model['status'] = 'testString' - - gateway_macsec_config_fallback_cak_model = {} # GatewayMacsecConfigFallbackCak - gateway_macsec_config_fallback_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_fallback_cak_model['status'] = 'testString' - - gateway_macsec_config_primary_cak_model = {} # GatewayMacsecConfigPrimaryCak - gateway_macsec_config_primary_cak_model['crn'] = 'crn:v1:bluemix:public:hs-crypto:us-south:a/4111d05f36894e3cb9b46a43556d9000:abc111b8-37aa-4034-9def-f2607c87aaaa:key:bbb222bc-430a-4de9-9aad-84e5bb022222' - gateway_macsec_config_primary_cak_model['status'] = 'testString' - - gateway_macsec_config_model = {} # GatewayMacsecConfig - gateway_macsec_config_model['active'] = True - gateway_macsec_config_model['active_cak'] = gateway_macsec_config_active_cak_model - gateway_macsec_config_model['cipher_suite'] = 'gcm_aes_xpn_256' - gateway_macsec_config_model['confidentiality_offset'] = 0 - gateway_macsec_config_model['cryptographic_algorithm'] = 'aes_256_cmac' - gateway_macsec_config_model['fallback_cak'] = gateway_macsec_config_fallback_cak_model - gateway_macsec_config_model['key_server_priority'] = 255 - gateway_macsec_config_model['primary_cak'] = gateway_macsec_config_primary_cak_model - gateway_macsec_config_model['sak_expiry_time'] = 3600 - gateway_macsec_config_model['security_policy'] = 'must_secure' - gateway_macsec_config_model['status'] = 'secured' - gateway_macsec_config_model['window_size'] = 64 - - gateway_port_model = {} # GatewayPort - gateway_port_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' + gateway_macsec_status_reason_model = {} # GatewayMacsecStatusReason + gateway_macsec_status_reason_model['code'] = 'macsec_cak_failed' + gateway_macsec_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_macsec_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + gateway_macsec_reference_model = {} # GatewayMacsecReference + gateway_macsec_reference_model['active'] = True + gateway_macsec_reference_model['security_policy'] = 'must_secure' + gateway_macsec_reference_model['status'] = 'secured' + gateway_macsec_reference_model['status_reasons'] = [gateway_macsec_status_reason_model] + + gateway_status_reason_model = {} # GatewayStatusReason + gateway_status_reason_model['code'] = 'authentication_key_failed' + gateway_status_reason_model['message'] = 'The `authentication_key` failed configuration.' + gateway_status_reason_model['more_info'] = 'https://cloud.ibm.com/docs/dl/TODO_ADD_DOCS_LINK' + + gateway_port_reference_model = {} # GatewayPortReference + gateway_port_reference_model['id'] = '54321b1a-fee4-41c7-9e11-9cd99e000aaa' resource_group_reference_model = {} # ResourceGroupReference resource_group_reference_model['id'] = '56969d6043e9465c883cb9f7363e78e8' @@ -7723,7 +8824,7 @@ def test_get_gateway_response_gateway_serialization(self): # Construct a json representation of a GetGatewayResponseGateway model get_gateway_response_gateway_model_json = {} get_gateway_response_gateway_model_json['as_prepends'] = [as_prepend_model] - get_gateway_response_gateway_model_json['authentication_key'] = gateway_authentication_key_model + get_gateway_response_gateway_model_json['authentication_key'] = authentication_key_reference_model get_gateway_response_gateway_model_json['bfd_config'] = gateway_bfd_config_model get_gateway_response_gateway_model_json['bgp_asn'] = 64999 get_gateway_response_gateway_model_json['bgp_base_cidr'] = 'testString' @@ -7749,15 +8850,17 @@ def test_get_gateway_response_gateway_serialization(self): get_gateway_response_gateway_model_json['link_status_updated_at'] = '2020-08-20T06:58:41.909000Z' get_gateway_response_gateway_model_json['location_display_name'] = 'Dallas 03' get_gateway_response_gateway_model_json['location_name'] = 'dal03' - get_gateway_response_gateway_model_json['macsec_config'] = gateway_macsec_config_model + get_gateway_response_gateway_model_json['macsec'] = gateway_macsec_reference_model + get_gateway_response_gateway_model_json['macsec_capability'] = 'non_macsec' get_gateway_response_gateway_model_json['metered'] = False get_gateway_response_gateway_model_json['name'] = 'myGateway' get_gateway_response_gateway_model_json['operational_status'] = 'awaiting_completion_notice' - get_gateway_response_gateway_model_json['port'] = gateway_port_model + get_gateway_response_gateway_model_json['operational_status_reasons'] = [gateway_status_reason_model] + get_gateway_response_gateway_model_json['patch_panel_completion_notice'] = 'patch panel configuration details' + get_gateway_response_gateway_model_json['port'] = gateway_port_reference_model get_gateway_response_gateway_model_json['provider_api_managed'] = False get_gateway_response_gateway_model_json['resource_group'] = resource_group_reference_model get_gateway_response_gateway_model_json['speed_mbps'] = 1000 - get_gateway_response_gateway_model_json['patch_panel_completion_notice'] = 'patch panel configuration details' get_gateway_response_gateway_model_json['type'] = 'dedicated' get_gateway_response_gateway_model_json['vlan'] = 10 @@ -7840,7 +8943,190 @@ def test_route_report_overlapping_route_for_others_serialization(self): assert route_report_overlapping_route_for_others_model_json2 == route_report_overlapping_route_for_others_model_json +class TestModel_SakRekeyPacketNumberRolloverMode: + """ + Test Class for SakRekeyPacketNumberRolloverMode + """ + + def test_sak_rekey_packet_number_rollover_mode_serialization(self): + """ + Test serialization/deserialization for SakRekeyPacketNumberRolloverMode + """ + + # Construct a json representation of a SakRekeyPacketNumberRolloverMode model + sak_rekey_packet_number_rollover_mode_model_json = {} + sak_rekey_packet_number_rollover_mode_model_json['mode'] = 'packet_number_rollover' + + # Construct a model instance of SakRekeyPacketNumberRolloverMode by calling from_dict on the json representation + sak_rekey_packet_number_rollover_mode_model = SakRekeyPacketNumberRolloverMode.from_dict(sak_rekey_packet_number_rollover_mode_model_json) + assert sak_rekey_packet_number_rollover_mode_model != False + + # Construct a model instance of SakRekeyPacketNumberRolloverMode by calling from_dict on the json representation + sak_rekey_packet_number_rollover_mode_model_dict = SakRekeyPacketNumberRolloverMode.from_dict(sak_rekey_packet_number_rollover_mode_model_json).__dict__ + sak_rekey_packet_number_rollover_mode_model2 = SakRekeyPacketNumberRolloverMode(**sak_rekey_packet_number_rollover_mode_model_dict) + + # Verify the model instances are equivalent + assert sak_rekey_packet_number_rollover_mode_model == sak_rekey_packet_number_rollover_mode_model2 + + # Convert model instance back to dict and verify no loss of data + sak_rekey_packet_number_rollover_mode_model_json2 = sak_rekey_packet_number_rollover_mode_model.to_dict() + assert sak_rekey_packet_number_rollover_mode_model_json2 == sak_rekey_packet_number_rollover_mode_model_json + + +class TestModel_SakRekeyPatchSakRekeyPacketNumberRolloverModePatch: + """ + Test Class for SakRekeyPatchSakRekeyPacketNumberRolloverModePatch + """ + + def test_sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_serialization(self): + """ + Test serialization/deserialization for SakRekeyPatchSakRekeyPacketNumberRolloverModePatch + """ + + # Construct a json representation of a SakRekeyPatchSakRekeyPacketNumberRolloverModePatch model + sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_json = {} + sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_json['mode'] = 'packet_number_rollover' + + # Construct a model instance of SakRekeyPatchSakRekeyPacketNumberRolloverModePatch by calling from_dict on the json representation + sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model = SakRekeyPatchSakRekeyPacketNumberRolloverModePatch.from_dict(sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_json) + assert sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model != False + + # Construct a model instance of SakRekeyPatchSakRekeyPacketNumberRolloverModePatch by calling from_dict on the json representation + sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_dict = SakRekeyPatchSakRekeyPacketNumberRolloverModePatch.from_dict(sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_json).__dict__ + sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model2 = SakRekeyPatchSakRekeyPacketNumberRolloverModePatch(**sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_dict) + + # Verify the model instances are equivalent + assert sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model == sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model2 + + # Convert model instance back to dict and verify no loss of data + sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_json2 = sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model.to_dict() + assert sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_json2 == sak_rekey_patch_sak_rekey_packet_number_rollover_mode_patch_model_json + + +class TestModel_SakRekeyPatchSakRekeyTimerModePatch: + """ + Test Class for SakRekeyPatchSakRekeyTimerModePatch + """ + + def test_sak_rekey_patch_sak_rekey_timer_mode_patch_serialization(self): + """ + Test serialization/deserialization for SakRekeyPatchSakRekeyTimerModePatch + """ + + # Construct a json representation of a SakRekeyPatchSakRekeyTimerModePatch model + sak_rekey_patch_sak_rekey_timer_mode_patch_model_json = {} + sak_rekey_patch_sak_rekey_timer_mode_patch_model_json['interval'] = 3600 + sak_rekey_patch_sak_rekey_timer_mode_patch_model_json['mode'] = 'timer' + + # Construct a model instance of SakRekeyPatchSakRekeyTimerModePatch by calling from_dict on the json representation + sak_rekey_patch_sak_rekey_timer_mode_patch_model = SakRekeyPatchSakRekeyTimerModePatch.from_dict(sak_rekey_patch_sak_rekey_timer_mode_patch_model_json) + assert sak_rekey_patch_sak_rekey_timer_mode_patch_model != False + + # Construct a model instance of SakRekeyPatchSakRekeyTimerModePatch by calling from_dict on the json representation + sak_rekey_patch_sak_rekey_timer_mode_patch_model_dict = SakRekeyPatchSakRekeyTimerModePatch.from_dict(sak_rekey_patch_sak_rekey_timer_mode_patch_model_json).__dict__ + sak_rekey_patch_sak_rekey_timer_mode_patch_model2 = SakRekeyPatchSakRekeyTimerModePatch(**sak_rekey_patch_sak_rekey_timer_mode_patch_model_dict) + + # Verify the model instances are equivalent + assert sak_rekey_patch_sak_rekey_timer_mode_patch_model == sak_rekey_patch_sak_rekey_timer_mode_patch_model2 + + # Convert model instance back to dict and verify no loss of data + sak_rekey_patch_sak_rekey_timer_mode_patch_model_json2 = sak_rekey_patch_sak_rekey_timer_mode_patch_model.to_dict() + assert sak_rekey_patch_sak_rekey_timer_mode_patch_model_json2 == sak_rekey_patch_sak_rekey_timer_mode_patch_model_json + + +class TestModel_SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype: + """ + Test Class for SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype + """ + + def test_sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_serialization(self): + """ + Test serialization/deserialization for SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype + """ + + # Construct a json representation of a SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype model + sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_json = {} + sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_json['mode'] = 'packet_number_rollover' + + # Construct a model instance of SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype by calling from_dict on the json representation + sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model = SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype.from_dict(sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_json) + assert sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model != False + + # Construct a model instance of SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype by calling from_dict on the json representation + sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_dict = SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype.from_dict(sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_json).__dict__ + sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model2 = SakRekeyPrototypeSakRekeyPacketNumberRolloverModePrototype(**sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_dict) + + # Verify the model instances are equivalent + assert sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model == sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_json2 = sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model.to_dict() + assert sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_json2 == sak_rekey_prototype_sak_rekey_packet_number_rollover_mode_prototype_model_json + + +class TestModel_SakRekeyPrototypeSakRekeyTimerModePrototype: + """ + Test Class for SakRekeyPrototypeSakRekeyTimerModePrototype + """ + + def test_sak_rekey_prototype_sak_rekey_timer_mode_prototype_serialization(self): + """ + Test serialization/deserialization for SakRekeyPrototypeSakRekeyTimerModePrototype + """ + + # Construct a json representation of a SakRekeyPrototypeSakRekeyTimerModePrototype model + sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_json = {} + sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_json['interval'] = 3600 + sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_json['mode'] = 'timer' + + # Construct a model instance of SakRekeyPrototypeSakRekeyTimerModePrototype by calling from_dict on the json representation + sak_rekey_prototype_sak_rekey_timer_mode_prototype_model = SakRekeyPrototypeSakRekeyTimerModePrototype.from_dict(sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_json) + assert sak_rekey_prototype_sak_rekey_timer_mode_prototype_model != False + + # Construct a model instance of SakRekeyPrototypeSakRekeyTimerModePrototype by calling from_dict on the json representation + sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_dict = SakRekeyPrototypeSakRekeyTimerModePrototype.from_dict(sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_json).__dict__ + sak_rekey_prototype_sak_rekey_timer_mode_prototype_model2 = SakRekeyPrototypeSakRekeyTimerModePrototype(**sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_dict) + + # Verify the model instances are equivalent + assert sak_rekey_prototype_sak_rekey_timer_mode_prototype_model == sak_rekey_prototype_sak_rekey_timer_mode_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_json2 = sak_rekey_prototype_sak_rekey_timer_mode_prototype_model.to_dict() + assert sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_json2 == sak_rekey_prototype_sak_rekey_timer_mode_prototype_model_json + + +class TestModel_SakRekeyTimerMode: + """ + Test Class for SakRekeyTimerMode + """ + + def test_sak_rekey_timer_mode_serialization(self): + """ + Test serialization/deserialization for SakRekeyTimerMode + """ + + # Construct a json representation of a SakRekeyTimerMode model + sak_rekey_timer_mode_model_json = {} + sak_rekey_timer_mode_model_json['interval'] = 3600 + sak_rekey_timer_mode_model_json['mode'] = 'timer' + + # Construct a model instance of SakRekeyTimerMode by calling from_dict on the json representation + sak_rekey_timer_mode_model = SakRekeyTimerMode.from_dict(sak_rekey_timer_mode_model_json) + assert sak_rekey_timer_mode_model != False + + # Construct a model instance of SakRekeyTimerMode by calling from_dict on the json representation + sak_rekey_timer_mode_model_dict = SakRekeyTimerMode.from_dict(sak_rekey_timer_mode_model_json).__dict__ + sak_rekey_timer_mode_model2 = SakRekeyTimerMode(**sak_rekey_timer_mode_model_dict) + + # Verify the model instances are equivalent + assert sak_rekey_timer_mode_model == sak_rekey_timer_mode_model2 + + # Convert model instance back to dict and verify no loss of data + sak_rekey_timer_mode_model_json2 = sak_rekey_timer_mode_model.to_dict() + assert sak_rekey_timer_mode_model_json2 == sak_rekey_timer_mode_model_json + + # endregion ############################################################################## # End of Model Tests -############################################################################## +############################################################################## \ No newline at end of file diff --git a/tox.ini b/tox.ini index 42fd980..dea6155 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,10 @@ [tox] -envlist = py37-lint, py36, py37, py38, py39 +envlist = py39-lint, py39, py310, py311, py312 -[testenv:py37-lint] -; basepython = python3.7 -; deps = pylint -; commands = pylint --rcfile=.pylintrc ibm_cloud_networking_services test +[testenv:py39-lint] +basepython = python3.9 +deps = pre-commit +commands = pre-commit run [testenv] passenv = TOXENV CI TRAVIS* @@ -14,4 +14,4 @@ deps = -r{toxinidir}/requirements.txt -r{toxinidir}/requirements-dev.txt usedevelop = True -exclude = .venv,.git,.tox,docs +exclude = .venv,.git,.tox,docs \ No newline at end of file