From e78faf13d9f020bb6c96b3d70462b422c391589f Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 15 Dec 2025 12:56:55 -0600 Subject: [PATCH 1/2] fix: add display name to service ref response Signed-off-by: Dylan --- .../context_based_restrictions_v1.py | 134 ++++++--- .../test_context_based_restrictions_v1.py | 281 ++++++------------ 2 files changed, 191 insertions(+), 224 deletions(-) diff --git a/ibm_platform_services/context_based_restrictions_v1.py b/ibm_platform_services/context_based_restrictions_v1.py index dbb19648..30d3eed6 100644 --- a/ibm_platform_services/context_based_restrictions_v1.py +++ b/ibm_platform_services/context_based_restrictions_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.86.0-bc6f14b3-20240221-193958 +# IBM OpenAPI SDK Code Generator Version: 3.108.0-56772134-20251111-102802 """ With the Context Based Restrictions API, you can: @@ -59,7 +59,9 @@ def new_instance( specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) - service = cls(authenticator) + service = cls( + authenticator + ) service.configure_service(service_name) return service @@ -1290,19 +1292,20 @@ class AccountSettings: :param str crn: The account settings CRN. :param int rule_count_limit: the max number of rules allowed for the account. :param int zone_count_limit: the max number of zones allowed for the account. - :param int tags_rule_count_limit: (optional) the max number of rules with tags - allowed for the account. + :param int tags_rule_count_limit: the max number of rules with tags allowed for + the account. :param int current_rule_count: the current number of rules used by the account. :param int current_zone_count: the current number of zones used by the account. - :param int current_tags_rule_count: (optional) the current number of rules with - tags used by the account. + :param int current_tags_rule_count: the current number of rules with tags used + by the account. :param str href: The href link to the resource. - :param datetime created_at: The time the resource was created. - :param str created_by_id: IAM ID of the user or service which created the - resource. - :param datetime last_modified_at: The last time the resource was modified. - :param str last_modified_by_id: IAM ID of the user or service which modified the - resource. + :param datetime created_at: (optional) The time the resource was created. + :param str created_by_id: (optional) IAM ID of the user or service which created + the resource. + :param datetime last_modified_at: (optional) The last time the resource was + modified. + :param str last_modified_by_id: (optional) IAM ID of the user or service which + modified the resource. """ def __init__( @@ -1311,16 +1314,16 @@ def __init__( crn: str, rule_count_limit: int, zone_count_limit: int, + tags_rule_count_limit: int, current_rule_count: int, current_zone_count: int, + current_tags_rule_count: int, href: str, - created_at: datetime, - created_by_id: str, - last_modified_at: datetime, - last_modified_by_id: str, *, - tags_rule_count_limit: Optional[int] = None, - current_tags_rule_count: Optional[int] = None, + created_at: Optional[datetime] = None, + created_by_id: Optional[str] = None, + last_modified_at: Optional[datetime] = None, + last_modified_by_id: Optional[str] = None, ) -> None: """ Initialize a AccountSettings object. @@ -1331,21 +1334,22 @@ def __init__( account. :param int zone_count_limit: the max number of zones allowed for the account. + :param int tags_rule_count_limit: the max number of rules with tags allowed + for the account. :param int current_rule_count: the current number of rules used by the account. :param int current_zone_count: the current number of zones used by the account. + :param int current_tags_rule_count: the current number of rules with tags + used by the account. :param str href: The href link to the resource. - :param datetime created_at: The time the resource was created. - :param str created_by_id: IAM ID of the user or service which created the - resource. - :param datetime last_modified_at: The last time the resource was modified. - :param str last_modified_by_id: IAM ID of the user or service which - modified the resource. - :param int tags_rule_count_limit: (optional) the max number of rules with - tags allowed for the account. - :param int current_tags_rule_count: (optional) the current number of rules - with tags used by the account. + :param datetime created_at: (optional) The time the resource was created. + :param str created_by_id: (optional) IAM ID of the user or service which + created the resource. + :param datetime last_modified_at: (optional) The last time the resource was + modified. + :param str last_modified_by_id: (optional) IAM ID of the user or service + which modified the resource. """ self.id = id self.crn = crn @@ -1383,6 +1387,8 @@ def from_dict(cls, _dict: Dict) -> 'AccountSettings': raise ValueError('Required property \'zone_count_limit\' not present in AccountSettings JSON') if (tags_rule_count_limit := _dict.get('tags_rule_count_limit')) is not None: args['tags_rule_count_limit'] = tags_rule_count_limit + else: + raise ValueError('Required property \'tags_rule_count_limit\' not present in AccountSettings JSON') if (current_rule_count := _dict.get('current_rule_count')) is not None: args['current_rule_count'] = current_rule_count else: @@ -1393,26 +1399,20 @@ def from_dict(cls, _dict: Dict) -> 'AccountSettings': raise ValueError('Required property \'current_zone_count\' not present in AccountSettings JSON') if (current_tags_rule_count := _dict.get('current_tags_rule_count')) is not None: args['current_tags_rule_count'] = current_tags_rule_count + else: + raise ValueError('Required property \'current_tags_rule_count\' not present in AccountSettings JSON') if (href := _dict.get('href')) is not None: args['href'] = href else: raise ValueError('Required property \'href\' not present in AccountSettings 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 AccountSettings JSON') if (created_by_id := _dict.get('created_by_id')) is not None: args['created_by_id'] = created_by_id - else: - raise ValueError('Required property \'created_by_id\' not present in AccountSettings JSON') if (last_modified_at := _dict.get('last_modified_at')) is not None: args['last_modified_at'] = string_to_datetime(last_modified_at) - else: - raise ValueError('Required property \'last_modified_at\' not present in AccountSettings JSON') if (last_modified_by_id := _dict.get('last_modified_by_id')) is not None: args['last_modified_by_id'] = last_modified_by_id - else: - raise ValueError('Required property \'last_modified_by_id\' not present in AccountSettings JSON') return cls(**args) @classmethod @@ -1609,6 +1609,7 @@ class TypeEnum(str, Enum): SERVICEREF = 'serviceRef' + class NewRuleOperations: """ The operations this rule applies to. @@ -2245,6 +2246,7 @@ class EnforcementModeEnum(str, Enum): REPORT = 'report' + class RuleContext: """ A rule context. @@ -2462,6 +2464,7 @@ class ServiceRefTarget: :param str service_type: (optional) The type of the service. :param List[ServiceRefTargetLocationsItem] locations: (optional) The locations the service is available. + :param str display_name: (optional) The display name of the service. """ def __init__( @@ -2470,6 +2473,7 @@ def __init__( *, service_type: Optional[str] = None, locations: Optional[List['ServiceRefTargetLocationsItem']] = None, + display_name: Optional[str] = None, ) -> None: """ Initialize a ServiceRefTarget object. @@ -2478,10 +2482,12 @@ def __init__( :param str service_type: (optional) The type of the service. :param List[ServiceRefTargetLocationsItem] locations: (optional) The locations the service is available. + :param str display_name: (optional) The display name of the service. """ self.service_name = service_name self.service_type = service_type self.locations = locations + self.display_name = display_name @classmethod def from_dict(cls, _dict: Dict) -> 'ServiceRefTarget': @@ -2495,6 +2501,8 @@ def from_dict(cls, _dict: Dict) -> 'ServiceRefTarget': args['service_type'] = service_type if (locations := _dict.get('locations')) is not None: args['locations'] = [ServiceRefTargetLocationsItem.from_dict(v) for v in locations] + if (display_name := _dict.get('display_name')) is not None: + args['display_name'] = display_name return cls(**args) @classmethod @@ -2517,6 +2525,8 @@ def to_dict(self) -> Dict: else: locations_list.append(v.to_dict()) _dict['locations'] = locations_list + if hasattr(self, 'display_name') and self.display_name is not None: + _dict['display_name'] = self.display_name return _dict def _to_dict(self): @@ -3251,22 +3261,27 @@ class AddressIPAddress(Address): :param str type: The type of address. :param str value: The IP address. + :param str id: (optional) The address id (for use by terraform only). """ def __init__( self, type: str, value: str, + *, + id: Optional[str] = None, ) -> None: """ Initialize a AddressIPAddress object. :param str type: The type of address. :param str value: The IP address. + :param str id: (optional) The address id (for use by terraform only). """ # pylint: disable=super-init-not-called self.type = type self.value = value + self.id = id @classmethod def from_dict(cls, _dict: Dict) -> 'AddressIPAddress': @@ -3280,6 +3295,8 @@ def from_dict(cls, _dict: Dict) -> 'AddressIPAddress': args['value'] = value else: raise ValueError('Required property \'value\' not present in AddressIPAddress JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id return cls(**args) @classmethod @@ -3294,6 +3311,8 @@ def to_dict(self) -> Dict: _dict['type'] = self.type if hasattr(self, 'value') and self.value is not None: _dict['value'] = self.value + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id return _dict def _to_dict(self): @@ -3322,28 +3341,34 @@ class TypeEnum(str, Enum): IPADDRESS = 'ipAddress' + class AddressIPAddressRange(Address): """ An IP address range. IPv4 and IPv6 are supported. :param str type: The type of address. :param str value: The ip range in - format. + :param str id: (optional) The address id (for use by terraform only). """ def __init__( self, type: str, value: str, + *, + id: Optional[str] = None, ) -> None: """ Initialize a AddressIPAddressRange object. :param str type: The type of address. :param str value: The ip range in - format. + :param str id: (optional) The address id (for use by terraform only). """ # pylint: disable=super-init-not-called self.type = type self.value = value + self.id = id @classmethod def from_dict(cls, _dict: Dict) -> 'AddressIPAddressRange': @@ -3357,6 +3382,8 @@ def from_dict(cls, _dict: Dict) -> 'AddressIPAddressRange': args['value'] = value else: raise ValueError('Required property \'value\' not present in AddressIPAddressRange JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id return cls(**args) @classmethod @@ -3371,6 +3398,8 @@ def to_dict(self) -> Dict: _dict['type'] = self.type if hasattr(self, 'value') and self.value is not None: _dict['value'] = self.value + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id return _dict def _to_dict(self): @@ -3399,28 +3428,34 @@ class TypeEnum(str, Enum): IPRANGE = 'ipRange' + class AddressServiceRef(Address): """ A service reference. :param str type: The type of address. :param ServiceRefValue ref: A service reference value. + :param str id: (optional) The address id (for use by terraform only). """ def __init__( self, type: str, ref: 'ServiceRefValue', + *, + id: Optional[str] = None, ) -> None: """ Initialize a AddressServiceRef object. :param str type: The type of address. :param ServiceRefValue ref: A service reference value. + :param str id: (optional) The address id (for use by terraform only). """ # pylint: disable=super-init-not-called self.type = type self.ref = ref + self.id = id @classmethod def from_dict(cls, _dict: Dict) -> 'AddressServiceRef': @@ -3434,6 +3469,8 @@ def from_dict(cls, _dict: Dict) -> 'AddressServiceRef': args['ref'] = ServiceRefValue.from_dict(ref) else: raise ValueError('Required property \'ref\' not present in AddressServiceRef JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id return cls(**args) @classmethod @@ -3451,6 +3488,8 @@ def to_dict(self) -> Dict: _dict['ref'] = self.ref else: _dict['ref'] = self.ref.to_dict() + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id return _dict def _to_dict(self): @@ -3479,28 +3518,34 @@ class TypeEnum(str, Enum): SERVICEREF = 'serviceRef' + class AddressSubnet(Address): """ A subnet in CIDR format. :param str type: The type of address. :param str value: The subnet in CIDR format. + :param str id: (optional) The address id (for use by terraform only). """ def __init__( self, type: str, value: str, + *, + id: Optional[str] = None, ) -> None: """ Initialize a AddressSubnet object. :param str type: The type of address. :param str value: The subnet in CIDR format. + :param str id: (optional) The address id (for use by terraform only). """ # pylint: disable=super-init-not-called self.type = type self.value = value + self.id = id @classmethod def from_dict(cls, _dict: Dict) -> 'AddressSubnet': @@ -3514,6 +3559,8 @@ def from_dict(cls, _dict: Dict) -> 'AddressSubnet': args['value'] = value else: raise ValueError('Required property \'value\' not present in AddressSubnet JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id return cls(**args) @classmethod @@ -3528,6 +3575,8 @@ def to_dict(self) -> Dict: _dict['type'] = self.type if hasattr(self, 'value') and self.value is not None: _dict['value'] = self.value + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id return _dict def _to_dict(self): @@ -3556,28 +3605,34 @@ class TypeEnum(str, Enum): SUBNET = 'subnet' + class AddressVPC(Address): """ A single VPC address. :param str type: The type of address. :param str value: The VPC CRN. + :param str id: (optional) The address id (for use by terraform only). """ def __init__( self, type: str, value: str, + *, + id: Optional[str] = None, ) -> None: """ Initialize a AddressVPC object. :param str type: The type of address. :param str value: The VPC CRN. + :param str id: (optional) The address id (for use by terraform only). """ # pylint: disable=super-init-not-called self.type = type self.value = value + self.id = id @classmethod def from_dict(cls, _dict: Dict) -> 'AddressVPC': @@ -3591,6 +3646,8 @@ def from_dict(cls, _dict: Dict) -> 'AddressVPC': args['value'] = value else: raise ValueError('Required property \'value\' not present in AddressVPC JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id return cls(**args) @classmethod @@ -3605,6 +3662,8 @@ def to_dict(self) -> Dict: _dict['type'] = self.type if hasattr(self, 'value') and self.value is not None: _dict['value'] = self.value + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id return _dict def _to_dict(self): @@ -3631,3 +3690,4 @@ class TypeEnum(str, Enum): """ VPC = 'vpc' + diff --git a/test/unit/test_context_based_restrictions_v1.py b/test/unit/test_context_based_restrictions_v1.py index 14d71b44..4d8404c7 100644 --- a/test/unit/test_context_based_restrictions_v1.py +++ b/test/unit/test_context_based_restrictions_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. @@ -31,7 +31,9 @@ from ibm_platform_services.context_based_restrictions_v1 import * -_service = ContextBasedRestrictionsV1(authenticator=NoAuthAuthenticator()) +_service = ContextBasedRestrictionsV1( + authenticator=NoAuthAuthenticator() +) _base_url = 'https://cbr.cloud.ibm.com' _service.set_service_url(_base_url) @@ -44,21 +46,12 @@ 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 - # /. + # Otherwise, return a regular expression that matches one or more trailing /. if not request_url.endswith('/'): return request_url return re.compile(request_url.rstrip('/') + '/+') @@ -735,7 +728,7 @@ def test_list_available_serviceref_targets_all_params(self): """ # Set up mock url = preprocess_url('/v1/zones/serviceref_targets') - mock_response = '{"count": 5, "targets": [{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}]}]}' + mock_response = '{"count": 5, "targets": [{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}], "display_name": "display_name"}]}' responses.add( responses.GET, url, @@ -766,13 +759,11 @@ def test_list_available_serviceref_targets_all_params(self): assert 'type={}'.format(type) in query_string def test_list_available_serviceref_targets_all_params_with_retries(self): - # Enable retries and run - # test_list_available_serviceref_targets_all_params. + # Enable retries and run test_list_available_serviceref_targets_all_params. _service.enable_retries() self.test_list_available_serviceref_targets_all_params() - # Disable retries and run - # test_list_available_serviceref_targets_all_params. + # Disable retries and run test_list_available_serviceref_targets_all_params. _service.disable_retries() self.test_list_available_serviceref_targets_all_params() @@ -783,7 +774,7 @@ def test_list_available_serviceref_targets_required_params(self): """ # Set up mock url = preprocess_url('/v1/zones/serviceref_targets') - mock_response = '{"count": 5, "targets": [{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}]}]}' + mock_response = '{"count": 5, "targets": [{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}], "display_name": "display_name"}]}' responses.add( responses.GET, url, @@ -800,13 +791,11 @@ def test_list_available_serviceref_targets_required_params(self): assert response.status_code == 200 def test_list_available_serviceref_targets_required_params_with_retries(self): - # Enable retries and run - # test_list_available_serviceref_targets_required_params. + # Enable retries and run test_list_available_serviceref_targets_required_params. _service.enable_retries() self.test_list_available_serviceref_targets_required_params() - # Disable retries and run - # test_list_available_serviceref_targets_required_params. + # Disable retries and run test_list_available_serviceref_targets_required_params. _service.disable_retries() self.test_list_available_serviceref_targets_required_params() @@ -823,7 +812,7 @@ def test_get_serviceref_target_all_params(self): """ # Set up mock url = preprocess_url('/v1/zones/serviceref_targets/testString') - mock_response = '{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}]}' + mock_response = '{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}], "display_name": "display_name"}' responses.add( responses.GET, url, @@ -865,7 +854,7 @@ def test_get_serviceref_target_required_params(self): """ # Set up mock url = preprocess_url('/v1/zones/serviceref_targets/testString') - mock_response = '{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}]}' + mock_response = '{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}], "display_name": "display_name"}' responses.add( responses.GET, url, @@ -903,7 +892,7 @@ def test_get_serviceref_target_value_error(self): """ # Set up mock url = preprocess_url('/v1/zones/serviceref_targets/testString') - mock_response = '{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}]}' + mock_response = '{"service_name": "service_name", "service_type": "service_type", "locations": [{"display_name": "display_name", "kind": "kind", "name": "name"}], "display_name": "display_name"}' responses.add( responses.GET, url, @@ -1020,8 +1009,7 @@ def test_create_rule_all_params(self): resource_model['attributes'] = [resource_attribute_model] resource_model['tags'] = [resource_tag_attribute_model] - # Construct a dict representation of a NewRuleOperationsApiTypesItem - # model + # Construct a dict representation of a NewRuleOperationsApiTypesItem model new_rule_operations_api_types_item_model = {} new_rule_operations_api_types_item_model['api_type_id'] = 'testString' @@ -1932,13 +1920,11 @@ def test_list_available_service_operations_all_params(self): assert 'resource_type={}'.format(resource_type) in query_string def test_list_available_service_operations_all_params_with_retries(self): - # Enable retries and run - # test_list_available_service_operations_all_params. + # Enable retries and run test_list_available_service_operations_all_params. _service.enable_retries() self.test_list_available_service_operations_all_params() - # Disable retries and run - # test_list_available_service_operations_all_params. + # Disable retries and run test_list_available_service_operations_all_params. _service.disable_retries() self.test_list_available_service_operations_all_params() @@ -1966,13 +1952,11 @@ def test_list_available_service_operations_required_params(self): assert response.status_code == 200 def test_list_available_service_operations_required_params_with_retries(self): - # Enable retries and run - # test_list_available_service_operations_required_params. + # Enable retries and run test_list_available_service_operations_required_params. _service.enable_retries() self.test_list_available_service_operations_required_params() - # Disable retries and run - # test_list_available_service_operations_required_params. + # Disable retries and run test_list_available_service_operations_required_params. _service.disable_retries() self.test_list_available_service_operations_required_params() @@ -1999,8 +1983,7 @@ def test_api_type_serialization(self): Test serialization/deserialization for APIType """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. action_model = {} # Action action_model['action_id'] = 'testString' @@ -2015,13 +1998,11 @@ def test_api_type_serialization(self): api_type_model_json['actions'] = [action_model] api_type_model_json['enforcement_modes'] = ['testString'] - # Construct a model instance of APIType by calling from_dict on the - # json representation + # Construct a model instance of APIType by calling from_dict on the json representation api_type_model = APIType.from_dict(api_type_model_json) assert api_type_model != False - # Construct a model instance of APIType by calling from_dict on the - # json representation + # Construct a model instance of APIType by calling from_dict on the json representation api_type_model_dict = APIType.from_dict(api_type_model_json).__dict__ api_type_model2 = APIType(**api_type_model_dict) @@ -2059,13 +2040,11 @@ def test_account_settings_serialization(self): account_settings_model_json['last_modified_at'] = '2019-01-01T12:00:00Z' account_settings_model_json['last_modified_by_id'] = 'testString' - # Construct a model instance of AccountSettings by calling from_dict on - # the json representation + # Construct a model instance of AccountSettings by calling from_dict on the json representation account_settings_model = AccountSettings.from_dict(account_settings_model_json) assert account_settings_model != False - # Construct a model instance of AccountSettings by calling from_dict on - # the json representation + # Construct a model instance of AccountSettings by calling from_dict on the json representation account_settings_model_dict = AccountSettings.from_dict(account_settings_model_json).__dict__ account_settings_model2 = AccountSettings(**account_settings_model_dict) @@ -2092,13 +2071,11 @@ def test_action_serialization(self): action_model_json['action_id'] = 'testString' action_model_json['description'] = 'testString' - # Construct a model instance of Action by calling from_dict on the json - # representation + # Construct a model instance of Action by calling from_dict on the json representation action_model = Action.from_dict(action_model_json) assert action_model != False - # Construct a model instance of Action by calling from_dict on the json - # representation + # Construct a model instance of Action by calling from_dict on the json representation action_model_dict = Action.from_dict(action_model_json).__dict__ action_model2 = Action(**action_model_dict) @@ -2120,8 +2097,7 @@ def test_new_rule_operations_serialization(self): Test serialization/deserialization for NewRuleOperations """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. new_rule_operations_api_types_item_model = {} # NewRuleOperationsApiTypesItem new_rule_operations_api_types_item_model['api_type_id'] = 'testString' @@ -2130,13 +2106,11 @@ def test_new_rule_operations_serialization(self): new_rule_operations_model_json = {} new_rule_operations_model_json['api_types'] = [new_rule_operations_api_types_item_model] - # Construct a model instance of NewRuleOperations by calling from_dict - # on the json representation + # Construct a model instance of NewRuleOperations by calling from_dict on the json representation new_rule_operations_model = NewRuleOperations.from_dict(new_rule_operations_model_json) assert new_rule_operations_model != False - # Construct a model instance of NewRuleOperations by calling from_dict - # on the json representation + # Construct a model instance of NewRuleOperations by calling from_dict on the json representation new_rule_operations_model_dict = NewRuleOperations.from_dict(new_rule_operations_model_json).__dict__ new_rule_operations_model2 = NewRuleOperations(**new_rule_operations_model_dict) @@ -2158,26 +2132,17 @@ def test_new_rule_operations_api_types_item_serialization(self): Test serialization/deserialization for NewRuleOperationsApiTypesItem """ - # Construct a json representation of a NewRuleOperationsApiTypesItem - # model + # Construct a json representation of a NewRuleOperationsApiTypesItem model new_rule_operations_api_types_item_model_json = {} new_rule_operations_api_types_item_model_json['api_type_id'] = 'testString' - # Construct a model instance of NewRuleOperationsApiTypesItem by - # calling from_dict on the json representation - new_rule_operations_api_types_item_model = NewRuleOperationsApiTypesItem.from_dict( - new_rule_operations_api_types_item_model_json - ) + # Construct a model instance of NewRuleOperationsApiTypesItem by calling from_dict on the json representation + new_rule_operations_api_types_item_model = NewRuleOperationsApiTypesItem.from_dict(new_rule_operations_api_types_item_model_json) assert new_rule_operations_api_types_item_model != False - # Construct a model instance of NewRuleOperationsApiTypesItem by - # calling from_dict on the json representation - new_rule_operations_api_types_item_model_dict = NewRuleOperationsApiTypesItem.from_dict( - new_rule_operations_api_types_item_model_json - ).__dict__ - new_rule_operations_api_types_item_model2 = NewRuleOperationsApiTypesItem( - **new_rule_operations_api_types_item_model_dict - ) + # Construct a model instance of NewRuleOperationsApiTypesItem by calling from_dict on the json representation + new_rule_operations_api_types_item_model_dict = NewRuleOperationsApiTypesItem.from_dict(new_rule_operations_api_types_item_model_json).__dict__ + new_rule_operations_api_types_item_model2 = NewRuleOperationsApiTypesItem(**new_rule_operations_api_types_item_model_dict) # Verify the model instances are equivalent assert new_rule_operations_api_types_item_model == new_rule_operations_api_types_item_model2 @@ -2197,8 +2162,7 @@ def test_operations_list_serialization(self): Test serialization/deserialization for OperationsList """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. action_model = {} # Action action_model['action_id'] = 'testString' @@ -2216,13 +2180,11 @@ def test_operations_list_serialization(self): operations_list_model_json = {} operations_list_model_json['api_types'] = [api_type_model] - # Construct a model instance of OperationsList by calling from_dict on - # the json representation + # Construct a model instance of OperationsList by calling from_dict on the json representation operations_list_model = OperationsList.from_dict(operations_list_model_json) assert operations_list_model != False - # Construct a model instance of OperationsList by calling from_dict on - # the json representation + # Construct a model instance of OperationsList by calling from_dict on the json representation operations_list_model_dict = OperationsList.from_dict(operations_list_model_json).__dict__ operations_list_model2 = OperationsList(**operations_list_model_dict) @@ -2244,8 +2206,7 @@ def test_resource_serialization(self): Test serialization/deserialization for Resource """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. resource_attribute_model = {} # ResourceAttribute resource_attribute_model['name'] = 'testString' @@ -2262,13 +2223,11 @@ def test_resource_serialization(self): resource_model_json['attributes'] = [resource_attribute_model] resource_model_json['tags'] = [resource_tag_attribute_model] - # Construct a model instance of Resource by calling from_dict on the - # json representation + # Construct a model instance of Resource by calling from_dict on the json representation resource_model = Resource.from_dict(resource_model_json) assert resource_model != False - # Construct a model instance of Resource by calling from_dict on the - # json representation + # Construct a model instance of Resource by calling from_dict on the json representation resource_model_dict = Resource.from_dict(resource_model_json).__dict__ resource_model2 = Resource(**resource_model_dict) @@ -2296,13 +2255,11 @@ def test_resource_attribute_serialization(self): resource_attribute_model_json['value'] = 'testString' resource_attribute_model_json['operator'] = 'testString' - # Construct a model instance of ResourceAttribute by calling from_dict - # on the json representation + # Construct a model instance of ResourceAttribute by calling from_dict on the json representation resource_attribute_model = ResourceAttribute.from_dict(resource_attribute_model_json) assert resource_attribute_model != False - # Construct a model instance of ResourceAttribute by calling from_dict - # on the json representation + # Construct a model instance of ResourceAttribute by calling from_dict on the json representation resource_attribute_model_dict = ResourceAttribute.from_dict(resource_attribute_model_json).__dict__ resource_attribute_model2 = ResourceAttribute(**resource_attribute_model_dict) @@ -2330,13 +2287,11 @@ def test_resource_tag_attribute_serialization(self): resource_tag_attribute_model_json['value'] = 'testString' resource_tag_attribute_model_json['operator'] = 'testString' - # Construct a model instance of ResourceTagAttribute by calling - # from_dict on the json representation + # Construct a model instance of ResourceTagAttribute by calling from_dict on the json representation resource_tag_attribute_model = ResourceTagAttribute.from_dict(resource_tag_attribute_model_json) assert resource_tag_attribute_model != False - # Construct a model instance of ResourceTagAttribute by calling - # from_dict on the json representation + # Construct a model instance of ResourceTagAttribute by calling from_dict on the json representation resource_tag_attribute_model_dict = ResourceTagAttribute.from_dict(resource_tag_attribute_model_json).__dict__ resource_tag_attribute_model2 = ResourceTagAttribute(**resource_tag_attribute_model_dict) @@ -2358,8 +2313,7 @@ def test_rule_serialization(self): Test serialization/deserialization for Rule """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. rule_context_attribute_model = {} # RuleContextAttribute rule_context_attribute_model['name'] = 'testString' @@ -2403,13 +2357,11 @@ def test_rule_serialization(self): rule_model_json['last_modified_at'] = '2019-01-01T12:00:00Z' rule_model_json['last_modified_by_id'] = 'testString' - # Construct a model instance of Rule by calling from_dict on the json - # representation + # Construct a model instance of Rule by calling from_dict on the json representation rule_model = Rule.from_dict(rule_model_json) assert rule_model != False - # Construct a model instance of Rule by calling from_dict on the json - # representation + # Construct a model instance of Rule by calling from_dict on the json representation rule_model_dict = Rule.from_dict(rule_model_json).__dict__ rule_model2 = Rule(**rule_model_dict) @@ -2431,8 +2383,7 @@ def test_rule_context_serialization(self): Test serialization/deserialization for RuleContext """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. rule_context_attribute_model = {} # RuleContextAttribute rule_context_attribute_model['name'] = 'testString' @@ -2442,13 +2393,11 @@ def test_rule_context_serialization(self): rule_context_model_json = {} rule_context_model_json['attributes'] = [rule_context_attribute_model] - # Construct a model instance of RuleContext by calling from_dict on the - # json representation + # Construct a model instance of RuleContext by calling from_dict on the json representation rule_context_model = RuleContext.from_dict(rule_context_model_json) assert rule_context_model != False - # Construct a model instance of RuleContext by calling from_dict on the - # json representation + # Construct a model instance of RuleContext by calling from_dict on the json representation rule_context_model_dict = RuleContext.from_dict(rule_context_model_json).__dict__ rule_context_model2 = RuleContext(**rule_context_model_dict) @@ -2475,13 +2424,11 @@ def test_rule_context_attribute_serialization(self): rule_context_attribute_model_json['name'] = 'testString' rule_context_attribute_model_json['value'] = 'testString' - # Construct a model instance of RuleContextAttribute by calling - # from_dict on the json representation + # Construct a model instance of RuleContextAttribute by calling from_dict on the json representation rule_context_attribute_model = RuleContextAttribute.from_dict(rule_context_attribute_model_json) assert rule_context_attribute_model != False - # Construct a model instance of RuleContextAttribute by calling - # from_dict on the json representation + # Construct a model instance of RuleContextAttribute by calling from_dict on the json representation rule_context_attribute_model_dict = RuleContextAttribute.from_dict(rule_context_attribute_model_json).__dict__ rule_context_attribute_model2 = RuleContextAttribute(**rule_context_attribute_model_dict) @@ -2503,8 +2450,7 @@ def test_rule_list_serialization(self): Test serialization/deserialization for RuleList """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. rule_context_attribute_model = {} # RuleContextAttribute rule_context_attribute_model['name'] = 'testString' @@ -2552,13 +2498,11 @@ def test_rule_list_serialization(self): rule_list_model_json['count'] = 38 rule_list_model_json['rules'] = [rule_model] - # Construct a model instance of RuleList by calling from_dict on the - # json representation + # Construct a model instance of RuleList by calling from_dict on the json representation rule_list_model = RuleList.from_dict(rule_list_model_json) assert rule_list_model != False - # Construct a model instance of RuleList by calling from_dict on the - # json representation + # Construct a model instance of RuleList by calling from_dict on the json representation rule_list_model_dict = RuleList.from_dict(rule_list_model_json).__dict__ rule_list_model2 = RuleList(**rule_list_model_dict) @@ -2580,8 +2524,7 @@ def test_service_ref_target_serialization(self): Test serialization/deserialization for ServiceRefTarget """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. service_ref_target_locations_item_model = {} # ServiceRefTargetLocationsItem service_ref_target_locations_item_model['display_name'] = 'testString' @@ -2593,14 +2536,13 @@ def test_service_ref_target_serialization(self): service_ref_target_model_json['service_name'] = 'testString' service_ref_target_model_json['service_type'] = 'testString' service_ref_target_model_json['locations'] = [service_ref_target_locations_item_model] + service_ref_target_model_json['display_name'] = 'testString' - # Construct a model instance of ServiceRefTarget by calling from_dict - # on the json representation + # Construct a model instance of ServiceRefTarget by calling from_dict on the json representation service_ref_target_model = ServiceRefTarget.from_dict(service_ref_target_model_json) assert service_ref_target_model != False - # Construct a model instance of ServiceRefTarget by calling from_dict - # on the json representation + # Construct a model instance of ServiceRefTarget by calling from_dict on the json representation service_ref_target_model_dict = ServiceRefTarget.from_dict(service_ref_target_model_json).__dict__ service_ref_target_model2 = ServiceRefTarget(**service_ref_target_model_dict) @@ -2622,8 +2564,7 @@ def test_service_ref_target_list_serialization(self): Test serialization/deserialization for ServiceRefTargetList """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. service_ref_target_locations_item_model = {} # ServiceRefTargetLocationsItem service_ref_target_locations_item_model['display_name'] = 'testString' @@ -2634,19 +2575,18 @@ def test_service_ref_target_list_serialization(self): service_ref_target_model['service_name'] = 'testString' service_ref_target_model['service_type'] = 'testString' service_ref_target_model['locations'] = [service_ref_target_locations_item_model] + service_ref_target_model['display_name'] = 'testString' # Construct a json representation of a ServiceRefTargetList model service_ref_target_list_model_json = {} service_ref_target_list_model_json['count'] = 38 service_ref_target_list_model_json['targets'] = [service_ref_target_model] - # Construct a model instance of ServiceRefTargetList by calling - # from_dict on the json representation + # Construct a model instance of ServiceRefTargetList by calling from_dict on the json representation service_ref_target_list_model = ServiceRefTargetList.from_dict(service_ref_target_list_model_json) assert service_ref_target_list_model != False - # Construct a model instance of ServiceRefTargetList by calling - # from_dict on the json representation + # Construct a model instance of ServiceRefTargetList by calling from_dict on the json representation service_ref_target_list_model_dict = ServiceRefTargetList.from_dict(service_ref_target_list_model_json).__dict__ service_ref_target_list_model2 = ServiceRefTargetList(**service_ref_target_list_model_dict) @@ -2668,28 +2608,19 @@ def test_service_ref_target_locations_item_serialization(self): Test serialization/deserialization for ServiceRefTargetLocationsItem """ - # Construct a json representation of a ServiceRefTargetLocationsItem - # model + # Construct a json representation of a ServiceRefTargetLocationsItem model service_ref_target_locations_item_model_json = {} service_ref_target_locations_item_model_json['display_name'] = 'testString' service_ref_target_locations_item_model_json['kind'] = 'testString' service_ref_target_locations_item_model_json['name'] = 'testString' - # Construct a model instance of ServiceRefTargetLocationsItem by - # calling from_dict on the json representation - service_ref_target_locations_item_model = ServiceRefTargetLocationsItem.from_dict( - service_ref_target_locations_item_model_json - ) + # Construct a model instance of ServiceRefTargetLocationsItem by calling from_dict on the json representation + service_ref_target_locations_item_model = ServiceRefTargetLocationsItem.from_dict(service_ref_target_locations_item_model_json) assert service_ref_target_locations_item_model != False - # Construct a model instance of ServiceRefTargetLocationsItem by - # calling from_dict on the json representation - service_ref_target_locations_item_model_dict = ServiceRefTargetLocationsItem.from_dict( - service_ref_target_locations_item_model_json - ).__dict__ - service_ref_target_locations_item_model2 = ServiceRefTargetLocationsItem( - **service_ref_target_locations_item_model_dict - ) + # Construct a model instance of ServiceRefTargetLocationsItem by calling from_dict on the json representation + service_ref_target_locations_item_model_dict = ServiceRefTargetLocationsItem.from_dict(service_ref_target_locations_item_model_json).__dict__ + service_ref_target_locations_item_model2 = ServiceRefTargetLocationsItem(**service_ref_target_locations_item_model_dict) # Verify the model instances are equivalent assert service_ref_target_locations_item_model == service_ref_target_locations_item_model2 @@ -2717,13 +2648,11 @@ def test_service_ref_value_serialization(self): service_ref_value_model_json['service_instance'] = 'testString' service_ref_value_model_json['location'] = 'testString' - # Construct a model instance of ServiceRefValue by calling from_dict on - # the json representation + # Construct a model instance of ServiceRefValue by calling from_dict on the json representation service_ref_value_model = ServiceRefValue.from_dict(service_ref_value_model_json) assert service_ref_value_model != False - # Construct a model instance of ServiceRefValue by calling from_dict on - # the json representation + # Construct a model instance of ServiceRefValue by calling from_dict on the json representation service_ref_value_model_dict = ServiceRefValue.from_dict(service_ref_value_model_json).__dict__ service_ref_value_model2 = ServiceRefValue(**service_ref_value_model_dict) @@ -2745,8 +2674,7 @@ def test_zone_serialization(self): Test serialization/deserialization for Zone """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. address_model = {} # AddressIPAddress address_model['type'] = 'ipAddress' @@ -2769,13 +2697,11 @@ def test_zone_serialization(self): zone_model_json['last_modified_at'] = '2019-01-01T12:00:00Z' zone_model_json['last_modified_by_id'] = 'testString' - # Construct a model instance of Zone by calling from_dict on the json - # representation + # Construct a model instance of Zone by calling from_dict on the json representation zone_model = Zone.from_dict(zone_model_json) assert zone_model != False - # Construct a model instance of Zone by calling from_dict on the json - # representation + # Construct a model instance of Zone by calling from_dict on the json representation zone_model_dict = Zone.from_dict(zone_model_json).__dict__ zone_model2 = Zone(**zone_model_dict) @@ -2797,8 +2723,7 @@ def test_zone_list_serialization(self): Test serialization/deserialization for ZoneList """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. address_model = {} # AddressIPAddress address_model['type'] = 'ipAddress' @@ -2823,13 +2748,11 @@ def test_zone_list_serialization(self): zone_list_model_json['count'] = 38 zone_list_model_json['zones'] = [zone_summary_model] - # Construct a model instance of ZoneList by calling from_dict on the - # json representation + # Construct a model instance of ZoneList by calling from_dict on the json representation zone_list_model = ZoneList.from_dict(zone_list_model_json) assert zone_list_model != False - # Construct a model instance of ZoneList by calling from_dict on the - # json representation + # Construct a model instance of ZoneList by calling from_dict on the json representation zone_list_model_dict = ZoneList.from_dict(zone_list_model_json).__dict__ zone_list_model2 = ZoneList(**zone_list_model_dict) @@ -2851,8 +2774,7 @@ def test_zone_summary_serialization(self): Test serialization/deserialization for ZoneSummary """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. address_model = {} # AddressIPAddress address_model['type'] = 'ipAddress' @@ -2873,13 +2795,11 @@ def test_zone_summary_serialization(self): zone_summary_model_json['last_modified_at'] = '2019-01-01T12:00:00Z' zone_summary_model_json['last_modified_by_id'] = 'testString' - # Construct a model instance of ZoneSummary by calling from_dict on the - # json representation + # Construct a model instance of ZoneSummary by calling from_dict on the json representation zone_summary_model = ZoneSummary.from_dict(zone_summary_model_json) assert zone_summary_model != False - # Construct a model instance of ZoneSummary by calling from_dict on the - # json representation + # Construct a model instance of ZoneSummary by calling from_dict on the json representation zone_summary_model_dict = ZoneSummary.from_dict(zone_summary_model_json).__dict__ zone_summary_model2 = ZoneSummary(**zone_summary_model_dict) @@ -2906,13 +2826,11 @@ def test_address_ip_address_serialization(self): address_ip_address_model_json['type'] = 'ipAddress' address_ip_address_model_json['value'] = 'testString' - # Construct a model instance of AddressIPAddress by calling from_dict - # on the json representation + # Construct a model instance of AddressIPAddress by calling from_dict on the json representation address_ip_address_model = AddressIPAddress.from_dict(address_ip_address_model_json) assert address_ip_address_model != False - # Construct a model instance of AddressIPAddress by calling from_dict - # on the json representation + # Construct a model instance of AddressIPAddress by calling from_dict on the json representation address_ip_address_model_dict = AddressIPAddress.from_dict(address_ip_address_model_json).__dict__ address_ip_address_model2 = AddressIPAddress(**address_ip_address_model_dict) @@ -2939,16 +2857,12 @@ def test_address_ip_address_range_serialization(self): address_ip_address_range_model_json['type'] = 'ipRange' address_ip_address_range_model_json['value'] = 'testString' - # Construct a model instance of AddressIPAddressRange by calling - # from_dict on the json representation + # Construct a model instance of AddressIPAddressRange by calling from_dict on the json representation address_ip_address_range_model = AddressIPAddressRange.from_dict(address_ip_address_range_model_json) assert address_ip_address_range_model != False - # Construct a model instance of AddressIPAddressRange by calling - # from_dict on the json representation - address_ip_address_range_model_dict = AddressIPAddressRange.from_dict( - address_ip_address_range_model_json - ).__dict__ + # Construct a model instance of AddressIPAddressRange by calling from_dict on the json representation + address_ip_address_range_model_dict = AddressIPAddressRange.from_dict(address_ip_address_range_model_json).__dict__ address_ip_address_range_model2 = AddressIPAddressRange(**address_ip_address_range_model_dict) # Verify the model instances are equivalent @@ -2969,8 +2883,7 @@ def test_address_service_ref_serialization(self): Test serialization/deserialization for AddressServiceRef """ - # Construct dict forms of any model objects needed in order to build - # this model. + # Construct dict forms of any model objects needed in order to build this model. service_ref_value_model = {} # ServiceRefValue service_ref_value_model['account_id'] = 'testString' @@ -2984,13 +2897,11 @@ def test_address_service_ref_serialization(self): address_service_ref_model_json['type'] = 'serviceRef' address_service_ref_model_json['ref'] = service_ref_value_model - # Construct a model instance of AddressServiceRef by calling from_dict - # on the json representation + # Construct a model instance of AddressServiceRef by calling from_dict on the json representation address_service_ref_model = AddressServiceRef.from_dict(address_service_ref_model_json) assert address_service_ref_model != False - # Construct a model instance of AddressServiceRef by calling from_dict - # on the json representation + # Construct a model instance of AddressServiceRef by calling from_dict on the json representation address_service_ref_model_dict = AddressServiceRef.from_dict(address_service_ref_model_json).__dict__ address_service_ref_model2 = AddressServiceRef(**address_service_ref_model_dict) @@ -3017,13 +2928,11 @@ def test_address_subnet_serialization(self): address_subnet_model_json['type'] = 'subnet' address_subnet_model_json['value'] = 'testString' - # Construct a model instance of AddressSubnet by calling from_dict on - # the json representation + # Construct a model instance of AddressSubnet by calling from_dict on the json representation address_subnet_model = AddressSubnet.from_dict(address_subnet_model_json) assert address_subnet_model != False - # Construct a model instance of AddressSubnet by calling from_dict on - # the json representation + # Construct a model instance of AddressSubnet by calling from_dict on the json representation address_subnet_model_dict = AddressSubnet.from_dict(address_subnet_model_json).__dict__ address_subnet_model2 = AddressSubnet(**address_subnet_model_dict) @@ -3050,13 +2959,11 @@ def test_address_vpc_serialization(self): address_vpc_model_json['type'] = 'vpc' address_vpc_model_json['value'] = 'testString' - # Construct a model instance of AddressVPC by calling from_dict on the - # json representation + # Construct a model instance of AddressVPC by calling from_dict on the json representation address_vpc_model = AddressVPC.from_dict(address_vpc_model_json) assert address_vpc_model != False - # Construct a model instance of AddressVPC by calling from_dict on the - # json representation + # Construct a model instance of AddressVPC by calling from_dict on the json representation address_vpc_model_dict = AddressVPC.from_dict(address_vpc_model_json).__dict__ address_vpc_model2 = AddressVPC(**address_vpc_model_dict) From 16dab13ef631e538323916bbc62a641d65cac790 Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 15 Dec 2025 13:10:54 -0600 Subject: [PATCH 2/2] linting fix Signed-off-by: Dylan --- .../context_based_restrictions_v1.py | 11 +------ .../test_context_based_restrictions_v1.py | 32 +++++++++++++------ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ibm_platform_services/context_based_restrictions_v1.py b/ibm_platform_services/context_based_restrictions_v1.py index 30d3eed6..9bb7deb7 100644 --- a/ibm_platform_services/context_based_restrictions_v1.py +++ b/ibm_platform_services/context_based_restrictions_v1.py @@ -59,9 +59,7 @@ def new_instance( specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) - service = cls( - authenticator - ) + service = cls(authenticator) service.configure_service(service_name) return service @@ -1609,7 +1607,6 @@ class TypeEnum(str, Enum): SERVICEREF = 'serviceRef' - class NewRuleOperations: """ The operations this rule applies to. @@ -2246,7 +2243,6 @@ class EnforcementModeEnum(str, Enum): REPORT = 'report' - class RuleContext: """ A rule context. @@ -3341,7 +3337,6 @@ class TypeEnum(str, Enum): IPADDRESS = 'ipAddress' - class AddressIPAddressRange(Address): """ An IP address range. IPv4 and IPv6 are supported. @@ -3428,7 +3423,6 @@ class TypeEnum(str, Enum): IPRANGE = 'ipRange' - class AddressServiceRef(Address): """ A service reference. @@ -3518,7 +3512,6 @@ class TypeEnum(str, Enum): SERVICEREF = 'serviceRef' - class AddressSubnet(Address): """ A subnet in CIDR format. @@ -3605,7 +3598,6 @@ class TypeEnum(str, Enum): SUBNET = 'subnet' - class AddressVPC(Address): """ A single VPC address. @@ -3690,4 +3682,3 @@ class TypeEnum(str, Enum): """ VPC = 'vpc' - diff --git a/test/unit/test_context_based_restrictions_v1.py b/test/unit/test_context_based_restrictions_v1.py index 4d8404c7..7d1d923d 100644 --- a/test/unit/test_context_based_restrictions_v1.py +++ b/test/unit/test_context_based_restrictions_v1.py @@ -31,9 +31,7 @@ from ibm_platform_services.context_based_restrictions_v1 import * -_service = ContextBasedRestrictionsV1( - authenticator=NoAuthAuthenticator() -) +_service = ContextBasedRestrictionsV1(authenticator=NoAuthAuthenticator()) _base_url = 'https://cbr.cloud.ibm.com' _service.set_service_url(_base_url) @@ -2137,12 +2135,18 @@ def test_new_rule_operations_api_types_item_serialization(self): new_rule_operations_api_types_item_model_json['api_type_id'] = 'testString' # Construct a model instance of NewRuleOperationsApiTypesItem by calling from_dict on the json representation - new_rule_operations_api_types_item_model = NewRuleOperationsApiTypesItem.from_dict(new_rule_operations_api_types_item_model_json) + new_rule_operations_api_types_item_model = NewRuleOperationsApiTypesItem.from_dict( + new_rule_operations_api_types_item_model_json + ) assert new_rule_operations_api_types_item_model != False # Construct a model instance of NewRuleOperationsApiTypesItem by calling from_dict on the json representation - new_rule_operations_api_types_item_model_dict = NewRuleOperationsApiTypesItem.from_dict(new_rule_operations_api_types_item_model_json).__dict__ - new_rule_operations_api_types_item_model2 = NewRuleOperationsApiTypesItem(**new_rule_operations_api_types_item_model_dict) + new_rule_operations_api_types_item_model_dict = NewRuleOperationsApiTypesItem.from_dict( + new_rule_operations_api_types_item_model_json + ).__dict__ + new_rule_operations_api_types_item_model2 = NewRuleOperationsApiTypesItem( + **new_rule_operations_api_types_item_model_dict + ) # Verify the model instances are equivalent assert new_rule_operations_api_types_item_model == new_rule_operations_api_types_item_model2 @@ -2615,12 +2619,18 @@ def test_service_ref_target_locations_item_serialization(self): service_ref_target_locations_item_model_json['name'] = 'testString' # Construct a model instance of ServiceRefTargetLocationsItem by calling from_dict on the json representation - service_ref_target_locations_item_model = ServiceRefTargetLocationsItem.from_dict(service_ref_target_locations_item_model_json) + service_ref_target_locations_item_model = ServiceRefTargetLocationsItem.from_dict( + service_ref_target_locations_item_model_json + ) assert service_ref_target_locations_item_model != False # Construct a model instance of ServiceRefTargetLocationsItem by calling from_dict on the json representation - service_ref_target_locations_item_model_dict = ServiceRefTargetLocationsItem.from_dict(service_ref_target_locations_item_model_json).__dict__ - service_ref_target_locations_item_model2 = ServiceRefTargetLocationsItem(**service_ref_target_locations_item_model_dict) + service_ref_target_locations_item_model_dict = ServiceRefTargetLocationsItem.from_dict( + service_ref_target_locations_item_model_json + ).__dict__ + service_ref_target_locations_item_model2 = ServiceRefTargetLocationsItem( + **service_ref_target_locations_item_model_dict + ) # Verify the model instances are equivalent assert service_ref_target_locations_item_model == service_ref_target_locations_item_model2 @@ -2862,7 +2872,9 @@ def test_address_ip_address_range_serialization(self): assert address_ip_address_range_model != False # Construct a model instance of AddressIPAddressRange by calling from_dict on the json representation - address_ip_address_range_model_dict = AddressIPAddressRange.from_dict(address_ip_address_range_model_json).__dict__ + address_ip_address_range_model_dict = AddressIPAddressRange.from_dict( + address_ip_address_range_model_json + ).__dict__ address_ip_address_range_model2 = AddressIPAddressRange(**address_ip_address_range_model_dict) # Verify the model instances are equivalent