From d94f00c8fb5cda0eeb7f93fec40a95c1e22a2811 Mon Sep 17 00:00:00 2001 From: Hari K Arla Date: Wed, 29 Oct 2025 16:32:22 +0530 Subject: [PATCH] feat(IAM Identity): add few new account settings Signed-off-by: Hari K Arla --- .secrets.baseline | 40 +- examples/test_iam_identity_v1_examples.py | 86 +- ibm_platform_services/iam_identity_v1.py | 4164 +++++++++++---------- test/integration/test_iam_identity_v1.py | 157 +- test/unit/test_iam_identity_v1.py | 662 +++- 5 files changed, 2855 insertions(+), 2254 deletions(-) diff --git a/.secrets.baseline b/.secrets.baseline index a06aa1c..9913ebe 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "^.secrets.baseline$", "lines": null }, - "generated_at": "2025-01-09T22:39:35Z", + "generated_at": "2025-10-30T10:03:11Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -78,11 +78,19 @@ ], "results": { "examples/test_iam_identity_v1_examples.py": [ + { + "hashed_secret": "469f62fa9e1c6afe62e8808180668934ee548e8f", + "is_secret": false, + "is_verified": false, + "line_number": 1598, + "type": "Secret Keyword", + "verified_result": null + }, { "hashed_secret": "a2190c299b60e882d9fb33736d5e6ab6ffe42708", "is_secret": false, "is_verified": false, - "line_number": 939, + "line_number": 1697, "type": "Secret Keyword", "verified_result": null }, @@ -90,7 +98,7 @@ "hashed_secret": "cf4d2385b84329a52ca542285b93d9c4618420df", "is_secret": false, "is_verified": false, - "line_number": 1618, + "line_number": 1816, "type": "Secret Keyword", "verified_result": null } @@ -117,18 +125,18 @@ ], "test/integration/test_iam_identity_v1.py": [ { - "hashed_secret": "a2190c299b60e882d9fb33736d5e6ab6ffe42708", + "hashed_secret": "469f62fa9e1c6afe62e8808180668934ee548e8f", "is_secret": false, "is_verified": false, - "line_number": 1148, + "line_number": 1874, "type": "Secret Keyword", "verified_result": null }, { - "hashed_secret": "cf4d2385b84329a52ca542285b93d9c4618420df", + "hashed_secret": "a2190c299b60e882d9fb33736d5e6ab6ffe42708", "is_secret": false, "is_verified": false, - "line_number": 1702, + "line_number": 1964, "type": "Secret Keyword", "verified_result": null } @@ -270,15 +278,15 @@ "hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030", "is_secret": false, "is_verified": false, - "line_number": 1575, + "line_number": 1969, "type": "Secret Keyword", "verified_result": null }, { - "hashed_secret": "cf4d2385b84329a52ca542285b93d9c4618420df", + "hashed_secret": "b8473b86d4c2072ca9b08bd28e373e8253e865c4", "is_secret": false, "is_verified": false, - "line_number": 4055, + "line_number": 12008, "type": "Secret Keyword", "verified_result": null }, @@ -286,15 +294,7 @@ "hashed_secret": "469f62fa9e1c6afe62e8808180668934ee548e8f", "is_secret": false, "is_verified": false, - "line_number": 9511, - "type": "Secret Keyword", - "verified_result": null - }, - { - "hashed_secret": "b8473b86d4c2072ca9b08bd28e373e8253e865c4", - "is_secret": false, - "is_verified": false, - "line_number": 10632, + "line_number": 12086, "type": "Secret Keyword", "verified_result": null } @@ -352,7 +352,7 @@ } ] }, - "version": "0.13.1+ibm.62.dss", + "version": "0.13.1+ibm.64.dss", "word_list": { "file": null, "hash": null diff --git a/examples/test_iam_identity_v1_examples.py b/examples/test_iam_identity_v1_examples.py index 79d9d74..b1f69dd 100644 --- a/examples/test_iam_identity_v1_examples.py +++ b/examples/test_iam_identity_v1_examples.py @@ -171,7 +171,7 @@ def waitUntilTrustedProfileAssignmentFinished(cls, service, assignmentId): profile_template_assignment_etag is not None break except ApiException as e: - if e.code == 404: + if getattr(e, "status_code", None) == 404: finished = True break time.sleep(10) @@ -191,7 +191,7 @@ def waitUntilAccountSettingsAssignmentFinished(cls, service, assignmentId): account_settings_template_assignment_etag is not None break except ApiException as e: - if e.code == 404: + if getattr(e, "status_code", None) == 404: finished = True break time.sleep(10) @@ -1576,15 +1576,42 @@ def test_create_account_settings_template(self): print('\ncreate_account_settings_template() result:') # begin-create_account_settings_template - account_settings = {} - account_settings['mfa'] = 'LEVEL1' - account_settings['system_access_token_expiration_in_seconds'] = 3000 + # Construct a dict representation of a UserMfa model + user_mfa_model = { + 'iam_id': iam_id, + 'mfa': 'LEVEL2', + } + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = { + 'realm_id': 'IBMid', + 'invitation_email_allow_patterns': ["*.*@ibm.com"], + 'restrict_invitation': True, + } + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = { + 'account_sufficient': True, + 'restrictions': [account_settings_user_domain_restriction_model], + } + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = { + 'restrict_create_service_id': 'NOT_SET', + 'restrict_create_platform_apikey': 'NOT_SET', + 'mfa': 'LEVEL1', + 'user_mfa': [user_mfa_model], + 'session_expiration_in_seconds': '86400', + 'session_invalidation_in_seconds': '7200', + 'max_sessions_per_identity': '10', + 'system_access_token_expiration_in_seconds': '3600', + 'system_refresh_token_expiration_in_seconds': '259200', + 'restrict_user_list_visibility': 'RESTRICTED', + 'restrict_user_domains': template_account_settings_restrict_user_domains_model, + } create_response = iam_identity_service.create_account_settings_template( name=account_settings_template_name, description='IAM enterprise account settings template example', account_id=enterprise_account_id, - account_settings=account_settings, + account_settings=template_account_settings_model, ) account_settings_template = create_response.get_result() print('\ncreate_account_settings_template() response: ', json.dumps(account_settings_template, indent=2)) @@ -1648,9 +1675,36 @@ def test_update_account_settings_template(self): global account_settings_template_etag # begin-update_account_settings_template_version - account_settings = {} - account_settings['mfa'] = 'LEVEL1' - account_settings['system_access_token_expiration_in_seconds'] = 3000 + # Construct a dict representation of a UserMfa model + user_mfa_model = { + 'iam_id': iam_id, + 'mfa': 'LEVEL1', + } + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = { + 'realm_id': 'IBMid', + 'invitation_email_allow_patterns': ["*.*@sap.com"], + 'restrict_invitation': True, + } + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = { + 'account_sufficient': False, + 'restrictions': [account_settings_user_domain_restriction_model], + } + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = { + 'restrict_create_service_id': 'NOT_RESTRICTED', + 'restrict_create_platform_apikey': 'NOT_RESTRICTED', + 'mfa': 'LEVEL2', + 'user_mfa': [user_mfa_model], + 'session_expiration_in_seconds': '72400', + 'session_invalidation_in_seconds': '6000', + 'max_sessions_per_identity': '5', + 'system_access_token_expiration_in_seconds': '3000', + 'system_refresh_token_expiration_in_seconds': '200000', + 'restrict_user_list_visibility': 'NOT_RESTRICTED', + 'restrict_user_domains': template_account_settings_restrict_user_domains_model, + } update_response = iam_identity_service.update_account_settings_template_version( account_id=enterprise_account_id, @@ -1659,7 +1713,7 @@ def test_update_account_settings_template(self): if_match=account_settings_template_etag, name=account_settings_template_name, description='IAM enterprise account settings template example - updated', - account_settings=account_settings, + account_settings=template_account_settings_model, ) account_settings_template = update_response.get_result() print('\nupdate_account_settings_template() response: ', json.dumps(account_settings_template, indent=2)) @@ -1761,6 +1815,18 @@ def test_create_new_account_settings_template_version(self): account_settings['system_access_token_expiration_in_seconds'] = 2600 account_settings['restrict_create_platform_apikey'] = 'RESTRICTED' account_settings['restrict_create_service_id'] = 'RESTRICTED' + account_settings['session_expiration_in_seconds'] = 75000 + account_settings['session_invalidation_in_seconds'] = 5000 + account_settings['max_sessions_per_identity'] = '7' + account_settings['restrict_user_list_visibility'] = 'RESTRICTED' + account_settings_user_mfa = {} + account_settings_user_mfa['iam_id'] = iam_id + account_settings_user_mfa['mfa'] = 'LEVEL2' + account_settings['user_mfa'] = [account_settings_user_mfa] + account_settings_user_domain_restriction_model = {} + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = ['*.*@example.com'] + account_settings_user_domain_restriction_model['restrict_invitation'] = True create_response = iam_identity_service.create_account_settings_template_version( template_id=account_settings_template_id, diff --git a/ibm_platform_services/iam_identity_v1.py b/ibm_platform_services/iam_identity_v1.py index 6d9046c..0d81572 100644 --- a/ibm_platform_services/iam_identity_v1.py +++ b/ibm_platform_services/iam_identity_v1.py @@ -2851,16 +2851,16 @@ def update_account_settings( *, restrict_create_service_id: Optional[str] = None, restrict_create_platform_apikey: Optional[str] = None, - restrict_user_list_visibility: Optional[str] = None, - restrict_user_domains: Optional[List['AccountSettingsUserDomainRestriction']] = None, allowed_ip_addresses: Optional[str] = None, mfa: Optional[str] = None, + user_mfa: Optional[List['UserMfa']] = None, session_expiration_in_seconds: Optional[str] = None, session_invalidation_in_seconds: Optional[str] = None, max_sessions_per_identity: Optional[str] = None, system_access_token_expiration_in_seconds: Optional[str] = None, system_refresh_token_expiration_in_seconds: Optional[str] = None, - user_mfa: Optional[List['UserMfa']] = None, + restrict_user_list_visibility: Optional[str] = None, + restrict_user_domains: Optional[List['AccountSettingsUserDomainRestriction']] = None, **kwargs, ) -> DetailedResponse: """ @@ -2888,17 +2888,6 @@ def update_account_settings( IAM Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. - :param str restrict_user_list_visibility: (optional) Defines whether or not - user visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the - account, such as those the user has invited to the account, or descendants - of those users based on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the - Users page in IBM Cloud console. - :param List[AccountSettingsUserDomainRestriction] restrict_user_domains: - (optional) Defines if account invitations are restricted to specified - domains. To remove an entry for a realm_id, perform an update (PUT) request - with only the realm_id set. :param str allowed_ip_addresses: (optional) Defines the IP addresses and subnets from which IAM tokens can be created for the account. :param str mfa: (optional) MFA trait definitions as follows: @@ -2909,6 +2898,8 @@ def update_account_settings( * LEVEL1 - Email-based MFA for all users * LEVEL2 - TOTP-based MFA for all users * LEVEL3 - U2F MFA for all users. + :param List[UserMfa] user_mfa: (optional) List of users that are exempted + from the MFA requirement of the account. :param str session_expiration_in_seconds: (optional) Defines the session expiration in seconds for the account. Valid values: * Any whole number between between '900' and '86400' @@ -2930,8 +2921,17 @@ def update_account_settings( the refresh token expiration in seconds. Valid values: * Any whole number between '900' and '259200' * NOT_SET - To unset account setting and use service default. - :param List[UserMfa] user_mfa: (optional) List of users that are exempted - from the MFA requirement of the account. + :param str restrict_user_list_visibility: (optional) Defines whether or not + user visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the + account, such as those the user has invited to the account, or descendants + of those users based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the + Users page in IBM Cloud console. + :param List[AccountSettingsUserDomainRestriction] restrict_user_domains: + (optional) Defines if account invitations are restricted to specified + domains. To remove an entry for a realm_id, perform an update (PUT) request + with only the realm_id set. :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 `AccountSettingsResponse` object @@ -2941,10 +2941,10 @@ def update_account_settings( raise ValueError('if_match must be provided') if not account_id: raise ValueError('account_id must be provided') - if restrict_user_domains is not None: - restrict_user_domains = [convert_model(x) for x in restrict_user_domains] if user_mfa is not None: user_mfa = [convert_model(x) for x in user_mfa] + if restrict_user_domains is not None: + restrict_user_domains = [convert_model(x) for x in restrict_user_domains] headers = { 'If-Match': if_match, } @@ -2958,16 +2958,16 @@ def update_account_settings( data = { 'restrict_create_service_id': restrict_create_service_id, 'restrict_create_platform_apikey': restrict_create_platform_apikey, - 'restrict_user_list_visibility': restrict_user_list_visibility, - 'restrict_user_domains': restrict_user_domains, 'allowed_ip_addresses': allowed_ip_addresses, 'mfa': mfa, + 'user_mfa': user_mfa, 'session_expiration_in_seconds': session_expiration_in_seconds, 'session_invalidation_in_seconds': session_invalidation_in_seconds, 'max_sessions_per_identity': max_sessions_per_identity, 'system_access_token_expiration_in_seconds': system_access_token_expiration_in_seconds, 'system_refresh_token_expiration_in_seconds': system_refresh_token_expiration_in_seconds, - 'user_mfa': user_mfa, + 'restrict_user_list_visibility': restrict_user_list_visibility, + 'restrict_user_domains': restrict_user_domains, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -4540,7 +4540,7 @@ def create_account_settings_template( account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, - account_settings: Optional['AccountSettingsComponent'] = None, + account_settings: Optional['TemplateAccountSettings'] = None, **kwargs, ) -> DetailedResponse: """ @@ -4554,7 +4554,8 @@ def create_account_settings_template( is visible only in the enterprise account. :param str description: (optional) The description of the trusted profile template. Describe the template for enterprise account users. - :param AccountSettingsComponent account_settings: (optional) + :param TemplateAccountSettings account_settings: (optional) Input body + parameters for the Account Settings REST request. :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 `AccountSettingsTemplateResponse` object @@ -4769,7 +4770,7 @@ def create_account_settings_template_version( account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, - account_settings: Optional['AccountSettingsComponent'] = None, + account_settings: Optional['TemplateAccountSettings'] = None, **kwargs, ) -> DetailedResponse: """ @@ -4784,7 +4785,8 @@ def create_account_settings_template_version( is visible only in the enterprise account. :param str description: (optional) The description of the trusted profile template. Describe the template for enterprise account users. - :param AccountSettingsComponent account_settings: (optional) + :param TemplateAccountSettings account_settings: (optional) Input body + parameters for the Account Settings REST request. :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 `AccountSettingsTemplateResponse` object @@ -4897,7 +4899,7 @@ def update_account_settings_template_version( account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, - account_settings: Optional['AccountSettingsComponent'] = None, + account_settings: Optional['TemplateAccountSettings'] = None, **kwargs, ) -> DetailedResponse: """ @@ -4918,7 +4920,8 @@ def update_account_settings_template_version( is visible only in the enterprise account. :param str description: (optional) The description of the trusted profile template. Describe the template for enterprise account users. - :param AccountSettingsComponent account_settings: (optional) + :param TemplateAccountSettings account_settings: (optional) Input body + parameters for the Account Settings REST request. :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 `AccountSettingsTemplateResponse` object @@ -5749,7 +5752,7 @@ def __ne__(self, other: 'AccountBasedMfaEnrollment') -> bool: class AccountSettingsAssignedTemplatesSection: """ - Response body format for Account Settings REST requests. + Input body parameters for the Account Settings REST request. :param str template_id: Template Id. :param int template_version: Template version. @@ -5766,17 +5769,6 @@ class AccountSettingsAssignedTemplatesSection: Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. - :param str restrict_user_list_visibility: (optional) Defines whether or not user - visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the account, - such as those the user has invited to the account, or descendants of those users - based on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the Users - page in IBM Cloud console. - :param List[AccountSettingsUserDomainRestriction] restrict_user_domains: - (optional) Defines if account invitations are restricted to specified domains. - To remove an entry for a realm_id, perform an update (PUT) request with only the - realm_id set. :param str allowed_ip_addresses: (optional) Defines the IP addresses and subnets from which IAM tokens can be created for the account. :param str mfa: (optional) MFA trait definitions as follows: @@ -5808,8 +5800,18 @@ class AccountSettingsAssignedTemplatesSection: refresh token expiration in seconds. Valid values: * Any whole number between '900' and '259200' * NOT_SET - To unset account setting and use service default. + :param str restrict_user_list_visibility: (optional) Defines whether or not user + visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the account, + such as those the user has invited to the account, or descendants of those users + based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the Users + page in IBM Cloud console + * NOT_SET - to 'unset' a previous set value. :param List[AccountSettingsUserMFAResponse] user_mfa: (optional) List of users that are exempted from the MFA requirement of the account. + :param AssignedTemplatesAccountSettingsRestrictUserDomains + restrict_user_domains: (optional) """ def __init__( @@ -5820,8 +5822,6 @@ def __init__( *, restrict_create_service_id: Optional[str] = None, restrict_create_platform_apikey: Optional[str] = None, - restrict_user_list_visibility: Optional[str] = None, - restrict_user_domains: Optional[List['AccountSettingsUserDomainRestriction']] = None, allowed_ip_addresses: Optional[str] = None, mfa: Optional[str] = None, session_expiration_in_seconds: Optional[str] = None, @@ -5829,7 +5829,9 @@ def __init__( max_sessions_per_identity: Optional[str] = None, system_access_token_expiration_in_seconds: Optional[str] = None, system_refresh_token_expiration_in_seconds: Optional[str] = None, + restrict_user_list_visibility: Optional[str] = None, user_mfa: Optional[List['AccountSettingsUserMFAResponse']] = None, + restrict_user_domains: Optional['AssignedTemplatesAccountSettingsRestrictUserDomains'] = None, ) -> None: """ Initialize a AccountSettingsAssignedTemplatesSection object. @@ -5849,17 +5851,6 @@ def __init__( IAM Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. - :param str restrict_user_list_visibility: (optional) Defines whether or not - user visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the - account, such as those the user has invited to the account, or descendants - of those users based on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the - Users page in IBM Cloud console. - :param List[AccountSettingsUserDomainRestriction] restrict_user_domains: - (optional) Defines if account invitations are restricted to specified - domains. To remove an entry for a realm_id, perform an update (PUT) request - with only the realm_id set. :param str allowed_ip_addresses: (optional) Defines the IP addresses and subnets from which IAM tokens can be created for the account. :param str mfa: (optional) MFA trait definitions as follows: @@ -5891,16 +5882,24 @@ def __init__( the refresh token expiration in seconds. Valid values: * Any whole number between '900' and '259200' * NOT_SET - To unset account setting and use service default. + :param str restrict_user_list_visibility: (optional) Defines whether or not + user visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the + account, such as those the user has invited to the account, or descendants + of those users based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the + Users page in IBM Cloud console + * NOT_SET - to 'unset' a previous set value. :param List[AccountSettingsUserMFAResponse] user_mfa: (optional) List of users that are exempted from the MFA requirement of the account. + :param AssignedTemplatesAccountSettingsRestrictUserDomains + restrict_user_domains: (optional) """ self.template_id = template_id self.template_version = template_version self.template_name = template_name self.restrict_create_service_id = restrict_create_service_id self.restrict_create_platform_apikey = restrict_create_platform_apikey - self.restrict_user_list_visibility = restrict_user_list_visibility - self.restrict_user_domains = restrict_user_domains self.allowed_ip_addresses = allowed_ip_addresses self.mfa = mfa self.session_expiration_in_seconds = session_expiration_in_seconds @@ -5908,7 +5907,9 @@ def __init__( self.max_sessions_per_identity = max_sessions_per_identity self.system_access_token_expiration_in_seconds = system_access_token_expiration_in_seconds self.system_refresh_token_expiration_in_seconds = system_refresh_token_expiration_in_seconds + self.restrict_user_list_visibility = restrict_user_list_visibility self.user_mfa = user_mfa + self.restrict_user_domains = restrict_user_domains @classmethod def from_dict(cls, _dict: Dict) -> 'AccountSettingsAssignedTemplatesSection': @@ -5936,12 +5937,6 @@ def from_dict(cls, _dict: Dict) -> 'AccountSettingsAssignedTemplatesSection': args['restrict_create_service_id'] = restrict_create_service_id if (restrict_create_platform_apikey := _dict.get('restrict_create_platform_apikey')) is not None: args['restrict_create_platform_apikey'] = restrict_create_platform_apikey - if (restrict_user_list_visibility := _dict.get('restrict_user_list_visibility')) is not None: - args['restrict_user_list_visibility'] = restrict_user_list_visibility - if (restrict_user_domains := _dict.get('restrict_user_domains')) is not None: - args['restrict_user_domains'] = [ - AccountSettingsUserDomainRestriction.from_dict(v) for v in restrict_user_domains - ] if (allowed_ip_addresses := _dict.get('allowed_ip_addresses')) is not None: args['allowed_ip_addresses'] = allowed_ip_addresses if (mfa := _dict.get('mfa')) is not None: @@ -5960,8 +5955,14 @@ def from_dict(cls, _dict: Dict) -> 'AccountSettingsAssignedTemplatesSection': system_refresh_token_expiration_in_seconds := _dict.get('system_refresh_token_expiration_in_seconds') ) is not None: args['system_refresh_token_expiration_in_seconds'] = system_refresh_token_expiration_in_seconds + if (restrict_user_list_visibility := _dict.get('restrict_user_list_visibility')) is not None: + args['restrict_user_list_visibility'] = restrict_user_list_visibility if (user_mfa := _dict.get('user_mfa')) is not None: args['user_mfa'] = [AccountSettingsUserMFAResponse.from_dict(v) for v in user_mfa] + if (restrict_user_domains := _dict.get('restrict_user_domains')) is not None: + args['restrict_user_domains'] = AssignedTemplatesAccountSettingsRestrictUserDomains.from_dict( + restrict_user_domains + ) return cls(**args) @classmethod @@ -5982,16 +5983,6 @@ def to_dict(self) -> Dict: _dict['restrict_create_service_id'] = self.restrict_create_service_id if hasattr(self, 'restrict_create_platform_apikey') and self.restrict_create_platform_apikey is not None: _dict['restrict_create_platform_apikey'] = self.restrict_create_platform_apikey - if hasattr(self, 'restrict_user_list_visibility') and self.restrict_user_list_visibility is not None: - _dict['restrict_user_list_visibility'] = self.restrict_user_list_visibility - if hasattr(self, 'restrict_user_domains') and self.restrict_user_domains is not None: - restrict_user_domains_list = [] - for v in self.restrict_user_domains: - if isinstance(v, dict): - restrict_user_domains_list.append(v) - else: - restrict_user_domains_list.append(v.to_dict()) - _dict['restrict_user_domains'] = restrict_user_domains_list if hasattr(self, 'allowed_ip_addresses') and self.allowed_ip_addresses is not None: _dict['allowed_ip_addresses'] = self.allowed_ip_addresses if hasattr(self, 'mfa') and self.mfa is not None: @@ -6012,6 +6003,8 @@ def to_dict(self) -> Dict: and self.system_refresh_token_expiration_in_seconds is not None ): _dict['system_refresh_token_expiration_in_seconds'] = self.system_refresh_token_expiration_in_seconds + if hasattr(self, 'restrict_user_list_visibility') and self.restrict_user_list_visibility is not None: + _dict['restrict_user_list_visibility'] = self.restrict_user_list_visibility if hasattr(self, 'user_mfa') and self.user_mfa is not None: user_mfa_list = [] for v in self.user_mfa: @@ -6020,6 +6013,11 @@ def to_dict(self) -> Dict: else: user_mfa_list.append(v.to_dict()) _dict['user_mfa'] = user_mfa_list + if hasattr(self, 'restrict_user_domains') and self.restrict_user_domains is not None: + if isinstance(self.restrict_user_domains, dict): + _dict['restrict_user_domains'] = self.restrict_user_domains + else: + _dict['restrict_user_domains'] = self.restrict_user_domains.to_dict() return _dict def _to_dict(self): @@ -6066,19 +6064,6 @@ class RestrictCreatePlatformApikeyEnum(str, Enum): NOT_RESTRICTED = 'NOT_RESTRICTED' NOT_SET = 'NOT_SET' - class RestrictUserListVisibilityEnum(str, Enum): - """ - Defines whether or not user visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the account, such - as those the user has invited to the account, or descendants of those users based - on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the Users - page in IBM Cloud console. - """ - - NOT_RESTRICTED = 'NOT_RESTRICTED' - RESTRICTED = 'RESTRICTED' - class MfaEnum(str, Enum): """ MFA trait definitions as follows: @@ -6099,10 +6084,25 @@ class MfaEnum(str, Enum): LEVEL2 = 'LEVEL2' LEVEL3 = 'LEVEL3' + class RestrictUserListVisibilityEnum(str, Enum): + """ + Defines whether or not user visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the account, such + as those the user has invited to the account, or descendants of those users based + on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the Users + page in IBM Cloud console + * NOT_SET - to 'unset' a previous set value. + """ + + RESTRICTED = 'RESTRICTED' + NOT_RESTRICTED = 'NOT_RESTRICTED' + NOT_SET = 'NOT_SET' + -class AccountSettingsComponent: +class AccountSettingsEffectiveSection: """ - AccountSettingsComponent. + AccountSettingsEffectiveSection. :param str restrict_create_service_id: (optional) Defines whether or not creating the resource is access controlled. Valid values: @@ -6116,6 +6116,13 @@ class AccountSettingsComponent: Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. + :param str restrict_user_list_visibility: (optional) Defines whether or not user + visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the account, + such as those the user has invited to the account, or descendants of those users + based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the Users + page in IBM Cloud console. :param str allowed_ip_addresses: (optional) Defines the IP addresses and subnets from which IAM tokens can be created for the account. :param str mfa: (optional) MFA trait definitions as follows: @@ -6126,8 +6133,8 @@ class AccountSettingsComponent: * LEVEL1 - Email-based MFA for all users * LEVEL2 - TOTP-based MFA for all users * LEVEL3 - U2F MFA for all users. - :param List[UserMfa] user_mfa: (optional) List of users that are exempted from - the MFA requirement of the account. + :param List[AccountSettingsUserMFAResponse] user_mfa: (optional) List of users + that are exempted from the MFA requirement of the account. :param str session_expiration_in_seconds: (optional) Defines the session expiration in seconds for the account. Valid values: * Any whole number between between '900' and '86400' @@ -6156,9 +6163,10 @@ def __init__( *, restrict_create_service_id: Optional[str] = None, restrict_create_platform_apikey: Optional[str] = None, + restrict_user_list_visibility: Optional[str] = None, allowed_ip_addresses: Optional[str] = None, mfa: Optional[str] = None, - user_mfa: Optional[List['UserMfa']] = None, + user_mfa: Optional[List['AccountSettingsUserMFAResponse']] = None, session_expiration_in_seconds: Optional[str] = None, session_invalidation_in_seconds: Optional[str] = None, max_sessions_per_identity: Optional[str] = None, @@ -6166,7 +6174,7 @@ def __init__( system_refresh_token_expiration_in_seconds: Optional[str] = None, ) -> None: """ - Initialize a AccountSettingsComponent object. + Initialize a AccountSettingsEffectiveSection object. :param str restrict_create_service_id: (optional) Defines whether or not creating the resource is access controlled. Valid values: @@ -6180,6 +6188,13 @@ def __init__( IAM Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. + :param str restrict_user_list_visibility: (optional) Defines whether or not + user visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the + account, such as those the user has invited to the account, or descendants + of those users based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the + Users page in IBM Cloud console. :param str allowed_ip_addresses: (optional) Defines the IP addresses and subnets from which IAM tokens can be created for the account. :param str mfa: (optional) MFA trait definitions as follows: @@ -6190,8 +6205,8 @@ def __init__( * LEVEL1 - Email-based MFA for all users * LEVEL2 - TOTP-based MFA for all users * LEVEL3 - U2F MFA for all users. - :param List[UserMfa] user_mfa: (optional) List of users that are exempted - from the MFA requirement of the account. + :param List[AccountSettingsUserMFAResponse] user_mfa: (optional) List of + users that are exempted from the MFA requirement of the account. :param str session_expiration_in_seconds: (optional) Defines the session expiration in seconds for the account. Valid values: * Any whole number between between '900' and '86400' @@ -6216,6 +6231,7 @@ def __init__( """ self.restrict_create_service_id = restrict_create_service_id self.restrict_create_platform_apikey = restrict_create_platform_apikey + self.restrict_user_list_visibility = restrict_user_list_visibility self.allowed_ip_addresses = allowed_ip_addresses self.mfa = mfa self.user_mfa = user_mfa @@ -6226,19 +6242,21 @@ def __init__( self.system_refresh_token_expiration_in_seconds = system_refresh_token_expiration_in_seconds @classmethod - def from_dict(cls, _dict: Dict) -> 'AccountSettingsComponent': - """Initialize a AccountSettingsComponent object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'AccountSettingsEffectiveSection': + """Initialize a AccountSettingsEffectiveSection object from a json dictionary.""" args = {} if (restrict_create_service_id := _dict.get('restrict_create_service_id')) is not None: args['restrict_create_service_id'] = restrict_create_service_id if (restrict_create_platform_apikey := _dict.get('restrict_create_platform_apikey')) is not None: args['restrict_create_platform_apikey'] = restrict_create_platform_apikey + if (restrict_user_list_visibility := _dict.get('restrict_user_list_visibility')) is not None: + args['restrict_user_list_visibility'] = restrict_user_list_visibility if (allowed_ip_addresses := _dict.get('allowed_ip_addresses')) is not None: args['allowed_ip_addresses'] = allowed_ip_addresses if (mfa := _dict.get('mfa')) is not None: args['mfa'] = mfa if (user_mfa := _dict.get('user_mfa')) is not None: - args['user_mfa'] = [UserMfa.from_dict(v) for v in user_mfa] + args['user_mfa'] = [AccountSettingsUserMFAResponse.from_dict(v) for v in user_mfa] if (session_expiration_in_seconds := _dict.get('session_expiration_in_seconds')) is not None: args['session_expiration_in_seconds'] = session_expiration_in_seconds if (session_invalidation_in_seconds := _dict.get('session_invalidation_in_seconds')) is not None: @@ -6257,7 +6275,7 @@ def from_dict(cls, _dict: Dict) -> 'AccountSettingsComponent': @classmethod def _from_dict(cls, _dict): - """Initialize a AccountSettingsComponent object from a json dictionary.""" + """Initialize a AccountSettingsEffectiveSection object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -6267,6 +6285,8 @@ def to_dict(self) -> Dict: _dict['restrict_create_service_id'] = self.restrict_create_service_id if hasattr(self, 'restrict_create_platform_apikey') and self.restrict_create_platform_apikey is not None: _dict['restrict_create_platform_apikey'] = self.restrict_create_platform_apikey + if hasattr(self, 'restrict_user_list_visibility') and self.restrict_user_list_visibility is not None: + _dict['restrict_user_list_visibility'] = self.restrict_user_list_visibility if hasattr(self, 'allowed_ip_addresses') and self.allowed_ip_addresses is not None: _dict['allowed_ip_addresses'] = self.allowed_ip_addresses if hasattr(self, 'mfa') and self.mfa is not None: @@ -6302,16 +6322,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AccountSettingsComponent object.""" + """Return a `str` version of this AccountSettingsEffectiveSection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AccountSettingsComponent') -> bool: + def __eq__(self, other: 'AccountSettingsEffectiveSection') -> 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: 'AccountSettingsComponent') -> bool: + def __ne__(self, other: 'AccountSettingsEffectiveSection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -6341,6 +6361,19 @@ class RestrictCreatePlatformApikeyEnum(str, Enum): NOT_RESTRICTED = 'NOT_RESTRICTED' NOT_SET = 'NOT_SET' + class RestrictUserListVisibilityEnum(str, Enum): + """ + Defines whether or not user visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the account, such + as those the user has invited to the account, or descendants of those users based + on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the Users + page in IBM Cloud console. + """ + + NOT_RESTRICTED = 'NOT_RESTRICTED' + RESTRICTED = 'RESTRICTED' + class MfaEnum(str, Enum): """ MFA trait definitions as follows: @@ -6362,32 +6395,31 @@ class MfaEnum(str, Enum): LEVEL3 = 'LEVEL3' -class AccountSettingsEffectiveSection: +class AccountSettingsResponse: """ - AccountSettingsEffectiveSection. + Input body parameters for the Account Settings REST request. - :param str restrict_create_service_id: (optional) Defines whether or not - creating the resource is access controlled. Valid values: + :param ResponseContext context: (optional) Context with key properties for + problem determination. + :param str account_id: Unique ID of the account. + :param str entity_tag: Version of the account settings. + :param List[EnityHistoryRecord] history: (optional) History of the Account + Settings. + :param str restrict_create_service_id: Defines whether or not creating the + resource is access controlled. Valid values: * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. - :param str restrict_create_platform_apikey: (optional) Defines whether or not - creating the resource is access controlled. Valid values: + :param str restrict_create_platform_apikey: Defines whether or not creating the + resource is access controlled. Valid values: * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. - :param str restrict_user_list_visibility: (optional) Defines whether or not user - visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the account, - such as those the user has invited to the account, or descendants of those users - based on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the Users - page in IBM Cloud console. - :param str allowed_ip_addresses: (optional) Defines the IP addresses and subnets - from which IAM tokens can be created for the account. - :param str mfa: (optional) MFA trait definitions as follows: + :param str allowed_ip_addresses: Defines the IP addresses and subnets from which + IAM tokens can be created for the account. + :param str mfa: MFA trait definitions as follows: * NONE - No MFA trait set * NONE_NO_ROPC- No MFA, disable CLI logins with only a password * TOTP - For all non-federated IBMId users @@ -6395,71 +6427,80 @@ class AccountSettingsEffectiveSection: * LEVEL1 - Email-based MFA for all users * LEVEL2 - TOTP-based MFA for all users * LEVEL3 - U2F MFA for all users. - :param List[AccountSettingsUserMFAResponse] user_mfa: (optional) List of users - that are exempted from the MFA requirement of the account. - :param str session_expiration_in_seconds: (optional) Defines the session - expiration in seconds for the account. Valid values: + :param str session_expiration_in_seconds: Defines the session expiration in + seconds for the account. Valid values: * Any whole number between between '900' and '86400' * NOT_SET - To unset account setting and use service default. - :param str session_invalidation_in_seconds: (optional) Defines the period of - time in seconds in which a session will be invalidated due to inactivity. Valid - values: + :param str session_invalidation_in_seconds: Defines the period of time in + seconds in which a session will be invalidated due to inactivity. Valid values: * Any whole number between '900' and '7200' * NOT_SET - To unset account setting and use service default. - :param str max_sessions_per_identity: (optional) Defines the max allowed - sessions per identity required by the account. Valid values: + :param str max_sessions_per_identity: Defines the max allowed sessions per + identity required by the account. Valid values: * Any whole number greater than 0 * NOT_SET - To unset account setting and use service default. - :param str system_access_token_expiration_in_seconds: (optional) Defines the - access token expiration in seconds. Valid values: + :param str system_access_token_expiration_in_seconds: Defines the access token + expiration in seconds. Valid values: * Any whole number between '900' and '3600' * NOT_SET - To unset account setting and use service default. - :param str system_refresh_token_expiration_in_seconds: (optional) Defines the - refresh token expiration in seconds. Valid values: + :param str system_refresh_token_expiration_in_seconds: Defines the refresh token + expiration in seconds. Valid values: * Any whole number between '900' and '259200' * NOT_SET - To unset account setting and use service default. + :param str restrict_user_list_visibility: Defines whether or not user visibility + is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the account, + such as those the user has invited to the account, or descendants of those users + based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the Users + page in IBM Cloud console. + :param List[AccountSettingsUserMFAResponse] user_mfa: List of users that are + exempted from the MFA requirement of the account. + :param List[AccountSettingsUserDomainRestriction] restrict_user_domains: Defines + if account invitations are restricted to specified domains. To remove an entry + for a realm_id, perform an update (PUT) request with only the realm_id set. """ def __init__( self, - *, - restrict_create_service_id: Optional[str] = None, - restrict_create_platform_apikey: Optional[str] = None, - restrict_user_list_visibility: Optional[str] = None, - allowed_ip_addresses: Optional[str] = None, - mfa: Optional[str] = None, - user_mfa: Optional[List['AccountSettingsUserMFAResponse']] = None, - session_expiration_in_seconds: Optional[str] = None, - session_invalidation_in_seconds: Optional[str] = None, - max_sessions_per_identity: Optional[str] = None, - system_access_token_expiration_in_seconds: Optional[str] = None, - system_refresh_token_expiration_in_seconds: Optional[str] = None, + account_id: str, + entity_tag: str, + restrict_create_service_id: str, + restrict_create_platform_apikey: str, + allowed_ip_addresses: str, + mfa: str, + session_expiration_in_seconds: str, + session_invalidation_in_seconds: str, + max_sessions_per_identity: str, + system_access_token_expiration_in_seconds: str, + system_refresh_token_expiration_in_seconds: str, + restrict_user_list_visibility: str, + user_mfa: List['AccountSettingsUserMFAResponse'], + restrict_user_domains: List['AccountSettingsUserDomainRestriction'], + *, + context: Optional['ResponseContext'] = None, + history: Optional[List['EnityHistoryRecord']] = None, ) -> None: """ - Initialize a AccountSettingsEffectiveSection object. + Initialize a AccountSettingsResponse object. - :param str restrict_create_service_id: (optional) Defines whether or not - creating the resource is access controlled. Valid values: + :param str account_id: Unique ID of the account. + :param str entity_tag: Version of the account settings. + :param str restrict_create_service_id: Defines whether or not creating the + resource is access controlled. Valid values: * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. - :param str restrict_create_platform_apikey: (optional) Defines whether or - not creating the resource is access controlled. Valid values: + :param str restrict_create_platform_apikey: Defines whether or not creating + the resource is access controlled. Valid values: * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM Identity Service can create service IDs, including the account owner * NOT_RESTRICTED - all members of an account can create service IDs * NOT_SET - to 'unset' a previous set value. - :param str restrict_user_list_visibility: (optional) Defines whether or not - user visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the - account, such as those the user has invited to the account, or descendants - of those users based on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the - Users page in IBM Cloud console. - :param str allowed_ip_addresses: (optional) Defines the IP addresses and - subnets from which IAM tokens can be created for the account. - :param str mfa: (optional) MFA trait definitions as follows: + :param str allowed_ip_addresses: Defines the IP addresses and subnets from + which IAM tokens can be created for the account. + :param str mfa: MFA trait definitions as follows: * NONE - No MFA trait set * NONE_NO_ROPC- No MFA, disable CLI logins with only a password * TOTP - For all non-federated IBMId users @@ -6467,100 +6508,183 @@ def __init__( * LEVEL1 - Email-based MFA for all users * LEVEL2 - TOTP-based MFA for all users * LEVEL3 - U2F MFA for all users. - :param List[AccountSettingsUserMFAResponse] user_mfa: (optional) List of - users that are exempted from the MFA requirement of the account. - :param str session_expiration_in_seconds: (optional) Defines the session - expiration in seconds for the account. Valid values: + :param str session_expiration_in_seconds: Defines the session expiration in + seconds for the account. Valid values: * Any whole number between between '900' and '86400' * NOT_SET - To unset account setting and use service default. - :param str session_invalidation_in_seconds: (optional) Defines the period - of time in seconds in which a session will be invalidated due to - inactivity. Valid values: + :param str session_invalidation_in_seconds: Defines the period of time in + seconds in which a session will be invalidated due to inactivity. Valid + values: * Any whole number between '900' and '7200' * NOT_SET - To unset account setting and use service default. - :param str max_sessions_per_identity: (optional) Defines the max allowed - sessions per identity required by the account. Valid values: + :param str max_sessions_per_identity: Defines the max allowed sessions per + identity required by the account. Valid values: * Any whole number greater than 0 * NOT_SET - To unset account setting and use service default. - :param str system_access_token_expiration_in_seconds: (optional) Defines - the access token expiration in seconds. Valid values: + :param str system_access_token_expiration_in_seconds: Defines the access + token expiration in seconds. Valid values: * Any whole number between '900' and '3600' * NOT_SET - To unset account setting and use service default. - :param str system_refresh_token_expiration_in_seconds: (optional) Defines - the refresh token expiration in seconds. Valid values: + :param str system_refresh_token_expiration_in_seconds: Defines the refresh + token expiration in seconds. Valid values: * Any whole number between '900' and '259200' * NOT_SET - To unset account setting and use service default. + :param str restrict_user_list_visibility: Defines whether or not user + visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the + account, such as those the user has invited to the account, or descendants + of those users based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the + Users page in IBM Cloud console. + :param List[AccountSettingsUserMFAResponse] user_mfa: List of users that + are exempted from the MFA requirement of the account. + :param List[AccountSettingsUserDomainRestriction] restrict_user_domains: + Defines if account invitations are restricted to specified domains. To + remove an entry for a realm_id, perform an update (PUT) request with only + the realm_id set. + :param ResponseContext context: (optional) Context with key properties for + problem determination. + :param List[EnityHistoryRecord] history: (optional) History of the Account + Settings. """ + self.context = context + self.account_id = account_id + self.entity_tag = entity_tag + self.history = history self.restrict_create_service_id = restrict_create_service_id self.restrict_create_platform_apikey = restrict_create_platform_apikey - self.restrict_user_list_visibility = restrict_user_list_visibility self.allowed_ip_addresses = allowed_ip_addresses self.mfa = mfa - self.user_mfa = user_mfa self.session_expiration_in_seconds = session_expiration_in_seconds self.session_invalidation_in_seconds = session_invalidation_in_seconds self.max_sessions_per_identity = max_sessions_per_identity self.system_access_token_expiration_in_seconds = system_access_token_expiration_in_seconds self.system_refresh_token_expiration_in_seconds = system_refresh_token_expiration_in_seconds + self.restrict_user_list_visibility = restrict_user_list_visibility + self.user_mfa = user_mfa + self.restrict_user_domains = restrict_user_domains @classmethod - def from_dict(cls, _dict: Dict) -> 'AccountSettingsEffectiveSection': - """Initialize a AccountSettingsEffectiveSection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'AccountSettingsResponse': + """Initialize a AccountSettingsResponse object from a json dictionary.""" args = {} + if (context := _dict.get('context')) is not None: + args['context'] = ResponseContext.from_dict(context) + if (account_id := _dict.get('account_id')) is not None: + args['account_id'] = account_id + else: + raise ValueError('Required property \'account_id\' not present in AccountSettingsResponse JSON') + if (entity_tag := _dict.get('entity_tag')) is not None: + args['entity_tag'] = entity_tag + else: + raise ValueError('Required property \'entity_tag\' not present in AccountSettingsResponse JSON') + if (history := _dict.get('history')) is not None: + args['history'] = [EnityHistoryRecord.from_dict(v) for v in history] if (restrict_create_service_id := _dict.get('restrict_create_service_id')) is not None: args['restrict_create_service_id'] = restrict_create_service_id + else: + raise ValueError( + 'Required property \'restrict_create_service_id\' not present in AccountSettingsResponse JSON' + ) if (restrict_create_platform_apikey := _dict.get('restrict_create_platform_apikey')) is not None: args['restrict_create_platform_apikey'] = restrict_create_platform_apikey - if (restrict_user_list_visibility := _dict.get('restrict_user_list_visibility')) is not None: - args['restrict_user_list_visibility'] = restrict_user_list_visibility + else: + raise ValueError( + 'Required property \'restrict_create_platform_apikey\' not present in AccountSettingsResponse JSON' + ) if (allowed_ip_addresses := _dict.get('allowed_ip_addresses')) is not None: args['allowed_ip_addresses'] = allowed_ip_addresses + else: + raise ValueError('Required property \'allowed_ip_addresses\' not present in AccountSettingsResponse JSON') if (mfa := _dict.get('mfa')) is not None: args['mfa'] = mfa - if (user_mfa := _dict.get('user_mfa')) is not None: - args['user_mfa'] = [AccountSettingsUserMFAResponse.from_dict(v) for v in user_mfa] + else: + raise ValueError('Required property \'mfa\' not present in AccountSettingsResponse JSON') if (session_expiration_in_seconds := _dict.get('session_expiration_in_seconds')) is not None: args['session_expiration_in_seconds'] = session_expiration_in_seconds + else: + raise ValueError( + 'Required property \'session_expiration_in_seconds\' not present in AccountSettingsResponse JSON' + ) if (session_invalidation_in_seconds := _dict.get('session_invalidation_in_seconds')) is not None: args['session_invalidation_in_seconds'] = session_invalidation_in_seconds + else: + raise ValueError( + 'Required property \'session_invalidation_in_seconds\' not present in AccountSettingsResponse JSON' + ) if (max_sessions_per_identity := _dict.get('max_sessions_per_identity')) is not None: args['max_sessions_per_identity'] = max_sessions_per_identity + else: + raise ValueError( + 'Required property \'max_sessions_per_identity\' not present in AccountSettingsResponse JSON' + ) if ( system_access_token_expiration_in_seconds := _dict.get('system_access_token_expiration_in_seconds') ) is not None: args['system_access_token_expiration_in_seconds'] = system_access_token_expiration_in_seconds + else: + raise ValueError( + 'Required property \'system_access_token_expiration_in_seconds\' not present in AccountSettingsResponse JSON' + ) if ( system_refresh_token_expiration_in_seconds := _dict.get('system_refresh_token_expiration_in_seconds') ) is not None: args['system_refresh_token_expiration_in_seconds'] = system_refresh_token_expiration_in_seconds + else: + raise ValueError( + 'Required property \'system_refresh_token_expiration_in_seconds\' not present in AccountSettingsResponse JSON' + ) + if (restrict_user_list_visibility := _dict.get('restrict_user_list_visibility')) is not None: + args['restrict_user_list_visibility'] = restrict_user_list_visibility + else: + raise ValueError( + 'Required property \'restrict_user_list_visibility\' not present in AccountSettingsResponse JSON' + ) + if (user_mfa := _dict.get('user_mfa')) is not None: + args['user_mfa'] = [AccountSettingsUserMFAResponse.from_dict(v) for v in user_mfa] + else: + raise ValueError('Required property \'user_mfa\' not present in AccountSettingsResponse JSON') + if (restrict_user_domains := _dict.get('restrict_user_domains')) is not None: + args['restrict_user_domains'] = [ + AccountSettingsUserDomainRestriction.from_dict(v) for v in restrict_user_domains + ] + else: + raise ValueError('Required property \'restrict_user_domains\' not present in AccountSettingsResponse JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AccountSettingsEffectiveSection object from a json dictionary.""" + """Initialize a AccountSettingsResponse 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, 'context') and self.context is not None: + if isinstance(self.context, dict): + _dict['context'] = self.context + else: + _dict['context'] = self.context.to_dict() + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'entity_tag') and self.entity_tag is not None: + _dict['entity_tag'] = self.entity_tag + if hasattr(self, 'history') and self.history is not None: + history_list = [] + for v in self.history: + if isinstance(v, dict): + history_list.append(v) + else: + history_list.append(v.to_dict()) + _dict['history'] = history_list if hasattr(self, 'restrict_create_service_id') and self.restrict_create_service_id is not None: _dict['restrict_create_service_id'] = self.restrict_create_service_id if hasattr(self, 'restrict_create_platform_apikey') and self.restrict_create_platform_apikey is not None: _dict['restrict_create_platform_apikey'] = self.restrict_create_platform_apikey - if hasattr(self, 'restrict_user_list_visibility') and self.restrict_user_list_visibility is not None: - _dict['restrict_user_list_visibility'] = self.restrict_user_list_visibility if hasattr(self, 'allowed_ip_addresses') and self.allowed_ip_addresses is not None: _dict['allowed_ip_addresses'] = self.allowed_ip_addresses if hasattr(self, 'mfa') and self.mfa is not None: _dict['mfa'] = self.mfa - if hasattr(self, 'user_mfa') and self.user_mfa is not None: - user_mfa_list = [] - for v in self.user_mfa: - if isinstance(v, dict): - user_mfa_list.append(v) - else: - user_mfa_list.append(v.to_dict()) - _dict['user_mfa'] = user_mfa_list if hasattr(self, 'session_expiration_in_seconds') and self.session_expiration_in_seconds is not None: _dict['session_expiration_in_seconds'] = self.session_expiration_in_seconds if hasattr(self, 'session_invalidation_in_seconds') and self.session_invalidation_in_seconds is not None: @@ -6577,6 +6701,24 @@ def to_dict(self) -> Dict: and self.system_refresh_token_expiration_in_seconds is not None ): _dict['system_refresh_token_expiration_in_seconds'] = self.system_refresh_token_expiration_in_seconds + if hasattr(self, 'restrict_user_list_visibility') and self.restrict_user_list_visibility is not None: + _dict['restrict_user_list_visibility'] = self.restrict_user_list_visibility + if hasattr(self, 'user_mfa') and self.user_mfa is not None: + user_mfa_list = [] + for v in self.user_mfa: + if isinstance(v, dict): + user_mfa_list.append(v) + else: + user_mfa_list.append(v.to_dict()) + _dict['user_mfa'] = user_mfa_list + if hasattr(self, 'restrict_user_domains') and self.restrict_user_domains is not None: + restrict_user_domains_list = [] + for v in self.restrict_user_domains: + if isinstance(v, dict): + restrict_user_domains_list.append(v) + else: + restrict_user_domains_list.append(v.to_dict()) + _dict['restrict_user_domains'] = restrict_user_domains_list return _dict def _to_dict(self): @@ -6584,16 +6726,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AccountSettingsEffectiveSection object.""" + """Return a `str` version of this AccountSettingsResponse object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AccountSettingsEffectiveSection') -> bool: + def __eq__(self, other: 'AccountSettingsResponse') -> 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: 'AccountSettingsEffectiveSection') -> bool: + def __ne__(self, other: 'AccountSettingsResponse') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -6623,19 +6765,6 @@ class RestrictCreatePlatformApikeyEnum(str, Enum): NOT_RESTRICTED = 'NOT_RESTRICTED' NOT_SET = 'NOT_SET' - class RestrictUserListVisibilityEnum(str, Enum): - """ - Defines whether or not user visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the account, such - as those the user has invited to the account, or descendants of those users based - on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the Users - page in IBM Cloud console. - """ - - NOT_RESTRICTED = 'NOT_RESTRICTED' - RESTRICTED = 'RESTRICTED' - class MfaEnum(str, Enum): """ MFA trait definitions as follows: @@ -6656,414 +6785,23 @@ class MfaEnum(str, Enum): LEVEL2 = 'LEVEL2' LEVEL3 = 'LEVEL3' + class RestrictUserListVisibilityEnum(str, Enum): + """ + Defines whether or not user visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the account, such + as those the user has invited to the account, or descendants of those users based + on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the Users + page in IBM Cloud console. + """ + + NOT_RESTRICTED = 'NOT_RESTRICTED' + RESTRICTED = 'RESTRICTED' + -class AccountSettingsResponse: +class AccountSettingsTemplateList: """ - Input body parameters for the Account Settings REST request. - - :param ResponseContext context: (optional) Context with key properties for - problem determination. - :param str account_id: Unique ID of the account. - :param str entity_tag: Version of the account settings. - :param List[EnityHistoryRecord] history: (optional) History of the Account - Settings. - :param str restrict_create_service_id: Defines whether or not creating the - resource is access controlled. Valid values: - * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM - Identity Service can create service IDs, including the account owner - * NOT_RESTRICTED - all members of an account can create service IDs - * NOT_SET - to 'unset' a previous set value. - :param str restrict_create_platform_apikey: Defines whether or not creating the - resource is access controlled. Valid values: - * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM - Identity Service can create service IDs, including the account owner - * NOT_RESTRICTED - all members of an account can create service IDs - * NOT_SET - to 'unset' a previous set value. - :param str restrict_user_list_visibility: Defines whether or not user visibility - is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the account, - such as those the user has invited to the account, or descendants of those users - based on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the Users - page in IBM Cloud console. - :param List[AccountSettingsUserDomainRestriction] restrict_user_domains: Defines - if account invitations are restricted to specified domains. To remove an entry - for a realm_id, perform an update (PUT) request with only the realm_id set. - :param str allowed_ip_addresses: Defines the IP addresses and subnets from which - IAM tokens can be created for the account. - :param str mfa: MFA trait definitions as follows: - * NONE - No MFA trait set - * NONE_NO_ROPC- No MFA, disable CLI logins with only a password - * TOTP - For all non-federated IBMId users - * TOTP4ALL - For all users - * LEVEL1 - Email-based MFA for all users - * LEVEL2 - TOTP-based MFA for all users - * LEVEL3 - U2F MFA for all users. - :param str session_expiration_in_seconds: Defines the session expiration in - seconds for the account. Valid values: - * Any whole number between between '900' and '86400' - * NOT_SET - To unset account setting and use service default. - :param str session_invalidation_in_seconds: Defines the period of time in - seconds in which a session will be invalidated due to inactivity. Valid values: - * Any whole number between '900' and '7200' - * NOT_SET - To unset account setting and use service default. - :param str max_sessions_per_identity: Defines the max allowed sessions per - identity required by the account. Valid values: - * Any whole number greater than 0 - * NOT_SET - To unset account setting and use service default. - :param str system_access_token_expiration_in_seconds: Defines the access token - expiration in seconds. Valid values: - * Any whole number between '900' and '3600' - * NOT_SET - To unset account setting and use service default. - :param str system_refresh_token_expiration_in_seconds: Defines the refresh token - expiration in seconds. Valid values: - * Any whole number between '900' and '259200' - * NOT_SET - To unset account setting and use service default. - :param List[AccountSettingsUserMFAResponse] user_mfa: List of users that are - exempted from the MFA requirement of the account. - """ - - def __init__( - self, - account_id: str, - entity_tag: str, - restrict_create_service_id: str, - restrict_create_platform_apikey: str, - restrict_user_list_visibility: str, - restrict_user_domains: List['AccountSettingsUserDomainRestriction'], - allowed_ip_addresses: str, - mfa: str, - session_expiration_in_seconds: str, - session_invalidation_in_seconds: str, - max_sessions_per_identity: str, - system_access_token_expiration_in_seconds: str, - system_refresh_token_expiration_in_seconds: str, - user_mfa: List['AccountSettingsUserMFAResponse'], - *, - context: Optional['ResponseContext'] = None, - history: Optional[List['EnityHistoryRecord']] = None, - ) -> None: - """ - Initialize a AccountSettingsResponse object. - - :param str account_id: Unique ID of the account. - :param str entity_tag: Version of the account settings. - :param str restrict_create_service_id: Defines whether or not creating the - resource is access controlled. Valid values: - * RESTRICTED - only users assigned the 'Service ID creator' role on the - IAM Identity Service can create service IDs, including the account owner - * NOT_RESTRICTED - all members of an account can create service IDs - * NOT_SET - to 'unset' a previous set value. - :param str restrict_create_platform_apikey: Defines whether or not creating - the resource is access controlled. Valid values: - * RESTRICTED - only users assigned the 'Service ID creator' role on the - IAM Identity Service can create service IDs, including the account owner - * NOT_RESTRICTED - all members of an account can create service IDs - * NOT_SET - to 'unset' a previous set value. - :param str restrict_user_list_visibility: Defines whether or not user - visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the - account, such as those the user has invited to the account, or descendants - of those users based on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the - Users page in IBM Cloud console. - :param List[AccountSettingsUserDomainRestriction] restrict_user_domains: - Defines if account invitations are restricted to specified domains. To - remove an entry for a realm_id, perform an update (PUT) request with only - the realm_id set. - :param str allowed_ip_addresses: Defines the IP addresses and subnets from - which IAM tokens can be created for the account. - :param str mfa: MFA trait definitions as follows: - * NONE - No MFA trait set - * NONE_NO_ROPC- No MFA, disable CLI logins with only a password - * TOTP - For all non-federated IBMId users - * TOTP4ALL - For all users - * LEVEL1 - Email-based MFA for all users - * LEVEL2 - TOTP-based MFA for all users - * LEVEL3 - U2F MFA for all users. - :param str session_expiration_in_seconds: Defines the session expiration in - seconds for the account. Valid values: - * Any whole number between between '900' and '86400' - * NOT_SET - To unset account setting and use service default. - :param str session_invalidation_in_seconds: Defines the period of time in - seconds in which a session will be invalidated due to inactivity. Valid - values: - * Any whole number between '900' and '7200' - * NOT_SET - To unset account setting and use service default. - :param str max_sessions_per_identity: Defines the max allowed sessions per - identity required by the account. Valid values: - * Any whole number greater than 0 - * NOT_SET - To unset account setting and use service default. - :param str system_access_token_expiration_in_seconds: Defines the access - token expiration in seconds. Valid values: - * Any whole number between '900' and '3600' - * NOT_SET - To unset account setting and use service default. - :param str system_refresh_token_expiration_in_seconds: Defines the refresh - token expiration in seconds. Valid values: - * Any whole number between '900' and '259200' - * NOT_SET - To unset account setting and use service default. - :param List[AccountSettingsUserMFAResponse] user_mfa: List of users that - are exempted from the MFA requirement of the account. - :param ResponseContext context: (optional) Context with key properties for - problem determination. - :param List[EnityHistoryRecord] history: (optional) History of the Account - Settings. - """ - self.context = context - self.account_id = account_id - self.entity_tag = entity_tag - self.history = history - self.restrict_create_service_id = restrict_create_service_id - self.restrict_create_platform_apikey = restrict_create_platform_apikey - self.restrict_user_list_visibility = restrict_user_list_visibility - self.restrict_user_domains = restrict_user_domains - self.allowed_ip_addresses = allowed_ip_addresses - self.mfa = mfa - self.session_expiration_in_seconds = session_expiration_in_seconds - self.session_invalidation_in_seconds = session_invalidation_in_seconds - self.max_sessions_per_identity = max_sessions_per_identity - self.system_access_token_expiration_in_seconds = system_access_token_expiration_in_seconds - self.system_refresh_token_expiration_in_seconds = system_refresh_token_expiration_in_seconds - self.user_mfa = user_mfa - - @classmethod - def from_dict(cls, _dict: Dict) -> 'AccountSettingsResponse': - """Initialize a AccountSettingsResponse object from a json dictionary.""" - args = {} - if (context := _dict.get('context')) is not None: - args['context'] = ResponseContext.from_dict(context) - if (account_id := _dict.get('account_id')) is not None: - args['account_id'] = account_id - else: - raise ValueError('Required property \'account_id\' not present in AccountSettingsResponse JSON') - if (entity_tag := _dict.get('entity_tag')) is not None: - args['entity_tag'] = entity_tag - else: - raise ValueError('Required property \'entity_tag\' not present in AccountSettingsResponse JSON') - if (history := _dict.get('history')) is not None: - args['history'] = [EnityHistoryRecord.from_dict(v) for v in history] - if (restrict_create_service_id := _dict.get('restrict_create_service_id')) is not None: - args['restrict_create_service_id'] = restrict_create_service_id - else: - raise ValueError( - 'Required property \'restrict_create_service_id\' not present in AccountSettingsResponse JSON' - ) - if (restrict_create_platform_apikey := _dict.get('restrict_create_platform_apikey')) is not None: - args['restrict_create_platform_apikey'] = restrict_create_platform_apikey - else: - raise ValueError( - 'Required property \'restrict_create_platform_apikey\' not present in AccountSettingsResponse JSON' - ) - if (restrict_user_list_visibility := _dict.get('restrict_user_list_visibility')) is not None: - args['restrict_user_list_visibility'] = restrict_user_list_visibility - else: - raise ValueError( - 'Required property \'restrict_user_list_visibility\' not present in AccountSettingsResponse JSON' - ) - if (restrict_user_domains := _dict.get('restrict_user_domains')) is not None: - args['restrict_user_domains'] = [ - AccountSettingsUserDomainRestriction.from_dict(v) for v in restrict_user_domains - ] - else: - raise ValueError('Required property \'restrict_user_domains\' not present in AccountSettingsResponse JSON') - if (allowed_ip_addresses := _dict.get('allowed_ip_addresses')) is not None: - args['allowed_ip_addresses'] = allowed_ip_addresses - else: - raise ValueError('Required property \'allowed_ip_addresses\' not present in AccountSettingsResponse JSON') - if (mfa := _dict.get('mfa')) is not None: - args['mfa'] = mfa - else: - raise ValueError('Required property \'mfa\' not present in AccountSettingsResponse JSON') - if (session_expiration_in_seconds := _dict.get('session_expiration_in_seconds')) is not None: - args['session_expiration_in_seconds'] = session_expiration_in_seconds - else: - raise ValueError( - 'Required property \'session_expiration_in_seconds\' not present in AccountSettingsResponse JSON' - ) - if (session_invalidation_in_seconds := _dict.get('session_invalidation_in_seconds')) is not None: - args['session_invalidation_in_seconds'] = session_invalidation_in_seconds - else: - raise ValueError( - 'Required property \'session_invalidation_in_seconds\' not present in AccountSettingsResponse JSON' - ) - if (max_sessions_per_identity := _dict.get('max_sessions_per_identity')) is not None: - args['max_sessions_per_identity'] = max_sessions_per_identity - else: - raise ValueError( - 'Required property \'max_sessions_per_identity\' not present in AccountSettingsResponse JSON' - ) - if ( - system_access_token_expiration_in_seconds := _dict.get('system_access_token_expiration_in_seconds') - ) is not None: - args['system_access_token_expiration_in_seconds'] = system_access_token_expiration_in_seconds - else: - raise ValueError( - 'Required property \'system_access_token_expiration_in_seconds\' not present in AccountSettingsResponse JSON' - ) - if ( - system_refresh_token_expiration_in_seconds := _dict.get('system_refresh_token_expiration_in_seconds') - ) is not None: - args['system_refresh_token_expiration_in_seconds'] = system_refresh_token_expiration_in_seconds - else: - raise ValueError( - 'Required property \'system_refresh_token_expiration_in_seconds\' not present in AccountSettingsResponse JSON' - ) - if (user_mfa := _dict.get('user_mfa')) is not None: - args['user_mfa'] = [AccountSettingsUserMFAResponse.from_dict(v) for v in user_mfa] - else: - raise ValueError('Required property \'user_mfa\' not present in AccountSettingsResponse JSON') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a AccountSettingsResponse 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, 'context') and self.context is not None: - if isinstance(self.context, dict): - _dict['context'] = self.context - else: - _dict['context'] = self.context.to_dict() - if hasattr(self, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'entity_tag') and self.entity_tag is not None: - _dict['entity_tag'] = self.entity_tag - if hasattr(self, 'history') and self.history is not None: - history_list = [] - for v in self.history: - if isinstance(v, dict): - history_list.append(v) - else: - history_list.append(v.to_dict()) - _dict['history'] = history_list - if hasattr(self, 'restrict_create_service_id') and self.restrict_create_service_id is not None: - _dict['restrict_create_service_id'] = self.restrict_create_service_id - if hasattr(self, 'restrict_create_platform_apikey') and self.restrict_create_platform_apikey is not None: - _dict['restrict_create_platform_apikey'] = self.restrict_create_platform_apikey - if hasattr(self, 'restrict_user_list_visibility') and self.restrict_user_list_visibility is not None: - _dict['restrict_user_list_visibility'] = self.restrict_user_list_visibility - if hasattr(self, 'restrict_user_domains') and self.restrict_user_domains is not None: - restrict_user_domains_list = [] - for v in self.restrict_user_domains: - if isinstance(v, dict): - restrict_user_domains_list.append(v) - else: - restrict_user_domains_list.append(v.to_dict()) - _dict['restrict_user_domains'] = restrict_user_domains_list - if hasattr(self, 'allowed_ip_addresses') and self.allowed_ip_addresses is not None: - _dict['allowed_ip_addresses'] = self.allowed_ip_addresses - if hasattr(self, 'mfa') and self.mfa is not None: - _dict['mfa'] = self.mfa - if hasattr(self, 'session_expiration_in_seconds') and self.session_expiration_in_seconds is not None: - _dict['session_expiration_in_seconds'] = self.session_expiration_in_seconds - if hasattr(self, 'session_invalidation_in_seconds') and self.session_invalidation_in_seconds is not None: - _dict['session_invalidation_in_seconds'] = self.session_invalidation_in_seconds - if hasattr(self, 'max_sessions_per_identity') and self.max_sessions_per_identity is not None: - _dict['max_sessions_per_identity'] = self.max_sessions_per_identity - if ( - hasattr(self, 'system_access_token_expiration_in_seconds') - and self.system_access_token_expiration_in_seconds is not None - ): - _dict['system_access_token_expiration_in_seconds'] = self.system_access_token_expiration_in_seconds - if ( - hasattr(self, 'system_refresh_token_expiration_in_seconds') - and self.system_refresh_token_expiration_in_seconds is not None - ): - _dict['system_refresh_token_expiration_in_seconds'] = self.system_refresh_token_expiration_in_seconds - if hasattr(self, 'user_mfa') and self.user_mfa is not None: - user_mfa_list = [] - for v in self.user_mfa: - if isinstance(v, dict): - user_mfa_list.append(v) - else: - user_mfa_list.append(v.to_dict()) - _dict['user_mfa'] = user_mfa_list - 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 AccountSettingsResponse object.""" - return json.dumps(self.to_dict(), indent=2) - - def __eq__(self, other: 'AccountSettingsResponse') -> 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: 'AccountSettingsResponse') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class RestrictCreateServiceIdEnum(str, Enum): - """ - Defines whether or not creating the resource is access controlled. Valid values: - * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM - Identity Service can create service IDs, including the account owner - * NOT_RESTRICTED - all members of an account can create service IDs - * NOT_SET - to 'unset' a previous set value. - """ - - RESTRICTED = 'RESTRICTED' - NOT_RESTRICTED = 'NOT_RESTRICTED' - NOT_SET = 'NOT_SET' - - class RestrictCreatePlatformApikeyEnum(str, Enum): - """ - Defines whether or not creating the resource is access controlled. Valid values: - * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM - Identity Service can create service IDs, including the account owner - * NOT_RESTRICTED - all members of an account can create service IDs - * NOT_SET - to 'unset' a previous set value. - """ - - RESTRICTED = 'RESTRICTED' - NOT_RESTRICTED = 'NOT_RESTRICTED' - NOT_SET = 'NOT_SET' - - class RestrictUserListVisibilityEnum(str, Enum): - """ - Defines whether or not user visibility is access controlled. Valid values: - * RESTRICTED - users can view only specific types of users in the account, such - as those the user has invited to the account, or descendants of those users based - on the classic infrastructure hierarchy - * NOT_RESTRICTED - any user in the account can view other users from the Users - page in IBM Cloud console. - """ - - NOT_RESTRICTED = 'NOT_RESTRICTED' - RESTRICTED = 'RESTRICTED' - - class MfaEnum(str, Enum): - """ - MFA trait definitions as follows: - * NONE - No MFA trait set - * NONE_NO_ROPC- No MFA, disable CLI logins with only a password - * TOTP - For all non-federated IBMId users - * TOTP4ALL - For all users - * LEVEL1 - Email-based MFA for all users - * LEVEL2 - TOTP-based MFA for all users - * LEVEL3 - U2F MFA for all users. - """ - - NONE = 'NONE' - NONE_NO_ROPC = 'NONE_NO_ROPC' - TOTP = 'TOTP' - TOTP4ALL = 'TOTP4ALL' - LEVEL1 = 'LEVEL1' - LEVEL2 = 'LEVEL2' - LEVEL3 = 'LEVEL3' - - -class AccountSettingsTemplateList: - """ - AccountSettingsTemplateList. + AccountSettingsTemplateList. :param ResponseContext context: (optional) Context with key properties for problem determination. @@ -7209,7 +6947,8 @@ class AccountSettingsTemplateResponse: template. Describe the template for enterprise account users. :param bool committed: Committed flag determines if the template is ready for assignment. - :param AccountSettingsComponent account_settings: + :param TemplateAccountSettings account_settings: Input body parameters for the + Account Settings REST request. :param List[EnityHistoryRecord] history: (optional) History of the Template. :param str entity_tag: Entity tag for this templateId-version combination. :param str crn: Cloud resource name. @@ -7227,7 +6966,7 @@ def __init__( account_id: str, name: str, committed: bool, - account_settings: 'AccountSettingsComponent', + account_settings: 'TemplateAccountSettings', entity_tag: str, crn: str, *, @@ -7248,7 +6987,8 @@ def __init__( only in the enterprise account. :param bool committed: Committed flag determines if the template is ready for assignment. - :param AccountSettingsComponent account_settings: + :param TemplateAccountSettings account_settings: Input body parameters for + the Account Settings REST request. :param str entity_tag: Entity tag for this templateId-version combination. :param str crn: Cloud resource name. :param str description: (optional) The description of the trusted profile @@ -7303,7 +7043,7 @@ def from_dict(cls, _dict: Dict) -> 'AccountSettingsTemplateResponse': else: raise ValueError('Required property \'committed\' not present in AccountSettingsTemplateResponse JSON') if (account_settings := _dict.get('account_settings')) is not None: - args['account_settings'] = AccountSettingsComponent.from_dict(account_settings) + args['account_settings'] = TemplateAccountSettings.from_dict(account_settings) else: raise ValueError( 'Required property \'account_settings\' not present in AccountSettingsTemplateResponse JSON' @@ -8735,16 +8475,94 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ApikeyActivityUser object.""" + """Return a `str` version of this ApikeyActivityUser object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ApikeyActivityUser') -> 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: 'ApikeyActivityUser') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AssignedTemplatesAccountSettingsRestrictUserDomains: + """ + AssignedTemplatesAccountSettingsRestrictUserDomains. + + :param bool account_sufficient: (optional) + :param List[AccountSettingsUserDomainRestriction] restrictions: (optional) + Defines if account invitations are restricted to specified domains. To remove an + entry for a realm_id, perform an update (PUT) request with only the realm_id + set. + """ + + def __init__( + self, + *, + account_sufficient: Optional[bool] = None, + restrictions: Optional[List['AccountSettingsUserDomainRestriction']] = None, + ) -> None: + """ + Initialize a AssignedTemplatesAccountSettingsRestrictUserDomains object. + + :param bool account_sufficient: (optional) + :param List[AccountSettingsUserDomainRestriction] restrictions: (optional) + Defines if account invitations are restricted to specified domains. To + remove an entry for a realm_id, perform an update (PUT) request with only + the realm_id set. + """ + self.account_sufficient = account_sufficient + self.restrictions = restrictions + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AssignedTemplatesAccountSettingsRestrictUserDomains': + """Initialize a AssignedTemplatesAccountSettingsRestrictUserDomains object from a json dictionary.""" + args = {} + if (account_sufficient := _dict.get('account_sufficient')) is not None: + args['account_sufficient'] = account_sufficient + if (restrictions := _dict.get('restrictions')) is not None: + args['restrictions'] = [AccountSettingsUserDomainRestriction.from_dict(v) for v in restrictions] + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AssignedTemplatesAccountSettingsRestrictUserDomains 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, 'account_sufficient') and self.account_sufficient is not None: + _dict['account_sufficient'] = self.account_sufficient + if hasattr(self, 'restrictions') and self.restrictions is not None: + restrictions_list = [] + for v in self.restrictions: + if isinstance(v, dict): + restrictions_list.append(v) + else: + restrictions_list.append(v.to_dict()) + _dict['restrictions'] = restrictions_list + 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 AssignedTemplatesAccountSettingsRestrictUserDomains object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ApikeyActivityUser') -> bool: + def __eq__(self, other: 'AssignedTemplatesAccountSettingsRestrictUserDomains') -> 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: 'ApikeyActivityUser') -> bool: + def __ne__(self, other: 'AssignedTemplatesAccountSettingsRestrictUserDomains') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -9766,35 +9584,347 @@ def __init__( :param bool required: Describes whether the enrollment type is required. :param bool enrolled: Describes whether the enrollment type is enrolled. """ - self.required = required - self.enrolled = enrolled + self.required = required + self.enrolled = enrolled + + @classmethod + def from_dict(cls, _dict: Dict) -> 'MfaEnrollmentTypeStatus': + """Initialize a MfaEnrollmentTypeStatus object from a json dictionary.""" + args = {} + if (required := _dict.get('required')) is not None: + args['required'] = required + else: + raise ValueError('Required property \'required\' not present in MfaEnrollmentTypeStatus JSON') + if (enrolled := _dict.get('enrolled')) is not None: + args['enrolled'] = enrolled + else: + raise ValueError('Required property \'enrolled\' not present in MfaEnrollmentTypeStatus JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a MfaEnrollmentTypeStatus 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, 'required') and self.required is not None: + _dict['required'] = self.required + if hasattr(self, 'enrolled') and self.enrolled is not None: + _dict['enrolled'] = self.enrolled + 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 MfaEnrollmentTypeStatus object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'MfaEnrollmentTypeStatus') -> 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: 'MfaEnrollmentTypeStatus') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class MfaEnrollments: + """ + MfaEnrollments. + + :param str effective_mfa_type: currently effective mfa type i.e. id_based_mfa or + account_based_mfa. + :param IdBasedMfaEnrollment id_based_mfa: (optional) + :param AccountBasedMfaEnrollment account_based_mfa: (optional) + """ + + def __init__( + self, + effective_mfa_type: str, + *, + id_based_mfa: Optional['IdBasedMfaEnrollment'] = None, + account_based_mfa: Optional['AccountBasedMfaEnrollment'] = None, + ) -> None: + """ + Initialize a MfaEnrollments object. + + :param str effective_mfa_type: currently effective mfa type i.e. + id_based_mfa or account_based_mfa. + :param IdBasedMfaEnrollment id_based_mfa: (optional) + :param AccountBasedMfaEnrollment account_based_mfa: (optional) + """ + self.effective_mfa_type = effective_mfa_type + self.id_based_mfa = id_based_mfa + self.account_based_mfa = account_based_mfa + + @classmethod + def from_dict(cls, _dict: Dict) -> 'MfaEnrollments': + """Initialize a MfaEnrollments object from a json dictionary.""" + args = {} + if (effective_mfa_type := _dict.get('effective_mfa_type')) is not None: + args['effective_mfa_type'] = effective_mfa_type + else: + raise ValueError('Required property \'effective_mfa_type\' not present in MfaEnrollments JSON') + if (id_based_mfa := _dict.get('id_based_mfa')) is not None: + args['id_based_mfa'] = IdBasedMfaEnrollment.from_dict(id_based_mfa) + if (account_based_mfa := _dict.get('account_based_mfa')) is not None: + args['account_based_mfa'] = AccountBasedMfaEnrollment.from_dict(account_based_mfa) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a MfaEnrollments 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, 'effective_mfa_type') and self.effective_mfa_type is not None: + _dict['effective_mfa_type'] = self.effective_mfa_type + if hasattr(self, 'id_based_mfa') and self.id_based_mfa is not None: + if isinstance(self.id_based_mfa, dict): + _dict['id_based_mfa'] = self.id_based_mfa + else: + _dict['id_based_mfa'] = self.id_based_mfa.to_dict() + if hasattr(self, 'account_based_mfa') and self.account_based_mfa is not None: + if isinstance(self.account_based_mfa, dict): + _dict['account_based_mfa'] = self.account_based_mfa + else: + _dict['account_based_mfa'] = self.account_based_mfa.to_dict() + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this MfaEnrollments object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'MfaEnrollments') -> 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: 'MfaEnrollments') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class PolicyTemplateReference: + """ + Metadata for external access policy. + + :param str id: ID of Access Policy Template. + :param str version: Version of Access Policy Template. + """ + + def __init__( + self, + id: str, + version: str, + ) -> None: + """ + Initialize a PolicyTemplateReference object. + + :param str id: ID of Access Policy Template. + :param str version: Version of Access Policy Template. + """ + self.id = id + self.version = version + + @classmethod + def from_dict(cls, _dict: Dict) -> 'PolicyTemplateReference': + """Initialize a PolicyTemplateReference object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in PolicyTemplateReference JSON') + if (version := _dict.get('version')) is not None: + args['version'] = version + else: + raise ValueError('Required property \'version\' not present in PolicyTemplateReference JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a PolicyTemplateReference 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, 'version') and self.version is not None: + _dict['version'] = self.version + 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 PolicyTemplateReference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'PolicyTemplateReference') -> 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: 'PolicyTemplateReference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ProfileClaimRule: + """ + ProfileClaimRule. + + :param str id: the unique identifier of the claim rule. + :param str entity_tag: version of the claim rule. + :param datetime created_at: If set contains a date time string of the creation + date in ISO format. + :param datetime modified_at: (optional) If set contains a date time string of + the last modification date in ISO format. + :param str name: (optional) The optional claim rule name. + :param str type: Type of the claim rule, either 'Profile-SAML' or 'Profile-CR'. + :param str realm_name: (optional) The realm name of the Idp this claim rule + applies to. + :param int expiration: Session expiration in seconds. + :param str cr_type: (optional) The compute resource type. Not required if type + is Profile-SAML. Valid values are VSI, IKS_SA, ROKS_SA. + :param List[ProfileClaimRuleConditions] conditions: Conditions of this claim + rule. + """ + + def __init__( + self, + id: str, + entity_tag: str, + created_at: datetime, + type: str, + expiration: int, + conditions: List['ProfileClaimRuleConditions'], + *, + modified_at: Optional[datetime] = None, + name: Optional[str] = None, + realm_name: Optional[str] = None, + cr_type: Optional[str] = None, + ) -> None: + """ + Initialize a ProfileClaimRule object. + + :param str id: the unique identifier of the claim rule. + :param str entity_tag: version of the claim rule. + :param datetime created_at: If set contains a date time string of the + creation date in ISO format. + :param str type: Type of the claim rule, either 'Profile-SAML' or + 'Profile-CR'. + :param int expiration: Session expiration in seconds. + :param List[ProfileClaimRuleConditions] conditions: Conditions of this + claim rule. + :param datetime modified_at: (optional) If set contains a date time string + of the last modification date in ISO format. + :param str name: (optional) The optional claim rule name. + :param str realm_name: (optional) The realm name of the Idp this claim rule + applies to. + :param str cr_type: (optional) The compute resource type. Not required if + type is Profile-SAML. Valid values are VSI, IKS_SA, ROKS_SA. + """ + self.id = id + self.entity_tag = entity_tag + self.created_at = created_at + self.modified_at = modified_at + self.name = name + self.type = type + self.realm_name = realm_name + self.expiration = expiration + self.cr_type = cr_type + self.conditions = conditions @classmethod - def from_dict(cls, _dict: Dict) -> 'MfaEnrollmentTypeStatus': - """Initialize a MfaEnrollmentTypeStatus object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileClaimRule': + """Initialize a ProfileClaimRule object from a json dictionary.""" args = {} - if (required := _dict.get('required')) is not None: - args['required'] = required + if (id := _dict.get('id')) is not None: + args['id'] = id else: - raise ValueError('Required property \'required\' not present in MfaEnrollmentTypeStatus JSON') - if (enrolled := _dict.get('enrolled')) is not None: - args['enrolled'] = enrolled + raise ValueError('Required property \'id\' not present in ProfileClaimRule JSON') + if (entity_tag := _dict.get('entity_tag')) is not None: + args['entity_tag'] = entity_tag else: - raise ValueError('Required property \'enrolled\' not present in MfaEnrollmentTypeStatus JSON') + raise ValueError('Required property \'entity_tag\' not present in ProfileClaimRule 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 ProfileClaimRule JSON') + if (modified_at := _dict.get('modified_at')) is not None: + args['modified_at'] = string_to_datetime(modified_at) + if (name := _dict.get('name')) is not None: + args['name'] = name + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in ProfileClaimRule JSON') + if (realm_name := _dict.get('realm_name')) is not None: + args['realm_name'] = realm_name + if (expiration := _dict.get('expiration')) is not None: + args['expiration'] = expiration + else: + raise ValueError('Required property \'expiration\' not present in ProfileClaimRule JSON') + if (cr_type := _dict.get('cr_type')) is not None: + args['cr_type'] = cr_type + if (conditions := _dict.get('conditions')) is not None: + args['conditions'] = [ProfileClaimRuleConditions.from_dict(v) for v in conditions] + else: + raise ValueError('Required property \'conditions\' not present in ProfileClaimRule JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a MfaEnrollmentTypeStatus object from a json dictionary.""" + """Initialize a ProfileClaimRule 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, 'required') and self.required is not None: - _dict['required'] = self.required - if hasattr(self, 'enrolled') and self.enrolled is not None: - _dict['enrolled'] = self.enrolled + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'entity_tag') and self.entity_tag is not None: + _dict['entity_tag'] = self.entity_tag + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'modified_at') and self.modified_at is not None: + _dict['modified_at'] = datetime_to_string(self.modified_at) + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'realm_name') and self.realm_name is not None: + _dict['realm_name'] = self.realm_name + if hasattr(self, 'expiration') and self.expiration is not None: + _dict['expiration'] = self.expiration + if hasattr(self, 'cr_type') and self.cr_type is not None: + _dict['cr_type'] = self.cr_type + if hasattr(self, 'conditions') and self.conditions is not None: + conditions_list = [] + for v in self.conditions: + if isinstance(v, dict): + conditions_list.append(v) + else: + conditions_list.append(v.to_dict()) + _dict['conditions'] = conditions_list return _dict def _to_dict(self): @@ -9802,83 +9932,85 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this MfaEnrollmentTypeStatus object.""" + """Return a `str` version of this ProfileClaimRule object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'MfaEnrollmentTypeStatus') -> bool: + def __eq__(self, other: 'ProfileClaimRule') -> 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: 'MfaEnrollmentTypeStatus') -> bool: + def __ne__(self, other: 'ProfileClaimRule') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class MfaEnrollments: +class ProfileClaimRuleConditions: """ - MfaEnrollments. + ProfileClaimRuleConditions. - :param str effective_mfa_type: currently effective mfa type i.e. id_based_mfa or - account_based_mfa. - :param IdBasedMfaEnrollment id_based_mfa: (optional) - :param AccountBasedMfaEnrollment account_based_mfa: (optional) + :param str claim: The claim to evaluate against. [Learn + more](/docs/account?topic=account-iam-condition-properties&interface=ui#cr-attribute-names). + :param str operator: The operation to perform on the claim. valid values are + EQUALS, NOT_EQUALS, EQUALS_IGNORE_CASE, NOT_EQUALS_IGNORE_CASE, CONTAINS, IN. + :param str value: The stringified JSON value that the claim is compared to using + the operator. """ def __init__( self, - effective_mfa_type: str, - *, - id_based_mfa: Optional['IdBasedMfaEnrollment'] = None, - account_based_mfa: Optional['AccountBasedMfaEnrollment'] = None, + claim: str, + operator: str, + value: str, ) -> None: """ - Initialize a MfaEnrollments object. + Initialize a ProfileClaimRuleConditions object. - :param str effective_mfa_type: currently effective mfa type i.e. - id_based_mfa or account_based_mfa. - :param IdBasedMfaEnrollment id_based_mfa: (optional) - :param AccountBasedMfaEnrollment account_based_mfa: (optional) + :param str claim: The claim to evaluate against. [Learn + more](/docs/account?topic=account-iam-condition-properties&interface=ui#cr-attribute-names). + :param str operator: The operation to perform on the claim. valid values + are EQUALS, NOT_EQUALS, EQUALS_IGNORE_CASE, NOT_EQUALS_IGNORE_CASE, + CONTAINS, IN. + :param str value: The stringified JSON value that the claim is compared to + using the operator. """ - self.effective_mfa_type = effective_mfa_type - self.id_based_mfa = id_based_mfa - self.account_based_mfa = account_based_mfa + self.claim = claim + self.operator = operator + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'MfaEnrollments': - """Initialize a MfaEnrollments object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileClaimRuleConditions': + """Initialize a ProfileClaimRuleConditions object from a json dictionary.""" args = {} - if (effective_mfa_type := _dict.get('effective_mfa_type')) is not None: - args['effective_mfa_type'] = effective_mfa_type + if (claim := _dict.get('claim')) is not None: + args['claim'] = claim else: - raise ValueError('Required property \'effective_mfa_type\' not present in MfaEnrollments JSON') - if (id_based_mfa := _dict.get('id_based_mfa')) is not None: - args['id_based_mfa'] = IdBasedMfaEnrollment.from_dict(id_based_mfa) - if (account_based_mfa := _dict.get('account_based_mfa')) is not None: - args['account_based_mfa'] = AccountBasedMfaEnrollment.from_dict(account_based_mfa) + raise ValueError('Required property \'claim\' not present in ProfileClaimRuleConditions JSON') + if (operator := _dict.get('operator')) is not None: + args['operator'] = operator + else: + raise ValueError('Required property \'operator\' not present in ProfileClaimRuleConditions JSON') + if (value := _dict.get('value')) is not None: + args['value'] = value + else: + raise ValueError('Required property \'value\' not present in ProfileClaimRuleConditions JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a MfaEnrollments object from a json dictionary.""" + """Initialize a ProfileClaimRuleConditions 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, 'effective_mfa_type') and self.effective_mfa_type is not None: - _dict['effective_mfa_type'] = self.effective_mfa_type - if hasattr(self, 'id_based_mfa') and self.id_based_mfa is not None: - if isinstance(self.id_based_mfa, dict): - _dict['id_based_mfa'] = self.id_based_mfa - else: - _dict['id_based_mfa'] = self.id_based_mfa.to_dict() - if hasattr(self, 'account_based_mfa') and self.account_based_mfa is not None: - if isinstance(self.account_based_mfa, dict): - _dict['account_based_mfa'] = self.account_based_mfa - else: - _dict['account_based_mfa'] = self.account_based_mfa.to_dict() + if hasattr(self, 'claim') and self.claim is not None: + _dict['claim'] = self.claim + if hasattr(self, 'operator') and self.operator is not None: + _dict['operator'] = self.operator + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -9886,68 +10018,78 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this MfaEnrollments object.""" + """Return a `str` version of this ProfileClaimRuleConditions object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'MfaEnrollments') -> bool: + def __eq__(self, other: 'ProfileClaimRuleConditions') -> 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: 'MfaEnrollments') -> bool: + def __ne__(self, other: 'ProfileClaimRuleConditions') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PolicyTemplateReference: +class ProfileClaimRuleList: """ - Metadata for external access policy. + ProfileClaimRuleList. - :param str id: ID of Access Policy Template. - :param str version: Version of Access Policy Template. + :param ResponseContext context: (optional) Context with key properties for + problem determination. + :param List[ProfileClaimRule] rules: List of claim rules. """ def __init__( self, - id: str, - version: str, + rules: List['ProfileClaimRule'], + *, + context: Optional['ResponseContext'] = None, ) -> None: """ - Initialize a PolicyTemplateReference object. + Initialize a ProfileClaimRuleList object. - :param str id: ID of Access Policy Template. - :param str version: Version of Access Policy Template. + :param List[ProfileClaimRule] rules: List of claim rules. + :param ResponseContext context: (optional) Context with key properties for + problem determination. """ - self.id = id - self.version = version + self.context = context + self.rules = rules @classmethod - def from_dict(cls, _dict: Dict) -> 'PolicyTemplateReference': - """Initialize a PolicyTemplateReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileClaimRuleList': + """Initialize a ProfileClaimRuleList object from a json dictionary.""" args = {} - if (id := _dict.get('id')) is not None: - args['id'] = id - else: - raise ValueError('Required property \'id\' not present in PolicyTemplateReference JSON') - if (version := _dict.get('version')) is not None: - args['version'] = version + if (context := _dict.get('context')) is not None: + args['context'] = ResponseContext.from_dict(context) + if (rules := _dict.get('rules')) is not None: + args['rules'] = [ProfileClaimRule.from_dict(v) for v in rules] else: - raise ValueError('Required property \'version\' not present in PolicyTemplateReference JSON') + raise ValueError('Required property \'rules\' not present in ProfileClaimRuleList JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PolicyTemplateReference object from a json dictionary.""" + """Initialize a ProfileClaimRuleList 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, 'version') and self.version is not None: - _dict['version'] = self.version + if hasattr(self, 'context') and self.context is not None: + if isinstance(self.context, dict): + _dict['context'] = self.context + else: + _dict['context'] = self.context.to_dict() + if hasattr(self, 'rules') and self.rules is not None: + rules_list = [] + for v in self.rules: + if isinstance(v, dict): + rules_list.append(v) + else: + rules_list.append(v.to_dict()) + _dict['rules'] = rules_list return _dict def _to_dict(self): @@ -9955,158 +10097,73 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PolicyTemplateReference object.""" + """Return a `str` version of this ProfileClaimRuleList object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PolicyTemplateReference') -> bool: + def __eq__(self, other: 'ProfileClaimRuleList') -> 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: 'PolicyTemplateReference') -> bool: + def __ne__(self, other: 'ProfileClaimRuleList') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProfileClaimRule: +class ProfileIdentitiesResponse: """ - ProfileClaimRule. + ProfileIdentitiesResponse. - :param str id: the unique identifier of the claim rule. - :param str entity_tag: version of the claim rule. - :param datetime created_at: If set contains a date time string of the creation - date in ISO format. - :param datetime modified_at: (optional) If set contains a date time string of - the last modification date in ISO format. - :param str name: (optional) The optional claim rule name. - :param str type: Type of the claim rule, either 'Profile-SAML' or 'Profile-CR'. - :param str realm_name: (optional) The realm name of the Idp this claim rule - applies to. - :param int expiration: Session expiration in seconds. - :param str cr_type: (optional) The compute resource type. Not required if type - is Profile-SAML. Valid values are VSI, IKS_SA, ROKS_SA. - :param List[ProfileClaimRuleConditions] conditions: Conditions of this claim - rule. + :param str entity_tag: (optional) Entity tag of the profile identities response. + :param List[ProfileIdentityResponse] identities: (optional) List of identities. """ def __init__( self, - id: str, - entity_tag: str, - created_at: datetime, - type: str, - expiration: int, - conditions: List['ProfileClaimRuleConditions'], *, - modified_at: Optional[datetime] = None, - name: Optional[str] = None, - realm_name: Optional[str] = None, - cr_type: Optional[str] = None, + entity_tag: Optional[str] = None, + identities: Optional[List['ProfileIdentityResponse']] = None, ) -> None: """ - Initialize a ProfileClaimRule object. + Initialize a ProfileIdentitiesResponse object. - :param str id: the unique identifier of the claim rule. - :param str entity_tag: version of the claim rule. - :param datetime created_at: If set contains a date time string of the - creation date in ISO format. - :param str type: Type of the claim rule, either 'Profile-SAML' or - 'Profile-CR'. - :param int expiration: Session expiration in seconds. - :param List[ProfileClaimRuleConditions] conditions: Conditions of this - claim rule. - :param datetime modified_at: (optional) If set contains a date time string - of the last modification date in ISO format. - :param str name: (optional) The optional claim rule name. - :param str realm_name: (optional) The realm name of the Idp this claim rule - applies to. - :param str cr_type: (optional) The compute resource type. Not required if - type is Profile-SAML. Valid values are VSI, IKS_SA, ROKS_SA. + :param str entity_tag: (optional) Entity tag of the profile identities + response. + :param List[ProfileIdentityResponse] identities: (optional) List of + identities. """ - self.id = id self.entity_tag = entity_tag - self.created_at = created_at - self.modified_at = modified_at - self.name = name - self.type = type - self.realm_name = realm_name - self.expiration = expiration - self.cr_type = cr_type - self.conditions = conditions + self.identities = identities @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileClaimRule': - """Initialize a ProfileClaimRule object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileIdentitiesResponse': + """Initialize a ProfileIdentitiesResponse object from a json dictionary.""" args = {} - if (id := _dict.get('id')) is not None: - args['id'] = id - else: - raise ValueError('Required property \'id\' not present in ProfileClaimRule JSON') if (entity_tag := _dict.get('entity_tag')) is not None: args['entity_tag'] = entity_tag - else: - raise ValueError('Required property \'entity_tag\' not present in ProfileClaimRule 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 ProfileClaimRule JSON') - if (modified_at := _dict.get('modified_at')) is not None: - args['modified_at'] = string_to_datetime(modified_at) - if (name := _dict.get('name')) is not None: - args['name'] = name - if (type := _dict.get('type')) is not None: - args['type'] = type - else: - raise ValueError('Required property \'type\' not present in ProfileClaimRule JSON') - if (realm_name := _dict.get('realm_name')) is not None: - args['realm_name'] = realm_name - if (expiration := _dict.get('expiration')) is not None: - args['expiration'] = expiration - else: - raise ValueError('Required property \'expiration\' not present in ProfileClaimRule JSON') - if (cr_type := _dict.get('cr_type')) is not None: - args['cr_type'] = cr_type - if (conditions := _dict.get('conditions')) is not None: - args['conditions'] = [ProfileClaimRuleConditions.from_dict(v) for v in conditions] - else: - raise ValueError('Required property \'conditions\' not present in ProfileClaimRule JSON') + if (identities := _dict.get('identities')) is not None: + args['identities'] = [ProfileIdentityResponse.from_dict(v) for v in identities] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileClaimRule object from a json dictionary.""" + """Initialize a ProfileIdentitiesResponse 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, 'entity_tag') and self.entity_tag is not None: _dict['entity_tag'] = self.entity_tag - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'modified_at') and self.modified_at is not None: - _dict['modified_at'] = datetime_to_string(self.modified_at) - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'realm_name') and self.realm_name is not None: - _dict['realm_name'] = self.realm_name - if hasattr(self, 'expiration') and self.expiration is not None: - _dict['expiration'] = self.expiration - if hasattr(self, 'cr_type') and self.cr_type is not None: - _dict['cr_type'] = self.cr_type - if hasattr(self, 'conditions') and self.conditions is not None: - conditions_list = [] - for v in self.conditions: + if hasattr(self, 'identities') and self.identities is not None: + identities_list = [] + for v in self.identities: if isinstance(v, dict): - conditions_list.append(v) + identities_list.append(v) else: - conditions_list.append(v.to_dict()) - _dict['conditions'] = conditions_list + identities_list.append(v.to_dict()) + _dict['identities'] = identities_list return _dict def _to_dict(self): @@ -10114,85 +10171,103 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileClaimRule object.""" + """Return a `str` version of this ProfileIdentitiesResponse object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileClaimRule') -> bool: + def __eq__(self, other: 'ProfileIdentitiesResponse') -> 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: 'ProfileClaimRule') -> bool: + def __ne__(self, other: 'ProfileIdentitiesResponse') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProfileClaimRuleConditions: +class ProfileIdentityRequest: """ - ProfileClaimRuleConditions. + ProfileIdentityRequest. - :param str claim: The claim to evaluate against. [Learn - more](/docs/account?topic=account-iam-condition-properties&interface=ui#cr-attribute-names). - :param str operator: The operation to perform on the claim. valid values are - EQUALS, NOT_EQUALS, EQUALS_IGNORE_CASE, NOT_EQUALS_IGNORE_CASE, CONTAINS, IN. - :param str value: The stringified JSON value that the claim is compared to using - the operator. + :param str identifier: Identifier of the identity that can assume the trusted + profiles. This can be a user identifier (IAM id), serviceid or crn. Internally + it uses account id of the service id for the identifier 'serviceid' and for the + identifier 'crn' it uses account id contained in the CRN. + :param str type: Type of the identity. + :param List[str] accounts: (optional) Only valid for the type user. Accounts + from which a user can assume the trusted profile. + :param str description: (optional) Description of the identity that can assume + the trusted profile. This is optional field for all the types of identities. + When this field is not set for the identity type 'serviceid' then the + description of the service id is used. Description is recommended for the + identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service project'. """ def __init__( self, - claim: str, - operator: str, - value: str, + identifier: str, + type: str, + *, + accounts: Optional[List[str]] = None, + description: Optional[str] = None, ) -> None: """ - Initialize a ProfileClaimRuleConditions object. + Initialize a ProfileIdentityRequest object. - :param str claim: The claim to evaluate against. [Learn - more](/docs/account?topic=account-iam-condition-properties&interface=ui#cr-attribute-names). - :param str operator: The operation to perform on the claim. valid values - are EQUALS, NOT_EQUALS, EQUALS_IGNORE_CASE, NOT_EQUALS_IGNORE_CASE, - CONTAINS, IN. - :param str value: The stringified JSON value that the claim is compared to - using the operator. + :param str identifier: Identifier of the identity that can assume the + trusted profiles. This can be a user identifier (IAM id), serviceid or crn. + Internally it uses account id of the service id for the identifier + 'serviceid' and for the identifier 'crn' it uses account id contained in + the CRN. + :param str type: Type of the identity. + :param List[str] accounts: (optional) Only valid for the type user. + Accounts from which a user can assume the trusted profile. + :param str description: (optional) Description of the identity that can + assume the trusted profile. This is optional field for all the types of + identities. When this field is not set for the identity type 'serviceid' + then the description of the service id is used. Description is recommended + for the identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service + project'. """ - self.claim = claim - self.operator = operator - self.value = value + self.identifier = identifier + self.type = type + self.accounts = accounts + self.description = description @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileClaimRuleConditions': - """Initialize a ProfileClaimRuleConditions object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileIdentityRequest': + """Initialize a ProfileIdentityRequest object from a json dictionary.""" args = {} - if (claim := _dict.get('claim')) is not None: - args['claim'] = claim - else: - raise ValueError('Required property \'claim\' not present in ProfileClaimRuleConditions JSON') - if (operator := _dict.get('operator')) is not None: - args['operator'] = operator + if (identifier := _dict.get('identifier')) is not None: + args['identifier'] = identifier else: - raise ValueError('Required property \'operator\' not present in ProfileClaimRuleConditions JSON') - if (value := _dict.get('value')) is not None: - args['value'] = value + raise ValueError('Required property \'identifier\' not present in ProfileIdentityRequest JSON') + if (type := _dict.get('type')) is not None: + args['type'] = type else: - raise ValueError('Required property \'value\' not present in ProfileClaimRuleConditions JSON') + raise ValueError('Required property \'type\' not present in ProfileIdentityRequest JSON') + if (accounts := _dict.get('accounts')) is not None: + args['accounts'] = accounts + if (description := _dict.get('description')) is not None: + args['description'] = description return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileClaimRuleConditions object from a json dictionary.""" + """Initialize a ProfileIdentityRequest 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, 'claim') and self.claim is not None: - _dict['claim'] = self.claim - if hasattr(self, 'operator') and self.operator is not None: - _dict['operator'] = self.operator - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'identifier') and self.identifier is not None: + _dict['identifier'] = self.identifier + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'accounts') and self.accounts is not None: + _dict['accounts'] = self.accounts + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description return _dict def _to_dict(self): @@ -10200,78 +10275,122 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileClaimRuleConditions object.""" + """Return a `str` version of this ProfileIdentityRequest object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileClaimRuleConditions') -> bool: + def __eq__(self, other: 'ProfileIdentityRequest') -> 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: 'ProfileClaimRuleConditions') -> bool: + def __ne__(self, other: 'ProfileIdentityRequest') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class TypeEnum(str, Enum): + """ + Type of the identity. + """ -class ProfileClaimRuleList: + USER = 'user' + SERVICEID = 'serviceid' + CRN = 'crn' + + +class ProfileIdentityResponse: """ - ProfileClaimRuleList. + ProfileIdentityResponse. - :param ResponseContext context: (optional) Context with key properties for - problem determination. - :param List[ProfileClaimRule] rules: List of claim rules. + :param str iam_id: IAM ID of the identity. + :param str identifier: Identifier of the identity that can assume the trusted + profiles. This can be a user identifier (IAM id), serviceid or crn. Internally + it uses account id of the service id for the identifier 'serviceid' and for the + identifier 'crn' it uses account id contained in the CRN. + :param str type: Type of the identity. + :param List[str] accounts: (optional) Only valid for the type user. Accounts + from which a user can assume the trusted profile. + :param str description: (optional) Description of the identity that can assume + the trusted profile. This is optional field for all the types of identities. + When this field is not set for the identity type 'serviceid' then the + description of the service id is used. Description is recommended for the + identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service project'. """ def __init__( self, - rules: List['ProfileClaimRule'], + iam_id: str, + identifier: str, + type: str, *, - context: Optional['ResponseContext'] = None, + accounts: Optional[List[str]] = None, + description: Optional[str] = None, ) -> None: """ - Initialize a ProfileClaimRuleList object. + Initialize a ProfileIdentityResponse object. - :param List[ProfileClaimRule] rules: List of claim rules. - :param ResponseContext context: (optional) Context with key properties for - problem determination. + :param str iam_id: IAM ID of the identity. + :param str identifier: Identifier of the identity that can assume the + trusted profiles. This can be a user identifier (IAM id), serviceid or crn. + Internally it uses account id of the service id for the identifier + 'serviceid' and for the identifier 'crn' it uses account id contained in + the CRN. + :param str type: Type of the identity. + :param List[str] accounts: (optional) Only valid for the type user. + Accounts from which a user can assume the trusted profile. + :param str description: (optional) Description of the identity that can + assume the trusted profile. This is optional field for all the types of + identities. When this field is not set for the identity type 'serviceid' + then the description of the service id is used. Description is recommended + for the identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service + project'. """ - self.context = context - self.rules = rules + self.iam_id = iam_id + self.identifier = identifier + self.type = type + self.accounts = accounts + self.description = description @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileClaimRuleList': - """Initialize a ProfileClaimRuleList object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileIdentityResponse': + """Initialize a ProfileIdentityResponse object from a json dictionary.""" args = {} - if (context := _dict.get('context')) is not None: - args['context'] = ResponseContext.from_dict(context) - if (rules := _dict.get('rules')) is not None: - args['rules'] = [ProfileClaimRule.from_dict(v) for v in rules] + if (iam_id := _dict.get('iam_id')) is not None: + args['iam_id'] = iam_id else: - raise ValueError('Required property \'rules\' not present in ProfileClaimRuleList JSON') + raise ValueError('Required property \'iam_id\' not present in ProfileIdentityResponse JSON') + if (identifier := _dict.get('identifier')) is not None: + args['identifier'] = identifier + else: + raise ValueError('Required property \'identifier\' not present in ProfileIdentityResponse JSON') + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in ProfileIdentityResponse JSON') + if (accounts := _dict.get('accounts')) is not None: + args['accounts'] = accounts + if (description := _dict.get('description')) is not None: + args['description'] = description return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileClaimRuleList object from a json dictionary.""" + """Initialize a ProfileIdentityResponse 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, 'context') and self.context is not None: - if isinstance(self.context, dict): - _dict['context'] = self.context - else: - _dict['context'] = self.context.to_dict() - if hasattr(self, 'rules') and self.rules is not None: - rules_list = [] - for v in self.rules: - if isinstance(v, dict): - rules_list.append(v) - else: - rules_list.append(v.to_dict()) - _dict['rules'] = rules_list + if hasattr(self, 'iam_id') and self.iam_id is not None: + _dict['iam_id'] = self.iam_id + if hasattr(self, 'identifier') and self.identifier is not None: + _dict['identifier'] = self.identifier + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'accounts') and self.accounts is not None: + _dict['accounts'] = self.accounts + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description return _dict def _to_dict(self): @@ -10279,73 +10398,135 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileClaimRuleList object.""" + """Return a `str` version of this ProfileIdentityResponse object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileClaimRuleList') -> bool: + def __eq__(self, other: 'ProfileIdentityResponse') -> 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: 'ProfileClaimRuleList') -> bool: + def __ne__(self, other: 'ProfileIdentityResponse') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class TypeEnum(str, Enum): + """ + Type of the identity. + """ + + USER = 'user' + SERVICEID = 'serviceid' + CRN = 'crn' + -class ProfileIdentitiesResponse: +class ProfileLink: """ - ProfileIdentitiesResponse. + Link details. - :param str entity_tag: (optional) Entity tag of the profile identities response. - :param List[ProfileIdentityResponse] identities: (optional) List of identities. + :param str id: the unique identifier of the link. + :param str entity_tag: version of the link. + :param datetime created_at: If set contains a date time string of the creation + date in ISO format. + :param datetime modified_at: If set contains a date time string of the last + modification date in ISO format. + :param str name: (optional) Optional name of the Link. + :param str cr_type: The compute resource type. Valid values are VSI, BMS, + IKS_SA, ROKS_SA, CE. + :param ProfileLinkLink link: """ def __init__( self, + id: str, + entity_tag: str, + created_at: datetime, + modified_at: datetime, + cr_type: str, + link: 'ProfileLinkLink', *, - entity_tag: Optional[str] = None, - identities: Optional[List['ProfileIdentityResponse']] = None, + name: Optional[str] = None, ) -> None: """ - Initialize a ProfileIdentitiesResponse object. + Initialize a ProfileLink object. - :param str entity_tag: (optional) Entity tag of the profile identities - response. - :param List[ProfileIdentityResponse] identities: (optional) List of - identities. + :param str id: the unique identifier of the link. + :param str entity_tag: version of the link. + :param datetime created_at: If set contains a date time string of the + creation date in ISO format. + :param datetime modified_at: If set contains a date time string of the last + modification date in ISO format. + :param str cr_type: The compute resource type. Valid values are VSI, BMS, + IKS_SA, ROKS_SA, CE. + :param ProfileLinkLink link: + :param str name: (optional) Optional name of the Link. """ + self.id = id self.entity_tag = entity_tag - self.identities = identities + self.created_at = created_at + self.modified_at = modified_at + self.name = name + self.cr_type = cr_type + self.link = link @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileIdentitiesResponse': - """Initialize a ProfileIdentitiesResponse object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileLink': + """Initialize a ProfileLink object from a json dictionary.""" args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in ProfileLink JSON') if (entity_tag := _dict.get('entity_tag')) is not None: args['entity_tag'] = entity_tag - if (identities := _dict.get('identities')) is not None: - args['identities'] = [ProfileIdentityResponse.from_dict(v) for v in identities] + else: + raise ValueError('Required property \'entity_tag\' not present in ProfileLink 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 ProfileLink JSON') + if (modified_at := _dict.get('modified_at')) is not None: + args['modified_at'] = string_to_datetime(modified_at) + else: + raise ValueError('Required property \'modified_at\' not present in ProfileLink JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name + if (cr_type := _dict.get('cr_type')) is not None: + args['cr_type'] = cr_type + else: + raise ValueError('Required property \'cr_type\' not present in ProfileLink JSON') + if (link := _dict.get('link')) is not None: + args['link'] = ProfileLinkLink.from_dict(link) + else: + raise ValueError('Required property \'link\' not present in ProfileLink JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileIdentitiesResponse object from a json dictionary.""" + """Initialize a ProfileLink 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, 'entity_tag') and self.entity_tag is not None: _dict['entity_tag'] = self.entity_tag - if hasattr(self, 'identities') and self.identities is not None: - identities_list = [] - for v in self.identities: - if isinstance(v, dict): - identities_list.append(v) - else: - identities_list.append(v.to_dict()) - _dict['identities'] = identities_list + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'modified_at') and self.modified_at is not None: + _dict['modified_at'] = datetime_to_string(self.modified_at) + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'cr_type') and self.cr_type is not None: + _dict['cr_type'] = self.cr_type + if hasattr(self, 'link') and self.link is not None: + if isinstance(self.link, dict): + _dict['link'] = self.link + else: + _dict['link'] = self.link.to_dict() return _dict def _to_dict(self): @@ -10353,103 +10534,97 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileIdentitiesResponse object.""" + """Return a `str` version of this ProfileLink object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileIdentitiesResponse') -> bool: + def __eq__(self, other: 'ProfileLink') -> 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: 'ProfileIdentitiesResponse') -> bool: + def __ne__(self, other: 'ProfileLink') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProfileIdentityRequest: +class ProfileLinkLink: """ - ProfileIdentityRequest. + ProfileLinkLink. - :param str identifier: Identifier of the identity that can assume the trusted - profiles. This can be a user identifier (IAM id), serviceid or crn. Internally - it uses account id of the service id for the identifier 'serviceid' and for the - identifier 'crn' it uses account id contained in the CRN. - :param str type: Type of the identity. - :param List[str] accounts: (optional) Only valid for the type user. Accounts - from which a user can assume the trusted profile. - :param str description: (optional) Description of the identity that can assume - the trusted profile. This is optional field for all the types of identities. - When this field is not set for the identity type 'serviceid' then the - description of the service id is used. Description is recommended for the - identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service project'. + :param str crn: (optional) The CRN of the compute resource. + :param str namespace: (optional) The compute resource namespace, only required + if cr_type is IKS_SA or ROKS_SA. + :param str name: (optional) Name of the compute resource, only required if + cr_type is IKS_SA or ROKS_SA. + :param str component_type: (optional) Component type of the compute resource, + only required if cr_type is CE. + :param str component_name: (optional) Component name of the compute resource, + only required if cr_type is CE. """ def __init__( self, - identifier: str, - type: str, *, - accounts: Optional[List[str]] = None, - description: Optional[str] = None, + crn: Optional[str] = None, + namespace: Optional[str] = None, + name: Optional[str] = None, + component_type: Optional[str] = None, + component_name: Optional[str] = None, ) -> None: """ - Initialize a ProfileIdentityRequest object. + Initialize a ProfileLinkLink object. - :param str identifier: Identifier of the identity that can assume the - trusted profiles. This can be a user identifier (IAM id), serviceid or crn. - Internally it uses account id of the service id for the identifier - 'serviceid' and for the identifier 'crn' it uses account id contained in - the CRN. - :param str type: Type of the identity. - :param List[str] accounts: (optional) Only valid for the type user. - Accounts from which a user can assume the trusted profile. - :param str description: (optional) Description of the identity that can - assume the trusted profile. This is optional field for all the types of - identities. When this field is not set for the identity type 'serviceid' - then the description of the service id is used. Description is recommended - for the identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service - project'. + :param str crn: (optional) The CRN of the compute resource. + :param str namespace: (optional) The compute resource namespace, only + required if cr_type is IKS_SA or ROKS_SA. + :param str name: (optional) Name of the compute resource, only required if + cr_type is IKS_SA or ROKS_SA. + :param str component_type: (optional) Component type of the compute + resource, only required if cr_type is CE. + :param str component_name: (optional) Component name of the compute + resource, only required if cr_type is CE. """ - self.identifier = identifier - self.type = type - self.accounts = accounts - self.description = description + self.crn = crn + self.namespace = namespace + self.name = name + self.component_type = component_type + self.component_name = component_name @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileIdentityRequest': - """Initialize a ProfileIdentityRequest object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileLinkLink': + """Initialize a ProfileLinkLink object from a json dictionary.""" args = {} - if (identifier := _dict.get('identifier')) is not None: - args['identifier'] = identifier - else: - raise ValueError('Required property \'identifier\' not present in ProfileIdentityRequest JSON') - if (type := _dict.get('type')) is not None: - args['type'] = type - else: - raise ValueError('Required property \'type\' not present in ProfileIdentityRequest JSON') - if (accounts := _dict.get('accounts')) is not None: - args['accounts'] = accounts - if (description := _dict.get('description')) is not None: - args['description'] = description + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + if (namespace := _dict.get('namespace')) is not None: + args['namespace'] = namespace + if (name := _dict.get('name')) is not None: + args['name'] = name + if (component_type := _dict.get('component_type')) is not None: + args['component_type'] = component_type + if (component_name := _dict.get('component_name')) is not None: + args['component_name'] = component_name return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileIdentityRequest object from a json dictionary.""" + """Initialize a ProfileLinkLink 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, 'identifier') and self.identifier is not None: - _dict['identifier'] = self.identifier - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'accounts') and self.accounts is not None: - _dict['accounts'] = self.accounts - if hasattr(self, 'description') and self.description is not None: - _dict['description'] = self.description + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'namespace') and self.namespace is not None: + _dict['namespace'] = self.namespace + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'component_type') and self.component_type is not None: + _dict['component_type'] = self.component_type + if hasattr(self, 'component_name') and self.component_name is not None: + _dict['component_name'] = self.component_name return _dict def _to_dict(self): @@ -10457,122 +10632,64 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileIdentityRequest object.""" + """Return a `str` version of this ProfileLinkLink object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileIdentityRequest') -> bool: + def __eq__(self, other: 'ProfileLinkLink') -> 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: 'ProfileIdentityRequest') -> bool: + def __ne__(self, other: 'ProfileLinkLink') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - Type of the identity. - """ - - USER = 'user' - SERVICEID = 'serviceid' - CRN = 'crn' - -class ProfileIdentityResponse: +class ProfileLinkList: """ - ProfileIdentityResponse. + ProfileLinkList. - :param str iam_id: IAM ID of the identity. - :param str identifier: Identifier of the identity that can assume the trusted - profiles. This can be a user identifier (IAM id), serviceid or crn. Internally - it uses account id of the service id for the identifier 'serviceid' and for the - identifier 'crn' it uses account id contained in the CRN. - :param str type: Type of the identity. - :param List[str] accounts: (optional) Only valid for the type user. Accounts - from which a user can assume the trusted profile. - :param str description: (optional) Description of the identity that can assume - the trusted profile. This is optional field for all the types of identities. - When this field is not set for the identity type 'serviceid' then the - description of the service id is used. Description is recommended for the - identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service project'. + :param List[ProfileLink] links: List of links to a trusted profile. """ def __init__( self, - iam_id: str, - identifier: str, - type: str, - *, - accounts: Optional[List[str]] = None, - description: Optional[str] = None, + links: List['ProfileLink'], ) -> None: """ - Initialize a ProfileIdentityResponse object. + Initialize a ProfileLinkList object. - :param str iam_id: IAM ID of the identity. - :param str identifier: Identifier of the identity that can assume the - trusted profiles. This can be a user identifier (IAM id), serviceid or crn. - Internally it uses account id of the service id for the identifier - 'serviceid' and for the identifier 'crn' it uses account id contained in - the CRN. - :param str type: Type of the identity. - :param List[str] accounts: (optional) Only valid for the type user. - Accounts from which a user can assume the trusted profile. - :param str description: (optional) Description of the identity that can - assume the trusted profile. This is optional field for all the types of - identities. When this field is not set for the identity type 'serviceid' - then the description of the service id is used. Description is recommended - for the identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service - project'. + :param List[ProfileLink] links: List of links to a trusted profile. """ - self.iam_id = iam_id - self.identifier = identifier - self.type = type - self.accounts = accounts - self.description = description + self.links = links @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileIdentityResponse': - """Initialize a ProfileIdentityResponse object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileLinkList': + """Initialize a ProfileLinkList object from a json dictionary.""" args = {} - if (iam_id := _dict.get('iam_id')) is not None: - args['iam_id'] = iam_id - else: - raise ValueError('Required property \'iam_id\' not present in ProfileIdentityResponse JSON') - if (identifier := _dict.get('identifier')) is not None: - args['identifier'] = identifier - else: - raise ValueError('Required property \'identifier\' not present in ProfileIdentityResponse JSON') - if (type := _dict.get('type')) is not None: - args['type'] = type + if (links := _dict.get('links')) is not None: + args['links'] = [ProfileLink.from_dict(v) for v in links] else: - raise ValueError('Required property \'type\' not present in ProfileIdentityResponse JSON') - if (accounts := _dict.get('accounts')) is not None: - args['accounts'] = accounts - if (description := _dict.get('description')) is not None: - args['description'] = description + raise ValueError('Required property \'links\' not present in ProfileLinkList JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileIdentityResponse object from a json dictionary.""" + """Initialize a ProfileLinkList 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, 'iam_id') and self.iam_id is not None: - _dict['iam_id'] = self.iam_id - if hasattr(self, 'identifier') and self.identifier is not None: - _dict['identifier'] = self.identifier - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'accounts') and self.accounts is not None: - _dict['accounts'] = self.accounts - if hasattr(self, 'description') and self.description is not None: - _dict['description'] = self.description + if hasattr(self, 'links') and self.links is not None: + links_list = [] + for v in self.links: + if isinstance(v, dict): + links_list.append(v) + else: + links_list.append(v.to_dict()) + _dict['links'] = links_list return _dict def _to_dict(self): @@ -10580,135 +10697,156 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileIdentityResponse object.""" + """Return a `str` version of this ProfileLinkList object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileIdentityResponse') -> bool: + def __eq__(self, other: 'ProfileLinkList') -> 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: 'ProfileIdentityResponse') -> bool: + def __ne__(self, other: 'ProfileLinkList') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - Type of the identity. - """ - - USER = 'user' - SERVICEID = 'serviceid' - CRN = 'crn' - -class ProfileLink: +class Report: """ - Link details. + Report. - :param str id: the unique identifier of the link. - :param str entity_tag: version of the link. - :param datetime created_at: If set contains a date time string of the creation - date in ISO format. - :param datetime modified_at: If set contains a date time string of the last - modification date in ISO format. - :param str name: (optional) Optional name of the Link. - :param str cr_type: The compute resource type. Valid values are VSI, BMS, - IKS_SA, ROKS_SA, CE. - :param ProfileLinkLink link: + :param str created_by: IAMid of the user who triggered the report. + :param str reference: Unique reference used to generate the report. + :param str report_duration: Duration in hours for which the report is generated. + :param str report_start_time: Start time of the report. + :param str report_end_time: End time of the report. + :param List[UserActivity] users: (optional) List of users. + :param List[ApikeyActivity] apikeys: (optional) List of apikeys. + :param List[EntityActivity] serviceids: (optional) List of serviceids. + :param List[EntityActivity] profiles: (optional) List of profiles. """ def __init__( self, - id: str, - entity_tag: str, - created_at: datetime, - modified_at: datetime, - cr_type: str, - link: 'ProfileLinkLink', + created_by: str, + reference: str, + report_duration: str, + report_start_time: str, + report_end_time: str, *, - name: Optional[str] = None, + users: Optional[List['UserActivity']] = None, + apikeys: Optional[List['ApikeyActivity']] = None, + serviceids: Optional[List['EntityActivity']] = None, + profiles: Optional[List['EntityActivity']] = None, ) -> None: """ - Initialize a ProfileLink object. + Initialize a Report object. - :param str id: the unique identifier of the link. - :param str entity_tag: version of the link. - :param datetime created_at: If set contains a date time string of the - creation date in ISO format. - :param datetime modified_at: If set contains a date time string of the last - modification date in ISO format. - :param str cr_type: The compute resource type. Valid values are VSI, BMS, - IKS_SA, ROKS_SA, CE. - :param ProfileLinkLink link: - :param str name: (optional) Optional name of the Link. + :param str created_by: IAMid of the user who triggered the report. + :param str reference: Unique reference used to generate the report. + :param str report_duration: Duration in hours for which the report is + generated. + :param str report_start_time: Start time of the report. + :param str report_end_time: End time of the report. + :param List[UserActivity] users: (optional) List of users. + :param List[ApikeyActivity] apikeys: (optional) List of apikeys. + :param List[EntityActivity] serviceids: (optional) List of serviceids. + :param List[EntityActivity] profiles: (optional) List of profiles. """ - self.id = id - self.entity_tag = entity_tag - self.created_at = created_at - self.modified_at = modified_at - self.name = name - self.cr_type = cr_type - self.link = link + self.created_by = created_by + self.reference = reference + self.report_duration = report_duration + self.report_start_time = report_start_time + self.report_end_time = report_end_time + self.users = users + self.apikeys = apikeys + self.serviceids = serviceids + self.profiles = profiles @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileLink': - """Initialize a ProfileLink object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Report': + """Initialize a Report object from a json dictionary.""" args = {} - if (id := _dict.get('id')) is not None: - args['id'] = id - else: - raise ValueError('Required property \'id\' not present in ProfileLink JSON') - if (entity_tag := _dict.get('entity_tag')) is not None: - args['entity_tag'] = entity_tag + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by else: - raise ValueError('Required property \'entity_tag\' not present in ProfileLink JSON') - if (created_at := _dict.get('created_at')) is not None: - args['created_at'] = string_to_datetime(created_at) + raise ValueError('Required property \'created_by\' not present in Report JSON') + if (reference := _dict.get('reference')) is not None: + args['reference'] = reference else: - raise ValueError('Required property \'created_at\' not present in ProfileLink JSON') - if (modified_at := _dict.get('modified_at')) is not None: - args['modified_at'] = string_to_datetime(modified_at) + raise ValueError('Required property \'reference\' not present in Report JSON') + if (report_duration := _dict.get('report_duration')) is not None: + args['report_duration'] = report_duration else: - raise ValueError('Required property \'modified_at\' not present in ProfileLink JSON') - if (name := _dict.get('name')) is not None: - args['name'] = name - if (cr_type := _dict.get('cr_type')) is not None: - args['cr_type'] = cr_type + raise ValueError('Required property \'report_duration\' not present in Report JSON') + if (report_start_time := _dict.get('report_start_time')) is not None: + args['report_start_time'] = report_start_time else: - raise ValueError('Required property \'cr_type\' not present in ProfileLink JSON') - if (link := _dict.get('link')) is not None: - args['link'] = ProfileLinkLink.from_dict(link) + raise ValueError('Required property \'report_start_time\' not present in Report JSON') + if (report_end_time := _dict.get('report_end_time')) is not None: + args['report_end_time'] = report_end_time else: - raise ValueError('Required property \'link\' not present in ProfileLink JSON') + raise ValueError('Required property \'report_end_time\' not present in Report JSON') + if (users := _dict.get('users')) is not None: + args['users'] = [UserActivity.from_dict(v) for v in users] + if (apikeys := _dict.get('apikeys')) is not None: + args['apikeys'] = [ApikeyActivity.from_dict(v) for v in apikeys] + if (serviceids := _dict.get('serviceids')) is not None: + args['serviceids'] = [EntityActivity.from_dict(v) for v in serviceids] + if (profiles := _dict.get('profiles')) is not None: + args['profiles'] = [EntityActivity.from_dict(v) for v in profiles] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileLink object from a json dictionary.""" + """Initialize a Report 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, 'entity_tag') and self.entity_tag is not None: - _dict['entity_tag'] = self.entity_tag - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'modified_at') and self.modified_at is not None: - _dict['modified_at'] = datetime_to_string(self.modified_at) - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'cr_type') and self.cr_type is not None: - _dict['cr_type'] = self.cr_type - if hasattr(self, 'link') and self.link is not None: - if isinstance(self.link, dict): - _dict['link'] = self.link - else: - _dict['link'] = self.link.to_dict() + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'reference') and self.reference is not None: + _dict['reference'] = self.reference + if hasattr(self, 'report_duration') and self.report_duration is not None: + _dict['report_duration'] = self.report_duration + if hasattr(self, 'report_start_time') and self.report_start_time is not None: + _dict['report_start_time'] = self.report_start_time + if hasattr(self, 'report_end_time') and self.report_end_time is not None: + _dict['report_end_time'] = self.report_end_time + if hasattr(self, 'users') and self.users is not None: + users_list = [] + for v in self.users: + if isinstance(v, dict): + users_list.append(v) + else: + users_list.append(v.to_dict()) + _dict['users'] = users_list + if hasattr(self, 'apikeys') and self.apikeys is not None: + apikeys_list = [] + for v in self.apikeys: + if isinstance(v, dict): + apikeys_list.append(v) + else: + apikeys_list.append(v.to_dict()) + _dict['apikeys'] = apikeys_list + if hasattr(self, 'serviceids') and self.serviceids is not None: + serviceids_list = [] + for v in self.serviceids: + if isinstance(v, dict): + serviceids_list.append(v) + else: + serviceids_list.append(v.to_dict()) + _dict['serviceids'] = serviceids_list + if hasattr(self, 'profiles') and self.profiles is not None: + profiles_list = [] + for v in self.profiles: + if isinstance(v, dict): + profiles_list.append(v) + else: + profiles_list.append(v.to_dict()) + _dict['profiles'] = profiles_list return _dict def _to_dict(self): @@ -10716,97 +10854,115 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileLink object.""" + """Return a `str` version of this Report object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileLink') -> bool: + def __eq__(self, other: 'Report') -> 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: 'ProfileLink') -> bool: + def __ne__(self, other: 'Report') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProfileLinkLink: +class ReportMfaEnrollmentStatus: """ - ProfileLinkLink. + ReportMfaEnrollmentStatus. - :param str crn: (optional) The CRN of the compute resource. - :param str namespace: (optional) The compute resource namespace, only required - if cr_type is IKS_SA or ROKS_SA. - :param str name: (optional) Name of the compute resource, only required if - cr_type is IKS_SA or ROKS_SA. - :param str component_type: (optional) Component type of the compute resource, - only required if cr_type is CE. - :param str component_name: (optional) Component name of the compute resource, - only required if cr_type is CE. + :param str created_by: IAMid of the user who triggered the report. + :param str reference: Unique reference used to generate the report. + :param str report_time: Date time at which report is generated. Date is in ISO + format. + :param str account_id: BSS account id of the user who triggered the report. + :param str ims_account_id: (optional) IMS account id of the user who triggered + the report. + :param List[UserReportMfaEnrollmentStatus] users: (optional) List of users. """ def __init__( self, + created_by: str, + reference: str, + report_time: str, + account_id: str, *, - crn: Optional[str] = None, - namespace: Optional[str] = None, - name: Optional[str] = None, - component_type: Optional[str] = None, - component_name: Optional[str] = None, + ims_account_id: Optional[str] = None, + users: Optional[List['UserReportMfaEnrollmentStatus']] = None, ) -> None: """ - Initialize a ProfileLinkLink object. + Initialize a ReportMfaEnrollmentStatus object. - :param str crn: (optional) The CRN of the compute resource. - :param str namespace: (optional) The compute resource namespace, only - required if cr_type is IKS_SA or ROKS_SA. - :param str name: (optional) Name of the compute resource, only required if - cr_type is IKS_SA or ROKS_SA. - :param str component_type: (optional) Component type of the compute - resource, only required if cr_type is CE. - :param str component_name: (optional) Component name of the compute - resource, only required if cr_type is CE. + :param str created_by: IAMid of the user who triggered the report. + :param str reference: Unique reference used to generate the report. + :param str report_time: Date time at which report is generated. Date is in + ISO format. + :param str account_id: BSS account id of the user who triggered the report. + :param str ims_account_id: (optional) IMS account id of the user who + triggered the report. + :param List[UserReportMfaEnrollmentStatus] users: (optional) List of users. """ - self.crn = crn - self.namespace = namespace - self.name = name - self.component_type = component_type - self.component_name = component_name + self.created_by = created_by + self.reference = reference + self.report_time = report_time + self.account_id = account_id + self.ims_account_id = ims_account_id + self.users = users @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileLinkLink': - """Initialize a ProfileLinkLink object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportMfaEnrollmentStatus': + """Initialize a ReportMfaEnrollmentStatus object from a json dictionary.""" args = {} - if (crn := _dict.get('crn')) is not None: - args['crn'] = crn - if (namespace := _dict.get('namespace')) is not None: - args['namespace'] = namespace - if (name := _dict.get('name')) is not None: - args['name'] = name - if (component_type := _dict.get('component_type')) is not None: - args['component_type'] = component_type - if (component_name := _dict.get('component_name')) is not None: - args['component_name'] = component_name + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + else: + raise ValueError('Required property \'created_by\' not present in ReportMfaEnrollmentStatus JSON') + if (reference := _dict.get('reference')) is not None: + args['reference'] = reference + else: + raise ValueError('Required property \'reference\' not present in ReportMfaEnrollmentStatus JSON') + if (report_time := _dict.get('report_time')) is not None: + args['report_time'] = report_time + else: + raise ValueError('Required property \'report_time\' not present in ReportMfaEnrollmentStatus JSON') + if (account_id := _dict.get('account_id')) is not None: + args['account_id'] = account_id + else: + raise ValueError('Required property \'account_id\' not present in ReportMfaEnrollmentStatus JSON') + if (ims_account_id := _dict.get('ims_account_id')) is not None: + args['ims_account_id'] = ims_account_id + if (users := _dict.get('users')) is not None: + args['users'] = [UserReportMfaEnrollmentStatus.from_dict(v) for v in users] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileLinkLink object from a json dictionary.""" + """Initialize a ReportMfaEnrollmentStatus 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, 'namespace') and self.namespace is not None: - _dict['namespace'] = self.namespace - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'component_type') and self.component_type is not None: - _dict['component_type'] = self.component_type - if hasattr(self, 'component_name') and self.component_name is not None: - _dict['component_name'] = self.component_name + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'reference') and self.reference is not None: + _dict['reference'] = self.reference + if hasattr(self, 'report_time') and self.report_time is not None: + _dict['report_time'] = self.report_time + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'ims_account_id') and self.ims_account_id is not None: + _dict['ims_account_id'] = self.ims_account_id + if hasattr(self, 'users') and self.users is not None: + users_list = [] + for v in self.users: + if isinstance(v, dict): + users_list.append(v) + else: + users_list.append(v.to_dict()) + _dict['users'] = users_list return _dict def _to_dict(self): @@ -10814,64 +10970,58 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileLinkLink object.""" + """Return a `str` version of this ReportMfaEnrollmentStatus object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileLinkLink') -> bool: + def __eq__(self, other: 'ReportMfaEnrollmentStatus') -> 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: 'ProfileLinkLink') -> bool: + def __ne__(self, other: 'ReportMfaEnrollmentStatus') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProfileLinkList: +class ReportReference: """ - ProfileLinkList. + ReportReference. - :param List[ProfileLink] links: List of links to a trusted profile. + :param str reference: Reference for the report to be generated. """ def __init__( self, - links: List['ProfileLink'], + reference: str, ) -> None: """ - Initialize a ProfileLinkList object. + Initialize a ReportReference object. - :param List[ProfileLink] links: List of links to a trusted profile. + :param str reference: Reference for the report to be generated. """ - self.links = links + self.reference = reference @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileLinkList': - """Initialize a ProfileLinkList object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportReference': + """Initialize a ReportReference object from a json dictionary.""" args = {} - if (links := _dict.get('links')) is not None: - args['links'] = [ProfileLink.from_dict(v) for v in links] + if (reference := _dict.get('reference')) is not None: + args['reference'] = reference else: - raise ValueError('Required property \'links\' not present in ProfileLinkList JSON') + raise ValueError('Required property \'reference\' not present in ReportReference JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileLinkList object from a json dictionary.""" + """Initialize a ReportReference 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, 'links') and self.links is not None: - links_list = [] - for v in self.links: - if isinstance(v, dict): - links_list.append(v) - else: - links_list.append(v.to_dict()) - _dict['links'] = links_list + if hasattr(self, 'reference') and self.reference is not None: + _dict['reference'] = self.reference return _dict def _to_dict(self): @@ -10879,156 +11029,146 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileLinkList object.""" + """Return a `str` version of this ReportReference object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileLinkList') -> bool: + def __eq__(self, other: 'ReportReference') -> 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: 'ProfileLinkList') -> bool: + def __ne__(self, other: 'ReportReference') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Report: +class ResponseContext: """ - Report. + Context with key properties for problem determination. - :param str created_by: IAMid of the user who triggered the report. - :param str reference: Unique reference used to generate the report. - :param str report_duration: Duration in hours for which the report is generated. - :param str report_start_time: Start time of the report. - :param str report_end_time: End time of the report. - :param List[UserActivity] users: (optional) List of users. - :param List[ApikeyActivity] apikeys: (optional) List of apikeys. - :param List[EntityActivity] serviceids: (optional) List of serviceids. - :param List[EntityActivity] profiles: (optional) List of profiles. + :param str transaction_id: (optional) The transaction ID of the inbound REST + request. + :param str operation: (optional) The operation of the inbound REST request. + :param str user_agent: (optional) The user agent of the inbound REST request. + :param str url: (optional) The URL of that cluster. + :param str instance_id: (optional) The instance ID of the server instance + processing the request. + :param str thread_id: (optional) The thread ID of the server instance processing + the request. + :param str host: (optional) The host of the server instance processing the + request. + :param str start_time: (optional) The start time of the request. + :param str end_time: (optional) The finish time of the request. + :param str elapsed_time: (optional) The elapsed time in msec. + :param str cluster_name: (optional) The cluster name. """ def __init__( self, - created_by: str, - reference: str, - report_duration: str, - report_start_time: str, - report_end_time: str, *, - users: Optional[List['UserActivity']] = None, - apikeys: Optional[List['ApikeyActivity']] = None, - serviceids: Optional[List['EntityActivity']] = None, - profiles: Optional[List['EntityActivity']] = None, + transaction_id: Optional[str] = None, + operation: Optional[str] = None, + user_agent: Optional[str] = None, + url: Optional[str] = None, + instance_id: Optional[str] = None, + thread_id: Optional[str] = None, + host: Optional[str] = None, + start_time: Optional[str] = None, + end_time: Optional[str] = None, + elapsed_time: Optional[str] = None, + cluster_name: Optional[str] = None, ) -> None: """ - Initialize a Report object. + Initialize a ResponseContext object. - :param str created_by: IAMid of the user who triggered the report. - :param str reference: Unique reference used to generate the report. - :param str report_duration: Duration in hours for which the report is - generated. - :param str report_start_time: Start time of the report. - :param str report_end_time: End time of the report. - :param List[UserActivity] users: (optional) List of users. - :param List[ApikeyActivity] apikeys: (optional) List of apikeys. - :param List[EntityActivity] serviceids: (optional) List of serviceids. - :param List[EntityActivity] profiles: (optional) List of profiles. + :param str transaction_id: (optional) The transaction ID of the inbound + REST request. + :param str operation: (optional) The operation of the inbound REST request. + :param str user_agent: (optional) The user agent of the inbound REST + request. + :param str url: (optional) The URL of that cluster. + :param str instance_id: (optional) The instance ID of the server instance + processing the request. + :param str thread_id: (optional) The thread ID of the server instance + processing the request. + :param str host: (optional) The host of the server instance processing the + request. + :param str start_time: (optional) The start time of the request. + :param str end_time: (optional) The finish time of the request. + :param str elapsed_time: (optional) The elapsed time in msec. + :param str cluster_name: (optional) The cluster name. """ - self.created_by = created_by - self.reference = reference - self.report_duration = report_duration - self.report_start_time = report_start_time - self.report_end_time = report_end_time - self.users = users - self.apikeys = apikeys - self.serviceids = serviceids - self.profiles = profiles + self.transaction_id = transaction_id + self.operation = operation + self.user_agent = user_agent + self.url = url + self.instance_id = instance_id + self.thread_id = thread_id + self.host = host + self.start_time = start_time + self.end_time = end_time + self.elapsed_time = elapsed_time + self.cluster_name = cluster_name @classmethod - def from_dict(cls, _dict: Dict) -> 'Report': - """Initialize a Report object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ResponseContext': + """Initialize a ResponseContext object from a json dictionary.""" args = {} - if (created_by := _dict.get('created_by')) is not None: - args['created_by'] = created_by - else: - raise ValueError('Required property \'created_by\' not present in Report JSON') - if (reference := _dict.get('reference')) is not None: - args['reference'] = reference - else: - raise ValueError('Required property \'reference\' not present in Report JSON') - if (report_duration := _dict.get('report_duration')) is not None: - args['report_duration'] = report_duration - else: - raise ValueError('Required property \'report_duration\' not present in Report JSON') - if (report_start_time := _dict.get('report_start_time')) is not None: - args['report_start_time'] = report_start_time - else: - raise ValueError('Required property \'report_start_time\' not present in Report JSON') - if (report_end_time := _dict.get('report_end_time')) is not None: - args['report_end_time'] = report_end_time - else: - raise ValueError('Required property \'report_end_time\' not present in Report JSON') - if (users := _dict.get('users')) is not None: - args['users'] = [UserActivity.from_dict(v) for v in users] - if (apikeys := _dict.get('apikeys')) is not None: - args['apikeys'] = [ApikeyActivity.from_dict(v) for v in apikeys] - if (serviceids := _dict.get('serviceids')) is not None: - args['serviceids'] = [EntityActivity.from_dict(v) for v in serviceids] - if (profiles := _dict.get('profiles')) is not None: - args['profiles'] = [EntityActivity.from_dict(v) for v in profiles] + if (transaction_id := _dict.get('transaction_id')) is not None: + args['transaction_id'] = transaction_id + if (operation := _dict.get('operation')) is not None: + args['operation'] = operation + if (user_agent := _dict.get('user_agent')) is not None: + args['user_agent'] = user_agent + if (url := _dict.get('url')) is not None: + args['url'] = url + if (instance_id := _dict.get('instance_id')) is not None: + args['instance_id'] = instance_id + if (thread_id := _dict.get('thread_id')) is not None: + args['thread_id'] = thread_id + if (host := _dict.get('host')) is not None: + args['host'] = host + if (start_time := _dict.get('start_time')) is not None: + args['start_time'] = start_time + if (end_time := _dict.get('end_time')) is not None: + args['end_time'] = end_time + if (elapsed_time := _dict.get('elapsed_time')) is not None: + args['elapsed_time'] = elapsed_time + if (cluster_name := _dict.get('cluster_name')) is not None: + args['cluster_name'] = cluster_name return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Report object from a json dictionary.""" + """Initialize a ResponseContext 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_by') and self.created_by is not None: - _dict['created_by'] = self.created_by - if hasattr(self, 'reference') and self.reference is not None: - _dict['reference'] = self.reference - if hasattr(self, 'report_duration') and self.report_duration is not None: - _dict['report_duration'] = self.report_duration - if hasattr(self, 'report_start_time') and self.report_start_time is not None: - _dict['report_start_time'] = self.report_start_time - if hasattr(self, 'report_end_time') and self.report_end_time is not None: - _dict['report_end_time'] = self.report_end_time - if hasattr(self, 'users') and self.users is not None: - users_list = [] - for v in self.users: - if isinstance(v, dict): - users_list.append(v) - else: - users_list.append(v.to_dict()) - _dict['users'] = users_list - if hasattr(self, 'apikeys') and self.apikeys is not None: - apikeys_list = [] - for v in self.apikeys: - if isinstance(v, dict): - apikeys_list.append(v) - else: - apikeys_list.append(v.to_dict()) - _dict['apikeys'] = apikeys_list - if hasattr(self, 'serviceids') and self.serviceids is not None: - serviceids_list = [] - for v in self.serviceids: - if isinstance(v, dict): - serviceids_list.append(v) - else: - serviceids_list.append(v.to_dict()) - _dict['serviceids'] = serviceids_list - if hasattr(self, 'profiles') and self.profiles is not None: - profiles_list = [] - for v in self.profiles: - if isinstance(v, dict): - profiles_list.append(v) - else: - profiles_list.append(v.to_dict()) - _dict['profiles'] = profiles_list + if hasattr(self, 'transaction_id') and self.transaction_id is not None: + _dict['transaction_id'] = self.transaction_id + if hasattr(self, 'operation') and self.operation is not None: + _dict['operation'] = self.operation + if hasattr(self, 'user_agent') and self.user_agent is not None: + _dict['user_agent'] = self.user_agent + if hasattr(self, 'url') and self.url is not None: + _dict['url'] = self.url + if hasattr(self, 'instance_id') and self.instance_id is not None: + _dict['instance_id'] = self.instance_id + if hasattr(self, 'thread_id') and self.thread_id is not None: + _dict['thread_id'] = self.thread_id + if hasattr(self, 'host') and self.host is not None: + _dict['host'] = self.host + if hasattr(self, 'start_time') and self.start_time is not None: + _dict['start_time'] = self.start_time + if hasattr(self, 'end_time') and self.end_time is not None: + _dict['end_time'] = self.end_time + if hasattr(self, 'elapsed_time') and self.elapsed_time is not None: + _dict['elapsed_time'] = self.elapsed_time + if hasattr(self, 'cluster_name') and self.cluster_name is not None: + _dict['cluster_name'] = self.cluster_name return _dict def _to_dict(self): @@ -11036,115 +11176,236 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Report object.""" + """Return a `str` version of this ResponseContext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Report') -> bool: + def __eq__(self, other: 'ResponseContext') -> 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: 'Report') -> bool: + def __ne__(self, other: 'ResponseContext') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReportMfaEnrollmentStatus: +class ServiceId: """ - ReportMfaEnrollmentStatus. + Response body format for service ID V1 REST requests. - :param str created_by: IAMid of the user who triggered the report. - :param str reference: Unique reference used to generate the report. - :param str report_time: Date time at which report is generated. Date is in ISO - format. - :param str account_id: BSS account id of the user who triggered the report. - :param str ims_account_id: (optional) IMS account id of the user who triggered - the report. - :param List[UserReportMfaEnrollmentStatus] users: (optional) List of users. + :param ResponseContext context: (optional) Context with key properties for + problem determination. + :param str id: Unique identifier of this Service Id. + :param str iam_id: Cloud wide identifier for identities of this service ID. + :param str entity_tag: Version of the service ID details object. You need to + specify this value when updating the service ID to avoid stale updates. + :param str crn: Cloud Resource Name of the item. Example Cloud Resource Name: + 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::serviceid:1234-5678-9012'. + :param bool locked: The service ID cannot be changed if set to true. + :param datetime created_at: If set contains a date time string of the creation + date in ISO format. + :param datetime modified_at: If set contains a date time string of the last + modification date in ISO format. + :param str account_id: ID of the account the service ID belongs to. + :param str group_id: (optional) ID of the group to which the service ID belongs + to. Only set if requested via parameter `show_group_id`. + :param str name: Name of the Service Id. The name is not checked for uniqueness. + Therefore multiple names with the same value can exist. Access is done via the + UUID of the Service Id. + :param str description: (optional) The optional description of the Service Id. + The 'description' property is only available if a description was provided + during a create of a Service Id. + :param List[str] unique_instance_crns: (optional) Optional list of CRNs (string + array) which point to the services connected to the service ID. + :param List[EnityHistoryRecord] history: (optional) History of the Service ID. + :param ApiKey apikey: (optional) Response body format for API key V1 REST + requests. + :param Activity activity: (optional) """ def __init__( self, - created_by: str, - reference: str, - report_time: str, + id: str, + iam_id: str, + entity_tag: str, + crn: str, + locked: bool, + created_at: datetime, + modified_at: datetime, account_id: str, + name: str, *, - ims_account_id: Optional[str] = None, - users: Optional[List['UserReportMfaEnrollmentStatus']] = None, + context: Optional['ResponseContext'] = None, + group_id: Optional[str] = None, + description: Optional[str] = None, + unique_instance_crns: Optional[List[str]] = None, + history: Optional[List['EnityHistoryRecord']] = None, + apikey: Optional['ApiKey'] = None, + activity: Optional['Activity'] = None, ) -> None: """ - Initialize a ReportMfaEnrollmentStatus object. + Initialize a ServiceId object. - :param str created_by: IAMid of the user who triggered the report. - :param str reference: Unique reference used to generate the report. - :param str report_time: Date time at which report is generated. Date is in - ISO format. - :param str account_id: BSS account id of the user who triggered the report. - :param str ims_account_id: (optional) IMS account id of the user who - triggered the report. - :param List[UserReportMfaEnrollmentStatus] users: (optional) List of users. + :param str id: Unique identifier of this Service Id. + :param str iam_id: Cloud wide identifier for identities of this service ID. + :param str entity_tag: Version of the service ID details object. You need + to specify this value when updating the service ID to avoid stale updates. + :param str crn: Cloud Resource Name of the item. Example Cloud Resource + Name: + 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::serviceid:1234-5678-9012'. + :param bool locked: The service ID cannot be changed if set to true. + :param datetime created_at: If set contains a date time string of the + creation date in ISO format. + :param datetime modified_at: If set contains a date time string of the last + modification date in ISO format. + :param str account_id: ID of the account the service ID belongs to. + :param str name: Name of the Service Id. The name is not checked for + uniqueness. Therefore multiple names with the same value can exist. Access + is done via the UUID of the Service Id. + :param ResponseContext context: (optional) Context with key properties for + problem determination. + :param str group_id: (optional) ID of the group to which the service ID + belongs to. Only set if requested via parameter `show_group_id`. + :param str description: (optional) The optional description of the Service + Id. The 'description' property is only available if a description was + provided during a create of a Service Id. + :param List[str] unique_instance_crns: (optional) Optional list of CRNs + (string array) which point to the services connected to the service ID. + :param List[EnityHistoryRecord] history: (optional) History of the Service + ID. + :param ApiKey apikey: (optional) Response body format for API key V1 REST + requests. + :param Activity activity: (optional) """ - self.created_by = created_by - self.reference = reference - self.report_time = report_time + self.context = context + self.id = id + self.iam_id = iam_id + self.entity_tag = entity_tag + self.crn = crn + self.locked = locked + self.created_at = created_at + self.modified_at = modified_at self.account_id = account_id - self.ims_account_id = ims_account_id - self.users = users + self.group_id = group_id + self.name = name + self.description = description + self.unique_instance_crns = unique_instance_crns + self.history = history + self.apikey = apikey + self.activity = activity @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportMfaEnrollmentStatus': - """Initialize a ReportMfaEnrollmentStatus object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ServiceId': + """Initialize a ServiceId object from a json dictionary.""" args = {} - if (created_by := _dict.get('created_by')) is not None: - args['created_by'] = created_by + if (context := _dict.get('context')) is not None: + args['context'] = ResponseContext.from_dict(context) + if (id := _dict.get('id')) is not None: + args['id'] = id else: - raise ValueError('Required property \'created_by\' not present in ReportMfaEnrollmentStatus JSON') - if (reference := _dict.get('reference')) is not None: - args['reference'] = reference + raise ValueError('Required property \'id\' not present in ServiceId JSON') + if (iam_id := _dict.get('iam_id')) is not None: + args['iam_id'] = iam_id else: - raise ValueError('Required property \'reference\' not present in ReportMfaEnrollmentStatus JSON') - if (report_time := _dict.get('report_time')) is not None: - args['report_time'] = report_time + raise ValueError('Required property \'iam_id\' not present in ServiceId JSON') + if (entity_tag := _dict.get('entity_tag')) is not None: + args['entity_tag'] = entity_tag else: - raise ValueError('Required property \'report_time\' not present in ReportMfaEnrollmentStatus JSON') + raise ValueError('Required property \'entity_tag\' not present in ServiceId JSON') + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + else: + raise ValueError('Required property \'crn\' not present in ServiceId JSON') + if (locked := _dict.get('locked')) is not None: + args['locked'] = locked + else: + raise ValueError('Required property \'locked\' not present in ServiceId 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 ServiceId JSON') + if (modified_at := _dict.get('modified_at')) is not None: + args['modified_at'] = string_to_datetime(modified_at) + else: + raise ValueError('Required property \'modified_at\' not present in ServiceId JSON') if (account_id := _dict.get('account_id')) is not None: args['account_id'] = account_id else: - raise ValueError('Required property \'account_id\' not present in ReportMfaEnrollmentStatus JSON') - if (ims_account_id := _dict.get('ims_account_id')) is not None: - args['ims_account_id'] = ims_account_id - if (users := _dict.get('users')) is not None: - args['users'] = [UserReportMfaEnrollmentStatus.from_dict(v) for v in users] + raise ValueError('Required property \'account_id\' not present in ServiceId JSON') + if (group_id := _dict.get('group_id')) is not None: + args['group_id'] = group_id + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in ServiceId JSON') + if (description := _dict.get('description')) is not None: + args['description'] = description + if (unique_instance_crns := _dict.get('unique_instance_crns')) is not None: + args['unique_instance_crns'] = unique_instance_crns + if (history := _dict.get('history')) is not None: + args['history'] = [EnityHistoryRecord.from_dict(v) for v in history] + if (apikey := _dict.get('apikey')) is not None: + args['apikey'] = ApiKey.from_dict(apikey) + if (activity := _dict.get('activity')) is not None: + args['activity'] = Activity.from_dict(activity) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReportMfaEnrollmentStatus object from a json dictionary.""" + """Initialize a ServiceId 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_by') and self.created_by is not None: - _dict['created_by'] = self.created_by - if hasattr(self, 'reference') and self.reference is not None: - _dict['reference'] = self.reference - if hasattr(self, 'report_time') and self.report_time is not None: - _dict['report_time'] = self.report_time + if hasattr(self, 'context') and self.context is not None: + if isinstance(self.context, dict): + _dict['context'] = self.context + else: + _dict['context'] = self.context.to_dict() + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'iam_id') and self.iam_id is not None: + _dict['iam_id'] = self.iam_id + if hasattr(self, 'entity_tag') and self.entity_tag is not None: + _dict['entity_tag'] = self.entity_tag + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'locked') and self.locked is not None: + _dict['locked'] = self.locked + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'modified_at') and self.modified_at is not None: + _dict['modified_at'] = datetime_to_string(self.modified_at) if hasattr(self, 'account_id') and self.account_id is not None: _dict['account_id'] = self.account_id - if hasattr(self, 'ims_account_id') and self.ims_account_id is not None: - _dict['ims_account_id'] = self.ims_account_id - if hasattr(self, 'users') and self.users is not None: - users_list = [] - for v in self.users: + if hasattr(self, 'group_id') and self.group_id is not None: + _dict['group_id'] = self.group_id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'unique_instance_crns') and self.unique_instance_crns is not None: + _dict['unique_instance_crns'] = self.unique_instance_crns + if hasattr(self, 'history') and self.history is not None: + history_list = [] + for v in self.history: if isinstance(v, dict): - users_list.append(v) + history_list.append(v) else: - users_list.append(v.to_dict()) - _dict['users'] = users_list + history_list.append(v.to_dict()) + _dict['history'] = history_list + if hasattr(self, 'apikey') and self.apikey is not None: + if isinstance(self.apikey, dict): + _dict['apikey'] = self.apikey + else: + _dict['apikey'] = self.apikey.to_dict() + if hasattr(self, 'activity') and self.activity is not None: + if isinstance(self.activity, dict): + _dict['activity'] = self.activity + else: + _dict['activity'] = self.activity.to_dict() return _dict def _to_dict(self): @@ -11152,58 +11413,141 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportMfaEnrollmentStatus object.""" + """Return a `str` version of this ServiceId object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportMfaEnrollmentStatus') -> bool: + def __eq__(self, other: 'ServiceId') -> 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: 'ReportMfaEnrollmentStatus') -> bool: + def __ne__(self, other: 'ServiceId') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReportReference: +class ServiceIdGroup: """ - ReportReference. + ServiceIdGroup. - :param str reference: Reference for the report to be generated. + :param str id: ID of the the service ID group. + :param str entity_tag: (optional) Version of the service ID group details + object. You need to specify this value when updating the service ID group to + avoid stale updates. + :param str account_id: ID of the account the service ID group belongs to. + :param str crn: Cloud Resource Name of the item. + :param str name: Name of the service ID group. Unique in the account. + :param str description: (optional) Description of the service ID group. + :param str created_at: (optional) Timestamp of when the service ID group was + created. + :param str created_by: IAM ID of the user or service which created the Service + Id group. + :param str modified_at: (optional) Timestamp of when the service ID group was + modified. """ def __init__( self, - reference: str, + id: str, + account_id: str, + crn: str, + name: str, + created_by: str, + *, + entity_tag: Optional[str] = None, + description: Optional[str] = None, + created_at: Optional[str] = None, + modified_at: Optional[str] = None, ) -> None: """ - Initialize a ReportReference object. + Initialize a ServiceIdGroup object. - :param str reference: Reference for the report to be generated. + :param str id: ID of the the service ID group. + :param str account_id: ID of the account the service ID group belongs to. + :param str crn: Cloud Resource Name of the item. + :param str name: Name of the service ID group. Unique in the account. + :param str created_by: IAM ID of the user or service which created the + Service Id group. + :param str entity_tag: (optional) Version of the service ID group details + object. You need to specify this value when updating the service ID group + to avoid stale updates. + :param str description: (optional) Description of the service ID group. + :param str created_at: (optional) Timestamp of when the service ID group + was created. + :param str modified_at: (optional) Timestamp of when the service ID group + was modified. """ - self.reference = reference + self.id = id + self.entity_tag = entity_tag + self.account_id = account_id + self.crn = crn + self.name = name + self.description = description + self.created_at = created_at + self.created_by = created_by + self.modified_at = modified_at @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportReference': - """Initialize a ReportReference object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ServiceIdGroup': + """Initialize a ServiceIdGroup object from a json dictionary.""" args = {} - if (reference := _dict.get('reference')) is not None: - args['reference'] = reference + if (id := _dict.get('id')) is not None: + args['id'] = id else: - raise ValueError('Required property \'reference\' not present in ReportReference JSON') + raise ValueError('Required property \'id\' not present in ServiceIdGroup JSON') + if (entity_tag := _dict.get('entity_tag')) is not None: + args['entity_tag'] = entity_tag + if (account_id := _dict.get('account_id')) is not None: + args['account_id'] = account_id + else: + raise ValueError('Required property \'account_id\' not present in ServiceIdGroup JSON') + if (crn := _dict.get('crn')) is not None: + args['crn'] = crn + else: + raise ValueError('Required property \'crn\' not present in ServiceIdGroup JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in ServiceIdGroup JSON') + if (description := _dict.get('description')) is not None: + args['description'] = description + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = created_at + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + else: + raise ValueError('Required property \'created_by\' not present in ServiceIdGroup JSON') + if (modified_at := _dict.get('modified_at')) is not None: + args['modified_at'] = modified_at return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReportReference object from a json dictionary.""" + """Initialize a ServiceIdGroup 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, 'reference') and self.reference is not None: - _dict['reference'] = self.reference + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'entity_tag') and self.entity_tag is not None: + _dict['entity_tag'] = self.entity_tag + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'crn') and self.crn is not None: + _dict['crn'] = self.crn + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = self.created_at + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'modified_at') and self.modified_at is not None: + _dict['modified_at'] = self.modified_at return _dict def _to_dict(self): @@ -11211,146 +11555,66 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportReference object.""" + """Return a `str` version of this ServiceIdGroup object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportReference') -> bool: + def __eq__(self, other: 'ServiceIdGroup') -> 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: 'ReportReference') -> bool: + def __ne__(self, other: 'ServiceIdGroup') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ResponseContext: +class ServiceIdGroupList: """ - Context with key properties for problem determination. + ServiceIdGroupList. - :param str transaction_id: (optional) The transaction ID of the inbound REST - request. - :param str operation: (optional) The operation of the inbound REST request. - :param str user_agent: (optional) The user agent of the inbound REST request. - :param str url: (optional) The URL of that cluster. - :param str instance_id: (optional) The instance ID of the server instance - processing the request. - :param str thread_id: (optional) The thread ID of the server instance processing - the request. - :param str host: (optional) The host of the server instance processing the - request. - :param str start_time: (optional) The start time of the request. - :param str end_time: (optional) The finish time of the request. - :param str elapsed_time: (optional) The elapsed time in msec. - :param str cluster_name: (optional) The cluster name. + :param List[ServiceIdGroup] serviceid_groups: List of Service ID groups based on + the query parameter. """ def __init__( self, - *, - transaction_id: Optional[str] = None, - operation: Optional[str] = None, - user_agent: Optional[str] = None, - url: Optional[str] = None, - instance_id: Optional[str] = None, - thread_id: Optional[str] = None, - host: Optional[str] = None, - start_time: Optional[str] = None, - end_time: Optional[str] = None, - elapsed_time: Optional[str] = None, - cluster_name: Optional[str] = None, + serviceid_groups: List['ServiceIdGroup'], ) -> None: """ - Initialize a ResponseContext object. + Initialize a ServiceIdGroupList object. - :param str transaction_id: (optional) The transaction ID of the inbound - REST request. - :param str operation: (optional) The operation of the inbound REST request. - :param str user_agent: (optional) The user agent of the inbound REST - request. - :param str url: (optional) The URL of that cluster. - :param str instance_id: (optional) The instance ID of the server instance - processing the request. - :param str thread_id: (optional) The thread ID of the server instance - processing the request. - :param str host: (optional) The host of the server instance processing the - request. - :param str start_time: (optional) The start time of the request. - :param str end_time: (optional) The finish time of the request. - :param str elapsed_time: (optional) The elapsed time in msec. - :param str cluster_name: (optional) The cluster name. + :param List[ServiceIdGroup] serviceid_groups: List of Service ID groups + based on the query parameter. """ - self.transaction_id = transaction_id - self.operation = operation - self.user_agent = user_agent - self.url = url - self.instance_id = instance_id - self.thread_id = thread_id - self.host = host - self.start_time = start_time - self.end_time = end_time - self.elapsed_time = elapsed_time - self.cluster_name = cluster_name + self.serviceid_groups = serviceid_groups @classmethod - def from_dict(cls, _dict: Dict) -> 'ResponseContext': - """Initialize a ResponseContext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ServiceIdGroupList': + """Initialize a ServiceIdGroupList object from a json dictionary.""" args = {} - if (transaction_id := _dict.get('transaction_id')) is not None: - args['transaction_id'] = transaction_id - if (operation := _dict.get('operation')) is not None: - args['operation'] = operation - if (user_agent := _dict.get('user_agent')) is not None: - args['user_agent'] = user_agent - if (url := _dict.get('url')) is not None: - args['url'] = url - if (instance_id := _dict.get('instance_id')) is not None: - args['instance_id'] = instance_id - if (thread_id := _dict.get('thread_id')) is not None: - args['thread_id'] = thread_id - if (host := _dict.get('host')) is not None: - args['host'] = host - if (start_time := _dict.get('start_time')) is not None: - args['start_time'] = start_time - if (end_time := _dict.get('end_time')) is not None: - args['end_time'] = end_time - if (elapsed_time := _dict.get('elapsed_time')) is not None: - args['elapsed_time'] = elapsed_time - if (cluster_name := _dict.get('cluster_name')) is not None: - args['cluster_name'] = cluster_name + if (serviceid_groups := _dict.get('serviceid_groups')) is not None: + args['serviceid_groups'] = [ServiceIdGroup.from_dict(v) for v in serviceid_groups] + else: + raise ValueError('Required property \'serviceid_groups\' not present in ServiceIdGroupList JSON') return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a ResponseContext 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, 'transaction_id') and self.transaction_id is not None: - _dict['transaction_id'] = self.transaction_id - if hasattr(self, 'operation') and self.operation is not None: - _dict['operation'] = self.operation - if hasattr(self, 'user_agent') and self.user_agent is not None: - _dict['user_agent'] = self.user_agent - if hasattr(self, 'url') and self.url is not None: - _dict['url'] = self.url - if hasattr(self, 'instance_id') and self.instance_id is not None: - _dict['instance_id'] = self.instance_id - if hasattr(self, 'thread_id') and self.thread_id is not None: - _dict['thread_id'] = self.thread_id - if hasattr(self, 'host') and self.host is not None: - _dict['host'] = self.host - if hasattr(self, 'start_time') and self.start_time is not None: - _dict['start_time'] = self.start_time - if hasattr(self, 'end_time') and self.end_time is not None: - _dict['end_time'] = self.end_time - if hasattr(self, 'elapsed_time') and self.elapsed_time is not None: - _dict['elapsed_time'] = self.elapsed_time - if hasattr(self, 'cluster_name') and self.cluster_name is not None: - _dict['cluster_name'] = self.cluster_name + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ServiceIdGroupList 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, 'serviceid_groups') and self.serviceid_groups is not None: + serviceid_groups_list = [] + for v in self.serviceid_groups: + if isinstance(v, dict): + serviceid_groups_list.append(v) + else: + serviceid_groups_list.append(v.to_dict()) + _dict['serviceid_groups'] = serviceid_groups_list return _dict def _to_dict(self): @@ -11358,184 +11622,102 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ResponseContext object.""" + """Return a `str` version of this ServiceIdGroupList object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ResponseContext') -> bool: + def __eq__(self, other: 'ServiceIdGroupList') -> 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: 'ResponseContext') -> bool: + def __ne__(self, other: 'ServiceIdGroupList') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ServiceId: +class ServiceIdList: """ - Response body format for service ID V1 REST requests. + Response body format for the list service ID V1 REST request. :param ResponseContext context: (optional) Context with key properties for problem determination. - :param str id: Unique identifier of this Service Id. - :param str iam_id: Cloud wide identifier for identities of this service ID. - :param str entity_tag: Version of the service ID details object. You need to - specify this value when updating the service ID to avoid stale updates. - :param str crn: Cloud Resource Name of the item. Example Cloud Resource Name: - 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::serviceid:1234-5678-9012'. - :param bool locked: The service ID cannot be changed if set to true. - :param datetime created_at: If set contains a date time string of the creation - date in ISO format. - :param datetime modified_at: If set contains a date time string of the last - modification date in ISO format. - :param str account_id: ID of the account the service ID belongs to. - :param str group_id: (optional) ID of the group to which the service ID belongs - to. Only set if requested via parameter `show_group_id`. - :param str name: Name of the Service Id. The name is not checked for uniqueness. - Therefore multiple names with the same value can exist. Access is done via the - UUID of the Service Id. - :param str description: (optional) The optional description of the Service Id. - The 'description' property is only available if a description was provided - during a create of a Service Id. - :param List[str] unique_instance_crns: (optional) Optional list of CRNs (string - array) which point to the services connected to the service ID. - :param List[EnityHistoryRecord] history: (optional) History of the Service ID. - :param ApiKey apikey: (optional) Response body format for API key V1 REST - requests. - :param Activity activity: (optional) + :param int offset: (optional) The offset of the current page. + :param int limit: (optional) Optional size of a single page. Default is 20 items + per page. Valid range is 1 to 100. + :param str first: (optional) Link to the first page. + :param str previous: (optional) Link to the previous available page. If + 'previous' property is not part of the response no previous page is available. + :param str next: (optional) Link to the next available page. If 'next' property + is not part of the response no next page is available. + :param List[ServiceId] serviceids: List of service IDs based on the query + paramters and the page size. The service IDs array is always part of the + response but might be empty depending on the query parameter values provided. """ def __init__( self, - id: str, - iam_id: str, - entity_tag: str, - crn: str, - locked: bool, - created_at: datetime, - modified_at: datetime, - account_id: str, - name: str, + serviceids: List['ServiceId'], *, context: Optional['ResponseContext'] = None, - group_id: Optional[str] = None, - description: Optional[str] = None, - unique_instance_crns: Optional[List[str]] = None, - history: Optional[List['EnityHistoryRecord']] = None, - apikey: Optional['ApiKey'] = None, - activity: Optional['Activity'] = None, + offset: Optional[int] = None, + limit: Optional[int] = None, + first: Optional[str] = None, + previous: Optional[str] = None, + next: Optional[str] = None, ) -> None: """ - Initialize a ServiceId object. + Initialize a ServiceIdList object. - :param str id: Unique identifier of this Service Id. - :param str iam_id: Cloud wide identifier for identities of this service ID. - :param str entity_tag: Version of the service ID details object. You need - to specify this value when updating the service ID to avoid stale updates. - :param str crn: Cloud Resource Name of the item. Example Cloud Resource - Name: - 'crn:v1:bluemix:public:iam-identity:us-south:a/myaccount::serviceid:1234-5678-9012'. - :param bool locked: The service ID cannot be changed if set to true. - :param datetime created_at: If set contains a date time string of the - creation date in ISO format. - :param datetime modified_at: If set contains a date time string of the last - modification date in ISO format. - :param str account_id: ID of the account the service ID belongs to. - :param str name: Name of the Service Id. The name is not checked for - uniqueness. Therefore multiple names with the same value can exist. Access - is done via the UUID of the Service Id. + :param List[ServiceId] serviceids: List of service IDs based on the query + paramters and the page size. The service IDs array is always part of the + response but might be empty depending on the query parameter values + provided. :param ResponseContext context: (optional) Context with key properties for problem determination. - :param str group_id: (optional) ID of the group to which the service ID - belongs to. Only set if requested via parameter `show_group_id`. - :param str description: (optional) The optional description of the Service - Id. The 'description' property is only available if a description was - provided during a create of a Service Id. - :param List[str] unique_instance_crns: (optional) Optional list of CRNs - (string array) which point to the services connected to the service ID. - :param List[EnityHistoryRecord] history: (optional) History of the Service - ID. - :param ApiKey apikey: (optional) Response body format for API key V1 REST - requests. - :param Activity activity: (optional) + :param int offset: (optional) The offset of the current page. + :param int limit: (optional) Optional size of a single page. Default is 20 + items per page. Valid range is 1 to 100. + :param str first: (optional) Link to the first page. + :param str previous: (optional) Link to the previous available page. If + 'previous' property is not part of the response no previous page is + available. + :param str next: (optional) Link to the next available page. If 'next' + property is not part of the response no next page is available. """ self.context = context - self.id = id - self.iam_id = iam_id - self.entity_tag = entity_tag - self.crn = crn - self.locked = locked - self.created_at = created_at - self.modified_at = modified_at - self.account_id = account_id - self.group_id = group_id - self.name = name - self.description = description - self.unique_instance_crns = unique_instance_crns - self.history = history - self.apikey = apikey - self.activity = activity + self.offset = offset + self.limit = limit + self.first = first + self.previous = previous + self.next = next + self.serviceids = serviceids @classmethod - def from_dict(cls, _dict: Dict) -> 'ServiceId': - """Initialize a ServiceId object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ServiceIdList': + """Initialize a ServiceIdList object from a json dictionary.""" args = {} if (context := _dict.get('context')) is not None: args['context'] = ResponseContext.from_dict(context) - if (id := _dict.get('id')) is not None: - args['id'] = id - else: - raise ValueError('Required property \'id\' not present in ServiceId JSON') - if (iam_id := _dict.get('iam_id')) is not None: - args['iam_id'] = iam_id - else: - raise ValueError('Required property \'iam_id\' not present in ServiceId JSON') - if (entity_tag := _dict.get('entity_tag')) is not None: - args['entity_tag'] = entity_tag - else: - raise ValueError('Required property \'entity_tag\' not present in ServiceId JSON') - if (crn := _dict.get('crn')) is not None: - args['crn'] = crn - else: - raise ValueError('Required property \'crn\' not present in ServiceId JSON') - if (locked := _dict.get('locked')) is not None: - args['locked'] = locked - else: - raise ValueError('Required property \'locked\' not present in ServiceId 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 ServiceId JSON') - if (modified_at := _dict.get('modified_at')) is not None: - args['modified_at'] = string_to_datetime(modified_at) - else: - raise ValueError('Required property \'modified_at\' not present in ServiceId JSON') - if (account_id := _dict.get('account_id')) is not None: - args['account_id'] = account_id - else: - raise ValueError('Required property \'account_id\' not present in ServiceId JSON') - if (group_id := _dict.get('group_id')) is not None: - args['group_id'] = group_id - if (name := _dict.get('name')) is not None: - args['name'] = name + if (offset := _dict.get('offset')) is not None: + args['offset'] = offset + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + if (first := _dict.get('first')) is not None: + args['first'] = first + if (previous := _dict.get('previous')) is not None: + args['previous'] = previous + if (next := _dict.get('next')) is not None: + args['next'] = next + if (serviceids := _dict.get('serviceids')) is not None: + args['serviceids'] = [ServiceId.from_dict(v) for v in serviceids] else: - raise ValueError('Required property \'name\' not present in ServiceId JSON') - if (description := _dict.get('description')) is not None: - args['description'] = description - if (unique_instance_crns := _dict.get('unique_instance_crns')) is not None: - args['unique_instance_crns'] = unique_instance_crns - if (history := _dict.get('history')) is not None: - args['history'] = [EnityHistoryRecord.from_dict(v) for v in history] - if (apikey := _dict.get('apikey')) is not None: - args['apikey'] = ApiKey.from_dict(apikey) - if (activity := _dict.get('activity')) is not None: - args['activity'] = Activity.from_dict(activity) + raise ValueError('Required property \'serviceids\' not present in ServiceIdList JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ServiceId object from a json dictionary.""" + """Initialize a ServiceIdList object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -11546,48 +11728,24 @@ def to_dict(self) -> Dict: _dict['context'] = self.context else: _dict['context'] = self.context.to_dict() - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'iam_id') and self.iam_id is not None: - _dict['iam_id'] = self.iam_id - if hasattr(self, 'entity_tag') and self.entity_tag is not None: - _dict['entity_tag'] = self.entity_tag - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'locked') and self.locked is not None: - _dict['locked'] = self.locked - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'modified_at') and self.modified_at is not None: - _dict['modified_at'] = datetime_to_string(self.modified_at) - if hasattr(self, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'group_id') and self.group_id is not None: - _dict['group_id'] = self.group_id - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'description') and self.description is not None: - _dict['description'] = self.description - if hasattr(self, 'unique_instance_crns') and self.unique_instance_crns is not None: - _dict['unique_instance_crns'] = self.unique_instance_crns - if hasattr(self, 'history') and self.history is not None: - history_list = [] - for v in self.history: + if hasattr(self, 'offset') and self.offset is not None: + _dict['offset'] = self.offset + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'first') and self.first is not None: + _dict['first'] = self.first + if hasattr(self, 'previous') and self.previous is not None: + _dict['previous'] = self.previous + if hasattr(self, 'next') and self.next is not None: + _dict['next'] = self.next + if hasattr(self, 'serviceids') and self.serviceids is not None: + serviceids_list = [] + for v in self.serviceids: if isinstance(v, dict): - history_list.append(v) + serviceids_list.append(v) else: - history_list.append(v.to_dict()) - _dict['history'] = history_list - if hasattr(self, 'apikey') and self.apikey is not None: - if isinstance(self.apikey, dict): - _dict['apikey'] = self.apikey - else: - _dict['apikey'] = self.apikey.to_dict() - if hasattr(self, 'activity') and self.activity is not None: - if isinstance(self.activity, dict): - _dict['activity'] = self.activity - else: - _dict['activity'] = self.activity.to_dict() + serviceids_list.append(v.to_dict()) + _dict['serviceids'] = serviceids_list return _dict def _to_dict(self): @@ -11595,141 +11753,250 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ServiceId object.""" + """Return a `str` version of this ServiceIdList object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ServiceId') -> bool: + def __eq__(self, other: 'ServiceIdList') -> 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: 'ServiceId') -> bool: + def __ne__(self, other: 'ServiceIdList') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ServiceIdGroup: +class TemplateAccountSettings: """ - ServiceIdGroup. + Input body parameters for the Account Settings REST request. - :param str id: ID of the the service ID group. - :param str entity_tag: (optional) Version of the service ID group details - object. You need to specify this value when updating the service ID group to - avoid stale updates. - :param str account_id: ID of the account the service ID group belongs to. - :param str crn: Cloud Resource Name of the item. - :param str name: Name of the service ID group. Unique in the account. - :param str description: (optional) Description of the service ID group. - :param str created_at: (optional) Timestamp of when the service ID group was - created. - :param str created_by: IAM ID of the user or service which created the Service - Id group. - :param str modified_at: (optional) Timestamp of when the service ID group was - modified. + :param str restrict_create_service_id: (optional) Defines whether or not + creating the resource is access controlled. Valid values: + * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM + Identity Service can create service IDs, including the account owner + * NOT_RESTRICTED - all members of an account can create service IDs + * NOT_SET - to 'unset' a previous set value. + :param str restrict_create_platform_apikey: (optional) Defines whether or not + creating the resource is access controlled. Valid values: + * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM + Identity Service can create service IDs, including the account owner + * NOT_RESTRICTED - all members of an account can create service IDs + * NOT_SET - to 'unset' a previous set value. + :param str allowed_ip_addresses: (optional) Defines the IP addresses and subnets + from which IAM tokens can be created for the account. + :param str mfa: (optional) MFA trait definitions as follows: + * NONE - No MFA trait set + * NONE_NO_ROPC- No MFA, disable CLI logins with only a password + * TOTP - For all non-federated IBMId users + * TOTP4ALL - For all users + * LEVEL1 - Email-based MFA for all users + * LEVEL2 - TOTP-based MFA for all users + * LEVEL3 - U2F MFA for all users. + :param List[UserMfa] user_mfa: (optional) List of users that are exempted from + the MFA requirement of the account. + :param str session_expiration_in_seconds: (optional) Defines the session + expiration in seconds for the account. Valid values: + * Any whole number between between '900' and '86400' + * NOT_SET - To unset account setting and use service default. + :param str session_invalidation_in_seconds: (optional) Defines the period of + time in seconds in which a session will be invalidated due to inactivity. Valid + values: + * Any whole number between '900' and '7200' + * NOT_SET - To unset account setting and use service default. + :param str max_sessions_per_identity: (optional) Defines the max allowed + sessions per identity required by the account. Valid values: + * Any whole number greater than 0 + * NOT_SET - To unset account setting and use service default. + :param str system_access_token_expiration_in_seconds: (optional) Defines the + access token expiration in seconds. Valid values: + * Any whole number between '900' and '3600' + * NOT_SET - To unset account setting and use service default. + :param str system_refresh_token_expiration_in_seconds: (optional) Defines the + refresh token expiration in seconds. Valid values: + * Any whole number between '900' and '259200' + * NOT_SET - To unset account setting and use service default. + :param str restrict_user_list_visibility: (optional) Defines whether or not user + visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the account, + such as those the user has invited to the account, or descendants of those users + based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the Users + page in IBM Cloud console + * NOT_SET - to 'unset' a previous set value. + :param TemplateAccountSettingsRestrictUserDomains restrict_user_domains: + (optional) """ def __init__( self, - id: str, - account_id: str, - crn: str, - name: str, - created_by: str, *, - entity_tag: Optional[str] = None, - description: Optional[str] = None, - created_at: Optional[str] = None, - modified_at: Optional[str] = None, + restrict_create_service_id: Optional[str] = None, + restrict_create_platform_apikey: Optional[str] = None, + allowed_ip_addresses: Optional[str] = None, + mfa: Optional[str] = None, + user_mfa: Optional[List['UserMfa']] = None, + session_expiration_in_seconds: Optional[str] = None, + session_invalidation_in_seconds: Optional[str] = None, + max_sessions_per_identity: Optional[str] = None, + system_access_token_expiration_in_seconds: Optional[str] = None, + system_refresh_token_expiration_in_seconds: Optional[str] = None, + restrict_user_list_visibility: Optional[str] = None, + restrict_user_domains: Optional['TemplateAccountSettingsRestrictUserDomains'] = None, ) -> None: """ - Initialize a ServiceIdGroup object. + Initialize a TemplateAccountSettings object. - :param str id: ID of the the service ID group. - :param str account_id: ID of the account the service ID group belongs to. - :param str crn: Cloud Resource Name of the item. - :param str name: Name of the service ID group. Unique in the account. - :param str created_by: IAM ID of the user or service which created the - Service Id group. - :param str entity_tag: (optional) Version of the service ID group details - object. You need to specify this value when updating the service ID group - to avoid stale updates. - :param str description: (optional) Description of the service ID group. - :param str created_at: (optional) Timestamp of when the service ID group - was created. - :param str modified_at: (optional) Timestamp of when the service ID group - was modified. + :param str restrict_create_service_id: (optional) Defines whether or not + creating the resource is access controlled. Valid values: + * RESTRICTED - only users assigned the 'Service ID creator' role on the + IAM Identity Service can create service IDs, including the account owner + * NOT_RESTRICTED - all members of an account can create service IDs + * NOT_SET - to 'unset' a previous set value. + :param str restrict_create_platform_apikey: (optional) Defines whether or + not creating the resource is access controlled. Valid values: + * RESTRICTED - only users assigned the 'Service ID creator' role on the + IAM Identity Service can create service IDs, including the account owner + * NOT_RESTRICTED - all members of an account can create service IDs + * NOT_SET - to 'unset' a previous set value. + :param str allowed_ip_addresses: (optional) Defines the IP addresses and + subnets from which IAM tokens can be created for the account. + :param str mfa: (optional) MFA trait definitions as follows: + * NONE - No MFA trait set + * NONE_NO_ROPC- No MFA, disable CLI logins with only a password + * TOTP - For all non-federated IBMId users + * TOTP4ALL - For all users + * LEVEL1 - Email-based MFA for all users + * LEVEL2 - TOTP-based MFA for all users + * LEVEL3 - U2F MFA for all users. + :param List[UserMfa] user_mfa: (optional) List of users that are exempted + from the MFA requirement of the account. + :param str session_expiration_in_seconds: (optional) Defines the session + expiration in seconds for the account. Valid values: + * Any whole number between between '900' and '86400' + * NOT_SET - To unset account setting and use service default. + :param str session_invalidation_in_seconds: (optional) Defines the period + of time in seconds in which a session will be invalidated due to + inactivity. Valid values: + * Any whole number between '900' and '7200' + * NOT_SET - To unset account setting and use service default. + :param str max_sessions_per_identity: (optional) Defines the max allowed + sessions per identity required by the account. Valid values: + * Any whole number greater than 0 + * NOT_SET - To unset account setting and use service default. + :param str system_access_token_expiration_in_seconds: (optional) Defines + the access token expiration in seconds. Valid values: + * Any whole number between '900' and '3600' + * NOT_SET - To unset account setting and use service default. + :param str system_refresh_token_expiration_in_seconds: (optional) Defines + the refresh token expiration in seconds. Valid values: + * Any whole number between '900' and '259200' + * NOT_SET - To unset account setting and use service default. + :param str restrict_user_list_visibility: (optional) Defines whether or not + user visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the + account, such as those the user has invited to the account, or descendants + of those users based on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the + Users page in IBM Cloud console + * NOT_SET - to 'unset' a previous set value. + :param TemplateAccountSettingsRestrictUserDomains restrict_user_domains: + (optional) """ - self.id = id - self.entity_tag = entity_tag - self.account_id = account_id - self.crn = crn - self.name = name - self.description = description - self.created_at = created_at - self.created_by = created_by - self.modified_at = modified_at + self.restrict_create_service_id = restrict_create_service_id + self.restrict_create_platform_apikey = restrict_create_platform_apikey + self.allowed_ip_addresses = allowed_ip_addresses + self.mfa = mfa + self.user_mfa = user_mfa + self.session_expiration_in_seconds = session_expiration_in_seconds + self.session_invalidation_in_seconds = session_invalidation_in_seconds + self.max_sessions_per_identity = max_sessions_per_identity + self.system_access_token_expiration_in_seconds = system_access_token_expiration_in_seconds + self.system_refresh_token_expiration_in_seconds = system_refresh_token_expiration_in_seconds + self.restrict_user_list_visibility = restrict_user_list_visibility + self.restrict_user_domains = restrict_user_domains @classmethod - def from_dict(cls, _dict: Dict) -> 'ServiceIdGroup': - """Initialize a ServiceIdGroup object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'TemplateAccountSettings': + """Initialize a TemplateAccountSettings object from a json dictionary.""" args = {} - if (id := _dict.get('id')) is not None: - args['id'] = id - else: - raise ValueError('Required property \'id\' not present in ServiceIdGroup JSON') - if (entity_tag := _dict.get('entity_tag')) is not None: - args['entity_tag'] = entity_tag - if (account_id := _dict.get('account_id')) is not None: - args['account_id'] = account_id - else: - raise ValueError('Required property \'account_id\' not present in ServiceIdGroup JSON') - if (crn := _dict.get('crn')) is not None: - args['crn'] = crn - else: - raise ValueError('Required property \'crn\' not present in ServiceIdGroup JSON') - if (name := _dict.get('name')) is not None: - args['name'] = name - else: - raise ValueError('Required property \'name\' not present in ServiceIdGroup JSON') - if (description := _dict.get('description')) is not None: - args['description'] = description - if (created_at := _dict.get('created_at')) is not None: - args['created_at'] = created_at - if (created_by := _dict.get('created_by')) is not None: - args['created_by'] = created_by - else: - raise ValueError('Required property \'created_by\' not present in ServiceIdGroup JSON') - if (modified_at := _dict.get('modified_at')) is not None: - args['modified_at'] = modified_at + if (restrict_create_service_id := _dict.get('restrict_create_service_id')) is not None: + args['restrict_create_service_id'] = restrict_create_service_id + if (restrict_create_platform_apikey := _dict.get('restrict_create_platform_apikey')) is not None: + args['restrict_create_platform_apikey'] = restrict_create_platform_apikey + if (allowed_ip_addresses := _dict.get('allowed_ip_addresses')) is not None: + args['allowed_ip_addresses'] = allowed_ip_addresses + if (mfa := _dict.get('mfa')) is not None: + args['mfa'] = mfa + if (user_mfa := _dict.get('user_mfa')) is not None: + args['user_mfa'] = [UserMfa.from_dict(v) for v in user_mfa] + if (session_expiration_in_seconds := _dict.get('session_expiration_in_seconds')) is not None: + args['session_expiration_in_seconds'] = session_expiration_in_seconds + if (session_invalidation_in_seconds := _dict.get('session_invalidation_in_seconds')) is not None: + args['session_invalidation_in_seconds'] = session_invalidation_in_seconds + if (max_sessions_per_identity := _dict.get('max_sessions_per_identity')) is not None: + args['max_sessions_per_identity'] = max_sessions_per_identity + if ( + system_access_token_expiration_in_seconds := _dict.get('system_access_token_expiration_in_seconds') + ) is not None: + args['system_access_token_expiration_in_seconds'] = system_access_token_expiration_in_seconds + if ( + system_refresh_token_expiration_in_seconds := _dict.get('system_refresh_token_expiration_in_seconds') + ) is not None: + args['system_refresh_token_expiration_in_seconds'] = system_refresh_token_expiration_in_seconds + if (restrict_user_list_visibility := _dict.get('restrict_user_list_visibility')) is not None: + args['restrict_user_list_visibility'] = restrict_user_list_visibility + if (restrict_user_domains := _dict.get('restrict_user_domains')) is not None: + args['restrict_user_domains'] = TemplateAccountSettingsRestrictUserDomains.from_dict(restrict_user_domains) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ServiceIdGroup object from a json dictionary.""" + """Initialize a TemplateAccountSettings 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, 'entity_tag') and self.entity_tag is not None: - _dict['entity_tag'] = self.entity_tag - if hasattr(self, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'crn') and self.crn is not None: - _dict['crn'] = self.crn - if hasattr(self, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'description') and self.description is not None: - _dict['description'] = self.description - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = self.created_at - if hasattr(self, 'created_by') and self.created_by is not None: - _dict['created_by'] = self.created_by - if hasattr(self, 'modified_at') and self.modified_at is not None: - _dict['modified_at'] = self.modified_at + if hasattr(self, 'restrict_create_service_id') and self.restrict_create_service_id is not None: + _dict['restrict_create_service_id'] = self.restrict_create_service_id + if hasattr(self, 'restrict_create_platform_apikey') and self.restrict_create_platform_apikey is not None: + _dict['restrict_create_platform_apikey'] = self.restrict_create_platform_apikey + if hasattr(self, 'allowed_ip_addresses') and self.allowed_ip_addresses is not None: + _dict['allowed_ip_addresses'] = self.allowed_ip_addresses + if hasattr(self, 'mfa') and self.mfa is not None: + _dict['mfa'] = self.mfa + if hasattr(self, 'user_mfa') and self.user_mfa is not None: + user_mfa_list = [] + for v in self.user_mfa: + if isinstance(v, dict): + user_mfa_list.append(v) + else: + user_mfa_list.append(v.to_dict()) + _dict['user_mfa'] = user_mfa_list + if hasattr(self, 'session_expiration_in_seconds') and self.session_expiration_in_seconds is not None: + _dict['session_expiration_in_seconds'] = self.session_expiration_in_seconds + if hasattr(self, 'session_invalidation_in_seconds') and self.session_invalidation_in_seconds is not None: + _dict['session_invalidation_in_seconds'] = self.session_invalidation_in_seconds + if hasattr(self, 'max_sessions_per_identity') and self.max_sessions_per_identity is not None: + _dict['max_sessions_per_identity'] = self.max_sessions_per_identity + if ( + hasattr(self, 'system_access_token_expiration_in_seconds') + and self.system_access_token_expiration_in_seconds is not None + ): + _dict['system_access_token_expiration_in_seconds'] = self.system_access_token_expiration_in_seconds + if ( + hasattr(self, 'system_refresh_token_expiration_in_seconds') + and self.system_refresh_token_expiration_in_seconds is not None + ): + _dict['system_refresh_token_expiration_in_seconds'] = self.system_refresh_token_expiration_in_seconds + if hasattr(self, 'restrict_user_list_visibility') and self.restrict_user_list_visibility is not None: + _dict['restrict_user_list_visibility'] = self.restrict_user_list_visibility + if hasattr(self, 'restrict_user_domains') and self.restrict_user_domains is not None: + if isinstance(self.restrict_user_domains, dict): + _dict['restrict_user_domains'] = self.restrict_user_domains + else: + _dict['restrict_user_domains'] = self.restrict_user_domains.to_dict() return _dict def _to_dict(self): @@ -11737,197 +12004,138 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ServiceIdGroup object.""" + """Return a `str` version of this TemplateAccountSettings object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ServiceIdGroup') -> bool: + def __eq__(self, other: 'TemplateAccountSettings') -> 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: 'ServiceIdGroup') -> bool: + def __ne__(self, other: 'TemplateAccountSettings') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - -class ServiceIdGroupList: - """ - ServiceIdGroupList. - - :param List[ServiceIdGroup] serviceid_groups: List of Service ID groups based on - the query parameter. - """ - - def __init__( - self, - serviceid_groups: List['ServiceIdGroup'], - ) -> None: + class RestrictCreateServiceIdEnum(str, Enum): """ - Initialize a ServiceIdGroupList object. - - :param List[ServiceIdGroup] serviceid_groups: List of Service ID groups - based on the query parameter. + Defines whether or not creating the resource is access controlled. Valid values: + * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM + Identity Service can create service IDs, including the account owner + * NOT_RESTRICTED - all members of an account can create service IDs + * NOT_SET - to 'unset' a previous set value. """ - self.serviceid_groups = serviceid_groups - @classmethod - def from_dict(cls, _dict: Dict) -> 'ServiceIdGroupList': - """Initialize a ServiceIdGroupList object from a json dictionary.""" - args = {} - if (serviceid_groups := _dict.get('serviceid_groups')) is not None: - args['serviceid_groups'] = [ServiceIdGroup.from_dict(v) for v in serviceid_groups] - else: - raise ValueError('Required property \'serviceid_groups\' not present in ServiceIdGroupList JSON') - return cls(**args) + RESTRICTED = 'RESTRICTED' + NOT_RESTRICTED = 'NOT_RESTRICTED' + NOT_SET = 'NOT_SET' - @classmethod - def _from_dict(cls, _dict): - """Initialize a ServiceIdGroupList object from a json dictionary.""" - return cls.from_dict(_dict) + class RestrictCreatePlatformApikeyEnum(str, Enum): + """ + Defines whether or not creating the resource is access controlled. Valid values: + * RESTRICTED - only users assigned the 'Service ID creator' role on the IAM + Identity Service can create service IDs, including the account owner + * NOT_RESTRICTED - all members of an account can create service IDs + * NOT_SET - to 'unset' a previous set value. + """ - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'serviceid_groups') and self.serviceid_groups is not None: - serviceid_groups_list = [] - for v in self.serviceid_groups: - if isinstance(v, dict): - serviceid_groups_list.append(v) - else: - serviceid_groups_list.append(v.to_dict()) - _dict['serviceid_groups'] = serviceid_groups_list - return _dict + RESTRICTED = 'RESTRICTED' + NOT_RESTRICTED = 'NOT_RESTRICTED' + NOT_SET = 'NOT_SET' - def _to_dict(self): - """Return a json dictionary representing this model.""" - return self.to_dict() + class MfaEnum(str, Enum): + """ + MFA trait definitions as follows: + * NONE - No MFA trait set + * NONE_NO_ROPC- No MFA, disable CLI logins with only a password + * TOTP - For all non-federated IBMId users + * TOTP4ALL - For all users + * LEVEL1 - Email-based MFA for all users + * LEVEL2 - TOTP-based MFA for all users + * LEVEL3 - U2F MFA for all users. + """ - def __str__(self) -> str: - """Return a `str` version of this ServiceIdGroupList object.""" - return json.dumps(self.to_dict(), indent=2) + NONE = 'NONE' + NONE_NO_ROPC = 'NONE_NO_ROPC' + TOTP = 'TOTP' + TOTP4ALL = 'TOTP4ALL' + LEVEL1 = 'LEVEL1' + LEVEL2 = 'LEVEL2' + LEVEL3 = 'LEVEL3' - def __eq__(self, other: 'ServiceIdGroupList') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + class RestrictUserListVisibilityEnum(str, Enum): + """ + Defines whether or not user visibility is access controlled. Valid values: + * RESTRICTED - users can view only specific types of users in the account, such + as those the user has invited to the account, or descendants of those users based + on the classic infrastructure hierarchy + * NOT_RESTRICTED - any user in the account can view other users from the Users + page in IBM Cloud console + * NOT_SET - to 'unset' a previous set value. + """ - def __ne__(self, other: 'ServiceIdGroupList') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other + RESTRICTED = 'RESTRICTED' + NOT_RESTRICTED = 'NOT_RESTRICTED' + NOT_SET = 'NOT_SET' -class ServiceIdList: +class TemplateAccountSettingsRestrictUserDomains: """ - Response body format for the list service ID V1 REST request. + TemplateAccountSettingsRestrictUserDomains. - :param ResponseContext context: (optional) Context with key properties for - problem determination. - :param int offset: (optional) The offset of the current page. - :param int limit: (optional) Optional size of a single page. Default is 20 items - per page. Valid range is 1 to 100. - :param str first: (optional) Link to the first page. - :param str previous: (optional) Link to the previous available page. If - 'previous' property is not part of the response no previous page is available. - :param str next: (optional) Link to the next available page. If 'next' property - is not part of the response no next page is available. - :param List[ServiceId] serviceids: List of service IDs based on the query - paramters and the page size. The service IDs array is always part of the - response but might be empty depending on the query parameter values provided. + :param bool account_sufficient: (optional) + :param List[AccountSettingsUserDomainRestriction] restrictions: (optional) + Defines if account invitations are restricted to specified domains. To remove an + entry for a realm_id, perform an update (PUT) request with only the realm_id + set. """ def __init__( self, - serviceids: List['ServiceId'], *, - context: Optional['ResponseContext'] = None, - offset: Optional[int] = None, - limit: Optional[int] = None, - first: Optional[str] = None, - previous: Optional[str] = None, - next: Optional[str] = None, + account_sufficient: Optional[bool] = None, + restrictions: Optional[List['AccountSettingsUserDomainRestriction']] = None, ) -> None: """ - Initialize a ServiceIdList object. + Initialize a TemplateAccountSettingsRestrictUserDomains object. - :param List[ServiceId] serviceids: List of service IDs based on the query - paramters and the page size. The service IDs array is always part of the - response but might be empty depending on the query parameter values - provided. - :param ResponseContext context: (optional) Context with key properties for - problem determination. - :param int offset: (optional) The offset of the current page. - :param int limit: (optional) Optional size of a single page. Default is 20 - items per page. Valid range is 1 to 100. - :param str first: (optional) Link to the first page. - :param str previous: (optional) Link to the previous available page. If - 'previous' property is not part of the response no previous page is - available. - :param str next: (optional) Link to the next available page. If 'next' - property is not part of the response no next page is available. + :param bool account_sufficient: (optional) + :param List[AccountSettingsUserDomainRestriction] restrictions: (optional) + Defines if account invitations are restricted to specified domains. To + remove an entry for a realm_id, perform an update (PUT) request with only + the realm_id set. """ - self.context = context - self.offset = offset - self.limit = limit - self.first = first - self.previous = previous - self.next = next - self.serviceids = serviceids + self.account_sufficient = account_sufficient + self.restrictions = restrictions @classmethod - def from_dict(cls, _dict: Dict) -> 'ServiceIdList': - """Initialize a ServiceIdList object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'TemplateAccountSettingsRestrictUserDomains': + """Initialize a TemplateAccountSettingsRestrictUserDomains object from a json dictionary.""" args = {} - if (context := _dict.get('context')) is not None: - args['context'] = ResponseContext.from_dict(context) - if (offset := _dict.get('offset')) is not None: - args['offset'] = offset - if (limit := _dict.get('limit')) is not None: - args['limit'] = limit - if (first := _dict.get('first')) is not None: - args['first'] = first - if (previous := _dict.get('previous')) is not None: - args['previous'] = previous - if (next := _dict.get('next')) is not None: - args['next'] = next - if (serviceids := _dict.get('serviceids')) is not None: - args['serviceids'] = [ServiceId.from_dict(v) for v in serviceids] - else: - raise ValueError('Required property \'serviceids\' not present in ServiceIdList JSON') + if (account_sufficient := _dict.get('account_sufficient')) is not None: + args['account_sufficient'] = account_sufficient + if (restrictions := _dict.get('restrictions')) is not None: + args['restrictions'] = [AccountSettingsUserDomainRestriction.from_dict(v) for v in restrictions] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ServiceIdList object from a json dictionary.""" + """Initialize a TemplateAccountSettingsRestrictUserDomains 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, 'context') and self.context is not None: - if isinstance(self.context, dict): - _dict['context'] = self.context - else: - _dict['context'] = self.context.to_dict() - if hasattr(self, 'offset') and self.offset is not None: - _dict['offset'] = self.offset - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'first') and self.first is not None: - _dict['first'] = self.first - if hasattr(self, 'previous') and self.previous is not None: - _dict['previous'] = self.previous - if hasattr(self, 'next') and self.next is not None: - _dict['next'] = self.next - if hasattr(self, 'serviceids') and self.serviceids is not None: - serviceids_list = [] - for v in self.serviceids: + if hasattr(self, 'account_sufficient') and self.account_sufficient is not None: + _dict['account_sufficient'] = self.account_sufficient + if hasattr(self, 'restrictions') and self.restrictions is not None: + restrictions_list = [] + for v in self.restrictions: if isinstance(v, dict): - serviceids_list.append(v) + restrictions_list.append(v) else: - serviceids_list.append(v.to_dict()) - _dict['serviceids'] = serviceids_list + restrictions_list.append(v.to_dict()) + _dict['restrictions'] = restrictions_list return _dict def _to_dict(self): @@ -11935,16 +12143,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ServiceIdList object.""" + """Return a `str` version of this TemplateAccountSettingsRestrictUserDomains object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ServiceIdList') -> bool: + def __eq__(self, other: 'TemplateAccountSettingsRestrictUserDomains') -> 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: 'ServiceIdList') -> bool: + def __ne__(self, other: 'TemplateAccountSettingsRestrictUserDomains') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other diff --git a/test/integration/test_iam_identity_v1.py b/test/integration/test_iam_identity_v1.py index 6804638..bfdcbab 100644 --- a/test/integration/test_iam_identity_v1.py +++ b/test/integration/test_iam_identity_v1.py @@ -295,7 +295,7 @@ def waitUntilTrustedProfileAssignmentFinished(cls, service, assignmentId): profile_template_assignment_etag is not None break except ApiException as e: - if e.code == 404: + if getattr(e, "status_code", None) == 404: finished = True break time.sleep(10) @@ -315,7 +315,7 @@ def waitUntilAccountSettingsAssignmentFinished(cls, service, assignmentId): account_settings_template_assignment_etag is not None break except ApiException as e: - if e.code == 404: + if getattr(e, "status_code", None) == 404: finished = True break time.sleep(10) @@ -1204,22 +1204,22 @@ def test_create_profile_bad_request(self): self.iam_identity_service.create_profile( name=self.profile_name1, description='PythonSDK test profile #1', account_id='invalid' ) - assert e.value.code == 400 + assert e.value.status_code == 400 def test_get_profile_not_found(self): with pytest.raises(ApiException) as e: self.iam_identity_service.get_profile(profile_id='invalid') - assert e.value.code == 404 + assert e.value.status_code == 404 def test_update_profile_not_found(self): with pytest.raises(ApiException) as e: self.iam_identity_service.update_profile(profile_id='invalid', if_match='invalid', description='invalid') - assert e.value.code == 404 + assert e.value.status_code == 404 def test_delete_profile_not_found(self): with pytest.raises(ApiException) as e: self.iam_identity_service.delete_profile(profile_id='invalid') - assert e.value.code == 404 + assert e.value.status_code == 404 def test_create_claimRule_bad_request(self): profile_claim_rule_conditions_model = {} @@ -1234,12 +1234,12 @@ def test_create_claimRule_bad_request(self): expiration=43200, conditions=[profile_claim_rule_conditions_model], ) - assert e.value.code == 404 + assert e.value.status_code == 404 def test_get_claimRule_not_found(self): with pytest.raises(ApiException) as e: self.iam_identity_service.get_claim_rule(profile_id='invalid', rule_id='invalid') - assert e.value.code == 404 + assert e.value.status_code == 404 def test_update_claimRule_not_found(self): profile_claim_rule_conditions_model = {} @@ -1256,12 +1256,12 @@ def test_update_claimRule_not_found(self): type=self.claimRule_type, realm_name=self.realm_name, ) - assert e.value.code == 404 + assert e.value.status_code == 404 def test_delete_claimRule_not_found(self): with pytest.raises(ApiException) as e: self.iam_identity_service.delete_claim_rule(profile_id='invalid', rule_id='invalid') - assert e.value.code == 404 + assert e.value.status_code == 404 def test_create_link_bad_request(self): CreateProfileLinkRequestLink = {} @@ -1274,17 +1274,17 @@ def test_create_link_bad_request(self): self.iam_identity_service.create_link( profile_id='invalid', name='nice link', cr_type='ROKS_SA', link=CreateProfileLinkRequestLink ) - assert e.value.code == 404 + assert e.value.status_code == 404 def test_get_link_not_found(self): with pytest.raises(ApiException) as e: self.iam_identity_service.get_link(profile_id='invalid', link_id='invalid') - assert e.value.code == 404 + assert e.value.status_code == 404 def test_delete_link_not_found(self): with pytest.raises(ApiException) as e: self.iam_identity_service.delete_link(profile_id='invalid', link_id='invalid') - assert e.value.code == 404 + assert e.value.status_code == 404 @needscredentials def test_get_account_settings(self): @@ -1376,10 +1376,10 @@ def test_get_effective_account_settings(self): assert get_effective_account_settings_response.get_status_code() == 200 settings = get_effective_account_settings_response.get_result() assert settings is not None + print('\neffective_settings() response: ', json.dumps(settings, indent=2)) - assert settings["account_id"] == self.account_id - assert settings["effective"] is not None - assert settings["account"] is not None + assert settings.get("effective") is not None + assert settings.get("account") is not None @needscredentials def test_create_report(self): @@ -1441,7 +1441,7 @@ def test_get_inactivity_report_notfound(self): account_id=self.account_id, reference='test123', ) - assert e.value.code == 404 + assert e.value.status_code == 404 @needscredentials def test_create_mfa_report(self): @@ -1489,7 +1489,7 @@ def test_get_mfa_report_notfound(self): account_id=self.account_id, reference='test123', ) - assert e.value.code == 404 + assert e.value.status_code == 404 @needscredentials def test_get_mfa_status(self): @@ -1764,15 +1764,42 @@ def test_delete_profile_template(self): @needscredentials def test_create_account_settings_template(self): - account_settings = {} - account_settings['mfa'] = 'LEVEL1' - account_settings['system_access_token_expiration_in_seconds'] = 3000 + # Construct a dict representation of a UserMfa model + user_mfa_model = { + 'iam_id': self.iam_id, + 'mfa': 'LEVEL1', + } + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = { + 'realm_id': 'IBMid', + 'invitation_email_allow_patterns': ["*.*@ibm.com"], + 'restrict_invitation': True, + } + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = { + 'account_sufficient': True, + 'restrictions': [account_settings_user_domain_restriction_model], + } + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = { + 'restrict_create_service_id': 'NOT_SET', + 'restrict_create_platform_apikey': 'NOT_SET', + 'mfa': 'LEVEL1', + 'user_mfa': [user_mfa_model], + 'session_expiration_in_seconds': '86400', + 'session_invalidation_in_seconds': '7200', + 'max_sessions_per_identity': '10', + 'system_access_token_expiration_in_seconds': '3600', + 'system_refresh_token_expiration_in_seconds': '259200', + 'restrict_user_list_visibility': 'RESTRICTED', + 'restrict_user_domains': template_account_settings_restrict_user_domains_model, + } create_response = self.iam_identity_service.create_account_settings_template( name=self.account_settings_template_name, description='Python SDK test Account Settings Template', account_id=self.enterprise_account_id, - account_settings=account_settings, + account_settings=template_account_settings_model, ) assert create_response.get_status_code() == 201 @@ -1825,26 +1852,53 @@ def test_update_account_settings_template(self): assert account_settings_template_version is not None assert account_settings_template_etag is not None - account_settings = {} - account_settings['mfa'] = 'LEVEL1' - account_settings['system_access_token_expiration_in_seconds'] = 3000 - - update_response = self.iam_identity_service.update_account_settings_template_version( - account_id=self.enterprise_account_id, + # Construct a dict representation of a UserMfa model + user_mfa_model = { + 'iam_id': self.iam_id, + 'mfa': 'NONE', + } + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = { + 'realm_id': 'IBMid', + 'invitation_email_allow_patterns': ["*.*@sap.com"], + 'restrict_invitation': False, + } + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = { + 'account_sufficient': False, + 'restrictions': [account_settings_user_domain_restriction_model], + } + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = { + 'restrict_create_service_id': 'NOT_SET', + 'restrict_create_platform_apikey': 'NOT_SET', + 'mfa': 'NONE', + 'user_mfa': [user_mfa_model], + 'session_expiration_in_seconds': '86400', + 'session_invalidation_in_seconds': '7200', + 'max_sessions_per_identity': '6', + 'system_access_token_expiration_in_seconds': '3600', + 'system_refresh_token_expiration_in_seconds': '259200', + 'restrict_user_list_visibility': 'RESTRICTED', + 'restrict_user_domains': template_account_settings_restrict_user_domains_model, + } + + response = self.iam_identity_service.update_account_settings_template_version( + if_match=account_settings_template_etag, template_id=account_settings_template_id, version=str(account_settings_template_version), - if_match=account_settings_template_etag, + account_id=self.enterprise_account_id, name=self.account_settings_template_name, description='Python SDK test Account Settings Template - updated', - account_settings=account_settings, + account_settings=template_account_settings_model, ) - assert update_response.get_status_code() == 200 - account_settings_template = update_response.get_result() + assert response.get_status_code() == 200 + account_settings_template = response.get_result() assert account_settings_template is not None print('\nupdate_account_settings_template() response: ', json.dumps(account_settings_template, indent=2)) - account_settings_template_etag = update_response.get_headers()['Etag'] + account_settings_template_etag = response.get_headers()['Etag'] assert account_settings_template_etag is not None @needscredentials @@ -1888,18 +1942,43 @@ def test_list_account_settings_template_assignments(self): def test_create_new_account_settings_template_version(self): assert account_settings_template_id is not None - account_settings = {} - account_settings['mfa'] = 'LEVEL1' - account_settings['system_access_token_expiration_in_seconds'] = 2600 - account_settings['restrict_create_platform_apikey'] = 'RESTRICTED' - account_settings['restrict_create_service_id'] = 'RESTRICTED' + # Construct a dict representation of a UserMfa model + user_mfa_model = { + 'iam_id': self.iam_id, + 'mfa': 'NONE', + } + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = { + 'realm_id': 'IBMid', + 'invitation_email_allow_patterns': ["*.*@ibm.com"], + 'restrict_invitation': True, + } + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = { + 'account_sufficient': False, + 'restrictions': [account_settings_user_domain_restriction_model], + } + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = { + 'restrict_create_service_id': 'NOT_RESTRICTED', + 'restrict_create_platform_apikey': 'NOT_RESTRICTED', + 'mfa': 'TOTP', + 'user_mfa': [user_mfa_model], + 'session_expiration_in_seconds': '72000', + 'session_invalidation_in_seconds': '7200', + 'max_sessions_per_identity': '3', + 'system_access_token_expiration_in_seconds': '3600', + 'system_refresh_token_expiration_in_seconds': '25200', + 'restrict_user_list_visibility': 'NOT_RESTRICTED', + 'restrict_user_domains': template_account_settings_restrict_user_domains_model, + } create_response = self.iam_identity_service.create_account_settings_template_version( template_id=account_settings_template_id, name=self.account_settings_template_name, description='Python SDK test Account Settings Template - new version', account_id=self.enterprise_account_id, - account_settings=account_settings, + account_settings=template_account_settings_model, ) assert create_response.get_status_code() == 201 diff --git a/test/unit/test_iam_identity_v1.py b/test/unit/test_iam_identity_v1.py index 5ad2927..5978dd1 100644 --- a/test/unit/test_iam_identity_v1.py +++ b/test/unit/test_iam_identity_v1.py @@ -4783,7 +4783,7 @@ def test_get_account_settings_all_params(self): """ # Set up mock url = preprocess_url('/v1/accounts/testString/settings/identity') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "NOT_RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}' responses.add( responses.GET, url, @@ -4830,7 +4830,7 @@ def test_get_account_settings_required_params(self): """ # Set up mock url = preprocess_url('/v1/accounts/testString/settings/identity') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "NOT_RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}' responses.add( responses.GET, url, @@ -4868,7 +4868,7 @@ def test_get_account_settings_value_error(self): """ # Set up mock url = preprocess_url('/v1/accounts/testString/settings/identity') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "NOT_RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}' responses.add( responses.GET, url, @@ -4911,7 +4911,7 @@ def test_update_account_settings_all_params(self): """ # Set up mock url = preprocess_url('/v1/accounts/testString/settings/identity') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "NOT_RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}' responses.add( responses.PUT, url, @@ -4920,32 +4920,32 @@ def test_update_account_settings_all_params(self): status=200, ) + # Construct a dict representation of a UserMfa model + user_mfa_model = {} + user_mfa_model['iam_id'] = 'testString' + user_mfa_model['mfa'] = 'NONE' + # Construct a dict representation of a AccountSettingsUserDomainRestriction model account_settings_user_domain_restriction_model = {} account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] account_settings_user_domain_restriction_model['restrict_invitation'] = True - # Construct a dict representation of a UserMfa model - user_mfa_model = {} - user_mfa_model['iam_id'] = 'testString' - user_mfa_model['mfa'] = 'NONE' - # Set up parameter values if_match = 'testString' account_id = 'testString' restrict_create_service_id = 'NOT_SET' restrict_create_platform_apikey = 'NOT_SET' - restrict_user_list_visibility = 'NOT_RESTRICTED' - restrict_user_domains = [account_settings_user_domain_restriction_model] allowed_ip_addresses = 'testString' mfa = 'NONE' + user_mfa = [user_mfa_model] session_expiration_in_seconds = '86400' session_invalidation_in_seconds = '7200' max_sessions_per_identity = 'testString' system_access_token_expiration_in_seconds = '3600' system_refresh_token_expiration_in_seconds = '259200' - user_mfa = [user_mfa_model] + restrict_user_list_visibility = 'NOT_RESTRICTED' + restrict_user_domains = [account_settings_user_domain_restriction_model] # Invoke method response = _service.update_account_settings( @@ -4953,16 +4953,16 @@ def test_update_account_settings_all_params(self): account_id, restrict_create_service_id=restrict_create_service_id, restrict_create_platform_apikey=restrict_create_platform_apikey, - restrict_user_list_visibility=restrict_user_list_visibility, - restrict_user_domains=restrict_user_domains, allowed_ip_addresses=allowed_ip_addresses, mfa=mfa, + user_mfa=user_mfa, session_expiration_in_seconds=session_expiration_in_seconds, session_invalidation_in_seconds=session_invalidation_in_seconds, max_sessions_per_identity=max_sessions_per_identity, system_access_token_expiration_in_seconds=system_access_token_expiration_in_seconds, system_refresh_token_expiration_in_seconds=system_refresh_token_expiration_in_seconds, - user_mfa=user_mfa, + restrict_user_list_visibility=restrict_user_list_visibility, + restrict_user_domains=restrict_user_domains, headers={}, ) @@ -4973,16 +4973,16 @@ def test_update_account_settings_all_params(self): req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) assert req_body['restrict_create_service_id'] == 'NOT_SET' assert req_body['restrict_create_platform_apikey'] == 'NOT_SET' - assert req_body['restrict_user_list_visibility'] == 'NOT_RESTRICTED' - assert req_body['restrict_user_domains'] == [account_settings_user_domain_restriction_model] assert req_body['allowed_ip_addresses'] == 'testString' assert req_body['mfa'] == 'NONE' + assert req_body['user_mfa'] == [user_mfa_model] assert req_body['session_expiration_in_seconds'] == '86400' assert req_body['session_invalidation_in_seconds'] == '7200' assert req_body['max_sessions_per_identity'] == 'testString' assert req_body['system_access_token_expiration_in_seconds'] == '3600' assert req_body['system_refresh_token_expiration_in_seconds'] == '259200' - assert req_body['user_mfa'] == [user_mfa_model] + assert req_body['restrict_user_list_visibility'] == 'NOT_RESTRICTED' + assert req_body['restrict_user_domains'] == [account_settings_user_domain_restriction_model] def test_update_account_settings_all_params_with_retries(self): # Enable retries and run test_update_account_settings_all_params. @@ -5000,7 +5000,7 @@ def test_update_account_settings_value_error(self): """ # Set up mock url = preprocess_url('/v1/accounts/testString/settings/identity') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "NOT_RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}' responses.add( responses.PUT, url, @@ -5009,32 +5009,32 @@ def test_update_account_settings_value_error(self): status=200, ) + # Construct a dict representation of a UserMfa model + user_mfa_model = {} + user_mfa_model['iam_id'] = 'testString' + user_mfa_model['mfa'] = 'NONE' + # Construct a dict representation of a AccountSettingsUserDomainRestriction model account_settings_user_domain_restriction_model = {} account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] account_settings_user_domain_restriction_model['restrict_invitation'] = True - # Construct a dict representation of a UserMfa model - user_mfa_model = {} - user_mfa_model['iam_id'] = 'testString' - user_mfa_model['mfa'] = 'NONE' - # Set up parameter values if_match = 'testString' account_id = 'testString' restrict_create_service_id = 'NOT_SET' restrict_create_platform_apikey = 'NOT_SET' - restrict_user_list_visibility = 'NOT_RESTRICTED' - restrict_user_domains = [account_settings_user_domain_restriction_model] allowed_ip_addresses = 'testString' mfa = 'NONE' + user_mfa = [user_mfa_model] session_expiration_in_seconds = '86400' session_invalidation_in_seconds = '7200' max_sessions_per_identity = 'testString' system_access_token_expiration_in_seconds = '3600' system_refresh_token_expiration_in_seconds = '259200' - user_mfa = [user_mfa_model] + restrict_user_list_visibility = 'NOT_RESTRICTED' + restrict_user_domains = [account_settings_user_domain_restriction_model] # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -5068,7 +5068,7 @@ def test_get_effective_account_settings_all_params(self): """ # Set up mock url = preprocess_url('/v1/accounts/testString/effective_settings/identity') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "effective": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "account": {"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}, "assigned_templates": [{"template_id": "template_id", "template_version": 16, "template_name": "template_name", "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "effective": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "account": {"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "NOT_RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}, "assigned_templates": [{"template_id": "template_id", "template_version": 16, "template_name": "template_name", "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}]}' responses.add( responses.GET, url, @@ -5115,7 +5115,7 @@ def test_get_effective_account_settings_required_params(self): """ # Set up mock url = preprocess_url('/v1/accounts/testString/effective_settings/identity') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "effective": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "account": {"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}, "assigned_templates": [{"template_id": "template_id", "template_version": 16, "template_name": "template_name", "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "effective": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "account": {"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "NOT_RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}, "assigned_templates": [{"template_id": "template_id", "template_version": 16, "template_name": "template_name", "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}]}' responses.add( responses.GET, url, @@ -5153,7 +5153,7 @@ def test_get_effective_account_settings_value_error(self): """ # Set up mock url = preprocess_url('/v1/accounts/testString/effective_settings/identity') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "effective": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "account": {"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}, "assigned_templates": [{"template_id": "template_id", "template_version": 16, "template_name": "template_name", "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}], "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}]}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "effective": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "restrict_user_list_visibility": "NOT_RESTRICTED", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "account": {"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "account_id": "account_id", "entity_tag": "entity_tag", "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "NOT_RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}, "assigned_templates": [{"template_id": "template_id", "template_version": 16, "template_name": "template_name", "restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE", "name": "name", "userName": "user_name", "email": "email", "description": "description"}], "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}]}' responses.add( responses.GET, url, @@ -7843,7 +7843,7 @@ def test_list_account_settings_templates_all_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' responses.add( responses.GET, url, @@ -7900,7 +7900,7 @@ def test_list_account_settings_templates_required_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' responses.add( responses.GET, url, @@ -7938,7 +7938,7 @@ def test_create_account_settings_template_all_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.POST, url, @@ -7952,24 +7952,39 @@ def test_create_account_settings_template_all_params(self): user_mfa_model['iam_id'] = 'testString' user_mfa_model['mfa'] = 'NONE' - # Construct a dict representation of a AccountSettingsComponent model - account_settings_component_model = {} - account_settings_component_model['restrict_create_service_id'] = 'NOT_SET' - account_settings_component_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_component_model['allowed_ip_addresses'] = 'testString' - account_settings_component_model['mfa'] = 'NONE' - account_settings_component_model['user_mfa'] = [user_mfa_model] - account_settings_component_model['session_expiration_in_seconds'] = '86400' - account_settings_component_model['session_invalidation_in_seconds'] = '7200' - account_settings_component_model['max_sessions_per_identity'] = 'testString' - account_settings_component_model['system_access_token_expiration_in_seconds'] = '3600' - account_settings_component_model['system_refresh_token_expiration_in_seconds'] = '259200' + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = {} + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = {} + template_account_settings_restrict_user_domains_model['account_sufficient'] = True + template_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = {} + template_account_settings_model['restrict_create_service_id'] = 'NOT_SET' + template_account_settings_model['restrict_create_platform_apikey'] = 'NOT_SET' + template_account_settings_model['allowed_ip_addresses'] = 'testString' + template_account_settings_model['mfa'] = 'NONE' + template_account_settings_model['user_mfa'] = [user_mfa_model] + template_account_settings_model['session_expiration_in_seconds'] = '86400' + template_account_settings_model['session_invalidation_in_seconds'] = '7200' + template_account_settings_model['max_sessions_per_identity'] = 'testString' + template_account_settings_model['system_access_token_expiration_in_seconds'] = '3600' + template_account_settings_model['system_refresh_token_expiration_in_seconds'] = '259200' + template_account_settings_model['restrict_user_list_visibility'] = 'RESTRICTED' + template_account_settings_model['restrict_user_domains'] = template_account_settings_restrict_user_domains_model # Set up parameter values account_id = 'testString' name = 'testString' description = 'testString' - account_settings = account_settings_component_model + account_settings = template_account_settings_model # Invoke method response = _service.create_account_settings_template( @@ -7988,7 +8003,7 @@ def test_create_account_settings_template_all_params(self): assert req_body['account_id'] == 'testString' assert req_body['name'] == 'testString' assert req_body['description'] == 'testString' - assert req_body['account_settings'] == account_settings_component_model + assert req_body['account_settings'] == template_account_settings_model def test_create_account_settings_template_all_params_with_retries(self): # Enable retries and run test_create_account_settings_template_all_params. @@ -8012,7 +8027,7 @@ def test_get_latest_account_settings_template_version_all_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.GET, url, @@ -8056,7 +8071,7 @@ def test_get_latest_account_settings_template_version_required_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.GET, url, @@ -8094,7 +8109,7 @@ def test_get_latest_account_settings_template_version_value_error(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.GET, url, @@ -8212,7 +8227,7 @@ def test_list_versions_of_account_settings_template_all_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' responses.add( responses.GET, url, @@ -8268,7 +8283,7 @@ def test_list_versions_of_account_settings_template_required_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' responses.add( responses.GET, url, @@ -8306,7 +8321,7 @@ def test_list_versions_of_account_settings_template_value_error(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions') - mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' + mock_response = '{"context": {"transaction_id": "transaction_id", "operation": "operation", "user_agent": "user_agent", "url": "url", "instance_id": "instance_id", "thread_id": "thread_id", "host": "host", "start_time": "start_time", "end_time": "end_time", "elapsed_time": "elapsed_time", "cluster_name": "cluster_name"}, "offset": 6, "limit": 20, "first": "first", "previous": "previous", "next": "next", "account_settings_templates": [{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}]}' responses.add( responses.GET, url, @@ -8349,7 +8364,7 @@ def test_create_account_settings_template_version_all_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.POST, url, @@ -8363,25 +8378,40 @@ def test_create_account_settings_template_version_all_params(self): user_mfa_model['iam_id'] = 'testString' user_mfa_model['mfa'] = 'NONE' - # Construct a dict representation of a AccountSettingsComponent model - account_settings_component_model = {} - account_settings_component_model['restrict_create_service_id'] = 'NOT_SET' - account_settings_component_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_component_model['allowed_ip_addresses'] = 'testString' - account_settings_component_model['mfa'] = 'NONE' - account_settings_component_model['user_mfa'] = [user_mfa_model] - account_settings_component_model['session_expiration_in_seconds'] = '86400' - account_settings_component_model['session_invalidation_in_seconds'] = '7200' - account_settings_component_model['max_sessions_per_identity'] = 'testString' - account_settings_component_model['system_access_token_expiration_in_seconds'] = '3600' - account_settings_component_model['system_refresh_token_expiration_in_seconds'] = '259200' + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = {} + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = {} + template_account_settings_restrict_user_domains_model['account_sufficient'] = True + template_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = {} + template_account_settings_model['restrict_create_service_id'] = 'NOT_SET' + template_account_settings_model['restrict_create_platform_apikey'] = 'NOT_SET' + template_account_settings_model['allowed_ip_addresses'] = 'testString' + template_account_settings_model['mfa'] = 'NONE' + template_account_settings_model['user_mfa'] = [user_mfa_model] + template_account_settings_model['session_expiration_in_seconds'] = '86400' + template_account_settings_model['session_invalidation_in_seconds'] = '7200' + template_account_settings_model['max_sessions_per_identity'] = 'testString' + template_account_settings_model['system_access_token_expiration_in_seconds'] = '3600' + template_account_settings_model['system_refresh_token_expiration_in_seconds'] = '259200' + template_account_settings_model['restrict_user_list_visibility'] = 'RESTRICTED' + template_account_settings_model['restrict_user_domains'] = template_account_settings_restrict_user_domains_model # Set up parameter values template_id = 'testString' account_id = 'testString' name = 'testString' description = 'testString' - account_settings = account_settings_component_model + account_settings = template_account_settings_model # Invoke method response = _service.create_account_settings_template_version( @@ -8401,7 +8431,7 @@ def test_create_account_settings_template_version_all_params(self): assert req_body['account_id'] == 'testString' assert req_body['name'] == 'testString' assert req_body['description'] == 'testString' - assert req_body['account_settings'] == account_settings_component_model + assert req_body['account_settings'] == template_account_settings_model def test_create_account_settings_template_version_all_params_with_retries(self): # Enable retries and run test_create_account_settings_template_version_all_params. @@ -8419,7 +8449,7 @@ def test_create_account_settings_template_version_value_error(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.POST, url, @@ -8433,25 +8463,40 @@ def test_create_account_settings_template_version_value_error(self): user_mfa_model['iam_id'] = 'testString' user_mfa_model['mfa'] = 'NONE' - # Construct a dict representation of a AccountSettingsComponent model - account_settings_component_model = {} - account_settings_component_model['restrict_create_service_id'] = 'NOT_SET' - account_settings_component_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_component_model['allowed_ip_addresses'] = 'testString' - account_settings_component_model['mfa'] = 'NONE' - account_settings_component_model['user_mfa'] = [user_mfa_model] - account_settings_component_model['session_expiration_in_seconds'] = '86400' - account_settings_component_model['session_invalidation_in_seconds'] = '7200' - account_settings_component_model['max_sessions_per_identity'] = 'testString' - account_settings_component_model['system_access_token_expiration_in_seconds'] = '3600' - account_settings_component_model['system_refresh_token_expiration_in_seconds'] = '259200' + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = {} + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = {} + template_account_settings_restrict_user_domains_model['account_sufficient'] = True + template_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = {} + template_account_settings_model['restrict_create_service_id'] = 'NOT_SET' + template_account_settings_model['restrict_create_platform_apikey'] = 'NOT_SET' + template_account_settings_model['allowed_ip_addresses'] = 'testString' + template_account_settings_model['mfa'] = 'NONE' + template_account_settings_model['user_mfa'] = [user_mfa_model] + template_account_settings_model['session_expiration_in_seconds'] = '86400' + template_account_settings_model['session_invalidation_in_seconds'] = '7200' + template_account_settings_model['max_sessions_per_identity'] = 'testString' + template_account_settings_model['system_access_token_expiration_in_seconds'] = '3600' + template_account_settings_model['system_refresh_token_expiration_in_seconds'] = '259200' + template_account_settings_model['restrict_user_list_visibility'] = 'RESTRICTED' + template_account_settings_model['restrict_user_domains'] = template_account_settings_restrict_user_domains_model # Set up parameter values template_id = 'testString' account_id = 'testString' name = 'testString' description = 'testString' - account_settings = account_settings_component_model + account_settings = template_account_settings_model # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -8484,7 +8529,7 @@ def test_get_account_settings_template_version_all_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions/testString') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.GET, url, @@ -8530,7 +8575,7 @@ def test_get_account_settings_template_version_required_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions/testString') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.GET, url, @@ -8570,7 +8615,7 @@ def test_get_account_settings_template_version_value_error(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions/testString') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.GET, url, @@ -8615,7 +8660,7 @@ def test_update_account_settings_template_version_all_params(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions/testString') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.PUT, url, @@ -8629,18 +8674,33 @@ def test_update_account_settings_template_version_all_params(self): user_mfa_model['iam_id'] = 'testString' user_mfa_model['mfa'] = 'NONE' - # Construct a dict representation of a AccountSettingsComponent model - account_settings_component_model = {} - account_settings_component_model['restrict_create_service_id'] = 'NOT_SET' - account_settings_component_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_component_model['allowed_ip_addresses'] = 'testString' - account_settings_component_model['mfa'] = 'NONE' - account_settings_component_model['user_mfa'] = [user_mfa_model] - account_settings_component_model['session_expiration_in_seconds'] = '86400' - account_settings_component_model['session_invalidation_in_seconds'] = '7200' - account_settings_component_model['max_sessions_per_identity'] = 'testString' - account_settings_component_model['system_access_token_expiration_in_seconds'] = '3600' - account_settings_component_model['system_refresh_token_expiration_in_seconds'] = '259200' + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = {} + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = {} + template_account_settings_restrict_user_domains_model['account_sufficient'] = True + template_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = {} + template_account_settings_model['restrict_create_service_id'] = 'NOT_SET' + template_account_settings_model['restrict_create_platform_apikey'] = 'NOT_SET' + template_account_settings_model['allowed_ip_addresses'] = 'testString' + template_account_settings_model['mfa'] = 'NONE' + template_account_settings_model['user_mfa'] = [user_mfa_model] + template_account_settings_model['session_expiration_in_seconds'] = '86400' + template_account_settings_model['session_invalidation_in_seconds'] = '7200' + template_account_settings_model['max_sessions_per_identity'] = 'testString' + template_account_settings_model['system_access_token_expiration_in_seconds'] = '3600' + template_account_settings_model['system_refresh_token_expiration_in_seconds'] = '259200' + template_account_settings_model['restrict_user_list_visibility'] = 'RESTRICTED' + template_account_settings_model['restrict_user_domains'] = template_account_settings_restrict_user_domains_model # Set up parameter values if_match = 'testString' @@ -8649,7 +8709,7 @@ def test_update_account_settings_template_version_all_params(self): account_id = 'testString' name = 'testString' description = 'testString' - account_settings = account_settings_component_model + account_settings = template_account_settings_model # Invoke method response = _service.update_account_settings_template_version( @@ -8671,7 +8731,7 @@ def test_update_account_settings_template_version_all_params(self): assert req_body['account_id'] == 'testString' assert req_body['name'] == 'testString' assert req_body['description'] == 'testString' - assert req_body['account_settings'] == account_settings_component_model + assert req_body['account_settings'] == template_account_settings_model def test_update_account_settings_template_version_all_params_with_retries(self): # Enable retries and run test_update_account_settings_template_version_all_params. @@ -8689,7 +8749,7 @@ def test_update_account_settings_template_version_value_error(self): """ # Set up mock url = preprocess_url('/v1/account_settings_templates/testString/versions/testString') - mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200"}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' + mock_response = '{"id": "id", "version": 7, "account_id": "account_id", "name": "name", "description": "description", "committed": false, "account_settings": {"restrict_create_service_id": "NOT_SET", "restrict_create_platform_apikey": "NOT_SET", "allowed_ip_addresses": "allowed_ip_addresses", "mfa": "NONE", "user_mfa": [{"iam_id": "iam_id", "mfa": "NONE"}], "session_expiration_in_seconds": "86400", "session_invalidation_in_seconds": "7200", "max_sessions_per_identity": "max_sessions_per_identity", "system_access_token_expiration_in_seconds": "3600", "system_refresh_token_expiration_in_seconds": "259200", "restrict_user_list_visibility": "RESTRICTED", "restrict_user_domains": {"account_sufficient": true, "restrictions": [{"realm_id": "IBMid", "invitation_email_allow_patterns": ["invitation_email_allow_patterns"], "restrict_invitation": false}]}}, "history": [{"timestamp": "timestamp", "iam_id": "iam_id", "iam_id_account": "iam_id_account", "action": "action", "params": ["params"], "message": "message"}], "entity_tag": "entity_tag", "crn": "crn", "created_at": "created_at", "created_by_id": "created_by_id", "last_modified_at": "last_modified_at", "last_modified_by_id": "last_modified_by_id"}' responses.add( responses.PUT, url, @@ -8703,18 +8763,33 @@ def test_update_account_settings_template_version_value_error(self): user_mfa_model['iam_id'] = 'testString' user_mfa_model['mfa'] = 'NONE' - # Construct a dict representation of a AccountSettingsComponent model - account_settings_component_model = {} - account_settings_component_model['restrict_create_service_id'] = 'NOT_SET' - account_settings_component_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_component_model['allowed_ip_addresses'] = 'testString' - account_settings_component_model['mfa'] = 'NONE' - account_settings_component_model['user_mfa'] = [user_mfa_model] - account_settings_component_model['session_expiration_in_seconds'] = '86400' - account_settings_component_model['session_invalidation_in_seconds'] = '7200' - account_settings_component_model['max_sessions_per_identity'] = 'testString' - account_settings_component_model['system_access_token_expiration_in_seconds'] = '3600' - account_settings_component_model['system_refresh_token_expiration_in_seconds'] = '259200' + # Construct a dict representation of a AccountSettingsUserDomainRestriction model + account_settings_user_domain_restriction_model = {} + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + # Construct a dict representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model = {} + template_account_settings_restrict_user_domains_model['account_sufficient'] = True + template_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + # Construct a dict representation of a TemplateAccountSettings model + template_account_settings_model = {} + template_account_settings_model['restrict_create_service_id'] = 'NOT_SET' + template_account_settings_model['restrict_create_platform_apikey'] = 'NOT_SET' + template_account_settings_model['allowed_ip_addresses'] = 'testString' + template_account_settings_model['mfa'] = 'NONE' + template_account_settings_model['user_mfa'] = [user_mfa_model] + template_account_settings_model['session_expiration_in_seconds'] = '86400' + template_account_settings_model['session_invalidation_in_seconds'] = '7200' + template_account_settings_model['max_sessions_per_identity'] = 'testString' + template_account_settings_model['system_access_token_expiration_in_seconds'] = '3600' + template_account_settings_model['system_refresh_token_expiration_in_seconds'] = '259200' + template_account_settings_model['restrict_user_list_visibility'] = 'RESTRICTED' + template_account_settings_model['restrict_user_domains'] = template_account_settings_restrict_user_domains_model # Set up parameter values if_match = 'testString' @@ -8723,7 +8798,7 @@ def test_update_account_settings_template_version_value_error(self): account_id = 'testString' name = 'testString' description = 'testString' - account_settings = account_settings_component_model + account_settings = template_account_settings_model # Pass in all but one required param and check for a ValueError req_param_dict = { @@ -9514,11 +9589,6 @@ def test_account_settings_assigned_templates_section_serialization(self): # Construct dict forms of any model objects needed in order to build this model. - account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction - account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' - account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] - account_settings_user_domain_restriction_model['restrict_invitation'] = True - account_settings_user_mfa_response_model = {} # AccountSettingsUserMFAResponse account_settings_user_mfa_response_model['iam_id'] = 'testString' account_settings_user_mfa_response_model['mfa'] = 'NONE' @@ -9527,6 +9597,19 @@ def test_account_settings_assigned_templates_section_serialization(self): account_settings_user_mfa_response_model['email'] = 'testString' account_settings_user_mfa_response_model['description'] = 'testString' + account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + assigned_templates_account_settings_restrict_user_domains_model = ( + {} + ) # AssignedTemplatesAccountSettingsRestrictUserDomains + assigned_templates_account_settings_restrict_user_domains_model['account_sufficient'] = True + assigned_templates_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + # Construct a json representation of a AccountSettingsAssignedTemplatesSection model account_settings_assigned_templates_section_model_json = {} account_settings_assigned_templates_section_model_json['template_id'] = 'testString' @@ -9534,10 +9617,6 @@ def test_account_settings_assigned_templates_section_serialization(self): account_settings_assigned_templates_section_model_json['template_name'] = 'testString' account_settings_assigned_templates_section_model_json['restrict_create_service_id'] = 'NOT_SET' account_settings_assigned_templates_section_model_json['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_assigned_templates_section_model_json['restrict_user_list_visibility'] = 'NOT_RESTRICTED' - account_settings_assigned_templates_section_model_json['restrict_user_domains'] = [ - account_settings_user_domain_restriction_model - ] account_settings_assigned_templates_section_model_json['allowed_ip_addresses'] = 'testString' account_settings_assigned_templates_section_model_json['mfa'] = 'NONE' account_settings_assigned_templates_section_model_json['session_expiration_in_seconds'] = '86400' @@ -9545,7 +9624,11 @@ def test_account_settings_assigned_templates_section_serialization(self): account_settings_assigned_templates_section_model_json['max_sessions_per_identity'] = 'testString' account_settings_assigned_templates_section_model_json['system_access_token_expiration_in_seconds'] = '3600' account_settings_assigned_templates_section_model_json['system_refresh_token_expiration_in_seconds'] = '259200' + account_settings_assigned_templates_section_model_json['restrict_user_list_visibility'] = 'RESTRICTED' account_settings_assigned_templates_section_model_json['user_mfa'] = [account_settings_user_mfa_response_model] + account_settings_assigned_templates_section_model_json['restrict_user_domains'] = ( + assigned_templates_account_settings_restrict_user_domains_model + ) # Construct a model instance of AccountSettingsAssignedTemplatesSection by calling from_dict on the json representation account_settings_assigned_templates_section_model = AccountSettingsAssignedTemplatesSection.from_dict( @@ -9574,53 +9657,6 @@ def test_account_settings_assigned_templates_section_serialization(self): ) -class TestModel_AccountSettingsComponent: - """ - Test Class for AccountSettingsComponent - """ - - def test_account_settings_component_serialization(self): - """ - Test serialization/deserialization for AccountSettingsComponent - """ - - # Construct dict forms of any model objects needed in order to build this model. - - user_mfa_model = {} # UserMfa - user_mfa_model['iam_id'] = 'testString' - user_mfa_model['mfa'] = 'NONE' - - # Construct a json representation of a AccountSettingsComponent model - account_settings_component_model_json = {} - account_settings_component_model_json['restrict_create_service_id'] = 'NOT_SET' - account_settings_component_model_json['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_component_model_json['allowed_ip_addresses'] = 'testString' - account_settings_component_model_json['mfa'] = 'NONE' - account_settings_component_model_json['user_mfa'] = [user_mfa_model] - account_settings_component_model_json['session_expiration_in_seconds'] = '86400' - account_settings_component_model_json['session_invalidation_in_seconds'] = '7200' - account_settings_component_model_json['max_sessions_per_identity'] = 'testString' - account_settings_component_model_json['system_access_token_expiration_in_seconds'] = '3600' - account_settings_component_model_json['system_refresh_token_expiration_in_seconds'] = '259200' - - # Construct a model instance of AccountSettingsComponent by calling from_dict on the json representation - account_settings_component_model = AccountSettingsComponent.from_dict(account_settings_component_model_json) - assert account_settings_component_model != False - - # Construct a model instance of AccountSettingsComponent by calling from_dict on the json representation - account_settings_component_model_dict = AccountSettingsComponent.from_dict( - account_settings_component_model_json - ).__dict__ - account_settings_component_model2 = AccountSettingsComponent(**account_settings_component_model_dict) - - # Verify the model instances are equivalent - assert account_settings_component_model == account_settings_component_model2 - - # Convert model instance back to dict and verify no loss of data - account_settings_component_model_json2 = account_settings_component_model.to_dict() - assert account_settings_component_model_json2 == account_settings_component_model_json - - class TestModel_AccountSettingsEffectiveSection: """ Test Class for AccountSettingsEffectiveSection @@ -9710,11 +9746,6 @@ def test_account_settings_response_serialization(self): enity_history_record_model['params'] = ['testString'] enity_history_record_model['message'] = 'testString' - account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction - account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' - account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] - account_settings_user_domain_restriction_model['restrict_invitation'] = True - account_settings_user_mfa_response_model = {} # AccountSettingsUserMFAResponse account_settings_user_mfa_response_model['iam_id'] = 'testString' account_settings_user_mfa_response_model['mfa'] = 'NONE' @@ -9723,6 +9754,11 @@ def test_account_settings_response_serialization(self): account_settings_user_mfa_response_model['email'] = 'testString' account_settings_user_mfa_response_model['description'] = 'testString' + account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + # Construct a json representation of a AccountSettingsResponse model account_settings_response_model_json = {} account_settings_response_model_json['context'] = response_context_model @@ -9731,8 +9767,6 @@ def test_account_settings_response_serialization(self): account_settings_response_model_json['history'] = [enity_history_record_model] account_settings_response_model_json['restrict_create_service_id'] = 'NOT_SET' account_settings_response_model_json['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_response_model_json['restrict_user_list_visibility'] = 'NOT_RESTRICTED' - account_settings_response_model_json['restrict_user_domains'] = [account_settings_user_domain_restriction_model] account_settings_response_model_json['allowed_ip_addresses'] = 'testString' account_settings_response_model_json['mfa'] = 'NONE' account_settings_response_model_json['session_expiration_in_seconds'] = '86400' @@ -9740,7 +9774,9 @@ def test_account_settings_response_serialization(self): account_settings_response_model_json['max_sessions_per_identity'] = 'testString' account_settings_response_model_json['system_access_token_expiration_in_seconds'] = '3600' account_settings_response_model_json['system_refresh_token_expiration_in_seconds'] = '259200' + account_settings_response_model_json['restrict_user_list_visibility'] = 'NOT_RESTRICTED' account_settings_response_model_json['user_mfa'] = [account_settings_user_mfa_response_model] + account_settings_response_model_json['restrict_user_domains'] = [account_settings_user_domain_restriction_model] # Construct a model instance of AccountSettingsResponse by calling from_dict on the json representation account_settings_response_model = AccountSettingsResponse.from_dict(account_settings_response_model_json) @@ -9789,17 +9825,30 @@ def test_account_settings_template_list_serialization(self): user_mfa_model['iam_id'] = 'testString' user_mfa_model['mfa'] = 'NONE' - account_settings_component_model = {} # AccountSettingsComponent - account_settings_component_model['restrict_create_service_id'] = 'NOT_SET' - account_settings_component_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_component_model['allowed_ip_addresses'] = 'testString' - account_settings_component_model['mfa'] = 'NONE' - account_settings_component_model['user_mfa'] = [user_mfa_model] - account_settings_component_model['session_expiration_in_seconds'] = '86400' - account_settings_component_model['session_invalidation_in_seconds'] = '7200' - account_settings_component_model['max_sessions_per_identity'] = 'testString' - account_settings_component_model['system_access_token_expiration_in_seconds'] = '3600' - account_settings_component_model['system_refresh_token_expiration_in_seconds'] = '259200' + account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + template_account_settings_restrict_user_domains_model = {} # TemplateAccountSettingsRestrictUserDomains + template_account_settings_restrict_user_domains_model['account_sufficient'] = True + template_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + template_account_settings_model = {} # TemplateAccountSettings + template_account_settings_model['restrict_create_service_id'] = 'NOT_SET' + template_account_settings_model['restrict_create_platform_apikey'] = 'NOT_SET' + template_account_settings_model['allowed_ip_addresses'] = 'testString' + template_account_settings_model['mfa'] = 'NONE' + template_account_settings_model['user_mfa'] = [user_mfa_model] + template_account_settings_model['session_expiration_in_seconds'] = '86400' + template_account_settings_model['session_invalidation_in_seconds'] = '7200' + template_account_settings_model['max_sessions_per_identity'] = 'testString' + template_account_settings_model['system_access_token_expiration_in_seconds'] = '3600' + template_account_settings_model['system_refresh_token_expiration_in_seconds'] = '259200' + template_account_settings_model['restrict_user_list_visibility'] = 'RESTRICTED' + template_account_settings_model['restrict_user_domains'] = template_account_settings_restrict_user_domains_model enity_history_record_model = {} # EnityHistoryRecord enity_history_record_model['timestamp'] = 'testString' @@ -9816,7 +9865,7 @@ def test_account_settings_template_list_serialization(self): account_settings_template_response_model['name'] = 'testString' account_settings_template_response_model['description'] = 'testString' account_settings_template_response_model['committed'] = True - account_settings_template_response_model['account_settings'] = account_settings_component_model + account_settings_template_response_model['account_settings'] = template_account_settings_model account_settings_template_response_model['history'] = [enity_history_record_model] account_settings_template_response_model['entity_tag'] = 'testString' account_settings_template_response_model['crn'] = 'testString' @@ -9873,17 +9922,30 @@ def test_account_settings_template_response_serialization(self): user_mfa_model['iam_id'] = 'testString' user_mfa_model['mfa'] = 'NONE' - account_settings_component_model = {} # AccountSettingsComponent - account_settings_component_model['restrict_create_service_id'] = 'NOT_SET' - account_settings_component_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_component_model['allowed_ip_addresses'] = 'testString' - account_settings_component_model['mfa'] = 'NONE' - account_settings_component_model['user_mfa'] = [user_mfa_model] - account_settings_component_model['session_expiration_in_seconds'] = '86400' - account_settings_component_model['session_invalidation_in_seconds'] = '7200' - account_settings_component_model['max_sessions_per_identity'] = 'testString' - account_settings_component_model['system_access_token_expiration_in_seconds'] = '3600' - account_settings_component_model['system_refresh_token_expiration_in_seconds'] = '259200' + account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + template_account_settings_restrict_user_domains_model = {} # TemplateAccountSettingsRestrictUserDomains + template_account_settings_restrict_user_domains_model['account_sufficient'] = True + template_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + template_account_settings_model = {} # TemplateAccountSettings + template_account_settings_model['restrict_create_service_id'] = 'NOT_SET' + template_account_settings_model['restrict_create_platform_apikey'] = 'NOT_SET' + template_account_settings_model['allowed_ip_addresses'] = 'testString' + template_account_settings_model['mfa'] = 'NONE' + template_account_settings_model['user_mfa'] = [user_mfa_model] + template_account_settings_model['session_expiration_in_seconds'] = '86400' + template_account_settings_model['session_invalidation_in_seconds'] = '7200' + template_account_settings_model['max_sessions_per_identity'] = 'testString' + template_account_settings_model['system_access_token_expiration_in_seconds'] = '3600' + template_account_settings_model['system_refresh_token_expiration_in_seconds'] = '259200' + template_account_settings_model['restrict_user_list_visibility'] = 'RESTRICTED' + template_account_settings_model['restrict_user_domains'] = template_account_settings_restrict_user_domains_model enity_history_record_model = {} # EnityHistoryRecord enity_history_record_model['timestamp'] = 'testString' @@ -9901,7 +9963,7 @@ def test_account_settings_template_response_serialization(self): account_settings_template_response_model_json['name'] = 'testString' account_settings_template_response_model_json['description'] = 'testString' account_settings_template_response_model_json['committed'] = True - account_settings_template_response_model_json['account_settings'] = account_settings_component_model + account_settings_template_response_model_json['account_settings'] = template_account_settings_model account_settings_template_response_model_json['history'] = [enity_history_record_model] account_settings_template_response_model_json['entity_tag'] = 'testString' account_settings_template_response_model_json['crn'] = 'testString' @@ -10498,6 +10560,66 @@ def test_apikey_activity_user_serialization(self): assert apikey_activity_user_model_json2 == apikey_activity_user_model_json +class TestModel_AssignedTemplatesAccountSettingsRestrictUserDomains: + """ + Test Class for AssignedTemplatesAccountSettingsRestrictUserDomains + """ + + def test_assigned_templates_account_settings_restrict_user_domains_serialization(self): + """ + Test serialization/deserialization for AssignedTemplatesAccountSettingsRestrictUserDomains + """ + + # Construct dict forms of any model objects needed in order to build this model. + + account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + # Construct a json representation of a AssignedTemplatesAccountSettingsRestrictUserDomains model + assigned_templates_account_settings_restrict_user_domains_model_json = {} + assigned_templates_account_settings_restrict_user_domains_model_json['account_sufficient'] = True + assigned_templates_account_settings_restrict_user_domains_model_json['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + # Construct a model instance of AssignedTemplatesAccountSettingsRestrictUserDomains by calling from_dict on the json representation + assigned_templates_account_settings_restrict_user_domains_model = ( + AssignedTemplatesAccountSettingsRestrictUserDomains.from_dict( + assigned_templates_account_settings_restrict_user_domains_model_json + ) + ) + assert assigned_templates_account_settings_restrict_user_domains_model != False + + # Construct a model instance of AssignedTemplatesAccountSettingsRestrictUserDomains by calling from_dict on the json representation + assigned_templates_account_settings_restrict_user_domains_model_dict = ( + AssignedTemplatesAccountSettingsRestrictUserDomains.from_dict( + assigned_templates_account_settings_restrict_user_domains_model_json + ).__dict__ + ) + assigned_templates_account_settings_restrict_user_domains_model2 = ( + AssignedTemplatesAccountSettingsRestrictUserDomains( + **assigned_templates_account_settings_restrict_user_domains_model_dict + ) + ) + + # Verify the model instances are equivalent + assert ( + assigned_templates_account_settings_restrict_user_domains_model + == assigned_templates_account_settings_restrict_user_domains_model2 + ) + + # Convert model instance back to dict and verify no loss of data + assigned_templates_account_settings_restrict_user_domains_model_json2 = ( + assigned_templates_account_settings_restrict_user_domains_model.to_dict() + ) + assert ( + assigned_templates_account_settings_restrict_user_domains_model_json2 + == assigned_templates_account_settings_restrict_user_domains_model_json + ) + + class TestModel_CreateProfileLinkRequestLink: """ Test Class for CreateProfileLinkRequestLink @@ -10604,8 +10726,6 @@ def test_effective_account_settings_response_serialization(self): account_settings_response_model['history'] = [enity_history_record_model] account_settings_response_model['restrict_create_service_id'] = 'NOT_SET' account_settings_response_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_response_model['restrict_user_list_visibility'] = 'NOT_RESTRICTED' - account_settings_response_model['restrict_user_domains'] = [account_settings_user_domain_restriction_model] account_settings_response_model['allowed_ip_addresses'] = 'testString' account_settings_response_model['mfa'] = 'NONE' account_settings_response_model['session_expiration_in_seconds'] = '86400' @@ -10613,7 +10733,17 @@ def test_effective_account_settings_response_serialization(self): account_settings_response_model['max_sessions_per_identity'] = 'testString' account_settings_response_model['system_access_token_expiration_in_seconds'] = '3600' account_settings_response_model['system_refresh_token_expiration_in_seconds'] = '259200' + account_settings_response_model['restrict_user_list_visibility'] = 'NOT_RESTRICTED' account_settings_response_model['user_mfa'] = [account_settings_user_mfa_response_model] + account_settings_response_model['restrict_user_domains'] = [account_settings_user_domain_restriction_model] + + assigned_templates_account_settings_restrict_user_domains_model = ( + {} + ) # AssignedTemplatesAccountSettingsRestrictUserDomains + assigned_templates_account_settings_restrict_user_domains_model['account_sufficient'] = True + assigned_templates_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] account_settings_assigned_templates_section_model = {} # AccountSettingsAssignedTemplatesSection account_settings_assigned_templates_section_model['template_id'] = 'testString' @@ -10621,10 +10751,6 @@ def test_effective_account_settings_response_serialization(self): account_settings_assigned_templates_section_model['template_name'] = 'testString' account_settings_assigned_templates_section_model['restrict_create_service_id'] = 'NOT_SET' account_settings_assigned_templates_section_model['restrict_create_platform_apikey'] = 'NOT_SET' - account_settings_assigned_templates_section_model['restrict_user_list_visibility'] = 'NOT_RESTRICTED' - account_settings_assigned_templates_section_model['restrict_user_domains'] = [ - account_settings_user_domain_restriction_model - ] account_settings_assigned_templates_section_model['allowed_ip_addresses'] = 'testString' account_settings_assigned_templates_section_model['mfa'] = 'NONE' account_settings_assigned_templates_section_model['session_expiration_in_seconds'] = '86400' @@ -10632,7 +10758,11 @@ def test_effective_account_settings_response_serialization(self): account_settings_assigned_templates_section_model['max_sessions_per_identity'] = 'testString' account_settings_assigned_templates_section_model['system_access_token_expiration_in_seconds'] = '3600' account_settings_assigned_templates_section_model['system_refresh_token_expiration_in_seconds'] = '259200' + account_settings_assigned_templates_section_model['restrict_user_list_visibility'] = 'RESTRICTED' account_settings_assigned_templates_section_model['user_mfa'] = [account_settings_user_mfa_response_model] + account_settings_assigned_templates_section_model['restrict_user_domains'] = ( + assigned_templates_account_settings_restrict_user_domains_model + ) # Construct a json representation of a EffectiveAccountSettingsResponse model effective_account_settings_response_model_json = {} @@ -11923,6 +12053,124 @@ def test_service_id_list_serialization(self): assert service_id_list_model_json2 == service_id_list_model_json +class TestModel_TemplateAccountSettings: + """ + Test Class for TemplateAccountSettings + """ + + def test_template_account_settings_serialization(self): + """ + Test serialization/deserialization for TemplateAccountSettings + """ + + # Construct dict forms of any model objects needed in order to build this model. + + user_mfa_model = {} # UserMfa + user_mfa_model['iam_id'] = 'testString' + user_mfa_model['mfa'] = 'NONE' + + account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + template_account_settings_restrict_user_domains_model = {} # TemplateAccountSettingsRestrictUserDomains + template_account_settings_restrict_user_domains_model['account_sufficient'] = True + template_account_settings_restrict_user_domains_model['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + # Construct a json representation of a TemplateAccountSettings model + template_account_settings_model_json = {} + template_account_settings_model_json['restrict_create_service_id'] = 'NOT_SET' + template_account_settings_model_json['restrict_create_platform_apikey'] = 'NOT_SET' + template_account_settings_model_json['allowed_ip_addresses'] = 'testString' + template_account_settings_model_json['mfa'] = 'NONE' + template_account_settings_model_json['user_mfa'] = [user_mfa_model] + template_account_settings_model_json['session_expiration_in_seconds'] = '86400' + template_account_settings_model_json['session_invalidation_in_seconds'] = '7200' + template_account_settings_model_json['max_sessions_per_identity'] = 'testString' + template_account_settings_model_json['system_access_token_expiration_in_seconds'] = '3600' + template_account_settings_model_json['system_refresh_token_expiration_in_seconds'] = '259200' + template_account_settings_model_json['restrict_user_list_visibility'] = 'RESTRICTED' + template_account_settings_model_json['restrict_user_domains'] = ( + template_account_settings_restrict_user_domains_model + ) + + # Construct a model instance of TemplateAccountSettings by calling from_dict on the json representation + template_account_settings_model = TemplateAccountSettings.from_dict(template_account_settings_model_json) + assert template_account_settings_model != False + + # Construct a model instance of TemplateAccountSettings by calling from_dict on the json representation + template_account_settings_model_dict = TemplateAccountSettings.from_dict( + template_account_settings_model_json + ).__dict__ + template_account_settings_model2 = TemplateAccountSettings(**template_account_settings_model_dict) + + # Verify the model instances are equivalent + assert template_account_settings_model == template_account_settings_model2 + + # Convert model instance back to dict and verify no loss of data + template_account_settings_model_json2 = template_account_settings_model.to_dict() + assert template_account_settings_model_json2 == template_account_settings_model_json + + +class TestModel_TemplateAccountSettingsRestrictUserDomains: + """ + Test Class for TemplateAccountSettingsRestrictUserDomains + """ + + def test_template_account_settings_restrict_user_domains_serialization(self): + """ + Test serialization/deserialization for TemplateAccountSettingsRestrictUserDomains + """ + + # Construct dict forms of any model objects needed in order to build this model. + + account_settings_user_domain_restriction_model = {} # AccountSettingsUserDomainRestriction + account_settings_user_domain_restriction_model['realm_id'] = 'IBMid' + account_settings_user_domain_restriction_model['invitation_email_allow_patterns'] = [] + account_settings_user_domain_restriction_model['restrict_invitation'] = True + + # Construct a json representation of a TemplateAccountSettingsRestrictUserDomains model + template_account_settings_restrict_user_domains_model_json = {} + template_account_settings_restrict_user_domains_model_json['account_sufficient'] = True + template_account_settings_restrict_user_domains_model_json['restrictions'] = [ + account_settings_user_domain_restriction_model + ] + + # Construct a model instance of TemplateAccountSettingsRestrictUserDomains by calling from_dict on the json representation + template_account_settings_restrict_user_domains_model = TemplateAccountSettingsRestrictUserDomains.from_dict( + template_account_settings_restrict_user_domains_model_json + ) + assert template_account_settings_restrict_user_domains_model != False + + # Construct a model instance of TemplateAccountSettingsRestrictUserDomains by calling from_dict on the json representation + template_account_settings_restrict_user_domains_model_dict = ( + TemplateAccountSettingsRestrictUserDomains.from_dict( + template_account_settings_restrict_user_domains_model_json + ).__dict__ + ) + template_account_settings_restrict_user_domains_model2 = TemplateAccountSettingsRestrictUserDomains( + **template_account_settings_restrict_user_domains_model_dict + ) + + # Verify the model instances are equivalent + assert ( + template_account_settings_restrict_user_domains_model + == template_account_settings_restrict_user_domains_model2 + ) + + # Convert model instance back to dict and verify no loss of data + template_account_settings_restrict_user_domains_model_json2 = ( + template_account_settings_restrict_user_domains_model.to_dict() + ) + assert ( + template_account_settings_restrict_user_domains_model_json2 + == template_account_settings_restrict_user_domains_model_json + ) + + class TestModel_TemplateAssignmentListResponse: """ Test Class for TemplateAssignmentListResponse