diff --git a/README.md b/README.md index 8ea8440..119ce90 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [](https://opensource.org/licenses/Apache-2.0) [](https://codeclimate.com/github/IBM/scc-python-sdk/test_coverage) [](https://github.com/semantic-release/semantic-release) -# IBM Cloud Security & Compliance Center Python SDK Version 4.0.1 +# IBM Cloud Security & Compliance Center Python SDK Version 5.0.0 Python client library to interact with various [IBM Cloud Security & Compliance Center APIs](https://cloud.ibm.com/apidocs/security-compliance?code=python). @@ -55,20 +55,20 @@ Service Name | Module Name | Imported Class Name * An [IBM Cloud][ibm-cloud-onboarding] account. * An IAM API key to allow the SDK to access your account. Create one [here](https://cloud.ibm.com/iam/apikeys). -* Python 3.7 or above. +* Python 3.12 or above. ## Installation To install, use `pip` or `easy_install`: ```bash -pip install --upgrade "ibm-scc>=4.0.1" +pip install --upgrade "ibm-scc>=5.0.0" ``` or ```bash -easy_install --upgrade "ibm-scc>=4.0.1" +easy_install --upgrade "ibm-scc>=5.0.0" ``` ## Using the SDK diff --git a/ibm_scc/security_and_compliance_center_api_v3.py b/ibm_scc/security_and_compliance_center_api_v3.py index afcd680..038fddf 100644 --- a/ibm_scc/security_and_compliance_center_api_v3.py +++ b/ibm_scc/security_and_compliance_center_api_v3.py @@ -1,6 +1,6 @@ # coding: utf-8 -# (C) Copyright IBM Corp. 2023. +# (C) Copyright IBM Corp. 2025. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,20 +14,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -# IBM OpenAPI SDK Code Generator Version: 3.76.0-ad3e6f96-20230724-172814 +# IBM OpenAPI SDK Code Generator Version: 3.98.0-8be2046a-20241205-162752 """ -Security and Compliance Center API +The Security and Compliance Center API reference. -API Version: 3.0.0 """ from datetime import datetime from enum import Enum -from typing import Dict, List +from typing import Dict, List, Optional import json -from ibm_cloud_sdk_core import BaseService, DetailedResponse, get_query_param +from ibm_cloud_sdk_core import BaseService, DetailedResponse from ibm_cloud_sdk_core.authenticators.authenticator import Authenticator from ibm_cloud_sdk_core.get_authenticator import get_authenticator_from_environment from ibm_cloud_sdk_core.utils import convert_model, datetime_to_string, string_to_datetime @@ -42,10 +41,17 @@ class SecurityAndComplianceCenterApiV3(BaseService): """The Security and Compliance Center API V3 service.""" - DEFAULT_SERVICE_URL = 'https://us-south.compliance.cloud.ibm.com/instances/instance_id/v3' + DEFAULT_SERVICE_URL = 'https://us-south.compliance.cloud.ibm.com' DEFAULT_SERVICE_NAME = 'security_and_compliance_center_api' - PARAMETERIZED_SERVICE_URL = 'https://{region}.cloud.ibm.com/instances/{instance_id}/v3' + REGIONAL_ENDPOINTS = { + 'us-south': 'https://us-south.compliance.cloud.ibm.com', # Dallas region + 'eu-de': 'https://eu-de.compliance.cloud.ibm.com', # Frankfurt region + 'eu-fr2': 'https://eu-fr2.compliance.cloud.ibm.com', # Frankfurt region(Restricted) + 'ca-tor': 'https://ca-tor.compliance.cloud.ibm.com', # Toronto region + 'au-syd': 'https://au-syd.compliance.cloud.ibm.com', # Sydney region + 'eu-es': 'https://eu-es.compliance.cloud.ibm.com', # Madrid region + } @classmethod def new_instance( @@ -64,28 +70,18 @@ def new_instance( return service @classmethod - def construct_service_url( + def get_service_url_for_region( cls, - region: str = 'us-south.compliance', - instance_id: str = 'instance_id', + region: str, ) -> str: """ - Construct a service URL by formatting the parameterized service URL. - - The parameterized service URL is: - 'https://{region}.cloud.ibm.com/instances/{instance_id}/v3' - - :param str region: (optional) No description provided. - (default 'us-south.compliance') - :param str instance_id: (optional) The ID of the managing instance. - (default 'instance_id') - :return: The formatted URL with all variable placeholders replaced by values. + Returns the service URL associated with the specified region. + :param str region: a string representing the region + :return: The service URL associated with the specified region or None + if no mapping for the region exists :rtype: str """ - return cls.PARAMETERIZED_SERVICE_URL.format( - region=region, - instance_id=instance_id, - ) + return cls.REGIONAL_ENDPOINTS.get(region, None) def __init__( self, @@ -101,113 +97,143 @@ def __init__( BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### - # Settings + # attachment ######################### - def get_settings( + def list_instance_attachments( self, + instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, + version_group_label: Optional[str] = None, + limit: Optional[int] = None, + sort: Optional[str] = None, + direction: Optional[str] = None, + start: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Get settings. + Get all instance attachments. - Retrieve the settings of your service instance. + Retrieve all instance attachments. + With Security and Compliance Center, you can evaluate your resources on a + recurring schedule or you can initiate a scan at any time. To evaluate your + resources, you create an attachment. An attachment is the association between the + set of resources that you want to evaluate and a profile that contains the + specific controls that you want to use. For more information, see [Running an + evaluation for IBM + Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request, and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request, and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str account_id: (optional) The user account ID. + :param str version_group_label: (optional) The profile version group label. + :param int limit: (optional) The number of items that are retrieved in a + collection. + :param str sort: (optional) The sorted collection of attachments. The + available values are `created_on` and `scope_type`. + :param str direction: (optional) The collection of attachments that is + sorted in ascending order. To sort the collection in descending order, use + the `DESC` schema. + :param str start: (optional) The reference to the first item in the results + page. Take the value from the `next` field that is in the response from the + previous page. :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 `Settings` object + :rtype: DetailedResponse with `dict` result representing a `ProfileAttachmentCollection` object """ - headers = { - 'X-Correlation-Id': x_correlation_id, - 'X-Request-Id': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_settings', + operation_id='list_instance_attachments', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + 'version_group_label': version_group_label, + 'limit': limit, + 'sort': sort, + 'direction': direction, + 'start': start, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/settings' + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/attachments'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - def update_settings( + def create_profile_attachment( self, + instance_id: str, + profile_id: str, + attachments: List['ProfileAttachmentBase'], *, - event_notifications: 'EventNotifications' = None, - object_storage: 'ObjectStorage' = None, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Update settings. + Create an attachment. - Update the settings of your service instance. + Create an attachment to link to a profile. + With Security and Compliance Center, you can evaluate your resources on a + recurring schedule or you can initiate a scan at any time. To evaluate your + resources, you create an attachment. An attachment is the association between the + set of resources that you want to evaluate and a profile that contains the + specific controls that you want to use. For more information, see [Running an + evaluation for IBM + Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). - :param EventNotifications event_notifications: (optional) The Event - Notifications settings. - :param ObjectStorage object_storage: (optional) The Cloud Object Storage - settings. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request, and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request, and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param List[ProfileAttachmentBase] attachments: The Prototype to create a + profile attachment. + :param str account_id: (optional) The user account ID. :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 `Settings` object + :rtype: DetailedResponse with `dict` result representing a `ProfileAttachmentResponse` object """ - if event_notifications is not None: - event_notifications = convert_model(event_notifications) - if object_storage is not None: - object_storage = convert_model(object_storage) - headers = { - 'X-Correlation-Id': x_correlation_id, - 'X-Request-Id': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + if attachments is None: + raise ValueError('attachments must be provided') + attachments = [convert_model(x) for x in attachments] + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='update_settings', + operation_id='create_profile_attachment', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + data = { - 'event_notifications': event_notifications, - 'object_storage': object_storage, + 'attachments': attachments, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -218,498 +244,465 @@ def update_settings( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/settings' + path_param_keys = ['instance_id', 'profile_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/attachments'.format(**path_param_dict) request = self.prepare_request( - method='PATCH', + method='POST', url=url, headers=headers, + params=params, data=data, ) response = self.send(request, **kwargs) return response - def post_test_event( + def get_profile_attachment( self, + instance_id: str, + profile_id: str, + attachment_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Create a test event. - - Send a test event to your Event Notifications instance to ensure that the events - that are generated by Security and Compliance Center are being forwarded to Event - Notifications. For more information, see [Enabling event - notifications](/docs/security-compliance?topic=security-compliance-event-notifications#event-notifications-test-api). + Get an attachment. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request, and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request, and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + Retrieve an attachment that is linked to a profile by specifying the attachment + ID. + With Security and Compliance Center, you can evaluate your resources on a + recurring schedule or you can initiate a scan at any time. To evaluate your + resources, you create an attachment. An attachment is the association between the + set of resources that you want to evaluate and a profile that contains the + specific controls that you want to use. For more information, see [Running an + evaluation for IBM + Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param str attachment_id: The attachment ID. + :param str account_id: (optional) The user account ID. :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 `TestEvent` object + :rtype: DetailedResponse with `dict` result representing a `ProfileAttachment` object """ - headers = { - 'X-Correlation-Id': x_correlation_id, - 'X-Request-Id': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + if not attachment_id: + raise ValueError('attachment_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='post_test_event', + operation_id='get_profile_attachment', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/test_event' + path_param_keys = ['instance_id', 'profile_id', 'attachment_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id, attachment_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/attachments/{attachment_id}'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='GET', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - ######################### - # Control libraries - ######################### - - def list_control_libraries( + def replace_profile_attachment( self, + instance_id: str, + profile_id: str, + attachment_id: str, + attachments: List['ProfileAttachmentBase'], *, - x_correlation_id: str = None, - x_request_id: str = None, - limit: int = None, - control_library_type: str = None, - start: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Get control libraries. + Update an attachment. - Retrieve all of the control libraries that are available in your account, - including predefined, and custom libraries. - With Security and Compliance Center, you can create a custom control library that - is specific to your organization's needs. You define the controls and - specifications before you map previously created assessments. Each control has - several specifications and assessments that are mapped to it. A specification is - a defined requirement that is specific to a component. An assessment, or several, - are mapped to each specification with a detailed evaluation that is done to check - whether the specification is compliant. For more information, see [Creating custom - libraries](/docs/security-compliance?topic=security-compliance-custom-library). - - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param int limit: (optional) The field that indicates how many resources to - return, unless the response is the last page of resources. - :param str control_library_type: (optional) The field that indicate how you - want the resources to be filtered by. - :param str start: (optional) Determine what resource to start the page on - or after. + Update an attachment that is linked to a profile. + With Security and Compliance Center, you can evaluate your resources on a + recurring schedule or you can initiate a scan at any time. To evaluate your + resources, you create an attachment. An attachment is the association between the + set of resources that you want to evaluate and a profile that contains the + specific controls that you want to use. For more information, see [Running an + evaluation for IBM + Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param str attachment_id: The attachment ID. + :param List[ProfileAttachmentBase] attachments: The Prototype to create a + profile attachment. + :param str account_id: (optional) The user account ID. :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 `ControlLibraryCollection` object + :rtype: DetailedResponse with `dict` result representing a `ProfileAttachment` object """ - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + if not attachment_id: + raise ValueError('attachment_id must be provided') + if attachments is None: + raise ValueError('attachments must be provided') + attachments = [convert_model(x) for x in attachments] + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='list_control_libraries', + operation_id='replace_profile_attachment', ) headers.update(sdk_headers) params = { - 'limit': limit, - 'control_library_type': control_library_type, - 'start': start, + 'account_id': account_id, + } + + data = { + 'attachments': attachments, } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/control_libraries' + path_param_keys = ['instance_id', 'profile_id', 'attachment_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id, attachment_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/attachments/{attachment_id}'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='PUT', url=url, headers=headers, params=params, + data=data, ) response = self.send(request, **kwargs) return response - def create_custom_control_library( + def delete_profile_attachment( self, - control_library_name: str, - control_library_description: str, - control_library_type: str, - controls: List['ControlsInControlLib'], + instance_id: str, + profile_id: str, + attachment_id: str, *, - version_group_label: str = None, - control_library_version: str = None, - latest: bool = None, - controls_count: int = None, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Create a custom control library. + Delete an attachment. - Create a custom control library that is specific to your organization's needs. - With Security and Compliance Center, you can create a custom control library that - is specific to your organization's needs. You define the controls and - specifications before you map previously created assessments. Each control has - several specifications and assessments that are mapped to it. A specification is - a defined requirement that is specific to a component. An assessment, or several, - are mapped to each specification with a detailed evaluation that is done to check - whether the specification is compliant. For more information, see [Creating custom - libraries](/docs/security-compliance?topic=security-compliance-custom-library). + Delete an attachment that is linked to a profile. + With Security and Compliance Center, you can evaluate your resources on a + recurring schedule or you can initiate a scan at any time. To evaluate your + resources, you create an attachment. An attachment is the association between the + set of resources that you want to evaluate and a profile that contains the + specific controls that you want to use. For more information, see [Running an + evaluation for IBM + Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). - :param str control_library_name: The control library name. - :param str control_library_description: The control library description. - :param str control_library_type: The control library type. - :param List[ControlsInControlLib] controls: The controls. - :param str version_group_label: (optional) The version group label. - :param str control_library_version: (optional) The control library version. - :param bool latest: (optional) The latest control library version. - :param int controls_count: (optional) The number of controls. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param str attachment_id: The attachment ID. + :param str account_id: (optional) The user account ID. :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 `ControlLibrary` object + :rtype: DetailedResponse with `dict` result representing a `ProfileAttachment` object """ - if control_library_name is None: - raise ValueError('control_library_name must be provided') - if control_library_description is None: - raise ValueError('control_library_description must be provided') - if control_library_type is None: - raise ValueError('control_library_type must be provided') - if controls is None: - raise ValueError('controls must be provided') - controls = [convert_model(x) for x in controls] - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + if not attachment_id: + raise ValueError('attachment_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='create_custom_control_library', + operation_id='delete_profile_attachment', ) headers.update(sdk_headers) - data = { - 'control_library_name': control_library_name, - 'control_library_description': control_library_description, - 'control_library_type': control_library_type, - 'controls': controls, - 'version_group_label': version_group_label, - 'control_library_version': control_library_version, - 'latest': latest, - 'controls_count': controls_count, + params = { + 'account_id': account_id, } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/control_libraries' + path_param_keys = ['instance_id', 'profile_id', 'attachment_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id, attachment_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/attachments/{attachment_id}'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='DELETE', url=url, headers=headers, - data=data, + params=params, ) response = self.send(request, **kwargs) return response - def delete_custom_control_library( + def upgrade_attachment( self, - control_libraries_id: str, + instance_id: str, + profile_id: str, + attachment_id: str, + attachment_parameters: List['Parameter'], *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Delete a control library. - - Delete a custom control library by providing the control library ID. You can find - this ID by looking in the Security and Compliance Center UI. - With Security and Compliance Center, you can manage a custom control library that - is specific to your organization's needs. Each control has several specifications - and assessments that are mapped to it. For more information, see [Creating custom - libraries](/docs/security-compliance?topic=security-compliance-custom-library). - - :param str control_libraries_id: The control library ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + Upgrade an attachment. + + Upgrade an attachment to the latest version of a profile. + With Security and Compliance Center, you can evaluate your resources on a + recurring schedule or you can initiate a scan at any time. To evaluate your + resources, you create an attachment. An attachment is the association between the + set of resources that you want to evaluate and a profile that contains the + specific controls that you want to use. For more information, see [Running an + evaluation for IBM + Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param str attachment_id: The attachment ID. + :param List[Parameter] attachment_parameters: The attachment_parameters to + set for a Profile Attachment. + :param str account_id: (optional) The user account ID. :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 `ControlLibraryDelete` object + :rtype: DetailedResponse with `dict` result representing a `ProfileAttachment` object """ - if not control_libraries_id: - raise ValueError('control_libraries_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + if not attachment_id: + raise ValueError('attachment_id must be provided') + if attachment_parameters is None: + raise ValueError('attachment_parameters must be provided') + attachment_parameters = [convert_model(x) for x in attachment_parameters] + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='delete_custom_control_library', + operation_id='upgrade_attachment', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + + data = { + 'attachment_parameters': attachment_parameters, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['control_libraries_id'] - path_param_values = self.encode_path_vars(control_libraries_id) + path_param_keys = ['instance_id', 'profile_id', 'attachment_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id, attachment_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/control_libraries/{control_libraries_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/attachments/{attachment_id}/upgrade'.format(**path_param_dict) request = self.prepare_request( - method='DELETE', + method='POST', url=url, headers=headers, + params=params, + data=data, ) response = self.send(request, **kwargs) return response - def get_control_library( + def create_scan( self, - control_libraries_id: str, + instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + attachment_id: Optional[str] = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Get a control library. + Create a scan. - View the details of a control library by specifying its ID. - With Security and Compliance Center, you can create a custom control library that - is specific to your organization's needs. You define the controls and - specifications before you map previously created assessments. Each control has - several specifications and assessments that are mapped to it. A specification is - a defined requirement that is specific to a component. An assessment, or several, - are mapped to each specification with a detailed evaluation that is done to check - whether the specification is compliant. For more information, see [Creating custom - libraries](/docs/security-compliance?topic=security-compliance-custom-library). - - :param str control_libraries_id: The control library ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + Create a scan to evaluate your resources. + With Security and Compliance Center, you can evaluate your resources on a + recurring schedule. If your attachment exists, but you don't want to wait for the + next scan to see your posture, you can initiate an on-demand scan. For more + information, see [Running a scan on + demand](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources#scan-ondemand-api). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str attachment_id: (optional) The ID of the profile attachment. + :param str account_id: (optional) The user account ID. :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 `ControlLibrary` object + :rtype: DetailedResponse with `dict` result representing a `CreateScanResponse` object """ - if not control_libraries_id: - raise ValueError('control_libraries_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_control_library', + operation_id='create_scan', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + + data = { + 'attachment_id': attachment_id, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['control_libraries_id'] - path_param_values = self.encode_path_vars(control_libraries_id) + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/control_libraries/{control_libraries_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/scans'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='POST', url=url, headers=headers, + params=params, + data=data, ) response = self.send(request, **kwargs) return response - def replace_custom_control_library( + ######################### + # controlLibrary + ######################### + + def create_custom_control_library( self, - control_libraries_id: str, + instance_id: str, + control_library_name: str, + control_library_description: str, + control_library_type: str, + control_library_version: str, + controls: List['ControlPrototype'], *, - id: str = None, - account_id: str = None, - control_library_name: str = None, - control_library_description: str = None, - control_library_type: str = None, - version_group_label: str = None, - control_library_version: str = None, - created_on: datetime = None, - created_by: str = None, - updated_on: datetime = None, - updated_by: str = None, - latest: bool = None, - hierarchy_enabled: bool = None, - controls_count: int = None, - control_parents_count: int = None, - controls: List['ControlsInControlLib'] = None, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Update a control library. - - Update a custom control library by providing the control library ID. You can find - this ID in the Security and Compliance Center UI. - With Security and Compliance Center, you can create and update a custom control - library that is specific to your organization's needs. You define the controls - and specifications before you map previously created assessments. Each control has - several specifications and assessments that are mapped to it. For more - information, see [Creating custom - libraries](/docs/security-compliance?topic=security-compliance-custom-library). - - :param str control_libraries_id: The control library ID. - :param str id: (optional) The control library ID. - :param str account_id: (optional) The account ID. - :param str control_library_name: (optional) The control library name. - :param str control_library_description: (optional) The control library - description. - :param str control_library_type: (optional) The control library type. - :param str version_group_label: (optional) The version group label. - :param str control_library_version: (optional) The control library version. - :param datetime created_on: (optional) The date when the control library - was created. - :param str created_by: (optional) The user who created the control library. - :param datetime updated_on: (optional) The date when the control library - was updated. - :param str updated_by: (optional) The user who updated the control library. - :param bool latest: (optional) The latest version of the control library. - :param bool hierarchy_enabled: (optional) The indication of whether - hierarchy is enabled for the control library. - :param int controls_count: (optional) The number of controls. - :param int control_parents_count: (optional) The number of parent controls - in the control library. - :param List[ControlsInControlLib] controls: (optional) The list of controls - in a control library. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + Create a custom control library. + + Create a custom control library that is specific to your organization's needs. + With Security and Compliance Center, you can create a custom control library that + is specific to your organization's needs. You define the controls and + specifications before you map previously created assessments. Each control has + several specifications and assessments that are mapped to it. A specification is + a defined requirement that is specific to a component. An assessment, or several, + are mapped to each specification with a detailed evaluation that is done to check + whether the specification is compliant. For more information, see [Creating custom + libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str control_library_name: The name of the control library. + :param str control_library_description: Details of the control library. + :param str control_library_type: Details that the control library is a user + made(custom) or Security Compliance Center(predefined). + :param str control_library_version: The revision number of the control + library. + :param List[ControlPrototype] controls: The list of rules that the control + library attempts to adhere to. + :param str account_id: (optional) The user account ID. :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 `ControlLibrary` object """ - if not control_libraries_id: - raise ValueError('control_libraries_id must be provided') - if created_on is not None: - created_on = datetime_to_string(created_on) - if updated_on is not None: - updated_on = datetime_to_string(updated_on) - if controls is not None: - controls = [convert_model(x) for x in controls] - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if control_library_name is None: + raise ValueError('control_library_name must be provided') + if control_library_description is None: + raise ValueError('control_library_description must be provided') + if control_library_type is None: + raise ValueError('control_library_type must be provided') + if control_library_version is None: + raise ValueError('control_library_version must be provided') + if controls is None: + raise ValueError('controls must be provided') + controls = [convert_model(x) for x in controls] + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='replace_custom_control_library', + operation_id='create_custom_control_library', ) headers.update(sdk_headers) - data = { - 'id': id, + params = { 'account_id': account_id, + } + + data = { 'control_library_name': control_library_name, 'control_library_description': control_library_description, 'control_library_type': control_library_type, - 'version_group_label': version_group_label, 'control_library_version': control_library_version, - 'created_on': created_on, - 'created_by': created_by, - 'updated_on': updated_on, - 'updated_by': updated_by, - 'latest': latest, - 'hierarchy_enabled': hierarchy_enabled, - 'controls_count': controls_count, - 'control_parents_count': control_parents_count, 'controls': controls, } data = {k: v for (k, v) in data.items() if v is not None} @@ -721,75 +714,61 @@ def replace_custom_control_library( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['control_libraries_id'] - path_param_values = self.encode_path_vars(control_libraries_id) + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/control_libraries/{control_libraries_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/control_libraries'.format(**path_param_dict) request = self.prepare_request( - method='PUT', + method='POST', url=url, headers=headers, + params=params, data=data, ) response = self.send(request, **kwargs) return response - ######################### - # Profiles - ######################### - - def list_profiles( + def list_control_libraries( self, + instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - limit: int = None, - profile_type: str = None, - start: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Get all profiles. + Get all control libraries. - View all of the predefined and custom profiles that are available in your account. - - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request, and repeated in a response header for - the corresponding response. The same value is used for downstream requests, - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param int limit: (optional) The indication of how many resources to - return, unless the response is the last page of resources. - :param str profile_type: (optional) The field that indicate how you want - the resources to be filtered by. - :param str start: (optional) Determine what resource to start the page on - or after. + Retrieve all the control libraries, including predefined, and custom libraries. + With Security and Compliance Center, you can create a custom control library that + is specific to your organization's needs. You define the controls and + specifications before you map previously created assessments. Each control has + several specifications and assessments that are mapped to it. A specification is + a defined requirement that is specific to a component. An assessment, or several, + are mapped to each specification with a detailed evaluation that is done to check + whether the specification is compliant. For more information, see [Creating custom + libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str account_id: (optional) The user account ID. :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 `ProfileCollection` object + :rtype: DetailedResponse with `dict` result representing a `ControlLibraryCollection` object """ - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='list_profiles', + operation_id='list_control_libraries', ) headers.update(sdk_headers) params = { - 'limit': limit, - 'profile_type': profile_type, - 'start': start, + 'account_id': account_id, } if 'headers' in kwargs: @@ -797,7 +776,10 @@ def list_profiles( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/profiles' + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/control_libraries'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -808,76 +790,82 @@ def list_profiles( response = self.send(request, **kwargs) return response - def create_profile( + def replace_custom_control_library( self, - profile_name: str, - profile_description: str, - profile_type: str, - controls: List['ProfileControlsPrototype'], - default_parameters: List['DefaultParametersPrototype'], + instance_id: str, + control_library_id: str, + control_library_name: str, + control_library_description: str, + control_library_type: str, + control_library_version: str, + controls: List['ControlPrototype'], *, - x_correlation_id: str = None, - x_request_id: str = None, + bss_account: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Create a custom profile. + Update a custom control library. - Create a custom profile that is specific to your usecase, by using an existing - library as a starting point. For more information, see [Building custom - profiles](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + Update a custom control library by specifying its ID. + With Security and Compliance Center, you can create a custom control library that + is specific to your organization's needs. You define the controls and + specifications before you map previously created assessments. Each control has + several specifications and assessments that are mapped to it. A specification is + a defined requirement that is specific to a component. An assessment, or several, + are mapped to each specification with a detailed evaluation that is done to check + whether the specification is compliant. For more information, see [Creating custom + libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). - :param str profile_name: The name of the profile. - :param str profile_description: The description of the profile. - :param str profile_type: The profile type. - :param List[ProfileControlsPrototype] controls: The controls that are in - the profile. - :param List[DefaultParametersPrototype] default_parameters: The default - parameters of the profile. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request, and repeated in a response header for - the corresponding response. The same value is used for downstream requests, - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str control_library_id: The predefined control library ID. + :param str control_library_name: The name of the control library. + :param str control_library_description: Details of the control library. + :param str control_library_type: Details that the control library is a user + made(custom) or Security Compliance Center(predefined). + :param str control_library_version: The revision number of the control + library. + :param List[ControlPrototype] controls: The list of rules that the control + library attempts to adhere to. + :param str bss_account: (optional) The account id tied to billing. :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 `Profile` object + :rtype: DetailedResponse with `dict` result representing a `ControlLibrary` object """ - if profile_name is None: - raise ValueError('profile_name must be provided') - if profile_description is None: - raise ValueError('profile_description must be provided') - if profile_type is None: - raise ValueError('profile_type must be provided') + if not instance_id: + raise ValueError('instance_id must be provided') + if not control_library_id: + raise ValueError('control_library_id must be provided') + if control_library_name is None: + raise ValueError('control_library_name must be provided') + if control_library_description is None: + raise ValueError('control_library_description must be provided') + if control_library_type is None: + raise ValueError('control_library_type must be provided') + if control_library_version is None: + raise ValueError('control_library_version must be provided') if controls is None: raise ValueError('controls must be provided') - if default_parameters is None: - raise ValueError('default_parameters must be provided') controls = [convert_model(x) for x in controls] - default_parameters = [convert_model(x) for x in default_parameters] - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='create_profile', + operation_id='replace_custom_control_library', ) headers.update(sdk_headers) + params = { + 'bss_account': bss_account, + } + data = { - 'profile_name': profile_name, - 'profile_description': profile_description, - 'profile_type': profile_type, + 'control_library_name': control_library_name, + 'control_library_description': control_library_description, + 'control_library_type': control_library_type, + 'control_library_version': control_library_version, 'controls': controls, - 'default_parameters': default_parameters, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -888,218 +876,226 @@ def create_profile( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/profiles' + path_param_keys = ['instance_id', 'control_library_id'] + path_param_values = self.encode_path_vars(instance_id, control_library_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/control_libraries/{control_library_id}'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='PUT', url=url, headers=headers, + params=params, data=data, ) response = self.send(request, **kwargs) return response - def delete_custom_profile( + def get_control_library( self, - profile_id: str, + instance_id: str, + control_library_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Delete a custom profile. + Get a control library. - Delete a custom profile by providing the profile ID. You can find the ID in the - Security and Compliance Center UI. For more information about managing your custom - profiles, see [Building custom - profiles](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + View the details of a control library by specifying its ID. + With Security and Compliance Center, you can create a custom control library that + is specific to your organization's needs. You define the controls and + specifications before you map previously created assessments. Each control has + several specifications and assessments that are mapped to it. A specification is + a defined requirement that is specific to a component. An assessment, or several, + are mapped to each specification with a detailed evaluation that is done to check + whether the specification is compliant. For more information, see [Creating custom + libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). - :param str profile_id: The profile ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str control_library_id: The predefined control library ID. + :param str account_id: (optional) The user account ID. :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 `Profile` object + :rtype: DetailedResponse with `dict` result representing a `ControlLibrary` object """ - if not profile_id: - raise ValueError('profile_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not control_library_id: + raise ValueError('control_library_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='delete_custom_profile', + operation_id='get_control_library', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['profile_id'] - path_param_values = self.encode_path_vars(profile_id) + path_param_keys = ['instance_id', 'control_library_id'] + path_param_values = self.encode_path_vars(instance_id, control_library_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/profiles/{profile_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/control_libraries/{control_library_id}'.format(**path_param_dict) request = self.prepare_request( - method='DELETE', + method='GET', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - def get_profile( + def delete_custom_control_library( self, - profile_id: str, + instance_id: str, + control_library_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Get a profile. + Delete a custom control library. - View the details of a profile by providing the profile ID. You can find the - profile ID in the Security and Compliance Center UI. For more information, see - [Building custom - profiles](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + Delete a custom control library by specifying its ID. + With Security and Compliance Center, you can create a custom control library that + is specific to your organization's needs. You define the controls and + specifications before you map previously created assessments. Each control has + several specifications and assessments that are mapped to it. A specification is + a defined requirement that is specific to a component. An assessment, or several, + are mapped to each specification with a detailed evaluation that is done to check + whether the specification is compliant. For more information, see [Creating custom + libraries](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-custom-library). - :param str profile_id: The profile ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str control_library_id: The predefined control library ID. + :param str account_id: (optional) The user account ID. :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 `Profile` object + :rtype: DetailedResponse with `dict` result representing a `ControlLibrary` object """ - if not profile_id: - raise ValueError('profile_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not control_library_id: + raise ValueError('control_library_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_profile', + operation_id='delete_custom_control_library', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['profile_id'] - path_param_values = self.encode_path_vars(profile_id) + path_param_keys = ['instance_id', 'control_library_id'] + path_param_values = self.encode_path_vars(instance_id, control_library_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/profiles/{profile_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/control_libraries/{control_library_id}'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='DELETE', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - def replace_profile( + ######################### + # profile + ######################### + + def create_profile( self, - profile_id: str, - profile_name: str, - profile_description: str, - profile_type: str, + instance_id: str, controls: List['ProfileControlsPrototype'], - default_parameters: List['DefaultParametersPrototype'], + default_parameters: List['DefaultParameters'], *, - x_correlation_id: str = None, - x_request_id: str = None, + profile_name: Optional[str] = None, + profile_description: Optional[str] = None, + profile_version: Optional[str] = None, + latest: Optional[bool] = None, + version_group_label: Optional[str] = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Update a profile. + Create a custom profile. - Update the details of a custom profile. With Security and Compliance Center, you - can manage a profile that is specific to your usecase, by using an existing - library as a starting point. For more information, see [Building custom - profiles](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + Create a user-defined custom profile. + With Security and Compliance Center, you can create a profile that is specific to + your usecase, by using an existing library as a starting point. For more + information, see [Building custom + profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). - :param str profile_id: The profile ID. - :param str profile_name: The name of the profile. - :param str profile_description: The description of the profile. - :param str profile_type: The profile type. - :param List[ProfileControlsPrototype] controls: The controls that are in - the profile. - :param List[DefaultParametersPrototype] default_parameters: The default - parameters of the profile. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param List[ProfileControlsPrototype] controls: List of controls associated + with the profile. + :param List[DefaultParameters] default_parameters: The default values when + using the profile. + :param str profile_name: (optional) The name of the profile. + :param str profile_description: (optional) A description of what the + profile should represent. + :param str profile_version: (optional) The version of the profile. + :param bool latest: (optional) Determines if the profile is up to date with + the latest revisions. + :param str version_group_label: (optional) The unique identifier of the + revision. + :param str account_id: (optional) The user account ID. :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 `Profile` object """ - if not profile_id: - raise ValueError('profile_id must be provided') - if profile_name is None: - raise ValueError('profile_name must be provided') - if profile_description is None: - raise ValueError('profile_description must be provided') - if profile_type is None: - raise ValueError('profile_type must be provided') + if not instance_id: + raise ValueError('instance_id must be provided') if controls is None: raise ValueError('controls must be provided') if default_parameters is None: raise ValueError('default_parameters must be provided') controls = [convert_model(x) for x in controls] default_parameters = [convert_model(x) for x in default_parameters] - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='replace_profile', + operation_id='create_profile', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + data = { - 'profile_name': profile_name, - 'profile_description': profile_description, - 'profile_type': profile_type, 'controls': controls, 'default_parameters': default_parameters, + 'profile_name': profile_name, + 'profile_description': profile_description, + 'profile_version': profile_version, + 'latest': latest, + 'version_group_label': version_group_label, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -1110,77 +1106,58 @@ def replace_profile( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['profile_id'] - path_param_values = self.encode_path_vars(profile_id) + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/profiles/{profile_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/profiles'.format(**path_param_dict) request = self.prepare_request( - method='PUT', + method='POST', url=url, headers=headers, + params=params, data=data, ) response = self.send(request, **kwargs) return response - ######################### - # Rules - ######################### - - def list_rules( + def list_profiles( self, + instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - type: str = None, - search: str = None, - service_name: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - List all rules. + Get all profiles. - Retrieve all the rules that you use to target the exact configuration properties - that you need to ensure are compliant. For more information, see [Defining custom - rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. - :param str type: (optional) The list of only user-defined, or - system-defined rules. - :param str search: (optional) The indication of whether to search for rules - with a specific string string in the name, description, or labels. - :param str service_name: (optional) Searches for rules targeting - corresponding service. + Retrieve all profiles, including predefined and custom profiles. + With Security and Compliance Center, you can take advantage of predefined profiles + that are curated based on industry standards. Or you can choose to create one + that is specific to your usecase by using an existing library as a starting point. + For more information, see [Building custom + profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str account_id: (optional) The user account ID. :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 `RulesPageBase` object + :rtype: DetailedResponse with `dict` result representing a `ProfileCollection` object """ - headers = { - 'X-Correlation-Id': x_correlation_id, - 'X-Request-Id': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='list_rules', + operation_id='list_profiles', ) headers.update(sdk_headers) params = { - 'type': type, - 'search': search, - 'service_name': service_name, + 'account_id': account_id, } if 'headers' in kwargs: @@ -1188,7 +1165,10 @@ def list_rules( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/rules' + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/profiles'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -1199,80 +1179,81 @@ def list_rules( response = self.send(request, **kwargs) return response - def create_rule( + def replace_profile( self, - description: str, - target: 'Target', - required_config: 'RequiredConfig', + instance_id: str, + profile_id: str, + controls: List['ProfileControlsPrototype'], + default_parameters: List['DefaultParameters'], *, - type: str = None, - version: str = None, - import_: 'Import' = None, - labels: List[str] = None, - x_correlation_id: str = None, - x_request_id: str = None, + profile_name: Optional[str] = None, + profile_description: Optional[str] = None, + profile_version: Optional[str] = None, + latest: Optional[bool] = None, + version_group_label: Optional[str] = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Create a custom rule. + Update a custom profile. - Create a custom rule to to target the exact configuration properties that you - need to evaluate your resources for compliance. For more information, see - [Defining custom - rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + Update the details of a user-defined profile. + With Security and Compliance Center, you can create a profile that is specific to + your usecase, by using an existing library as a starting point. For more + information, see [Building custom + profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). - :param str description: The rule description. - :param Target target: The rule target. - :param RequiredConfig required_config: The required configurations. - :param str type: (optional) The rule type (user_defined or system_defined). - :param str version: (optional) The rule version number. - :param Import import_: (optional) The collection of import parameters. - :param List[str] labels: (optional) The list of labels that correspond to a - rule. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param List[ProfileControlsPrototype] controls: List of controls associated + with the profile. + :param List[DefaultParameters] default_parameters: The default values when + using the profile. + :param str profile_name: (optional) The name of the profile. + :param str profile_description: (optional) A description of what the + profile should represent. + :param str profile_version: (optional) The version of the profile. + :param bool latest: (optional) Determines if the profile is up to date with + the latest revisions. + :param str version_group_label: (optional) The unique identifier of the + revision. + :param str account_id: (optional) The user account ID. :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 `Rule` object + :rtype: DetailedResponse with `dict` result representing a `Profile` object """ - if description is None: - raise ValueError('description must be provided') - if target is None: - raise ValueError('target must be provided') - if required_config is None: - raise ValueError('required_config must be provided') - target = convert_model(target) - required_config = convert_model(required_config) - if import_ is not None: - import_ = convert_model(import_) - headers = { - 'X-Correlation-Id': x_correlation_id, - 'X-Request-Id': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + if controls is None: + raise ValueError('controls must be provided') + if default_parameters is None: + raise ValueError('default_parameters must be provided') + controls = [convert_model(x) for x in controls] + default_parameters = [convert_model(x) for x in default_parameters] + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='create_rule', + operation_id='replace_profile', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + data = { - 'description': description, - 'target': target, - 'required_config': required_config, - 'type': type, - 'version': version, - 'import': import_, - 'labels': labels, + 'controls': controls, + 'default_parameters': default_parameters, + 'profile_name': profile_name, + 'profile_description': profile_description, + 'profile_version': profile_version, + 'latest': latest, + 'version_group_label': version_group_label, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -1283,227 +1264,199 @@ def create_rule( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/rules' + path_param_keys = ['instance_id', 'profile_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/profiles/{profile_id}'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='PUT', url=url, headers=headers, + params=params, data=data, ) response = self.send(request, **kwargs) return response - def delete_rule( + def get_profile( self, - rule_id: str, + instance_id: str, + profile_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Delete a custom rule. + Get a profile. - Delete a custom rule that you no longer require to evaluate your resources. For - more information, see [Defining custom - rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - - :param str rule_id: The ID of the corresponding rule. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + Retrieve a profile by specifying the profile ID. + With Security and Compliance Center, you can utilize predefined profiles that are + curated based on industry standards. Or you can choose to create one that is + specific to your usecase, by using an existing library as a starting point. For + more information, see [Building custom + profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param str account_id: (optional) The user account ID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse + :rtype: DetailedResponse with `dict` result representing a `Profile` object """ - if not rule_id: - raise ValueError('rule_id must be provided') - headers = { - 'X-Correlation-Id': x_correlation_id, - 'X-Request-Id': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='delete_rule', + operation_id='get_profile', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] + headers['Accept'] = 'application/json' - path_param_keys = ['rule_id'] - path_param_values = self.encode_path_vars(rule_id) + path_param_keys = ['instance_id', 'profile_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/rules/{rule_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/profiles/{profile_id}'.format(**path_param_dict) request = self.prepare_request( - method='DELETE', + method='GET', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - def get_rule( + def delete_custom_profile( self, - rule_id: str, + instance_id: str, + profile_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Get a custom rule. + Delete a custom profile. - Retrieve a rule that you created to evaluate your resources. For more - information, see [Defining custom - rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - - :param str rule_id: The ID of the corresponding rule. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + Delete a custom profile by specifying the profile ID. + With Security and Compliance Center, you can utilize predefined profiles that are + curated based on industry standards. Or you can choose to create one that is + specific to your usecase, by using an existing library as a starting point. For + more information, see [Building custom + profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param str account_id: (optional) The user account ID. :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 `Rule` object + :rtype: DetailedResponse with `dict` result representing a `Profile` object """ - if not rule_id: - raise ValueError('rule_id must be provided') - headers = { - 'X-Correlation-Id': x_correlation_id, - 'X-Request-Id': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_rule', + operation_id='delete_custom_profile', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['rule_id'] - path_param_values = self.encode_path_vars(rule_id) + path_param_keys = ['instance_id', 'profile_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/rules/{rule_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/profiles/{profile_id}'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='DELETE', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - def replace_rule( + def replace_profile_parameters( self, - rule_id: str, - if_match: str, - description: str, - target: 'Target', - required_config: 'RequiredConfig', + instance_id: str, + profile_id: str, + default_parameters: List['DefaultParameters'], *, - type: str = None, - version: str = None, - import_: 'Import' = None, - labels: List[str] = None, - x_correlation_id: str = None, - x_request_id: str = None, + id: Optional[str] = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Update a custom rule. + Update custom profile parameters. - Update a custom rule that you use to target the exact configuration properties - that you need to evaluate your resources for compliance. For more information, see - [Defining custom - rules](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). + Update the parameters of a custom profile. + With Security and Compliance Center, you can utilize predefined profiles that are + curated based on industry standards. Or you can choose to create one that is + specific to your usecase, by using an existing library as a starting point. For + more information, see [Building custom + profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). - :param str rule_id: The ID of the corresponding rule. - :param str if_match: This field compares a supplied `Etag` value with the - version that is stored for the requested resource. If the values match, the - server allows the request method to continue. - To find the `Etag` value, run a GET request on the resource that you want - to modify, and check the response headers. - :param str description: The rule description. - :param Target target: The rule target. - :param RequiredConfig required_config: The required configurations. - :param str type: (optional) The rule type (user_defined or system_defined). - :param str version: (optional) The rule version number. - :param Import import_: (optional) The collection of import parameters. - :param List[str] labels: (optional) The list of labels that correspond to a - rule. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str profile_id: The profile ID. + :param List[DefaultParameters] default_parameters: list of parameters given + by default. + :param str id: (optional) The ID of the Profile. + :param str account_id: (optional) The user account ID. :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 `Rule` object + :rtype: DetailedResponse with `dict` result representing a `ProfileDefaultParametersResponse` object """ - if not rule_id: - raise ValueError('rule_id must be provided') - if not if_match: - raise ValueError('if_match must be provided') - if description is None: - raise ValueError('description must be provided') - if target is None: - raise ValueError('target must be provided') - if required_config is None: - raise ValueError('required_config must be provided') - target = convert_model(target) - required_config = convert_model(required_config) - if import_ is not None: - import_ = convert_model(import_) - headers = { - 'If-Match': if_match, - 'X-Correlation-Id': x_correlation_id, - 'X-Request-Id': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not profile_id: + raise ValueError('profile_id must be provided') + if default_parameters is None: + raise ValueError('default_parameters must be provided') + default_parameters = [convert_model(x) for x in default_parameters] + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='replace_rule', + operation_id='replace_profile_parameters', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + data = { - 'description': description, - 'target': target, - 'required_config': required_config, - 'type': type, - 'version': version, - 'import': import_, - 'labels': labels, + 'default_parameters': default_parameters, + 'id': id, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -1514,293 +1467,227 @@ def replace_rule( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['rule_id'] - path_param_values = self.encode_path_vars(rule_id) + path_param_keys = ['instance_id', 'profile_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/rules/{rule_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/parameters'.format(**path_param_dict) request = self.prepare_request( method='PUT', url=url, headers=headers, + params=params, data=data, ) response = self.send(request, **kwargs) return response - ######################### - # Attachments - ######################### - - def list_attachments( + def list_profile_parameters( self, + instance_id: str, profile_id: str, - *, - x_correlation_id: str = None, - x_request_id: str = None, - limit: int = None, - start: str = None, **kwargs, ) -> DetailedResponse: """ - Get all attachments linked to a specific profile. + List profile parameters for a given profile. - View all of the attachments that are linked to a specific profile. An attachment - is the association between the set of resources that you want to evaluate and a - profile that contains the specific controls that you want to use. For more - information, see [Running an evaluation for IBM - Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + List the parameters used in the Profile. + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str profile_id: The profile ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param int limit: (optional) The indication of how many resources to - return, unless the response is the last page of resources. - :param str start: (optional) Determine what resource to start the page on - or after. :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 `AttachmentCollection` object + :rtype: DetailedResponse with `dict` result representing a `ProfileDefaultParametersResponse` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not profile_id: raise ValueError('profile_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='list_attachments', + operation_id='list_profile_parameters', ) headers.update(sdk_headers) - params = { - 'limit': limit, - 'start': start, - } - if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['profile_id'] - path_param_values = self.encode_path_vars(profile_id) + path_param_keys = ['instance_id', 'profile_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/profiles/{profile_id}/attachments'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/parameters'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, - params=params, ) response = self.send(request, **kwargs) return response - def create_attachment( + def compare_profiles( self, + instance_id: str, profile_id: str, - attachments: List['AttachmentsPrototype'], *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Create an attachment. + Compare profiles. - Create an attachment to link to a profile to schedule evaluations of your - resources on a recurring schedule, or on-demand. For more information, see - [Running an evaluation for IBM - Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + Compare the version of the profile that you're currently using with your + attachment to the most recent profile version. By comparing them, you can view + what controls were added, removed, or modified. For more information, see + [Building custom + profiles](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-build-custom-profiles&interface=api). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str profile_id: The profile ID. - :param List[AttachmentsPrototype] attachments: The array that displays all - of the available attachments. - :param str profile_id: (optional) The ID of the profile that is specified - in the attachment. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str account_id: (optional) The user account ID. :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 `AttachmentPrototype` object + :rtype: DetailedResponse with `dict` result representing a `ComparePredefinedProfilesResponse` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not profile_id: raise ValueError('profile_id must be provided') - if attachments is None: - raise ValueError('attachments must be provided') - attachments = [convert_model(x) for x in attachments] - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='create_attachment', + operation_id='compare_profiles', ) headers.update(sdk_headers) - data = { - 'attachments': attachments, - 'profile_id': profile_id, + params = { + 'account_id': account_id, } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['profile_id'] - path_param_values = self.encode_path_vars(profile_id) + path_param_keys = ['instance_id', 'profile_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/profiles/{profile_id}/attachments'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/compare'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='GET', url=url, headers=headers, - data=data, + params=params, ) response = self.send(request, **kwargs) return response - def delete_profile_attachment( + def list_profile_attachments( self, - attachment_id: str, + instance_id: str, profile_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + account_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Delete an attachment. + Get all attachments linked to a specific profile. - Delete an attachment. Alternatively, if you think that you might need this - configuration in the future, you can pause an attachment to stop being charged. - For more information, see [Running an evaluation for IBM - Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + Retrieve all attachments that are linked to a profile. + With Security and Compliance Center, you can evaluate your resources on a + recurring schedule or you can initiate a scan at any time. To evaluate your + resources, you create an attachment. An attachment is the association between the + set of resources that you want to evaluate and a profile that contains the + specific controls that you want to use. For more information, see [Running an + evaluation for IBM + Cloud](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). - :param str attachment_id: The attachment ID. + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str profile_id: The profile ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str account_id: (optional) The user account ID. :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 `AttachmentItem` object + :rtype: DetailedResponse with `dict` result representing a `ProfileAttachmentCollection` object """ - if not attachment_id: - raise ValueError('attachment_id must be provided') + if not instance_id: + raise ValueError('instance_id must be provided') if not profile_id: raise ValueError('profile_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='delete_profile_attachment', + operation_id='list_profile_attachments', ) headers.update(sdk_headers) + params = { + 'account_id': account_id, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['attachment_id', 'profile_id'] - path_param_values = self.encode_path_vars(attachment_id, profile_id) + path_param_keys = ['instance_id', 'profile_id'] + path_param_values = self.encode_path_vars(instance_id, profile_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/profiles/{profile_id}/attachments/{attachment_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/profiles/{profile_id}/attachments'.format(**path_param_dict) request = self.prepare_request( - method='DELETE', + method='GET', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - def get_profile_attachment( + ######################### + # providerType + ######################### + + def list_provider_types( self, - attachment_id: str, - profile_id: str, - *, - x_correlation_id: str = None, - x_request_id: str = None, + instance_id: str, **kwargs, ) -> DetailedResponse: """ - Get an attachment. + List provider types. - View the details of an attachment a profile by providing the attachment ID. You - can find this value in the Security and Compliance Center UI. For more - information, see [Running an evaluation for IBM - Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + List all the registered provider types or integrations such as Workload Protection + available to connect to Security and Compliance Center. For more information + about connecting Workload Protection with the Security and Compliance Center, see + [Connecting Workload + Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). - :param str attachment_id: The attachment ID. - :param str profile_id: The profile ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. :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 `AttachmentItem` object + :rtype: DetailedResponse with `dict` result representing a `ProviderTypeCollection` object """ - if not attachment_id: - raise ValueError('attachment_id must be provided') - if not profile_id: - raise ValueError('profile_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_profile_attachment', + operation_id='list_provider_types', ) headers.update(sdk_headers) @@ -1809,10 +1696,10 @@ def get_profile_attachment( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['attachment_id', 'profile_id'] - path_param_values = self.encode_path_vars(attachment_id, profile_id) + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/profiles/{profile_id}/attachments/{attachment_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/provider_types'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -1822,129 +1709,103 @@ def get_profile_attachment( response = self.send(request, **kwargs) return response - def replace_profile_attachment( + def get_provider_type_by_id( self, - attachment_id: str, - profile_id: str, - *, - id: str = None, - account_id: str = None, - instance_id: str = None, - scope: List['MultiCloudScope'] = None, - created_on: datetime = None, - created_by: str = None, - updated_on: datetime = None, - updated_by: str = None, - status: str = None, - schedule: str = None, - notifications: 'AttachmentsNotificationsPrototype' = None, - attachment_parameters: List['AttachmentParameterPrototype'] = None, - last_scan: 'LastScan' = None, - next_scan_time: datetime = None, - name: str = None, - description: str = None, - x_correlation_id: str = None, - x_request_id: str = None, + instance_id: str, + provider_type_id: str, **kwargs, ) -> DetailedResponse: """ - Update an attachment. + Get a provider type. - Update an attachment that is linked to a profile to evaluate your resources on a - recurring schedule, or on-demand. For more information, see [Running an evaluation - for IBM - Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). + Retrieve a provider type by specifying its ID. For more information about + integrations, see [Connecting Workload + Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). - :param str attachment_id: The attachment ID. - :param str profile_id: The profile ID. - :param str id: (optional) The ID of the attachment. - :param str profile_id: (optional) The ID of the profile that is specified - in the attachment. - :param str account_id: (optional) The account ID that is associated to the - attachment. - :param str instance_id: (optional) The instance ID of the account that is - associated to the attachment. - :param List[MultiCloudScope] scope: (optional) The scope payload for the - multi cloud feature. - :param datetime created_on: (optional) The date when the attachment was - created. - :param str created_by: (optional) The user who created the attachment. - :param datetime updated_on: (optional) The date when the attachment was - updated. - :param str updated_by: (optional) The user who updated the attachment. - :param str status: (optional) The status of an attachment evaluation. - :param str schedule: (optional) The schedule of an attachment evaluation. - :param AttachmentsNotificationsPrototype notifications: (optional) The - request payload of the attachment notifications. - :param List[AttachmentParameterPrototype] attachment_parameters: (optional) - The profile parameters for the attachment. - :param LastScan last_scan: (optional) The details of the last scan of an - attachment. - :param datetime next_scan_time: (optional) The start time of the next scan. - :param str name: (optional) The name of the attachment. - :param str description: (optional) The description for the attachment. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str provider_type_id: The provider type ID. :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 `AttachmentItem` object + :rtype: DetailedResponse with `dict` result representing a `ProviderType` object """ - if not attachment_id: - raise ValueError('attachment_id must be provided') - if not profile_id: - raise ValueError('profile_id must be provided') - if scope is not None: - scope = [convert_model(x) for x in scope] - if created_on is not None: - created_on = datetime_to_string(created_on) - if updated_on is not None: - updated_on = datetime_to_string(updated_on) - if notifications is not None: - notifications = convert_model(notifications) - if attachment_parameters is not None: - attachment_parameters = [convert_model(x) for x in attachment_parameters] - if last_scan is not None: - last_scan = convert_model(last_scan) - if next_scan_time is not None: - next_scan_time = datetime_to_string(next_scan_time) - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not provider_type_id: + raise ValueError('provider_type_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='replace_profile_attachment', + operation_id='get_provider_type_by_id', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'provider_type_id'] + path_param_values = self.encode_path_vars(instance_id, provider_type_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/provider_types/{provider_type_id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + ######################### + # providerTypeInstance + ######################### + + def create_provider_type_instance( + self, + instance_id: str, + provider_type_id: str, + *, + name: Optional[str] = None, + attributes: Optional[dict] = None, + **kwargs, + ) -> DetailedResponse: + """ + Create a provider type instance. + + Create an instance of a provider type. For more information about integrations, + see [Connecting Workload + Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str provider_type_id: The provider type ID. + :param str name: (optional) The provider type instance name. + :param dict attributes: (optional) The attributes for connecting to the + provider type instance. + :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 `ProviderTypeInstance` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not provider_type_id: + raise ValueError('provider_type_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='create_provider_type_instance', ) headers.update(sdk_headers) data = { - 'id': id, - 'profile_id': profile_id, - 'account_id': account_id, - 'instance_id': instance_id, - 'scope': scope, - 'created_on': created_on, - 'created_by': created_by, - 'updated_on': updated_on, - 'updated_by': updated_by, - 'status': status, - 'schedule': schedule, - 'notifications': notifications, - 'attachment_parameters': attachment_parameters, - 'last_scan': last_scan, - 'next_scan_time': next_scan_time, 'name': name, - 'description': description, + 'attributes': attributes, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -1955,12 +1816,12 @@ def replace_profile_attachment( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['attachment_id', 'profile_id'] - path_param_values = self.encode_path_vars(attachment_id, profile_id) + path_param_keys = ['instance_id', 'provider_type_id'] + path_param_values = self.encode_path_vars(instance_id, provider_type_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/profiles/{profile_id}/attachments/{attachment_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances'.format(**path_param_dict) request = self.prepare_request( - method='PUT', + method='POST', url=url, headers=headers, data=data, @@ -1969,50 +1830,159 @@ def replace_profile_attachment( response = self.send(request, **kwargs) return response - def create_scan( + def list_provider_type_instances( self, - attachment_id: str, + instance_id: str, + provider_type_id: str, + **kwargs, + ) -> DetailedResponse: + """ + List instances of a specific provider type. + + Retrieve all instances of a provider type. For more information about + integrations, see [Connecting Workload + Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str provider_type_id: The provider type ID. + :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 `ProviderTypeInstanceCollection` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not provider_type_id: + raise ValueError('provider_type_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='list_provider_type_instances', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'provider_type_id'] + path_param_values = self.encode_path_vars(instance_id, provider_type_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def get_provider_type_instance( + self, + instance_id: str, + provider_type_id: str, + provider_type_instance_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Get a provider type instance. + + Retrieve a provider type instance by specifying the provider type ID, and Security + and Compliance Center instance ID. For more information about integrations, see + [Connecting Workload + Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str provider_type_id: The provider type ID. + :param str provider_type_instance_id: The provider type instance ID. + :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 `ProviderTypeInstance` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not provider_type_id: + raise ValueError('provider_type_id must be provided') + if not provider_type_instance_id: + raise ValueError('provider_type_instance_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='get_provider_type_instance', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'provider_type_id', 'provider_type_instance_id'] + path_param_values = self.encode_path_vars(instance_id, provider_type_id, provider_type_instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def update_provider_type_instance( + self, + instance_id: str, + provider_type_id: str, + provider_type_instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + name: Optional[str] = None, + attributes: Optional[dict] = None, **kwargs, ) -> DetailedResponse: """ - Create a scan. + Update a provider type instance. - Create a scan to evaluate your resources on a recurring basis or on demand. - - :param str attachment_id: The attachment ID of a profile. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. + Update a provider type instance. For more information about integrations, see + [Connecting Workload + Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str provider_type_id: The provider type ID. + :param str provider_type_instance_id: The provider type instance ID. + :param str name: (optional) The provider type instance name. + :param dict attributes: (optional) The attributes for connecting to the + provider type instance. :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 `Scan` object + :rtype: DetailedResponse with `dict` result representing a `ProviderTypeInstance` object """ - if attachment_id is None: - raise ValueError('attachment_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not provider_type_id: + raise ValueError('provider_type_id must be provided') + if not provider_type_instance_id: + raise ValueError('provider_type_instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='create_scan', + operation_id='update_provider_type_instance', ) headers.update(sdk_headers) data = { - 'attachment_id': attachment_id, + 'name': name, + 'attributes': attributes, } data = {k: v for (k, v) in data.items() if v is not None} data = json.dumps(data) @@ -2023,9 +1993,12 @@ def create_scan( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/scans' + path_param_keys = ['instance_id', 'provider_type_id', 'provider_type_instance_id'] + path_param_values = self.encode_path_vars(instance_id, provider_type_id, provider_type_instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='PATCH', url=url, headers=headers, data=data, @@ -2034,104 +2007,80 @@ def create_scan( response = self.send(request, **kwargs) return response - def list_attachments_account( + def delete_provider_type_instance( self, - *, - x_correlation_id: str = None, - x_request_id: str = None, - limit: int = None, - start: str = None, + instance_id: str, + provider_type_id: str, + provider_type_instance_id: str, **kwargs, ) -> DetailedResponse: """ - Get all attachments in an instance. - - View all of the attachments that are linked to an account. An attachment is the - association between the set of resources that you want to evaluate and a profile - that contains the specific controls that you want to use. For more information, - see [Running an evaluation for IBM - Cloud](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-scan-resources). - - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param int limit: (optional) The indication of how many resources to - return, unless the response is the last page of resources. - :param str start: (optional) Determine what resource to start the page on - or after. + Delete a provider type instance. + + Remove a provider type instance. For more information about integrations, see + [Connecting Workload + Protection](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str provider_type_id: The provider type ID. + :param str provider_type_instance_id: The provider type instance ID. :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 `AttachmentCollection` object + :rtype: DetailedResponse """ - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not provider_type_id: + raise ValueError('provider_type_id must be provided') + if not provider_type_instance_id: + raise ValueError('provider_type_instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='list_attachments_account', + operation_id='delete_provider_type_instance', ) headers.update(sdk_headers) - params = { - 'limit': limit, - 'start': start, - } - if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] - headers['Accept'] = 'application/json' - url = '/attachments' + path_param_keys = ['instance_id', 'provider_type_id', 'provider_type_instance_id'] + path_param_values = self.encode_path_vars(instance_id, provider_type_id, provider_type_instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='DELETE', url=url, headers=headers, - params=params, ) response = self.send(request, **kwargs) return response ######################### - # Reports + # report ######################### def get_latest_reports( self, + instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - sort: str = None, + sort: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Get the latest reports. + List latest reports. Retrieve the latest reports, which are grouped by profile ID, scope ID, and attachment ID. For more information, see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str sort: (optional) This field sorts results by using a valid sort field. To learn more, see [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). @@ -2140,10 +2089,9 @@ def get_latest_reports( :rtype: DetailedResponse with `dict` result representing a `ReportLatest` object """ - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2160,7 +2108,10 @@ def get_latest_reports( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/reports/latest' + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/reports/latest'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2173,16 +2124,15 @@ def get_latest_reports( def list_reports( self, + instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - attachment_id: str = None, - group_id: str = None, - profile_id: str = None, - type: str = None, - start: str = None, - limit: int = None, - sort: str = None, + attachment_id: Optional[str] = None, + group_id: Optional[str] = None, + profile_id: Optional[str] = None, + type: Optional[str] = None, + start: Optional[str] = None, + limit: Optional[int] = None, + sort: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -2192,16 +2142,8 @@ def list_reports( information, see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str attachment_id: (optional) The ID of the attachment. :param str group_id: (optional) The report group ID. :param str profile_id: (optional) The ID of the profile. @@ -2215,13 +2157,12 @@ def list_reports( [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). :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 `ReportPage` object + :rtype: DetailedResponse with `dict` result representing a `ReportCollection` object """ - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2244,7 +2185,10 @@ def list_reports( del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/reports' + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/reports'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2258,28 +2202,24 @@ def list_reports( def get_report( self, report_id: str, + instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get a report. - Retrieve a report by specifying its ID. For more information, see [Viewing + Retrieve a specified report and filter the report details by the specified scope + ID and/or subscope ID. For more information, see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the subscope. :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 `Report` object @@ -2287,10 +2227,9 @@ def get_report( if not report_id: raise ValueError('report_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2298,19 +2237,25 @@ def get_report( ) headers.update(sdk_headers) + params = { + 'scope_id': scope_id, + 'subscope_id': subscope_id, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['report_id'] - path_param_values = self.encode_path_vars(report_id) + path_param_keys = ['report_id', 'instance_id'] + path_param_values = self.encode_path_vars(report_id, instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) @@ -2318,10 +2263,8 @@ def get_report( def get_report_summary( self, + instance_id: str, report_id: str, - *, - x_correlation_id: str = None, - x_request_id: str = None, **kwargs, ) -> DetailedResponse: """ @@ -2331,28 +2274,19 @@ def get_report_summary( see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. :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 `ReportSummary` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not report_id: raise ValueError('report_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2365,10 +2299,10 @@ def get_report_summary( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['report_id'] - path_param_values = self.encode_path_vars(report_id) + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}/summary'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/summary'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2378,33 +2312,27 @@ def get_report_summary( response = self.send(request, **kwargs) return response - def get_report_evaluation( + def get_report_download_file( self, + instance_id: str, report_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - exclude_summary: bool = None, + accept: Optional[str] = None, + exclude_summary: Optional[bool] = None, **kwargs, ) -> DetailedResponse: """ Get report evaluation details. - Retrieve the evaluation details of a report by specifying the report ID. For more - information, see [Viewing + Download a .csv file to inspect the evaluation details of a specified report. For + more information, see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str accept: (optional) The type of the response: application/csv or + application/pdf. :param bool exclude_summary: (optional) The indication of whether report summary metadata must be excluded. :param dict headers: A `dict` containing the request headers @@ -2412,16 +2340,17 @@ def get_report_evaluation( :rtype: DetailedResponse with `BinaryIO` result """ + if not instance_id: + raise ValueError('instance_id must be provided') if not report_id: raise ValueError('report_id must be provided') headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, + 'Accept': accept, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_report_evaluation', + operation_id='get_report_download_file', ) headers.update(sdk_headers) @@ -2432,12 +2361,11 @@ def get_report_evaluation( if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] - headers['Accept'] = 'application/csv' - path_param_keys = ['report_id'] - path_param_values = self.encode_path_vars(report_id) + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}/download'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/download'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2450,16 +2378,17 @@ def get_report_evaluation( def get_report_controls( self, + instance_id: str, report_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - control_id: str = None, - control_name: str = None, - control_description: str = None, - control_category: str = None, - status: str = None, - sort: str = None, + control_id: Optional[str] = None, + control_name: Optional[str] = None, + control_description: Optional[str] = None, + control_category: Optional[str] = None, + status: Optional[str] = None, + sort: Optional[str] = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -2469,17 +2398,9 @@ def get_report_controls( information, see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. :param str control_id: (optional) The ID of the control. :param str control_name: (optional) The name of the control. :param str control_description: (optional) The description of the control. @@ -2488,17 +2409,18 @@ def get_report_controls( :param str sort: (optional) This field sorts controls by using a valid sort field. To learn more, see [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the subscope. :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 `ReportControls` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not report_id: raise ValueError('report_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2513,6 +2435,8 @@ def get_report_controls( 'control_category': control_category, 'status': status, 'sort': sort, + 'scope_id': scope_id, + 'subscope_id': subscope_id, } if 'headers' in kwargs: @@ -2520,10 +2444,10 @@ def get_report_controls( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['report_id'] - path_param_values = self.encode_path_vars(report_id) + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}/controls'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/controls'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2536,11 +2460,9 @@ def get_report_controls( def get_report_rule( self, + instance_id: str, report_id: str, rule_id: str, - *, - x_correlation_id: str = None, - x_request_id: str = None, **kwargs, ) -> DetailedResponse: """ @@ -2550,31 +2472,22 @@ def get_report_rule( see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str report_id: The ID of the scan that is associated with a report. - :param str rule_id: The ID of a rule in a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. + :param str rule_id: The ID of a rule/assessment. :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 `RuleInfo` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not report_id: raise ValueError('report_id must be provided') if not rule_id: raise ValueError('rule_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2587,10 +2500,10 @@ def get_report_rule( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['report_id', 'rule_id'] - path_param_values = self.encode_path_vars(report_id, rule_id) + path_param_keys = ['instance_id', 'report_id', 'rule_id'] + path_param_values = self.encode_path_vars(instance_id, report_id, rule_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}/rules/{rule_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/rules/{rule_id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2602,17 +2515,21 @@ def get_report_rule( def list_report_evaluations( self, + instance_id: str, report_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - assessment_id: str = None, - component_id: str = None, - target_id: str = None, - target_name: str = None, - status: str = None, - start: str = None, - limit: int = None, + assessment_id: Optional[str] = None, + assessment_method: Optional[str] = None, + component_id: Optional[str] = None, + target_id: Optional[str] = None, + target_env: Optional[str] = None, + target_name: Optional[str] = None, + status: Optional[str] = None, + start: Optional[str] = None, + limit: Optional[int] = None, + sort: Optional[str] = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -2622,37 +2539,35 @@ def list_report_evaluations( information, see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. :param str assessment_id: (optional) The ID of the assessment. + :param str assessment_method: (optional) The assessment method. :param str component_id: (optional) The ID of component. :param str target_id: (optional) The ID of the evaluation target. + :param str target_env: (optional) The environment of the evaluation target. :param str target_name: (optional) The name of the evaluation target. :param str status: (optional) The evaluation status value. :param str start: (optional) The indication of what resource to start the page on. :param int limit: (optional) The indication of many resources to return, unless the response is the last page of resources. + :param str sort: (optional) This field sorts results by using a valid sort + field. To learn more, see + [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the subscope. :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 `EvaluationPage` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not report_id: raise ValueError('report_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2662,12 +2577,17 @@ def list_report_evaluations( params = { 'assessment_id': assessment_id, + 'assessment_method': assessment_method, 'component_id': component_id, 'target_id': target_id, + 'target_env': target_env, 'target_name': target_name, 'status': status, 'start': start, 'limit': limit, + 'sort': sort, + 'scope_id': scope_id, + 'subscope_id': subscope_id, } if 'headers' in kwargs: @@ -2675,10 +2595,10 @@ def list_report_evaluations( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['report_id'] - path_param_values = self.encode_path_vars(report_id) + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}/evaluations'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/evaluations'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2691,18 +2611,19 @@ def list_report_evaluations( def list_report_resources( self, + instance_id: str, report_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - id: str = None, - resource_name: str = None, - account_id: str = None, - component_id: str = None, - status: str = None, - sort: str = None, - start: str = None, - limit: int = None, + id: Optional[str] = None, + resource_name: Optional[str] = None, + account_id: Optional[str] = None, + component_id: Optional[str] = None, + status: Optional[str] = None, + sort: Optional[str] = None, + start: Optional[str] = None, + limit: Optional[int] = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -2712,20 +2633,12 @@ def list_report_resources( see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. :param str id: (optional) The ID of the resource. :param str resource_name: (optional) The name of the resource. - :param str account_id: (optional) The ID of the account owning a resource. + :param str account_id: (optional) The user account ID. :param str component_id: (optional) The ID of component. :param str status: (optional) The compliance status value. :param str sort: (optional) This field sorts resources by using a valid @@ -2735,17 +2648,18 @@ def list_report_resources( page on. :param int limit: (optional) The indication of many resources to return, unless the response is the last page of resources. + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the subscope. :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 `ResourcePage` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not report_id: raise ValueError('report_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2762,6 +2676,8 @@ def list_report_resources( 'sort': sort, 'start': start, 'limit': limit, + 'scope_id': scope_id, + 'subscope_id': subscope_id, } if 'headers' in kwargs: @@ -2769,10 +2685,10 @@ def list_report_resources( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['report_id'] - path_param_values = self.encode_path_vars(report_id) + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}/resources'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/resources'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2785,41 +2701,30 @@ def list_report_resources( def get_report_tags( self, + instance_id: str, report_id: str, - *, - x_correlation_id: str = None, - x_request_id: str = None, **kwargs, ) -> DetailedResponse: """ - Get report tags. + List report tags. Retrieve a list of tags for the specified report. For more information, see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. :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 `ReportTags` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not report_id: raise ValueError('report_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2832,10 +2737,10 @@ def get_report_tags( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['report_id'] - path_param_values = self.encode_path_vars(report_id) + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}/tags'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/tags'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2847,11 +2752,12 @@ def get_report_tags( def get_report_violations_drift( self, + instance_id: str, report_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, - scan_time_duration: int = None, + scan_time_duration: Optional[int] = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ @@ -2861,30 +2767,23 @@ def get_report_violations_drift( frame. For more information, see [Viewing results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + :param str instance_id: The ID of the Security and Compliance Center + instance. :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. :param int scan_time_duration: (optional) The duration of the `scan_time` timestamp in number of days. + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the subscope. :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 `ReportViolationsDrift` object """ + if not instance_id: + raise ValueError('instance_id must be provided') if not report_id: raise ValueError('report_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', @@ -2894,6 +2793,8 @@ def get_report_violations_drift( params = { 'scan_time_duration': scan_time_duration, + 'scope_id': scope_id, + 'subscope_id': subscope_id, } if 'headers' in kwargs: @@ -2901,10 +2802,10 @@ def get_report_violations_drift( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['report_id'] - path_param_values = self.encode_path_vars(report_id) + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/reports/{report_id}/violations_drift'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/violations_drift'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -2915,173 +2816,171 @@ def get_report_violations_drift( response = self.send(request, **kwargs) return response - ######################### - # Provider types - ######################### - - def list_provider_types( + def list_scan_reports( self, + instance_id: str, + report_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - List all provider types. - - List all the registered provider types. For more information about connecting - Workload Protection with the Security and Compliance Center, see [Connecting - Workload - Protection](/docs/security-compliance?topic=security-compliance-setup-workload-protection&interface=api#wp-register). - - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. + List scan reports. + + Get a list of scan reports and view the status of report generation in progress. + For more information, see [Viewing + results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str report_id: The ID of the scan that is associated with a report. + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the subscope. :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 `ProviderTypesCollection` object + :rtype: DetailedResponse with `dict` result representing a `ScanReportCollection` object """ - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not report_id: + raise ValueError('report_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='list_provider_types', + operation_id='list_scan_reports', ) headers.update(sdk_headers) + params = { + 'scope_id': scope_id, + 'subscope_id': subscope_id, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/provider_types' + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/reports/{report_id}/scan_reports'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - def get_provider_type_by_id( + def create_scan_report( self, - provider_type_id: str, + instance_id: str, + report_id: str, + format: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Get a provider type. + Create a scan report. - Retrieve a provider type by specifying its ID. For more information about - integrations, see [Connecting Workload - Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + Create a scan report for a specific scope or sub-scope. For more information, see + [Defining custom + rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - :param str provider_type_id: The provider type ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str report_id: The ID of the scan that is associated with a report. + :param str format: The enum of different report format types. + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the sub-scope. :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 `ProviderTypeItem` object + :rtype: DetailedResponse with `dict` result representing a `CreateScanReport` object """ - if not provider_type_id: - raise ValueError('provider_type_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not report_id: + raise ValueError('report_id must be provided') + if format is None: + raise ValueError('format must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_provider_type_by_id', + operation_id='create_scan_report', ) headers.update(sdk_headers) + data = { + 'format': format, + 'scope_id': scope_id, + 'subscope_id': subscope_id, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['provider_type_id'] - path_param_values = self.encode_path_vars(provider_type_id) + path_param_keys = ['instance_id', 'report_id'] + path_param_values = self.encode_path_vars(instance_id, report_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/provider_types/{provider_type_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/scan_reports'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='POST', url=url, headers=headers, + data=data, ) response = self.send(request, **kwargs) return response - ######################### - # Provider type instances - ######################### - - def list_provider_type_instances( + def get_scan_report( self, - provider_type_id: str, - *, - x_correlation_id: str = None, - x_request_id: str = None, + instance_id: str, + report_id: str, + job_id: str, **kwargs, ) -> DetailedResponse: """ - List all provider type instances. + Get a scan report. - Retrieve all instances of provider type. For more information about integrations, - see [Connecting Workload - Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + Retrieve the scan report by specifying the ID. For more information, see [Viewing + results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). - :param str provider_type_id: The provider type ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str report_id: The ID of the scan that is associated with a report. + :param str job_id: The ID of the scan_result. :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 `ProviderTypeInstancesResponse` object + :rtype: DetailedResponse with `dict` result representing a `ScanReport` object """ - if not provider_type_id: - raise ValueError('provider_type_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not report_id: + raise ValueError('report_id must be provided') + if not job_id: + raise ValueError('job_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='list_provider_type_instances', + operation_id='get_scan_report', ) headers.update(sdk_headers) @@ -3090,10 +2989,10 @@ def list_provider_type_instances( del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['provider_type_id'] - path_param_values = self.encode_path_vars(provider_type_id) + path_param_keys = ['instance_id', 'report_id', 'job_id'] + path_param_values = self.encode_path_vars(instance_id, report_id, job_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/provider_types/{provider_type_id}/provider_type_instances'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/scan_reports/{job_id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, @@ -3103,482 +3002,5970 @@ def list_provider_type_instances( response = self.send(request, **kwargs) return response - def create_provider_type_instance( + def get_scan_report_download_file( self, - provider_type_id: str, + instance_id: str, + report_id: str, + job_id: str, *, - name: str = None, - attributes: dict = None, - x_correlation_id: str = None, - x_request_id: str = None, + accept: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Create a provider type instance. + Get a scan report details. - Create an instance of a provider type. For more information about integrations, - see [Connecting Workload - Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + Download the scan report with evaluation details for the specified ID. For more + information, see [Viewing + results](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-results). - :param str provider_type_id: The provider type ID. - :param str name: (optional) The provider type instance name. - :param dict attributes: (optional) The attributes for connecting to the - provider type instance. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str report_id: The ID of the scan that is associated with a report. + :param str job_id: The ID of the scan_result. + :param str accept: (optional) The type of the response: application/csv or + application/pdf. :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 `ProviderTypeInstanceItem` object + :rtype: DetailedResponse with `BinaryIO` result """ - if not provider_type_id: - raise ValueError('provider_type_id must be provided') + if not instance_id: + raise ValueError('instance_id must be provided') + if not report_id: + raise ValueError('report_id must be provided') + if not job_id: + raise ValueError('job_id must be provided') headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, + 'Accept': accept, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='create_provider_type_instance', + operation_id='get_scan_report_download_file', ) headers.update(sdk_headers) - data = { - 'name': name, - 'attributes': attributes, - } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' - if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] - headers['Accept'] = 'application/json' - path_param_keys = ['provider_type_id'] - path_param_values = self.encode_path_vars(provider_type_id) + path_param_keys = ['instance_id', 'report_id', 'job_id'] + path_param_values = self.encode_path_vars(instance_id, report_id, job_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/provider_types/{provider_type_id}/provider_type_instances'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/reports/{report_id}/scan_reports/{job_id}/download'.format(**path_param_dict) request = self.prepare_request( - method='POST', + method='GET', url=url, headers=headers, - data=data, ) + response = self.send(request, **kwargs) return response - def delete_provider_type_instance( + ######################### + # rule + ######################### + + def list_rules( self, - provider_type_id: str, - provider_type_instance_id: str, + instance_id: str, *, - x_correlation_id: str = None, - x_request_id: str = None, + limit: Optional[int] = None, + start: Optional[str] = None, + type: Optional[str] = None, + search: Optional[str] = None, + service_name: Optional[str] = None, + sort: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ - Remove a specific instance of a provider type. + Get all rules. - Remove a specific instance of a provider type. + Retrieve all the rules that you use to target the exact configuration properties + that you need to ensure are compliant. For more information, see [Defining custom + rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - :param str provider_type_id: The provider type ID. - :param str provider_type_instance_id: The provider type instance ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param int limit: (optional) The indication of how many resources to + return, unless the response is the last page of resources. + :param str start: (optional) Determine what resource to start the page on + or after. + :param str type: (optional) The list of only user-defined, or + system-defined rules. + :param str search: (optional) The indication of whether to search for rules + with a specific string string in the name, description, or labels. + :param str service_name: (optional) Searches for rules targeting + corresponding service. + :param str sort: (optional) Field used to sort rules. Rules can be sorted + in ascending or descending order. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. - :rtype: DetailedResponse + :rtype: DetailedResponse with `dict` result representing a `RuleCollection` object """ - if not provider_type_id: - raise ValueError('provider_type_id must be provided') - if not provider_type_instance_id: - raise ValueError('provider_type_instance_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='delete_provider_type_instance', + operation_id='list_rules', ) headers.update(sdk_headers) + params = { + 'limit': limit, + 'start': start, + 'type': type, + 'search': search, + 'service_name': service_name, + 'sort': sort, + } + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] + headers['Accept'] = 'application/json' - path_param_keys = ['provider_type_id', 'provider_type_instance_id'] - path_param_values = self.encode_path_vars(provider_type_id, provider_type_instance_id) + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/rules'.format(**path_param_dict) request = self.prepare_request( - method='DELETE', + method='GET', url=url, headers=headers, + params=params, ) response = self.send(request, **kwargs) return response - def get_provider_type_instance( + def create_rule( self, - provider_type_id: str, - provider_type_instance_id: str, + instance_id: str, + description: str, + target: 'RuleTargetPrototype', + required_config: 'RequiredConfig', *, - x_correlation_id: str = None, - x_request_id: str = None, + version: Optional[str] = None, + import_: Optional['Import'] = None, + labels: Optional[List[str]] = None, **kwargs, ) -> DetailedResponse: """ - List a provider type instance. + Create a custom rule. - Retrieve a provider type instance by specifying the provider type ID, and Security - and Compliance Center instance ID. For more information about integrations, see - [Connecting Workload - Protection](https://test.cloud.ibm.com/docs/security-compliance?topic=security-compliance-setup-workload-protection). + Create a custom rule to to target the exact configuration properties that you + need to evaluate your resources for compliance. For more information, see + [Defining custom + rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - :param str provider_type_id: The provider type ID. - :param str provider_type_instance_id: The provider type instance ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str description: The rule description. + :param RuleTargetPrototype target: The rule target. + :param RequiredConfig required_config: The required configurations for a + Rule. + :param str version: (optional) The rule version number. + :param Import import_: (optional) The collection of import parameters. + :param List[str] labels: (optional) The list of labels that correspond to a + rule. :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 `ProviderTypeInstanceItem` object + :rtype: DetailedResponse with `dict` result representing a `Rule` object """ - if not provider_type_id: - raise ValueError('provider_type_id must be provided') - if not provider_type_instance_id: - raise ValueError('provider_type_instance_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if description is None: + raise ValueError('description must be provided') + if target is None: + raise ValueError('target must be provided') + if required_config is None: + raise ValueError('required_config must be provided') + target = convert_model(target) + required_config = convert_model(required_config) + if import_ is not None: + import_ = convert_model(import_) + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_provider_type_instance', + operation_id='create_rule', ) headers.update(sdk_headers) + data = { + 'description': description, + 'target': target, + 'required_config': required_config, + 'version': version, + 'import': import_, + 'labels': labels, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['provider_type_id', 'provider_type_instance_id'] - path_param_values = self.encode_path_vars(provider_type_id, provider_type_instance_id) + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/rules'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='POST', url=url, headers=headers, + data=data, ) response = self.send(request, **kwargs) return response - def update_provider_type_instance( + def get_rule( self, - provider_type_id: str, - provider_type_instance_id: str, - *, - name: str = None, - attributes: dict = None, - x_correlation_id: str = None, - x_request_id: str = None, + instance_id: str, + rule_id: str, **kwargs, ) -> DetailedResponse: """ - Patch a specific instance of a provider type. + Get a custom rule. - Patch a specific instance of a provider type. + Retrieve a rule that you created to evaluate your resources. For more + information, see [Defining custom + rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - :param str provider_type_id: The provider type ID. - :param str provider_type_instance_id: The provider type instance ID. - :param str name: (optional) The provider type instance name. - :param dict attributes: (optional) The attributes for connecting to the - provider type instance. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str rule_id: The ID of a rule/assessment. :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 `ProviderTypeInstanceItem` object + :rtype: DetailedResponse with `dict` result representing a `Rule` object """ - if not provider_type_id: - raise ValueError('provider_type_id must be provided') - if not provider_type_instance_id: - raise ValueError('provider_type_instance_id must be provided') - headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, - } + if not instance_id: + raise ValueError('instance_id must be provided') + if not rule_id: + raise ValueError('rule_id must be provided') + headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='update_provider_type_instance', + operation_id='get_rule', ) headers.update(sdk_headers) - data = { - 'name': name, - 'attributes': attributes, - } - data = {k: v for (k, v) in data.items() if v is not None} - data = json.dumps(data) - headers['content-type'] = 'application/json' - if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - path_param_keys = ['provider_type_id', 'provider_type_instance_id'] - path_param_values = self.encode_path_vars(provider_type_id, provider_type_instance_id) + path_param_keys = ['instance_id', 'rule_id'] + path_param_values = self.encode_path_vars(instance_id, rule_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) - url = '/provider_types/{provider_type_id}/provider_type_instances/{provider_type_instance_id}'.format(**path_param_dict) + url = '/instances/{instance_id}/v3/rules/{rule_id}'.format(**path_param_dict) request = self.prepare_request( - method='PATCH', + method='GET', url=url, headers=headers, - data=data, ) response = self.send(request, **kwargs) return response - def get_provider_types_instances( + def replace_rule( self, + instance_id: str, + rule_id: str, + if_match: str, + description: str, + target: 'RuleTargetPrototype', + required_config: 'RequiredConfig', *, - x_correlation_id: str = None, - x_request_id: str = None, + version: Optional[str] = None, + import_: Optional['Import'] = None, + labels: Optional[List[str]] = None, **kwargs, ) -> DetailedResponse: """ - Get a list of instances for all provider types. + Update a custom rule. - Get a list of instances for all provider types. + Update a custom rule that you use to target the exact configuration properties + that you need to evaluate your resources for compliance. For more information, see + [Defining custom + rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this headers is not supplied - in a request, the service generates a random (version 4) UUID. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str rule_id: The ID of a rule/assessment. + :param str if_match: This field compares a supplied `Etag` value with the + version that is stored for the requested resource. If the values match, the + server allows the request method to continue. + To find the `Etag` value, run a GET request on the resource that you want + to modify, and check the response headers. + :param str description: The rule description. + :param RuleTargetPrototype target: The rule target. + :param RequiredConfig required_config: The required configurations for a + Rule. + :param str version: (optional) The rule version number. + :param Import import_: (optional) The collection of import parameters. + :param List[str] labels: (optional) The list of labels that correspond to a + rule. :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 `ProviderTypesInstancesResponse` object + :rtype: DetailedResponse with `dict` result representing a `Rule` object """ + if not instance_id: + raise ValueError('instance_id must be provided') + if not rule_id: + raise ValueError('rule_id must be provided') + if not if_match: + raise ValueError('if_match must be provided') + if description is None: + raise ValueError('description must be provided') + if target is None: + raise ValueError('target must be provided') + if required_config is None: + raise ValueError('required_config must be provided') + target = convert_model(target) + required_config = convert_model(required_config) + if import_ is not None: + import_ = convert_model(import_) headers = { - 'X-Correlation-ID': x_correlation_id, - 'X-Request-ID': x_request_id, + 'If-Match': if_match, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V3', - operation_id='get_provider_types_instances', + operation_id='replace_rule', ) headers.update(sdk_headers) + data = { + 'description': description, + 'target': target, + 'required_config': required_config, + 'version': version, + 'import': import_, + 'labels': labels, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' - url = '/provider_types_instances' + path_param_keys = ['instance_id', 'rule_id'] + path_param_values = self.encode_path_vars(instance_id, rule_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/rules/{rule_id}'.format(**path_param_dict) request = self.prepare_request( - method='GET', + method='PUT', url=url, headers=headers, + data=data, ) response = self.send(request, **kwargs) return response + def delete_rule( + self, + instance_id: str, + rule_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Delete a custom rule. -class ListReportsEnums: - """ - Enums for list_reports parameters. - """ + Delete a custom rule that you no longer require to evaluate your resources. For + more information, see [Defining custom + rules](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-rules-define). - class Type(str, Enum): - """ - The type of the scan. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str rule_id: The ID of a rule/assessment. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse """ - ONDEMAND = 'ondemand' - SCHEDULED = 'scheduled' + if not instance_id: + raise ValueError('instance_id must be provided') + if not rule_id: + raise ValueError('rule_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='delete_rule', + ) + headers.update(sdk_headers) + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] -class GetReportControlsEnums: - """ - Enums for get_report_controls parameters. - """ + path_param_keys = ['instance_id', 'rule_id'] + path_param_values = self.encode_path_vars(instance_id, rule_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/rules/{rule_id}'.format(**path_param_dict) + request = self.prepare_request( + method='DELETE', + url=url, + headers=headers, + ) - class Status(str, Enum): - """ - The compliance status value. - """ + response = self.send(request, **kwargs) + return response - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' - class Sort(str, Enum): - """ - This field sorts controls by using a valid sort field. To learn more, see - [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + ######################### + # scope + ######################### + + def create_scope( + self, + instance_id: str, + *, + name: Optional[str] = None, + description: Optional[str] = None, + environment: Optional[str] = None, + properties: Optional[List['ScopeProperty']] = None, + **kwargs, + ) -> DetailedResponse: """ + Create a scope. - CONTROL_NAME = 'control_name' - CONTROL_CATEGORY = 'control_category' - STATUS = 'status' + Create a scope. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str name: (optional) The scope name. + :param str description: (optional) The scope description. + :param str environment: (optional) The scope environment. + :param List[ScopeProperty] properties: (optional) The properties that are + supported for scoping by this environment. + :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 `Scope` object + """ -class ListReportEvaluationsEnums: - """ - Enums for list_report_evaluations parameters. - """ + if not instance_id: + raise ValueError('instance_id must be provided') + if properties is not None: + properties = [convert_model(x) for x in properties] + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='create_scope', + ) + headers.update(sdk_headers) - class Status(str, Enum): - """ - The evaluation status value. - """ + data = { + 'name': name, + 'description': description, + 'environment': environment, + 'properties': properties, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' - PASS = 'pass' - FAILURE = 'failure' - ERROR = 'error' - SKIPPED = 'skipped' + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes'.format(**path_param_dict) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + data=data, + ) -class ListReportResourcesEnums: - """ - Enums for list_report_resources parameters. - """ + response = self.send(request, **kwargs) + return response - class Status(str, Enum): - """ - The compliance status value. + def list_scopes( + self, + instance_id: str, + *, + limit: Optional[int] = None, + start: Optional[str] = None, + name: Optional[str] = None, + description: Optional[str] = None, + environment: Optional[str] = None, + **kwargs, + ) -> DetailedResponse: """ + Get all scopes. - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' - class Sort(str, Enum): - """ - This field sorts resources by using a valid sort field. To learn more, see - [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). - """ + Get all scopes. - ACCOUNT_ID = 'account_id' - COMPONENT_ID = 'component_id' - RESOURCE_NAME = 'resource_name' - STATUS = 'status' + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param int limit: (optional) The indication of how many resources to + return, unless the response is the last page of resources. + :param str start: (optional) Determine what resource to start the page on + or after. + :param str name: (optional) determine name of scope returned in response. + :param str description: (optional) determine descriptions of scope returned + in response. + :param str environment: (optional) determine environment of scopes returned + in response. + :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 `ScopeCollection` object + """ + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='list_scopes', + ) + headers.update(sdk_headers) -############################################################################## -# Models -############################################################################## + params = { + 'limit': limit, + 'start': start, + 'name': name, + 'description': description, + 'environment': environment, + } + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' -class Account: - """ - The account that is associated with a report. + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) - :attr str id: (optional) The account ID. - :attr str name: (optional) The account name. - :attr str type: (optional) The account type. - """ + response = self.send(request, **kwargs) + return response - def __init__( + def update_scope( self, + instance_id: str, + scope_id: str, *, - id: str = None, - name: str = None, - type: str = None, - ) -> None: - """ + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs, + ) -> DetailedResponse: + """ + Update a scope. + + Update the details of a scope. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :param str name: (optional) The scope name. + :param str description: (optional) The scope description. + :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 `Scope` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not scope_id: + raise ValueError('scope_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='update_scope', + ) + headers.update(sdk_headers) + + data = { + 'name': name, + 'description': description, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'scope_id'] + path_param_values = self.encode_path_vars(instance_id, scope_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes/{scope_id}'.format(**path_param_dict) + request = self.prepare_request( + method='PATCH', + url=url, + headers=headers, + data=data, + ) + + response = self.send(request, **kwargs) + return response + + def get_scope( + self, + instance_id: str, + scope_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Get a scope. + + Get a scope by specifying the scope ID. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :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 `Scope` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not scope_id: + raise ValueError('scope_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='get_scope', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'scope_id'] + path_param_values = self.encode_path_vars(instance_id, scope_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes/{scope_id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def delete_scope( + self, + instance_id: str, + scope_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Delete a scope. + + Delete a scope by specifying the scope ID. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not scope_id: + raise ValueError('scope_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='delete_scope', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + + path_param_keys = ['instance_id', 'scope_id'] + path_param_values = self.encode_path_vars(instance_id, scope_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes/{scope_id}'.format(**path_param_dict) + request = self.prepare_request( + method='DELETE', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def create_subscope( + self, + instance_id: str, + scope_id: str, + subscopes: List['ScopePrototype'], + **kwargs, + ) -> DetailedResponse: + """ + Create a subscope. + + Create a subscope. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :param List[ScopePrototype] subscopes: The array of subscopes. + :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 `SubScopeResponse` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not scope_id: + raise ValueError('scope_id must be provided') + if subscopes is None: + raise ValueError('subscopes must be provided') + subscopes = [convert_model(x) for x in subscopes] + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='create_subscope', + ) + headers.update(sdk_headers) + + data = { + 'subscopes': subscopes, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'scope_id'] + path_param_values = self.encode_path_vars(instance_id, scope_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes/{scope_id}/subscopes'.format(**path_param_dict) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + data=data, + ) + + response = self.send(request, **kwargs) + return response + + def list_subscopes( + self, + instance_id: str, + scope_id: str, + *, + limit: Optional[int] = None, + start: Optional[str] = None, + name: Optional[str] = None, + description: Optional[str] = None, + environment: Optional[str] = None, + **kwargs, + ) -> DetailedResponse: + """ + Get all subscopes. + + Get all subscopes. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :param int limit: (optional) The indication of how many resources to + return, unless the response is the last page of resources. + :param str start: (optional) Determine what resource to start the page on + or after. + :param str name: (optional) determine name of subscope returned in + response. + :param str description: (optional) determine descriptions of subscopes + returned in response. + :param str environment: (optional) determine environment of subscopes + returned in response. + :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 `SubScopeCollection` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not scope_id: + raise ValueError('scope_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='list_subscopes', + ) + headers.update(sdk_headers) + + params = { + 'limit': limit, + 'start': start, + 'name': name, + 'description': description, + 'environment': environment, + } + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'scope_id'] + path_param_values = self.encode_path_vars(instance_id, scope_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes/{scope_id}/subscopes'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + params=params, + ) + + response = self.send(request, **kwargs) + return response + + def get_subscope( + self, + instance_id: str, + scope_id: str, + subscope_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Get a subscope. + + Get the subscope details. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :param str subscope_id: The ID of the scope being targeted. + :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 `SubScope` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not scope_id: + raise ValueError('scope_id must be provided') + if not subscope_id: + raise ValueError('subscope_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='get_subscope', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'scope_id', 'subscope_id'] + path_param_values = self.encode_path_vars(instance_id, scope_id, subscope_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes/{scope_id}/subscopes/{subscope_id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def update_subscope( + self, + instance_id: str, + scope_id: str, + subscope_id: str, + *, + name: Optional[str] = None, + description: Optional[str] = None, + **kwargs, + ) -> DetailedResponse: + """ + Update a subscope. + + Update the subscope details. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :param str subscope_id: The ID of the scope being targeted. + :param str name: (optional) The scope name. + :param str description: (optional) The scope description. + :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 `SubScope` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not scope_id: + raise ValueError('scope_id must be provided') + if not subscope_id: + raise ValueError('subscope_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='update_subscope', + ) + headers.update(sdk_headers) + + data = { + 'name': name, + 'description': description, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'scope_id', 'subscope_id'] + path_param_values = self.encode_path_vars(instance_id, scope_id, subscope_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes/{scope_id}/subscopes/{subscope_id}'.format(**path_param_dict) + request = self.prepare_request( + method='PATCH', + url=url, + headers=headers, + data=data, + ) + + response = self.send(request, **kwargs) + return response + + def delete_subscope( + self, + instance_id: str, + scope_id: str, + subscope_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Delete a subscope. + + Delete the subscope by specifying the subscope ID. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :param str subscope_id: The ID of the scope being targeted. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not scope_id: + raise ValueError('scope_id must be provided') + if not subscope_id: + raise ValueError('subscope_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='delete_subscope', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + + path_param_keys = ['instance_id', 'scope_id', 'subscope_id'] + path_param_values = self.encode_path_vars(instance_id, scope_id, subscope_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/scopes/{scope_id}/subscopes/{subscope_id}'.format(**path_param_dict) + request = self.prepare_request( + method='DELETE', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + ######################### + # service + ######################### + + def list_services( + self, + **kwargs, + ) -> DetailedResponse: + """ + List services. + + List all the services that you use to evaluate the configuration of your resources + for security and compliance. + [Learn + more](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scannable-components). + + :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 `ServiceCollection` object + """ + + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='list_services', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + url = '/v3/services' + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def get_service( + self, + services_name: str, + **kwargs, + ) -> DetailedResponse: + """ + Get a service. + + Retrieve a service configuration that you monitor. [Learn + more](https://cloud.ibm.com/docs/security-compliance?topic=security-compliance-scannable-components). + + :param str services_name: The name of the corresponding service. + :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 `Service` object + """ + + if not services_name: + raise ValueError('services_name must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='get_service', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['services_name'] + path_param_values = self.encode_path_vars(services_name) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/v3/services/{services_name}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + ######################### + # setting + ######################### + + def get_settings( + self, + instance_id: str, + **kwargs, + ) -> DetailedResponse: + """ + List settings. + + Retrieve the settings of your service instance. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :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 `Settings` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='get_settings', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/settings'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def update_settings( + self, + instance_id: str, + *, + object_storage: Optional['ObjectStoragePrototype'] = None, + event_notifications: Optional['EventNotificationsPrototype'] = None, + **kwargs, + ) -> DetailedResponse: + """ + Update settings. + + Update the settings of your service instance. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param ObjectStoragePrototype object_storage: (optional) The payload to + connect a Cloud Object Storage instance to an Security and Compliance + Center instance. + :param EventNotificationsPrototype event_notifications: (optional) The + payload to connect an Event Notification instance with a Security and + Compliance Center instance. + :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 `Settings` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if object_storage is not None: + object_storage = convert_model(object_storage) + if event_notifications is not None: + event_notifications = convert_model(event_notifications) + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='update_settings', + ) + headers.update(sdk_headers) + + data = { + 'object_storage': object_storage, + 'event_notifications': event_notifications, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/settings'.format(**path_param_dict) + request = self.prepare_request( + method='PATCH', + url=url, + headers=headers, + data=data, + ) + + response = self.send(request, **kwargs) + return response + + def post_test_event( + self, + instance_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Create a test event. + + Send a test event to your Event Notifications instance to ensure that the events + that are generated by Security and Compliance Center are being forwarded to Event + Notifications. For more information, see [Enabling event + notifications](/docs/security-compliance?topic=security-compliance-event-notifications#event-notifications-test-api). + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :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 `TestEvent` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='post_test_event', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/test_event'.format(**path_param_dict) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + ######################### + # target + ######################### + + def create_target( + self, + instance_id: str, + account_id: str, + trusted_profile_id: str, + name: str, + *, + credentials: Optional[List['Credential']] = None, + **kwargs, + ) -> DetailedResponse: + """ + Create a target. + + Creates a target to scan against. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str account_id: The target account ID. + :param str trusted_profile_id: The trusted profile ID. + :param str name: The target name. + :param List[Credential] credentials: (optional) Customer credential to + access for a specific service to scan. + :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 `Target` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if account_id is None: + raise ValueError('account_id must be provided') + if trusted_profile_id is None: + raise ValueError('trusted_profile_id must be provided') + if name is None: + raise ValueError('name must be provided') + if credentials is not None: + credentials = [convert_model(x) for x in credentials] + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='create_target', + ) + headers.update(sdk_headers) + + data = { + 'account_id': account_id, + 'trusted_profile_id': trusted_profile_id, + 'name': name, + 'credentials': credentials, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/targets'.format(**path_param_dict) + request = self.prepare_request( + method='POST', + url=url, + headers=headers, + data=data, + ) + + response = self.send(request, **kwargs) + return response + + def list_targets( + self, + instance_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Get a list of targets with pagination. + + Returns a list of targets. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :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 `TargetCollection` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='list_targets', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id'] + path_param_values = self.encode_path_vars(instance_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/targets'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def get_target( + self, + instance_id: str, + target_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Get a target by ID. + + Retrieves a target by its ID association. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str target_id: The target ID. + :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 `Target` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not target_id: + raise ValueError('target_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='get_target', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'target_id'] + path_param_values = self.encode_path_vars(instance_id, target_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/targets/{target_id}'.format(**path_param_dict) + request = self.prepare_request( + method='GET', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + def replace_target( + self, + instance_id: str, + target_id: str, + account_id: str, + trusted_profile_id: str, + name: str, + *, + credentials: Optional[List['Credential']] = None, + **kwargs, + ) -> DetailedResponse: + """ + replace a target by ID. + + Updates a target by its ID. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str target_id: The target ID. + :param str account_id: The target account ID. + :param str trusted_profile_id: The trusted profile ID. + :param str name: The target name. + :param List[Credential] credentials: (optional) Customer credential to + access for a specific service to scan. + :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 `Target` object + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not target_id: + raise ValueError('target_id must be provided') + if account_id is None: + raise ValueError('account_id must be provided') + if trusted_profile_id is None: + raise ValueError('trusted_profile_id must be provided') + if name is None: + raise ValueError('name must be provided') + if credentials is not None: + credentials = [convert_model(x) for x in credentials] + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='replace_target', + ) + headers.update(sdk_headers) + + data = { + 'account_id': account_id, + 'trusted_profile_id': trusted_profile_id, + 'name': name, + 'credentials': credentials, + } + data = {k: v for (k, v) in data.items() if v is not None} + data = json.dumps(data) + headers['content-type'] = 'application/json' + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + headers['Accept'] = 'application/json' + + path_param_keys = ['instance_id', 'target_id'] + path_param_values = self.encode_path_vars(instance_id, target_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/targets/{target_id}'.format(**path_param_dict) + request = self.prepare_request( + method='PUT', + url=url, + headers=headers, + data=data, + ) + + response = self.send(request, **kwargs) + return response + + def delete_target( + self, + instance_id: str, + target_id: str, + **kwargs, + ) -> DetailedResponse: + """ + Delete a target by ID. + + Deletes a target by the ID. + + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str target_id: The target ID. + :param dict headers: A `dict` containing the request headers + :return: A `DetailedResponse` containing the result, headers and HTTP status code. + :rtype: DetailedResponse + """ + + if not instance_id: + raise ValueError('instance_id must be provided') + if not target_id: + raise ValueError('target_id must be provided') + headers = {} + sdk_headers = get_sdk_headers( + service_name=self.DEFAULT_SERVICE_NAME, + service_version='V3', + operation_id='delete_target', + ) + headers.update(sdk_headers) + + if 'headers' in kwargs: + headers.update(kwargs.get('headers')) + del kwargs['headers'] + + path_param_keys = ['instance_id', 'target_id'] + path_param_values = self.encode_path_vars(instance_id, target_id) + path_param_dict = dict(zip(path_param_keys, path_param_values)) + url = '/instances/{instance_id}/v3/targets/{target_id}'.format(**path_param_dict) + request = self.prepare_request( + method='DELETE', + url=url, + headers=headers, + ) + + response = self.send(request, **kwargs) + return response + + +class ListInstanceAttachmentsEnums: + """ + Enums for list_instance_attachments parameters. + """ + + class Sort(str, Enum): + """ + The sorted collection of attachments. The available values are `created_on` and + `scope_type`. + """ + + CREATED_ON = 'created_on' + SCOPE_TYPE = 'scope_type' + class Direction(str, Enum): + """ + The collection of attachments that is sorted in ascending order. To sort the + collection in descending order, use the `DESC` schema. + """ + + DESC = 'desc' + ASC = 'asc' + + +class ListReportsEnums: + """ + Enums for list_reports parameters. + """ + + class Type(str, Enum): + """ + The type of the scan. + """ + + ONDEMAND = 'ondemand' + SCHEDULED = 'scheduled' + + +class GetReportDownloadFileEnums: + """ + Enums for get_report_download_file parameters. + """ + + class Accept(str, Enum): + """ + The type of the response: application/csv or application/pdf. + """ + + APPLICATION_CSV = 'application/csv' + APPLICATION_PDF = 'application/pdf' + + +class GetReportControlsEnums: + """ + Enums for get_report_controls parameters. + """ + + class Status(str, Enum): + """ + The compliance status value. + """ + + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' + class Sort(str, Enum): + """ + This field sorts controls by using a valid sort field. To learn more, see + [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + """ + + CONTROL_NAME = 'control_name' + CONTROL_CATEGORY = 'control_category' + STATUS = 'status' + + +class ListReportEvaluationsEnums: + """ + Enums for list_report_evaluations parameters. + """ + + class Status(str, Enum): + """ + The evaluation status value. + """ + + PASS = 'pass' + FAILURE = 'failure' + ERROR = 'error' + SKIPPED = 'skipped' + + +class ListReportResourcesEnums: + """ + Enums for list_report_resources parameters. + """ + + class Status(str, Enum): + """ + The compliance status value. + """ + + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' + class Sort(str, Enum): + """ + This field sorts resources by using a valid sort field. To learn more, see + [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + """ + + ACCOUNT_ID = 'account_id' + COMPONENT_ID = 'component_id' + RESOURCE_NAME = 'resource_name' + STATUS = 'status' + + +class GetScanReportDownloadFileEnums: + """ + Enums for get_scan_report_download_file parameters. + """ + + class Accept(str, Enum): + """ + The type of the response: application/csv or application/pdf. + """ + + APPLICATION_CSV = 'application/csv' + APPLICATION_PDF = 'application/pdf' + + +class ListRulesEnums: + """ + Enums for list_rules parameters. + """ + + class Type(str, Enum): + """ + The list of only user-defined, or system-defined rules. + """ + + USER_DEFINED = 'user_defined' + SYSTEM_DEFINED = 'system_defined' + class Sort(str, Enum): + """ + Field used to sort rules. Rules can be sorted in ascending or descending order. + """ + + DESCRIPTION = 'description' + SERVICE_DISPLAY_NAME = 'service_display_name' + TYPE = 'type' + UPDATED_ON = 'updated_on' + + +############################################################################## +# Models +############################################################################## + + +class Account: + """ + The account that is associated with a report. + + :param str id: (optional) The account ID. + :param str name: (optional) The account name. + :param str type: (optional) The account type. + """ + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + type: Optional[str] = None, + ) -> None: + """ Initialize a Account object. - :param str id: (optional) The account ID. - :param str name: (optional) The account name. - :param str type: (optional) The account type. + :param str id: (optional) The account ID. + :param str name: (optional) The account name. + :param str type: (optional) The account type. + """ + self.id = id + self.name = name + self.type = type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'Account': + """Initialize a Account object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + if (name := _dict.get('name')) is not None: + args['name'] = name + if (type := _dict.get('type')) is not None: + args['type'] = type + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Account 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, '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 + 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 Account object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'Account') -> 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: 'Account') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AdditionalDetails: + """ + Extended information for a report. + + :param str created_by: (optional) Identifies which entity created a report. + :param List[str] labels: (optional) Classification for a report. + :param List[Link] links: (optional) URL. + """ + + def __init__( + self, + *, + created_by: Optional[str] = None, + labels: Optional[List[str]] = None, + links: Optional[List['Link']] = None, + ) -> None: + """ + Initialize a AdditionalDetails object. + + :param str created_by: (optional) Identifies which entity created a report. + :param List[str] labels: (optional) Classification for a report. + :param List[Link] links: (optional) URL. + """ + self.created_by = created_by + self.labels = labels + self.links = links + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AdditionalDetails': + """Initialize a AdditionalDetails object from a json dictionary.""" + args = {} + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + if (labels := _dict.get('labels')) is not None: + args['labels'] = labels + if (links := _dict.get('links')) is not None: + args['links'] = [Link.from_dict(v) for v in links] + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AdditionalDetails 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, 'labels') and self.labels is not None: + _dict['labels'] = self.labels + 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): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this AdditionalDetails object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AdditionalDetails') -> 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: 'AdditionalDetails') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AdditionalProperty: + """ + AdditionalProperty. + + :param str type: An additional property that indicates the type of the attribute + in various formats (text, url, secret, label, masked). + :param str display_name: The name of the attribute that is displayed in the UI. + """ + + def __init__( + self, + type: str, + display_name: str, + ) -> None: + """ + Initialize a AdditionalProperty object. + + :param str type: An additional property that indicates the type of the + attribute in various formats (text, url, secret, label, masked). + :param str display_name: The name of the attribute that is displayed in the + UI. + """ + self.type = type + self.display_name = display_name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AdditionalProperty': + """Initialize a AdditionalProperty object from a json dictionary.""" + args = {} + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in AdditionalProperty JSON') + if (display_name := _dict.get('display_name')) is not None: + args['display_name'] = display_name + else: + raise ValueError('Required property \'display_name\' not present in AdditionalProperty JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AdditionalProperty 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, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'display_name') and self.display_name is not None: + _dict['display_name'] = self.display_name + 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 AdditionalProperty object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AdditionalProperty') -> 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: 'AdditionalProperty') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class TypeEnum(str, Enum): + """ + An additional property that indicates the type of the attribute in various formats + (text, url, secret, label, masked). + """ + + SECRET = 'secret' + LABEL = 'label' + URL = 'url' + TEXT = 'text' + MASKED = 'masked' + + + +class AdditionalTargetAttribute: + """ + The additional target attribute of the service. + + :param str name: (optional) The additional target attribute name. + :param str operator: The operator. + :param object value: (optional) + """ + + def __init__( + self, + operator: str, + *, + name: Optional[str] = None, + value: Optional[object] = None, + ) -> None: + """ + Initialize a AdditionalTargetAttribute object. + + :param str operator: The operator. + :param str name: (optional) The additional target attribute name. + :param object value: (optional) + """ + self.name = name + self.operator = operator + self.value = value + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AdditionalTargetAttribute': + """Initialize a AdditionalTargetAttribute object from a json dictionary.""" + args = {} + if (name := _dict.get('name')) is not None: + args['name'] = name + if (operator := _dict.get('operator')) is not None: + args['operator'] = operator + else: + raise ValueError('Required property \'operator\' not present in AdditionalTargetAttribute JSON') + if (value := _dict.get('value')) is not None: + args['value'] = value + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AdditionalTargetAttribute 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, 'name') and self.name is not None: + _dict['name'] = self.name + 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): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this AdditionalTargetAttribute object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AdditionalTargetAttribute') -> 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: 'AdditionalTargetAttribute') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class OperatorEnum(str, Enum): + """ + The operator. + """ + + STRING_EQUALS = 'string_equals' + STRING_NOT_EQUALS = 'string_not_equals' + STRING_MATCH = 'string_match' + STRING_NOT_MATCH = 'string_not_match' + STRING_CONTAINS = 'string_contains' + STRING_NOT_CONTAINS = 'string_not_contains' + NUM_EQUALS = 'num_equals' + NUM_NOT_EQUALS = 'num_not_equals' + NUM_LESS_THAN = 'num_less_than' + NUM_LESS_THAN_EQUALS = 'num_less_than_equals' + NUM_GREATER_THAN = 'num_greater_than' + NUM_GREATER_THAN_EQUALS = 'num_greater_than_equals' + IS_EMPTY = 'is_empty' + IS_NOT_EMPTY = 'is_not_empty' + IS_TRUE = 'is_true' + IS_FALSE = 'is_false' + STRINGS_IN_LIST = 'strings_in_list' + STRINGS_ALLOWED = 'strings_allowed' + STRINGS_REQUIRED = 'strings_required' + IPS_IN_RANGE = 'ips_in_range' + IPS_EQUALS = 'ips_equals' + IPS_NOT_EQUALS = 'ips_not_equals' + DAYS_LESS_THAN = 'days_less_than' + + + +class Assessment: + """ + The control specification assessment. + + :param str assessment_id: (optional) The assessment ID. + :param str assessment_type: (optional) The assessment type. + :param str assessment_method: (optional) The assessment method. + :param str assessment_description: (optional) The assessment description. + :param int parameter_count: (optional) The number of parameters of this + assessment. + :param List[Parameter] parameters: The list of parameters of this assessment. + """ + + def __init__( + self, + parameters: List['Parameter'], + *, + assessment_id: Optional[str] = None, + assessment_type: Optional[str] = None, + assessment_method: Optional[str] = None, + assessment_description: Optional[str] = None, + parameter_count: Optional[int] = None, + ) -> None: + """ + Initialize a Assessment object. + + :param List[Parameter] parameters: The list of parameters of this + assessment. + :param str assessment_id: (optional) The assessment ID. + :param str assessment_type: (optional) The assessment type. + :param str assessment_method: (optional) The assessment method. + :param str assessment_description: (optional) The assessment description. + :param int parameter_count: (optional) The number of parameters of this + assessment. + """ + self.assessment_id = assessment_id + self.assessment_type = assessment_type + self.assessment_method = assessment_method + self.assessment_description = assessment_description + self.parameter_count = parameter_count + self.parameters = parameters + + @classmethod + def from_dict(cls, _dict: Dict) -> 'Assessment': + """Initialize a Assessment object from a json dictionary.""" + args = {} + if (assessment_id := _dict.get('assessment_id')) is not None: + args['assessment_id'] = assessment_id + if (assessment_type := _dict.get('assessment_type')) is not None: + args['assessment_type'] = assessment_type + if (assessment_method := _dict.get('assessment_method')) is not None: + args['assessment_method'] = assessment_method + if (assessment_description := _dict.get('assessment_description')) is not None: + args['assessment_description'] = assessment_description + if (parameter_count := _dict.get('parameter_count')) is not None: + args['parameter_count'] = parameter_count + if (parameters := _dict.get('parameters')) is not None: + args['parameters'] = [Parameter.from_dict(v) for v in parameters] + else: + raise ValueError('Required property \'parameters\' not present in Assessment JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Assessment 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, 'assessment_id') and self.assessment_id is not None: + _dict['assessment_id'] = self.assessment_id + if hasattr(self, 'assessment_type') and self.assessment_type is not None: + _dict['assessment_type'] = self.assessment_type + if hasattr(self, 'assessment_method') and self.assessment_method is not None: + _dict['assessment_method'] = self.assessment_method + if hasattr(self, 'assessment_description') and self.assessment_description is not None: + _dict['assessment_description'] = self.assessment_description + if hasattr(self, 'parameter_count') and self.parameter_count is not None: + _dict['parameter_count'] = self.parameter_count + if hasattr(self, 'parameters') and self.parameters is not None: + parameters_list = [] + for v in self.parameters: + if isinstance(v, dict): + parameters_list.append(v) + else: + parameters_list.append(v.to_dict()) + _dict['parameters'] = parameters_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 Assessment object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'Assessment') -> 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: 'Assessment') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AssessmentPrototype: + """ + The necessary fields to include a rule/assessment. + + :param str assessment_id: (optional) The ID of the rule to target. A list of + rules can be obtained from the list_rules method. + :param str assessment_description: (optional) Details on the intent of the rule + for an assessment. + """ + + def __init__( + self, + *, + assessment_id: Optional[str] = None, + assessment_description: Optional[str] = None, + ) -> None: + """ + Initialize a AssessmentPrototype object. + + :param str assessment_id: (optional) The ID of the rule to target. A list + of rules can be obtained from the list_rules method. + :param str assessment_description: (optional) Details on the intent of the + rule for an assessment. + """ + self.assessment_id = assessment_id + self.assessment_description = assessment_description + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AssessmentPrototype': + """Initialize a AssessmentPrototype object from a json dictionary.""" + args = {} + if (assessment_id := _dict.get('assessment_id')) is not None: + args['assessment_id'] = assessment_id + if (assessment_description := _dict.get('assessment_description')) is not None: + args['assessment_description'] = assessment_description + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AssessmentPrototype 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, 'assessment_id') and self.assessment_id is not None: + _dict['assessment_id'] = self.assessment_id + if hasattr(self, 'assessment_description') and self.assessment_description is not None: + _dict['assessment_description'] = self.assessment_description + 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 AssessmentPrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AssessmentPrototype') -> 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: 'AssessmentPrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AssessmentWithStats: + """ + The control specification assessment. + + :param str assessment_id: (optional) The assessment ID. + :param str assessment_type: (optional) The assessment type. + :param str assessment_method: (optional) The assessment method. + :param str assessment_description: (optional) The assessment description. + :param int parameter_count: (optional) The number of parameters of this + assessment. + :param List[Parameter] parameters: (optional) The list of parameters of this + assessment. + :param int total_count: (optional) The total number of evaluations. + :param int pass_count: (optional) The number of passed evaluations. + :param int failure_count: (optional) The number of failed evaluations. + :param int error_count: (optional) The number of evaluations that started, but + did not finish, and ended with errors. + :param int completed_count: (optional) The total number of completed + evaluations. + """ + + def __init__( + self, + *, + assessment_id: Optional[str] = None, + assessment_type: Optional[str] = None, + assessment_method: Optional[str] = None, + assessment_description: Optional[str] = None, + parameter_count: Optional[int] = None, + parameters: Optional[List['Parameter']] = None, + total_count: Optional[int] = None, + pass_count: Optional[int] = None, + failure_count: Optional[int] = None, + error_count: Optional[int] = None, + completed_count: Optional[int] = None, + ) -> None: + """ + Initialize a AssessmentWithStats object. + + :param str assessment_id: (optional) The assessment ID. + :param str assessment_type: (optional) The assessment type. + :param str assessment_method: (optional) The assessment method. + :param str assessment_description: (optional) The assessment description. + :param int parameter_count: (optional) The number of parameters of this + assessment. + :param List[Parameter] parameters: (optional) The list of parameters of + this assessment. + :param int total_count: (optional) The total number of evaluations. + :param int pass_count: (optional) The number of passed evaluations. + :param int failure_count: (optional) The number of failed evaluations. + :param int error_count: (optional) The number of evaluations that started, + but did not finish, and ended with errors. + :param int completed_count: (optional) The total number of completed + evaluations. + """ + self.assessment_id = assessment_id + self.assessment_type = assessment_type + self.assessment_method = assessment_method + self.assessment_description = assessment_description + self.parameter_count = parameter_count + self.parameters = parameters + self.total_count = total_count + self.pass_count = pass_count + self.failure_count = failure_count + self.error_count = error_count + self.completed_count = completed_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AssessmentWithStats': + """Initialize a AssessmentWithStats object from a json dictionary.""" + args = {} + if (assessment_id := _dict.get('assessment_id')) is not None: + args['assessment_id'] = assessment_id + if (assessment_type := _dict.get('assessment_type')) is not None: + args['assessment_type'] = assessment_type + if (assessment_method := _dict.get('assessment_method')) is not None: + args['assessment_method'] = assessment_method + if (assessment_description := _dict.get('assessment_description')) is not None: + args['assessment_description'] = assessment_description + if (parameter_count := _dict.get('parameter_count')) is not None: + args['parameter_count'] = parameter_count + if (parameters := _dict.get('parameters')) is not None: + args['parameters'] = [Parameter.from_dict(v) for v in parameters] + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (pass_count := _dict.get('pass_count')) is not None: + args['pass_count'] = pass_count + if (failure_count := _dict.get('failure_count')) is not None: + args['failure_count'] = failure_count + if (error_count := _dict.get('error_count')) is not None: + args['error_count'] = error_count + if (completed_count := _dict.get('completed_count')) is not None: + args['completed_count'] = completed_count + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AssessmentWithStats 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, 'assessment_id') and self.assessment_id is not None: + _dict['assessment_id'] = self.assessment_id + if hasattr(self, 'assessment_type') and self.assessment_type is not None: + _dict['assessment_type'] = self.assessment_type + if hasattr(self, 'assessment_method') and self.assessment_method is not None: + _dict['assessment_method'] = self.assessment_method + if hasattr(self, 'assessment_description') and self.assessment_description is not None: + _dict['assessment_description'] = self.assessment_description + if hasattr(self, 'parameter_count') and self.parameter_count is not None: + _dict['parameter_count'] = self.parameter_count + if hasattr(self, 'parameters') and self.parameters is not None: + parameters_list = [] + for v in self.parameters: + if isinstance(v, dict): + parameters_list.append(v) + else: + parameters_list.append(v.to_dict()) + _dict['parameters'] = parameters_list + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'pass_count') and self.pass_count is not None: + _dict['pass_count'] = self.pass_count + if hasattr(self, 'failure_count') and self.failure_count is not None: + _dict['failure_count'] = self.failure_count + if hasattr(self, 'error_count') and self.error_count is not None: + _dict['error_count'] = self.error_count + if hasattr(self, 'completed_count') and self.completed_count is not None: + _dict['completed_count'] = self.completed_count + 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 AssessmentWithStats object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AssessmentWithStats') -> 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: 'AssessmentWithStats') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class Attachment: + """ + The attachment that is associated with a report. + + :param str id: (optional) The attachment ID. + :param str name: (optional) The name of the attachment. + :param str description: (optional) The description of the attachment. + :param str schedule: (optional) The attachment schedule. + :param object scope: (optional) Deprecated: (deprecated) The scope associated + with the report. + :param List[Scope] scopes: (optional) The report's scopes based on the caller's + access permissions. + :param AttachmentNotifications notifications: (optional) The notification + configuration of the attachment. + """ + + def __init__( + self, + *, + id: Optional[str] = None, + name: Optional[str] = None, + description: Optional[str] = None, + schedule: Optional[str] = None, + scope: Optional[object] = None, + scopes: Optional[List['Scope']] = None, + notifications: Optional['AttachmentNotifications'] = None, + ) -> None: + """ + Initialize a Attachment object. + + :param str id: (optional) The attachment ID. + :param str name: (optional) The name of the attachment. + :param str description: (optional) The description of the attachment. + :param str schedule: (optional) The attachment schedule. + :param object scope: (optional) Deprecated: (deprecated) The scope + associated with the report. + :param List[Scope] scopes: (optional) The report's scopes based on the + caller's access permissions. + :param AttachmentNotifications notifications: (optional) The notification + configuration of the attachment. + """ + self.id = id + self.name = name + self.description = description + self.schedule = schedule + self.scope = scope + self.scopes = scopes + self.notifications = notifications + + @classmethod + def from_dict(cls, _dict: Dict) -> 'Attachment': + """Initialize a Attachment object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + if (name := _dict.get('name')) is not None: + args['name'] = name + if (description := _dict.get('description')) is not None: + args['description'] = description + if (schedule := _dict.get('schedule')) is not None: + args['schedule'] = schedule + if (scope := _dict.get('scope')) is not None: + args['scope'] = scope + if (scopes := _dict.get('scopes')) is not None: + args['scopes'] = [Scope.from_dict(v) for v in scopes] + if (notifications := _dict.get('notifications')) is not None: + args['notifications'] = AttachmentNotifications.from_dict(notifications) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Attachment 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, '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, 'schedule') and self.schedule is not None: + _dict['schedule'] = self.schedule + if hasattr(self, 'scope') and self.scope is not None: + _dict['scope'] = self.scope + if hasattr(self, 'scopes') and self.scopes is not None: + scopes_list = [] + for v in self.scopes: + if isinstance(v, dict): + scopes_list.append(v) + else: + scopes_list.append(v.to_dict()) + _dict['scopes'] = scopes_list + if hasattr(self, 'notifications') and self.notifications is not None: + if isinstance(self.notifications, dict): + _dict['notifications'] = self.notifications + else: + _dict['notifications'] = self.notifications.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 Attachment object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'Attachment') -> 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: 'Attachment') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AttachmentNotifications: + """ + The notification configuration of the attachment. + + :param bool enabled: (optional) Shows if the notification is enabled or + disabled. + :param AttachmentNotificationsControls controls: (optional) The controls + associated with an AttachmentNotification. + """ + + def __init__( + self, + *, + enabled: Optional[bool] = None, + controls: Optional['AttachmentNotificationsControls'] = None, + ) -> None: + """ + Initialize a AttachmentNotifications object. + + :param bool enabled: (optional) Shows if the notification is enabled or + disabled. + :param AttachmentNotificationsControls controls: (optional) The controls + associated with an AttachmentNotification. + """ + self.enabled = enabled + self.controls = controls + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AttachmentNotifications': + """Initialize a AttachmentNotifications object from a json dictionary.""" + args = {} + if (enabled := _dict.get('enabled')) is not None: + args['enabled'] = enabled + if (controls := _dict.get('controls')) is not None: + args['controls'] = AttachmentNotificationsControls.from_dict(controls) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AttachmentNotifications 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, 'enabled') and self.enabled is not None: + _dict['enabled'] = self.enabled + if hasattr(self, 'controls') and self.controls is not None: + if isinstance(self.controls, dict): + _dict['controls'] = self.controls + else: + _dict['controls'] = self.controls.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 AttachmentNotifications object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AttachmentNotifications') -> 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: 'AttachmentNotifications') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class AttachmentNotificationsControls: + """ + The controls associated with an AttachmentNotification. + + :param int threshold_limit: (optional) The maximum number of not compliant + controls before a notification is triggered. + :param List[str] failed_control_ids: List of controls that triggers a + notification should a scan fail. + """ + + def __init__( + self, + failed_control_ids: List[str], + *, + threshold_limit: Optional[int] = None, + ) -> None: + """ + Initialize a AttachmentNotificationsControls object. + + :param List[str] failed_control_ids: List of controls that triggers a + notification should a scan fail. + :param int threshold_limit: (optional) The maximum number of not compliant + controls before a notification is triggered. + """ + self.threshold_limit = threshold_limit + self.failed_control_ids = failed_control_ids + + @classmethod + def from_dict(cls, _dict: Dict) -> 'AttachmentNotificationsControls': + """Initialize a AttachmentNotificationsControls object from a json dictionary.""" + args = {} + if (threshold_limit := _dict.get('threshold_limit')) is not None: + args['threshold_limit'] = threshold_limit + if (failed_control_ids := _dict.get('failed_control_ids')) is not None: + args['failed_control_ids'] = failed_control_ids + else: + raise ValueError('Required property \'failed_control_ids\' not present in AttachmentNotificationsControls JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a AttachmentNotificationsControls 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, 'threshold_limit') and self.threshold_limit is not None: + _dict['threshold_limit'] = self.threshold_limit + if hasattr(self, 'failed_control_ids') and self.failed_control_ids is not None: + _dict['failed_control_ids'] = self.failed_control_ids + 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 AttachmentNotificationsControls object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'AttachmentNotificationsControls') -> 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: 'AttachmentNotificationsControls') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ComparePredefinedProfilesResponse: + """ + The predefined profile comparison response. + + :param CompareProfileResponse current_predefined_version: (optional) Shows a + change in the Profile. + :param CompareProfileResponse latest_predefined_version: (optional) Shows a + change in the Profile. + :param ControlChanges controls_changes: (optional) Shows details of the controls + that were changed. + :param DefaultParametersChanges default_parameters_changes: (optional) Shows + details of the parameters that were changed. + """ + + def __init__( + self, + *, + current_predefined_version: Optional['CompareProfileResponse'] = None, + latest_predefined_version: Optional['CompareProfileResponse'] = None, + controls_changes: Optional['ControlChanges'] = None, + default_parameters_changes: Optional['DefaultParametersChanges'] = None, + ) -> None: + """ + Initialize a ComparePredefinedProfilesResponse object. + + :param CompareProfileResponse current_predefined_version: (optional) Shows + a change in the Profile. + :param CompareProfileResponse latest_predefined_version: (optional) Shows a + change in the Profile. + :param ControlChanges controls_changes: (optional) Shows details of the + controls that were changed. + :param DefaultParametersChanges default_parameters_changes: (optional) + Shows details of the parameters that were changed. + """ + self.current_predefined_version = current_predefined_version + self.latest_predefined_version = latest_predefined_version + self.controls_changes = controls_changes + self.default_parameters_changes = default_parameters_changes + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ComparePredefinedProfilesResponse': + """Initialize a ComparePredefinedProfilesResponse object from a json dictionary.""" + args = {} + if (current_predefined_version := _dict.get('current_predefined_version')) is not None: + args['current_predefined_version'] = CompareProfileResponse.from_dict(current_predefined_version) + if (latest_predefined_version := _dict.get('latest_predefined_version')) is not None: + args['latest_predefined_version'] = CompareProfileResponse.from_dict(latest_predefined_version) + if (controls_changes := _dict.get('controls_changes')) is not None: + args['controls_changes'] = ControlChanges.from_dict(controls_changes) + if (default_parameters_changes := _dict.get('default_parameters_changes')) is not None: + args['default_parameters_changes'] = DefaultParametersChanges.from_dict(default_parameters_changes) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ComparePredefinedProfilesResponse 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, 'current_predefined_version') and self.current_predefined_version is not None: + if isinstance(self.current_predefined_version, dict): + _dict['current_predefined_version'] = self.current_predefined_version + else: + _dict['current_predefined_version'] = self.current_predefined_version.to_dict() + if hasattr(self, 'latest_predefined_version') and self.latest_predefined_version is not None: + if isinstance(self.latest_predefined_version, dict): + _dict['latest_predefined_version'] = self.latest_predefined_version + else: + _dict['latest_predefined_version'] = self.latest_predefined_version.to_dict() + if hasattr(self, 'controls_changes') and self.controls_changes is not None: + if isinstance(self.controls_changes, dict): + _dict['controls_changes'] = self.controls_changes + else: + _dict['controls_changes'] = self.controls_changes.to_dict() + if hasattr(self, 'default_parameters_changes') and self.default_parameters_changes is not None: + if isinstance(self.default_parameters_changes, dict): + _dict['default_parameters_changes'] = self.default_parameters_changes + else: + _dict['default_parameters_changes'] = self.default_parameters_changes.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 ComparePredefinedProfilesResponse object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ComparePredefinedProfilesResponse') -> 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: 'ComparePredefinedProfilesResponse') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class CompareProfileResponse: + """ + Shows a change in the Profile. + + :param str id: (optional) The ID of the profile. + :param str profile_name: (optional) The name of the profile. + :param str profile_description: (optional) A description of what the profile + should represent. + :param str profile_type: The type of profile, either predefined or custom. + :param str profile_version: (optional) The version of the profile. + :param str version_group_label: (optional) The unique identifier of the profile + revision. + :param bool latest: (optional) Determines if the profile is up to date with the + latest revisions. + :param str created_by: (optional) User who created the profile. + :param datetime created_on: (optional) The date when the profile was created, in + date-time format. + :param str updated_by: (optional) User who made the latest changes to the + profile. + :param datetime updated_on: (optional) The date when the profile was last + updated, in date-time format. + :param int controls_count: (optional) Number of controls in the profile. + """ + + def __init__( + self, + profile_type: str, + *, + id: Optional[str] = None, + profile_name: Optional[str] = None, + profile_description: Optional[str] = None, + profile_version: Optional[str] = None, + version_group_label: Optional[str] = None, + latest: Optional[bool] = None, + created_by: Optional[str] = None, + created_on: Optional[datetime] = None, + updated_by: Optional[str] = None, + updated_on: Optional[datetime] = None, + controls_count: Optional[int] = None, + ) -> None: + """ + Initialize a CompareProfileResponse object. + + :param str profile_type: The type of profile, either predefined or custom. + :param str id: (optional) The ID of the profile. + :param str profile_name: (optional) The name of the profile. + :param str profile_description: (optional) A description of what the + profile should represent. + :param str profile_version: (optional) The version of the profile. + :param str version_group_label: (optional) The unique identifier of the + profile revision. + :param bool latest: (optional) Determines if the profile is up to date with + the latest revisions. + :param str created_by: (optional) User who created the profile. + :param datetime created_on: (optional) The date when the profile was + created, in date-time format. + :param str updated_by: (optional) User who made the latest changes to the + profile. + :param datetime updated_on: (optional) The date when the profile was last + updated, in date-time format. + :param int controls_count: (optional) Number of controls in the profile. + """ + self.id = id + self.profile_name = profile_name + self.profile_description = profile_description + self.profile_type = profile_type + self.profile_version = profile_version + self.version_group_label = version_group_label + self.latest = latest + self.created_by = created_by + self.created_on = created_on + self.updated_by = updated_by + self.updated_on = updated_on + self.controls_count = controls_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'CompareProfileResponse': + """Initialize a CompareProfileResponse object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + if (profile_name := _dict.get('profile_name')) is not None: + args['profile_name'] = profile_name + if (profile_description := _dict.get('profile_description')) is not None: + args['profile_description'] = profile_description + if (profile_type := _dict.get('profile_type')) is not None: + args['profile_type'] = profile_type + else: + raise ValueError('Required property \'profile_type\' not present in CompareProfileResponse JSON') + if (profile_version := _dict.get('profile_version')) is not None: + args['profile_version'] = profile_version + if (version_group_label := _dict.get('version_group_label')) is not None: + args['version_group_label'] = version_group_label + if (latest := _dict.get('latest')) is not None: + args['latest'] = latest + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) + if (controls_count := _dict.get('controls_count')) is not None: + args['controls_count'] = controls_count + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a CompareProfileResponse 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, 'profile_name') and self.profile_name is not None: + _dict['profile_name'] = self.profile_name + if hasattr(self, 'profile_description') and self.profile_description is not None: + _dict['profile_description'] = self.profile_description + if hasattr(self, 'profile_type') and self.profile_type is not None: + _dict['profile_type'] = self.profile_type + if hasattr(self, 'profile_version') and self.profile_version is not None: + _dict['profile_version'] = self.profile_version + if hasattr(self, 'version_group_label') and self.version_group_label is not None: + _dict['version_group_label'] = self.version_group_label + if hasattr(self, 'latest') and self.latest is not None: + _dict['latest'] = self.latest + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'updated_by') and self.updated_by is not None: + _dict['updated_by'] = self.updated_by + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) + if hasattr(self, 'controls_count') and self.controls_count is not None: + _dict['controls_count'] = self.controls_count + 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 CompareProfileResponse object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'CompareProfileResponse') -> 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: 'CompareProfileResponse') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ProfileTypeEnum(str, Enum): + """ + The type of profile, either predefined or custom. + """ + + CUSTOM = 'custom' + PREDEFINED = 'predefined' + + + +class ComplianceScore: + """ + The compliance score. + + :param int passed: (optional) The number of successful evaluations. + :param int total_count: (optional) The total number of evaluations. + :param int percent: (optional) The percentage of successful evaluations. + """ + + def __init__( + self, + *, + passed: Optional[int] = None, + total_count: Optional[int] = None, + percent: Optional[int] = None, + ) -> None: + """ + Initialize a ComplianceScore object. + + :param int passed: (optional) The number of successful evaluations. + :param int total_count: (optional) The total number of evaluations. + :param int percent: (optional) The percentage of successful evaluations. + """ + self.passed = passed + self.total_count = total_count + self.percent = percent + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ComplianceScore': + """Initialize a ComplianceScore object from a json dictionary.""" + args = {} + if (passed := _dict.get('passed')) is not None: + args['passed'] = passed + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (percent := _dict.get('percent')) is not None: + args['percent'] = percent + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ComplianceScore 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, 'passed') and self.passed is not None: + _dict['passed'] = self.passed + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'percent') and self.percent is not None: + _dict['percent'] = self.percent + 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 ComplianceScore object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ComplianceScore') -> 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: 'ComplianceScore') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ComplianceStats: + """ + The compliance stats. + + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are not + compliant. + :param int unable_to_perform_count: (optional) The number of checks that are + unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks that + require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable (with + no evaluations) checks. + """ + + def __init__( + self, + status: str, + *, + total_count: Optional[int] = None, + compliant_count: Optional[int] = None, + not_compliant_count: Optional[int] = None, + unable_to_perform_count: Optional[int] = None, + user_evaluation_required_count: Optional[int] = None, + not_applicable_count: Optional[int] = None, + ) -> None: + """ + Initialize a ComplianceStats object. + + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are + not compliant. + :param int unable_to_perform_count: (optional) The number of checks that + are unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks + that require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable + (with no evaluations) checks. + """ + self.status = status + self.total_count = total_count + self.compliant_count = compliant_count + self.not_compliant_count = not_compliant_count + self.unable_to_perform_count = unable_to_perform_count + self.user_evaluation_required_count = user_evaluation_required_count + self.not_applicable_count = not_applicable_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ComplianceStats': + """Initialize a ComplianceStats object from a json dictionary.""" + args = {} + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ComplianceStats JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (compliant_count := _dict.get('compliant_count')) is not None: + args['compliant_count'] = compliant_count + if (not_compliant_count := _dict.get('not_compliant_count')) is not None: + args['not_compliant_count'] = not_compliant_count + if (unable_to_perform_count := _dict.get('unable_to_perform_count')) is not None: + args['unable_to_perform_count'] = unable_to_perform_count + if (user_evaluation_required_count := _dict.get('user_evaluation_required_count')) is not None: + args['user_evaluation_required_count'] = user_evaluation_required_count + if (not_applicable_count := _dict.get('not_applicable_count')) is not None: + args['not_applicable_count'] = not_applicable_count + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ComplianceStats 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, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'compliant_count') and self.compliant_count is not None: + _dict['compliant_count'] = self.compliant_count + if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: + _dict['not_compliant_count'] = self.not_compliant_count + if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: + _dict['unable_to_perform_count'] = self.unable_to_perform_count + if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: + _dict['user_evaluation_required_count'] = self.user_evaluation_required_count + if hasattr(self, 'not_applicable_count') and self.not_applicable_count is not None: + _dict['not_applicable_count'] = self.not_applicable_count + 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 ComplianceStats object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ComplianceStats') -> 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: 'ComplianceStats') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class StatusEnum(str, Enum): + """ + The allowed values of an aggregated status for controls, specifications, + assessments, and resources. + """ + + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' + + + +class ComplianceStatsWithNonCompliant: + """ + The compliance stats. + + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are not + compliant. + :param int unable_to_perform_count: (optional) The number of checks that are + unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks that + require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable (with + no evaluations) checks. + :param List[ControlSummary] not_compliant_controls: (optional) The list of non + compliant controls. + """ + + def __init__( + self, + status: str, + *, + total_count: Optional[int] = None, + compliant_count: Optional[int] = None, + not_compliant_count: Optional[int] = None, + unable_to_perform_count: Optional[int] = None, + user_evaluation_required_count: Optional[int] = None, + not_applicable_count: Optional[int] = None, + not_compliant_controls: Optional[List['ControlSummary']] = None, + ) -> None: + """ + Initialize a ComplianceStatsWithNonCompliant object. + + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are + not compliant. + :param int unable_to_perform_count: (optional) The number of checks that + are unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks + that require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable + (with no evaluations) checks. + :param List[ControlSummary] not_compliant_controls: (optional) The list of + non compliant controls. + """ + self.status = status + self.total_count = total_count + self.compliant_count = compliant_count + self.not_compliant_count = not_compliant_count + self.unable_to_perform_count = unable_to_perform_count + self.user_evaluation_required_count = user_evaluation_required_count + self.not_applicable_count = not_applicable_count + self.not_compliant_controls = not_compliant_controls + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ComplianceStatsWithNonCompliant': + """Initialize a ComplianceStatsWithNonCompliant object from a json dictionary.""" + args = {} + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ComplianceStatsWithNonCompliant JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (compliant_count := _dict.get('compliant_count')) is not None: + args['compliant_count'] = compliant_count + if (not_compliant_count := _dict.get('not_compliant_count')) is not None: + args['not_compliant_count'] = not_compliant_count + if (unable_to_perform_count := _dict.get('unable_to_perform_count')) is not None: + args['unable_to_perform_count'] = unable_to_perform_count + if (user_evaluation_required_count := _dict.get('user_evaluation_required_count')) is not None: + args['user_evaluation_required_count'] = user_evaluation_required_count + if (not_applicable_count := _dict.get('not_applicable_count')) is not None: + args['not_applicable_count'] = not_applicable_count + if (not_compliant_controls := _dict.get('not_compliant_controls')) is not None: + args['not_compliant_controls'] = [ControlSummary.from_dict(v) for v in not_compliant_controls] + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ComplianceStatsWithNonCompliant 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, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'compliant_count') and self.compliant_count is not None: + _dict['compliant_count'] = self.compliant_count + if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: + _dict['not_compliant_count'] = self.not_compliant_count + if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: + _dict['unable_to_perform_count'] = self.unable_to_perform_count + if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: + _dict['user_evaluation_required_count'] = self.user_evaluation_required_count + if hasattr(self, 'not_applicable_count') and self.not_applicable_count is not None: + _dict['not_applicable_count'] = self.not_applicable_count + if hasattr(self, 'not_compliant_controls') and self.not_compliant_controls is not None: + not_compliant_controls_list = [] + for v in self.not_compliant_controls: + if isinstance(v, dict): + not_compliant_controls_list.append(v) + else: + not_compliant_controls_list.append(v.to_dict()) + _dict['not_compliant_controls'] = not_compliant_controls_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 ComplianceStatsWithNonCompliant object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ComplianceStatsWithNonCompliant') -> 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: 'ComplianceStatsWithNonCompliant') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class StatusEnum(str, Enum): + """ + The allowed values of an aggregated status for controls, specifications, + assessments, and resources. + """ + + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' + + + +class ConditionItem: + """ + ConditionItem. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a ConditionItem object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ConditionItemConditionBase', 'ConditionItemConditionList', 'ConditionItemConditionSubRule']) + ) + raise Exception(msg) + + +class ConfigurationInformationPoints: + """ + The service configuration information. + + :param str type: (optional) The information type. + :param List[Endpoint] endpoints: (optional) The service configurations + endpoints. + """ + + def __init__( + self, + *, + type: Optional[str] = None, + endpoints: Optional[List['Endpoint']] = None, + ) -> None: + """ + Initialize a ConfigurationInformationPoints object. + + :param str type: (optional) The information type. + :param List[Endpoint] endpoints: (optional) The service configurations + endpoints. + """ + self.type = type + self.endpoints = endpoints + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ConfigurationInformationPoints': + """Initialize a ConfigurationInformationPoints object from a json dictionary.""" + args = {} + if (type := _dict.get('type')) is not None: + args['type'] = type + if (endpoints := _dict.get('endpoints')) is not None: + args['endpoints'] = [Endpoint.from_dict(v) for v in endpoints] + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ConfigurationInformationPoints 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, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'endpoints') and self.endpoints is not None: + endpoints_list = [] + for v in self.endpoints: + if isinstance(v, dict): + endpoints_list.append(v) + else: + endpoints_list.append(v.to_dict()) + _dict['endpoints'] = endpoints_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 ConfigurationInformationPoints object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ConfigurationInformationPoints') -> 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: 'ConfigurationInformationPoints') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class Control: + """ + A technical, administrative, or physical safeguard designed to meet a set of defined + security and privacy requirements. + + :param str control_name: (optional) The ID of the control library that contains + the profile. + :param str control_id: (optional) The control name. + :param str control_description: (optional) The control description. + :param str control_category: (optional) The association of the control. + :param str control_parent: (optional) The ID of the parent control. + :param str control_severity: (optional) Details how important a control is + should it fail. + :param List[str] control_tags: tags associated with a control. + :param List[ControlSpecification] control_specifications: List of control + specifications associated with the control. + :param ControlDoc control_docs: (optional) References to a control + documentation. + :param str status: (optional) Determines if a control will be evaluated or not. + """ + + def __init__( + self, + control_tags: List[str], + control_specifications: List['ControlSpecification'], + *, + control_name: Optional[str] = None, + control_id: Optional[str] = None, + control_description: Optional[str] = None, + control_category: Optional[str] = None, + control_parent: Optional[str] = None, + control_severity: Optional[str] = None, + control_docs: Optional['ControlDoc'] = None, + status: Optional[str] = None, + ) -> None: + """ + Initialize a Control object. + + :param List[str] control_tags: tags associated with a control. + :param List[ControlSpecification] control_specifications: List of control + specifications associated with the control. + :param str control_name: (optional) The ID of the control library that + contains the profile. + :param str control_id: (optional) The control name. + :param str control_description: (optional) The control description. + :param str control_category: (optional) The association of the control. + :param str control_parent: (optional) The ID of the parent control. + :param str control_severity: (optional) Details how important a control is + should it fail. + :param ControlDoc control_docs: (optional) References to a control + documentation. + :param str status: (optional) Determines if a control will be evaluated or + not. + """ + self.control_name = control_name + self.control_id = control_id + self.control_description = control_description + self.control_category = control_category + self.control_parent = control_parent + self.control_severity = control_severity + self.control_tags = control_tags + self.control_specifications = control_specifications + self.control_docs = control_docs + self.status = status + + @classmethod + def from_dict(cls, _dict: Dict) -> 'Control': + """Initialize a Control object from a json dictionary.""" + args = {} + if (control_name := _dict.get('control_name')) is not None: + args['control_name'] = control_name + if (control_id := _dict.get('control_id')) is not None: + args['control_id'] = control_id + if (control_description := _dict.get('control_description')) is not None: + args['control_description'] = control_description + if (control_category := _dict.get('control_category')) is not None: + args['control_category'] = control_category + if (control_parent := _dict.get('control_parent')) is not None: + args['control_parent'] = control_parent + if (control_severity := _dict.get('control_severity')) is not None: + args['control_severity'] = control_severity + if (control_tags := _dict.get('control_tags')) is not None: + args['control_tags'] = control_tags + else: + raise ValueError('Required property \'control_tags\' not present in Control JSON') + if (control_specifications := _dict.get('control_specifications')) is not None: + args['control_specifications'] = [ControlSpecification.from_dict(v) for v in control_specifications] + else: + raise ValueError('Required property \'control_specifications\' not present in Control JSON') + if (control_docs := _dict.get('control_docs')) is not None: + args['control_docs'] = ControlDoc.from_dict(control_docs) + if (status := _dict.get('status')) is not None: + args['status'] = status + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Control 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, 'control_name') and self.control_name is not None: + _dict['control_name'] = self.control_name + if hasattr(self, 'control_id') and self.control_id is not None: + _dict['control_id'] = self.control_id + if hasattr(self, 'control_description') and self.control_description is not None: + _dict['control_description'] = self.control_description + if hasattr(self, 'control_category') and self.control_category is not None: + _dict['control_category'] = self.control_category + if hasattr(self, 'control_parent') and self.control_parent is not None: + _dict['control_parent'] = self.control_parent + if hasattr(self, 'control_severity') and self.control_severity is not None: + _dict['control_severity'] = self.control_severity + if hasattr(self, 'control_tags') and self.control_tags is not None: + _dict['control_tags'] = self.control_tags + if hasattr(self, 'control_specifications') and self.control_specifications is not None: + control_specifications_list = [] + for v in self.control_specifications: + if isinstance(v, dict): + control_specifications_list.append(v) + else: + control_specifications_list.append(v.to_dict()) + _dict['control_specifications'] = control_specifications_list + if hasattr(self, 'control_docs') and self.control_docs is not None: + if isinstance(self.control_docs, dict): + _dict['control_docs'] = self.control_docs + else: + _dict['control_docs'] = self.control_docs.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this Control object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'Control') -> 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: 'Control') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ControlChanges: + """ + Shows details of the controls that were changed. + + :param int total_added: (optional) How many controls were added. + :param int total_removed: (optional) How many controls were removed. + :param int total_updated: (optional) How many controls were updated. + :param List[ProfileControlsInResponse] added: A list of controls that were + added. + :param List[ProfileControlsInResponse] removed: A list of controls that were + removed. + :param List[ControlChangesUpdated] updated: A list of controls that were + updated. + """ + + def __init__( + self, + added: List['ProfileControlsInResponse'], + removed: List['ProfileControlsInResponse'], + updated: List['ControlChangesUpdated'], + *, + total_added: Optional[int] = None, + total_removed: Optional[int] = None, + total_updated: Optional[int] = None, + ) -> None: + """ + Initialize a ControlChanges object. + + :param List[ProfileControlsInResponse] added: A list of controls that were + added. + :param List[ProfileControlsInResponse] removed: A list of controls that + were removed. + :param List[ControlChangesUpdated] updated: A list of controls that were + updated. + :param int total_added: (optional) How many controls were added. + :param int total_removed: (optional) How many controls were removed. + :param int total_updated: (optional) How many controls were updated. + """ + self.total_added = total_added + self.total_removed = total_removed + self.total_updated = total_updated + self.added = added + self.removed = removed + self.updated = updated + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlChanges': + """Initialize a ControlChanges object from a json dictionary.""" + args = {} + if (total_added := _dict.get('total_added')) is not None: + args['total_added'] = total_added + if (total_removed := _dict.get('total_removed')) is not None: + args['total_removed'] = total_removed + if (total_updated := _dict.get('total_updated')) is not None: + args['total_updated'] = total_updated + if (added := _dict.get('added')) is not None: + args['added'] = [ProfileControlsInResponse.from_dict(v) for v in added] + else: + raise ValueError('Required property \'added\' not present in ControlChanges JSON') + if (removed := _dict.get('removed')) is not None: + args['removed'] = [ProfileControlsInResponse.from_dict(v) for v in removed] + else: + raise ValueError('Required property \'removed\' not present in ControlChanges JSON') + if (updated := _dict.get('updated')) is not None: + args['updated'] = [ControlChangesUpdated.from_dict(v) for v in updated] + else: + raise ValueError('Required property \'updated\' not present in ControlChanges JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlChanges 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, 'total_added') and self.total_added is not None: + _dict['total_added'] = self.total_added + if hasattr(self, 'total_removed') and self.total_removed is not None: + _dict['total_removed'] = self.total_removed + if hasattr(self, 'total_updated') and self.total_updated is not None: + _dict['total_updated'] = self.total_updated + if hasattr(self, 'added') and self.added is not None: + added_list = [] + for v in self.added: + if isinstance(v, dict): + added_list.append(v) + else: + added_list.append(v.to_dict()) + _dict['added'] = added_list + if hasattr(self, 'removed') and self.removed is not None: + removed_list = [] + for v in self.removed: + if isinstance(v, dict): + removed_list.append(v) + else: + removed_list.append(v.to_dict()) + _dict['removed'] = removed_list + if hasattr(self, 'updated') and self.updated is not None: + updated_list = [] + for v in self.updated: + if isinstance(v, dict): + updated_list.append(v) + else: + updated_list.append(v.to_dict()) + _dict['updated'] = updated_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 ControlChanges object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlChanges') -> 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: 'ControlChanges') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ControlChangesUpdated: + """ + Shows the difference in the Controls. + + :param ProfileControlsInResponse current: (optional) The control details for a + profile. + :param ProfileControlsInResponse latest: (optional) The control details for a + profile. + """ + + def __init__( + self, + *, + current: Optional['ProfileControlsInResponse'] = None, + latest: Optional['ProfileControlsInResponse'] = None, + ) -> None: + """ + Initialize a ControlChangesUpdated object. + + :param ProfileControlsInResponse current: (optional) The control details + for a profile. + :param ProfileControlsInResponse latest: (optional) The control details for + a profile. + """ + self.current = current + self.latest = latest + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlChangesUpdated': + """Initialize a ControlChangesUpdated object from a json dictionary.""" + args = {} + if (current := _dict.get('current')) is not None: + args['current'] = ProfileControlsInResponse.from_dict(current) + if (latest := _dict.get('latest')) is not None: + args['latest'] = ProfileControlsInResponse.from_dict(latest) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlChangesUpdated 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, 'current') and self.current is not None: + if isinstance(self.current, dict): + _dict['current'] = self.current + else: + _dict['current'] = self.current.to_dict() + if hasattr(self, 'latest') and self.latest is not None: + if isinstance(self.latest, dict): + _dict['latest'] = self.latest + else: + _dict['latest'] = self.latest.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 ControlChangesUpdated object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlChangesUpdated') -> 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: 'ControlChangesUpdated') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ControlDoc: + """ + References to a control documentation. + + :param str control_docs_id: (optional) The ID of the control doc. + :param str control_docs_type: (optional) The type of the control doc. + """ + + def __init__( + self, + *, + control_docs_id: Optional[str] = None, + control_docs_type: Optional[str] = None, + ) -> None: + """ + Initialize a ControlDoc object. + + :param str control_docs_id: (optional) The ID of the control doc. + :param str control_docs_type: (optional) The type of the control doc. + """ + self.control_docs_id = control_docs_id + self.control_docs_type = control_docs_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlDoc': + """Initialize a ControlDoc object from a json dictionary.""" + args = {} + if (control_docs_id := _dict.get('control_docs_id')) is not None: + args['control_docs_id'] = control_docs_id + if (control_docs_type := _dict.get('control_docs_type')) is not None: + args['control_docs_type'] = control_docs_type + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlDoc 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, 'control_docs_id') and self.control_docs_id is not None: + _dict['control_docs_id'] = self.control_docs_id + if hasattr(self, 'control_docs_type') and self.control_docs_type is not None: + _dict['control_docs_type'] = self.control_docs_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this ControlDoc object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlDoc') -> 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: 'ControlDoc') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ControlLibrary: + """ + A Control Library. + + :param str control_library_name: (optional) The name of the control library. + :param str control_library_description: (optional) Details of the control + library. + :param str control_library_type: Details that the control library is a user + made(custom) or Security Compliance Center(predefined). + :param str control_library_version: (optional) The revision number of the + control library. + :param List[Control] controls: The list of rules that the control library + attempts to adhere to. + :param str id: (optional) The ID of the control library. + :param str account_id: (optional) The ID of the account associated with the + creation of the control library. + :param str version_group_label: (optional) The ETag or version of the Control + Library. + :param bool latest: (optional) Shows if the Control Library is the latest. + :param str created_by: (optional) The ID of the creator of the Control Library. + :param datetime created_on: (optional) The date-time of the creation. + :param str updated_by: (optional) The ID of the user who made the last update. + :param datetime updated_on: (optional) The date-time of the update. + :param bool hierarchy_enabled: (optional) Determines if the control library has + any hierarchy. + :param int controls_count: (optional) The count of controls tied to the control + library. + :param int control_parents_count: (optional) THe count of control parents in the + control library. + """ + + def __init__( + self, + control_library_type: str, + controls: List['Control'], + *, + control_library_name: Optional[str] = None, + control_library_description: Optional[str] = None, + control_library_version: Optional[str] = None, + id: Optional[str] = None, + account_id: Optional[str] = None, + version_group_label: Optional[str] = None, + latest: Optional[bool] = None, + created_by: Optional[str] = None, + created_on: Optional[datetime] = None, + updated_by: Optional[str] = None, + updated_on: Optional[datetime] = None, + hierarchy_enabled: Optional[bool] = None, + controls_count: Optional[int] = None, + control_parents_count: Optional[int] = None, + ) -> None: + """ + Initialize a ControlLibrary object. + + :param str control_library_type: Details that the control library is a user + made(custom) or Security Compliance Center(predefined). + :param List[Control] controls: The list of rules that the control library + attempts to adhere to. + :param str control_library_name: (optional) The name of the control + library. + :param str control_library_description: (optional) Details of the control + library. + :param str control_library_version: (optional) The revision number of the + control library. + :param str id: (optional) The ID of the control library. + :param str account_id: (optional) The ID of the account associated with the + creation of the control library. + :param str version_group_label: (optional) The ETag or version of the + Control Library. + :param bool latest: (optional) Shows if the Control Library is the latest. + :param str created_by: (optional) The ID of the creator of the Control + Library. + :param datetime created_on: (optional) The date-time of the creation. + :param str updated_by: (optional) The ID of the user who made the last + update. + :param datetime updated_on: (optional) The date-time of the update. + :param bool hierarchy_enabled: (optional) Determines if the control library + has any hierarchy. + :param int controls_count: (optional) The count of controls tied to the + control library. + :param int control_parents_count: (optional) THe count of control parents + in the control library. + """ + self.control_library_name = control_library_name + self.control_library_description = control_library_description + self.control_library_type = control_library_type + self.control_library_version = control_library_version + self.controls = controls + self.id = id + self.account_id = account_id + self.version_group_label = version_group_label + self.latest = latest + self.created_by = created_by + self.created_on = created_on + self.updated_by = updated_by + self.updated_on = updated_on + self.hierarchy_enabled = hierarchy_enabled + self.controls_count = controls_count + self.control_parents_count = control_parents_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlLibrary': + """Initialize a ControlLibrary object from a json dictionary.""" + args = {} + if (control_library_name := _dict.get('control_library_name')) is not None: + args['control_library_name'] = control_library_name + if (control_library_description := _dict.get('control_library_description')) is not None: + args['control_library_description'] = control_library_description + if (control_library_type := _dict.get('control_library_type')) is not None: + args['control_library_type'] = control_library_type + else: + raise ValueError('Required property \'control_library_type\' not present in ControlLibrary JSON') + if (control_library_version := _dict.get('control_library_version')) is not None: + args['control_library_version'] = control_library_version + if (controls := _dict.get('controls')) is not None: + args['controls'] = [Control.from_dict(v) for v in controls] + else: + raise ValueError('Required property \'controls\' not present in ControlLibrary JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id + if (account_id := _dict.get('account_id')) is not None: + args['account_id'] = account_id + if (version_group_label := _dict.get('version_group_label')) is not None: + args['version_group_label'] = version_group_label + if (latest := _dict.get('latest')) is not None: + args['latest'] = latest + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) + if (hierarchy_enabled := _dict.get('hierarchy_enabled')) is not None: + args['hierarchy_enabled'] = hierarchy_enabled + if (controls_count := _dict.get('controls_count')) is not None: + args['controls_count'] = controls_count + if (control_parents_count := _dict.get('control_parents_count')) is not None: + args['control_parents_count'] = control_parents_count + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlLibrary 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, 'control_library_name') and self.control_library_name is not None: + _dict['control_library_name'] = self.control_library_name + if hasattr(self, 'control_library_description') and self.control_library_description is not None: + _dict['control_library_description'] = self.control_library_description + if hasattr(self, 'control_library_type') and self.control_library_type is not None: + _dict['control_library_type'] = self.control_library_type + if hasattr(self, 'control_library_version') and self.control_library_version is not None: + _dict['control_library_version'] = self.control_library_version + if hasattr(self, 'controls') and self.controls is not None: + controls_list = [] + for v in self.controls: + if isinstance(v, dict): + controls_list.append(v) + else: + controls_list.append(v.to_dict()) + _dict['controls'] = controls_list + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'version_group_label') and self.version_group_label is not None: + _dict['version_group_label'] = self.version_group_label + if hasattr(self, 'latest') and self.latest is not None: + _dict['latest'] = self.latest + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'updated_by') and self.updated_by is not None: + _dict['updated_by'] = self.updated_by + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) + if hasattr(self, 'hierarchy_enabled') and self.hierarchy_enabled is not None: + _dict['hierarchy_enabled'] = self.hierarchy_enabled + if hasattr(self, 'controls_count') and self.controls_count is not None: + _dict['controls_count'] = self.controls_count + if hasattr(self, 'control_parents_count') and self.control_parents_count is not None: + _dict['control_parents_count'] = self.control_parents_count + 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 ControlLibrary object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlLibrary') -> 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: 'ControlLibrary') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class ControlLibraryTypeEnum(str, Enum): + """ + Details that the control library is a user made(custom) or Security Compliance + Center(predefined). + """ + + CUSTOM = 'custom' + PREDEFINED = 'predefined' + + + +class ControlLibraryCollection: + """ + A list of control libraries. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param List[ControlLibrary] control_libraries: The list of control libraries. + """ + + def __init__( + self, + limit: int, + total_count: int, + control_libraries: List['ControlLibrary'], + *, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, + ) -> None: + """ + Initialize a ControlLibraryCollection object. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param List[ControlLibrary] control_libraries: The list of control + libraries. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + """ + self.limit = limit + self.total_count = total_count + self.first = first + self.next = next + self.control_libraries = control_libraries + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlLibraryCollection': + """Initialize a ControlLibraryCollection object from a json dictionary.""" + args = {} + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + else: + raise ValueError('Required property \'limit\' not present in ControlLibraryCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + else: + raise ValueError('Required property \'total_count\' not present in ControlLibraryCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (control_libraries := _dict.get('control_libraries')) is not None: + args['control_libraries'] = [ControlLibrary.from_dict(v) for v in control_libraries] + else: + raise ValueError('Required property \'control_libraries\' not present in ControlLibraryCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlLibraryCollection 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, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'control_libraries') and self.control_libraries is not None: + control_libraries_list = [] + for v in self.control_libraries: + if isinstance(v, dict): + control_libraries_list.append(v) + else: + control_libraries_list.append(v.to_dict()) + _dict['control_libraries'] = control_libraries_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 ControlLibraryCollection object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlLibraryCollection') -> 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: 'ControlLibraryCollection') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ControlPrototype: + """ + The payload to instantiate a control. + + :param str control_name: The ID of the control library that contains the + profile. + :param str control_description: The control description. + :param str control_category: The association of the control. + :param bool control_requirement: true if the control can be automated, false if + the control cannot. + :param str control_parent: (optional) The ID of the parent control. + :param List[ControlSpecificationPrototype] control_specifications: List of + control specifications associated with the control. + :param ControlDoc control_docs: (optional) References to a control + documentation. + :param str status: (optional) Details if a control library can be used or not. + """ + + def __init__( + self, + control_name: str, + control_description: str, + control_category: str, + control_requirement: bool, + control_specifications: List['ControlSpecificationPrototype'], + *, + control_parent: Optional[str] = None, + control_docs: Optional['ControlDoc'] = None, + status: Optional[str] = None, + ) -> None: + """ + Initialize a ControlPrototype object. + + :param str control_name: The ID of the control library that contains the + profile. + :param str control_description: The control description. + :param str control_category: The association of the control. + :param bool control_requirement: true if the control can be automated, + false if the control cannot. + :param List[ControlSpecificationPrototype] control_specifications: List of + control specifications associated with the control. + :param str control_parent: (optional) The ID of the parent control. + :param ControlDoc control_docs: (optional) References to a control + documentation. + :param str status: (optional) Details if a control library can be used or + not. + """ + self.control_name = control_name + self.control_description = control_description + self.control_category = control_category + self.control_requirement = control_requirement + self.control_parent = control_parent + self.control_specifications = control_specifications + self.control_docs = control_docs + self.status = status + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlPrototype': + """Initialize a ControlPrototype object from a json dictionary.""" + args = {} + if (control_name := _dict.get('control_name')) is not None: + args['control_name'] = control_name + else: + raise ValueError('Required property \'control_name\' not present in ControlPrototype JSON') + if (control_description := _dict.get('control_description')) is not None: + args['control_description'] = control_description + else: + raise ValueError('Required property \'control_description\' not present in ControlPrototype JSON') + if (control_category := _dict.get('control_category')) is not None: + args['control_category'] = control_category + else: + raise ValueError('Required property \'control_category\' not present in ControlPrototype JSON') + if (control_requirement := _dict.get('control_requirement')) is not None: + args['control_requirement'] = control_requirement + else: + raise ValueError('Required property \'control_requirement\' not present in ControlPrototype JSON') + if (control_parent := _dict.get('control_parent')) is not None: + args['control_parent'] = control_parent + if (control_specifications := _dict.get('control_specifications')) is not None: + args['control_specifications'] = [ControlSpecificationPrototype.from_dict(v) for v in control_specifications] + else: + raise ValueError('Required property \'control_specifications\' not present in ControlPrototype JSON') + if (control_docs := _dict.get('control_docs')) is not None: + args['control_docs'] = ControlDoc.from_dict(control_docs) + if (status := _dict.get('status')) is not None: + args['status'] = status + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlPrototype 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, 'control_name') and self.control_name is not None: + _dict['control_name'] = self.control_name + if hasattr(self, 'control_description') and self.control_description is not None: + _dict['control_description'] = self.control_description + if hasattr(self, 'control_category') and self.control_category is not None: + _dict['control_category'] = self.control_category + if hasattr(self, 'control_requirement') and self.control_requirement is not None: + _dict['control_requirement'] = self.control_requirement + if hasattr(self, 'control_parent') and self.control_parent is not None: + _dict['control_parent'] = self.control_parent + if hasattr(self, 'control_specifications') and self.control_specifications is not None: + control_specifications_list = [] + for v in self.control_specifications: + if isinstance(v, dict): + control_specifications_list.append(v) + else: + control_specifications_list.append(v.to_dict()) + _dict['control_specifications'] = control_specifications_list + if hasattr(self, 'control_docs') and self.control_docs is not None: + if isinstance(self.control_docs, dict): + _dict['control_docs'] = self.control_docs + else: + _dict['control_docs'] = self.control_docs.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this ControlPrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlPrototype') -> 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: 'ControlPrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ControlSpecification: + """ + A statement that defines a security/privacy requirement for a Control. + + :param str id: (optional) The ID of the control. + :param str responsibility: (optional) Details which party is responsible for the + implementation of a specification. + :param str component_id: (optional) The ID of the component. + :param str component_name: (optional) The name of the component. + :param str component_type: (optional) The type of component that will use the + specification. + :param str environment: (optional) The cloud provider the specification is + targeting. + :param str description: (optional) Information about the Control Specification. + :param int assessments_count: (optional) The number of rules tied to the + specification. + :param List[Assessment] assessments: The detailed list of rules associated with + the Specification. + """ + + def __init__( + self, + assessments: List['Assessment'], + *, + id: Optional[str] = None, + responsibility: Optional[str] = None, + component_id: Optional[str] = None, + component_name: Optional[str] = None, + component_type: Optional[str] = None, + environment: Optional[str] = None, + description: Optional[str] = None, + assessments_count: Optional[int] = None, + ) -> None: + """ + Initialize a ControlSpecification object. + + :param List[Assessment] assessments: The detailed list of rules associated + with the Specification. + :param str id: (optional) The ID of the control. + :param str responsibility: (optional) Details which party is responsible + for the implementation of a specification. + :param str component_id: (optional) The ID of the component. + :param str component_name: (optional) The name of the component. + :param str component_type: (optional) The type of component that will use + the specification. + :param str environment: (optional) The cloud provider the specification is + targeting. + :param str description: (optional) Information about the Control + Specification. + :param int assessments_count: (optional) The number of rules tied to the + specification. + """ + self.id = id + self.responsibility = responsibility + self.component_id = component_id + self.component_name = component_name + self.component_type = component_type + self.environment = environment + self.description = description + self.assessments_count = assessments_count + self.assessments = assessments + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlSpecification': + """Initialize a ControlSpecification object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + if (responsibility := _dict.get('responsibility')) is not None: + args['responsibility'] = responsibility + if (component_id := _dict.get('component_id')) is not None: + args['component_id'] = component_id + if (component_name := _dict.get('component_name')) is not None: + args['component_name'] = component_name + if (component_type := _dict.get('component_type')) is not None: + args['component_type'] = component_type + if (environment := _dict.get('environment')) is not None: + args['environment'] = environment + if (description := _dict.get('description')) is not None: + args['description'] = description + if (assessments_count := _dict.get('assessments_count')) is not None: + args['assessments_count'] = assessments_count + if (assessments := _dict.get('assessments')) is not None: + args['assessments'] = [Assessment.from_dict(v) for v in assessments] + else: + raise ValueError('Required property \'assessments\' not present in ControlSpecification JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlSpecification 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, 'responsibility') and self.responsibility is not None: + _dict['responsibility'] = self.responsibility + if hasattr(self, 'component_id') and self.component_id is not None: + _dict['component_id'] = self.component_id + if hasattr(self, 'component_name') and self.component_name is not None: + _dict['component_name'] = self.component_name + if hasattr(self, 'component_type') and self.component_type is not None: + _dict['component_type'] = self.component_type + if hasattr(self, 'environment') and self.environment is not None: + _dict['environment'] = self.environment + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'assessments_count') and self.assessments_count is not None: + _dict['assessments_count'] = self.assessments_count + if hasattr(self, 'assessments') and self.assessments is not None: + assessments_list = [] + for v in self.assessments: + if isinstance(v, dict): + assessments_list.append(v) + else: + assessments_list.append(v.to_dict()) + _dict['assessments'] = assessments_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 ControlSpecification object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlSpecification') -> 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: 'ControlSpecification') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ControlSpecificationPrototype: + """ + The necessary fields to instantiate a Control Specification. + + :param str component_id: (optional) The ID of the component. The component_id + can be found from the 'service_name' using the Get Services method. + :param str environment: (optional) The cloud provider the specification is + targeting. + :param str control_specification_id: (optional) The ID of the control + specification to give when creating the control_specification. + :param str control_specification_description: (optional) Information about the + Control Specification. + :param List[AssessmentPrototype] assessments: (optional) The detailed list of + rules associated with the Specification. + """ + + def __init__( + self, + *, + component_id: Optional[str] = None, + environment: Optional[str] = None, + control_specification_id: Optional[str] = None, + control_specification_description: Optional[str] = None, + assessments: Optional[List['AssessmentPrototype']] = None, + ) -> None: + """ + Initialize a ControlSpecificationPrototype object. + + :param str component_id: (optional) The ID of the component. The + component_id can be found from the 'service_name' using the Get Services + method. + :param str environment: (optional) The cloud provider the specification is + targeting. + :param str control_specification_id: (optional) The ID of the control + specification to give when creating the control_specification. + :param str control_specification_description: (optional) Information about + the Control Specification. + :param List[AssessmentPrototype] assessments: (optional) The detailed list + of rules associated with the Specification. + """ + self.component_id = component_id + self.environment = environment + self.control_specification_id = control_specification_id + self.control_specification_description = control_specification_description + self.assessments = assessments + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlSpecificationPrototype': + """Initialize a ControlSpecificationPrototype object from a json dictionary.""" + args = {} + if (component_id := _dict.get('component_id')) is not None: + args['component_id'] = component_id + if (environment := _dict.get('environment')) is not None: + args['environment'] = environment + if (control_specification_id := _dict.get('control_specification_id')) is not None: + args['control_specification_id'] = control_specification_id + if (control_specification_description := _dict.get('control_specification_description')) is not None: + args['control_specification_description'] = control_specification_description + if (assessments := _dict.get('assessments')) is not None: + args['assessments'] = [AssessmentPrototype.from_dict(v) for v in assessments] + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlSpecificationPrototype 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, 'component_id') and self.component_id is not None: + _dict['component_id'] = self.component_id + if hasattr(self, 'environment') and self.environment is not None: + _dict['environment'] = self.environment + if hasattr(self, 'control_specification_id') and self.control_specification_id is not None: + _dict['control_specification_id'] = self.control_specification_id + if hasattr(self, 'control_specification_description') and self.control_specification_description is not None: + _dict['control_specification_description'] = self.control_specification_description + if hasattr(self, 'assessments') and self.assessments is not None: + assessments_list = [] + for v in self.assessments: + if isinstance(v, dict): + assessments_list.append(v) + else: + assessments_list.append(v.to_dict()) + _dict['assessments'] = assessments_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 ControlSpecificationPrototype object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlSpecificationPrototype') -> 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: 'ControlSpecificationPrototype') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class EnvironmentEnum(str, Enum): + """ + The cloud provider the specification is targeting. + """ + + IBM_CLOUD = 'ibm-cloud' + + + +class ControlSpecificationWithStats: + """ + The control specification with compliance stats. + + :param str control_specification_id: (optional) The control specification ID. + :param str control_specification_description: (optional) The component + description. + :param str component_id: (optional) The component ID. + :param str component_name: (optional) The components name. + :param str environment: (optional) The environment. + :param str responsibility: (optional) The responsibility for managing control + specifications. + :param List[AssessmentWithStats] assessments: (optional) The list of + assessments. + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are not + compliant. + :param int unable_to_perform_count: (optional) The number of checks that are + unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks that + require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable (with + no evaluations) checks. + """ + + def __init__( + self, + status: str, + *, + control_specification_id: Optional[str] = None, + control_specification_description: Optional[str] = None, + component_id: Optional[str] = None, + component_name: Optional[str] = None, + environment: Optional[str] = None, + responsibility: Optional[str] = None, + assessments: Optional[List['AssessmentWithStats']] = None, + total_count: Optional[int] = None, + compliant_count: Optional[int] = None, + not_compliant_count: Optional[int] = None, + unable_to_perform_count: Optional[int] = None, + user_evaluation_required_count: Optional[int] = None, + not_applicable_count: Optional[int] = None, + ) -> None: + """ + Initialize a ControlSpecificationWithStats object. + + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param str control_specification_id: (optional) The control specification + ID. + :param str control_specification_description: (optional) The component + description. + :param str component_id: (optional) The component ID. + :param str component_name: (optional) The components name. + :param str environment: (optional) The environment. + :param str responsibility: (optional) The responsibility for managing + control specifications. + :param List[AssessmentWithStats] assessments: (optional) The list of + assessments. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are + not compliant. + :param int unable_to_perform_count: (optional) The number of checks that + are unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks + that require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable + (with no evaluations) checks. + """ + self.control_specification_id = control_specification_id + self.control_specification_description = control_specification_description + self.component_id = component_id + self.component_name = component_name + self.environment = environment + self.responsibility = responsibility + self.assessments = assessments + self.status = status + self.total_count = total_count + self.compliant_count = compliant_count + self.not_compliant_count = not_compliant_count + self.unable_to_perform_count = unable_to_perform_count + self.user_evaluation_required_count = user_evaluation_required_count + self.not_applicable_count = not_applicable_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlSpecificationWithStats': + """Initialize a ControlSpecificationWithStats object from a json dictionary.""" + args = {} + if (control_specification_id := _dict.get('control_specification_id')) is not None: + args['control_specification_id'] = control_specification_id + if (control_specification_description := _dict.get('control_specification_description')) is not None: + args['control_specification_description'] = control_specification_description + if (component_id := _dict.get('component_id')) is not None: + args['component_id'] = component_id + if (component_name := _dict.get('component_name')) is not None: + args['component_name'] = component_name + if (environment := _dict.get('environment')) is not None: + args['environment'] = environment + if (responsibility := _dict.get('responsibility')) is not None: + args['responsibility'] = responsibility + if (assessments := _dict.get('assessments')) is not None: + args['assessments'] = [AssessmentWithStats.from_dict(v) for v in assessments] + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ControlSpecificationWithStats JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (compliant_count := _dict.get('compliant_count')) is not None: + args['compliant_count'] = compliant_count + if (not_compliant_count := _dict.get('not_compliant_count')) is not None: + args['not_compliant_count'] = not_compliant_count + if (unable_to_perform_count := _dict.get('unable_to_perform_count')) is not None: + args['unable_to_perform_count'] = unable_to_perform_count + if (user_evaluation_required_count := _dict.get('user_evaluation_required_count')) is not None: + args['user_evaluation_required_count'] = user_evaluation_required_count + if (not_applicable_count := _dict.get('not_applicable_count')) is not None: + args['not_applicable_count'] = not_applicable_count + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlSpecificationWithStats 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, 'control_specification_id') and self.control_specification_id is not None: + _dict['control_specification_id'] = self.control_specification_id + if hasattr(self, 'control_specification_description') and self.control_specification_description is not None: + _dict['control_specification_description'] = self.control_specification_description + if hasattr(self, 'component_id') and self.component_id is not None: + _dict['component_id'] = self.component_id + if hasattr(self, 'component_name') and self.component_name is not None: + _dict['component_name'] = self.component_name + if hasattr(self, 'environment') and self.environment is not None: + _dict['environment'] = self.environment + if hasattr(self, 'responsibility') and self.responsibility is not None: + _dict['responsibility'] = self.responsibility + if hasattr(self, 'assessments') and self.assessments is not None: + assessments_list = [] + for v in self.assessments: + if isinstance(v, dict): + assessments_list.append(v) + else: + assessments_list.append(v.to_dict()) + _dict['assessments'] = assessments_list + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'compliant_count') and self.compliant_count is not None: + _dict['compliant_count'] = self.compliant_count + if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: + _dict['not_compliant_count'] = self.not_compliant_count + if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: + _dict['unable_to_perform_count'] = self.unable_to_perform_count + if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: + _dict['user_evaluation_required_count'] = self.user_evaluation_required_count + if hasattr(self, 'not_applicable_count') and self.not_applicable_count is not None: + _dict['not_applicable_count'] = self.not_applicable_count + 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 ControlSpecificationWithStats object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlSpecificationWithStats') -> 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: 'ControlSpecificationWithStats') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class StatusEnum(str, Enum): + """ + The allowed values of an aggregated status for controls, specifications, + assessments, and resources. + """ + + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' + + + +class ControlSummary: + """ + The summary of the control. + + :param str id: (optional) The controls ID. + :param str control_name: (optional) The controls name. + :param str control_description: (optional) The controls description. + """ + + def __init__( + self, + *, + id: Optional[str] = None, + control_name: Optional[str] = None, + control_description: Optional[str] = None, + ) -> None: + """ + Initialize a ControlSummary object. + + :param str id: (optional) The controls ID. + :param str control_name: (optional) The controls name. + :param str control_description: (optional) The controls description. + """ + self.id = id + self.control_name = control_name + self.control_description = control_description + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlSummary': + """Initialize a ControlSummary object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + if (control_name := _dict.get('control_name')) is not None: + args['control_name'] = control_name + if (control_description := _dict.get('control_description')) is not None: + args['control_description'] = control_description + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlSummary 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, 'control_name') and self.control_name is not None: + _dict['control_name'] = self.control_name + if hasattr(self, 'control_description') and self.control_description is not None: + _dict['control_description'] = self.control_description + 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 ControlSummary object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlSummary') -> 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: 'ControlSummary') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ControlWithStats: + """ + The control with compliance stats. + + :param str report_id: (optional) The report ID. + :param str home_account_id: (optional) The home account ID. + :param str id: (optional) The control ID. + :param str control_library_id: (optional) The control library ID. + :param str control_library_version: (optional) The control library version. + :param str control_name: (optional) The control name. + :param str control_description: (optional) The control description. + :param str control_category: (optional) The control category. + :param List[ControlSpecificationWithStats] control_specifications: (optional) + The list of specifications that are on the page. + :param Tags resource_tags: (optional) The collection of different types of tags. + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are not + compliant. + :param int unable_to_perform_count: (optional) The number of checks that are + unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks that + require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable (with + no evaluations) checks. + """ + + def __init__( + self, + status: str, + *, + report_id: Optional[str] = None, + home_account_id: Optional[str] = None, + id: Optional[str] = None, + control_library_id: Optional[str] = None, + control_library_version: Optional[str] = None, + control_name: Optional[str] = None, + control_description: Optional[str] = None, + control_category: Optional[str] = None, + control_specifications: Optional[List['ControlSpecificationWithStats']] = None, + resource_tags: Optional['Tags'] = None, + total_count: Optional[int] = None, + compliant_count: Optional[int] = None, + not_compliant_count: Optional[int] = None, + unable_to_perform_count: Optional[int] = None, + user_evaluation_required_count: Optional[int] = None, + not_applicable_count: Optional[int] = None, + ) -> None: + """ + Initialize a ControlWithStats object. + + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param str report_id: (optional) The report ID. + :param str home_account_id: (optional) The home account ID. + :param str id: (optional) The control ID. + :param str control_library_id: (optional) The control library ID. + :param str control_library_version: (optional) The control library version. + :param str control_name: (optional) The control name. + :param str control_description: (optional) The control description. + :param str control_category: (optional) The control category. + :param List[ControlSpecificationWithStats] control_specifications: + (optional) The list of specifications that are on the page. + :param Tags resource_tags: (optional) The collection of different types of + tags. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are + not compliant. + :param int unable_to_perform_count: (optional) The number of checks that + are unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks + that require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable + (with no evaluations) checks. + """ + self.report_id = report_id + self.home_account_id = home_account_id + self.id = id + self.control_library_id = control_library_id + self.control_library_version = control_library_version + self.control_name = control_name + self.control_description = control_description + self.control_category = control_category + self.control_specifications = control_specifications + self.resource_tags = resource_tags + self.status = status + self.total_count = total_count + self.compliant_count = compliant_count + self.not_compliant_count = not_compliant_count + self.unable_to_perform_count = unable_to_perform_count + self.user_evaluation_required_count = user_evaluation_required_count + self.not_applicable_count = not_applicable_count + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ControlWithStats': + """Initialize a ControlWithStats object from a json dictionary.""" + args = {} + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (id := _dict.get('id')) is not None: + args['id'] = id + if (control_library_id := _dict.get('control_library_id')) is not None: + args['control_library_id'] = control_library_id + if (control_library_version := _dict.get('control_library_version')) is not None: + args['control_library_version'] = control_library_version + if (control_name := _dict.get('control_name')) is not None: + args['control_name'] = control_name + if (control_description := _dict.get('control_description')) is not None: + args['control_description'] = control_description + if (control_category := _dict.get('control_category')) is not None: + args['control_category'] = control_category + if (control_specifications := _dict.get('control_specifications')) is not None: + args['control_specifications'] = [ControlSpecificationWithStats.from_dict(v) for v in control_specifications] + if (resource_tags := _dict.get('resource_tags')) is not None: + args['resource_tags'] = Tags.from_dict(resource_tags) + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ControlWithStats JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (compliant_count := _dict.get('compliant_count')) is not None: + args['compliant_count'] = compliant_count + if (not_compliant_count := _dict.get('not_compliant_count')) is not None: + args['not_compliant_count'] = not_compliant_count + if (unable_to_perform_count := _dict.get('unable_to_perform_count')) is not None: + args['unable_to_perform_count'] = unable_to_perform_count + if (user_evaluation_required_count := _dict.get('user_evaluation_required_count')) is not None: + args['user_evaluation_required_count'] = user_evaluation_required_count + if (not_applicable_count := _dict.get('not_applicable_count')) is not None: + args['not_applicable_count'] = not_applicable_count + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ControlWithStats 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, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'control_library_id') and self.control_library_id is not None: + _dict['control_library_id'] = self.control_library_id + if hasattr(self, 'control_library_version') and self.control_library_version is not None: + _dict['control_library_version'] = self.control_library_version + if hasattr(self, 'control_name') and self.control_name is not None: + _dict['control_name'] = self.control_name + if hasattr(self, 'control_description') and self.control_description is not None: + _dict['control_description'] = self.control_description + if hasattr(self, 'control_category') and self.control_category is not None: + _dict['control_category'] = self.control_category + if hasattr(self, 'control_specifications') and self.control_specifications is not None: + control_specifications_list = [] + for v in self.control_specifications: + if isinstance(v, dict): + control_specifications_list.append(v) + else: + control_specifications_list.append(v.to_dict()) + _dict['control_specifications'] = control_specifications_list + if hasattr(self, 'resource_tags') and self.resource_tags is not None: + if isinstance(self.resource_tags, dict): + _dict['resource_tags'] = self.resource_tags + else: + _dict['resource_tags'] = self.resource_tags.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'compliant_count') and self.compliant_count is not None: + _dict['compliant_count'] = self.compliant_count + if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: + _dict['not_compliant_count'] = self.not_compliant_count + if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: + _dict['unable_to_perform_count'] = self.unable_to_perform_count + if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: + _dict['user_evaluation_required_count'] = self.user_evaluation_required_count + if hasattr(self, 'not_applicable_count') and self.not_applicable_count is not None: + _dict['not_applicable_count'] = self.not_applicable_count + 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 ControlWithStats object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'ControlWithStats') -> 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: 'ControlWithStats') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class StatusEnum(str, Enum): + """ + The allowed values of an aggregated status for controls, specifications, + assessments, and resources. + """ + + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' + + + +class CreateScanReport: + """ + The scan report ID. + + :param str id: (optional) The scan report ID. + """ + + def __init__( + self, + *, + id: Optional[str] = None, + ) -> None: + """ + Initialize a CreateScanReport object. + + :param str id: (optional) The scan report ID. + """ + self.id = id + + @classmethod + def from_dict(cls, _dict: Dict) -> 'CreateScanReport': + """Initialize a CreateScanReport object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a CreateScanReport 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 + 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 CreateScanReport object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'CreateScanReport') -> 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: 'CreateScanReport') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class CreateScanResponse: + """ + The response that details the whether starting a scan was successful. + + :param str id: (optional) The ID of the scan generated. + :param str account_id: (optional) The ID of the account associated with the + scan. + :param str attachment_id: (optional) The ID of the profile attachment associated + with the scan. + :param str report_id: (optional) The ID of the report associated with the scan. + :param str status: (optional) Details the state of a scan. + :param datetime last_scan_time: (optional) The last time a scan was performed. + :param datetime next_scan_time: (optional) The next time a scan will be + triggered. + :param str scan_type: (optional) Shows how a scan gets triggered. + :param int occurence: (optional) The number of times the scan appeared. + """ + + def __init__( + self, + *, + id: Optional[str] = None, + account_id: Optional[str] = None, + attachment_id: Optional[str] = None, + report_id: Optional[str] = None, + status: Optional[str] = None, + last_scan_time: Optional[datetime] = None, + next_scan_time: Optional[datetime] = None, + scan_type: Optional[str] = None, + occurence: Optional[int] = None, + ) -> None: + """ + Initialize a CreateScanResponse object. + + :param str id: (optional) The ID of the scan generated. + :param str account_id: (optional) The ID of the account associated with the + scan. + :param str attachment_id: (optional) The ID of the profile attachment + associated with the scan. + :param str report_id: (optional) The ID of the report associated with the + scan. + :param str status: (optional) Details the state of a scan. + :param datetime last_scan_time: (optional) The last time a scan was + performed. + :param datetime next_scan_time: (optional) The next time a scan will be + triggered. + :param str scan_type: (optional) Shows how a scan gets triggered. + :param int occurence: (optional) The number of times the scan appeared. + """ + self.id = id + self.account_id = account_id + self.attachment_id = attachment_id + self.report_id = report_id + self.status = status + self.last_scan_time = last_scan_time + self.next_scan_time = next_scan_time + self.scan_type = scan_type + self.occurence = occurence + + @classmethod + def from_dict(cls, _dict: Dict) -> 'CreateScanResponse': + """Initialize a CreateScanResponse object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + if (account_id := _dict.get('account_id')) is not None: + args['account_id'] = account_id + if (attachment_id := _dict.get('attachment_id')) is not None: + args['attachment_id'] = attachment_id + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (status := _dict.get('status')) is not None: + args['status'] = status + if (last_scan_time := _dict.get('last_scan_time')) is not None: + args['last_scan_time'] = string_to_datetime(last_scan_time) + if (next_scan_time := _dict.get('next_scan_time')) is not None: + args['next_scan_time'] = string_to_datetime(next_scan_time) + if (scan_type := _dict.get('scan_type')) is not None: + args['scan_type'] = scan_type + if (occurence := _dict.get('occurence')) is not None: + args['occurence'] = occurence + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a CreateScanResponse 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, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'attachment_id') and self.attachment_id is not None: + _dict['attachment_id'] = self.attachment_id + if hasattr(self, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'last_scan_time') and self.last_scan_time is not None: + _dict['last_scan_time'] = datetime_to_string(self.last_scan_time) + if hasattr(self, 'next_scan_time') and self.next_scan_time is not None: + _dict['next_scan_time'] = datetime_to_string(self.next_scan_time) + if hasattr(self, 'scan_type') and self.scan_type is not None: + _dict['scan_type'] = self.scan_type + if hasattr(self, 'occurence') and self.occurence is not None: + _dict['occurence'] = self.occurence + 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 CreateScanResponse object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'CreateScanResponse') -> 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: 'CreateScanResponse') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class Credential: + """ + Credential. + + :param str secret_crn: The CRN of the secret. + :param List[Resource] resources: Credential having service name and instance + crn. + """ + + def __init__( + self, + secret_crn: str, + resources: List['Resource'], + ) -> None: + """ + Initialize a Credential object. + + :param str secret_crn: The CRN of the secret. + :param List[Resource] resources: Credential having service name and + instance crn. + """ + self.secret_crn = secret_crn + self.resources = resources + + @classmethod + def from_dict(cls, _dict: Dict) -> 'Credential': + """Initialize a Credential object from a json dictionary.""" + args = {} + if (secret_crn := _dict.get('secret_crn')) is not None: + args['secret_crn'] = secret_crn + else: + raise ValueError('Required property \'secret_crn\' not present in Credential JSON') + if (resources := _dict.get('resources')) is not None: + args['resources'] = [Resource.from_dict(v) for v in resources] + else: + raise ValueError('Required property \'resources\' not present in Credential JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Credential 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, 'secret_crn') and self.secret_crn is not None: + _dict['secret_crn'] = self.secret_crn + if hasattr(self, 'resources') and self.resources is not None: + resources_list = [] + for v in self.resources: + if isinstance(v, dict): + resources_list.append(v) + else: + resources_list.append(v.to_dict()) + _dict['resources'] = resources_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 Credential object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'Credential') -> 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: 'Credential') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class CredentialResponse: + """ + CredentialResponse. + + :param str type: The type of the credential. + :param str secret_crn: The CRN of the secret. + :param str secret_name: (optional) The name of the secret. + :param List[Resource] resources: Credential having service name and instance + crn. + """ + + def __init__( + self, + type: str, + secret_crn: str, + resources: List['Resource'], + *, + secret_name: Optional[str] = None, + ) -> None: + """ + Initialize a CredentialResponse object. + + :param str type: The type of the credential. + :param str secret_crn: The CRN of the secret. + :param List[Resource] resources: Credential having service name and + instance crn. + :param str secret_name: (optional) The name of the secret. + """ + self.type = type + self.secret_crn = secret_crn + self.secret_name = secret_name + self.resources = resources + + @classmethod + def from_dict(cls, _dict: Dict) -> 'CredentialResponse': + """Initialize a CredentialResponse object from a json dictionary.""" + args = {} + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in CredentialResponse JSON') + if (secret_crn := _dict.get('secret_crn')) is not None: + args['secret_crn'] = secret_crn + else: + raise ValueError('Required property \'secret_crn\' not present in CredentialResponse JSON') + if (secret_name := _dict.get('secret_name')) is not None: + args['secret_name'] = secret_name + if (resources := _dict.get('resources')) is not None: + args['resources'] = [Resource.from_dict(v) for v in resources] + else: + raise ValueError('Required property \'resources\' not present in CredentialResponse JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a CredentialResponse 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, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'secret_crn') and self.secret_crn is not None: + _dict['secret_crn'] = self.secret_crn + if hasattr(self, 'secret_name') and self.secret_name is not None: + _dict['secret_name'] = self.secret_name + if hasattr(self, 'resources') and self.resources is not None: + resources_list = [] + for v in self.resources: + if isinstance(v, dict): + resources_list.append(v) + else: + resources_list.append(v.to_dict()) + _dict['resources'] = resources_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 CredentialResponse object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'CredentialResponse') -> 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: 'CredentialResponse') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class DateRange: + """ + Date range. + + :param datetime start_date: date/time for the start of the range. + :param datetime end_date: date/time for the end of the range. + """ + + def __init__( + self, + start_date: datetime, + end_date: datetime, + ) -> None: + """ + Initialize a DateRange object. + + :param datetime start_date: date/time for the start of the range. + :param datetime end_date: date/time for the end of the range. + """ + self.start_date = start_date + self.end_date = end_date + + @classmethod + def from_dict(cls, _dict: Dict) -> 'DateRange': + """Initialize a DateRange object from a json dictionary.""" + args = {} + if (start_date := _dict.get('start_date')) is not None: + args['start_date'] = string_to_datetime(start_date) + else: + raise ValueError('Required property \'start_date\' not present in DateRange JSON') + if (end_date := _dict.get('end_date')) is not None: + args['end_date'] = string_to_datetime(end_date) + else: + raise ValueError('Required property \'end_date\' not present in DateRange JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a DateRange 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, 'start_date') and self.start_date is not None: + _dict['start_date'] = datetime_to_string(self.start_date) + if hasattr(self, 'end_date') and self.end_date is not None: + _dict['end_date'] = datetime_to_string(self.end_date) + 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 DateRange object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'DateRange') -> 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: 'DateRange') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class DefaultParameters: + """ + The parameters of the profile that are inherently set by the profile. + + :param str assessment_type: (optional) The type of the implementation. + :param str assessment_id: (optional) The implementation ID of the parameter. + :param str parameter_name: (optional) The parameter's name. + :param str parameter_default_value: (optional) The default value of the + parameter. + :param str parameter_display_name: (optional) The parameter display name. + :param str parameter_type: (optional) The parameter type. + """ + + def __init__( + self, + *, + assessment_type: Optional[str] = None, + assessment_id: Optional[str] = None, + parameter_name: Optional[str] = None, + parameter_default_value: Optional[str] = None, + parameter_display_name: Optional[str] = None, + parameter_type: Optional[str] = None, + ) -> None: + """ + Initialize a DefaultParameters object. + + :param str assessment_type: (optional) The type of the implementation. + :param str assessment_id: (optional) The implementation ID of the + parameter. + :param str parameter_name: (optional) The parameter's name. + :param str parameter_default_value: (optional) The default value of the + parameter. + :param str parameter_display_name: (optional) The parameter display name. + :param str parameter_type: (optional) The parameter type. + """ + self.assessment_type = assessment_type + self.assessment_id = assessment_id + self.parameter_name = parameter_name + self.parameter_default_value = parameter_default_value + self.parameter_display_name = parameter_display_name + self.parameter_type = parameter_type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'DefaultParameters': + """Initialize a DefaultParameters object from a json dictionary.""" + args = {} + if (assessment_type := _dict.get('assessment_type')) is not None: + args['assessment_type'] = assessment_type + if (assessment_id := _dict.get('assessment_id')) is not None: + args['assessment_id'] = assessment_id + if (parameter_name := _dict.get('parameter_name')) is not None: + args['parameter_name'] = parameter_name + if (parameter_default_value := _dict.get('parameter_default_value')) is not None: + args['parameter_default_value'] = parameter_default_value + if (parameter_display_name := _dict.get('parameter_display_name')) is not None: + args['parameter_display_name'] = parameter_display_name + if (parameter_type := _dict.get('parameter_type')) is not None: + args['parameter_type'] = parameter_type + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a DefaultParameters 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, 'assessment_type') and self.assessment_type is not None: + _dict['assessment_type'] = self.assessment_type + if hasattr(self, 'assessment_id') and self.assessment_id is not None: + _dict['assessment_id'] = self.assessment_id + if hasattr(self, 'parameter_name') and self.parameter_name is not None: + _dict['parameter_name'] = self.parameter_name + if hasattr(self, 'parameter_default_value') and self.parameter_default_value is not None: + _dict['parameter_default_value'] = self.parameter_default_value + if hasattr(self, 'parameter_display_name') and self.parameter_display_name is not None: + _dict['parameter_display_name'] = self.parameter_display_name + if hasattr(self, 'parameter_type') and self.parameter_type is not None: + _dict['parameter_type'] = self.parameter_type + return _dict + + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() + + def __str__(self) -> str: + """Return a `str` version of this DefaultParameters object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'DefaultParameters') -> 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: 'DefaultParameters') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class DefaultParametersChanges: + """ + Shows details of the parameters that were changed. + + :param int total_added: (optional) Number of parameters added. + :param int total_removed: (optional) Number of parameters removed. + :param int total_updated: (optional) Number of parameters updated. + :param List[DefaultParameters] added: List of parameters added. + :param List[DefaultParameters] removed: List of parameters removed. + :param List[DefaultParametersDifference] updated: List of parameters updated. + """ + + def __init__( + self, + added: List['DefaultParameters'], + removed: List['DefaultParameters'], + updated: List['DefaultParametersDifference'], + *, + total_added: Optional[int] = None, + total_removed: Optional[int] = None, + total_updated: Optional[int] = None, + ) -> None: + """ + Initialize a DefaultParametersChanges object. + + :param List[DefaultParameters] added: List of parameters added. + :param List[DefaultParameters] removed: List of parameters removed. + :param List[DefaultParametersDifference] updated: List of parameters + updated. + :param int total_added: (optional) Number of parameters added. + :param int total_removed: (optional) Number of parameters removed. + :param int total_updated: (optional) Number of parameters updated. + """ + self.total_added = total_added + self.total_removed = total_removed + self.total_updated = total_updated + self.added = added + self.removed = removed + self.updated = updated + + @classmethod + def from_dict(cls, _dict: Dict) -> 'DefaultParametersChanges': + """Initialize a DefaultParametersChanges object from a json dictionary.""" + args = {} + if (total_added := _dict.get('total_added')) is not None: + args['total_added'] = total_added + if (total_removed := _dict.get('total_removed')) is not None: + args['total_removed'] = total_removed + if (total_updated := _dict.get('total_updated')) is not None: + args['total_updated'] = total_updated + if (added := _dict.get('added')) is not None: + args['added'] = [DefaultParameters.from_dict(v) for v in added] + else: + raise ValueError('Required property \'added\' not present in DefaultParametersChanges JSON') + if (removed := _dict.get('removed')) is not None: + args['removed'] = [DefaultParameters.from_dict(v) for v in removed] + else: + raise ValueError('Required property \'removed\' not present in DefaultParametersChanges JSON') + if (updated := _dict.get('updated')) is not None: + args['updated'] = [DefaultParametersDifference.from_dict(v) for v in updated] + else: + raise ValueError('Required property \'updated\' not present in DefaultParametersChanges JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a DefaultParametersChanges 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, 'total_added') and self.total_added is not None: + _dict['total_added'] = self.total_added + if hasattr(self, 'total_removed') and self.total_removed is not None: + _dict['total_removed'] = self.total_removed + if hasattr(self, 'total_updated') and self.total_updated is not None: + _dict['total_updated'] = self.total_updated + if hasattr(self, 'added') and self.added is not None: + added_list = [] + for v in self.added: + if isinstance(v, dict): + added_list.append(v) + else: + added_list.append(v.to_dict()) + _dict['added'] = added_list + if hasattr(self, 'removed') and self.removed is not None: + removed_list = [] + for v in self.removed: + if isinstance(v, dict): + removed_list.append(v) + else: + removed_list.append(v.to_dict()) + _dict['removed'] = removed_list + if hasattr(self, 'updated') and self.updated is not None: + updated_list = [] + for v in self.updated: + if isinstance(v, dict): + updated_list.append(v) + else: + updated_list.append(v.to_dict()) + _dict['updated'] = updated_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 DefaultParametersChanges object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'DefaultParametersChanges') -> 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: 'DefaultParametersChanges') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class DefaultParametersDifference: + """ + Details the difference between the current parameters compared to the latest. + + :param DefaultParameters current: (optional) The parameters of the profile that + are inherently set by the profile. + :param DefaultParameters latest: (optional) The parameters of the profile that + are inherently set by the profile. + """ + + def __init__( + self, + *, + current: Optional['DefaultParameters'] = None, + latest: Optional['DefaultParameters'] = None, + ) -> None: + """ + Initialize a DefaultParametersDifference object. + + :param DefaultParameters current: (optional) The parameters of the profile + that are inherently set by the profile. + :param DefaultParameters latest: (optional) The parameters of the profile + that are inherently set by the profile. + """ + self.current = current + self.latest = latest + + @classmethod + def from_dict(cls, _dict: Dict) -> 'DefaultParametersDifference': + """Initialize a DefaultParametersDifference object from a json dictionary.""" + args = {} + if (current := _dict.get('current')) is not None: + args['current'] = DefaultParameters.from_dict(current) + if (latest := _dict.get('latest')) is not None: + args['latest'] = DefaultParameters.from_dict(latest) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a DefaultParametersDifference 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, 'current') and self.current is not None: + if isinstance(self.current, dict): + _dict['current'] = self.current + else: + _dict['current'] = self.current.to_dict() + if hasattr(self, 'latest') and self.latest is not None: + if isinstance(self.latest, dict): + _dict['latest'] = self.latest + else: + _dict['latest'] = self.latest.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 DefaultParametersDifference object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'DefaultParametersDifference') -> 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: 'DefaultParametersDifference') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class Endpoint: + """ + The service configurations endpoint. + + :param str host: (optional) The endpoint host. + :param str path: (optional) The endpoint path. + :param str region: (optional) The endpoint region. + :param int advisory_call_limit: (optional) The endpoints advisory call limit. + """ + + def __init__( + self, + *, + host: Optional[str] = None, + path: Optional[str] = None, + region: Optional[str] = None, + advisory_call_limit: Optional[int] = None, + ) -> None: + """ + Initialize a Endpoint object. + + :param str host: (optional) The endpoint host. + :param str path: (optional) The endpoint path. + :param str region: (optional) The endpoint region. + :param int advisory_call_limit: (optional) The endpoints advisory call + limit. + """ + self.host = host + self.path = path + self.region = region + self.advisory_call_limit = advisory_call_limit + + @classmethod + def from_dict(cls, _dict: Dict) -> 'Endpoint': + """Initialize a Endpoint object from a json dictionary.""" + args = {} + if (host := _dict.get('host')) is not None: + args['host'] = host + if (path := _dict.get('path')) is not None: + args['path'] = path + if (region := _dict.get('region')) is not None: + args['region'] = region + if (advisory_call_limit := _dict.get('advisory_call_limit')) is not None: + args['advisory_call_limit'] = advisory_call_limit + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Endpoint 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, 'host') and self.host is not None: + _dict['host'] = self.host + if hasattr(self, 'path') and self.path is not None: + _dict['path'] = self.path + if hasattr(self, 'region') and self.region is not None: + _dict['region'] = self.region + if hasattr(self, 'advisory_call_limit') and self.advisory_call_limit is not None: + _dict['advisory_call_limit'] = self.advisory_call_limit + 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 Endpoint object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'Endpoint') -> 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: 'Endpoint') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class EvalStats: + """ + The evaluation stats. + + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of evaluations. + :param int pass_count: (optional) The number of passed evaluations. + :param int failure_count: (optional) The number of failed evaluations. + :param int error_count: (optional) The number of evaluations that started, but + did not finish, and ended with errors. + :param int skipped_count: (optional) The number of assessments with no + corresponding evaluations. + :param int completed_count: (optional) The total number of completed + evaluations. + """ + + def __init__( + self, + status: str, + *, + total_count: Optional[int] = None, + pass_count: Optional[int] = None, + failure_count: Optional[int] = None, + error_count: Optional[int] = None, + skipped_count: Optional[int] = None, + completed_count: Optional[int] = None, + ) -> None: """ - self.id = id - self.name = name - self.type = type + Initialize a EvalStats object. + + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of evaluations. + :param int pass_count: (optional) The number of passed evaluations. + :param int failure_count: (optional) The number of failed evaluations. + :param int error_count: (optional) The number of evaluations that started, + but did not finish, and ended with errors. + :param int skipped_count: (optional) The number of assessments with no + corresponding evaluations. + :param int completed_count: (optional) The total number of completed + evaluations. + """ + self.status = status + self.total_count = total_count + self.pass_count = pass_count + self.failure_count = failure_count + self.error_count = error_count + self.skipped_count = skipped_count + self.completed_count = completed_count @classmethod - def from_dict(cls, _dict: Dict) -> 'Account': - """Initialize a Account object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EvalStats': + """Initialize a EvalStats object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'type' in _dict: - args['type'] = _dict.get('type') + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in EvalStats JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (pass_count := _dict.get('pass_count')) is not None: + args['pass_count'] = pass_count + if (failure_count := _dict.get('failure_count')) is not None: + args['failure_count'] = failure_count + if (error_count := _dict.get('error_count')) is not None: + args['error_count'] = error_count + if (skipped_count := _dict.get('skipped_count')) is not None: + args['skipped_count'] = skipped_count + if (completed_count := _dict.get('completed_count')) is not None: + args['completed_count'] = completed_count return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Account object from a json dictionary.""" + """Initialize a EvalStats 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, '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, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'pass_count') and self.pass_count is not None: + _dict['pass_count'] = self.pass_count + if hasattr(self, 'failure_count') and self.failure_count is not None: + _dict['failure_count'] = self.failure_count + if hasattr(self, 'error_count') and self.error_count is not None: + _dict['error_count'] = self.error_count + if hasattr(self, 'skipped_count') and self.skipped_count is not None: + _dict['skipped_count'] = self.skipped_count + if hasattr(self, 'completed_count') and self.completed_count is not None: + _dict['completed_count'] = self.completed_count return _dict def _to_dict(self): @@ -3586,71 +8973,384 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Account object.""" + """Return a `str` version of this EvalStats object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Account') -> bool: + def __eq__(self, other: 'EvalStats') -> 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: 'Account') -> bool: + def __ne__(self, other: 'EvalStats') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class StatusEnum(str, Enum): + """ + The allowed values of an aggregated status for controls, specifications, + assessments, and resources. + """ -class AdditionalProperty: + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' + + + +class Evaluation: """ - AdditionalProperty. + The evaluation of a control specification assessment. - :attr str type: An additional property that indicates the type of the attribute - in various formats (text, url, secret, label, masked). - :attr str display_name: The name of the attribute that is displayed in the UI. + :param str report_id: (optional) The ID of the report that is associated to the + evaluation. + :param str home_account_id: (optional) The ID of the home account. + :param str component_id: (optional) The component ID. + :param str component_name: (optional) The components name. + :param Assessment assessment: (optional) The control specification assessment. + :param str evaluate_time: (optional) The time when the evaluation was made. + :param TargetInfo target: (optional) The evaluation target. + :param str status: The allowed values of an evaluation status. + :param str reason: (optional) The reason for the evaluation failure. + :param EvaluationDetails details: (optional) A list of details related to the + Evaluation. + :param str evaluated_by: (optional) By whom the evaluation was made for erictree + results. """ def __init__( self, - type: str, - display_name: str, + status: str, + *, + report_id: Optional[str] = None, + home_account_id: Optional[str] = None, + component_id: Optional[str] = None, + component_name: Optional[str] = None, + assessment: Optional['Assessment'] = None, + evaluate_time: Optional[str] = None, + target: Optional['TargetInfo'] = None, + reason: Optional[str] = None, + details: Optional['EvaluationDetails'] = None, + evaluated_by: Optional[str] = None, ) -> None: """ - Initialize a AdditionalProperty object. + Initialize a Evaluation object. - :param str type: An additional property that indicates the type of the - attribute in various formats (text, url, secret, label, masked). - :param str display_name: The name of the attribute that is displayed in the - UI. + :param str status: The allowed values of an evaluation status. + :param str report_id: (optional) The ID of the report that is associated to + the evaluation. + :param str home_account_id: (optional) The ID of the home account. + :param str component_id: (optional) The component ID. + :param str component_name: (optional) The components name. + :param Assessment assessment: (optional) The control specification + assessment. + :param str evaluate_time: (optional) The time when the evaluation was made. + :param TargetInfo target: (optional) The evaluation target. + :param str reason: (optional) The reason for the evaluation failure. + :param EvaluationDetails details: (optional) A list of details related to + the Evaluation. + :param str evaluated_by: (optional) By whom the evaluation was made for + erictree results. + """ + self.report_id = report_id + self.home_account_id = home_account_id + self.component_id = component_id + self.component_name = component_name + self.assessment = assessment + self.evaluate_time = evaluate_time + self.target = target + self.status = status + self.reason = reason + self.details = details + self.evaluated_by = evaluated_by + + @classmethod + def from_dict(cls, _dict: Dict) -> 'Evaluation': + """Initialize a Evaluation object from a json dictionary.""" + args = {} + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (component_id := _dict.get('component_id')) is not None: + args['component_id'] = component_id + if (component_name := _dict.get('component_name')) is not None: + args['component_name'] = component_name + if (assessment := _dict.get('assessment')) is not None: + args['assessment'] = Assessment.from_dict(assessment) + if (evaluate_time := _dict.get('evaluate_time')) is not None: + args['evaluate_time'] = evaluate_time + if (target := _dict.get('target')) is not None: + args['target'] = TargetInfo.from_dict(target) + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in Evaluation JSON') + if (reason := _dict.get('reason')) is not None: + args['reason'] = reason + if (details := _dict.get('details')) is not None: + args['details'] = EvaluationDetails.from_dict(details) + if (evaluated_by := _dict.get('evaluated_by')) is not None: + args['evaluated_by'] = evaluated_by + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Evaluation 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, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'component_id') and self.component_id is not None: + _dict['component_id'] = self.component_id + if hasattr(self, 'component_name') and self.component_name is not None: + _dict['component_name'] = self.component_name + if hasattr(self, 'assessment') and self.assessment is not None: + if isinstance(self.assessment, dict): + _dict['assessment'] = self.assessment + else: + _dict['assessment'] = self.assessment.to_dict() + if hasattr(self, 'evaluate_time') and self.evaluate_time is not None: + _dict['evaluate_time'] = self.evaluate_time + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'reason') and self.reason is not None: + _dict['reason'] = self.reason + if hasattr(self, 'details') and self.details is not None: + if isinstance(self.details, dict): + _dict['details'] = self.details + else: + _dict['details'] = self.details.to_dict() + if hasattr(self, 'evaluated_by') and self.evaluated_by is not None: + _dict['evaluated_by'] = self.evaluated_by + 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 Evaluation object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'Evaluation') -> 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: 'Evaluation') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + class StatusEnum(str, Enum): + """ + The allowed values of an evaluation status. + """ + + PASS = 'pass' + FAILURE = 'failure' + ERROR = 'error' + SKIPPED = 'skipped' + + + +class EvaluationDetails: + """ + A list of details related to the Evaluation. + + :param List[EvaluationProperty] properties: (optional) Details the evaluations + that were incorrect. + :param EvaluationProviderInfo provider_info: (optional) The source provider of + the evaluation. + """ + + def __init__( + self, + *, + properties: Optional[List['EvaluationProperty']] = None, + provider_info: Optional['EvaluationProviderInfo'] = None, + ) -> None: + """ + Initialize a EvaluationDetails object. + + :param List[EvaluationProperty] properties: (optional) Details the + evaluations that were incorrect. + :param EvaluationProviderInfo provider_info: (optional) The source provider + of the evaluation. + """ + self.properties = properties + self.provider_info = provider_info + + @classmethod + def from_dict(cls, _dict: Dict) -> 'EvaluationDetails': + """Initialize a EvaluationDetails object from a json dictionary.""" + args = {} + if (properties := _dict.get('properties')) is not None: + args['properties'] = [EvaluationProperty.from_dict(v) for v in properties] + if (provider_info := _dict.get('provider_info')) is not None: + args['provider_info'] = EvaluationProviderInfo.from_dict(provider_info) + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a EvaluationDetails 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, 'properties') and self.properties is not None: + properties_list = [] + for v in self.properties: + if isinstance(v, dict): + properties_list.append(v) + else: + properties_list.append(v.to_dict()) + _dict['properties'] = properties_list + if hasattr(self, 'provider_info') and self.provider_info is not None: + if isinstance(self.provider_info, dict): + _dict['provider_info'] = self.provider_info + else: + _dict['provider_info'] = self.provider_info.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 EvaluationDetails object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'EvaluationDetails') -> 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: 'EvaluationDetails') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class EvaluationPage: + """ + The page of assessment evaluations. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param str report_id: (optional) The ID of the report. + :param str home_account_id: (optional) The ID of the home account. + :param List[Evaluation] evaluations: (optional) The list of evaluations that are + on the page. + """ + + def __init__( + self, + limit: int, + total_count: int, + *, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, + report_id: Optional[str] = None, + home_account_id: Optional[str] = None, + evaluations: Optional[List['Evaluation']] = None, + ) -> None: + """ + Initialize a EvaluationPage object. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param str report_id: (optional) The ID of the report. + :param str home_account_id: (optional) The ID of the home account. + :param List[Evaluation] evaluations: (optional) The list of evaluations + that are on the page. """ - self.type = type - self.display_name = display_name + self.limit = limit + self.total_count = total_count + self.first = first + self.next = next + self.report_id = report_id + self.home_account_id = home_account_id + self.evaluations = evaluations @classmethod - def from_dict(cls, _dict: Dict) -> 'AdditionalProperty': - """Initialize a AdditionalProperty object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EvaluationPage': + """Initialize a EvaluationPage object from a json dictionary.""" args = {} - if 'type' in _dict: - args['type'] = _dict.get('type') + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit else: - raise ValueError('Required property \'type\' not present in AdditionalProperty JSON') - if 'display_name' in _dict: - args['display_name'] = _dict.get('display_name') + raise ValueError('Required property \'limit\' not present in EvaluationPage JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count else: - raise ValueError('Required property \'display_name\' not present in AdditionalProperty JSON') + raise ValueError('Required property \'total_count\' not present in EvaluationPage JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (evaluations := _dict.get('evaluations')) is not None: + args['evaluations'] = [Evaluation.from_dict(v) for v in evaluations] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AdditionalProperty object from a json dictionary.""" + """Initialize a EvaluationPage 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, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'display_name') and self.display_name is not None: - _dict['display_name'] = self.display_name + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'evaluations') and self.evaluations is not None: + evaluations_list = [] + for v in self.evaluations: + if isinstance(v, dict): + evaluations_list.append(v) + else: + evaluations_list.append(v.to_dict()) + _dict['evaluations'] = evaluations_list return _dict def _to_dict(self): @@ -3658,86 +9358,92 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AdditionalProperty object.""" + """Return a `str` version of this EvaluationPage object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AdditionalProperty') -> bool: + def __eq__(self, other: 'EvaluationPage') -> 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: 'AdditionalProperty') -> bool: + def __ne__(self, other: 'EvaluationPage') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): - """ - An additional property that indicates the type of the attribute in various formats - (text, url, secret, label, masked). - """ - - SECRET = 'secret' - LABEL = 'label' - URL = 'url' - TEXT = 'text' - MASKED = 'masked' - - -class AdditionalTargetAttribute: +class EvaluationProperty: """ - The additional target attribute of the service. + An aspect of the evaluation. - :attr str name: (optional) The additional target attribute name. - :attr str operator: (optional) The operator. - :attr str value: (optional) The value. + :param str property: (optional) The attribute of the resource. + :param str property_description: (optional) An explanation of the resourcer. + :param str operator: The operator used during the evaluation. + :param object expected_value: (optional) + :param object found_value: (optional) """ def __init__( self, + operator: str, *, - name: str = None, - operator: str = None, - value: str = None, + property: Optional[str] = None, + property_description: Optional[str] = None, + expected_value: Optional[object] = None, + found_value: Optional[object] = None, ) -> None: """ - Initialize a AdditionalTargetAttribute object. + Initialize a EvaluationProperty object. - :param str name: (optional) The additional target attribute name. - :param str operator: (optional) The operator. - :param str value: (optional) The value. + :param str operator: The operator used during the evaluation. + :param str property: (optional) The attribute of the resource. + :param str property_description: (optional) An explanation of the + resourcer. + :param object expected_value: (optional) + :param object found_value: (optional) """ - self.name = name + self.property = property + self.property_description = property_description self.operator = operator - self.value = value + self.expected_value = expected_value + self.found_value = found_value @classmethod - def from_dict(cls, _dict: Dict) -> 'AdditionalTargetAttribute': - """Initialize a AdditionalTargetAttribute object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EvaluationProperty': + """Initialize a EvaluationProperty object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'operator' in _dict: - args['operator'] = _dict.get('operator') - if 'value' in _dict: - args['value'] = _dict.get('value') + if (property := _dict.get('property')) is not None: + args['property'] = property + if (property_description := _dict.get('property_description')) is not None: + args['property_description'] = property_description + if (operator := _dict.get('operator')) is not None: + args['operator'] = operator + else: + raise ValueError('Required property \'operator\' not present in EvaluationProperty JSON') + if (expected_value := _dict.get('expected_value')) is not None: + args['expected_value'] = expected_value + if (found_value := _dict.get('found_value')) is not None: + args['found_value'] = found_value return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AdditionalTargetAttribute object from a json dictionary.""" + """Initialize a EvaluationProperty 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, 'name') and self.name is not None: - _dict['name'] = self.name + if hasattr(self, 'property') and self.property is not None: + _dict['property'] = self.property + if hasattr(self, 'property_description') and self.property_description is not None: + _dict['property_description'] = self.property_description 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, 'expected_value') and self.expected_value is not None: + _dict['expected_value'] = self.expected_value + if hasattr(self, 'found_value') and self.found_value is not None: + _dict['found_value'] = self.found_value return _dict def _to_dict(self): @@ -3745,22 +9451,22 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AdditionalTargetAttribute object.""" + """Return a `str` version of this EvaluationProperty object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AdditionalTargetAttribute') -> bool: + def __eq__(self, other: 'EvaluationProperty') -> 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: 'AdditionalTargetAttribute') -> bool: + def __ne__(self, other: 'EvaluationProperty') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other class OperatorEnum(str, Enum): """ - The operator. + The operator used during the evaluation. """ STRING_EQUALS = 'string_equals' @@ -3789,93 +9495,43 @@ class OperatorEnum(str, Enum): -class Assessment: +class EvaluationProviderInfo: """ - The control specification assessment. + The source provider of the evaluation. - :attr str assessment_id: (optional) The assessment ID. - :attr str assessment_type: (optional) The assessment type. - :attr str assessment_method: (optional) The assessment method. - :attr str assessment_description: (optional) The assessment description. - :attr int parameter_count: (optional) The number of parameters of this - assessment. - :attr List[ParameterInfo] parameters: (optional) The list of parameters of this - assessment. + :param str provider_type: (optional) Details the source of the evaluation. """ def __init__( self, *, - assessment_id: str = None, - assessment_type: str = None, - assessment_method: str = None, - assessment_description: str = None, - parameter_count: int = None, - parameters: List['ParameterInfo'] = None, + provider_type: Optional[str] = None, ) -> None: """ - Initialize a Assessment object. + Initialize a EvaluationProviderInfo object. - :param str assessment_id: (optional) The assessment ID. - :param str assessment_type: (optional) The assessment type. - :param str assessment_method: (optional) The assessment method. - :param str assessment_description: (optional) The assessment description. - :param int parameter_count: (optional) The number of parameters of this - assessment. - :param List[ParameterInfo] parameters: (optional) The list of parameters of - this assessment. + :param str provider_type: (optional) Details the source of the evaluation. """ - self.assessment_id = assessment_id - self.assessment_type = assessment_type - self.assessment_method = assessment_method - self.assessment_description = assessment_description - self.parameter_count = parameter_count - self.parameters = parameters + self.provider_type = provider_type @classmethod - def from_dict(cls, _dict: Dict) -> 'Assessment': - """Initialize a Assessment object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EvaluationProviderInfo': + """Initialize a EvaluationProviderInfo object from a json dictionary.""" args = {} - if 'assessment_id' in _dict: - args['assessment_id'] = _dict.get('assessment_id') - if 'assessment_type' in _dict: - args['assessment_type'] = _dict.get('assessment_type') - if 'assessment_method' in _dict: - args['assessment_method'] = _dict.get('assessment_method') - if 'assessment_description' in _dict: - args['assessment_description'] = _dict.get('assessment_description') - if 'parameter_count' in _dict: - args['parameter_count'] = _dict.get('parameter_count') - if 'parameters' in _dict: - args['parameters'] = [ParameterInfo.from_dict(v) for v in _dict.get('parameters')] + if (provider_type := _dict.get('provider_type')) is not None: + args['provider_type'] = provider_type return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Assessment object from a json dictionary.""" + """Initialize a EvaluationProviderInfo 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, 'assessment_id') and self.assessment_id is not None: - _dict['assessment_id'] = self.assessment_id - if hasattr(self, 'assessment_type') and self.assessment_type is not None: - _dict['assessment_type'] = self.assessment_type - if hasattr(self, 'assessment_method') and self.assessment_method is not None: - _dict['assessment_method'] = self.assessment_method - if hasattr(self, 'assessment_description') and self.assessment_description is not None: - _dict['assessment_description'] = self.assessment_description - if hasattr(self, 'parameter_count') and self.parameter_count is not None: - _dict['parameter_count'] = self.parameter_count - if hasattr(self, 'parameters') and self.parameters is not None: - parameters_list = [] - for v in self.parameters: - if isinstance(v, dict): - parameters_list.append(v) - else: - parameters_list.append(v.to_dict()) - _dict['parameters'] = parameters_list + if hasattr(self, 'provider_type') and self.provider_type is not None: + _dict['provider_type'] = self.provider_type return _dict def _to_dict(self): @@ -3883,95 +9539,178 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Assessment object.""" + """Return a `str` version of this EvaluationProviderInfo object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Assessment') -> bool: + def __eq__(self, other: 'EvaluationProviderInfo') -> 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: 'Assessment') -> bool: + def __ne__(self, other: 'EvaluationProviderInfo') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Attachment: +class EventNotifications: """ - The attachment that is associated with a report. + The Event Notifications settings. - :attr str id: (optional) The attachment ID. - :attr str name: (optional) The name of the attachment. - :attr str description: (optional) The description of the attachment. - :attr str schedule: (optional) The attachment schedule. - :attr List[AttachmentScope] scope: (optional) The scope of the attachment. + :param str instance_crn: (optional) The Event Notifications instance CRN. + :param datetime updated_on: (optional) The date when the Event Notifications + connection was updated. + :param str source_id: (optional) The connected Security and Compliance Center + instance CRN. + :param str source_description: (optional) The description of the source of the + Event Notifications. + :param str source_name: (optional) The name of the source of the Event + Notifications. """ def __init__( self, *, - id: str = None, - name: str = None, - description: str = None, - schedule: str = None, - scope: List['AttachmentScope'] = None, + instance_crn: Optional[str] = None, + updated_on: Optional[datetime] = None, + source_id: Optional[str] = None, + source_description: Optional[str] = None, + source_name: Optional[str] = None, ) -> None: """ - Initialize a Attachment object. + Initialize a EventNotifications object. - :param str id: (optional) The attachment ID. - :param str name: (optional) The name of the attachment. - :param str description: (optional) The description of the attachment. - :param str schedule: (optional) The attachment schedule. - :param List[AttachmentScope] scope: (optional) The scope of the attachment. + :param str instance_crn: (optional) The Event Notifications instance CRN. + :param datetime updated_on: (optional) The date when the Event + Notifications connection was updated. + :param str source_id: (optional) The connected Security and Compliance + Center instance CRN. + :param str source_description: (optional) The description of the source of + the Event Notifications. + :param str source_name: (optional) The name of the source of the Event + Notifications. """ - self.id = id - self.name = name - self.description = description - self.schedule = schedule - self.scope = scope + self.instance_crn = instance_crn + self.updated_on = updated_on + self.source_id = source_id + self.source_description = source_description + self.source_name = source_name @classmethod - def from_dict(cls, _dict: Dict) -> 'Attachment': - """Initialize a Attachment object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'EventNotifications': + """Initialize a EventNotifications object from a json dictionary.""" + args = {} + if (instance_crn := _dict.get('instance_crn')) is not None: + args['instance_crn'] = instance_crn + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) + if (source_id := _dict.get('source_id')) is not None: + args['source_id'] = source_id + if (source_description := _dict.get('source_description')) is not None: + args['source_description'] = source_description + if (source_name := _dict.get('source_name')) is not None: + args['source_name'] = source_name + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a EventNotifications 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, 'instance_crn') and self.instance_crn is not None: + _dict['instance_crn'] = self.instance_crn + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) + if hasattr(self, 'source_id') and self.source_id is not None: + _dict['source_id'] = self.source_id + if hasattr(self, 'source_description') and self.source_description is not None: + _dict['source_description'] = self.source_description + if hasattr(self, 'source_name') and self.source_name is not None: + _dict['source_name'] = self.source_name + 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 EventNotifications object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'EventNotifications') -> 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: 'EventNotifications') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class EventNotificationsPrototype: + """ + The payload to connect an Event Notification instance with a Security and Compliance + Center instance. + + :param str instance_crn: (optional) The CRN of the Event Notification instance + to connect. + :param str source_description: (optional) The description of the source of the + Event Notifications. + :param str source_name: (optional) The name of the source of the Event + Notifications. + """ + + def __init__( + self, + *, + instance_crn: Optional[str] = None, + source_description: Optional[str] = None, + source_name: Optional[str] = None, + ) -> None: + """ + Initialize a EventNotificationsPrototype object. + + :param str instance_crn: (optional) The CRN of the Event Notification + instance to connect. + :param str source_description: (optional) The description of the source of + the Event Notifications. + :param str source_name: (optional) The name of the source of the Event + Notifications. + """ + self.instance_crn = instance_crn + self.source_description = source_description + self.source_name = source_name + + @classmethod + def from_dict(cls, _dict: Dict) -> 'EventNotificationsPrototype': + """Initialize a EventNotificationsPrototype object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'schedule' in _dict: - args['schedule'] = _dict.get('schedule') - if 'scope' in _dict: - args['scope'] = [AttachmentScope.from_dict(v) for v in _dict.get('scope')] + if (instance_crn := _dict.get('instance_crn')) is not None: + args['instance_crn'] = instance_crn + if (source_description := _dict.get('source_description')) is not None: + args['source_description'] = source_description + if (source_name := _dict.get('source_name')) is not None: + args['source_name'] = source_name return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Attachment object from a json dictionary.""" + """Initialize a EventNotificationsPrototype 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, '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, 'schedule') and self.schedule is not None: - _dict['schedule'] = self.schedule - if hasattr(self, 'scope') and self.scope is not None: - scope_list = [] - for v in self.scope: - if isinstance(v, dict): - scope_list.append(v) - else: - scope_list.append(v.to_dict()) - _dict['scope'] = scope_list + if hasattr(self, 'instance_crn') and self.instance_crn is not None: + _dict['instance_crn'] = self.instance_crn + if hasattr(self, 'source_description') and self.source_description is not None: + _dict['source_description'] = self.source_description + if hasattr(self, 'source_name') and self.source_name is not None: + _dict['source_name'] = self.source_name return _dict def _to_dict(self): @@ -3979,113 +9718,64 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Attachment object.""" + """Return a `str` version of this EventNotificationsPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Attachment') -> bool: + def __eq__(self, other: 'EventNotificationsPrototype') -> 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: 'Attachment') -> bool: + def __ne__(self, other: 'EventNotificationsPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class AttachmentCollection: +class Import: """ - The response body of an attachment. + The collection of import parameters. - :attr int total_count: The number of attachments. - :attr int limit: The limit of attachments per request. - :attr PaginatedCollectionFirst first: The reference to the first page of - entries. - :attr PaginatedCollectionNext next: The reference URL for the next few entries. - :attr List[AttachmentItem] attachments: The list of attachments. + :param List[RuleParameter] parameters: (optional) The list of import parameters. """ def __init__( self, - total_count: int, - limit: int, - first: 'PaginatedCollectionFirst', - next: 'PaginatedCollectionNext', - attachments: List['AttachmentItem'], + *, + parameters: Optional[List['RuleParameter']] = None, ) -> None: """ - Initialize a AttachmentCollection object. + Initialize a Import object. - :param int total_count: The number of attachments. - :param int limit: The limit of attachments per request. - :param PaginatedCollectionFirst first: The reference to the first page of - entries. - :param PaginatedCollectionNext next: The reference URL for the next few - entries. - :param List[AttachmentItem] attachments: The list of attachments. + :param List[RuleParameter] parameters: (optional) The list of import + parameters. """ - self.total_count = total_count - self.limit = limit - self.first = first - self.next = next - self.attachments = attachments + self.parameters = parameters @classmethod - def from_dict(cls, _dict: Dict) -> 'AttachmentCollection': - """Initialize a AttachmentCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Import': + """Initialize a Import object from a json dictionary.""" args = {} - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in AttachmentCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in AttachmentCollection JSON') - if 'first' in _dict: - args['first'] = PaginatedCollectionFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in AttachmentCollection JSON') - if 'next' in _dict: - args['next'] = PaginatedCollectionNext.from_dict(_dict.get('next')) - else: - raise ValueError('Required property \'next\' not present in AttachmentCollection JSON') - if 'attachments' in _dict: - args['attachments'] = [AttachmentItem.from_dict(v) for v in _dict.get('attachments')] - else: - raise ValueError('Required property \'attachments\' not present in AttachmentCollection JSON') + if (parameters := _dict.get('parameters')) is not None: + args['parameters'] = [RuleParameter.from_dict(v) for v in parameters] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AttachmentCollection object from a json dictionary.""" + """Initialize a Import 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, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'first') and self.first is not None: - if isinstance(self.first, dict): - _dict['first'] = self.first - else: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'next') and self.next is not None: - if isinstance(self.next, dict): - _dict['next'] = self.next - else: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'attachments') and self.attachments is not None: - attachments_list = [] - for v in self.attachments: + if hasattr(self, 'parameters') and self.parameters is not None: + parameters_list = [] + for v in self.parameters: if isinstance(v, dict): - attachments_list.append(v) + parameters_list.append(v) else: - attachments_list.append(v.to_dict()) - _dict['attachments'] = attachments_list + parameters_list.append(v.to_dict()) + _dict['parameters'] = parameters_list return _dict def _to_dict(self): @@ -4093,219 +9783,66 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AttachmentCollection object.""" + """Return a `str` version of this Import object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AttachmentCollection') -> bool: + def __eq__(self, other: 'Import') -> 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: 'AttachmentCollection') -> bool: + def __ne__(self, other: 'Import') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class AttachmentItem: +class LabelType: """ - The request payload of the attachments parameter. + The label that is associated with the provider type. - :attr str id: (optional) The ID of the attachment. - :attr str profile_id: (optional) The ID of the profile that is specified in the - attachment. - :attr str account_id: (optional) The account ID that is associated to the - attachment. - :attr str instance_id: (optional) The instance ID of the account that is - associated to the attachment. - :attr List[MultiCloudScope] scope: (optional) The scope payload for the multi - cloud feature. - :attr datetime created_on: (optional) The date when the attachment was created. - :attr str created_by: (optional) The user who created the attachment. - :attr datetime updated_on: (optional) The date when the attachment was updated. - :attr str updated_by: (optional) The user who updated the attachment. - :attr str status: (optional) The status of an attachment evaluation. - :attr str schedule: (optional) The schedule of an attachment evaluation. - :attr AttachmentsNotificationsPrototype notifications: (optional) The request - payload of the attachment notifications. - :attr List[AttachmentParameterPrototype] attachment_parameters: (optional) The - profile parameters for the attachment. - :attr LastScan last_scan: (optional) The details of the last scan of an - attachment. - :attr datetime next_scan_time: (optional) The start time of the next scan. - :attr str name: (optional) The name of the attachment. - :attr str description: (optional) The description for the attachment. + :param str text: (optional) The text of the label. + :param str tip: (optional) The text to be shown when user hover overs the label. """ def __init__( self, *, - id: str = None, - profile_id: str = None, - account_id: str = None, - instance_id: str = None, - scope: List['MultiCloudScope'] = None, - created_on: datetime = None, - created_by: str = None, - updated_on: datetime = None, - updated_by: str = None, - status: str = None, - schedule: str = None, - notifications: 'AttachmentsNotificationsPrototype' = None, - attachment_parameters: List['AttachmentParameterPrototype'] = None, - last_scan: 'LastScan' = None, - next_scan_time: datetime = None, - name: str = None, - description: str = None, + text: Optional[str] = None, + tip: Optional[str] = None, ) -> None: """ - Initialize a AttachmentItem object. + Initialize a LabelType object. - :param str id: (optional) The ID of the attachment. - :param str profile_id: (optional) The ID of the profile that is specified - in the attachment. - :param str account_id: (optional) The account ID that is associated to the - attachment. - :param str instance_id: (optional) The instance ID of the account that is - associated to the attachment. - :param List[MultiCloudScope] scope: (optional) The scope payload for the - multi cloud feature. - :param datetime created_on: (optional) The date when the attachment was - created. - :param str created_by: (optional) The user who created the attachment. - :param datetime updated_on: (optional) The date when the attachment was - updated. - :param str updated_by: (optional) The user who updated the attachment. - :param str status: (optional) The status of an attachment evaluation. - :param str schedule: (optional) The schedule of an attachment evaluation. - :param AttachmentsNotificationsPrototype notifications: (optional) The - request payload of the attachment notifications. - :param List[AttachmentParameterPrototype] attachment_parameters: (optional) - The profile parameters for the attachment. - :param LastScan last_scan: (optional) The details of the last scan of an - attachment. - :param datetime next_scan_time: (optional) The start time of the next scan. - :param str name: (optional) The name of the attachment. - :param str description: (optional) The description for the attachment. + :param str text: (optional) The text of the label. + :param str tip: (optional) The text to be shown when user hover overs the + label. """ - self.id = id - self.profile_id = profile_id - self.account_id = account_id - self.instance_id = instance_id - self.scope = scope - self.created_on = created_on - self.created_by = created_by - self.updated_on = updated_on - self.updated_by = updated_by - self.status = status - self.schedule = schedule - self.notifications = notifications - self.attachment_parameters = attachment_parameters - self.last_scan = last_scan - self.next_scan_time = next_scan_time - self.name = name - self.description = description + self.text = text + self.tip = tip @classmethod - def from_dict(cls, _dict: Dict) -> 'AttachmentItem': - """Initialize a AttachmentItem object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LabelType': + """Initialize a LabelType object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'profile_id' in _dict: - args['profile_id'] = _dict.get('profile_id') - if 'account_id' in _dict: - args['account_id'] = _dict.get('account_id') - if 'instance_id' in _dict: - args['instance_id'] = _dict.get('instance_id') - if 'scope' in _dict: - args['scope'] = [MultiCloudScope.from_dict(v) for v in _dict.get('scope')] - if 'created_on' in _dict: - args['created_on'] = string_to_datetime(_dict.get('created_on')) - if 'created_by' in _dict: - args['created_by'] = _dict.get('created_by') - if 'updated_on' in _dict: - args['updated_on'] = string_to_datetime(_dict.get('updated_on')) - if 'updated_by' in _dict: - args['updated_by'] = _dict.get('updated_by') - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'schedule' in _dict: - args['schedule'] = _dict.get('schedule') - if 'notifications' in _dict: - args['notifications'] = AttachmentsNotificationsPrototype.from_dict(_dict.get('notifications')) - if 'attachment_parameters' in _dict: - args['attachment_parameters'] = [AttachmentParameterPrototype.from_dict(v) for v in _dict.get('attachment_parameters')] - if 'last_scan' in _dict: - args['last_scan'] = LastScan.from_dict(_dict.get('last_scan')) - if 'next_scan_time' in _dict: - args['next_scan_time'] = string_to_datetime(_dict.get('next_scan_time')) - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'description' in _dict: - args['description'] = _dict.get('description') + if (text := _dict.get('text')) is not None: + args['text'] = text + if (tip := _dict.get('tip')) is not None: + args['tip'] = tip return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AttachmentItem object from a json dictionary.""" + """Initialize a LabelType 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, 'profile_id') and self.profile_id is not None: - _dict['profile_id'] = self.profile_id - if hasattr(self, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'instance_id') and self.instance_id is not None: - _dict['instance_id'] = self.instance_id - if hasattr(self, 'scope') and self.scope is not None: - scope_list = [] - for v in self.scope: - if isinstance(v, dict): - scope_list.append(v) - else: - scope_list.append(v.to_dict()) - _dict['scope'] = scope_list - if hasattr(self, 'created_on') and self.created_on is not None: - _dict['created_on'] = datetime_to_string(self.created_on) - if hasattr(self, 'created_by') and self.created_by is not None: - _dict['created_by'] = self.created_by - if hasattr(self, 'updated_on') and self.updated_on is not None: - _dict['updated_on'] = datetime_to_string(self.updated_on) - if hasattr(self, 'updated_by') and self.updated_by is not None: - _dict['updated_by'] = self.updated_by - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'schedule') and self.schedule is not None: - _dict['schedule'] = self.schedule - if hasattr(self, 'notifications') and self.notifications is not None: - if isinstance(self.notifications, dict): - _dict['notifications'] = self.notifications - else: - _dict['notifications'] = self.notifications.to_dict() - if hasattr(self, 'attachment_parameters') and self.attachment_parameters is not None: - attachment_parameters_list = [] - for v in self.attachment_parameters: - if isinstance(v, dict): - attachment_parameters_list.append(v) - else: - attachment_parameters_list.append(v.to_dict()) - _dict['attachment_parameters'] = attachment_parameters_list - if hasattr(self, 'last_scan') and self.last_scan is not None: - if isinstance(self.last_scan, dict): - _dict['last_scan'] = self.last_scan - else: - _dict['last_scan'] = self.last_scan.to_dict() - if hasattr(self, 'next_scan_time') and self.next_scan_time is not None: - _dict['next_scan_time'] = datetime_to_string(self.next_scan_time) - 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, 'text') and self.text is not None: + _dict['text'] = self.text + if hasattr(self, 'tip') and self.tip is not None: + _dict['tip'] = self.tip return _dict def _to_dict(self): @@ -4313,117 +9850,73 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AttachmentItem object.""" + """Return a `str` version of this LabelType object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AttachmentItem') -> bool: + def __eq__(self, other: 'LabelType') -> 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: 'AttachmentItem') -> bool: + def __ne__(self, other: 'LabelType') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The status of an attachment evaluation. - """ - - ENABLED = 'enabled' - DISABLED = 'disabled' - - - class ScheduleEnum(str, Enum): - """ - The schedule of an attachment evaluation. - """ - - DAILY = 'daily' - EVERY_7_DAYS = 'every_7_days' - EVERY_30_DAYS = 'every_30_days' - - -class AttachmentParameterPrototype: +class LastScan: """ - The parameters related to the Attachment. + The last scan performed on a profile attachment. - :attr str assessment_type: (optional) The type of the implementation. - :attr str assessment_id: (optional) The implementation ID of the parameter. - :attr str parameter_name: (optional) The parameter name. - :attr str parameter_value: (optional) The value of the parameter. - :attr str parameter_display_name: (optional) The parameter display name. - :attr str parameter_type: (optional) The parameter type. + :param str id: (optional) The ID of the last scan. + :param str status: (optional) Details the state of the last scan. + :param datetime time: (optional) The last time the scan ran. """ def __init__( self, *, - assessment_type: str = None, - assessment_id: str = None, - parameter_name: str = None, - parameter_value: str = None, - parameter_display_name: str = None, - parameter_type: str = None, + id: Optional[str] = None, + status: Optional[str] = None, + time: Optional[datetime] = None, ) -> None: """ - Initialize a AttachmentParameterPrototype object. + Initialize a LastScan object. - :param str assessment_type: (optional) The type of the implementation. - :param str assessment_id: (optional) The implementation ID of the - parameter. - :param str parameter_name: (optional) The parameter name. - :param str parameter_value: (optional) The value of the parameter. - :param str parameter_display_name: (optional) The parameter display name. - :param str parameter_type: (optional) The parameter type. + :param str id: (optional) The ID of the last scan. + :param str status: (optional) Details the state of the last scan. + :param datetime time: (optional) The last time the scan ran. """ - self.assessment_type = assessment_type - self.assessment_id = assessment_id - self.parameter_name = parameter_name - self.parameter_value = parameter_value - self.parameter_display_name = parameter_display_name - self.parameter_type = parameter_type + self.id = id + self.status = status + self.time = time @classmethod - def from_dict(cls, _dict: Dict) -> 'AttachmentParameterPrototype': - """Initialize a AttachmentParameterPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'LastScan': + """Initialize a LastScan object from a json dictionary.""" args = {} - if 'assessment_type' in _dict: - args['assessment_type'] = _dict.get('assessment_type') - if 'assessment_id' in _dict: - args['assessment_id'] = _dict.get('assessment_id') - if 'parameter_name' in _dict: - args['parameter_name'] = _dict.get('parameter_name') - if 'parameter_value' in _dict: - args['parameter_value'] = _dict.get('parameter_value') - if 'parameter_display_name' in _dict: - args['parameter_display_name'] = _dict.get('parameter_display_name') - if 'parameter_type' in _dict: - args['parameter_type'] = _dict.get('parameter_type') + if (id := _dict.get('id')) is not None: + args['id'] = id + if (status := _dict.get('status')) is not None: + args['status'] = status + if (time := _dict.get('time')) is not None: + args['time'] = string_to_datetime(time) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AttachmentParameterPrototype object from a json dictionary.""" + """Initialize a LastScan 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, 'assessment_type') and self.assessment_type is not None: - _dict['assessment_type'] = self.assessment_type - if hasattr(self, 'assessment_id') and self.assessment_id is not None: - _dict['assessment_id'] = self.assessment_id - if hasattr(self, 'parameter_name') and self.parameter_name is not None: - _dict['parameter_name'] = self.parameter_name - if hasattr(self, 'parameter_value') and self.parameter_value is not None: - _dict['parameter_value'] = self.parameter_value - if hasattr(self, 'parameter_display_name') and self.parameter_display_name is not None: - _dict['parameter_display_name'] = self.parameter_display_name - if hasattr(self, 'parameter_type') and self.parameter_type is not None: - _dict['parameter_type'] = self.parameter_type + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'time') and self.time is not None: + _dict['time'] = datetime_to_string(self.time) return _dict def _to_dict(self): @@ -4431,91 +9924,65 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AttachmentParameterPrototype object.""" + """Return a `str` version of this LastScan object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AttachmentParameterPrototype') -> bool: + def __eq__(self, other: 'LastScan') -> 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: 'AttachmentParameterPrototype') -> bool: + def __ne__(self, other: 'LastScan') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ParameterTypeEnum(str, Enum): - """ - The parameter type. - """ - - STRING = 'string' - NUMERIC = 'numeric' - GENERAL = 'general' - BOOLEAN = 'boolean' - STRING_LIST = 'string_list' - IP_LIST = 'ip_list' - TIMESTAMP = 'timestamp' - - -class AttachmentPrototype: +class Link: """ - The request body of getting an attachment that is associated with your account. + Link. - :attr str profile_id: (optional) The ID of the profile that is specified in the - attachment. - :attr List[AttachmentsPrototype] attachments: The array that displays all of the - available attachments. + :param str description: (optional) + :param str href: (optional) URL. """ def __init__( self, - attachments: List['AttachmentsPrototype'], *, - profile_id: str = None, + description: Optional[str] = None, + href: Optional[str] = None, ) -> None: """ - Initialize a AttachmentPrototype object. + Initialize a Link object. - :param List[AttachmentsPrototype] attachments: The array that displays all - of the available attachments. - :param str profile_id: (optional) The ID of the profile that is specified - in the attachment. + :param str description: (optional) + :param str href: (optional) URL. """ - self.profile_id = profile_id - self.attachments = attachments + self.description = description + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'AttachmentPrototype': - """Initialize a AttachmentPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Link': + """Initialize a Link object from a json dictionary.""" args = {} - if 'profile_id' in _dict: - args['profile_id'] = _dict.get('profile_id') - if 'attachments' in _dict: - args['attachments'] = [AttachmentsPrototype.from_dict(v) for v in _dict.get('attachments')] - else: - raise ValueError('Required property \'attachments\' not present in AttachmentPrototype JSON') + if (description := _dict.get('description')) is not None: + args['description'] = description + if (href := _dict.get('href')) is not None: + args['href'] = href return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AttachmentPrototype object from a json dictionary.""" + """Initialize a Link 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, 'profile_id') and self.profile_id is not None: - _dict['profile_id'] = self.profile_id - if hasattr(self, 'attachments') and self.attachments is not None: - attachments_list = [] - for v in self.attachments: - if isinstance(v, dict): - attachments_list.append(v) - else: - attachments_list.append(v.to_dict()) - _dict['attachments'] = attachments_list + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -4523,65 +9990,67 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AttachmentPrototype object.""" + """Return a `str` version of this Link object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AttachmentPrototype') -> bool: + def __eq__(self, other: 'Link') -> 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: 'AttachmentPrototype') -> bool: + def __ne__(self, other: 'Link') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class AttachmentScope: +class MultiCloudScopePayload: """ - A scope of the attachment. + MultiCloudScopePayload. - :attr str id: (optional) The unique identifier for this scope. - :attr str environment: (optional) The environment that relates to this scope. - :attr List[ScopeProperty] properties: (optional) The properties that are - supported for scoping by this environment. + :param str id: (optional) The ID of the scope. + :param str environment: (optional) The environment that relates to this scope. + :param List[ScopeProperty] properties: The properties supported for scoping by + this environment. """ def __init__( self, + properties: List['ScopeProperty'], *, - id: str = None, - environment: str = None, - properties: List['ScopeProperty'] = None, + id: Optional[str] = None, + environment: Optional[str] = None, ) -> None: """ - Initialize a AttachmentScope object. + Initialize a MultiCloudScopePayload object. - :param str id: (optional) The unique identifier for this scope. + :param List[ScopeProperty] properties: The properties supported for scoping + by this environment. + :param str id: (optional) The ID of the scope. :param str environment: (optional) The environment that relates to this scope. - :param List[ScopeProperty] properties: (optional) The properties that are - supported for scoping by this environment. """ self.id = id self.environment = environment self.properties = properties @classmethod - def from_dict(cls, _dict: Dict) -> 'AttachmentScope': - """Initialize a AttachmentScope object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'MultiCloudScopePayload': + """Initialize a MultiCloudScopePayload object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'environment' in _dict: - args['environment'] = _dict.get('environment') - if 'properties' in _dict: - args['properties'] = [ScopeProperty.from_dict(v) for v in _dict.get('properties')] + if (id := _dict.get('id')) is not None: + args['id'] = id + if (environment := _dict.get('environment')) is not None: + args['environment'] = environment + if (properties := _dict.get('properties')) is not None: + args['properties'] = properties + else: + raise ValueError('Required property \'properties\' not present in MultiCloudScopePayload JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AttachmentScope object from a json dictionary.""" + """Initialize a MultiCloudScopePayload object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -4606,71 +10075,98 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AttachmentScope object.""" + """Return a `str` version of this MultiCloudScopePayload object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AttachmentScope') -> bool: + def __eq__(self, other: 'MultiCloudScopePayload') -> 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: 'AttachmentScope') -> bool: + def __ne__(self, other: 'MultiCloudScopePayload') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class AttachmentsNotificationsPrototype: +class ObjectStorage: """ - The request payload of the attachment notifications. + The Cloud Object Storage settings. - :attr bool enabled: enabled notifications. - :attr FailedControls controls: The failed controls. + :param str instance_crn: (optional) The connected Cloud Object Storage instance + CRN. + :param str bucket: (optional) The connected Cloud Object Storage bucket name. + :param str bucket_location: (optional) The connected Cloud Object Storage bucket + location. + :param str bucket_endpoint: (optional) The connected Cloud Object Storage bucket + endpoint. + :param datetime updated_on: (optional) The date when the bucket connection was + updated. """ def __init__( self, - enabled: bool, - controls: 'FailedControls', + *, + instance_crn: Optional[str] = None, + bucket: Optional[str] = None, + bucket_location: Optional[str] = None, + bucket_endpoint: Optional[str] = None, + updated_on: Optional[datetime] = None, ) -> None: """ - Initialize a AttachmentsNotificationsPrototype object. + Initialize a ObjectStorage object. - :param bool enabled: enabled notifications. - :param FailedControls controls: The failed controls. + :param str instance_crn: (optional) The connected Cloud Object Storage + instance CRN. + :param str bucket: (optional) The connected Cloud Object Storage bucket + name. + :param str bucket_location: (optional) The connected Cloud Object Storage + bucket location. + :param str bucket_endpoint: (optional) The connected Cloud Object Storage + bucket endpoint. + :param datetime updated_on: (optional) The date when the bucket connection + was updated. """ - self.enabled = enabled - self.controls = controls + self.instance_crn = instance_crn + self.bucket = bucket + self.bucket_location = bucket_location + self.bucket_endpoint = bucket_endpoint + self.updated_on = updated_on @classmethod - def from_dict(cls, _dict: Dict) -> 'AttachmentsNotificationsPrototype': - """Initialize a AttachmentsNotificationsPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ObjectStorage': + """Initialize a ObjectStorage object from a json dictionary.""" args = {} - if 'enabled' in _dict: - args['enabled'] = _dict.get('enabled') - else: - raise ValueError('Required property \'enabled\' not present in AttachmentsNotificationsPrototype JSON') - if 'controls' in _dict: - args['controls'] = FailedControls.from_dict(_dict.get('controls')) - else: - raise ValueError('Required property \'controls\' not present in AttachmentsNotificationsPrototype JSON') + if (instance_crn := _dict.get('instance_crn')) is not None: + args['instance_crn'] = instance_crn + if (bucket := _dict.get('bucket')) is not None: + args['bucket'] = bucket + if (bucket_location := _dict.get('bucket_location')) is not None: + args['bucket_location'] = bucket_location + if (bucket_endpoint := _dict.get('bucket_endpoint')) is not None: + args['bucket_endpoint'] = bucket_endpoint + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AttachmentsNotificationsPrototype object from a json dictionary.""" + """Initialize a ObjectStorage 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, 'enabled') and self.enabled is not None: - _dict['enabled'] = self.enabled - if hasattr(self, 'controls') and self.controls is not None: - if isinstance(self.controls, dict): - _dict['controls'] = self.controls - else: - _dict['controls'] = self.controls.to_dict() + if hasattr(self, 'instance_crn') and self.instance_crn is not None: + _dict['instance_crn'] = self.instance_crn + if hasattr(self, 'bucket') and self.bucket is not None: + _dict['bucket'] = self.bucket + if hasattr(self, 'bucket_location') and self.bucket_location is not None: + _dict['bucket_location'] = self.bucket_location + if hasattr(self, 'bucket_endpoint') and self.bucket_endpoint is not None: + _dict['bucket_endpoint'] = self.bucket_endpoint + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) return _dict def _to_dict(self): @@ -4678,146 +10174,69 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AttachmentsNotificationsPrototype object.""" + """Return a `str` version of this ObjectStorage object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AttachmentsNotificationsPrototype') -> bool: + def __eq__(self, other: 'ObjectStorage') -> 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: 'AttachmentsNotificationsPrototype') -> bool: + def __ne__(self, other: 'ObjectStorage') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class AttachmentsPrototype: +class ObjectStoragePrototype: """ - The request payload of getting all of the attachments that are associated with the - account. + The payload to connect a Cloud Object Storage instance to an Security and Compliance + Center instance. - :attr str id: (optional) The id that is generated from the scope type and ID. - :attr str name: The name that is generated from the scope type and ID. - :attr str description: (optional) The description for the attachment. - :attr List[MultiCloudScope] scope: The scope payload for the multi cloud - feature. - :attr str status: The status of the scan of an attachment. - :attr str schedule: The schedule of an attachment evaluation. - :attr AttachmentsNotificationsPrototype notifications: (optional) The request - payload of the attachment notifications. - :attr List[AttachmentParameterPrototype] attachment_parameters: The profile - parameters for the attachment. + :param str bucket: (optional) The connected Cloud Object Storage bucket name. + :param str instance_crn: (optional) The connected Cloud Object Storage instance + CRN. """ def __init__( self, - name: str, - scope: List['MultiCloudScope'], - status: str, - schedule: str, - attachment_parameters: List['AttachmentParameterPrototype'], *, - id: str = None, - description: str = None, - notifications: 'AttachmentsNotificationsPrototype' = None, + bucket: Optional[str] = None, + instance_crn: Optional[str] = None, ) -> None: """ - Initialize a AttachmentsPrototype object. + Initialize a ObjectStoragePrototype object. - :param str name: The name that is generated from the scope type and ID. - :param List[MultiCloudScope] scope: The scope payload for the multi cloud - feature. - :param str status: The status of the scan of an attachment. - :param str schedule: The schedule of an attachment evaluation. - :param List[AttachmentParameterPrototype] attachment_parameters: The - profile parameters for the attachment. - :param str id: (optional) The id that is generated from the scope type and - ID. - :param str description: (optional) The description for the attachment. - :param AttachmentsNotificationsPrototype notifications: (optional) The - request payload of the attachment notifications. + :param str bucket: (optional) The connected Cloud Object Storage bucket + name. + :param str instance_crn: (optional) The connected Cloud Object Storage + instance CRN. """ - self.id = id - self.name = name - self.description = description - self.scope = scope - self.status = status - self.schedule = schedule - self.notifications = notifications - self.attachment_parameters = attachment_parameters + self.bucket = bucket + self.instance_crn = instance_crn @classmethod - def from_dict(cls, _dict: Dict) -> 'AttachmentsPrototype': - """Initialize a AttachmentsPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ObjectStoragePrototype': + """Initialize a ObjectStoragePrototype object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in AttachmentsPrototype JSON') - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'scope' in _dict: - args['scope'] = [MultiCloudScope.from_dict(v) for v in _dict.get('scope')] - else: - raise ValueError('Required property \'scope\' not present in AttachmentsPrototype JSON') - if 'status' in _dict: - args['status'] = _dict.get('status') - else: - raise ValueError('Required property \'status\' not present in AttachmentsPrototype JSON') - if 'schedule' in _dict: - args['schedule'] = _dict.get('schedule') - else: - raise ValueError('Required property \'schedule\' not present in AttachmentsPrototype JSON') - if 'notifications' in _dict: - args['notifications'] = AttachmentsNotificationsPrototype.from_dict(_dict.get('notifications')) - if 'attachment_parameters' in _dict: - args['attachment_parameters'] = [AttachmentParameterPrototype.from_dict(v) for v in _dict.get('attachment_parameters')] - else: - raise ValueError('Required property \'attachment_parameters\' not present in AttachmentsPrototype JSON') + if (bucket := _dict.get('bucket')) is not None: + args['bucket'] = bucket + if (instance_crn := _dict.get('instance_crn')) is not None: + args['instance_crn'] = instance_crn return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a AttachmentsPrototype object from a json dictionary.""" + """Initialize a ObjectStoragePrototype 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, '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, 'scope') and self.scope is not None: - scope_list = [] - for v in self.scope: - if isinstance(v, dict): - scope_list.append(v) - else: - scope_list.append(v.to_dict()) - _dict['scope'] = scope_list - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'schedule') and self.schedule is not None: - _dict['schedule'] = self.schedule - if hasattr(self, 'notifications') and self.notifications is not None: - if isinstance(self.notifications, dict): - _dict['notifications'] = self.notifications - else: - _dict['notifications'] = self.notifications.to_dict() - if hasattr(self, 'attachment_parameters') and self.attachment_parameters is not None: - attachment_parameters_list = [] - for v in self.attachment_parameters: - if isinstance(v, dict): - attachment_parameters_list.append(v) - else: - attachment_parameters_list.append(v.to_dict()) - _dict['attachment_parameters'] = attachment_parameters_list + if hasattr(self, 'bucket') and self.bucket is not None: + _dict['bucket'] = self.bucket + if hasattr(self, 'instance_crn') and self.instance_crn is not None: + _dict['instance_crn'] = self.instance_crn return _dict def _to_dict(self): @@ -4825,92 +10244,58 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this AttachmentsPrototype object.""" + """Return a `str` version of this ObjectStoragePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'AttachmentsPrototype') -> bool: + def __eq__(self, other: 'ObjectStoragePrototype') -> 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: 'AttachmentsPrototype') -> bool: + def __ne__(self, other: 'ObjectStoragePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The status of the scan of an attachment. - """ - - ENABLED = 'enabled' - DISABLED = 'disabled' - - - class ScheduleEnum(str, Enum): - """ - The schedule of an attachment evaluation. - """ - - DAILY = 'daily' - EVERY_7_DAYS = 'every_7_days' - EVERY_30_DAYS = 'every_30_days' - - -class ComplianceScore: +class PageHRefFirst: """ - The compliance score. + A page reference. - :attr int passed: (optional) The number of successful evaluations. - :attr int total_count: (optional) The total number of evaluations. - :attr int percent: (optional) The percentage of successful evaluations. + :param str href: The URL for the first page. """ def __init__( self, - *, - passed: int = None, - total_count: int = None, - percent: int = None, + href: str, ) -> None: """ - Initialize a ComplianceScore object. + Initialize a PageHRefFirst object. - :param int passed: (optional) The number of successful evaluations. - :param int total_count: (optional) The total number of evaluations. - :param int percent: (optional) The percentage of successful evaluations. + :param str href: The URL for the first page. """ - self.passed = passed - self.total_count = total_count - self.percent = percent + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'ComplianceScore': - """Initialize a ComplianceScore object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PageHRefFirst': + """Initialize a PageHRefFirst object from a json dictionary.""" args = {} - if 'passed' in _dict: - args['passed'] = _dict.get('passed') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'percent' in _dict: - args['percent'] = _dict.get('percent') + if (href := _dict.get('href')) is not None: + args['href'] = href + else: + raise ValueError('Required property \'href\' not present in PageHRefFirst JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ComplianceScore object from a json dictionary.""" + """Initialize a PageHRefFirst 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, 'passed') and self.passed is not None: - _dict['passed'] = self.passed - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'percent') and self.percent is not None: - _dict['percent'] = self.percent + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -4918,105 +10303,67 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ComplianceScore object.""" + """Return a `str` version of this PageHRefFirst object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ComplianceScore') -> bool: + def __eq__(self, other: 'PageHRefFirst') -> 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: 'ComplianceScore') -> bool: + def __ne__(self, other: 'PageHRefFirst') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ComplianceStats: +class PageHRefNext: """ - The compliance stats. + A page reference. - :attr str status: (optional) The allowed values of an aggregated status for - controls, specifications, assessments, and resources. - :attr int total_count: (optional) The total number of checks. - :attr int compliant_count: (optional) The number of compliant checks. - :attr int not_compliant_count: (optional) The number of checks that are not - compliant. - :attr int unable_to_perform_count: (optional) The number of checks that are - unable to perform. - :attr int user_evaluation_required_count: (optional) The number of checks that - require a user evaluation. + :param str href: The URL for the next page. + :param str start: (optional) The token of the next page, when it's present. """ def __init__( self, + href: str, *, - status: str = None, - total_count: int = None, - compliant_count: int = None, - not_compliant_count: int = None, - unable_to_perform_count: int = None, - user_evaluation_required_count: int = None, + start: Optional[str] = None, ) -> None: """ - Initialize a ComplianceStats object. + Initialize a PageHRefNext object. - :param str status: (optional) The allowed values of an aggregated status - for controls, specifications, assessments, and resources. - :param int total_count: (optional) The total number of checks. - :param int compliant_count: (optional) The number of compliant checks. - :param int not_compliant_count: (optional) The number of checks that are - not compliant. - :param int unable_to_perform_count: (optional) The number of checks that - are unable to perform. - :param int user_evaluation_required_count: (optional) The number of checks - that require a user evaluation. + :param str href: The URL for the next page. + :param str start: (optional) The token of the next page, when it's present. """ - self.status = status - self.total_count = total_count - self.compliant_count = compliant_count - self.not_compliant_count = not_compliant_count - self.unable_to_perform_count = unable_to_perform_count - self.user_evaluation_required_count = user_evaluation_required_count + self.href = href + self.start = start @classmethod - def from_dict(cls, _dict: Dict) -> 'ComplianceStats': - """Initialize a ComplianceStats object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'PageHRefNext': + """Initialize a PageHRefNext object from a json dictionary.""" args = {} - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'compliant_count' in _dict: - args['compliant_count'] = _dict.get('compliant_count') - if 'not_compliant_count' in _dict: - args['not_compliant_count'] = _dict.get('not_compliant_count') - if 'unable_to_perform_count' in _dict: - args['unable_to_perform_count'] = _dict.get('unable_to_perform_count') - if 'user_evaluation_required_count' in _dict: - args['user_evaluation_required_count'] = _dict.get('user_evaluation_required_count') + if (href := _dict.get('href')) is not None: + args['href'] = href + else: + raise ValueError('Required property \'href\' not present in PageHRefNext JSON') + if (start := _dict.get('start')) is not None: + args['start'] = start return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ComplianceStats object from a json dictionary.""" + """Initialize a PageHRefNext 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, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'compliant_count') and self.compliant_count is not None: - _dict['compliant_count'] = self.compliant_count - if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: - _dict['not_compliant_count'] = self.not_compliant_count - if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: - _dict['unable_to_perform_count'] = self.unable_to_perform_count - if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: - _dict['user_evaluation_required_count'] = self.user_evaluation_required_count + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href + if hasattr(self, 'start') and self.start is not None: + _dict['start'] = self.start return _dict def _to_dict(self): @@ -5024,77 +10371,97 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ComplianceStats object.""" + """Return a `str` version of this PageHRefNext object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ComplianceStats') -> 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: 'ComplianceStats') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other - - class StatusEnum(str, Enum): - """ - The allowed values of an aggregated status for controls, specifications, - assessments, and resources. - """ - - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' + def __eq__(self, other: 'PageHRefNext') -> 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: 'PageHRefNext') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other -class ControlDocs: +class Parameter: """ - The control documentation. - - :attr str control_docs_id: (optional) The ID of the control documentation. - :attr str control_docs_type: (optional) The type of control documentation. + The details of a parameter used during an assessment. + + :param str assessment_type: (optional) The type of evaluation. + :param str assessment_id: (optional) The ID of the assessment. + :param str parameter_name: (optional) The parameter name. + :param str parameter_display_name: (optional) The parameter display name. + :param str parameter_type: (optional) The parameter type. + :param object parameter_value: (optional) """ def __init__( self, *, - control_docs_id: str = None, - control_docs_type: str = None, + assessment_type: Optional[str] = None, + assessment_id: Optional[str] = None, + parameter_name: Optional[str] = None, + parameter_display_name: Optional[str] = None, + parameter_type: Optional[str] = None, + parameter_value: Optional[object] = None, ) -> None: """ - Initialize a ControlDocs object. + Initialize a Parameter object. - :param str control_docs_id: (optional) The ID of the control documentation. - :param str control_docs_type: (optional) The type of control documentation. + :param str assessment_type: (optional) The type of evaluation. + :param str assessment_id: (optional) The ID of the assessment. + :param str parameter_name: (optional) The parameter name. + :param str parameter_display_name: (optional) The parameter display name. + :param str parameter_type: (optional) The parameter type. + :param object parameter_value: (optional) """ - self.control_docs_id = control_docs_id - self.control_docs_type = control_docs_type + self.assessment_type = assessment_type + self.assessment_id = assessment_id + self.parameter_name = parameter_name + self.parameter_display_name = parameter_display_name + self.parameter_type = parameter_type + self.parameter_value = parameter_value @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlDocs': - """Initialize a ControlDocs object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Parameter': + """Initialize a Parameter object from a json dictionary.""" args = {} - if 'control_docs_id' in _dict: - args['control_docs_id'] = _dict.get('control_docs_id') - if 'control_docs_type' in _dict: - args['control_docs_type'] = _dict.get('control_docs_type') + if (assessment_type := _dict.get('assessment_type')) is not None: + args['assessment_type'] = assessment_type + if (assessment_id := _dict.get('assessment_id')) is not None: + args['assessment_id'] = assessment_id + if (parameter_name := _dict.get('parameter_name')) is not None: + args['parameter_name'] = parameter_name + if (parameter_display_name := _dict.get('parameter_display_name')) is not None: + args['parameter_display_name'] = parameter_display_name + if (parameter_type := _dict.get('parameter_type')) is not None: + args['parameter_type'] = parameter_type + if (parameter_value := _dict.get('parameter_value')) is not None: + args['parameter_value'] = parameter_value return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ControlDocs object from a json dictionary.""" + """Initialize a Parameter 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, 'control_docs_id') and self.control_docs_id is not None: - _dict['control_docs_id'] = self.control_docs_id - if hasattr(self, 'control_docs_type') and self.control_docs_type is not None: - _dict['control_docs_type'] = self.control_docs_type + if hasattr(self, 'assessment_type') and self.assessment_type is not None: + _dict['assessment_type'] = self.assessment_type + if hasattr(self, 'assessment_id') and self.assessment_id is not None: + _dict['assessment_id'] = self.assessment_id + if hasattr(self, 'parameter_name') and self.parameter_name is not None: + _dict['parameter_name'] = self.parameter_name + if hasattr(self, 'parameter_display_name') and self.parameter_display_name is not None: + _dict['parameter_display_name'] = self.parameter_display_name + if hasattr(self, 'parameter_type') and self.parameter_type is not None: + _dict['parameter_type'] = self.parameter_type + if hasattr(self, 'parameter_value') and self.parameter_value is not None: + _dict['parameter_value'] = self.parameter_value return _dict def _to_dict(self): @@ -5102,152 +10469,174 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ControlDocs object.""" + """Return a `str` version of this Parameter object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ControlDocs') -> bool: + def __eq__(self, other: 'Parameter') -> 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: 'ControlDocs') -> bool: + def __ne__(self, other: 'Parameter') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ControlLibrary: +class Profile: """ - The request payload of the control library. - - :attr str id: (optional) The control library ID. - :attr str account_id: (optional) The account ID. - :attr str control_library_name: (optional) The control library name. - :attr str control_library_description: (optional) The control library - description. - :attr str control_library_type: (optional) The control library type. - :attr str version_group_label: (optional) The version group label. - :attr str control_library_version: (optional) The control library version. - :attr datetime created_on: (optional) The date when the control library was - created. - :attr str created_by: (optional) The user who created the control library. - :attr datetime updated_on: (optional) The date when the control library was - updated. - :attr str updated_by: (optional) The user who updated the control library. - :attr bool latest: (optional) The latest version of the control library. - :attr bool hierarchy_enabled: (optional) The indication of whether hierarchy is - enabled for the control library. - :attr int controls_count: (optional) The number of controls. - :attr int control_parents_count: (optional) The number of parent controls in the - control library. - :attr List[ControlsInControlLib] controls: (optional) The list of controls in a - control library. + A group of controls that are related to a compliance objective. + + :param str id: (optional) The ID of the profile. + :param str profile_name: (optional) The name of the profile. + :param str instance_id: (optional) The ID of the Security and Compliance Center + instance who owns the profile. + :param bool hierarchy_enabled: (optional) Determines if the profile can be set + to a hierarchy. + :param str profile_description: (optional) A description of what the profile + should represent. + :param str profile_type: The type of profile, either predefined or custom. + :param str profile_version: (optional) The version of the profile. + :param str version_group_label: (optional) The unique identifier of the + revision. + :param bool latest: (optional) Determines if the profile is up to date with the + latest revisions. + :param str created_by: (optional) User who created the profile. + :param datetime created_on: (optional) The date when the profile was created, in + date-time format. + :param str updated_by: (optional) User who made the latest changes to the + profile. + :param datetime updated_on: (optional) The date when the profile was last + updated, in date-time format. + :param int controls_count: (optional) The number of controls contained in the + profile. + :param int attachments_count: (optional) The number of attachments associated + with the profile. + :param List[ProfileControlsInResponse] controls: The list of controls. + :param List[DefaultParameters] default_parameters: The default parameters of the + profile. """ def __init__( self, + profile_type: str, + controls: List['ProfileControlsInResponse'], + default_parameters: List['DefaultParameters'], *, - id: str = None, - account_id: str = None, - control_library_name: str = None, - control_library_description: str = None, - control_library_type: str = None, - version_group_label: str = None, - control_library_version: str = None, - created_on: datetime = None, - created_by: str = None, - updated_on: datetime = None, - updated_by: str = None, - latest: bool = None, - hierarchy_enabled: bool = None, - controls_count: int = None, - control_parents_count: int = None, - controls: List['ControlsInControlLib'] = None, + id: Optional[str] = None, + profile_name: Optional[str] = None, + instance_id: Optional[str] = None, + hierarchy_enabled: Optional[bool] = None, + profile_description: Optional[str] = None, + profile_version: Optional[str] = None, + version_group_label: Optional[str] = None, + latest: Optional[bool] = None, + created_by: Optional[str] = None, + created_on: Optional[datetime] = None, + updated_by: Optional[str] = None, + updated_on: Optional[datetime] = None, + controls_count: Optional[int] = None, + attachments_count: Optional[int] = None, ) -> None: """ - Initialize a ControlLibrary object. + Initialize a Profile object. - :param str id: (optional) The control library ID. - :param str account_id: (optional) The account ID. - :param str control_library_name: (optional) The control library name. - :param str control_library_description: (optional) The control library - description. - :param str control_library_type: (optional) The control library type. - :param str version_group_label: (optional) The version group label. - :param str control_library_version: (optional) The control library version. - :param datetime created_on: (optional) The date when the control library - was created. - :param str created_by: (optional) The user who created the control library. - :param datetime updated_on: (optional) The date when the control library - was updated. - :param str updated_by: (optional) The user who updated the control library. - :param bool latest: (optional) The latest version of the control library. - :param bool hierarchy_enabled: (optional) The indication of whether - hierarchy is enabled for the control library. - :param int controls_count: (optional) The number of controls. - :param int control_parents_count: (optional) The number of parent controls - in the control library. - :param List[ControlsInControlLib] controls: (optional) The list of controls - in a control library. + :param str profile_type: The type of profile, either predefined or custom. + :param List[ProfileControlsInResponse] controls: The list of controls. + :param List[DefaultParameters] default_parameters: The default parameters + of the profile. + :param str id: (optional) The ID of the profile. + :param str profile_name: (optional) The name of the profile. + :param str instance_id: (optional) The ID of the Security and Compliance + Center instance who owns the profile. + :param bool hierarchy_enabled: (optional) Determines if the profile can be + set to a hierarchy. + :param str profile_description: (optional) A description of what the + profile should represent. + :param str profile_version: (optional) The version of the profile. + :param str version_group_label: (optional) The unique identifier of the + revision. + :param bool latest: (optional) Determines if the profile is up to date with + the latest revisions. + :param str created_by: (optional) User who created the profile. + :param datetime created_on: (optional) The date when the profile was + created, in date-time format. + :param str updated_by: (optional) User who made the latest changes to the + profile. + :param datetime updated_on: (optional) The date when the profile was last + updated, in date-time format. + :param int controls_count: (optional) The number of controls contained in + the profile. + :param int attachments_count: (optional) The number of attachments + associated with the profile. """ self.id = id - self.account_id = account_id - self.control_library_name = control_library_name - self.control_library_description = control_library_description - self.control_library_type = control_library_type + self.profile_name = profile_name + self.instance_id = instance_id + self.hierarchy_enabled = hierarchy_enabled + self.profile_description = profile_description + self.profile_type = profile_type + self.profile_version = profile_version self.version_group_label = version_group_label - self.control_library_version = control_library_version - self.created_on = created_on + self.latest = latest self.created_by = created_by - self.updated_on = updated_on + self.created_on = created_on self.updated_by = updated_by - self.latest = latest - self.hierarchy_enabled = hierarchy_enabled + self.updated_on = updated_on self.controls_count = controls_count - self.control_parents_count = control_parents_count + self.attachments_count = attachments_count self.controls = controls + self.default_parameters = default_parameters @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlLibrary': - """Initialize a ControlLibrary object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Profile': + """Initialize a Profile object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'account_id' in _dict: - args['account_id'] = _dict.get('account_id') - if 'control_library_name' in _dict: - args['control_library_name'] = _dict.get('control_library_name') - if 'control_library_description' in _dict: - args['control_library_description'] = _dict.get('control_library_description') - if 'control_library_type' in _dict: - args['control_library_type'] = _dict.get('control_library_type') - if 'version_group_label' in _dict: - args['version_group_label'] = _dict.get('version_group_label') - if 'control_library_version' in _dict: - args['control_library_version'] = _dict.get('control_library_version') - if 'created_on' in _dict: - args['created_on'] = string_to_datetime(_dict.get('created_on')) - if 'created_by' in _dict: - args['created_by'] = _dict.get('created_by') - if 'updated_on' in _dict: - args['updated_on'] = string_to_datetime(_dict.get('updated_on')) - if 'updated_by' in _dict: - args['updated_by'] = _dict.get('updated_by') - if 'latest' in _dict: - args['latest'] = _dict.get('latest') - if 'hierarchy_enabled' in _dict: - args['hierarchy_enabled'] = _dict.get('hierarchy_enabled') - if 'controls_count' in _dict: - args['controls_count'] = _dict.get('controls_count') - if 'control_parents_count' in _dict: - args['control_parents_count'] = _dict.get('control_parents_count') - if 'controls' in _dict: - args['controls'] = [ControlsInControlLib.from_dict(v) for v in _dict.get('controls')] + if (id := _dict.get('id')) is not None: + args['id'] = id + if (profile_name := _dict.get('profile_name')) is not None: + args['profile_name'] = profile_name + if (instance_id := _dict.get('instance_id')) is not None: + args['instance_id'] = instance_id + if (hierarchy_enabled := _dict.get('hierarchy_enabled')) is not None: + args['hierarchy_enabled'] = hierarchy_enabled + if (profile_description := _dict.get('profile_description')) is not None: + args['profile_description'] = profile_description + if (profile_type := _dict.get('profile_type')) is not None: + args['profile_type'] = profile_type + else: + raise ValueError('Required property \'profile_type\' not present in Profile JSON') + if (profile_version := _dict.get('profile_version')) is not None: + args['profile_version'] = profile_version + if (version_group_label := _dict.get('version_group_label')) is not None: + args['version_group_label'] = version_group_label + if (latest := _dict.get('latest')) is not None: + args['latest'] = latest + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) + if (controls_count := _dict.get('controls_count')) is not None: + args['controls_count'] = controls_count + if (attachments_count := _dict.get('attachments_count')) is not None: + args['attachments_count'] = attachments_count + if (controls := _dict.get('controls')) is not None: + args['controls'] = [ProfileControlsInResponse.from_dict(v) for v in controls] + else: + raise ValueError('Required property \'controls\' not present in Profile JSON') + if (default_parameters := _dict.get('default_parameters')) is not None: + args['default_parameters'] = [DefaultParameters.from_dict(v) for v in default_parameters] + else: + raise ValueError('Required property \'default_parameters\' not present in Profile JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ControlLibrary object from a json dictionary.""" + """Initialize a Profile object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -5255,34 +10644,34 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'control_library_name') and self.control_library_name is not None: - _dict['control_library_name'] = self.control_library_name - if hasattr(self, 'control_library_description') and self.control_library_description is not None: - _dict['control_library_description'] = self.control_library_description - if hasattr(self, 'control_library_type') and self.control_library_type is not None: - _dict['control_library_type'] = self.control_library_type + if hasattr(self, 'profile_name') and self.profile_name is not None: + _dict['profile_name'] = self.profile_name + if hasattr(self, 'instance_id') and self.instance_id is not None: + _dict['instance_id'] = self.instance_id + if hasattr(self, 'hierarchy_enabled') and self.hierarchy_enabled is not None: + _dict['hierarchy_enabled'] = self.hierarchy_enabled + if hasattr(self, 'profile_description') and self.profile_description is not None: + _dict['profile_description'] = self.profile_description + if hasattr(self, 'profile_type') and self.profile_type is not None: + _dict['profile_type'] = self.profile_type + if hasattr(self, 'profile_version') and self.profile_version is not None: + _dict['profile_version'] = self.profile_version if hasattr(self, 'version_group_label') and self.version_group_label is not None: _dict['version_group_label'] = self.version_group_label - if hasattr(self, 'control_library_version') and self.control_library_version is not None: - _dict['control_library_version'] = self.control_library_version - if hasattr(self, 'created_on') and self.created_on is not None: - _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'latest') and self.latest is not None: + _dict['latest'] = self.latest if hasattr(self, 'created_by') and self.created_by is not None: _dict['created_by'] = self.created_by - if hasattr(self, 'updated_on') and self.updated_on is not None: - _dict['updated_on'] = datetime_to_string(self.updated_on) + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = datetime_to_string(self.created_on) if hasattr(self, 'updated_by') and self.updated_by is not None: _dict['updated_by'] = self.updated_by - if hasattr(self, 'latest') and self.latest is not None: - _dict['latest'] = self.latest - if hasattr(self, 'hierarchy_enabled') and self.hierarchy_enabled is not None: - _dict['hierarchy_enabled'] = self.hierarchy_enabled + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) if hasattr(self, 'controls_count') and self.controls_count is not None: _dict['controls_count'] = self.controls_count - if hasattr(self, 'control_parents_count') and self.control_parents_count is not None: - _dict['control_parents_count'] = self.control_parents_count + if hasattr(self, 'attachments_count') and self.attachments_count is not None: + _dict['attachments_count'] = self.attachments_count if hasattr(self, 'controls') and self.controls is not None: controls_list = [] for v in self.controls: @@ -5291,6 +10680,14 @@ def to_dict(self) -> Dict: else: controls_list.append(v.to_dict()) _dict['controls'] = controls_list + if hasattr(self, 'default_parameters') and self.default_parameters is not None: + default_parameters_list = [] + for v in self.default_parameters: + if isinstance(v, dict): + default_parameters_list.append(v) + else: + default_parameters_list.append(v.to_dict()) + _dict['default_parameters'] = default_parameters_list return _dict def _to_dict(self): @@ -5298,122 +10695,254 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ControlLibrary object.""" + """Return a `str` version of this Profile object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ControlLibrary') -> bool: + def __eq__(self, other: 'Profile') -> 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: 'ControlLibrary') -> bool: + def __ne__(self, other: 'Profile') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ControlLibraryTypeEnum(str, Enum): + class ProfileTypeEnum(str, Enum): """ - The control library type. + The type of profile, either predefined or custom. """ - PREDEFINED = 'predefined' CUSTOM = 'custom' + PREDEFINED = 'predefined' -class ControlLibraryCollection: +class ProfileAttachment: """ - The response body of control libraries. - - :attr int total_count: The number of control libraries. - :attr int limit: limit. - :attr PaginatedCollectionFirst first: The reference to the first page of - entries. - :attr PaginatedCollectionNext next: The reference URL for the next few entries. - :attr List[ControlLibraryItem] control_libraries: The control libraries. + The configuration set when starting a scan against a profile. + + :param List[Parameter] attachment_parameters: The parameters associated with the + profile attachment. + :param str description: The details to describe the profile attachment. + :param str name: The name of the Profile Attachment. + :param AttachmentNotifications notifications: The notification configuration of + the attachment. + :param str schedule: Details how often a scan from a profile attachment is ran. + :param List[MultiCloudScopePayload] scope: A list of scopes associated with a + profile attachment. + :param str status: Details the state of a profile attachment. + :param DateRange data_selection_range: (optional) Date range. + :param str account_id: (optional) The ID of the account. + :param str created_by: (optional) User who created the profile attachment. + :param datetime created_on: (optional) The date-time that the profile attachment + was created. + :param str id: (optional) The ID of the profile attachment. + :param str instance_id: (optional) The ID of the associated Security and + Compliance Center instance. + :param LastScan last_scan: (optional) The last scan performed on a profile + attachment. + :param datetime next_scan_time: (optional) The date-time for next scan. + :param str profile_id: (optional) The ID of the profile. + :param str updated_by: (optional) User who made the latest changes to the + profile attachment. + :param datetime updated_on: (optional) The date when the profile was last + updated, in date-time format. """ def __init__( self, - total_count: int, - limit: int, - first: 'PaginatedCollectionFirst', - next: 'PaginatedCollectionNext', - control_libraries: List['ControlLibraryItem'], + attachment_parameters: List['Parameter'], + description: str, + name: str, + notifications: 'AttachmentNotifications', + schedule: str, + scope: List['MultiCloudScopePayload'], + status: str, + *, + data_selection_range: Optional['DateRange'] = None, + account_id: Optional[str] = None, + created_by: Optional[str] = None, + created_on: Optional[datetime] = None, + id: Optional[str] = None, + instance_id: Optional[str] = None, + last_scan: Optional['LastScan'] = None, + next_scan_time: Optional[datetime] = None, + profile_id: Optional[str] = None, + updated_by: Optional[str] = None, + updated_on: Optional[datetime] = None, ) -> None: """ - Initialize a ControlLibraryCollection object. - - :param int total_count: The number of control libraries. - :param int limit: limit. - :param PaginatedCollectionFirst first: The reference to the first page of - entries. - :param PaginatedCollectionNext next: The reference URL for the next few - entries. - :param List[ControlLibraryItem] control_libraries: The control libraries. + Initialize a ProfileAttachment object. + + :param List[Parameter] attachment_parameters: The parameters associated + with the profile attachment. + :param str description: The details to describe the profile attachment. + :param str name: The name of the Profile Attachment. + :param AttachmentNotifications notifications: The notification + configuration of the attachment. + :param str schedule: Details how often a scan from a profile attachment is + ran. + :param List[MultiCloudScopePayload] scope: A list of scopes associated with + a profile attachment. + :param str status: Details the state of a profile attachment. + :param DateRange data_selection_range: (optional) Date range. + :param str account_id: (optional) The ID of the account. + :param str created_by: (optional) User who created the profile attachment. + :param datetime created_on: (optional) The date-time that the profile + attachment was created. + :param str id: (optional) The ID of the profile attachment. + :param str instance_id: (optional) The ID of the associated Security and + Compliance Center instance. + :param LastScan last_scan: (optional) The last scan performed on a profile + attachment. + :param datetime next_scan_time: (optional) The date-time for next scan. + :param str profile_id: (optional) The ID of the profile. + :param str updated_by: (optional) User who made the latest changes to the + profile attachment. + :param datetime updated_on: (optional) The date when the profile was last + updated, in date-time format. """ - self.total_count = total_count - self.limit = limit - self.first = first - self.next = next - self.control_libraries = control_libraries + self.attachment_parameters = attachment_parameters + self.description = description + self.name = name + self.notifications = notifications + self.schedule = schedule + self.scope = scope + self.status = status + self.data_selection_range = data_selection_range + self.account_id = account_id + self.created_by = created_by + self.created_on = created_on + self.id = id + self.instance_id = instance_id + self.last_scan = last_scan + self.next_scan_time = next_scan_time + self.profile_id = profile_id + self.updated_by = updated_by + self.updated_on = updated_on @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlLibraryCollection': - """Initialize a ControlLibraryCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileAttachment': + """Initialize a ProfileAttachment object from a json dictionary.""" args = {} - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + if (attachment_parameters := _dict.get('attachment_parameters')) is not None: + args['attachment_parameters'] = [Parameter.from_dict(v) for v in attachment_parameters] else: - raise ValueError('Required property \'total_count\' not present in ControlLibraryCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + raise ValueError('Required property \'attachment_parameters\' not present in ProfileAttachment JSON') + if (description := _dict.get('description')) is not None: + args['description'] = description else: - raise ValueError('Required property \'limit\' not present in ControlLibraryCollection JSON') - if 'first' in _dict: - args['first'] = PaginatedCollectionFirst.from_dict(_dict.get('first')) + raise ValueError('Required property \'description\' not present in ProfileAttachment JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name else: - raise ValueError('Required property \'first\' not present in ControlLibraryCollection JSON') - if 'next' in _dict: - args['next'] = PaginatedCollectionNext.from_dict(_dict.get('next')) + raise ValueError('Required property \'name\' not present in ProfileAttachment JSON') + if (notifications := _dict.get('notifications')) is not None: + args['notifications'] = AttachmentNotifications.from_dict(notifications) else: - raise ValueError('Required property \'next\' not present in ControlLibraryCollection JSON') - if 'control_libraries' in _dict: - args['control_libraries'] = [ControlLibraryItem.from_dict(v) for v in _dict.get('control_libraries')] + raise ValueError('Required property \'notifications\' not present in ProfileAttachment JSON') + if (schedule := _dict.get('schedule')) is not None: + args['schedule'] = schedule else: - raise ValueError('Required property \'control_libraries\' not present in ControlLibraryCollection JSON') + raise ValueError('Required property \'schedule\' not present in ProfileAttachment JSON') + if (scope := _dict.get('scope')) is not None: + args['scope'] = [MultiCloudScopePayload.from_dict(v) for v in scope] + else: + raise ValueError('Required property \'scope\' not present in ProfileAttachment JSON') + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ProfileAttachment JSON') + if (data_selection_range := _dict.get('data_selection_range')) is not None: + args['data_selection_range'] = DateRange.from_dict(data_selection_range) + if (account_id := _dict.get('account_id')) is not None: + args['account_id'] = account_id + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + if (id := _dict.get('id')) is not None: + args['id'] = id + if (instance_id := _dict.get('instance_id')) is not None: + args['instance_id'] = instance_id + if (last_scan := _dict.get('last_scan')) is not None: + args['last_scan'] = LastScan.from_dict(last_scan) + if (next_scan_time := _dict.get('next_scan_time')) is not None: + args['next_scan_time'] = string_to_datetime(next_scan_time) + if (profile_id := _dict.get('profile_id')) is not None: + args['profile_id'] = profile_id + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ControlLibraryCollection object from a json dictionary.""" + """Initialize a ProfileAttachment 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, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'first') and self.first is not None: - if isinstance(self.first, dict): - _dict['first'] = self.first - else: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'next') and self.next is not None: - if isinstance(self.next, dict): - _dict['next'] = self.next + if hasattr(self, 'attachment_parameters') and self.attachment_parameters is not None: + attachment_parameters_list = [] + for v in self.attachment_parameters: + if isinstance(v, dict): + attachment_parameters_list.append(v) + else: + attachment_parameters_list.append(v.to_dict()) + _dict['attachment_parameters'] = attachment_parameters_list + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'notifications') and self.notifications is not None: + if isinstance(self.notifications, dict): + _dict['notifications'] = self.notifications else: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'control_libraries') and self.control_libraries is not None: - control_libraries_list = [] - for v in self.control_libraries: + _dict['notifications'] = self.notifications.to_dict() + if hasattr(self, 'schedule') and self.schedule is not None: + _dict['schedule'] = self.schedule + if hasattr(self, 'scope') and self.scope is not None: + scope_list = [] + for v in self.scope: if isinstance(v, dict): - control_libraries_list.append(v) + scope_list.append(v) else: - control_libraries_list.append(v.to_dict()) - _dict['control_libraries'] = control_libraries_list + scope_list.append(v.to_dict()) + _dict['scope'] = scope_list + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'data_selection_range') and self.data_selection_range is not None: + if isinstance(self.data_selection_range, dict): + _dict['data_selection_range'] = self.data_selection_range + else: + _dict['data_selection_range'] = self.data_selection_range.to_dict() + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'instance_id') and self.instance_id is not None: + _dict['instance_id'] = self.instance_id + if hasattr(self, 'last_scan') and self.last_scan is not None: + if isinstance(self.last_scan, dict): + _dict['last_scan'] = self.last_scan + else: + _dict['last_scan'] = self.last_scan.to_dict() + if hasattr(self, 'next_scan_time') and self.next_scan_time is not None: + _dict['next_scan_time'] = datetime_to_string(self.next_scan_time) + if hasattr(self, 'profile_id') and self.profile_id is not None: + _dict['profile_id'] = self.profile_id + if hasattr(self, 'updated_by') and self.updated_by is not None: + _dict['updated_by'] = self.updated_by + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) return _dict def _to_dict(self): @@ -5421,217 +10950,171 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ControlLibraryCollection object.""" + """Return a `str` version of this ProfileAttachment object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ControlLibraryCollection') -> bool: + def __eq__(self, other: 'ProfileAttachment') -> 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: 'ControlLibraryCollection') -> bool: + def __ne__(self, other: 'ProfileAttachment') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - -class ControlLibraryDelete: - """ - The response body of deleting of a control library. - - :attr str deleted: (optional) The delete message of a control library. - """ - - def __init__( - self, - *, - deleted: str = None, - ) -> None: + class ScheduleEnum(str, Enum): """ - Initialize a ControlLibraryDelete object. - - :param str deleted: (optional) The delete message of a control library. + Details how often a scan from a profile attachment is ran. """ - self.deleted = deleted - - @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlLibraryDelete': - """Initialize a ControlLibraryDelete object from a json dictionary.""" - args = {} - if 'deleted' in _dict: - args['deleted'] = _dict.get('deleted') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a ControlLibraryDelete 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, 'deleted') and self.deleted is not None: - _dict['deleted'] = self.deleted - return _dict + DAILY = 'daily' + EVERY_7_DAYS = 'every_7_days' + EVERY_30_DAYS = 'every_30_days' - 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 ControlLibraryDelete object.""" - return json.dumps(self.to_dict(), indent=2) + class StatusEnum(str, Enum): + """ + Details the state of a profile attachment. + """ - def __eq__(self, other: 'ControlLibraryDelete') -> bool: - """Return `true` when self and other are equal, false otherwise.""" - if not isinstance(other, self.__class__): - return False - return self.__dict__ == other.__dict__ + ENABLED = 'enabled' + DISABLED = 'disabled' - def __ne__(self, other: 'ControlLibraryDelete') -> bool: - """Return `true` when self and other are not equal, false otherwise.""" - return not self == other -class ControlLibraryItem: +class ProfileAttachmentBase: """ - ControlLibraryItem. - - :attr str id: (optional) The ID of the control library. - :attr str account_id: (optional) The Account ID. - :attr str control_library_name: (optional) The control library name. - :attr str control_library_description: (optional) The control library - description. - :attr str control_library_type: (optional) The control library type. - :attr datetime created_on: (optional) The date when the control library was - created. - :attr str created_by: (optional) The user who created the control library. - :attr datetime updated_on: (optional) The date when the control library was - updated. - :attr str updated_by: (optional) The use who updated the control library. - :attr str version_group_label: (optional) The version group label. - :attr str control_library_version: (optional) The control library version. - :attr bool latest: (optional) The latest control library version. - :attr int controls_count: (optional) The number of controls. + The prototype for creating a Profile attachment. + + :param List[Parameter] attachment_parameters: The parameters associated with the + profile attachment. + :param str description: The details to describe the profile attachment. + :param str name: The name of the Profile Attachment. + :param AttachmentNotifications notifications: The notification configuration of + the attachment. + :param str schedule: Details how often a scan from a profile attachment is ran. + :param List[MultiCloudScopePayload] scope: A list of scopes associated with a + profile attachment. + :param str status: Details the state of a profile attachment. + :param DateRange data_selection_range: (optional) Date range. """ def __init__( self, + attachment_parameters: List['Parameter'], + description: str, + name: str, + notifications: 'AttachmentNotifications', + schedule: str, + scope: List['MultiCloudScopePayload'], + status: str, *, - id: str = None, - account_id: str = None, - control_library_name: str = None, - control_library_description: str = None, - control_library_type: str = None, - created_on: datetime = None, - created_by: str = None, - updated_on: datetime = None, - updated_by: str = None, - version_group_label: str = None, - control_library_version: str = None, - latest: bool = None, - controls_count: int = None, + data_selection_range: Optional['DateRange'] = None, ) -> None: """ - Initialize a ControlLibraryItem object. - - :param str id: (optional) The ID of the control library. - :param str account_id: (optional) The Account ID. - :param str control_library_name: (optional) The control library name. - :param str control_library_description: (optional) The control library - description. - :param str control_library_type: (optional) The control library type. - :param datetime created_on: (optional) The date when the control library - was created. - :param str created_by: (optional) The user who created the control library. - :param datetime updated_on: (optional) The date when the control library - was updated. - :param str updated_by: (optional) The use who updated the control library. - :param str version_group_label: (optional) The version group label. - :param str control_library_version: (optional) The control library version. - :param bool latest: (optional) The latest control library version. - :param int controls_count: (optional) The number of controls. + Initialize a ProfileAttachmentBase object. + + :param List[Parameter] attachment_parameters: The parameters associated + with the profile attachment. + :param str description: The details to describe the profile attachment. + :param str name: The name of the Profile Attachment. + :param AttachmentNotifications notifications: The notification + configuration of the attachment. + :param str schedule: Details how often a scan from a profile attachment is + ran. + :param List[MultiCloudScopePayload] scope: A list of scopes associated with + a profile attachment. + :param str status: Details the state of a profile attachment. + :param DateRange data_selection_range: (optional) Date range. """ - self.id = id - self.account_id = account_id - self.control_library_name = control_library_name - self.control_library_description = control_library_description - self.control_library_type = control_library_type - self.created_on = created_on - self.created_by = created_by - self.updated_on = updated_on - self.updated_by = updated_by - self.version_group_label = version_group_label - self.control_library_version = control_library_version - self.latest = latest - self.controls_count = controls_count + self.attachment_parameters = attachment_parameters + self.description = description + self.name = name + self.notifications = notifications + self.schedule = schedule + self.scope = scope + self.status = status + self.data_selection_range = data_selection_range @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlLibraryItem': - """Initialize a ControlLibraryItem object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileAttachmentBase': + """Initialize a ProfileAttachmentBase object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'account_id' in _dict: - args['account_id'] = _dict.get('account_id') - if 'control_library_name' in _dict: - args['control_library_name'] = _dict.get('control_library_name') - if 'control_library_description' in _dict: - args['control_library_description'] = _dict.get('control_library_description') - if 'control_library_type' in _dict: - args['control_library_type'] = _dict.get('control_library_type') - if 'created_on' in _dict: - args['created_on'] = string_to_datetime(_dict.get('created_on')) - if 'created_by' in _dict: - args['created_by'] = _dict.get('created_by') - if 'updated_on' in _dict: - args['updated_on'] = string_to_datetime(_dict.get('updated_on')) - if 'updated_by' in _dict: - args['updated_by'] = _dict.get('updated_by') - if 'version_group_label' in _dict: - args['version_group_label'] = _dict.get('version_group_label') - if 'control_library_version' in _dict: - args['control_library_version'] = _dict.get('control_library_version') - if 'latest' in _dict: - args['latest'] = _dict.get('latest') - if 'controls_count' in _dict: - args['controls_count'] = _dict.get('controls_count') + if (attachment_parameters := _dict.get('attachment_parameters')) is not None: + args['attachment_parameters'] = [Parameter.from_dict(v) for v in attachment_parameters] + else: + raise ValueError('Required property \'attachment_parameters\' not present in ProfileAttachmentBase JSON') + if (description := _dict.get('description')) is not None: + args['description'] = description + else: + raise ValueError('Required property \'description\' not present in ProfileAttachmentBase JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in ProfileAttachmentBase JSON') + if (notifications := _dict.get('notifications')) is not None: + args['notifications'] = AttachmentNotifications.from_dict(notifications) + else: + raise ValueError('Required property \'notifications\' not present in ProfileAttachmentBase JSON') + if (schedule := _dict.get('schedule')) is not None: + args['schedule'] = schedule + else: + raise ValueError('Required property \'schedule\' not present in ProfileAttachmentBase JSON') + if (scope := _dict.get('scope')) is not None: + args['scope'] = [MultiCloudScopePayload.from_dict(v) for v in scope] + else: + raise ValueError('Required property \'scope\' not present in ProfileAttachmentBase JSON') + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ProfileAttachmentBase JSON') + if (data_selection_range := _dict.get('data_selection_range')) is not None: + args['data_selection_range'] = DateRange.from_dict(data_selection_range) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ControlLibraryItem object from a json dictionary.""" + """Initialize a ProfileAttachmentBase 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, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'control_library_name') and self.control_library_name is not None: - _dict['control_library_name'] = self.control_library_name - if hasattr(self, 'control_library_description') and self.control_library_description is not None: - _dict['control_library_description'] = self.control_library_description - if hasattr(self, 'control_library_type') and self.control_library_type is not None: - _dict['control_library_type'] = self.control_library_type - if hasattr(self, 'created_on') and self.created_on is not None: - _dict['created_on'] = datetime_to_string(self.created_on) - if hasattr(self, 'created_by') and self.created_by is not None: - _dict['created_by'] = self.created_by - if hasattr(self, 'updated_on') and self.updated_on is not None: - _dict['updated_on'] = datetime_to_string(self.updated_on) - if hasattr(self, 'updated_by') and self.updated_by is not None: - _dict['updated_by'] = self.updated_by - if hasattr(self, 'version_group_label') and self.version_group_label is not None: - _dict['version_group_label'] = self.version_group_label - if hasattr(self, 'control_library_version') and self.control_library_version is not None: - _dict['control_library_version'] = self.control_library_version - if hasattr(self, 'latest') and self.latest is not None: - _dict['latest'] = self.latest - if hasattr(self, 'controls_count') and self.controls_count is not None: - _dict['controls_count'] = self.controls_count + if hasattr(self, 'attachment_parameters') and self.attachment_parameters is not None: + attachment_parameters_list = [] + for v in self.attachment_parameters: + if isinstance(v, dict): + attachment_parameters_list.append(v) + else: + attachment_parameters_list.append(v.to_dict()) + _dict['attachment_parameters'] = attachment_parameters_list + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'notifications') and self.notifications is not None: + if isinstance(self.notifications, dict): + _dict['notifications'] = self.notifications + else: + _dict['notifications'] = self.notifications.to_dict() + if hasattr(self, 'schedule') and self.schedule is not None: + _dict['schedule'] = self.schedule + if hasattr(self, 'scope') and self.scope is not None: + scope_list = [] + for v in self.scope: + if isinstance(v, dict): + scope_list.append(v) + else: + scope_list.append(v.to_dict()) + _dict['scope'] = scope_list + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'data_selection_range') and self.data_selection_range is not None: + if isinstance(self.data_selection_range, dict): + _dict['data_selection_range'] = self.data_selection_range + else: + _dict['data_selection_range'] = self.data_selection_range.to_dict() return _dict def _to_dict(self): @@ -5639,164 +11122,128 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ControlLibraryItem object.""" + """Return a `str` version of this ProfileAttachmentBase object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ControlLibraryItem') -> bool: + def __eq__(self, other: 'ProfileAttachmentBase') -> 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: 'ControlLibraryItem') -> bool: + def __ne__(self, other: 'ProfileAttachmentBase') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class ScheduleEnum(str, Enum): + """ + Details how often a scan from a profile attachment is ran. + """ -class ControlSpecificationWithStats: - """ - The control specification with compliance stats. + DAILY = 'daily' + EVERY_7_DAYS = 'every_7_days' + EVERY_30_DAYS = 'every_30_days' - :attr str control_specification_id: (optional) The control specification ID. - :attr str component_id: (optional) The component ID. - :attr str control_specification_description: (optional) The component - description. - :attr str environment: (optional) The environment. - :attr str responsibility: (optional) The responsibility for managing control - specifications. - :attr List[Assessment] assessments: (optional) The list of assessments. - :attr str status: (optional) The allowed values of an aggregated status for - controls, specifications, assessments, and resources. - :attr int total_count: (optional) The total number of checks. - :attr int compliant_count: (optional) The number of compliant checks. - :attr int not_compliant_count: (optional) The number of checks that are not - compliant. - :attr int unable_to_perform_count: (optional) The number of checks that are - unable to perform. - :attr int user_evaluation_required_count: (optional) The number of checks that - require a user evaluation. + + class StatusEnum(str, Enum): + """ + Details the state of a profile attachment. + """ + + ENABLED = 'enabled' + DISABLED = 'disabled' + + + +class ProfileAttachmentCollection: + """ + A list of ProfileAttachment tied to a profile or instance. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param List[ProfileAttachment] attachments: List of attachments. """ def __init__( self, + limit: int, + total_count: int, + attachments: List['ProfileAttachment'], *, - control_specification_id: str = None, - component_id: str = None, - control_specification_description: str = None, - environment: str = None, - responsibility: str = None, - assessments: List['Assessment'] = None, - status: str = None, - total_count: int = None, - compliant_count: int = None, - not_compliant_count: int = None, - unable_to_perform_count: int = None, - user_evaluation_required_count: int = None, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, ) -> None: """ - Initialize a ControlSpecificationWithStats object. + Initialize a ProfileAttachmentCollection object. - :param str control_specification_id: (optional) The control specification - ID. - :param str component_id: (optional) The component ID. - :param str control_specification_description: (optional) The component - description. - :param str environment: (optional) The environment. - :param str responsibility: (optional) The responsibility for managing - control specifications. - :param List[Assessment] assessments: (optional) The list of assessments. - :param str status: (optional) The allowed values of an aggregated status - for controls, specifications, assessments, and resources. - :param int total_count: (optional) The total number of checks. - :param int compliant_count: (optional) The number of compliant checks. - :param int not_compliant_count: (optional) The number of checks that are - not compliant. - :param int unable_to_perform_count: (optional) The number of checks that - are unable to perform. - :param int user_evaluation_required_count: (optional) The number of checks - that require a user evaluation. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param List[ProfileAttachment] attachments: List of attachments. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. """ - self.control_specification_id = control_specification_id - self.component_id = component_id - self.control_specification_description = control_specification_description - self.environment = environment - self.responsibility = responsibility - self.assessments = assessments - self.status = status + self.limit = limit self.total_count = total_count - self.compliant_count = compliant_count - self.not_compliant_count = not_compliant_count - self.unable_to_perform_count = unable_to_perform_count - self.user_evaluation_required_count = user_evaluation_required_count - - @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlSpecificationWithStats': - """Initialize a ControlSpecificationWithStats object from a json dictionary.""" - args = {} - if 'control_specification_id' in _dict: - args['control_specification_id'] = _dict.get('control_specification_id') - if 'component_id' in _dict: - args['component_id'] = _dict.get('component_id') - if 'control_specification_description' in _dict: - args['control_specification_description'] = _dict.get('control_specification_description') - if 'environment' in _dict: - args['environment'] = _dict.get('environment') - if 'responsibility' in _dict: - args['responsibility'] = _dict.get('responsibility') - if 'assessments' in _dict: - args['assessments'] = [Assessment.from_dict(v) for v in _dict.get('assessments')] - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'compliant_count' in _dict: - args['compliant_count'] = _dict.get('compliant_count') - if 'not_compliant_count' in _dict: - args['not_compliant_count'] = _dict.get('not_compliant_count') - if 'unable_to_perform_count' in _dict: - args['unable_to_perform_count'] = _dict.get('unable_to_perform_count') - if 'user_evaluation_required_count' in _dict: - args['user_evaluation_required_count'] = _dict.get('user_evaluation_required_count') - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a ControlSpecificationWithStats object from a json dictionary.""" - return cls.from_dict(_dict) + self.first = first + self.next = next + self.attachments = attachments - def to_dict(self) -> Dict: - """Return a json dictionary representing this model.""" - _dict = {} - if hasattr(self, 'control_specification_id') and self.control_specification_id is not None: - _dict['control_specification_id'] = self.control_specification_id - if hasattr(self, 'component_id') and self.component_id is not None: - _dict['component_id'] = self.component_id - if hasattr(self, 'control_specification_description') and self.control_specification_description is not None: - _dict['control_specification_description'] = self.control_specification_description - if hasattr(self, 'environment') and self.environment is not None: - _dict['environment'] = self.environment - if hasattr(self, 'responsibility') and self.responsibility is not None: - _dict['responsibility'] = self.responsibility - if hasattr(self, 'assessments') and self.assessments is not None: - assessments_list = [] - for v in self.assessments: - if isinstance(v, dict): - assessments_list.append(v) - else: - assessments_list.append(v.to_dict()) - _dict['assessments'] = assessments_list - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + @classmethod + def from_dict(cls, _dict: Dict) -> 'ProfileAttachmentCollection': + """Initialize a ProfileAttachmentCollection object from a json dictionary.""" + args = {} + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + else: + raise ValueError('Required property \'limit\' not present in ProfileAttachmentCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + else: + raise ValueError('Required property \'total_count\' not present in ProfileAttachmentCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (attachments := _dict.get('attachments')) is not None: + args['attachments'] = [ProfileAttachment.from_dict(v) for v in attachments] + else: + raise ValueError('Required property \'attachments\' not present in ProfileAttachmentCollection JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ProfileAttachmentCollection 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, 'limit') and self.limit is not None: + _dict['limit'] = self.limit if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count - if hasattr(self, 'compliant_count') and self.compliant_count is not None: - _dict['compliant_count'] = self.compliant_count - if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: - _dict['not_compliant_count'] = self.not_compliant_count - if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: - _dict['unable_to_perform_count'] = self.unable_to_perform_count - if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: - _dict['user_evaluation_required_count'] = self.user_evaluation_required_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'attachments') and self.attachments is not None: + attachments_list = [] + for v in self.attachments: + if isinstance(v, dict): + attachments_list.append(v) + else: + attachments_list.append(v.to_dict()) + _dict['attachments'] = attachments_list return _dict def _to_dict(self): @@ -5804,136 +11251,75 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ControlSpecificationWithStats object.""" + """Return a `str` version of this ProfileAttachmentCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ControlSpecificationWithStats') -> bool: + def __eq__(self, other: 'ProfileAttachmentCollection') -> 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: 'ControlSpecificationWithStats') -> bool: + def __ne__(self, other: 'ProfileAttachmentCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The allowed values of an aggregated status for controls, specifications, - assessments, and resources. - """ - - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' - - -class ControlSpecifications: +class ProfileAttachmentResponse: """ - The control specifications of a control library. + ProfileAttachmentResponse. - :attr str control_specification_id: (optional) The control specification ID. - :attr str responsibility: (optional) The responsibility for managing the - control. - :attr str component_id: (optional) The component ID. - :attr str component_name: (optional) The component name. - :attr str environment: (optional) The control specifications environment. - :attr str control_specification_description: (optional) The control - specifications description. - :attr int assessments_count: (optional) The number of assessments. - :attr List[Implementation] assessments: (optional) The assessments. + :param str profile_id: (optional) The ID of the profile. + :param List[ProfileAttachment] attachments: List of profile attachments + associated with profile. """ def __init__( self, + attachments: List['ProfileAttachment'], *, - control_specification_id: str = None, - responsibility: str = None, - component_id: str = None, - component_name: str = None, - environment: str = None, - control_specification_description: str = None, - assessments_count: int = None, - assessments: List['Implementation'] = None, + profile_id: Optional[str] = None, ) -> None: """ - Initialize a ControlSpecifications object. + Initialize a ProfileAttachmentResponse object. - :param str control_specification_id: (optional) The control specification - ID. - :param str responsibility: (optional) The responsibility for managing the - control. - :param str component_id: (optional) The component ID. - :param str component_name: (optional) The component name. - :param str environment: (optional) The control specifications environment. - :param str control_specification_description: (optional) The control - specifications description. - :param int assessments_count: (optional) The number of assessments. - :param List[Implementation] assessments: (optional) The assessments. + :param List[ProfileAttachment] attachments: List of profile attachments + associated with profile. + :param str profile_id: (optional) The ID of the profile. """ - self.control_specification_id = control_specification_id - self.responsibility = responsibility - self.component_id = component_id - self.component_name = component_name - self.environment = environment - self.control_specification_description = control_specification_description - self.assessments_count = assessments_count - self.assessments = assessments + self.profile_id = profile_id + self.attachments = attachments @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlSpecifications': - """Initialize a ControlSpecifications object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileAttachmentResponse': + """Initialize a ProfileAttachmentResponse object from a json dictionary.""" args = {} - if 'control_specification_id' in _dict: - args['control_specification_id'] = _dict.get('control_specification_id') - if 'responsibility' in _dict: - args['responsibility'] = _dict.get('responsibility') - if 'component_id' in _dict: - args['component_id'] = _dict.get('component_id') - if 'component_name' in _dict: - args['component_name'] = _dict.get('component_name') - if 'environment' in _dict: - args['environment'] = _dict.get('environment') - if 'control_specification_description' in _dict: - args['control_specification_description'] = _dict.get('control_specification_description') - if 'assessments_count' in _dict: - args['assessments_count'] = _dict.get('assessments_count') - if 'assessments' in _dict: - args['assessments'] = [Implementation.from_dict(v) for v in _dict.get('assessments')] + if (profile_id := _dict.get('profile_id')) is not None: + args['profile_id'] = profile_id + if (attachments := _dict.get('attachments')) is not None: + args['attachments'] = [ProfileAttachment.from_dict(v) for v in attachments] + else: + raise ValueError('Required property \'attachments\' not present in ProfileAttachmentResponse JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ControlSpecifications object from a json dictionary.""" + """Initialize a ProfileAttachmentResponse 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, 'control_specification_id') and self.control_specification_id is not None: - _dict['control_specification_id'] = self.control_specification_id - if hasattr(self, 'responsibility') and self.responsibility is not None: - _dict['responsibility'] = self.responsibility - if hasattr(self, 'component_id') and self.component_id is not None: - _dict['component_id'] = self.component_id - if hasattr(self, 'component_name') and self.component_name is not None: - _dict['component_name'] = self.component_name - if hasattr(self, 'environment') and self.environment is not None: - _dict['environment'] = self.environment - if hasattr(self, 'control_specification_description') and self.control_specification_description is not None: - _dict['control_specification_description'] = self.control_specification_description - if hasattr(self, 'assessments_count') and self.assessments_count is not None: - _dict['assessments_count'] = self.assessments_count - if hasattr(self, 'assessments') and self.assessments is not None: - assessments_list = [] - for v in self.assessments: + if hasattr(self, 'profile_id') and self.profile_id is not None: + _dict['profile_id'] = self.profile_id + if hasattr(self, 'attachments') and self.attachments is not None: + attachments_list = [] + for v in self.attachments: if isinstance(v, dict): - assessments_list.append(v) + attachments_list.append(v) else: - assessments_list.append(v.to_dict()) - _dict['assessments'] = assessments_list + attachments_list.append(v.to_dict()) + _dict['attachments'] = attachments_list return _dict def _to_dict(self): @@ -5941,185 +11327,109 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ControlSpecifications object.""" + """Return a `str` version of this ProfileAttachmentResponse object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ControlSpecifications') -> bool: + def __eq__(self, other: 'ProfileAttachmentResponse') -> 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: 'ControlSpecifications') -> bool: + def __ne__(self, other: 'ProfileAttachmentResponse') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ResponsibilityEnum(str, Enum): - """ - The responsibility for managing the control. - """ - - USER = 'user' - - -class ControlWithStats: +class ProfileCollection: """ - The control with compliance stats. - - :attr str id: (optional) The control ID. - :attr str control_library_id: (optional) The control library ID. - :attr str control_library_version: (optional) The control library version. - :attr str control_name: (optional) The control name. - :attr str control_description: (optional) The control description. - :attr str control_category: (optional) The control category. - :attr str control_path: (optional) The control path. - :attr List[ControlSpecificationWithStats] control_specifications: (optional) The - list of specifications that are on the page. - :attr str status: (optional) The allowed values of an aggregated status for - controls, specifications, assessments, and resources. - :attr int total_count: (optional) The total number of checks. - :attr int compliant_count: (optional) The number of compliant checks. - :attr int not_compliant_count: (optional) The number of checks that are not - compliant. - :attr int unable_to_perform_count: (optional) The number of checks that are - unable to perform. - :attr int user_evaluation_required_count: (optional) The number of checks that - require a user evaluation. + Show a list of Profiles. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param List[Profile] profiles: A list of profiles. """ def __init__( self, + limit: int, + total_count: int, + profiles: List['Profile'], *, - id: str = None, - control_library_id: str = None, - control_library_version: str = None, - control_name: str = None, - control_description: str = None, - control_category: str = None, - control_path: str = None, - control_specifications: List['ControlSpecificationWithStats'] = None, - status: str = None, - total_count: int = None, - compliant_count: int = None, - not_compliant_count: int = None, - unable_to_perform_count: int = None, - user_evaluation_required_count: int = None, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, ) -> None: """ - Initialize a ControlWithStats object. + Initialize a ProfileCollection object. - :param str id: (optional) The control ID. - :param str control_library_id: (optional) The control library ID. - :param str control_library_version: (optional) The control library version. - :param str control_name: (optional) The control name. - :param str control_description: (optional) The control description. - :param str control_category: (optional) The control category. - :param str control_path: (optional) The control path. - :param List[ControlSpecificationWithStats] control_specifications: - (optional) The list of specifications that are on the page. - :param str status: (optional) The allowed values of an aggregated status - for controls, specifications, assessments, and resources. - :param int total_count: (optional) The total number of checks. - :param int compliant_count: (optional) The number of compliant checks. - :param int not_compliant_count: (optional) The number of checks that are - not compliant. - :param int unable_to_perform_count: (optional) The number of checks that - are unable to perform. - :param int user_evaluation_required_count: (optional) The number of checks - that require a user evaluation. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param List[Profile] profiles: A list of profiles. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. """ - self.id = id - self.control_library_id = control_library_id - self.control_library_version = control_library_version - self.control_name = control_name - self.control_description = control_description - self.control_category = control_category - self.control_path = control_path - self.control_specifications = control_specifications - self.status = status + self.limit = limit self.total_count = total_count - self.compliant_count = compliant_count - self.not_compliant_count = not_compliant_count - self.unable_to_perform_count = unable_to_perform_count - self.user_evaluation_required_count = user_evaluation_required_count + self.first = first + self.next = next + self.profiles = profiles @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlWithStats': - """Initialize a ControlWithStats object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileCollection': + """Initialize a ProfileCollection object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'control_library_id' in _dict: - args['control_library_id'] = _dict.get('control_library_id') - if 'control_library_version' in _dict: - args['control_library_version'] = _dict.get('control_library_version') - if 'control_name' in _dict: - args['control_name'] = _dict.get('control_name') - if 'control_description' in _dict: - args['control_description'] = _dict.get('control_description') - if 'control_category' in _dict: - args['control_category'] = _dict.get('control_category') - if 'control_path' in _dict: - args['control_path'] = _dict.get('control_path') - if 'control_specifications' in _dict: - args['control_specifications'] = [ControlSpecificationWithStats.from_dict(v) for v in _dict.get('control_specifications')] - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'compliant_count' in _dict: - args['compliant_count'] = _dict.get('compliant_count') - if 'not_compliant_count' in _dict: - args['not_compliant_count'] = _dict.get('not_compliant_count') - if 'unable_to_perform_count' in _dict: - args['unable_to_perform_count'] = _dict.get('unable_to_perform_count') - if 'user_evaluation_required_count' in _dict: - args['user_evaluation_required_count'] = _dict.get('user_evaluation_required_count') + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + else: + raise ValueError('Required property \'limit\' not present in ProfileCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + else: + raise ValueError('Required property \'total_count\' not present in ProfileCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (profiles := _dict.get('profiles')) is not None: + args['profiles'] = [Profile.from_dict(v) for v in profiles] + else: + raise ValueError('Required property \'profiles\' not present in ProfileCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ControlWithStats object from a json dictionary.""" + """Initialize a ProfileCollection 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, 'control_library_id') and self.control_library_id is not None: - _dict['control_library_id'] = self.control_library_id - if hasattr(self, 'control_library_version') and self.control_library_version is not None: - _dict['control_library_version'] = self.control_library_version - if hasattr(self, 'control_name') and self.control_name is not None: - _dict['control_name'] = self.control_name - if hasattr(self, 'control_description') and self.control_description is not None: - _dict['control_description'] = self.control_description - if hasattr(self, 'control_category') and self.control_category is not None: - _dict['control_category'] = self.control_category - if hasattr(self, 'control_path') and self.control_path is not None: - _dict['control_path'] = self.control_path - if hasattr(self, 'control_specifications') and self.control_specifications is not None: - control_specifications_list = [] - for v in self.control_specifications: - if isinstance(v, dict): - control_specifications_list.append(v) - else: - control_specifications_list.append(v.to_dict()) - _dict['control_specifications'] = control_specifications_list - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit if hasattr(self, 'total_count') and self.total_count is not None: _dict['total_count'] = self.total_count - if hasattr(self, 'compliant_count') and self.compliant_count is not None: - _dict['compliant_count'] = self.compliant_count - if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: - _dict['not_compliant_count'] = self.not_compliant_count - if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: - _dict['unable_to_perform_count'] = self.unable_to_perform_count - if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: - _dict['user_evaluation_required_count'] = self.user_evaluation_required_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, '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): @@ -6127,139 +11437,148 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ControlWithStats object.""" + """Return a `str` version of this ProfileCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ControlWithStats') -> bool: + def __eq__(self, other: 'ProfileCollection') -> 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: 'ControlWithStats') -> bool: + def __ne__(self, other: 'ProfileCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The allowed values of an aggregated status for controls, specifications, - assessments, and resources. - """ - - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' - - -class ControlsInControlLib: +class ProfileControlsInResponse: """ - The control details of a control library. - - :attr str control_name: (optional) The ID of the control library that contains - the profile. - :attr str control_id: (optional) The control name. - :attr str control_description: (optional) The control description. - :attr str control_category: (optional) The control category. - :attr str control_parent: (optional) The parent control. - :attr List[str] control_tags: (optional) The control tags. - :attr List[ControlSpecifications] control_specifications: (optional) The control - specifications. - :attr ControlDocs control_docs: (optional) The control documentation. - :attr bool control_requirement: (optional) Is this a control that can be - automated or manually evaluated. - :attr str status: (optional) The control status. + The control details for a profile. + + :param bool control_requirement: (optional) Determines if the control needs to + pass during evaluation. + :param str control_library_id: (optional) The ID of the control library that + contains a profile. + :param str control_id: (optional) The control ID. + :param str control_library_version: (optional) The control library version. + :param str control_name: (optional) The control name. + :param str control_description: (optional) The control description. + :param str control_severity: (optional) The control severity. + :param str control_category: (optional) The control category. + :param str control_parent: (optional) The control parent. + :param ControlDoc control_docs: (optional) References to a control + documentation. + :param List[ControlSpecification] control_specifications: List of control + specifications in a profile. """ def __init__( self, + control_specifications: List['ControlSpecification'], *, - control_name: str = None, - control_id: str = None, - control_description: str = None, - control_category: str = None, - control_parent: str = None, - control_tags: List[str] = None, - control_specifications: List['ControlSpecifications'] = None, - control_docs: 'ControlDocs' = None, - control_requirement: bool = None, - status: str = None, + control_requirement: Optional[bool] = None, + control_library_id: Optional[str] = None, + control_id: Optional[str] = None, + control_library_version: Optional[str] = None, + control_name: Optional[str] = None, + control_description: Optional[str] = None, + control_severity: Optional[str] = None, + control_category: Optional[str] = None, + control_parent: Optional[str] = None, + control_docs: Optional['ControlDoc'] = None, ) -> None: """ - Initialize a ControlsInControlLib object. + Initialize a ProfileControlsInResponse object. - :param str control_name: (optional) The ID of the control library that - contains the profile. - :param str control_id: (optional) The control name. + :param List[ControlSpecification] control_specifications: List of control + specifications in a profile. + :param bool control_requirement: (optional) Determines if the control needs + to pass during evaluation. + :param str control_library_id: (optional) The ID of the control library + that contains a profile. + :param str control_id: (optional) The control ID. + :param str control_library_version: (optional) The control library version. + :param str control_name: (optional) The control name. :param str control_description: (optional) The control description. + :param str control_severity: (optional) The control severity. :param str control_category: (optional) The control category. - :param str control_parent: (optional) The parent control. - :param List[str] control_tags: (optional) The control tags. - :param List[ControlSpecifications] control_specifications: (optional) The - control specifications. - :param ControlDocs control_docs: (optional) The control documentation. - :param bool control_requirement: (optional) Is this a control that can be - automated or manually evaluated. - :param str status: (optional) The control status. + :param str control_parent: (optional) The control parent. + :param ControlDoc control_docs: (optional) References to a control + documentation. """ - self.control_name = control_name + self.control_requirement = control_requirement + self.control_library_id = control_library_id self.control_id = control_id + self.control_library_version = control_library_version + self.control_name = control_name self.control_description = control_description + self.control_severity = control_severity self.control_category = control_category - self.control_parent = control_parent - self.control_tags = control_tags - self.control_specifications = control_specifications + self.control_parent = control_parent self.control_docs = control_docs - self.control_requirement = control_requirement - self.status = status + self.control_specifications = control_specifications @classmethod - def from_dict(cls, _dict: Dict) -> 'ControlsInControlLib': - """Initialize a ControlsInControlLib object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileControlsInResponse': + """Initialize a ProfileControlsInResponse object from a json dictionary.""" args = {} - if 'control_name' in _dict: - args['control_name'] = _dict.get('control_name') - if 'control_id' in _dict: - args['control_id'] = _dict.get('control_id') - if 'control_description' in _dict: - args['control_description'] = _dict.get('control_description') - if 'control_category' in _dict: - args['control_category'] = _dict.get('control_category') - if 'control_parent' in _dict: - args['control_parent'] = _dict.get('control_parent') - if 'control_tags' in _dict: - args['control_tags'] = _dict.get('control_tags') - if 'control_specifications' in _dict: - args['control_specifications'] = [ControlSpecifications.from_dict(v) for v in _dict.get('control_specifications')] - if 'control_docs' in _dict: - args['control_docs'] = ControlDocs.from_dict(_dict.get('control_docs')) - if 'control_requirement' in _dict: - args['control_requirement'] = _dict.get('control_requirement') - if 'status' in _dict: - args['status'] = _dict.get('status') + if (control_requirement := _dict.get('control_requirement')) is not None: + args['control_requirement'] = control_requirement + if (control_library_id := _dict.get('control_library_id')) is not None: + args['control_library_id'] = control_library_id + if (control_id := _dict.get('control_id')) is not None: + args['control_id'] = control_id + if (control_library_version := _dict.get('control_library_version')) is not None: + args['control_library_version'] = control_library_version + if (control_name := _dict.get('control_name')) is not None: + args['control_name'] = control_name + if (control_description := _dict.get('control_description')) is not None: + args['control_description'] = control_description + if (control_severity := _dict.get('control_severity')) is not None: + args['control_severity'] = control_severity + if (control_category := _dict.get('control_category')) is not None: + args['control_category'] = control_category + if (control_parent := _dict.get('control_parent')) is not None: + args['control_parent'] = control_parent + if (control_docs := _dict.get('control_docs')) is not None: + args['control_docs'] = ControlDoc.from_dict(control_docs) + if (control_specifications := _dict.get('control_specifications')) is not None: + args['control_specifications'] = [ControlSpecification.from_dict(v) for v in control_specifications] + else: + raise ValueError('Required property \'control_specifications\' not present in ProfileControlsInResponse JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ControlsInControlLib object from a json dictionary.""" + """Initialize a ProfileControlsInResponse 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, 'control_name') and self.control_name is not None: - _dict['control_name'] = self.control_name + if hasattr(self, 'control_requirement') and self.control_requirement is not None: + _dict['control_requirement'] = self.control_requirement + if hasattr(self, 'control_library_id') and self.control_library_id is not None: + _dict['control_library_id'] = self.control_library_id if hasattr(self, 'control_id') and self.control_id is not None: _dict['control_id'] = self.control_id + if hasattr(self, 'control_library_version') and self.control_library_version is not None: + _dict['control_library_version'] = self.control_library_version + if hasattr(self, 'control_name') and self.control_name is not None: + _dict['control_name'] = self.control_name if hasattr(self, 'control_description') and self.control_description is not None: _dict['control_description'] = self.control_description + if hasattr(self, 'control_severity') and self.control_severity is not None: + _dict['control_severity'] = self.control_severity if hasattr(self, 'control_category') and self.control_category is not None: _dict['control_category'] = self.control_category if hasattr(self, 'control_parent') and self.control_parent is not None: _dict['control_parent'] = self.control_parent - if hasattr(self, 'control_tags') and self.control_tags is not None: - _dict['control_tags'] = self.control_tags + if hasattr(self, 'control_docs') and self.control_docs is not None: + if isinstance(self.control_docs, dict): + _dict['control_docs'] = self.control_docs + else: + _dict['control_docs'] = self.control_docs.to_dict() if hasattr(self, 'control_specifications') and self.control_specifications is not None: control_specifications_list = [] for v in self.control_specifications: @@ -6268,15 +11587,6 @@ def to_dict(self) -> Dict: else: control_specifications_list.append(v.to_dict()) _dict['control_specifications'] = control_specifications_list - if hasattr(self, 'control_docs') and self.control_docs is not None: - if isinstance(self.control_docs, dict): - _dict['control_docs'] = self.control_docs - else: - _dict['control_docs'] = self.control_docs.to_dict() - if hasattr(self, 'control_requirement') and self.control_requirement is not None: - _dict['control_requirement'] = self.control_requirement - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status return _dict def _to_dict(self): @@ -6284,109 +11594,67 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ControlsInControlLib object.""" + """Return a `str` version of this ProfileControlsInResponse object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ControlsInControlLib') -> bool: + def __eq__(self, other: 'ProfileControlsInResponse') -> 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: 'ControlsInControlLib') -> bool: + def __ne__(self, other: 'ProfileControlsInResponse') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The control status. - """ - - ENABLED = 'enabled' - DISABLED = 'disabled' - - -class DefaultParametersPrototype: +class ProfileControlsPrototype: """ The control details of a profile. - :attr str assessment_type: (optional) The type of the implementation. - :attr str assessment_id: (optional) The implementation ID of the parameter. - :attr str parameter_name: (optional) The parameter name. - :attr str parameter_default_value: (optional) The default value of the - parameter. - :attr str parameter_display_name: (optional) The parameter display name. - :attr str parameter_type: (optional) The parameter type. + :param str control_library_id: (optional) The ID of the control library that + contains the profile. + :param str control_id: (optional) The control ID. """ def __init__( self, *, - assessment_type: str = None, - assessment_id: str = None, - parameter_name: str = None, - parameter_default_value: str = None, - parameter_display_name: str = None, - parameter_type: str = None, + control_library_id: Optional[str] = None, + control_id: Optional[str] = None, ) -> None: """ - Initialize a DefaultParametersPrototype object. + Initialize a ProfileControlsPrototype object. - :param str assessment_type: (optional) The type of the implementation. - :param str assessment_id: (optional) The implementation ID of the - parameter. - :param str parameter_name: (optional) The parameter name. - :param str parameter_default_value: (optional) The default value of the - parameter. - :param str parameter_display_name: (optional) The parameter display name. - :param str parameter_type: (optional) The parameter type. + :param str control_library_id: (optional) The ID of the control library + that contains the profile. + :param str control_id: (optional) The control ID. """ - self.assessment_type = assessment_type - self.assessment_id = assessment_id - self.parameter_name = parameter_name - self.parameter_default_value = parameter_default_value - self.parameter_display_name = parameter_display_name - self.parameter_type = parameter_type + self.control_library_id = control_library_id + self.control_id = control_id @classmethod - def from_dict(cls, _dict: Dict) -> 'DefaultParametersPrototype': - """Initialize a DefaultParametersPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileControlsPrototype': + """Initialize a ProfileControlsPrototype object from a json dictionary.""" args = {} - if 'assessment_type' in _dict: - args['assessment_type'] = _dict.get('assessment_type') - if 'assessment_id' in _dict: - args['assessment_id'] = _dict.get('assessment_id') - if 'parameter_name' in _dict: - args['parameter_name'] = _dict.get('parameter_name') - if 'parameter_default_value' in _dict: - args['parameter_default_value'] = _dict.get('parameter_default_value') - if 'parameter_display_name' in _dict: - args['parameter_display_name'] = _dict.get('parameter_display_name') - if 'parameter_type' in _dict: - args['parameter_type'] = _dict.get('parameter_type') + if (control_library_id := _dict.get('control_library_id')) is not None: + args['control_library_id'] = control_library_id + if (control_id := _dict.get('control_id')) is not None: + args['control_id'] = control_id return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a DefaultParametersPrototype object from a json dictionary.""" + """Initialize a ProfileControlsPrototype 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, 'assessment_type') and self.assessment_type is not None: - _dict['assessment_type'] = self.assessment_type - if hasattr(self, 'assessment_id') and self.assessment_id is not None: - _dict['assessment_id'] = self.assessment_id - if hasattr(self, 'parameter_name') and self.parameter_name is not None: - _dict['parameter_name'] = self.parameter_name - if hasattr(self, 'parameter_default_value') and self.parameter_default_value is not None: - _dict['parameter_default_value'] = self.parameter_default_value - if hasattr(self, 'parameter_display_name') and self.parameter_display_name is not None: - _dict['parameter_display_name'] = self.parameter_display_name - if hasattr(self, 'parameter_type') and self.parameter_type is not None: - _dict['parameter_type'] = self.parameter_type + if hasattr(self, 'control_library_id') and self.control_library_id is not None: + _dict['control_library_id'] = self.control_library_id + if hasattr(self, 'control_id') and self.control_id is not None: + _dict['control_id'] = self.control_id return _dict def _to_dict(self): @@ -6394,77 +11662,75 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this DefaultParametersPrototype object.""" + """Return a `str` version of this ProfileControlsPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'DefaultParametersPrototype') -> bool: + def __eq__(self, other: 'ProfileControlsPrototype') -> 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: 'DefaultParametersPrototype') -> bool: + def __ne__(self, other: 'ProfileControlsPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ParameterTypeEnum(str, Enum): - """ - The parameter type. - """ - - STRING = 'string' - NUMERIC = 'numeric' - GENERAL = 'general' - BOOLEAN = 'boolean' - STRING_LIST = 'string_list' - IP_LIST = 'ip_list' - TIMESTAMP = 'timestamp' - - -class EvalDetails: +class ProfileDefaultParametersResponse: """ - The evaluation details. + The default parameters of a profile. - :attr List[Property] properties: (optional) The evaluation properties. + :param str id: (optional) The ID of the Profile. + :param List[DefaultParameters] default_parameters: list of parameters given by + default. """ def __init__( self, + default_parameters: List['DefaultParameters'], *, - properties: List['Property'] = None, + id: Optional[str] = None, ) -> None: """ - Initialize a EvalDetails object. + Initialize a ProfileDefaultParametersResponse object. - :param List[Property] properties: (optional) The evaluation properties. + :param List[DefaultParameters] default_parameters: list of parameters given + by default. + :param str id: (optional) The ID of the Profile. """ - self.properties = properties + self.id = id + self.default_parameters = default_parameters @classmethod - def from_dict(cls, _dict: Dict) -> 'EvalDetails': - """Initialize a EvalDetails object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileDefaultParametersResponse': + """Initialize a ProfileDefaultParametersResponse object from a json dictionary.""" args = {} - if 'properties' in _dict: - args['properties'] = [Property.from_dict(v) for v in _dict.get('properties')] + if (id := _dict.get('id')) is not None: + args['id'] = id + if (default_parameters := _dict.get('default_parameters')) is not None: + args['default_parameters'] = [DefaultParameters.from_dict(v) for v in default_parameters] + else: + raise ValueError('Required property \'default_parameters\' not present in ProfileDefaultParametersResponse JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EvalDetails object from a json dictionary.""" + """Initialize a ProfileDefaultParametersResponse 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, 'properties') and self.properties is not None: - properties_list = [] - for v in self.properties: + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'default_parameters') and self.default_parameters is not None: + default_parameters_list = [] + for v in self.default_parameters: if isinstance(v, dict): - properties_list.append(v) + default_parameters_list.append(v) else: - properties_list.append(v.to_dict()) - _dict['properties'] = properties_list + default_parameters_list.append(v.to_dict()) + _dict['default_parameters'] = default_parameters_list return _dict def _to_dict(self): @@ -6472,102 +11738,73 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EvalDetails object.""" + """Return a `str` version of this ProfileDefaultParametersResponse object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EvalDetails') -> bool: + def __eq__(self, other: 'ProfileDefaultParametersResponse') -> 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: 'EvalDetails') -> bool: + def __ne__(self, other: 'ProfileDefaultParametersResponse') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class EvalStats: +class ProfileInfo: """ - The evaluation stats. + The profile information. - :attr str status: (optional) The allowed values of an aggregated status for - controls, specifications, assessments, and resources. - :attr int total_count: (optional) The total number of evaluations. - :attr int pass_count: (optional) The number of passed evaluations. - :attr int failure_count: (optional) The number of failed evaluations. - :attr int error_count: (optional) The number of evaluations that started, but - did not finish, and ended with errors. - :attr int completed_count: (optional) The total number of completed evaluations. + :param str id: (optional) The profile ID. + :param str name: (optional) The profile name. + :param str version: (optional) The profile version. """ def __init__( self, *, - status: str = None, - total_count: int = None, - pass_count: int = None, - failure_count: int = None, - error_count: int = None, - completed_count: int = None, + id: Optional[str] = None, + name: Optional[str] = None, + version: Optional[str] = None, ) -> None: """ - Initialize a EvalStats object. + Initialize a ProfileInfo object. - :param str status: (optional) The allowed values of an aggregated status - for controls, specifications, assessments, and resources. - :param int total_count: (optional) The total number of evaluations. - :param int pass_count: (optional) The number of passed evaluations. - :param int failure_count: (optional) The number of failed evaluations. - :param int error_count: (optional) The number of evaluations that started, - but did not finish, and ended with errors. - :param int completed_count: (optional) The total number of completed - evaluations. + :param str id: (optional) The profile ID. + :param str name: (optional) The profile name. + :param str version: (optional) The profile version. """ - self.status = status - self.total_count = total_count - self.pass_count = pass_count - self.failure_count = failure_count - self.error_count = error_count - self.completed_count = completed_count + self.id = id + self.name = name + self.version = version @classmethod - def from_dict(cls, _dict: Dict) -> 'EvalStats': - """Initialize a EvalStats object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProfileInfo': + """Initialize a ProfileInfo object from a json dictionary.""" args = {} - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'pass_count' in _dict: - args['pass_count'] = _dict.get('pass_count') - if 'failure_count' in _dict: - args['failure_count'] = _dict.get('failure_count') - if 'error_count' in _dict: - args['error_count'] = _dict.get('error_count') - if 'completed_count' in _dict: - args['completed_count'] = _dict.get('completed_count') + if (id := _dict.get('id')) is not None: + args['id'] = id + if (name := _dict.get('name')) is not None: + args['name'] = name + if (version := _dict.get('version')) is not None: + args['version'] = version return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EvalStats object from a json dictionary.""" + """Initialize a ProfileInfo 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, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'pass_count') and self.pass_count is not None: - _dict['pass_count'] = self.pass_count - if hasattr(self, 'failure_count') and self.failure_count is not None: - _dict['failure_count'] = self.failure_count - if hasattr(self, 'error_count') and self.error_count is not None: - _dict['error_count'] = self.error_count - if hasattr(self, 'completed_count') and self.completed_count is not None: - _dict['completed_count'] = self.completed_count + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'version') and self.version is not None: + _dict['version'] = self.version return _dict def _to_dict(self): @@ -6575,153 +11812,205 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EvalStats object.""" + """Return a `str` version of this ProfileInfo object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EvalStats') -> bool: + def __eq__(self, other: 'ProfileInfo') -> 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: 'EvalStats') -> bool: + def __ne__(self, other: 'ProfileInfo') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The allowed values of an aggregated status for controls, specifications, - assessments, and resources. - """ - - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' - - -class Evaluation: +class ProviderType: """ - The evaluation of a control specification assessment. + The provider type item. - :attr str home_account_id: (optional) The ID of the home account. - :attr str report_id: (optional) The ID of the report that is associated to the - evaluation. - :attr str control_id: (optional) The control ID. - :attr str component_id: (optional) The component ID. - :attr Assessment assessment: (optional) The control specification assessment. - :attr str evaluate_time: (optional) The time when the evaluation was made. - :attr TargetInfo target: (optional) The evaluation target. - :attr str status: (optional) The allowed values of an evaluation status. - :attr str reason: (optional) The reason for the evaluation failure. - :attr EvalDetails details: (optional) The evaluation details. + :param str id: The unique identifier of the provider type. + :param str type: The type of the provider type. + :param str name: The name of the provider type. + :param str description: The provider type description. + :param bool s2s_enabled: A boolean that indicates whether the provider type is + s2s-enabled. + :param int instance_limit: The maximum number of instances that can be created + for the provider type. + :param str mode: The mode that is used to get results from provider (`PUSH` or + `PULL`). + :param str data_type: The format of the results that a provider supports. + :param str icon: The icon of a provider in .svg format that is encoded as a + base64 string. + :param LabelType label: (optional) The label that is associated with the + provider type. + :param dict attributes: The attributes that are required when you're creating an + instance of a provider type. The attributes field can have multiple keys in its + value. Each of those keys has a value object that includes the type, and + display name as keys. For example, `{type:"", display_name:""}`. + **NOTE;** If the provider type is s2s-enabled, which means that if the + `s2s_enabled` field is set to `true`, then a CRN field of type text is required + in the attributes value object. + :param datetime created_at: (optional) Time at which resource was created. + :param datetime updated_at: (optional) Time at which resource was updated. """ def __init__( self, + id: str, + type: str, + name: str, + description: str, + s2s_enabled: bool, + instance_limit: int, + mode: str, + data_type: str, + icon: str, + attributes: dict, *, - home_account_id: str = None, - report_id: str = None, - control_id: str = None, - component_id: str = None, - assessment: 'Assessment' = None, - evaluate_time: str = None, - target: 'TargetInfo' = None, - status: str = None, - reason: str = None, - details: 'EvalDetails' = None, + label: Optional['LabelType'] = None, + created_at: Optional[datetime] = None, + updated_at: Optional[datetime] = None, ) -> None: """ - Initialize a Evaluation object. + Initialize a ProviderType object. - :param str home_account_id: (optional) The ID of the home account. - :param str report_id: (optional) The ID of the report that is associated to - the evaluation. - :param str control_id: (optional) The control ID. - :param str component_id: (optional) The component ID. - :param Assessment assessment: (optional) The control specification - assessment. - :param str evaluate_time: (optional) The time when the evaluation was made. - :param TargetInfo target: (optional) The evaluation target. - :param str status: (optional) The allowed values of an evaluation status. - :param str reason: (optional) The reason for the evaluation failure. - :param EvalDetails details: (optional) The evaluation details. + :param str id: The unique identifier of the provider type. + :param str type: The type of the provider type. + :param str name: The name of the provider type. + :param str description: The provider type description. + :param bool s2s_enabled: A boolean that indicates whether the provider type + is s2s-enabled. + :param int instance_limit: The maximum number of instances that can be + created for the provider type. + :param str mode: The mode that is used to get results from provider (`PUSH` + or `PULL`). + :param str data_type: The format of the results that a provider supports. + :param str icon: The icon of a provider in .svg format that is encoded as a + base64 string. + :param dict attributes: The attributes that are required when you're + creating an instance of a provider type. The attributes field can have + multiple keys in its value. Each of those keys has a value object that + includes the type, and display name as keys. For example, `{type:"", + display_name:""}`. + **NOTE;** If the provider type is s2s-enabled, which means that if the + `s2s_enabled` field is set to `true`, then a CRN field of type text is + required in the attributes value object. + :param LabelType label: (optional) The label that is associated with the + provider type. + :param datetime created_at: (optional) Time at which resource was created. + :param datetime updated_at: (optional) Time at which resource was updated. """ - self.home_account_id = home_account_id - self.report_id = report_id - self.control_id = control_id - self.component_id = component_id - self.assessment = assessment - self.evaluate_time = evaluate_time - self.target = target - self.status = status - self.reason = reason - self.details = details + self.id = id + self.type = type + self.name = name + self.description = description + self.s2s_enabled = s2s_enabled + self.instance_limit = instance_limit + self.mode = mode + self.data_type = data_type + self.icon = icon + self.label = label + self.attributes = attributes + self.created_at = created_at + self.updated_at = updated_at @classmethod - def from_dict(cls, _dict: Dict) -> 'Evaluation': - """Initialize a Evaluation object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProviderType': + """Initialize a ProviderType object from a json dictionary.""" args = {} - if 'home_account_id' in _dict: - args['home_account_id'] = _dict.get('home_account_id') - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'control_id' in _dict: - args['control_id'] = _dict.get('control_id') - if 'component_id' in _dict: - args['component_id'] = _dict.get('component_id') - if 'assessment' in _dict: - args['assessment'] = Assessment.from_dict(_dict.get('assessment')) - if 'evaluate_time' in _dict: - args['evaluate_time'] = _dict.get('evaluate_time') - if 'target' in _dict: - args['target'] = TargetInfo.from_dict(_dict.get('target')) - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'reason' in _dict: - args['reason'] = _dict.get('reason') - if 'details' in _dict: - args['details'] = EvalDetails.from_dict(_dict.get('details')) + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in ProviderType JSON') + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in ProviderType JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in ProviderType JSON') + if (description := _dict.get('description')) is not None: + args['description'] = description + else: + raise ValueError('Required property \'description\' not present in ProviderType JSON') + if (s2s_enabled := _dict.get('s2s_enabled')) is not None: + args['s2s_enabled'] = s2s_enabled + else: + raise ValueError('Required property \'s2s_enabled\' not present in ProviderType JSON') + if (instance_limit := _dict.get('instance_limit')) is not None: + args['instance_limit'] = instance_limit + else: + raise ValueError('Required property \'instance_limit\' not present in ProviderType JSON') + if (mode := _dict.get('mode')) is not None: + args['mode'] = mode + else: + raise ValueError('Required property \'mode\' not present in ProviderType JSON') + if (data_type := _dict.get('data_type')) is not None: + args['data_type'] = data_type + else: + raise ValueError('Required property \'data_type\' not present in ProviderType JSON') + if (icon := _dict.get('icon')) is not None: + args['icon'] = icon + else: + raise ValueError('Required property \'icon\' not present in ProviderType JSON') + if (label := _dict.get('label')) is not None: + args['label'] = LabelType.from_dict(label) + if (attributes := _dict.get('attributes')) is not None: + args['attributes'] = {k: AdditionalProperty.from_dict(v) for k, v in attributes.items()} + else: + raise ValueError('Required property \'attributes\' not present in ProviderType JSON') + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Evaluation object from a json dictionary.""" + """Initialize a ProviderType 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, 'home_account_id') and self.home_account_id is not None: - _dict['home_account_id'] = self.home_account_id - if hasattr(self, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'control_id') and self.control_id is not None: - _dict['control_id'] = self.control_id - if hasattr(self, 'component_id') and self.component_id is not None: - _dict['component_id'] = self.component_id - if hasattr(self, 'assessment') and self.assessment is not None: - if isinstance(self.assessment, dict): - _dict['assessment'] = self.assessment - else: - _dict['assessment'] = self.assessment.to_dict() - if hasattr(self, 'evaluate_time') and self.evaluate_time is not None: - _dict['evaluate_time'] = self.evaluate_time - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'reason') and self.reason is not None: - _dict['reason'] = self.reason - if hasattr(self, 'details') and self.details is not None: - if isinstance(self.details, dict): - _dict['details'] = self.details + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + 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, 's2s_enabled') and self.s2s_enabled is not None: + _dict['s2s_enabled'] = self.s2s_enabled + if hasattr(self, 'instance_limit') and self.instance_limit is not None: + _dict['instance_limit'] = self.instance_limit + if hasattr(self, 'mode') and self.mode is not None: + _dict['mode'] = self.mode + if hasattr(self, 'data_type') and self.data_type is not None: + _dict['data_type'] = self.data_type + if hasattr(self, 'icon') and self.icon is not None: + _dict['icon'] = self.icon + if hasattr(self, 'label') and self.label is not None: + if isinstance(self.label, dict): + _dict['label'] = self.label else: - _dict['details'] = self.details.to_dict() + _dict['label'] = self.label.to_dict() + if hasattr(self, 'attributes') and self.attributes is not None: + attributes_map = {} + for k, v in self.attributes.items(): + if isinstance(v, dict): + attributes_map[k] = v + else: + attributes_map[k] = v.to_dict() + _dict['attributes'] = attributes_map + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) return _dict def _to_dict(self): @@ -6729,145 +12018,64 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Evaluation object.""" + """Return a `str` version of this ProviderType object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Evaluation') -> bool: + def __eq__(self, other: 'ProviderType') -> 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: 'Evaluation') -> bool: + def __ne__(self, other: 'ProviderType') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The allowed values of an evaluation status. - """ - - PASS = 'pass' - FAILURE = 'failure' - ERROR = 'error' - SKIPPED = 'skipped' - - -class EvaluationPage: +class ProviderTypeCollection: """ - The page of assessment evaluations. + The provider types collection. - :attr int total_count: The total number of resources that are in the collection. - :attr int limit: The requested page limi.t. - :attr str start: (optional) The token of the next page, when it's present. - :attr PageHRef first: The page reference. - :attr PageHRef next: (optional) The page reference. - :attr str home_account_id: (optional) The ID of the home account. - :attr str report_id: (optional) The ID of the report. - :attr List[Evaluation] evaluations: (optional) The list of evaluations that are - on the page. + :param List[ProviderType] provider_types: (optional) The array of provder type. """ def __init__( self, - total_count: int, - limit: int, - first: 'PageHRef', *, - start: str = None, - next: 'PageHRef' = None, - home_account_id: str = None, - report_id: str = None, - evaluations: List['Evaluation'] = None, + provider_types: Optional[List['ProviderType']] = None, ) -> None: """ - Initialize a EvaluationPage object. + Initialize a ProviderTypeCollection object. - :param int total_count: The total number of resources that are in the - collection. - :param int limit: The requested page limi.t. - :param PageHRef first: The page reference. - :param str start: (optional) The token of the next page, when it's present. - :param PageHRef next: (optional) The page reference. - :param str home_account_id: (optional) The ID of the home account. - :param str report_id: (optional) The ID of the report. - :param List[Evaluation] evaluations: (optional) The list of evaluations - that are on the page. + :param List[ProviderType] provider_types: (optional) The array of provder + type. """ - self.total_count = total_count - self.limit = limit - self.start = start - self.first = first - self.next = next - self.home_account_id = home_account_id - self.report_id = report_id - self.evaluations = evaluations + self.provider_types = provider_types @classmethod - def from_dict(cls, _dict: Dict) -> 'EvaluationPage': - """Initialize a EvaluationPage object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProviderTypeCollection': + """Initialize a ProviderTypeCollection object from a json dictionary.""" args = {} - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in EvaluationPage JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in EvaluationPage JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') - if 'first' in _dict: - args['first'] = PageHRef.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in EvaluationPage JSON') - if 'next' in _dict: - args['next'] = PageHRef.from_dict(_dict.get('next')) - if 'home_account_id' in _dict: - args['home_account_id'] = _dict.get('home_account_id') - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'evaluations' in _dict: - args['evaluations'] = [Evaluation.from_dict(v) for v in _dict.get('evaluations')] + if (provider_types := _dict.get('provider_types')) is not None: + args['provider_types'] = [ProviderType.from_dict(v) for v in provider_types] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EvaluationPage object from a json dictionary.""" + """Initialize a ProviderTypeCollection 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, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'start') and self.start is not None: - _dict['start'] = self.start - if hasattr(self, 'first') and self.first is not None: - if isinstance(self.first, dict): - _dict['first'] = self.first - else: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'next') and self.next is not None: - if isinstance(self.next, dict): - _dict['next'] = self.next - else: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'home_account_id') and self.home_account_id is not None: - _dict['home_account_id'] = self.home_account_id - if hasattr(self, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'evaluations') and self.evaluations is not None: - evaluations_list = [] - for v in self.evaluations: + if hasattr(self, 'provider_types') and self.provider_types is not None: + provider_types_list = [] + for v in self.provider_types: if isinstance(v, dict): - evaluations_list.append(v) + provider_types_list.append(v) else: - evaluations_list.append(v.to_dict()) - _dict['evaluations'] = evaluations_list + provider_types_list.append(v.to_dict()) + _dict['provider_types'] = provider_types_list return _dict def _to_dict(self): @@ -6875,97 +12083,100 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EvaluationPage object.""" + """Return a `str` version of this ProviderTypeCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EvaluationPage') -> bool: + def __eq__(self, other: 'ProviderTypeCollection') -> 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: 'EvaluationPage') -> bool: + def __ne__(self, other: 'ProviderTypeCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class EventNotifications: +class ProviderTypeInstance: """ - The Event Notifications settings. + A provider type instance. - :attr str instance_crn: (optional) The Event Notifications instance CRN. - :attr datetime updated_on: (optional) The date when the Event Notifications - connection was updated. - :attr str source_id: (optional) The connected Security and Compliance Center - instance CRN. - :attr str source_description: (optional) The description of the source of the - Event Notifications. - :attr str source_name: (optional) The name of the source of the Event - Notifications. + :param str id: (optional) The unique identifier of the provider type instance. + :param str type: (optional) The type of the provider type. + :param str name: (optional) The name of the provider type instance. + :param dict attributes: (optional) The attributes for connecting to the provider + type instance. + :param datetime created_at: (optional) Time at which resource was created. + :param datetime updated_at: (optional) Time at which resource was updated. """ def __init__( self, *, - instance_crn: str = None, - updated_on: datetime = None, - source_id: str = None, - source_description: str = None, - source_name: str = None, + id: Optional[str] = None, + type: Optional[str] = None, + name: Optional[str] = None, + attributes: Optional[dict] = None, + created_at: Optional[datetime] = None, + updated_at: Optional[datetime] = None, ) -> None: """ - Initialize a EventNotifications object. + Initialize a ProviderTypeInstance object. - :param str instance_crn: (optional) The Event Notifications instance CRN. - :param datetime updated_on: (optional) The date when the Event - Notifications connection was updated. - :param str source_id: (optional) The connected Security and Compliance - Center instance CRN. - :param str source_description: (optional) The description of the source of - the Event Notifications. - :param str source_name: (optional) The name of the source of the Event - Notifications. + :param str id: (optional) The unique identifier of the provider type + instance. + :param str type: (optional) The type of the provider type. + :param str name: (optional) The name of the provider type instance. + :param dict attributes: (optional) The attributes for connecting to the + provider type instance. + :param datetime created_at: (optional) Time at which resource was created. + :param datetime updated_at: (optional) Time at which resource was updated. """ - self.instance_crn = instance_crn - self.updated_on = updated_on - self.source_id = source_id - self.source_description = source_description - self.source_name = source_name + self.id = id + self.type = type + self.name = name + self.attributes = attributes + self.created_at = created_at + self.updated_at = updated_at @classmethod - def from_dict(cls, _dict: Dict) -> 'EventNotifications': - """Initialize a EventNotifications object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProviderTypeInstance': + """Initialize a ProviderTypeInstance object from a json dictionary.""" args = {} - if 'instance_crn' in _dict: - args['instance_crn'] = _dict.get('instance_crn') - if 'updated_on' in _dict: - args['updated_on'] = string_to_datetime(_dict.get('updated_on')) - if 'source_id' in _dict: - args['source_id'] = _dict.get('source_id') - if 'source_description' in _dict: - args['source_description'] = _dict.get('source_description') - if 'source_name' in _dict: - args['source_name'] = _dict.get('source_name') + if (id := _dict.get('id')) is not None: + args['id'] = id + if (type := _dict.get('type')) is not None: + args['type'] = type + if (name := _dict.get('name')) is not None: + args['name'] = name + if (attributes := _dict.get('attributes')) is not None: + args['attributes'] = attributes + if (created_at := _dict.get('created_at')) is not None: + args['created_at'] = string_to_datetime(created_at) + if (updated_at := _dict.get('updated_at')) is not None: + args['updated_at'] = string_to_datetime(updated_at) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a EventNotifications object from a json dictionary.""" + """Initialize a ProviderTypeInstance 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, 'instance_crn') and self.instance_crn is not None: - _dict['instance_crn'] = self.instance_crn - if hasattr(self, 'updated_on') and self.updated_on is not None: - _dict['updated_on'] = datetime_to_string(self.updated_on) - if hasattr(self, 'source_id') and self.source_id is not None: - _dict['source_id'] = self.source_id - if hasattr(self, 'source_description') and self.source_description is not None: - _dict['source_description'] = self.source_description - if hasattr(self, 'source_name') and self.source_name is not None: - _dict['source_name'] = self.source_name + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'attributes') and self.attributes is not None: + _dict['attributes'] = self.attributes + if hasattr(self, 'created_at') and self.created_at is not None: + _dict['created_at'] = datetime_to_string(self.created_at) + if hasattr(self, 'updated_at') and self.updated_at is not None: + _dict['updated_at'] = datetime_to_string(self.updated_at) return _dict def _to_dict(self): @@ -6973,65 +12184,65 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this EventNotifications object.""" + """Return a `str` version of this ProviderTypeInstance object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'EventNotifications') -> bool: + def __eq__(self, other: 'ProviderTypeInstance') -> 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: 'EventNotifications') -> bool: + def __ne__(self, other: 'ProviderTypeInstance') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class FailedControls: +class ProviderTypeInstanceCollection: """ - The failed controls. + Provider types instances response. - :attr int threshold_limit: (optional) The threshold limit. - :attr List[str] failed_control_ids: (optional) The failed control IDs. + :param List[ProviderTypeInstance] provider_type_instances: (optional) The array + of instances for all provider types. """ def __init__( self, *, - threshold_limit: int = None, - failed_control_ids: List[str] = None, + provider_type_instances: Optional[List['ProviderTypeInstance']] = None, ) -> None: """ - Initialize a FailedControls object. + Initialize a ProviderTypeInstanceCollection object. - :param int threshold_limit: (optional) The threshold limit. - :param List[str] failed_control_ids: (optional) The failed control IDs. + :param List[ProviderTypeInstance] provider_type_instances: (optional) The + array of instances for all provider types. """ - self.threshold_limit = threshold_limit - self.failed_control_ids = failed_control_ids + self.provider_type_instances = provider_type_instances @classmethod - def from_dict(cls, _dict: Dict) -> 'FailedControls': - """Initialize a FailedControls object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ProviderTypeInstanceCollection': + """Initialize a ProviderTypeInstanceCollection object from a json dictionary.""" args = {} - if 'threshold_limit' in _dict: - args['threshold_limit'] = _dict.get('threshold_limit') - if 'failed_control_ids' in _dict: - args['failed_control_ids'] = _dict.get('failed_control_ids') + if (provider_type_instances := _dict.get('provider_type_instances')) is not None: + args['provider_type_instances'] = [ProviderTypeInstance.from_dict(v) for v in provider_type_instances] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a FailedControls object from a json dictionary.""" + """Initialize a ProviderTypeInstanceCollection 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, 'threshold_limit') and self.threshold_limit is not None: - _dict['threshold_limit'] = self.threshold_limit - if hasattr(self, 'failed_control_ids') and self.failed_control_ids is not None: - _dict['failed_control_ids'] = self.failed_control_ids + if hasattr(self, 'provider_type_instances') and self.provider_type_instances is not None: + provider_type_instances_list = [] + for v in self.provider_type_instances: + if isinstance(v, dict): + provider_type_instances_list.append(v) + else: + provider_type_instances_list.append(v.to_dict()) + _dict['provider_type_instances'] = provider_type_instances_list return _dict def _to_dict(self): @@ -7039,103 +12250,250 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this FailedControls object.""" + """Return a `str` version of this ProviderTypeInstanceCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'FailedControls') -> bool: + def __eq__(self, other: 'ProviderTypeInstanceCollection') -> 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: 'FailedControls') -> bool: + def __ne__(self, other: 'ProviderTypeInstanceCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Implementation: +class Report: """ - The implementation details of a control library. + The report. - :attr str assessment_id: (optional) The assessment ID. - :attr str assessment_method: (optional) The assessment method. - :attr str assessment_type: (optional) The assessment type. - :attr str assessment_description: (optional) The assessment description. - :attr int parameter_count: (optional) The parameter count. - :attr List[ParameterInfo] parameters: (optional) The parameters. + :param str id: The ID of the report. + :param str type: The type of the scan. + :param str group_id: The group ID that is associated with the report. The group + ID combines profile, scope, and attachment IDs. + :param str created_on: The date when the report was created. + :param str scan_time: The date when the scan was run. + :param str cos_object: The Cloud Object Storage object that is associated with + the report. + :param str instance_id: The ID of the Security and Compliance Center instance. + :param Account account: The account that is associated with a report. + :param ProfileInfo profile: The profile information. + :param ScopeID scope: The scope ID that is associated with a report. Attributes + for this object will be blank if the report has multiple scopes tied to the + report. + :param Attachment attachment: The attachment that is associated with a report. + :param ComplianceStatsWithNonCompliant controls_summary: The compliance stats. + :param EvalStats evaluations_summary: The evaluation stats. + :param Tags tags: The collection of different types of tags. + :param List[ReportScope] scopes: The scopes used in the report. + :param AdditionalDetails additional_details: Extended information for a report. """ - def __init__( - self, - *, - assessment_id: str = None, - assessment_method: str = None, - assessment_type: str = None, - assessment_description: str = None, - parameter_count: int = None, - parameters: List['ParameterInfo'] = None, + def __init__( + self, + id: str, + type: str, + group_id: str, + created_on: str, + scan_time: str, + cos_object: str, + instance_id: str, + account: 'Account', + profile: 'ProfileInfo', + scope: 'ScopeID', + attachment: 'Attachment', + controls_summary: 'ComplianceStatsWithNonCompliant', + evaluations_summary: 'EvalStats', + tags: 'Tags', + scopes: List['ReportScope'], + additional_details: 'AdditionalDetails', ) -> None: """ - Initialize a Implementation object. + Initialize a Report object. - :param str assessment_id: (optional) The assessment ID. - :param str assessment_method: (optional) The assessment method. - :param str assessment_type: (optional) The assessment type. - :param str assessment_description: (optional) The assessment description. - :param int parameter_count: (optional) The parameter count. - :param List[ParameterInfo] parameters: (optional) The parameters. + :param str id: The ID of the report. + :param str type: The type of the scan. + :param str group_id: The group ID that is associated with the report. The + group ID combines profile, scope, and attachment IDs. + :param str created_on: The date when the report was created. + :param str scan_time: The date when the scan was run. + :param str cos_object: The Cloud Object Storage object that is associated + with the report. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param Account account: The account that is associated with a report. + :param ProfileInfo profile: The profile information. + :param ScopeID scope: The scope ID that is associated with a report. + Attributes for this object will be blank if the report has multiple scopes + tied to the report. + :param Attachment attachment: The attachment that is associated with a + report. + :param ComplianceStatsWithNonCompliant controls_summary: The compliance + stats. + :param EvalStats evaluations_summary: The evaluation stats. + :param Tags tags: The collection of different types of tags. + :param List[ReportScope] scopes: The scopes used in the report. + :param AdditionalDetails additional_details: Extended information for a + report. """ - self.assessment_id = assessment_id - self.assessment_method = assessment_method - self.assessment_type = assessment_type - self.assessment_description = assessment_description - self.parameter_count = parameter_count - self.parameters = parameters + self.id = id + self.type = type + self.group_id = group_id + self.created_on = created_on + self.scan_time = scan_time + self.cos_object = cos_object + self.instance_id = instance_id + self.account = account + self.profile = profile + self.scope = scope + self.attachment = attachment + self.controls_summary = controls_summary + self.evaluations_summary = evaluations_summary + self.tags = tags + self.scopes = scopes + self.additional_details = additional_details @classmethod - def from_dict(cls, _dict: Dict) -> 'Implementation': - """Initialize a Implementation object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Report': + """Initialize a Report object from a json dictionary.""" args = {} - if 'assessment_id' in _dict: - args['assessment_id'] = _dict.get('assessment_id') - if 'assessment_method' in _dict: - args['assessment_method'] = _dict.get('assessment_method') - if 'assessment_type' in _dict: - args['assessment_type'] = _dict.get('assessment_type') - if 'assessment_description' in _dict: - args['assessment_description'] = _dict.get('assessment_description') - if 'parameter_count' in _dict: - args['parameter_count'] = _dict.get('parameter_count') - if 'parameters' in _dict: - args['parameters'] = [ParameterInfo.from_dict(v) for v in _dict.get('parameters')] + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in Report JSON') + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in Report JSON') + if (group_id := _dict.get('group_id')) is not None: + args['group_id'] = group_id + else: + raise ValueError('Required property \'group_id\' not present in Report JSON') + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = created_on + else: + raise ValueError('Required property \'created_on\' not present in Report JSON') + if (scan_time := _dict.get('scan_time')) is not None: + args['scan_time'] = scan_time + else: + raise ValueError('Required property \'scan_time\' not present in Report JSON') + if (cos_object := _dict.get('cos_object')) is not None: + args['cos_object'] = cos_object + else: + raise ValueError('Required property \'cos_object\' not present in Report JSON') + if (instance_id := _dict.get('instance_id')) is not None: + args['instance_id'] = instance_id + else: + raise ValueError('Required property \'instance_id\' not present in Report JSON') + if (account := _dict.get('account')) is not None: + args['account'] = Account.from_dict(account) + else: + raise ValueError('Required property \'account\' not present in Report JSON') + if (profile := _dict.get('profile')) is not None: + args['profile'] = ProfileInfo.from_dict(profile) + else: + raise ValueError('Required property \'profile\' not present in Report JSON') + if (scope := _dict.get('scope')) is not None: + args['scope'] = ScopeID.from_dict(scope) + else: + raise ValueError('Required property \'scope\' not present in Report JSON') + if (attachment := _dict.get('attachment')) is not None: + args['attachment'] = Attachment.from_dict(attachment) + else: + raise ValueError('Required property \'attachment\' not present in Report JSON') + if (controls_summary := _dict.get('controls_summary')) is not None: + args['controls_summary'] = ComplianceStatsWithNonCompliant.from_dict(controls_summary) + else: + raise ValueError('Required property \'controls_summary\' not present in Report JSON') + if (evaluations_summary := _dict.get('evaluations_summary')) is not None: + args['evaluations_summary'] = EvalStats.from_dict(evaluations_summary) + else: + raise ValueError('Required property \'evaluations_summary\' not present in Report JSON') + if (tags := _dict.get('tags')) is not None: + args['tags'] = Tags.from_dict(tags) + else: + raise ValueError('Required property \'tags\' not present in Report JSON') + if (scopes := _dict.get('scopes')) is not None: + args['scopes'] = [ReportScope.from_dict(v) for v in scopes] + else: + raise ValueError('Required property \'scopes\' not present in Report JSON') + if (additional_details := _dict.get('additional_details')) is not None: + args['additional_details'] = AdditionalDetails.from_dict(additional_details) + else: + raise ValueError('Required property \'additional_details\' not present in Report JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Implementation 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, 'assessment_id') and self.assessment_id is not None: - _dict['assessment_id'] = self.assessment_id - if hasattr(self, 'assessment_method') and self.assessment_method is not None: - _dict['assessment_method'] = self.assessment_method - if hasattr(self, 'assessment_type') and self.assessment_type is not None: - _dict['assessment_type'] = self.assessment_type - if hasattr(self, 'assessment_description') and self.assessment_description is not None: - _dict['assessment_description'] = self.assessment_description - if hasattr(self, 'parameter_count') and self.parameter_count is not None: - _dict['parameter_count'] = self.parameter_count - if hasattr(self, 'parameters') and self.parameters is not None: - parameters_list = [] - for v in self.parameters: + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'group_id') and self.group_id is not None: + _dict['group_id'] = self.group_id + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = self.created_on + if hasattr(self, 'scan_time') and self.scan_time is not None: + _dict['scan_time'] = self.scan_time + if hasattr(self, 'cos_object') and self.cos_object is not None: + _dict['cos_object'] = self.cos_object + if hasattr(self, 'instance_id') and self.instance_id is not None: + _dict['instance_id'] = self.instance_id + if hasattr(self, 'account') and self.account is not None: + if isinstance(self.account, dict): + _dict['account'] = self.account + else: + _dict['account'] = self.account.to_dict() + if hasattr(self, 'profile') and self.profile is not None: + if isinstance(self.profile, dict): + _dict['profile'] = self.profile + else: + _dict['profile'] = self.profile.to_dict() + if hasattr(self, 'scope') and self.scope is not None: + if isinstance(self.scope, dict): + _dict['scope'] = self.scope + else: + _dict['scope'] = self.scope.to_dict() + if hasattr(self, 'attachment') and self.attachment is not None: + if isinstance(self.attachment, dict): + _dict['attachment'] = self.attachment + else: + _dict['attachment'] = self.attachment.to_dict() + if hasattr(self, 'controls_summary') and self.controls_summary is not None: + if isinstance(self.controls_summary, dict): + _dict['controls_summary'] = self.controls_summary + else: + _dict['controls_summary'] = self.controls_summary.to_dict() + if hasattr(self, 'evaluations_summary') and self.evaluations_summary is not None: + if isinstance(self.evaluations_summary, dict): + _dict['evaluations_summary'] = self.evaluations_summary + else: + _dict['evaluations_summary'] = self.evaluations_summary.to_dict() + if hasattr(self, 'tags') and self.tags is not None: + if isinstance(self.tags, dict): + _dict['tags'] = self.tags + else: + _dict['tags'] = self.tags.to_dict() + if hasattr(self, 'scopes') and self.scopes is not None: + scopes_list = [] + for v in self.scopes: if isinstance(v, dict): - parameters_list.append(v) + scopes_list.append(v) else: - parameters_list.append(v.to_dict()) - _dict['parameters'] = parameters_list + scopes_list.append(v.to_dict()) + _dict['scopes'] = scopes_list + if hasattr(self, 'additional_details') and self.additional_details is not None: + if isinstance(self.additional_details, dict): + _dict['additional_details'] = self.additional_details + else: + _dict['additional_details'] = self.additional_details.to_dict() return _dict def _to_dict(self): @@ -7143,64 +12501,117 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Implementation object.""" + """Return a `str` version of this Report object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Implementation') -> 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: 'Implementation') -> bool: + def __ne__(self, other: 'Report') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Import: +class ReportCollection: """ - The collection of import parameters. + The page of reports. - :attr List[Parameter] parameters: (optional) The list of import parameters. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param str home_account_id: (optional) The ID of the home account. + :param List[Report] reports: (optional) The list of reports that are on the + page. """ def __init__( self, + limit: int, + total_count: int, *, - parameters: List['Parameter'] = None, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, + home_account_id: Optional[str] = None, + reports: Optional[List['Report']] = None, ) -> None: """ - Initialize a Import object. + Initialize a ReportCollection object. - :param List[Parameter] parameters: (optional) The list of import - parameters. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param str home_account_id: (optional) The ID of the home account. + :param List[Report] reports: (optional) The list of reports that are on the + page. """ - self.parameters = parameters + self.limit = limit + self.total_count = total_count + self.first = first + self.next = next + self.home_account_id = home_account_id + self.reports = reports @classmethod - def from_dict(cls, _dict: Dict) -> 'Import': - """Initialize a Import object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportCollection': + """Initialize a ReportCollection object from a json dictionary.""" args = {} - if 'parameters' in _dict: - args['parameters'] = [Parameter.from_dict(v) for v in _dict.get('parameters')] + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + else: + raise ValueError('Required property \'limit\' not present in ReportCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + else: + raise ValueError('Required property \'total_count\' not present in ReportCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (reports := _dict.get('reports')) is not None: + args['reports'] = [Report.from_dict(v) for v in reports] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Import object from a json dictionary.""" + """Initialize a ReportCollection 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, 'parameters') and self.parameters is not None: - parameters_list = [] - for v in self.parameters: + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'reports') and self.reports is not None: + reports_list = [] + for v in self.reports: if isinstance(v, dict): - parameters_list.append(v) + reports_list.append(v) else: - parameters_list.append(v.to_dict()) - _dict['parameters'] = parameters_list + reports_list.append(v.to_dict()) + _dict['reports'] = reports_list return _dict def _to_dict(self): @@ -7208,66 +12619,81 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Import object.""" + """Return a `str` version of this ReportCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Import') -> bool: + def __eq__(self, other: 'ReportCollection') -> 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: 'Import') -> bool: + def __ne__(self, other: 'ReportCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LabelType: +class ReportControls: """ - The label that is associated with the provider type. + The list of controls. - :attr str text: (optional) The text of the label. - :attr str tip: (optional) The text to be shown when user hover overs the label. + :param str report_id: (optional) The ID of the report. + :param str home_account_id: (optional) The ID of the home account. + :param List[ControlWithStats] controls: (optional) The list of controls that are + in the report. """ def __init__( self, *, - text: str = None, - tip: str = None, + report_id: Optional[str] = None, + home_account_id: Optional[str] = None, + controls: Optional[List['ControlWithStats']] = None, ) -> None: """ - Initialize a LabelType object. + Initialize a ReportControls object. - :param str text: (optional) The text of the label. - :param str tip: (optional) The text to be shown when user hover overs the - label. + :param str report_id: (optional) The ID of the report. + :param str home_account_id: (optional) The ID of the home account. + :param List[ControlWithStats] controls: (optional) The list of controls + that are in the report. """ - self.text = text - self.tip = tip + self.report_id = report_id + self.home_account_id = home_account_id + self.controls = controls @classmethod - def from_dict(cls, _dict: Dict) -> 'LabelType': - """Initialize a LabelType object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportControls': + """Initialize a ReportControls object from a json dictionary.""" args = {} - if 'text' in _dict: - args['text'] = _dict.get('text') - if 'tip' in _dict: - args['tip'] = _dict.get('tip') + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (controls := _dict.get('controls')) is not None: + args['controls'] = [ControlWithStats.from_dict(v) for v in controls] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LabelType object from a json dictionary.""" + """Initialize a ReportControls 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, 'text') and self.text is not None: - _dict['text'] = self.text - if hasattr(self, 'tip') and self.tip is not None: - _dict['tip'] = self.tip + if hasattr(self, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'controls') and self.controls is not None: + controls_list = [] + for v in self.controls: + if isinstance(v, dict): + controls_list.append(v) + else: + controls_list.append(v.to_dict()) + _dict['controls'] = controls_list return _dict def _to_dict(self): @@ -7275,73 +12701,104 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LabelType object.""" + """Return a `str` version of this ReportControls object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LabelType') -> bool: + def __eq__(self, other: 'ReportControls') -> 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: 'LabelType') -> bool: + def __ne__(self, other: 'ReportControls') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class LastScan: +class ReportLatest: """ - The details of the last scan of an attachment. + The response body of the `get_latest_reports` operation. - :attr str id: (optional) The ID of the last scan of an attachment. - :attr str status: (optional) The status of the last scan of an attachment. - :attr datetime time: (optional) The time when the last scan started. + :param str home_account_id: (optional) The ID of the home account. + :param ComplianceStats controls_summary: (optional) The compliance stats. + :param EvalStats evaluations_summary: (optional) The evaluation stats. + :param ComplianceScore score: (optional) The compliance score. + :param List[Report] reports: (optional) The list of reports. """ def __init__( self, *, - id: str = None, - status: str = None, - time: datetime = None, + home_account_id: Optional[str] = None, + controls_summary: Optional['ComplianceStats'] = None, + evaluations_summary: Optional['EvalStats'] = None, + score: Optional['ComplianceScore'] = None, + reports: Optional[List['Report']] = None, ) -> None: """ - Initialize a LastScan object. + Initialize a ReportLatest object. - :param str id: (optional) The ID of the last scan of an attachment. - :param str status: (optional) The status of the last scan of an attachment. - :param datetime time: (optional) The time when the last scan started. + :param str home_account_id: (optional) The ID of the home account. + :param ComplianceStats controls_summary: (optional) The compliance stats. + :param EvalStats evaluations_summary: (optional) The evaluation stats. + :param ComplianceScore score: (optional) The compliance score. + :param List[Report] reports: (optional) The list of reports. """ - self.id = id - self.status = status - self.time = time + self.home_account_id = home_account_id + self.controls_summary = controls_summary + self.evaluations_summary = evaluations_summary + self.score = score + self.reports = reports @classmethod - def from_dict(cls, _dict: Dict) -> 'LastScan': - """Initialize a LastScan object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportLatest': + """Initialize a ReportLatest object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'time' in _dict: - args['time'] = string_to_datetime(_dict.get('time')) + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (controls_summary := _dict.get('controls_summary')) is not None: + args['controls_summary'] = ComplianceStats.from_dict(controls_summary) + if (evaluations_summary := _dict.get('evaluations_summary')) is not None: + args['evaluations_summary'] = EvalStats.from_dict(evaluations_summary) + if (score := _dict.get('score')) is not None: + args['score'] = ComplianceScore.from_dict(score) + if (reports := _dict.get('reports')) is not None: + args['reports'] = [Report.from_dict(v) for v in reports] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a LastScan object from a json dictionary.""" + """Initialize a ReportLatest 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, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'time') and self.time is not None: - _dict['time'] = datetime_to_string(self.time) + def to_dict(self) -> Dict: + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'controls_summary') and self.controls_summary is not None: + if isinstance(self.controls_summary, dict): + _dict['controls_summary'] = self.controls_summary + else: + _dict['controls_summary'] = self.controls_summary.to_dict() + if hasattr(self, 'evaluations_summary') and self.evaluations_summary is not None: + if isinstance(self.evaluations_summary, dict): + _dict['evaluations_summary'] = self.evaluations_summary + else: + _dict['evaluations_summary'] = self.evaluations_summary.to_dict() + if hasattr(self, 'score') and self.score is not None: + if isinstance(self.score, dict): + _dict['score'] = self.score + else: + _dict['score'] = self.score.to_dict() + if hasattr(self, 'reports') and self.reports is not None: + reports_list = [] + for v in self.reports: + if isinstance(v, dict): + reports_list.append(v) + else: + reports_list.append(v.to_dict()) + _dict['reports'] = reports_list return _dict def _to_dict(self): @@ -7349,85 +12806,78 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this LastScan object.""" + """Return a `str` version of this ReportLatest object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'LastScan') -> bool: + def __eq__(self, other: 'ReportLatest') -> 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: 'LastScan') -> bool: + def __ne__(self, other: 'ReportLatest') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The status of the last scan of an attachment. - """ - - IN_PROGRESS = 'in_progress' - COMPLETED = 'completed' - - -class MultiCloudScope: +class ReportScope: """ - The scope payload for the multi cloud feature. + The scopes used in the report. - :attr str environment: The environment that relates to this scope. - :attr List[PropertyItem] properties: The properties supported for scoping by - this environment. + :param str id: The ID of the scope used. + :param str name: The name of the scope used. + :param str href: The url to a report concerning the specified scope. """ def __init__( self, - environment: str, - properties: List['PropertyItem'], + id: str, + name: str, + href: str, ) -> None: """ - Initialize a MultiCloudScope object. + Initialize a ReportScope object. - :param str environment: The environment that relates to this scope. - :param List[PropertyItem] properties: The properties supported for scoping - by this environment. + :param str id: The ID of the scope used. + :param str name: The name of the scope used. + :param str href: The url to a report concerning the specified scope. """ - self.environment = environment - self.properties = properties + self.id = id + self.name = name + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'MultiCloudScope': - """Initialize a MultiCloudScope object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportScope': + """Initialize a ReportScope object from a json dictionary.""" args = {} - if 'environment' in _dict: - args['environment'] = _dict.get('environment') + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in ReportScope JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name else: - raise ValueError('Required property \'environment\' not present in MultiCloudScope JSON') - if 'properties' in _dict: - args['properties'] = [PropertyItem.from_dict(v) for v in _dict.get('properties')] + raise ValueError('Required property \'name\' not present in ReportScope JSON') + if (href := _dict.get('href')) is not None: + args['href'] = href else: - raise ValueError('Required property \'properties\' not present in MultiCloudScope JSON') + raise ValueError('Required property \'href\' not present in ReportScope JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a MultiCloudScope object from a json dictionary.""" + """Initialize a ReportScope 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, 'environment') and self.environment is not None: - _dict['environment'] = self.environment - if hasattr(self, 'properties') and self.properties is not None: - properties_list = [] - for v in self.properties: - if isinstance(v, dict): - properties_list.append(v) - else: - properties_list.append(v.to_dict()) - _dict['properties'] = properties_list + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -7435,98 +12885,121 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this MultiCloudScope object.""" + """Return a `str` version of this ReportScope object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'MultiCloudScope') -> bool: + def __eq__(self, other: 'ReportScope') -> 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: 'MultiCloudScope') -> bool: + def __ne__(self, other: 'ReportScope') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ObjectStorage: +class ReportSummary: """ - The Cloud Object Storage settings. + The report summary. - :attr str instance_crn: (optional) The connected Cloud Object Storage instance - CRN. - :attr str bucket: (optional) The connected Cloud Object Storage bucket name. - :attr str bucket_location: (optional) The connected Cloud Object Storage bucket - location. - :attr str bucket_endpoint: (optional) The connected Cloud Object Storage bucket - endpoint. - :attr datetime updated_on: (optional) The date when the bucket connection was - updated. + :param str report_id: (optional) The ID of the report. + :param str isntance_id: (optional) Instance ID. + :param Account account: (optional) The account that is associated with a report. + :param ComplianceScore score: (optional) The compliance score. + :param EvalStats evaluations: (optional) The evaluation stats. + :param ComplianceStats controls: (optional) The compliance stats. + :param ResourceSummary resources: (optional) The resource summary. """ def __init__( self, *, - instance_crn: str = None, - bucket: str = None, - bucket_location: str = None, - bucket_endpoint: str = None, - updated_on: datetime = None, + report_id: Optional[str] = None, + isntance_id: Optional[str] = None, + account: Optional['Account'] = None, + score: Optional['ComplianceScore'] = None, + evaluations: Optional['EvalStats'] = None, + controls: Optional['ComplianceStats'] = None, + resources: Optional['ResourceSummary'] = None, ) -> None: """ - Initialize a ObjectStorage object. + Initialize a ReportSummary object. - :param str instance_crn: (optional) The connected Cloud Object Storage - instance CRN. - :param str bucket: (optional) The connected Cloud Object Storage bucket - name. - :param str bucket_location: (optional) The connected Cloud Object Storage - bucket location. - :param str bucket_endpoint: (optional) The connected Cloud Object Storage - bucket endpoint. - :param datetime updated_on: (optional) The date when the bucket connection - was updated. + :param str report_id: (optional) The ID of the report. + :param str isntance_id: (optional) Instance ID. + :param Account account: (optional) The account that is associated with a + report. + :param ComplianceScore score: (optional) The compliance score. + :param EvalStats evaluations: (optional) The evaluation stats. + :param ComplianceStats controls: (optional) The compliance stats. + :param ResourceSummary resources: (optional) The resource summary. """ - self.instance_crn = instance_crn - self.bucket = bucket - self.bucket_location = bucket_location - self.bucket_endpoint = bucket_endpoint - self.updated_on = updated_on + self.report_id = report_id + self.isntance_id = isntance_id + self.account = account + self.score = score + self.evaluations = evaluations + self.controls = controls + self.resources = resources @classmethod - def from_dict(cls, _dict: Dict) -> 'ObjectStorage': - """Initialize a ObjectStorage object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportSummary': + """Initialize a ReportSummary object from a json dictionary.""" args = {} - if 'instance_crn' in _dict: - args['instance_crn'] = _dict.get('instance_crn') - if 'bucket' in _dict: - args['bucket'] = _dict.get('bucket') - if 'bucket_location' in _dict: - args['bucket_location'] = _dict.get('bucket_location') - if 'bucket_endpoint' in _dict: - args['bucket_endpoint'] = _dict.get('bucket_endpoint') - if 'updated_on' in _dict: - args['updated_on'] = string_to_datetime(_dict.get('updated_on')) + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (isntance_id := _dict.get('isntance_id')) is not None: + args['isntance_id'] = isntance_id + if (account := _dict.get('account')) is not None: + args['account'] = Account.from_dict(account) + if (score := _dict.get('score')) is not None: + args['score'] = ComplianceScore.from_dict(score) + if (evaluations := _dict.get('evaluations')) is not None: + args['evaluations'] = EvalStats.from_dict(evaluations) + if (controls := _dict.get('controls')) is not None: + args['controls'] = ComplianceStats.from_dict(controls) + if (resources := _dict.get('resources')) is not None: + args['resources'] = ResourceSummary.from_dict(resources) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ObjectStorage object from a json dictionary.""" + """Initialize a ReportSummary 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, 'instance_crn') and self.instance_crn is not None: - _dict['instance_crn'] = self.instance_crn - if hasattr(self, 'bucket') and self.bucket is not None: - _dict['bucket'] = self.bucket - if hasattr(self, 'bucket_location') and self.bucket_location is not None: - _dict['bucket_location'] = self.bucket_location - if hasattr(self, 'bucket_endpoint') and self.bucket_endpoint is not None: - _dict['bucket_endpoint'] = self.bucket_endpoint - if hasattr(self, 'updated_on') and self.updated_on is not None: - _dict['updated_on'] = datetime_to_string(self.updated_on) + if hasattr(self, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'isntance_id') and self.isntance_id is not None: + _dict['isntance_id'] = self.isntance_id + if hasattr(self, 'account') and self.account is not None: + if isinstance(self.account, dict): + _dict['account'] = self.account + else: + _dict['account'] = self.account.to_dict() + if hasattr(self, 'score') and self.score is not None: + if isinstance(self.score, dict): + _dict['score'] = self.score + else: + _dict['score'] = self.score.to_dict() + if hasattr(self, 'evaluations') and self.evaluations is not None: + if isinstance(self.evaluations, dict): + _dict['evaluations'] = self.evaluations + else: + _dict['evaluations'] = self.evaluations.to_dict() + if hasattr(self, 'controls') and self.controls is not None: + if isinstance(self.controls, dict): + _dict['controls'] = self.controls + else: + _dict['controls'] = self.controls.to_dict() + if hasattr(self, 'resources') and self.resources is not None: + if isinstance(self.resources, dict): + _dict['resources'] = self.resources + else: + _dict['resources'] = self.resources.to_dict() return _dict def _to_dict(self): @@ -7534,58 +13007,68 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ObjectStorage object.""" + """Return a `str` version of this ReportSummary object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ObjectStorage') -> bool: + def __eq__(self, other: 'ReportSummary') -> 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: 'ObjectStorage') -> bool: + def __ne__(self, other: 'ReportSummary') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PageHRef: +class ReportTags: """ - The page reference. + The response body of the `get_tags` operation. - :attr str href: The URL for the first and next page. + :param str report_id: (optional) The ID of the report. + :param Tags tags: (optional) The collection of different types of tags. """ def __init__( self, - href: str, + *, + report_id: Optional[str] = None, + tags: Optional['Tags'] = None, ) -> None: """ - Initialize a PageHRef object. + Initialize a ReportTags object. - :param str href: The URL for the first and next page. + :param str report_id: (optional) The ID of the report. + :param Tags tags: (optional) The collection of different types of tags. """ - self.href = href + self.report_id = report_id + self.tags = tags @classmethod - def from_dict(cls, _dict: Dict) -> 'PageHRef': - """Initialize a PageHRef object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportTags': + """Initialize a ReportTags object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in PageHRef JSON') + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (tags := _dict.get('tags')) is not None: + args['tags'] = Tags.from_dict(tags) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PageHRef object from a json dictionary.""" + """Initialize a ReportTags object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'tags') and self.tags is not None: + if isinstance(self.tags, dict): + _dict['tags'] = self.tags + else: + _dict['tags'] = self.tags.to_dict() return _dict def _to_dict(self): @@ -7593,58 +13076,86 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PageHRef object.""" + """Return a `str` version of this ReportTags object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PageHRef') -> bool: + def __eq__(self, other: 'ReportTags') -> 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: 'PageHRef') -> bool: + def __ne__(self, other: 'ReportTags') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PageHRefFirst: +class ReportViolationDataPoint: """ - A page reference. + The report violation data point. - :attr str href: A URL for the first and next page. + :param str report_id: (optional) The ID of the report. + :param str report_group_id: (optional) The group ID that is associated with the + report. The group ID combines profile, scope, and attachment IDs. + :param str scan_time: (optional) The date when the scan was run. + :param ComplianceStats controls_summary: (optional) The compliance stats. """ def __init__( self, - href: str, + *, + report_id: Optional[str] = None, + report_group_id: Optional[str] = None, + scan_time: Optional[str] = None, + controls_summary: Optional['ComplianceStats'] = None, ) -> None: """ - Initialize a PageHRefFirst object. + Initialize a ReportViolationDataPoint object. - :param str href: A URL for the first and next page. + :param str report_id: (optional) The ID of the report. + :param str report_group_id: (optional) The group ID that is associated with + the report. The group ID combines profile, scope, and attachment IDs. + :param str scan_time: (optional) The date when the scan was run. + :param ComplianceStats controls_summary: (optional) The compliance stats. """ - self.href = href + self.report_id = report_id + self.report_group_id = report_group_id + self.scan_time = scan_time + self.controls_summary = controls_summary @classmethod - def from_dict(cls, _dict: Dict) -> 'PageHRefFirst': - """Initialize a PageHRefFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportViolationDataPoint': + """Initialize a ReportViolationDataPoint object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in PageHRefFirst JSON') + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (report_group_id := _dict.get('report_group_id')) is not None: + args['report_group_id'] = report_group_id + if (scan_time := _dict.get('scan_time')) is not None: + args['scan_time'] = scan_time + if (controls_summary := _dict.get('controls_summary')) is not None: + args['controls_summary'] = ComplianceStats.from_dict(controls_summary) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PageHRefFirst object from a json dictionary.""" + """Initialize a ReportViolationDataPoint object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'report_group_id') and self.report_group_id is not None: + _dict['report_group_id'] = self.report_group_id + if hasattr(self, 'scan_time') and self.scan_time is not None: + _dict['scan_time'] = self.scan_time + if hasattr(self, 'controls_summary') and self.controls_summary is not None: + if isinstance(self.controls_summary, dict): + _dict['controls_summary'] = self.controls_summary + else: + _dict['controls_summary'] = self.controls_summary.to_dict() return _dict def _to_dict(self): @@ -7652,67 +13163,81 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PageHRefFirst object.""" + """Return a `str` version of this ReportViolationDataPoint object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PageHRefFirst') -> bool: + def __eq__(self, other: 'ReportViolationDataPoint') -> 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: 'PageHRefFirst') -> bool: + def __ne__(self, other: 'ReportViolationDataPoint') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PageHRefNext: +class ReportViolationsDrift: """ - A page reference. + The response body of the `get_report_violations_drift` operation. - :attr str href: A URL for the first and next page. - :attr str start: (optional) The token of the next page when present. + :param str home_account_id: (optional) The ID of the home account. + :param str report_group_id: (optional) The ID of the report group. + :param List[ReportViolationDataPoint] data_points: (optional) The list of report + violations data points. """ def __init__( self, - href: str, *, - start: str = None, + home_account_id: Optional[str] = None, + report_group_id: Optional[str] = None, + data_points: Optional[List['ReportViolationDataPoint']] = None, ) -> None: """ - Initialize a PageHRefNext object. + Initialize a ReportViolationsDrift object. - :param str href: A URL for the first and next page. - :param str start: (optional) The token of the next page when present. + :param str home_account_id: (optional) The ID of the home account. + :param str report_group_id: (optional) The ID of the report group. + :param List[ReportViolationDataPoint] data_points: (optional) The list of + report violations data points. """ - self.href = href - self.start = start + self.home_account_id = home_account_id + self.report_group_id = report_group_id + self.data_points = data_points @classmethod - def from_dict(cls, _dict: Dict) -> 'PageHRefNext': - """Initialize a PageHRefNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ReportViolationsDrift': + """Initialize a ReportViolationsDrift object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - else: - raise ValueError('Required property \'href\' not present in PageHRefNext JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (report_group_id := _dict.get('report_group_id')) is not None: + args['report_group_id'] = report_group_id + if (data_points := _dict.get('data_points')) is not None: + args['data_points'] = [ReportViolationDataPoint.from_dict(v) for v in data_points] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PageHRefNext object from a json dictionary.""" + """Initialize a ReportViolationsDrift object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'start') and self.start is not None: - _dict['start'] = self.start + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'report_group_id') and self.report_group_id is not None: + _dict['report_group_id'] = self.report_group_id + if hasattr(self, 'data_points') and self.data_points is not None: + data_points_list = [] + for v in self.data_points: + if isinstance(v, dict): + data_points_list.append(v) + else: + data_points_list.append(v.to_dict()) + _dict['data_points'] = data_points_list return _dict def _to_dict(self): @@ -7720,57 +13245,229 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PageHRefNext object.""" + """Return a `str` version of this ReportViolationsDrift object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PageHRefNext') -> bool: + def __eq__(self, other: 'ReportViolationsDrift') -> 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: 'PageHRefNext') -> bool: + def __ne__(self, other: 'ReportViolationsDrift') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class PaginatedCollectionFirst: +class RequiredConfig: + """ + The required configurations for a Rule. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a RequiredConfig object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['RequiredConfigConditionBase', 'RequiredConfigConditionList', 'RequiredConfigConditionSubRule']) + ) + raise Exception(msg) + + +class Resource: """ - The reference to the first page of entries. + The resource. - :attr str href: (optional) The reference URL for the first few entries. + :param str report_id: (optional) The ID of the report. + :param str home_account_id: (optional) The ID of the home account. + :param str id: (optional) The resource CRN. + :param str resource_name: (optional) The resource name. + :param Account account: (optional) The account that is associated with a report. + :param str component_id: (optional) The ID of the component. + :param str component_name: (optional) The name of the component. + :param str environment: (optional) The environment. + :param Tags tags: (optional) The collection of different types of tags. + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of evaluations. + :param int pass_count: (optional) The number of passed evaluations. + :param int failure_count: (optional) The number of failed evaluations. + :param int error_count: (optional) The number of evaluations that started, but + did not finish, and ended with errors. + :param int skipped_count: (optional) The number of assessments with no + corresponding evaluations. + :param int completed_count: (optional) The total number of completed + evaluations. + :param str service_name: (optional) The name of the service. + :param str instance_crn: (optional) The instance CRN. """ def __init__( self, + status: str, *, - href: str = None, + report_id: Optional[str] = None, + home_account_id: Optional[str] = None, + id: Optional[str] = None, + resource_name: Optional[str] = None, + account: Optional['Account'] = None, + component_id: Optional[str] = None, + component_name: Optional[str] = None, + environment: Optional[str] = None, + tags: Optional['Tags'] = None, + total_count: Optional[int] = None, + pass_count: Optional[int] = None, + failure_count: Optional[int] = None, + error_count: Optional[int] = None, + skipped_count: Optional[int] = None, + completed_count: Optional[int] = None, + service_name: Optional[str] = None, + instance_crn: Optional[str] = None, ) -> None: """ - Initialize a PaginatedCollectionFirst object. + Initialize a Resource object. - :param str href: (optional) The reference URL for the first few entries. + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param str report_id: (optional) The ID of the report. + :param str home_account_id: (optional) The ID of the home account. + :param str id: (optional) The resource CRN. + :param str resource_name: (optional) The resource name. + :param Account account: (optional) The account that is associated with a + report. + :param str component_id: (optional) The ID of the component. + :param str component_name: (optional) The name of the component. + :param str environment: (optional) The environment. + :param Tags tags: (optional) The collection of different types of tags. + :param int total_count: (optional) The total number of evaluations. + :param int pass_count: (optional) The number of passed evaluations. + :param int failure_count: (optional) The number of failed evaluations. + :param int error_count: (optional) The number of evaluations that started, + but did not finish, and ended with errors. + :param int skipped_count: (optional) The number of assessments with no + corresponding evaluations. + :param int completed_count: (optional) The total number of completed + evaluations. + :param str service_name: (optional) The name of the service. + :param str instance_crn: (optional) The instance CRN. """ - self.href = href + self.report_id = report_id + self.home_account_id = home_account_id + self.id = id + self.resource_name = resource_name + self.account = account + self.component_id = component_id + self.component_name = component_name + self.environment = environment + self.tags = tags + self.status = status + self.total_count = total_count + self.pass_count = pass_count + self.failure_count = failure_count + self.error_count = error_count + self.skipped_count = skipped_count + self.completed_count = completed_count + self.service_name = service_name + self.instance_crn = instance_crn @classmethod - def from_dict(cls, _dict: Dict) -> 'PaginatedCollectionFirst': - """Initialize a PaginatedCollectionFirst object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Resource': + """Initialize a Resource object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (id := _dict.get('id')) is not None: + args['id'] = id + if (resource_name := _dict.get('resource_name')) is not None: + args['resource_name'] = resource_name + if (account := _dict.get('account')) is not None: + args['account'] = Account.from_dict(account) + if (component_id := _dict.get('component_id')) is not None: + args['component_id'] = component_id + if (component_name := _dict.get('component_name')) is not None: + args['component_name'] = component_name + if (environment := _dict.get('environment')) is not None: + args['environment'] = environment + if (tags := _dict.get('tags')) is not None: + args['tags'] = Tags.from_dict(tags) + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in Resource JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (pass_count := _dict.get('pass_count')) is not None: + args['pass_count'] = pass_count + if (failure_count := _dict.get('failure_count')) is not None: + args['failure_count'] = failure_count + if (error_count := _dict.get('error_count')) is not None: + args['error_count'] = error_count + if (skipped_count := _dict.get('skipped_count')) is not None: + args['skipped_count'] = skipped_count + if (completed_count := _dict.get('completed_count')) is not None: + args['completed_count'] = completed_count + if (service_name := _dict.get('service_name')) is not None: + args['service_name'] = service_name + if (instance_crn := _dict.get('instance_crn')) is not None: + args['instance_crn'] = instance_crn return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PaginatedCollectionFirst object from a json dictionary.""" + """Initialize a Resource object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href + if hasattr(self, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'resource_name') and self.resource_name is not None: + _dict['resource_name'] = self.resource_name + if hasattr(self, 'account') and self.account is not None: + if isinstance(self.account, dict): + _dict['account'] = self.account + else: + _dict['account'] = self.account.to_dict() + if hasattr(self, 'component_id') and self.component_id is not None: + _dict['component_id'] = self.component_id + if hasattr(self, 'component_name') and self.component_name is not None: + _dict['component_name'] = self.component_name + if hasattr(self, 'environment') and self.environment is not None: + _dict['environment'] = self.environment + if hasattr(self, 'tags') and self.tags is not None: + if isinstance(self.tags, dict): + _dict['tags'] = self.tags + else: + _dict['tags'] = self.tags.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'pass_count') and self.pass_count is not None: + _dict['pass_count'] = self.pass_count + if hasattr(self, 'failure_count') and self.failure_count is not None: + _dict['failure_count'] = self.failure_count + if hasattr(self, 'error_count') and self.error_count is not None: + _dict['error_count'] = self.error_count + if hasattr(self, 'skipped_count') and self.skipped_count is not None: + _dict['skipped_count'] = self.skipped_count + if hasattr(self, 'completed_count') and self.completed_count is not None: + _dict['completed_count'] = self.completed_count + if hasattr(self, 'service_name') and self.service_name is not None: + _dict['service_name'] = self.service_name + if hasattr(self, 'instance_crn') and self.instance_crn is not None: + _dict['instance_crn'] = self.instance_crn return _dict def _to_dict(self): @@ -7778,66 +13475,138 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PaginatedCollectionFirst object.""" + """Return a `str` version of this Resource object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PaginatedCollectionFirst') -> bool: + def __eq__(self, other: 'Resource') -> 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: 'PaginatedCollectionFirst') -> bool: + def __ne__(self, other: 'Resource') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class StatusEnum(str, Enum): + """ + The allowed values of an aggregated status for controls, specifications, + assessments, and resources. + """ + + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' + + -class PaginatedCollectionNext: +class ResourcePage: """ - The reference URL for the next few entries. + The page of resource evaluation summaries. - :attr str href: (optional) The reference URL for the entries. - :attr str start: (optional) The reference to the start of the list of entries. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param str report_id: (optional) The ID of the report. + :param str home_account_id: (optional) The ID of the home account. + :param List[Resource] resources: (optional) The list of resource evaluation + summaries that are on the page. """ def __init__( self, + limit: int, + total_count: int, *, - href: str = None, - start: str = None, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, + report_id: Optional[str] = None, + home_account_id: Optional[str] = None, + resources: Optional[List['Resource']] = None, ) -> None: """ - Initialize a PaginatedCollectionNext object. + Initialize a ResourcePage object. - :param str href: (optional) The reference URL for the entries. - :param str start: (optional) The reference to the start of the list of - entries. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param str report_id: (optional) The ID of the report. + :param str home_account_id: (optional) The ID of the home account. + :param List[Resource] resources: (optional) The list of resource evaluation + summaries that are on the page. """ - self.href = href - self.start = start + self.limit = limit + self.total_count = total_count + self.first = first + self.next = next + self.report_id = report_id + self.home_account_id = home_account_id + self.resources = resources @classmethod - def from_dict(cls, _dict: Dict) -> 'PaginatedCollectionNext': - """Initialize a PaginatedCollectionNext object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ResourcePage': + """Initialize a ResourcePage object from a json dictionary.""" args = {} - if 'href' in _dict: - args['href'] = _dict.get('href') - if 'start' in _dict: - args['start'] = _dict.get('start') + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + else: + raise ValueError('Required property \'limit\' not present in ResourcePage JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + else: + raise ValueError('Required property \'total_count\' not present in ResourcePage JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (report_id := _dict.get('report_id')) is not None: + args['report_id'] = report_id + if (home_account_id := _dict.get('home_account_id')) is not None: + args['home_account_id'] = home_account_id + if (resources := _dict.get('resources')) is not None: + args['resources'] = [Resource.from_dict(v) for v in resources] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PaginatedCollectionNext object from a json dictionary.""" + """Initialize a ResourcePage object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: """Return a json dictionary representing this model.""" _dict = {} - if hasattr(self, 'href') and self.href is not None: - _dict['href'] = self.href - if hasattr(self, 'start') and self.start is not None: - _dict['start'] = self.start + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'report_id') and self.report_id is not None: + _dict['report_id'] = self.report_id + if hasattr(self, 'home_account_id') and self.home_account_id is not None: + _dict['home_account_id'] = self.home_account_id + if hasattr(self, 'resources') and self.resources is not None: + resources_list = [] + for v in self.resources: + if isinstance(v, dict): + resources_list.append(v) + else: + resources_list.append(v.to_dict()) + _dict['resources'] = resources_list return _dict def _to_dict(self): @@ -7845,81 +13614,133 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PaginatedCollectionNext object.""" + """Return a `str` version of this ResourcePage object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PaginatedCollectionNext') -> bool: + def __eq__(self, other: 'ResourcePage') -> 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: 'PaginatedCollectionNext') -> bool: + def __ne__(self, other: 'ResourcePage') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Parameter: +class ResourceSummary: """ - The rule import parameter. + The resource summary. - :attr str name: (optional) The import parameter name. - :attr str display_name: (optional) The display name of the property. - :attr str description: (optional) The propery description. - :attr str type: (optional) The property type. + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are not + compliant. + :param int unable_to_perform_count: (optional) The number of checks that are + unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks that + require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable (with + no evaluations) checks. + :param List[ResourceSummaryItem] top_failed: (optional) The top 10 resources + that have the most failures. """ def __init__( self, + status: str, *, - name: str = None, - display_name: str = None, - description: str = None, - type: str = None, + total_count: Optional[int] = None, + compliant_count: Optional[int] = None, + not_compliant_count: Optional[int] = None, + unable_to_perform_count: Optional[int] = None, + user_evaluation_required_count: Optional[int] = None, + not_applicable_count: Optional[int] = None, + top_failed: Optional[List['ResourceSummaryItem']] = None, ) -> None: """ - Initialize a Parameter object. + Initialize a ResourceSummary object. - :param str name: (optional) The import parameter name. - :param str display_name: (optional) The display name of the property. - :param str description: (optional) The propery description. - :param str type: (optional) The property type. + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of checks. + :param int compliant_count: (optional) The number of compliant checks. + :param int not_compliant_count: (optional) The number of checks that are + not compliant. + :param int unable_to_perform_count: (optional) The number of checks that + are unable to perform. + :param int user_evaluation_required_count: (optional) The number of checks + that require a user evaluation. + :param int not_applicable_count: (optional) The number of not applicable + (with no evaluations) checks. + :param List[ResourceSummaryItem] top_failed: (optional) The top 10 + resources that have the most failures. """ - self.name = name - self.display_name = display_name - self.description = description - self.type = type + self.status = status + self.total_count = total_count + self.compliant_count = compliant_count + self.not_compliant_count = not_compliant_count + self.unable_to_perform_count = unable_to_perform_count + self.user_evaluation_required_count = user_evaluation_required_count + self.not_applicable_count = not_applicable_count + self.top_failed = top_failed @classmethod - def from_dict(cls, _dict: Dict) -> 'Parameter': - """Initialize a Parameter object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ResourceSummary': + """Initialize a ResourceSummary object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'display_name' in _dict: - args['display_name'] = _dict.get('display_name') - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'type' in _dict: - args['type'] = _dict.get('type') + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ResourceSummary JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (compliant_count := _dict.get('compliant_count')) is not None: + args['compliant_count'] = compliant_count + if (not_compliant_count := _dict.get('not_compliant_count')) is not None: + args['not_compliant_count'] = not_compliant_count + if (unable_to_perform_count := _dict.get('unable_to_perform_count')) is not None: + args['unable_to_perform_count'] = unable_to_perform_count + if (user_evaluation_required_count := _dict.get('user_evaluation_required_count')) is not None: + args['user_evaluation_required_count'] = user_evaluation_required_count + if (not_applicable_count := _dict.get('not_applicable_count')) is not None: + args['not_applicable_count'] = not_applicable_count + if (top_failed := _dict.get('top_failed')) is not None: + args['top_failed'] = [ResourceSummaryItem.from_dict(v) for v in top_failed] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Parameter object from a json dictionary.""" + """Initialize a ResourceSummary 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, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'display_name') and self.display_name is not None: - _dict['display_name'] = self.display_name - if hasattr(self, 'description') and self.description is not None: - _dict['description'] = self.description - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type + _dict = {} + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'compliant_count') and self.compliant_count is not None: + _dict['compliant_count'] = self.compliant_count + if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: + _dict['not_compliant_count'] = self.not_compliant_count + if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: + _dict['unable_to_perform_count'] = self.unable_to_perform_count + if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: + _dict['user_evaluation_required_count'] = self.user_evaluation_required_count + if hasattr(self, 'not_applicable_count') and self.not_applicable_count is not None: + _dict['not_applicable_count'] = self.not_applicable_count + if hasattr(self, 'top_failed') and self.top_failed is not None: + top_failed_list = [] + for v in self.top_failed: + if isinstance(v, dict): + top_failed_list.append(v) + else: + top_failed_list.append(v.to_dict()) + _dict['top_failed'] = top_failed_list return _dict def _to_dict(self): @@ -7927,95 +13748,181 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Parameter object.""" + """Return a `str` version of this ResourceSummary object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Parameter') -> bool: + def __eq__(self, other: 'ResourceSummary') -> 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: 'Parameter') -> bool: + def __ne__(self, other: 'ResourceSummary') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): + class StatusEnum(str, Enum): """ - The property type. + The allowed values of an aggregated status for controls, specifications, + assessments, and resources. """ - STRING = 'string' - NUMERIC = 'numeric' - GENERAL = 'general' - BOOLEAN = 'boolean' - STRING_LIST = 'string_list' - IP_LIST = 'ip_list' - TIMESTAMP = 'timestamp' + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' -class ParameterInfo: +class ResourceSummaryItem: """ - The parameter details. + The resource summary item. - :attr str parameter_name: (optional) The parameter name. - :attr str parameter_display_name: (optional) The parameter display name. - :attr str parameter_type: (optional) The parameter type. - :attr object parameter_value: (optional) The property value. + :param str id: (optional) The resource ID. + :param str name: (optional) The resource name. + :param str account: (optional) The account that owns the resource. + :param str service: (optional) The service that is managing the resource. + :param str service_display_name: (optional) The services display name that is + managing the resource. + :param Tags tags: (optional) The collection of different types of tags. + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param int total_count: (optional) The total number of evaluations. + :param int pass_count: (optional) The number of passed evaluations. + :param int failure_count: (optional) The number of failed evaluations. + :param int error_count: (optional) The number of evaluations that started, but + did not finish, and ended with errors. + :param int skipped_count: (optional) The number of assessments with no + corresponding evaluations. + :param int completed_count: (optional) The total number of completed + evaluations. """ def __init__( self, + status: str, *, - parameter_name: str = None, - parameter_display_name: str = None, - parameter_type: str = None, - parameter_value: object = None, + id: Optional[str] = None, + name: Optional[str] = None, + account: Optional[str] = None, + service: Optional[str] = None, + service_display_name: Optional[str] = None, + tags: Optional['Tags'] = None, + total_count: Optional[int] = None, + pass_count: Optional[int] = None, + failure_count: Optional[int] = None, + error_count: Optional[int] = None, + skipped_count: Optional[int] = None, + completed_count: Optional[int] = None, ) -> None: """ - Initialize a ParameterInfo object. + Initialize a ResourceSummaryItem object. - :param str parameter_name: (optional) The parameter name. - :param str parameter_display_name: (optional) The parameter display name. - :param str parameter_type: (optional) The parameter type. - :param object parameter_value: (optional) The property value. + :param str status: The allowed values of an aggregated status for controls, + specifications, assessments, and resources. + :param str id: (optional) The resource ID. + :param str name: (optional) The resource name. + :param str account: (optional) The account that owns the resource. + :param str service: (optional) The service that is managing the resource. + :param str service_display_name: (optional) The services display name that + is managing the resource. + :param Tags tags: (optional) The collection of different types of tags. + :param int total_count: (optional) The total number of evaluations. + :param int pass_count: (optional) The number of passed evaluations. + :param int failure_count: (optional) The number of failed evaluations. + :param int error_count: (optional) The number of evaluations that started, + but did not finish, and ended with errors. + :param int skipped_count: (optional) The number of assessments with no + corresponding evaluations. + :param int completed_count: (optional) The total number of completed + evaluations. """ - self.parameter_name = parameter_name - self.parameter_display_name = parameter_display_name - self.parameter_type = parameter_type - self.parameter_value = parameter_value + self.id = id + self.name = name + self.account = account + self.service = service + self.service_display_name = service_display_name + self.tags = tags + self.status = status + self.total_count = total_count + self.pass_count = pass_count + self.failure_count = failure_count + self.error_count = error_count + self.skipped_count = skipped_count + self.completed_count = completed_count @classmethod - def from_dict(cls, _dict: Dict) -> 'ParameterInfo': - """Initialize a ParameterInfo object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ResourceSummaryItem': + """Initialize a ResourceSummaryItem object from a json dictionary.""" args = {} - if 'parameter_name' in _dict: - args['parameter_name'] = _dict.get('parameter_name') - if 'parameter_display_name' in _dict: - args['parameter_display_name'] = _dict.get('parameter_display_name') - if 'parameter_type' in _dict: - args['parameter_type'] = _dict.get('parameter_type') - if 'parameter_value' in _dict: - args['parameter_value'] = _dict.get('parameter_value') + if (id := _dict.get('id')) is not None: + args['id'] = id + if (name := _dict.get('name')) is not None: + args['name'] = name + if (account := _dict.get('account')) is not None: + args['account'] = account + if (service := _dict.get('service')) is not None: + args['service'] = service + if (service_display_name := _dict.get('service_display_name')) is not None: + args['service_display_name'] = service_display_name + if (tags := _dict.get('tags')) is not None: + args['tags'] = Tags.from_dict(tags) + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ResourceSummaryItem JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + if (pass_count := _dict.get('pass_count')) is not None: + args['pass_count'] = pass_count + if (failure_count := _dict.get('failure_count')) is not None: + args['failure_count'] = failure_count + if (error_count := _dict.get('error_count')) is not None: + args['error_count'] = error_count + if (skipped_count := _dict.get('skipped_count')) is not None: + args['skipped_count'] = skipped_count + if (completed_count := _dict.get('completed_count')) is not None: + args['completed_count'] = completed_count return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ParameterInfo object from a json dictionary.""" + """Initialize a ResourceSummaryItem 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, 'parameter_name') and self.parameter_name is not None: - _dict['parameter_name'] = self.parameter_name - if hasattr(self, 'parameter_display_name') and self.parameter_display_name is not None: - _dict['parameter_display_name'] = self.parameter_display_name - if hasattr(self, 'parameter_type') and self.parameter_type is not None: - _dict['parameter_type'] = self.parameter_type - if hasattr(self, 'parameter_value') and self.parameter_value is not None: - _dict['parameter_value'] = self.parameter_value + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'account') and self.account is not None: + _dict['account'] = self.account + if hasattr(self, 'service') and self.service is not None: + _dict['service'] = self.service + if hasattr(self, 'service_display_name') and self.service_display_name is not None: + _dict['service_display_name'] = self.service_display_name + if hasattr(self, 'tags') and self.tags is not None: + if isinstance(self.tags, dict): + _dict['tags'] = self.tags + else: + _dict['tags'] = self.tags.to_dict() + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'pass_count') and self.pass_count is not None: + _dict['pass_count'] = self.pass_count + if hasattr(self, 'failure_count') and self.failure_count is not None: + _dict['failure_count'] = self.failure_count + if hasattr(self, 'error_count') and self.error_count is not None: + _dict['error_count'] = self.error_count + if hasattr(self, 'skipped_count') and self.skipped_count is not None: + _dict['skipped_count'] = self.skipped_count + if hasattr(self, 'completed_count') and self.completed_count is not None: + _dict['completed_count'] = self.completed_count return _dict def _to_dict(self): @@ -8023,236 +13930,202 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ParameterInfo object.""" + """Return a `str` version of this ResourceSummaryItem object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ParameterInfo') -> bool: + def __eq__(self, other: 'ResourceSummaryItem') -> 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: 'ParameterInfo') -> bool: + def __ne__(self, other: 'ResourceSummaryItem') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ParameterTypeEnum(str, Enum): + class StatusEnum(str, Enum): """ - The parameter type. + The allowed values of an aggregated status for controls, specifications, + assessments, and resources. """ - STRING = 'string' - NUMERIC = 'numeric' - GENERAL = 'general' - BOOLEAN = 'boolean' - STRING_LIST = 'string_list' - IP_LIST = 'ip_list' - TIMESTAMP = 'timestamp' + COMPLIANT = 'compliant' + NOT_COMPLIANT = 'not_compliant' + UNABLE_TO_PERFORM = 'unable_to_perform' + USER_EVALUATION_REQUIRED = 'user_evaluation_required' + NOT_APPLICABLE = 'not_applicable' -class Profile: +class Rule: """ - The response body of the profile. + The rule response that corresponds to an account instance. - :attr str id: (optional) The unique ID of the profile. - :attr str profile_name: (optional) The profile name. - :attr str profile_description: (optional) The profile description. - :attr str profile_type: (optional) The profile type, such as custom or - predefined. - :attr str profile_version: (optional) The version status of the profile. - :attr str version_group_label: (optional) The version group label of the - profile. - :attr str instance_id: (optional) The instance ID. - :attr bool latest: (optional) The latest version of the profile. - :attr bool hierarchy_enabled: (optional) The indication of whether hierarchy is - enabled for the profile. - :attr str created_by: (optional) The user who created the profile. - :attr datetime created_on: (optional) The date when the profile was created. - :attr str updated_by: (optional) The user who updated the profile. - :attr datetime updated_on: (optional) The date when the profile was updated. - :attr int controls_count: (optional) The number of controls for the profile. - :attr int control_parents_count: (optional) The number of parent controls for - the profile. - :attr int attachments_count: (optional) The number of attachments related to - this profile. - :attr List[ProfileControls] controls: (optional) The array of controls that are - used to create the profile. - :attr List[DefaultParametersPrototype] default_parameters: (optional) The - default parameters of the profile. + :param datetime created_on: The date when the rule was created. + :param str created_by: The user who created the rule. + :param datetime updated_on: The date when the rule was modified. + :param str updated_by: The user who modified the rule. + :param str id: The rule ID. + :param str account_id: The account ID. + :param str description: The details of a rule's response. + :param str type: The rule type (allowable values are `user_defined` or + `system_defined`). + :param str version: The version number of a rule. + :param Import import_: (optional) The collection of import parameters. + :param RuleTarget target: The rule target. + :param RequiredConfig required_config: The required configurations for a Rule. + :param List[str] labels: The list of labels. """ def __init__( self, + created_on: datetime, + created_by: str, + updated_on: datetime, + updated_by: str, + id: str, + account_id: str, + description: str, + type: str, + version: str, + target: 'RuleTarget', + required_config: 'RequiredConfig', + labels: List[str], *, - id: str = None, - profile_name: str = None, - profile_description: str = None, - profile_type: str = None, - profile_version: str = None, - version_group_label: str = None, - instance_id: str = None, - latest: bool = None, - hierarchy_enabled: bool = None, - created_by: str = None, - created_on: datetime = None, - updated_by: str = None, - updated_on: datetime = None, - controls_count: int = None, - control_parents_count: int = None, - attachments_count: int = None, - controls: List['ProfileControls'] = None, - default_parameters: List['DefaultParametersPrototype'] = None, + import_: Optional['Import'] = None, ) -> None: """ - Initialize a Profile object. + Initialize a Rule object. - :param str id: (optional) The unique ID of the profile. - :param str profile_name: (optional) The profile name. - :param str profile_description: (optional) The profile description. - :param str profile_type: (optional) The profile type, such as custom or - predefined. - :param str profile_version: (optional) The version status of the profile. - :param str version_group_label: (optional) The version group label of the - profile. - :param str instance_id: (optional) The instance ID. - :param bool latest: (optional) The latest version of the profile. - :param bool hierarchy_enabled: (optional) The indication of whether - hierarchy is enabled for the profile. - :param str created_by: (optional) The user who created the profile. - :param datetime created_on: (optional) The date when the profile was - created. - :param str updated_by: (optional) The user who updated the profile. - :param datetime updated_on: (optional) The date when the profile was - updated. - :param int controls_count: (optional) The number of controls for the - profile. - :param int control_parents_count: (optional) The number of parent controls - for the profile. - :param int attachments_count: (optional) The number of attachments related - to this profile. - :param List[ProfileControls] controls: (optional) The array of controls - that are used to create the profile. - :param List[DefaultParametersPrototype] default_parameters: (optional) The - default parameters of the profile. + :param datetime created_on: The date when the rule was created. + :param str created_by: The user who created the rule. + :param datetime updated_on: The date when the rule was modified. + :param str updated_by: The user who modified the rule. + :param str id: The rule ID. + :param str account_id: The account ID. + :param str description: The details of a rule's response. + :param str type: The rule type (allowable values are `user_defined` or + `system_defined`). + :param str version: The version number of a rule. + :param RuleTarget target: The rule target. + :param RequiredConfig required_config: The required configurations for a + Rule. + :param List[str] labels: The list of labels. + :param Import import_: (optional) The collection of import parameters. """ - self.id = id - self.profile_name = profile_name - self.profile_description = profile_description - self.profile_type = profile_type - self.profile_version = profile_version - self.version_group_label = version_group_label - self.instance_id = instance_id - self.latest = latest - self.hierarchy_enabled = hierarchy_enabled - self.created_by = created_by self.created_on = created_on - self.updated_by = updated_by + self.created_by = created_by self.updated_on = updated_on - self.controls_count = controls_count - self.control_parents_count = control_parents_count - self.attachments_count = attachments_count - self.controls = controls - self.default_parameters = default_parameters + self.updated_by = updated_by + self.id = id + self.account_id = account_id + self.description = description + self.type = type + self.version = version + self.import_ = import_ + self.target = target + self.required_config = required_config + self.labels = labels @classmethod - def from_dict(cls, _dict: Dict) -> 'Profile': - """Initialize a Profile object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Rule': + """Initialize a Rule object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'profile_name' in _dict: - args['profile_name'] = _dict.get('profile_name') - if 'profile_description' in _dict: - args['profile_description'] = _dict.get('profile_description') - if 'profile_type' in _dict: - args['profile_type'] = _dict.get('profile_type') - if 'profile_version' in _dict: - args['profile_version'] = _dict.get('profile_version') - if 'version_group_label' in _dict: - args['version_group_label'] = _dict.get('version_group_label') - if 'instance_id' in _dict: - args['instance_id'] = _dict.get('instance_id') - if 'latest' in _dict: - args['latest'] = _dict.get('latest') - if 'hierarchy_enabled' in _dict: - args['hierarchy_enabled'] = _dict.get('hierarchy_enabled') - if 'created_by' in _dict: - args['created_by'] = _dict.get('created_by') - if 'created_on' in _dict: - args['created_on'] = string_to_datetime(_dict.get('created_on')) - if 'updated_by' in _dict: - args['updated_by'] = _dict.get('updated_by') - if 'updated_on' in _dict: - args['updated_on'] = string_to_datetime(_dict.get('updated_on')) - if 'controls_count' in _dict: - args['controls_count'] = _dict.get('controls_count') - if 'control_parents_count' in _dict: - args['control_parents_count'] = _dict.get('control_parents_count') - if 'attachments_count' in _dict: - args['attachments_count'] = _dict.get('attachments_count') - if 'controls' in _dict: - args['controls'] = [ProfileControls.from_dict(v) for v in _dict.get('controls')] - if 'default_parameters' in _dict: - args['default_parameters'] = [DefaultParametersPrototype.from_dict(v) for v in _dict.get('default_parameters')] - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a Profile 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, 'profile_name') and self.profile_name is not None: - _dict['profile_name'] = self.profile_name - if hasattr(self, 'profile_description') and self.profile_description is not None: - _dict['profile_description'] = self.profile_description - if hasattr(self, 'profile_type') and self.profile_type is not None: - _dict['profile_type'] = self.profile_type - if hasattr(self, 'profile_version') and self.profile_version is not None: - _dict['profile_version'] = self.profile_version - if hasattr(self, 'version_group_label') and self.version_group_label is not None: - _dict['version_group_label'] = self.version_group_label - if hasattr(self, 'instance_id') and self.instance_id is not None: - _dict['instance_id'] = self.instance_id - if hasattr(self, 'latest') and self.latest is not None: - _dict['latest'] = self.latest - if hasattr(self, 'hierarchy_enabled') and self.hierarchy_enabled is not None: - _dict['hierarchy_enabled'] = self.hierarchy_enabled - if hasattr(self, 'created_by') and self.created_by is not None: - _dict['created_by'] = self.created_by + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + else: + raise ValueError('Required property \'created_on\' not present in Rule JSON') + 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 Rule JSON') + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) + else: + raise ValueError('Required property \'updated_on\' not present in Rule JSON') + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + else: + raise ValueError('Required property \'updated_by\' not present in Rule JSON') + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in Rule 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 Rule JSON') + if (description := _dict.get('description')) is not None: + args['description'] = description + else: + raise ValueError('Required property \'description\' not present in Rule JSON') + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in Rule JSON') + if (version := _dict.get('version')) is not None: + args['version'] = version + else: + raise ValueError('Required property \'version\' not present in Rule JSON') + if (import_ := _dict.get('import')) is not None: + args['import_'] = Import.from_dict(import_) + if (target := _dict.get('target')) is not None: + args['target'] = RuleTarget.from_dict(target) + else: + raise ValueError('Required property \'target\' not present in Rule JSON') + if (required_config := _dict.get('required_config')) is not None: + args['required_config'] = required_config + else: + raise ValueError('Required property \'required_config\' not present in Rule JSON') + if (labels := _dict.get('labels')) is not None: + args['labels'] = labels + else: + raise ValueError('Required property \'labels\' not present in Rule JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a Rule 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_on') and self.created_on is not None: _dict['created_on'] = datetime_to_string(self.created_on) - if hasattr(self, 'updated_by') and self.updated_by is not None: - _dict['updated_by'] = self.updated_by + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by if hasattr(self, 'updated_on') and self.updated_on is not None: _dict['updated_on'] = datetime_to_string(self.updated_on) - if hasattr(self, 'controls_count') and self.controls_count is not None: - _dict['controls_count'] = self.controls_count - if hasattr(self, 'control_parents_count') and self.control_parents_count is not None: - _dict['control_parents_count'] = self.control_parents_count - if hasattr(self, 'attachments_count') and self.attachments_count is not None: - _dict['attachments_count'] = self.attachments_count - if hasattr(self, 'controls') and self.controls is not None: - controls_list = [] - for v in self.controls: - if isinstance(v, dict): - controls_list.append(v) - else: - controls_list.append(v.to_dict()) - _dict['controls'] = controls_list - if hasattr(self, 'default_parameters') and self.default_parameters is not None: - default_parameters_list = [] - for v in self.default_parameters: - if isinstance(v, dict): - default_parameters_list.append(v) - else: - default_parameters_list.append(v.to_dict()) - _dict['default_parameters'] = default_parameters_list + if hasattr(self, 'updated_by') and self.updated_by is not None: + _dict['updated_by'] = self.updated_by + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'version') and self.version is not None: + _dict['version'] = self.version + if hasattr(self, 'import_') and self.import_ is not None: + if isinstance(self.import_, dict): + _dict['import'] = self.import_ + else: + _dict['import'] = self.import_.to_dict() + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target + else: + _dict['target'] = self.target.to_dict() + if hasattr(self, 'required_config') and self.required_config is not None: + if isinstance(self.required_config, dict): + _dict['required_config'] = self.required_config + else: + _dict['required_config'] = self.required_config.to_dict() + if hasattr(self, 'labels') and self.labels is not None: + _dict['labels'] = self.labels return _dict def _to_dict(self): @@ -8260,104 +14133,102 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Profile object.""" + """Return a `str` version of this Rule object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Profile') -> bool: + def __eq__(self, other: 'Rule') -> 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: 'Profile') -> bool: + def __ne__(self, other: 'Rule') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class ProfileTypeEnum(str, Enum): + class TypeEnum(str, Enum): """ - The profile type, such as custom or predefined. + The rule type (allowable values are `user_defined` or `system_defined`). """ - PREDEFINED = 'predefined' - CUSTOM = 'custom' + USER_DEFINED = 'user_defined' + SYSTEM_DEFINED = 'system_defined' -class ProfileCollection: +class RuleCollection: """ - The response body to get all profiles that are linked to your account. - - :attr int total_count: The number of profiles. - :attr int limit: The limit of profiles that can be created. - :attr PaginatedCollectionFirst first: The reference to the first page of - entries. - :attr PaginatedCollectionNext next: The reference URL for the next few entries. - :attr List[ProfileItem] profiles: The profiles. + The page of rules. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param List[Rule] rules: (optional) The collection of rules that correspond to + an account instance. Maximum of 100/500 custom rules per stand-alone/enterprise + account. """ def __init__( self, - total_count: int, limit: int, - first: 'PaginatedCollectionFirst', - next: 'PaginatedCollectionNext', - profiles: List['ProfileItem'], + total_count: int, + *, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, + rules: Optional[List['Rule']] = None, ) -> None: """ - Initialize a ProfileCollection object. + Initialize a RuleCollection object. - :param int total_count: The number of profiles. - :param int limit: The limit of profiles that can be created. - :param PaginatedCollectionFirst first: The reference to the first page of - entries. - :param PaginatedCollectionNext next: The reference URL for the next few - entries. - :param List[ProfileItem] profiles: The profiles. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param List[Rule] rules: (optional) The collection of rules that correspond + to an account instance. Maximum of 100/500 custom rules per + stand-alone/enterprise account. """ - self.total_count = total_count self.limit = limit + self.total_count = total_count self.first = first self.next = next - self.profiles = profiles + self.rules = rules @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileCollection': - """Initialize a ProfileCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RuleCollection': + """Initialize a RuleCollection object from a json dictionary.""" args = {} - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in ProfileCollection JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in ProfileCollection JSON') - if 'first' in _dict: - args['first'] = PaginatedCollectionFirst.from_dict(_dict.get('first')) + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit else: - raise ValueError('Required property \'first\' not present in ProfileCollection JSON') - if 'next' in _dict: - args['next'] = PaginatedCollectionNext.from_dict(_dict.get('next')) + raise ValueError('Required property \'limit\' not present in RuleCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count else: - raise ValueError('Required property \'next\' not present in ProfileCollection JSON') - if 'profiles' in _dict: - args['profiles'] = [ProfileItem.from_dict(v) for v in _dict.get('profiles')] - else: - raise ValueError('Required property \'profiles\' not present in ProfileCollection JSON') + raise ValueError('Required property \'total_count\' not present in RuleCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (rules := _dict.get('rules')) is not None: + args['rules'] = [Rule.from_dict(v) for v in rules] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileCollection object from a json dictionary.""" + """Initialize a RuleCollection 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, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count if hasattr(self, 'first') and self.first is not None: if isinstance(self.first, dict): _dict['first'] = self.first @@ -8368,14 +14239,14 @@ def to_dict(self) -> Dict: _dict['next'] = self.next else: _dict['next'] = self.next.to_dict() - if hasattr(self, 'profiles') and self.profiles is not None: - profiles_list = [] - for v in self.profiles: + if hasattr(self, 'rules') and self.rules is not None: + rules_list = [] + for v in self.rules: if isinstance(v, dict): - profiles_list.append(v) + rules_list.append(v) else: - profiles_list.append(v.to_dict()) - _dict['profiles'] = profiles_list + rules_list.append(v.to_dict()) + _dict['rules'] = rules_list return _dict def _to_dict(self): @@ -8383,158 +14254,213 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileCollection object.""" + """Return a `str` version of this RuleCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileCollection') -> bool: + def __eq__(self, other: 'RuleCollection') -> 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: 'ProfileCollection') -> bool: + def __ne__(self, other: 'RuleCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProfileControls: +class RuleInfo: """ - The control details for the profile. + The rule. - :attr str control_library_id: (optional) The ID of the control library that - contains the profile. - :attr str control_id: (optional) The unique ID of the control library that - contains the profile. - :attr str control_library_version: (optional) The most recent version of the - control library. - :attr str control_name: (optional) The control name. - :attr str control_description: (optional) The control description. - :attr str control_category: (optional) The control category. - :attr str control_parent: (optional) The parent control. - :attr bool control_requirement: (optional) Is this a control that can be - automated or manually evaluated. - :attr ControlDocs control_docs: (optional) The control documentation. - :attr int control_specifications_count: (optional) The number of control - specifications. - :attr List[ControlSpecifications] control_specifications: (optional) The control - specifications. + :param str id: (optional) The rule ID. + :param str type: (optional) The rule type. + :param str description: (optional) The rule description. + :param str version: (optional) The rule version. + :param str account_id: (optional) The rule account ID. + :param datetime created_on: (optional) The date when the rule was created. + :param str created_by: (optional) The ID of the user who created the rule. + :param datetime updated_on: (optional) The date when the rule was updated. + :param str updated_by: (optional) The ID of the user who updated the rule. + :param List[str] labels: (optional) The rule labels. """ def __init__( self, *, - control_library_id: str = None, - control_id: str = None, - control_library_version: str = None, - control_name: str = None, - control_description: str = None, - control_category: str = None, - control_parent: str = None, - control_requirement: bool = None, - control_docs: 'ControlDocs' = None, - control_specifications_count: int = None, - control_specifications: List['ControlSpecifications'] = None, + id: Optional[str] = None, + type: Optional[str] = None, + description: Optional[str] = None, + version: Optional[str] = None, + account_id: Optional[str] = None, + created_on: Optional[datetime] = None, + created_by: Optional[str] = None, + updated_on: Optional[datetime] = None, + updated_by: Optional[str] = None, + labels: Optional[List[str]] = None, ) -> None: """ - Initialize a ProfileControls object. + Initialize a RuleInfo object. - :param str control_library_id: (optional) The ID of the control library - that contains the profile. - :param str control_id: (optional) The unique ID of the control library that - contains the profile. - :param str control_library_version: (optional) The most recent version of - the control library. - :param str control_name: (optional) The control name. - :param str control_description: (optional) The control description. - :param str control_category: (optional) The control category. - :param str control_parent: (optional) The parent control. - :param bool control_requirement: (optional) Is this a control that can be - automated or manually evaluated. - :param ControlDocs control_docs: (optional) The control documentation. - :param int control_specifications_count: (optional) The number of control - specifications. - :param List[ControlSpecifications] control_specifications: (optional) The - control specifications. + :param str id: (optional) The rule ID. + :param str type: (optional) The rule type. + :param str description: (optional) The rule description. + :param str version: (optional) The rule version. + :param str account_id: (optional) The rule account ID. + :param datetime created_on: (optional) The date when the rule was created. + :param str created_by: (optional) The ID of the user who created the rule. + :param datetime updated_on: (optional) The date when the rule was updated. + :param str updated_by: (optional) The ID of the user who updated the rule. + :param List[str] labels: (optional) The rule labels. """ - self.control_library_id = control_library_id - self.control_id = control_id - self.control_library_version = control_library_version - self.control_name = control_name - self.control_description = control_description - self.control_category = control_category - self.control_parent = control_parent - self.control_requirement = control_requirement - self.control_docs = control_docs - self.control_specifications_count = control_specifications_count - self.control_specifications = control_specifications + self.id = id + self.type = type + self.description = description + self.version = version + self.account_id = account_id + self.created_on = created_on + self.created_by = created_by + self.updated_on = updated_on + self.updated_by = updated_by + self.labels = labels @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileControls': - """Initialize a ProfileControls object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RuleInfo': + """Initialize a RuleInfo object from a json dictionary.""" args = {} - if 'control_library_id' in _dict: - args['control_library_id'] = _dict.get('control_library_id') - if 'control_id' in _dict: - args['control_id'] = _dict.get('control_id') - if 'control_library_version' in _dict: - args['control_library_version'] = _dict.get('control_library_version') - if 'control_name' in _dict: - args['control_name'] = _dict.get('control_name') - if 'control_description' in _dict: - args['control_description'] = _dict.get('control_description') - if 'control_category' in _dict: - args['control_category'] = _dict.get('control_category') - if 'control_parent' in _dict: - args['control_parent'] = _dict.get('control_parent') - if 'control_requirement' in _dict: - args['control_requirement'] = _dict.get('control_requirement') - if 'control_docs' in _dict: - args['control_docs'] = ControlDocs.from_dict(_dict.get('control_docs')) - if 'control_specifications_count' in _dict: - args['control_specifications_count'] = _dict.get('control_specifications_count') - if 'control_specifications' in _dict: - args['control_specifications'] = [ControlSpecifications.from_dict(v) for v in _dict.get('control_specifications')] + if (id := _dict.get('id')) is not None: + args['id'] = id + if (type := _dict.get('type')) is not None: + args['type'] = type + if (description := _dict.get('description')) is not None: + args['description'] = description + if (version := _dict.get('version')) is not None: + args['version'] = version + if (account_id := _dict.get('account_id')) is not None: + args['account_id'] = account_id + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + if (labels := _dict.get('labels')) is not None: + args['labels'] = labels return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileControls object from a json dictionary.""" + """Initialize a RuleInfo 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, 'control_library_id') and self.control_library_id is not None: - _dict['control_library_id'] = self.control_library_id - if hasattr(self, 'control_id') and self.control_id is not None: - _dict['control_id'] = self.control_id - if hasattr(self, 'control_library_version') and self.control_library_version is not None: - _dict['control_library_version'] = self.control_library_version - if hasattr(self, 'control_name') and self.control_name is not None: - _dict['control_name'] = self.control_name - if hasattr(self, 'control_description') and self.control_description is not None: - _dict['control_description'] = self.control_description - if hasattr(self, 'control_category') and self.control_category is not None: - _dict['control_category'] = self.control_category - if hasattr(self, 'control_parent') and self.control_parent is not None: - _dict['control_parent'] = self.control_parent - if hasattr(self, 'control_requirement') and self.control_requirement is not None: - _dict['control_requirement'] = self.control_requirement - if hasattr(self, 'control_docs') and self.control_docs is not None: - if isinstance(self.control_docs, dict): - _dict['control_docs'] = self.control_docs - else: - _dict['control_docs'] = self.control_docs.to_dict() - if hasattr(self, 'control_specifications_count') and self.control_specifications_count is not None: - _dict['control_specifications_count'] = self.control_specifications_count - if hasattr(self, 'control_specifications') and self.control_specifications is not None: - control_specifications_list = [] - for v in self.control_specifications: - if isinstance(v, dict): - control_specifications_list.append(v) - else: - control_specifications_list.append(v.to_dict()) - _dict['control_specifications'] = control_specifications_list + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'version') and self.version is not None: + _dict['version'] = self.version + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) + if hasattr(self, 'updated_by') and self.updated_by is not None: + _dict['updated_by'] = self.updated_by + if hasattr(self, 'labels') and self.labels is not None: + _dict['labels'] = self.labels + 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 RuleInfo object.""" + return json.dumps(self.to_dict(), indent=2) + + def __eq__(self, other: 'RuleInfo') -> 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: 'RuleInfo') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class RuleParameter: + """ + The rule import parameter. + + :param str name: (optional) The import parameter name. + :param str display_name: (optional) The display name of the property. + :param str description: (optional) The propery description. + :param str type: The property type. + """ + + def __init__( + self, + type: str, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + description: Optional[str] = None, + ) -> None: + """ + Initialize a RuleParameter object. + + :param str type: The property type. + :param str name: (optional) The import parameter name. + :param str display_name: (optional) The display name of the property. + :param str description: (optional) The propery description. + """ + self.name = name + self.display_name = display_name + self.description = description + self.type = type + + @classmethod + def from_dict(cls, _dict: Dict) -> 'RuleParameter': + """Initialize a RuleParameter object from a json dictionary.""" + args = {} + if (name := _dict.get('name')) is not None: + args['name'] = name + if (display_name := _dict.get('display_name')) is not None: + args['display_name'] = display_name + if (description := _dict.get('description')) is not None: + args['description'] = description + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in RuleParameter JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a RuleParameter 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, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'display_name') and self.display_name is not None: + _dict['display_name'] = self.display_name + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'type') and self.type is not None: + _dict['type'] = self.type return _dict def _to_dict(self): @@ -8542,67 +14468,89 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileControls object.""" + """Return a `str` version of this RuleParameter object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileControls') -> bool: + def __eq__(self, other: 'RuleParameter') -> 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: 'ProfileControls') -> bool: + def __ne__(self, other: 'RuleParameter') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class TypeEnum(str, Enum): + """ + The property type. + """ -class ProfileControlsPrototype: + STRING = 'string' + NUMERIC = 'numeric' + GENERAL = 'general' + BOOLEAN = 'boolean' + STRING_LIST = 'string_list' + IP_LIST = 'ip_list' + TIMESTAMP = 'timestamp' + + + +class RuleProperty: """ - The control details of a profile. + The supported config property. - :attr str control_library_id: (optional) The ID of the control library that - contains the profile. - :attr str control_id: (optional) The control ID. + :param str name: (optional) The property name. + :param str description: (optional) The property description. + :param str type: The operator kind used when evaluating a property. """ def __init__( self, + type: str, *, - control_library_id: str = None, - control_id: str = None, + name: Optional[str] = None, + description: Optional[str] = None, ) -> None: """ - Initialize a ProfileControlsPrototype object. + Initialize a RuleProperty object. - :param str control_library_id: (optional) The ID of the control library - that contains the profile. - :param str control_id: (optional) The control ID. + :param str type: The operator kind used when evaluating a property. + :param str name: (optional) The property name. + :param str description: (optional) The property description. """ - self.control_library_id = control_library_id - self.control_id = control_id + self.name = name + self.description = description + self.type = type @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileControlsPrototype': - """Initialize a ProfileControlsPrototype object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RuleProperty': + """Initialize a RuleProperty object from a json dictionary.""" args = {} - if 'control_library_id' in _dict: - args['control_library_id'] = _dict.get('control_library_id') - if 'control_id' in _dict: - args['control_id'] = _dict.get('control_id') + if (name := _dict.get('name')) is not None: + args['name'] = name + if (description := _dict.get('description')) is not None: + args['description'] = description + if (type := _dict.get('type')) is not None: + args['type'] = type + else: + raise ValueError('Required property \'type\' not present in RuleProperty JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileControlsPrototype object from a json dictionary.""" + """Initialize a RuleProperty 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, 'control_library_id') and self.control_library_id is not None: - _dict['control_library_id'] = self.control_library_id - if hasattr(self, 'control_id') and self.control_id is not None: - _dict['control_id'] = self.control_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, 'type') and self.type is not None: + _dict['type'] = self.type return _dict def _to_dict(self): @@ -8610,73 +14558,118 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileControlsPrototype object.""" + """Return a `str` version of this RuleProperty object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileControlsPrototype') -> bool: + def __eq__(self, other: 'RuleProperty') -> 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: 'ProfileControlsPrototype') -> bool: + def __ne__(self, other: 'RuleProperty') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class TypeEnum(str, Enum): + """ + The operator kind used when evaluating a property. + """ -class ProfileInfo: + STRING = 'string' + NUMERIC = 'numeric' + GENERAL = 'general' + BOOLEAN = 'boolean' + STRING_LIST = 'string_list' + IP_LIST = 'ip_list' + TIMESTAMP = 'timestamp' + + + +class RuleTarget: """ - The profile information. + The rule target. - :attr str id: (optional) The profile ID. - :attr str name: (optional) The profile name. - :attr str version: (optional) The profile version. + :param str service_name: The target service name. + :param str service_display_name: (optional) The display name of the target + service. + :param str resource_kind: The target resource kind. + :param List[AdditionalTargetAttribute] additional_target_attributes: (optional) + The additional target attributes used to filter to a subset of resources. + :param str ref: (optional) The name of target when used in a rule. """ def __init__( self, + service_name: str, + resource_kind: str, *, - id: str = None, - name: str = None, - version: str = None, + service_display_name: Optional[str] = None, + additional_target_attributes: Optional[List['AdditionalTargetAttribute']] = None, + ref: Optional[str] = None, ) -> None: """ - Initialize a ProfileInfo object. + Initialize a RuleTarget object. - :param str id: (optional) The profile ID. - :param str name: (optional) The profile name. - :param str version: (optional) The profile version. + :param str service_name: The target service name. + :param str resource_kind: The target resource kind. + :param str service_display_name: (optional) The display name of the target + service. + :param List[AdditionalTargetAttribute] additional_target_attributes: + (optional) The additional target attributes used to filter to a subset of + resources. + :param str ref: (optional) The name of target when used in a rule. """ - self.id = id - self.name = name - self.version = version + self.service_name = service_name + self.service_display_name = service_display_name + self.resource_kind = resource_kind + self.additional_target_attributes = additional_target_attributes + self.ref = ref @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileInfo': - """Initialize a ProfileInfo object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RuleTarget': + """Initialize a RuleTarget object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'version' in _dict: - args['version'] = _dict.get('version') + if (service_name := _dict.get('service_name')) is not None: + args['service_name'] = service_name + else: + raise ValueError('Required property \'service_name\' not present in RuleTarget JSON') + if (service_display_name := _dict.get('service_display_name')) is not None: + args['service_display_name'] = service_display_name + if (resource_kind := _dict.get('resource_kind')) is not None: + args['resource_kind'] = resource_kind + else: + raise ValueError('Required property \'resource_kind\' not present in RuleTarget JSON') + if (additional_target_attributes := _dict.get('additional_target_attributes')) is not None: + args['additional_target_attributes'] = [AdditionalTargetAttribute.from_dict(v) for v in additional_target_attributes] + if (ref := _dict.get('ref')) is not None: + args['ref'] = ref return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileInfo object from a json dictionary.""" + """Initialize a RuleTarget 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, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'version') and self.version is not None: - _dict['version'] = self.version + if hasattr(self, 'service_name') and self.service_name is not None: + _dict['service_name'] = self.service_name + if hasattr(self, 'service_display_name') and self.service_display_name is not None: + _dict['service_display_name'] = self.service_display_name + if hasattr(self, 'resource_kind') and self.resource_kind is not None: + _dict['resource_kind'] = self.resource_kind + if hasattr(self, 'additional_target_attributes') and self.additional_target_attributes is not None: + additional_target_attributes_list = [] + for v in self.additional_target_attributes: + if isinstance(v, dict): + additional_target_attributes_list.append(v) + else: + additional_target_attributes_list.append(v.to_dict()) + _dict['additional_target_attributes'] = additional_target_attributes_list + if hasattr(self, 'ref') and self.ref is not None: + _dict['ref'] = self.ref return _dict def _to_dict(self): @@ -8684,155 +14677,86 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileInfo object.""" + """Return a `str` version of this RuleTarget object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileInfo') -> bool: + def __eq__(self, other: 'RuleTarget') -> 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: 'ProfileInfo') -> bool: + def __ne__(self, other: 'RuleTarget') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProfileItem: +class RuleTargetPrototype: """ - ProfileItem. + The rule target. - :attr str id: (optional) The profile ID. - :attr str profile_name: (optional) The profile name. - :attr str profile_description: (optional) The profile description. - :attr str profile_type: (optional) The profile type. - :attr str profile_version: (optional) The profile version. - :attr str version_group_label: (optional) The version group label. - :attr bool latest: (optional) The latest profile. - :attr str created_by: (optional) The user who created the profile. - :attr datetime created_on: (optional) The date when the profile was created. - :attr str updated_by: (optional) The user who updated the profile. - :attr datetime updated_on: (optional) The date when the profile was updated. - :attr int controls_count: (optional) The number of controls. - :attr int attachments_count: (optional) The number of attachments. + :param str service_name: The target service name. + :param str resource_kind: The target resource kind. + :param List[AdditionalTargetAttribute] additional_target_attributes: (optional) + The additional target attributes used to filter to a subset of resources. """ def __init__( self, + service_name: str, + resource_kind: str, *, - id: str = None, - profile_name: str = None, - profile_description: str = None, - profile_type: str = None, - profile_version: str = None, - version_group_label: str = None, - latest: bool = None, - created_by: str = None, - created_on: datetime = None, - updated_by: str = None, - updated_on: datetime = None, - controls_count: int = None, - attachments_count: int = None, + additional_target_attributes: Optional[List['AdditionalTargetAttribute']] = None, ) -> None: """ - Initialize a ProfileItem object. + Initialize a RuleTargetPrototype object. - :param str id: (optional) The profile ID. - :param str profile_name: (optional) The profile name. - :param str profile_description: (optional) The profile description. - :param str profile_type: (optional) The profile type. - :param str profile_version: (optional) The profile version. - :param str version_group_label: (optional) The version group label. - :param bool latest: (optional) The latest profile. - :param str created_by: (optional) The user who created the profile. - :param datetime created_on: (optional) The date when the profile was - created. - :param str updated_by: (optional) The user who updated the profile. - :param datetime updated_on: (optional) The date when the profile was - updated. - :param int controls_count: (optional) The number of controls. - :param int attachments_count: (optional) The number of attachments. + :param str service_name: The target service name. + :param str resource_kind: The target resource kind. + :param List[AdditionalTargetAttribute] additional_target_attributes: + (optional) The additional target attributes used to filter to a subset of + resources. """ - self.id = id - self.profile_name = profile_name - self.profile_description = profile_description - self.profile_type = profile_type - self.profile_version = profile_version - self.version_group_label = version_group_label - self.latest = latest - self.created_by = created_by - self.created_on = created_on - self.updated_by = updated_by - self.updated_on = updated_on - self.controls_count = controls_count - self.attachments_count = attachments_count + self.service_name = service_name + self.resource_kind = resource_kind + self.additional_target_attributes = additional_target_attributes @classmethod - def from_dict(cls, _dict: Dict) -> 'ProfileItem': - """Initialize a ProfileItem object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RuleTargetPrototype': + """Initialize a RuleTargetPrototype object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'profile_name' in _dict: - args['profile_name'] = _dict.get('profile_name') - if 'profile_description' in _dict: - args['profile_description'] = _dict.get('profile_description') - if 'profile_type' in _dict: - args['profile_type'] = _dict.get('profile_type') - if 'profile_version' in _dict: - args['profile_version'] = _dict.get('profile_version') - if 'version_group_label' in _dict: - args['version_group_label'] = _dict.get('version_group_label') - if 'latest' in _dict: - args['latest'] = _dict.get('latest') - if 'created_by' in _dict: - args['created_by'] = _dict.get('created_by') - if 'created_on' in _dict: - args['created_on'] = string_to_datetime(_dict.get('created_on')) - if 'updated_by' in _dict: - args['updated_by'] = _dict.get('updated_by') - if 'updated_on' in _dict: - args['updated_on'] = string_to_datetime(_dict.get('updated_on')) - if 'controls_count' in _dict: - args['controls_count'] = _dict.get('controls_count') - if 'attachments_count' in _dict: - args['attachments_count'] = _dict.get('attachments_count') + if (service_name := _dict.get('service_name')) is not None: + args['service_name'] = service_name + else: + raise ValueError('Required property \'service_name\' not present in RuleTargetPrototype JSON') + if (resource_kind := _dict.get('resource_kind')) is not None: + args['resource_kind'] = resource_kind + else: + raise ValueError('Required property \'resource_kind\' not present in RuleTargetPrototype JSON') + if (additional_target_attributes := _dict.get('additional_target_attributes')) is not None: + args['additional_target_attributes'] = [AdditionalTargetAttribute.from_dict(v) for v in additional_target_attributes] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProfileItem object from a json dictionary.""" + """Initialize a RuleTargetPrototype 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, 'profile_name') and self.profile_name is not None: - _dict['profile_name'] = self.profile_name - if hasattr(self, 'profile_description') and self.profile_description is not None: - _dict['profile_description'] = self.profile_description - if hasattr(self, 'profile_type') and self.profile_type is not None: - _dict['profile_type'] = self.profile_type - if hasattr(self, 'profile_version') and self.profile_version is not None: - _dict['profile_version'] = self.profile_version - if hasattr(self, 'version_group_label') and self.version_group_label is not None: - _dict['version_group_label'] = self.version_group_label - if hasattr(self, 'latest') and self.latest is not None: - _dict['latest'] = self.latest - if hasattr(self, 'created_by') and self.created_by is not None: - _dict['created_by'] = self.created_by - if hasattr(self, 'created_on') and self.created_on is not None: - _dict['created_on'] = datetime_to_string(self.created_on) - if hasattr(self, 'updated_by') and self.updated_by is not None: - _dict['updated_by'] = self.updated_by - if hasattr(self, 'updated_on') and self.updated_on is not None: - _dict['updated_on'] = datetime_to_string(self.updated_on) - if hasattr(self, 'controls_count') and self.controls_count is not None: - _dict['controls_count'] = self.controls_count - if hasattr(self, 'attachments_count') and self.attachments_count is not None: - _dict['attachments_count'] = self.attachments_count + if hasattr(self, 'service_name') and self.service_name is not None: + _dict['service_name'] = self.service_name + if hasattr(self, 'resource_kind') and self.resource_kind is not None: + _dict['resource_kind'] = self.resource_kind + if hasattr(self, 'additional_target_attributes') and self.additional_target_attributes is not None: + additional_target_attributes_list = [] + for v in self.additional_target_attributes: + if isinstance(v, dict): + additional_target_attributes_list.append(v) + else: + additional_target_attributes_list.append(v.to_dict()) + _dict['additional_target_attributes'] = additional_target_attributes_list return _dict def _to_dict(self): @@ -8840,89 +14764,128 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProfileItem object.""" + """Return a `str` version of this RuleTargetPrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProfileItem') -> bool: + def __eq__(self, other: 'RuleTargetPrototype') -> 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: 'ProfileItem') -> bool: + def __ne__(self, other: 'RuleTargetPrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Property: +class ScanReport: """ - The property. - - :attr str property: (optional) The property name. - :attr str property_description: (optional) The property description. - :attr str operator: (optional) The property operator. - :attr object expected_value: (optional) The property value. - :attr object found_value: (optional) The property value. + A report detailing the evaluations related to a specific control. + + :param str id: (optional) The ID of the scan report. + :param str scan_id: (optional) The ID of the scan. + :param str instance_id: (optional) The ID of the Security and Compliance Center + instance. + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the sub-scope. + :param str status: The enum of different scan report status. + :param datetime created_on: (optional) The date when the report was created. + :param str format: The file type of the report. + :param str href: (optional) The URL of the scan report. """ def __init__( self, + status: str, + format: str, *, - property: str = None, - property_description: str = None, - operator: str = None, - expected_value: object = None, - found_value: object = None, + id: Optional[str] = None, + scan_id: Optional[str] = None, + instance_id: Optional[str] = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, + created_on: Optional[datetime] = None, + href: Optional[str] = None, ) -> None: """ - Initialize a Property object. - - :param str property: (optional) The property name. - :param str property_description: (optional) The property description. - :param str operator: (optional) The property operator. - :param object expected_value: (optional) The property value. - :param object found_value: (optional) The property value. + Initialize a ScanReport object. + + :param str status: The enum of different scan report status. + :param str format: The file type of the report. + :param str id: (optional) The ID of the scan report. + :param str scan_id: (optional) The ID of the scan. + :param str instance_id: (optional) The ID of the Security and Compliance + Center instance. + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the sub-scope. + :param datetime created_on: (optional) The date when the report was + created. + :param str href: (optional) The URL of the scan report. """ - self.property = property - self.property_description = property_description - self.operator = operator - self.expected_value = expected_value - self.found_value = found_value + self.id = id + self.scan_id = scan_id + self.instance_id = instance_id + self.scope_id = scope_id + self.subscope_id = subscope_id + self.status = status + self.created_on = created_on + self.format = format + self.href = href @classmethod - def from_dict(cls, _dict: Dict) -> 'Property': - """Initialize a Property object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ScanReport': + """Initialize a ScanReport object from a json dictionary.""" args = {} - if 'property' in _dict: - args['property'] = _dict.get('property') - if 'property_description' in _dict: - args['property_description'] = _dict.get('property_description') - if 'operator' in _dict: - args['operator'] = _dict.get('operator') - if 'expected_value' in _dict: - args['expected_value'] = _dict.get('expected_value') - if 'found_value' in _dict: - args['found_value'] = _dict.get('found_value') + if (id := _dict.get('id')) is not None: + args['id'] = id + if (scan_id := _dict.get('scan_id')) is not None: + args['scan_id'] = scan_id + if (instance_id := _dict.get('instance_id')) is not None: + args['instance_id'] = instance_id + if (scope_id := _dict.get('scope_id')) is not None: + args['scope_id'] = scope_id + if (subscope_id := _dict.get('subscope_id')) is not None: + args['subscope_id'] = subscope_id + if (status := _dict.get('status')) is not None: + args['status'] = status + else: + raise ValueError('Required property \'status\' not present in ScanReport JSON') + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + if (format := _dict.get('format')) is not None: + args['format'] = format + else: + raise ValueError('Required property \'format\' not present in ScanReport JSON') + if (href := _dict.get('href')) is not None: + args['href'] = href return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Property object from a json dictionary.""" + """Initialize a ScanReport 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, 'property') and self.property is not None: - _dict['property'] = self.property - if hasattr(self, 'property_description') and self.property_description is not None: - _dict['property_description'] = self.property_description - if hasattr(self, 'operator') and self.operator is not None: - _dict['operator'] = self.operator - if hasattr(self, 'expected_value') and self.expected_value is not None: - _dict['expected_value'] = self.expected_value - if hasattr(self, 'found_value') and self.found_value is not None: - _dict['found_value'] = self.found_value + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'scan_id') and self.scan_id is not None: + _dict['scan_id'] = self.scan_id + if hasattr(self, 'instance_id') and self.instance_id is not None: + _dict['instance_id'] = self.instance_id + if hasattr(self, 'scope_id') and self.scope_id is not None: + _dict['scope_id'] = self.scope_id + if hasattr(self, 'subscope_id') and self.subscope_id is not None: + _dict['subscope_id'] = self.subscope_id + if hasattr(self, 'status') and self.status is not None: + _dict['status'] = self.status + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'format') and self.format is not None: + _dict['format'] = self.format + if hasattr(self, 'href') and self.href is not None: + _dict['href'] = self.href return _dict def _to_dict(self): @@ -8930,65 +14893,144 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Property object.""" + """Return a `str` version of this ScanReport object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Property') -> bool: + def __eq__(self, other: 'ScanReport') -> 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: 'Property') -> bool: + def __ne__(self, other: 'ScanReport') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class StatusEnum(str, Enum): + """ + The enum of different scan report status. + """ -class PropertyItem: - """ - The properties supported for scoping by this environment. + PENDING = 'pending' + IN_PROGRESS = 'in_progress' + ERROR = 'error' + COMPLETED = 'completed' + DELETED = 'deleted' - :attr str name: (optional) The name of the property. - :attr str value: (optional) The value of the property. + + class FormatEnum(str, Enum): + """ + The file type of the report. + """ + + CSV = 'csv' + PDF = 'pdf' + + + +class ScanReportCollection: + """ + The page of scan reports. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param str scope_id: (optional) The id of the requested scope. + :param str subscope_id: (optional) The id of the requested subscope. + :param List[ScanReport] scan_reports: (optional) The list of scan reports. """ def __init__( self, + limit: int, + total_count: int, *, - name: {} = None, - value: {} = None, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, + scope_id: Optional[str] = None, + subscope_id: Optional[str] = None, + scan_reports: Optional[List['ScanReport']] = None, ) -> None: """ - Initialize a PropertyItem object. + Initialize a ScanReportCollection object. - :param str name: (optional) The name of the property. - :param str value: (optional) The value of the property. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param str scope_id: (optional) The id of the requested scope. + :param str subscope_id: (optional) The id of the requested subscope. + :param List[ScanReport] scan_reports: (optional) The list of scan reports. """ - self.name = name - self.value = value + self.limit = limit + self.total_count = total_count + self.first = first + self.next = next + self.scope_id = scope_id + self.subscope_id = subscope_id + self.scan_reports = scan_reports @classmethod - def from_dict(cls, _dict: Dict) -> 'PropertyItem': - """Initialize a PropertyItem object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ScanReportCollection': + """Initialize a ScanReportCollection object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'value' in _dict: - args['value'] = _dict.get('value') + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + else: + raise ValueError('Required property \'limit\' not present in ScanReportCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + else: + raise ValueError('Required property \'total_count\' not present in ScanReportCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (scope_id := _dict.get('scope_id')) is not None: + args['scope_id'] = scope_id + if (subscope_id := _dict.get('subscope_id')) is not None: + args['subscope_id'] = subscope_id + if (scan_reports := _dict.get('scan_reports')) is not None: + args['scan_reports'] = [ScanReport.from_dict(v) for v in scan_reports] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a PropertyItem object from a json dictionary.""" + """Initialize a ScanReportCollection 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, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'scope_id') and self.scope_id is not None: + _dict['scope_id'] = self.scope_id + if hasattr(self, 'subscope_id') and self.subscope_id is not None: + _dict['subscope_id'] = self.subscope_id + if hasattr(self, 'scan_reports') and self.scan_reports is not None: + scan_reports_list = [] + for v in self.scan_reports: + if isinstance(v, dict): + scan_reports_list.append(v) + else: + scan_reports_list.append(v.to_dict()) + _dict['scan_reports'] = scan_reports_list return _dict def _to_dict(self): @@ -8996,83 +15038,147 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this PropertyItem object.""" + """Return a `str` version of this ScanReportCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'PropertyItem') -> bool: + def __eq__(self, other: 'ScanReportCollection') -> 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: 'PropertyItem') -> bool: + def __ne__(self, other: 'ScanReportCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProviderTypeInstanceItem: +class Scope: """ - A provider type instance. - - :attr str id: (optional) The unique identifier of the provider type instance. - :attr str type: (optional) The type of the provider type. - :attr str name: (optional) The name of the provider type instance. - :attr dict attributes: (optional) The attributes for connecting to the provider - type instance. - :attr datetime created_at: (optional) Time at which resource was created. - :attr datetime updated_at: (optional) Time at which resource was updated. + The group of resources that you want to evaluate. In the new API-based architecture, a + scope can be an Enterprise, Account group, Account, or Resource group. + + :param str id: The ID of the scope. + :param str name: The scope name. + :param str description: The scope description. + :param str environment: The scope environment. This value details what cloud + provider the scope targets. + :param List[ScopeProperty] properties: The properties that are supported for + scoping by this environment. + :param str account_id: The ID of the account associated with the scope. + :param str instance_id: The ID of the instance associated with the scope. + :param str created_by: The identifier of the account or service ID who created + the scope. + :param datetime created_on: The date when the scope was created. + :param str updated_by: The ID of the user or service ID who updated the scope. + :param datetime updated_on: The date when the scope was updated. + :param float attachment_count: The number of attachments tied to the scope. """ def __init__( self, - *, - id: str = None, - type: str = None, - name: str = None, - attributes: dict = None, - created_at: datetime = None, - updated_at: datetime = None, + id: str, + name: str, + description: str, + environment: str, + properties: List['ScopeProperty'], + account_id: str, + instance_id: str, + created_by: str, + created_on: datetime, + updated_by: str, + updated_on: datetime, + attachment_count: float, ) -> None: """ - Initialize a ProviderTypeInstanceItem object. - - :param str id: (optional) The unique identifier of the provider type - instance. - :param str type: (optional) The type of the provider type. - :param str name: (optional) The name of the provider type instance. - :param dict attributes: (optional) The attributes for connecting to the - provider type instance. - :param datetime created_at: (optional) Time at which resource was created. - :param datetime updated_at: (optional) Time at which resource was updated. + Initialize a Scope object. + + :param str id: The ID of the scope. + :param str name: The scope name. + :param str description: The scope description. + :param str environment: The scope environment. This value details what + cloud provider the scope targets. + :param List[ScopeProperty] properties: The properties that are supported + for scoping by this environment. + :param str account_id: The ID of the account associated with the scope. + :param str instance_id: The ID of the instance associated with the scope. + :param str created_by: The identifier of the account or service ID who + created the scope. + :param datetime created_on: The date when the scope was created. + :param str updated_by: The ID of the user or service ID who updated the + scope. + :param datetime updated_on: The date when the scope was updated. + :param float attachment_count: The number of attachments tied to the scope. """ self.id = id - self.type = type self.name = name - self.attributes = attributes - self.created_at = created_at - self.updated_at = updated_at + self.description = description + self.environment = environment + self.properties = properties + self.account_id = account_id + self.instance_id = instance_id + self.created_by = created_by + self.created_on = created_on + self.updated_by = updated_by + self.updated_on = updated_on + self.attachment_count = attachment_count @classmethod - def from_dict(cls, _dict: Dict) -> 'ProviderTypeInstanceItem': - """Initialize a ProviderTypeInstanceItem object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Scope': + """Initialize a Scope object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'type' in _dict: - args['type'] = _dict.get('type') - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'attributes' in _dict: - args['attributes'] = _dict.get('attributes') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in Scope JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in Scope JSON') + if (description := _dict.get('description')) is not None: + args['description'] = description + else: + raise ValueError('Required property \'description\' not present in Scope JSON') + if (environment := _dict.get('environment')) is not None: + args['environment'] = environment + else: + raise ValueError('Required property \'environment\' not present in Scope JSON') + if (properties := _dict.get('properties')) is not None: + args['properties'] = properties + else: + raise ValueError('Required property \'properties\' not present in Scope 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 Scope JSON') + if (instance_id := _dict.get('instance_id')) is not None: + args['instance_id'] = instance_id + else: + raise ValueError('Required property \'instance_id\' not present in Scope JSON') + 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 Scope JSON') + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + else: + raise ValueError('Required property \'created_on\' not present in Scope JSON') + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + else: + raise ValueError('Required property \'updated_by\' not present in Scope JSON') + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) + else: + raise ValueError('Required property \'updated_on\' not present in Scope JSON') + if (attachment_count := _dict.get('attachment_count')) is not None: + args['attachment_count'] = attachment_count + else: + raise ValueError('Required property \'attachment_count\' not present in Scope JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProviderTypeInstanceItem object from a json dictionary.""" + """Initialize a Scope object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -9080,16 +15186,34 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type if hasattr(self, 'name') and self.name is not None: _dict['name'] = self.name - if hasattr(self, 'attributes') and self.attributes is not None: - _dict['attributes'] = self.attributes - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'updated_at') and self.updated_at is not None: - _dict['updated_at'] = datetime_to_string(self.updated_at) + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'environment') and self.environment is not None: + _dict['environment'] = self.environment + if hasattr(self, 'properties') and self.properties is not None: + properties_list = [] + for v in self.properties: + if isinstance(v, dict): + properties_list.append(v) + else: + properties_list.append(v.to_dict()) + _dict['properties'] = properties_list + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'instance_id') and self.instance_id is not None: + _dict['instance_id'] = self.instance_id + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'updated_by') and self.updated_by is not None: + _dict['updated_by'] = self.updated_by + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) + if hasattr(self, 'attachment_count') and self.attachment_count is not None: + _dict['attachment_count'] = self.attachment_count return _dict def _to_dict(self): @@ -9097,65 +15221,109 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProviderTypeInstanceItem object.""" + """Return a `str` version of this Scope object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProviderTypeInstanceItem') -> bool: + def __eq__(self, other: 'Scope') -> 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: 'ProviderTypeInstanceItem') -> bool: + def __ne__(self, other: 'Scope') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProviderTypeInstancesResponse: +class ScopeCollection: """ - Provider type instances response. - - :attr List[ProviderTypeInstanceItem] provider_type_instances: (optional) The - array of instances for a provider type. + A list of scopes. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param List[Scope] scopes: The array of scopes. """ def __init__( self, + limit: int, + total_count: int, + scopes: List['Scope'], *, - provider_type_instances: List['ProviderTypeInstanceItem'] = None, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, ) -> None: """ - Initialize a ProviderTypeInstancesResponse object. + Initialize a ScopeCollection object. - :param List[ProviderTypeInstanceItem] provider_type_instances: (optional) - The array of instances for a provider type. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param List[Scope] scopes: The array of scopes. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. """ - self.provider_type_instances = provider_type_instances + self.limit = limit + self.total_count = total_count + self.first = first + self.next = next + self.scopes = scopes @classmethod - def from_dict(cls, _dict: Dict) -> 'ProviderTypeInstancesResponse': - """Initialize a ProviderTypeInstancesResponse object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ScopeCollection': + """Initialize a ScopeCollection object from a json dictionary.""" args = {} - if 'provider_type_instances' in _dict: - args['provider_type_instances'] = [ProviderTypeInstanceItem.from_dict(v) for v in _dict.get('provider_type_instances')] + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + else: + raise ValueError('Required property \'limit\' not present in ScopeCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + else: + raise ValueError('Required property \'total_count\' not present in ScopeCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (scopes := _dict.get('scopes')) is not None: + args['scopes'] = [Scope.from_dict(v) for v in scopes] + else: + raise ValueError('Required property \'scopes\' not present in ScopeCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProviderTypeInstancesResponse object from a json dictionary.""" + """Initialize a ScopeCollection 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, 'provider_type_instances') and self.provider_type_instances is not None: - provider_type_instances_list = [] - for v in self.provider_type_instances: + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first + else: + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'scopes') and self.scopes is not None: + scopes_list = [] + for v in self.scopes: if isinstance(v, dict): - provider_type_instances_list.append(v) + scopes_list.append(v) else: - provider_type_instances_list.append(v.to_dict()) - _dict['provider_type_instances'] = provider_type_instances_list + scopes_list.append(v.to_dict()) + _dict['scopes'] = scopes_list return _dict def _to_dict(self): @@ -9163,205 +15331,66 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProviderTypeInstancesResponse object.""" + """Return a `str` version of this ScopeCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProviderTypeInstancesResponse') -> bool: + def __eq__(self, other: 'ScopeCollection') -> 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: 'ProviderTypeInstancesResponse') -> bool: + def __ne__(self, other: 'ScopeCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProviderTypeItem: +class ScopeID: """ - The provider type item. + The scope ID that is associated with a report. Attributes for this object will be + blank if the report has multiple scopes tied to the report. - :attr str id: The unique identifier of the provider type. - :attr str type: The type of the provider type. - :attr str name: The name of the provider type. - :attr str description: The provider type description. - :attr bool s2s_enabled: A boolean that indicates whether the provider type is - s2s-enabled. - :attr int instance_limit: The maximum number of instances that can be created - for the provider type. - :attr str mode: The mode that is used to get results from provider (`PUSH` or - `PULL`). - :attr str data_type: The format of the results that a provider supports. - :attr str icon: The icon of a provider in .svg format that is encoded as a - base64 string. - :attr LabelType label: (optional) The label that is associated with the provider - type. - :attr dict attributes: The attributes that are required when you're creating an - instance of a provider type. The attributes field can have multiple keys in its - value. Each of those keys has a value object that includes the type, and - display name as keys. For example, `{type:"", display_name:""}`. - **NOTE;** If the provider type is s2s-enabled, which means that if the - `s2s_enabled` field is set to `true`, then a CRN field of type text is required - in the attributes value object. - :attr datetime created_at: (optional) Time at which resource was created. - :attr datetime updated_at: (optional) Time at which resource was updated. + :param str id: (optional) The scope ID. + :param str type: (optional) The scope type. """ def __init__( self, - id: str, - type: str, - name: str, - description: str, - s2s_enabled: bool, - instance_limit: int, - mode: str, - data_type: str, - icon: str, - attributes: dict, *, - label: 'LabelType' = None, - created_at: datetime = None, - updated_at: datetime = None, + id: Optional[str] = None, + type: Optional[str] = None, ) -> None: """ - Initialize a ProviderTypeItem object. + Initialize a ScopeID object. - :param str id: The unique identifier of the provider type. - :param str type: The type of the provider type. - :param str name: The name of the provider type. - :param str description: The provider type description. - :param bool s2s_enabled: A boolean that indicates whether the provider type - is s2s-enabled. - :param int instance_limit: The maximum number of instances that can be - created for the provider type. - :param str mode: The mode that is used to get results from provider (`PUSH` - or `PULL`). - :param str data_type: The format of the results that a provider supports. - :param str icon: The icon of a provider in .svg format that is encoded as a - base64 string. - :param dict attributes: The attributes that are required when you're - creating an instance of a provider type. The attributes field can have - multiple keys in its value. Each of those keys has a value object that - includes the type, and display name as keys. For example, `{type:"", - display_name:""}`. - **NOTE;** If the provider type is s2s-enabled, which means that if the - `s2s_enabled` field is set to `true`, then a CRN field of type text is - required in the attributes value object. - :param LabelType label: (optional) The label that is associated with the - provider type. - :param datetime created_at: (optional) Time at which resource was created. - :param datetime updated_at: (optional) Time at which resource was updated. + :param str id: (optional) The scope ID. + :param str type: (optional) The scope type. """ self.id = id self.type = type - self.name = name - self.description = description - self.s2s_enabled = s2s_enabled - self.instance_limit = instance_limit - self.mode = mode - self.data_type = data_type - self.icon = icon - self.label = label - self.attributes = attributes - self.created_at = created_at - self.updated_at = updated_at - - @classmethod - def from_dict(cls, _dict: Dict) -> 'ProviderTypeItem': - """Initialize a ProviderTypeItem object from a json dictionary.""" - args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in ProviderTypeItem JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in ProviderTypeItem JSON') - if 'name' in _dict: - args['name'] = _dict.get('name') - else: - raise ValueError('Required property \'name\' not present in ProviderTypeItem JSON') - if 'description' in _dict: - args['description'] = _dict.get('description') - else: - raise ValueError('Required property \'description\' not present in ProviderTypeItem JSON') - if 's2s_enabled' in _dict: - args['s2s_enabled'] = _dict.get('s2s_enabled') - else: - raise ValueError('Required property \'s2s_enabled\' not present in ProviderTypeItem JSON') - if 'instance_limit' in _dict: - args['instance_limit'] = _dict.get('instance_limit') - else: - raise ValueError('Required property \'instance_limit\' not present in ProviderTypeItem JSON') - if 'mode' in _dict: - args['mode'] = _dict.get('mode') - else: - raise ValueError('Required property \'mode\' not present in ProviderTypeItem JSON') - if 'data_type' in _dict: - args['data_type'] = _dict.get('data_type') - else: - raise ValueError('Required property \'data_type\' not present in ProviderTypeItem JSON') - if 'icon' in _dict: - args['icon'] = _dict.get('icon') - else: - raise ValueError('Required property \'icon\' not present in ProviderTypeItem JSON') - if 'label' in _dict: - args['label'] = LabelType.from_dict(_dict.get('label')) - if 'attributes' in _dict: - args['attributes'] = {k: AdditionalProperty.from_dict(v) for k, v in _dict.get('attributes').items()} - else: - raise ValueError('Required property \'attributes\' not present in ProviderTypeItem JSON') - if 'created_at' in _dict: - args['created_at'] = string_to_datetime(_dict.get('created_at')) - if 'updated_at' in _dict: - args['updated_at'] = string_to_datetime(_dict.get('updated_at')) - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a ProviderTypeItem 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, 'type') and self.type is not None: - _dict['type'] = self.type - 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, 's2s_enabled') and self.s2s_enabled is not None: - _dict['s2s_enabled'] = self.s2s_enabled - if hasattr(self, 'instance_limit') and self.instance_limit is not None: - _dict['instance_limit'] = self.instance_limit - if hasattr(self, 'mode') and self.mode is not None: - _dict['mode'] = self.mode - if hasattr(self, 'data_type') and self.data_type is not None: - _dict['data_type'] = self.data_type - if hasattr(self, 'icon') and self.icon is not None: - _dict['icon'] = self.icon - if hasattr(self, 'label') and self.label is not None: - if isinstance(self.label, dict): - _dict['label'] = self.label - else: - _dict['label'] = self.label.to_dict() - if hasattr(self, 'attributes') and self.attributes is not None: - attributes_map = {} - for k, v in self.attributes.items(): - if isinstance(v, dict): - attributes_map[k] = v - else: - attributes_map[k] = v.to_dict() - _dict['attributes'] = attributes_map - if hasattr(self, 'created_at') and self.created_at is not None: - _dict['created_at'] = datetime_to_string(self.created_at) - if hasattr(self, 'updated_at') and self.updated_at is not None: - _dict['updated_at'] = datetime_to_string(self.updated_at) + + @classmethod + def from_dict(cls, _dict: Dict) -> 'ScopeID': + """Initialize a ScopeID object from a json dictionary.""" + args = {} + if (id := _dict.get('id')) is not None: + args['id'] = id + if (type := _dict.get('type')) is not None: + args['type'] = type + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a ScopeID 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, 'type') and self.type is not None: + _dict['type'] = self.type return _dict def _to_dict(self): @@ -9369,65 +15398,101 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProviderTypeItem object.""" + """Return a `str` version of this ScopeID object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProviderTypeItem') -> bool: + def __eq__(self, other: 'ScopeID') -> 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: 'ProviderTypeItem') -> bool: + def __ne__(self, other: 'ScopeID') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ProviderTypesCollection: +class ScopeProperty: """ - The provider types collection. + ScopeProperty. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a ScopeProperty object. + + """ + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ScopePropertyScopeType', 'ScopePropertyScopeId', 'ScopePropertyExclusions']) + ) + raise Exception(msg) + - :attr List[ProviderTypeItem] provider_types: (optional) The array of provder - type. +class ScopePropertyExclusionItem: + """ + Any exclusion to be defined in the scope. + + :param str scope_id: (optional) + :param str scope_type: The type of scope it targets + The scope values are as followed: + - enterprise: The scope targets an enterprise account + - enterprise.account_group: The scope targets an account group within an + enterprise + - enterprise.account: The scope targets an account within an enterprise + - account: The scope targets an account not tied to an enterprise + - account.resource_group: The scope targets a resource group within an account. """ def __init__( self, + scope_type: str, *, - provider_types: List['ProviderTypeItem'] = None, + scope_id: Optional[str] = None, ) -> None: """ - Initialize a ProviderTypesCollection object. + Initialize a ScopePropertyExclusionItem object. - :param List[ProviderTypeItem] provider_types: (optional) The array of - provder type. + :param str scope_type: The type of scope it targets + The scope values are as followed: + - enterprise: The scope targets an enterprise account + - enterprise.account_group: The scope targets an account group within an + enterprise + - enterprise.account: The scope targets an account within an enterprise + - account: The scope targets an account not tied to an enterprise + - account.resource_group: The scope targets a resource group within an + account. + :param str scope_id: (optional) """ - self.provider_types = provider_types + self.scope_id = scope_id + self.scope_type = scope_type @classmethod - def from_dict(cls, _dict: Dict) -> 'ProviderTypesCollection': - """Initialize a ProviderTypesCollection object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ScopePropertyExclusionItem': + """Initialize a ScopePropertyExclusionItem object from a json dictionary.""" args = {} - if 'provider_types' in _dict: - args['provider_types'] = [ProviderTypeItem.from_dict(v) for v in _dict.get('provider_types')] + if (scope_id := _dict.get('scope_id')) is not None: + args['scope_id'] = scope_id + if (scope_type := _dict.get('scope_type')) is not None: + args['scope_type'] = scope_type + else: + raise ValueError('Required property \'scope_type\' not present in ScopePropertyExclusionItem JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProviderTypesCollection object from a json dictionary.""" + """Initialize a ScopePropertyExclusionItem 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, 'provider_types') and self.provider_types is not None: - provider_types_list = [] - for v in self.provider_types: - if isinstance(v, dict): - provider_types_list.append(v) - else: - provider_types_list.append(v.to_dict()) - _dict['provider_types'] = provider_types_list + if hasattr(self, 'scope_id') and self.scope_id is not None: + _dict['scope_id'] = self.scope_id + if hasattr(self, 'scope_type') and self.scope_type is not None: + _dict['scope_type'] = self.scope_type return _dict def _to_dict(self): @@ -9435,65 +15500,108 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProviderTypesCollection object.""" + """Return a `str` version of this ScopePropertyExclusionItem object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProviderTypesCollection') -> bool: + def __eq__(self, other: 'ScopePropertyExclusionItem') -> 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: 'ProviderTypesCollection') -> bool: + def __ne__(self, other: 'ScopePropertyExclusionItem') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class ScopeTypeEnum(str, Enum): + """ + The type of scope it targets + The scope values are as followed: + - enterprise: The scope targets an enterprise account + - enterprise.account_group: The scope targets an account group within an + enterprise + - enterprise.account: The scope targets an account within an enterprise + - account: The scope targets an account not tied to an enterprise + - account.resource_group: The scope targets a resource group within an account. + """ + + ENTERPRISE = 'enterprise' + ENTERPRISE_ACCOUNT_GROUP = 'enterprise.account_group' + ENTERPRISE_ACCOUNT = 'enterprise.account' + ACCOUNT = 'account' + ACCOUNT_RESOURCE_GROUP = 'account.resource_group' + + -class ProviderTypesInstancesResponse: +class ScopePrototype: """ - Provider types instances response. + The request body to make a Scope. - :attr List[ProviderTypeInstanceItem] provider_types_instances: (optional) The - array of instances for all provider types. + :param str name: (optional) The scope name. + :param str description: (optional) The scope description. + :param str environment: (optional) The scope environment. + :param List[ScopeProperty] properties: (optional) The properties that are + supported for scoping by this environment. """ def __init__( self, *, - provider_types_instances: List['ProviderTypeInstanceItem'] = None, + name: Optional[str] = None, + description: Optional[str] = None, + environment: Optional[str] = None, + properties: Optional[List['ScopeProperty']] = None, ) -> None: """ - Initialize a ProviderTypesInstancesResponse object. + Initialize a ScopePrototype object. - :param List[ProviderTypeInstanceItem] provider_types_instances: (optional) - The array of instances for all provider types. + :param str name: (optional) The scope name. + :param str description: (optional) The scope description. + :param str environment: (optional) The scope environment. + :param List[ScopeProperty] properties: (optional) The properties that are + supported for scoping by this environment. """ - self.provider_types_instances = provider_types_instances + self.name = name + self.description = description + self.environment = environment + self.properties = properties @classmethod - def from_dict(cls, _dict: Dict) -> 'ProviderTypesInstancesResponse': - """Initialize a ProviderTypesInstancesResponse object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ScopePrototype': + """Initialize a ScopePrototype object from a json dictionary.""" args = {} - if 'provider_types_instances' in _dict: - args['provider_types_instances'] = [ProviderTypeInstanceItem.from_dict(v) for v in _dict.get('provider_types_instances')] + if (name := _dict.get('name')) is not None: + args['name'] = name + if (description := _dict.get('description')) is not None: + args['description'] = description + if (environment := _dict.get('environment')) is not None: + args['environment'] = environment + if (properties := _dict.get('properties')) is not None: + args['properties'] = properties return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ProviderTypesInstancesResponse object from a json dictionary.""" + """Initialize a ScopePrototype 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, 'provider_types_instances') and self.provider_types_instances is not None: - provider_types_instances_list = [] - for v in self.provider_types_instances: + 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, 'environment') and self.environment is not None: + _dict['environment'] = self.environment + if hasattr(self, 'properties') and self.properties is not None: + properties_list = [] + for v in self.properties: if isinstance(v, dict): - provider_types_instances_list.append(v) + properties_list.append(v) else: - provider_types_instances_list.append(v.to_dict()) - _dict['provider_types_instances'] = provider_types_instances_list + properties_list.append(v.to_dict()) + _dict['properties'] = properties_list return _dict def _to_dict(self): @@ -9501,145 +15609,185 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ProviderTypesInstancesResponse object.""" + """Return a `str` version of this ScopePrototype object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ProviderTypesInstancesResponse') -> bool: + def __eq__(self, other: 'ScopePrototype') -> 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: 'ProviderTypesInstancesResponse') -> bool: + def __ne__(self, other: 'ScopePrototype') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Report: +class Service: """ - The report. - - :attr str id: (optional) The ID of the report. - :attr str group_id: (optional) The group ID that is associated with the report. - The group ID combines profile, scope, and attachment IDs. - :attr str created_on: (optional) The date when the report was created. - :attr str scan_time: (optional) The date when the scan was run. - :attr str type: (optional) The type of the scan. - :attr str cos_object: (optional) The Cloud Object Storage object that is - associated with the report. - :attr str instance_id: (optional) Instance ID. - :attr Account account: (optional) The account that is associated with a report. - :attr ProfileInfo profile: (optional) The profile information. - :attr Attachment attachment: (optional) The attachment that is associated with a - report. + The response body for creating a service instance. + + :param datetime created_on: The service creation date. + :param str created_by: The service author. + :param datetime updated_on: The date when the service was modified. + :param str updated_by: The user who modified the service. + :param str service_name: The service name. + :param str service_display_name: (optional) The display name of the service. + :param str description: The service description. + :param bool monitoring_enabled: The indication of whether monitoring is enabled. + :param bool enforcement_enabled: The indication of whether enforcement is + enabled. + :param bool service_listing_enabled: The indication of whether service listing + is enabled. + :param ConfigurationInformationPoints config_information_point: The service + configuration information. + :param List[SupportedConfigs] supported_configs: The supported configurations. """ def __init__( self, + created_on: datetime, + created_by: str, + updated_on: datetime, + updated_by: str, + service_name: str, + description: str, + monitoring_enabled: bool, + enforcement_enabled: bool, + service_listing_enabled: bool, + config_information_point: 'ConfigurationInformationPoints', + supported_configs: List['SupportedConfigs'], *, - id: str = None, - group_id: str = None, - created_on: str = None, - scan_time: str = None, - type: str = None, - cos_object: str = None, - instance_id: str = None, - account: 'Account' = None, - profile: 'ProfileInfo' = None, - attachment: 'Attachment' = None, + service_display_name: Optional[str] = None, ) -> None: """ - Initialize a Report object. - - :param str id: (optional) The ID of the report. - :param str group_id: (optional) The group ID that is associated with the - report. The group ID combines profile, scope, and attachment IDs. - :param str created_on: (optional) The date when the report was created. - :param str scan_time: (optional) The date when the scan was run. - :param str type: (optional) The type of the scan. - :param str cos_object: (optional) The Cloud Object Storage object that is - associated with the report. - :param str instance_id: (optional) Instance ID. - :param Account account: (optional) The account that is associated with a - report. - :param ProfileInfo profile: (optional) The profile information. - :param Attachment attachment: (optional) The attachment that is associated - with a report. + Initialize a Service object. + + :param datetime created_on: The service creation date. + :param str created_by: The service author. + :param datetime updated_on: The date when the service was modified. + :param str updated_by: The user who modified the service. + :param str service_name: The service name. + :param str description: The service description. + :param bool monitoring_enabled: The indication of whether monitoring is + enabled. + :param bool enforcement_enabled: The indication of whether enforcement is + enabled. + :param bool service_listing_enabled: The indication of whether service + listing is enabled. + :param ConfigurationInformationPoints config_information_point: The service + configuration information. + :param List[SupportedConfigs] supported_configs: The supported + configurations. + :param str service_display_name: (optional) The display name of the + service. """ - self.id = id - self.group_id = group_id self.created_on = created_on - self.scan_time = scan_time - self.type = type - self.cos_object = cos_object - self.instance_id = instance_id - self.account = account - self.profile = profile - self.attachment = attachment + self.created_by = created_by + self.updated_on = updated_on + self.updated_by = updated_by + self.service_name = service_name + self.service_display_name = service_display_name + self.description = description + self.monitoring_enabled = monitoring_enabled + self.enforcement_enabled = enforcement_enabled + self.service_listing_enabled = service_listing_enabled + self.config_information_point = config_information_point + self.supported_configs = supported_configs @classmethod - def from_dict(cls, _dict: Dict) -> 'Report': - """Initialize a Report object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Service': + """Initialize a Service object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'group_id' in _dict: - args['group_id'] = _dict.get('group_id') - if 'created_on' in _dict: - args['created_on'] = _dict.get('created_on') - if 'scan_time' in _dict: - args['scan_time'] = _dict.get('scan_time') - if 'type' in _dict: - args['type'] = _dict.get('type') - if 'cos_object' in _dict: - args['cos_object'] = _dict.get('cos_object') - if 'instance_id' in _dict: - args['instance_id'] = _dict.get('instance_id') - if 'account' in _dict: - args['account'] = Account.from_dict(_dict.get('account')) - if 'profile' in _dict: - args['profile'] = ProfileInfo.from_dict(_dict.get('profile')) - if 'attachment' in _dict: - args['attachment'] = Attachment.from_dict(_dict.get('attachment')) + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + else: + raise ValueError('Required property \'created_on\' not present in Service JSON') + 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 Service JSON') + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) + else: + raise ValueError('Required property \'updated_on\' not present in Service JSON') + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + else: + raise ValueError('Required property \'updated_by\' not present in Service JSON') + if (service_name := _dict.get('service_name')) is not None: + args['service_name'] = service_name + else: + raise ValueError('Required property \'service_name\' not present in Service JSON') + if (service_display_name := _dict.get('service_display_name')) is not None: + args['service_display_name'] = service_display_name + if (description := _dict.get('description')) is not None: + args['description'] = description + else: + raise ValueError('Required property \'description\' not present in Service JSON') + if (monitoring_enabled := _dict.get('monitoring_enabled')) is not None: + args['monitoring_enabled'] = monitoring_enabled + else: + raise ValueError('Required property \'monitoring_enabled\' not present in Service JSON') + if (enforcement_enabled := _dict.get('enforcement_enabled')) is not None: + args['enforcement_enabled'] = enforcement_enabled + else: + raise ValueError('Required property \'enforcement_enabled\' not present in Service JSON') + if (service_listing_enabled := _dict.get('service_listing_enabled')) is not None: + args['service_listing_enabled'] = service_listing_enabled + else: + raise ValueError('Required property \'service_listing_enabled\' not present in Service JSON') + if (config_information_point := _dict.get('config_information_point')) is not None: + args['config_information_point'] = ConfigurationInformationPoints.from_dict(config_information_point) + else: + raise ValueError('Required property \'config_information_point\' not present in Service JSON') + if (supported_configs := _dict.get('supported_configs')) is not None: + args['supported_configs'] = [SupportedConfigs.from_dict(v) for v in supported_configs] + else: + raise ValueError('Required property \'supported_configs\' not present in Service JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Report object from a json dictionary.""" + """Initialize a Service 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, 'group_id') and self.group_id is not None: - _dict['group_id'] = self.group_id if hasattr(self, 'created_on') and self.created_on is not None: - _dict['created_on'] = self.created_on - if hasattr(self, 'scan_time') and self.scan_time is not None: - _dict['scan_time'] = self.scan_time - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'cos_object') and self.cos_object is not None: - _dict['cos_object'] = self.cos_object - if hasattr(self, 'instance_id') and self.instance_id is not None: - _dict['instance_id'] = self.instance_id - if hasattr(self, 'account') and self.account is not None: - if isinstance(self.account, dict): - _dict['account'] = self.account - else: - _dict['account'] = self.account.to_dict() - if hasattr(self, 'profile') and self.profile is not None: - if isinstance(self.profile, dict): - _dict['profile'] = self.profile - else: - _dict['profile'] = self.profile.to_dict() - if hasattr(self, 'attachment') and self.attachment is not None: - if isinstance(self.attachment, dict): - _dict['attachment'] = self.attachment + _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) + if hasattr(self, 'updated_by') and self.updated_by is not None: + _dict['updated_by'] = self.updated_by + if hasattr(self, 'service_name') and self.service_name is not None: + _dict['service_name'] = self.service_name + if hasattr(self, 'service_display_name') and self.service_display_name is not None: + _dict['service_display_name'] = self.service_display_name + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'monitoring_enabled') and self.monitoring_enabled is not None: + _dict['monitoring_enabled'] = self.monitoring_enabled + if hasattr(self, 'enforcement_enabled') and self.enforcement_enabled is not None: + _dict['enforcement_enabled'] = self.enforcement_enabled + if hasattr(self, 'service_listing_enabled') and self.service_listing_enabled is not None: + _dict['service_listing_enabled'] = self.service_listing_enabled + if hasattr(self, 'config_information_point') and self.config_information_point is not None: + if isinstance(self.config_information_point, dict): + _dict['config_information_point'] = self.config_information_point else: - _dict['attachment'] = self.attachment.to_dict() + _dict['config_information_point'] = self.config_information_point.to_dict() + if hasattr(self, 'supported_configs') and self.supported_configs is not None: + supported_configs_list = [] + for v in self.supported_configs: + if isinstance(v, dict): + supported_configs_list.append(v) + else: + supported_configs_list.append(v.to_dict()) + _dict['supported_configs'] = supported_configs_list return _dict def _to_dict(self): @@ -9647,137 +15795,63 @@ 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 Service object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Report') -> bool: + def __eq__(self, other: 'Service') -> 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: 'Service') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReportControls: +class ServiceCollection: """ - The list of controls. + The services. - :attr str status: (optional) The allowed values of an aggregated status for - controls, specifications, assessments, and resources. - :attr int total_count: (optional) The total number of checks. - :attr int compliant_count: (optional) The number of compliant checks. - :attr int not_compliant_count: (optional) The number of checks that are not - compliant. - :attr int unable_to_perform_count: (optional) The number of checks that are - unable to perform. - :attr int user_evaluation_required_count: (optional) The number of checks that - require a user evaluation. - :attr str home_account_id: (optional) The ID of the home account. - :attr str report_id: (optional) The ID of the report. - :attr List[ControlWithStats] controls: (optional) The list of controls that are - in the report. + :param List[Service] services: (optional) The list of services. """ def __init__( self, *, - status: str = None, - total_count: int = None, - compliant_count: int = None, - not_compliant_count: int = None, - unable_to_perform_count: int = None, - user_evaluation_required_count: int = None, - home_account_id: str = None, - report_id: str = None, - controls: List['ControlWithStats'] = None, + services: Optional[List['Service']] = None, ) -> None: """ - Initialize a ReportControls object. + Initialize a ServiceCollection object. - :param str status: (optional) The allowed values of an aggregated status - for controls, specifications, assessments, and resources. - :param int total_count: (optional) The total number of checks. - :param int compliant_count: (optional) The number of compliant checks. - :param int not_compliant_count: (optional) The number of checks that are - not compliant. - :param int unable_to_perform_count: (optional) The number of checks that - are unable to perform. - :param int user_evaluation_required_count: (optional) The number of checks - that require a user evaluation. - :param str home_account_id: (optional) The ID of the home account. - :param str report_id: (optional) The ID of the report. - :param List[ControlWithStats] controls: (optional) The list of controls - that are in the report. + :param List[Service] services: (optional) The list of services. """ - self.status = status - self.total_count = total_count - self.compliant_count = compliant_count - self.not_compliant_count = not_compliant_count - self.unable_to_perform_count = unable_to_perform_count - self.user_evaluation_required_count = user_evaluation_required_count - self.home_account_id = home_account_id - self.report_id = report_id - self.controls = controls + self.services = services @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportControls': - """Initialize a ReportControls object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ServiceCollection': + """Initialize a ServiceCollection object from a json dictionary.""" args = {} - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'compliant_count' in _dict: - args['compliant_count'] = _dict.get('compliant_count') - if 'not_compliant_count' in _dict: - args['not_compliant_count'] = _dict.get('not_compliant_count') - if 'unable_to_perform_count' in _dict: - args['unable_to_perform_count'] = _dict.get('unable_to_perform_count') - if 'user_evaluation_required_count' in _dict: - args['user_evaluation_required_count'] = _dict.get('user_evaluation_required_count') - if 'home_account_id' in _dict: - args['home_account_id'] = _dict.get('home_account_id') - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'controls' in _dict: - args['controls'] = [ControlWithStats.from_dict(v) for v in _dict.get('controls')] + if (services := _dict.get('services')) is not None: + args['services'] = [Service.from_dict(v) for v in services] return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReportControls object from a json dictionary.""" + """Initialize a ServiceCollection 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, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'compliant_count') and self.compliant_count is not None: - _dict['compliant_count'] = self.compliant_count - if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: - _dict['not_compliant_count'] = self.not_compliant_count - if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: - _dict['unable_to_perform_count'] = self.unable_to_perform_count - if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: - _dict['user_evaluation_required_count'] = self.user_evaluation_required_count - if hasattr(self, 'home_account_id') and self.home_account_id is not None: - _dict['home_account_id'] = self.home_account_id - if hasattr(self, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'controls') and self.controls is not None: - controls_list = [] - for v in self.controls: + if hasattr(self, 'services') and self.services is not None: + services_list = [] + for v in self.services: if isinstance(v, dict): - controls_list.append(v) + services_list.append(v) else: - controls_list.append(v.to_dict()) - _dict['controls'] = controls_list + services_list.append(v.to_dict()) + _dict['services'] = services_list return _dict def _to_dict(self): @@ -9785,116 +15859,75 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportControls object.""" + """Return a `str` version of this ServiceCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportControls') -> bool: + def __eq__(self, other: 'ServiceCollection') -> 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: 'ReportControls') -> bool: + def __ne__(self, other: 'ServiceCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The allowed values of an aggregated status for controls, specifications, - assessments, and resources. - """ - - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' - - -class ReportLatest: +class Settings: """ - The response body of the `get_latest_reports` operation. + The settings. - :attr str home_account_id: (optional) The ID of the home account. - :attr ComplianceStats controls_summary: (optional) The compliance stats. - :attr EvalStats evaluations_summary: (optional) The evaluation stats. - :attr ComplianceScore score: (optional) The compliance score. - :attr List[Report] reports: (optional) The list of reports. + :param EventNotifications event_notifications: (optional) The Event + Notifications settings. + :param ObjectStorage object_storage: (optional) The Cloud Object Storage + settings. """ def __init__( self, *, - home_account_id: str = None, - controls_summary: 'ComplianceStats' = None, - evaluations_summary: 'EvalStats' = None, - score: 'ComplianceScore' = None, - reports: List['Report'] = None, + event_notifications: Optional['EventNotifications'] = None, + object_storage: Optional['ObjectStorage'] = None, ) -> None: """ - Initialize a ReportLatest object. + Initialize a Settings object. - :param str home_account_id: (optional) The ID of the home account. - :param ComplianceStats controls_summary: (optional) The compliance stats. - :param EvalStats evaluations_summary: (optional) The evaluation stats. - :param ComplianceScore score: (optional) The compliance score. - :param List[Report] reports: (optional) The list of reports. + :param EventNotifications event_notifications: (optional) The Event + Notifications settings. + :param ObjectStorage object_storage: (optional) The Cloud Object Storage + settings. """ - self.home_account_id = home_account_id - self.controls_summary = controls_summary - self.evaluations_summary = evaluations_summary - self.score = score - self.reports = reports + self.event_notifications = event_notifications + self.object_storage = object_storage @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportLatest': - """Initialize a ReportLatest object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Settings': + """Initialize a Settings object from a json dictionary.""" args = {} - if 'home_account_id' in _dict: - args['home_account_id'] = _dict.get('home_account_id') - if 'controls_summary' in _dict: - args['controls_summary'] = ComplianceStats.from_dict(_dict.get('controls_summary')) - if 'evaluations_summary' in _dict: - args['evaluations_summary'] = EvalStats.from_dict(_dict.get('evaluations_summary')) - if 'score' in _dict: - args['score'] = ComplianceScore.from_dict(_dict.get('score')) - if 'reports' in _dict: - args['reports'] = [Report.from_dict(v) for v in _dict.get('reports')] + if (event_notifications := _dict.get('event_notifications')) is not None: + args['event_notifications'] = EventNotifications.from_dict(event_notifications) + if (object_storage := _dict.get('object_storage')) is not None: + args['object_storage'] = ObjectStorage.from_dict(object_storage) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReportLatest object from a json dictionary.""" + """Initialize a Settings 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, 'home_account_id') and self.home_account_id is not None: - _dict['home_account_id'] = self.home_account_id - if hasattr(self, 'controls_summary') and self.controls_summary is not None: - if isinstance(self.controls_summary, dict): - _dict['controls_summary'] = self.controls_summary - else: - _dict['controls_summary'] = self.controls_summary.to_dict() - if hasattr(self, 'evaluations_summary') and self.evaluations_summary is not None: - if isinstance(self.evaluations_summary, dict): - _dict['evaluations_summary'] = self.evaluations_summary + if hasattr(self, 'event_notifications') and self.event_notifications is not None: + if isinstance(self.event_notifications, dict): + _dict['event_notifications'] = self.event_notifications else: - _dict['evaluations_summary'] = self.evaluations_summary.to_dict() - if hasattr(self, 'score') and self.score is not None: - if isinstance(self.score, dict): - _dict['score'] = self.score + _dict['event_notifications'] = self.event_notifications.to_dict() + if hasattr(self, 'object_storage') and self.object_storage is not None: + if isinstance(self.object_storage, dict): + _dict['object_storage'] = self.object_storage else: - _dict['score'] = self.score.to_dict() - if hasattr(self, 'reports') and self.reports is not None: - reports_list = [] - for v in self.reports: - if isinstance(v, dict): - reports_list.append(v) - else: - reports_list.append(v.to_dict()) - _dict['reports'] = reports_list + _dict['object_storage'] = self.object_storage.to_dict() return _dict def _to_dict(self): @@ -9902,125 +15935,73 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportLatest object.""" + """Return a `str` version of this Settings object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportLatest') -> bool: + def __eq__(self, other: 'Settings') -> 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: 'ReportLatest') -> bool: + def __ne__(self, other: 'Settings') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReportPage: +class SubRule: """ - The page of reports. + A rule within a rule used in the requiredConfig. - :attr int total_count: The total number of resources that are in the collection. - :attr int limit: The requested page limi.t. - :attr str start: (optional) The token of the next page, when it's present. - :attr PageHRef first: The page reference. - :attr PageHRef next: (optional) The page reference. - :attr str home_account_id: (optional) The ID of the home account. - :attr List[Report] reports: (optional) The list of reports that are on the page. + :param RuleTarget target: (optional) The rule target. + :param RequiredConfig required_config: (optional) The required configurations + for a Rule. """ def __init__( self, - total_count: int, - limit: int, - first: 'PageHRef', *, - start: str = None, - next: 'PageHRef' = None, - home_account_id: str = None, - reports: List['Report'] = None, + target: Optional['RuleTarget'] = None, + required_config: Optional['RequiredConfig'] = None, ) -> None: """ - Initialize a ReportPage object. + Initialize a SubRule object. - :param int total_count: The total number of resources that are in the - collection. - :param int limit: The requested page limi.t. - :param PageHRef first: The page reference. - :param str start: (optional) The token of the next page, when it's present. - :param PageHRef next: (optional) The page reference. - :param str home_account_id: (optional) The ID of the home account. - :param List[Report] reports: (optional) The list of reports that are on the - page. + :param RuleTarget target: (optional) The rule target. + :param RequiredConfig required_config: (optional) The required + configurations for a Rule. """ - self.total_count = total_count - self.limit = limit - self.start = start - self.first = first - self.next = next - self.home_account_id = home_account_id - self.reports = reports + self.target = target + self.required_config = required_config @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportPage': - """Initialize a ReportPage object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SubRule': + """Initialize a SubRule object from a json dictionary.""" args = {} - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in ReportPage JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in ReportPage JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') - if 'first' in _dict: - args['first'] = PageHRef.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in ReportPage JSON') - if 'next' in _dict: - args['next'] = PageHRef.from_dict(_dict.get('next')) - if 'home_account_id' in _dict: - args['home_account_id'] = _dict.get('home_account_id') - if 'reports' in _dict: - args['reports'] = [Report.from_dict(v) for v in _dict.get('reports')] + if (target := _dict.get('target')) is not None: + args['target'] = RuleTarget.from_dict(target) + if (required_config := _dict.get('required_config')) is not None: + args['required_config'] = required_config return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReportPage object from a json dictionary.""" + """Initialize a SubRule 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, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'start') and self.start is not None: - _dict['start'] = self.start - if hasattr(self, 'first') and self.first is not None: - if isinstance(self.first, dict): - _dict['first'] = self.first + if hasattr(self, 'target') and self.target is not None: + if isinstance(self.target, dict): + _dict['target'] = self.target else: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'next') and self.next is not None: - if isinstance(self.next, dict): - _dict['next'] = self.next + _dict['target'] = self.target.to_dict() + if hasattr(self, 'required_config') and self.required_config is not None: + if isinstance(self.required_config, dict): + _dict['required_config'] = self.required_config else: - _dict['next'] = self.next.to_dict() - if hasattr(self, 'home_account_id') and self.home_account_id is not None: - _dict['home_account_id'] = self.home_account_id - if hasattr(self, 'reports') and self.reports is not None: - reports_list = [] - for v in self.reports: - if isinstance(v, dict): - reports_list.append(v) - else: - reports_list.append(v.to_dict()) - _dict['reports'] = reports_list + _dict['required_config'] = self.required_config.to_dict() return _dict def _to_dict(self): @@ -10028,121 +16009,103 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportPage object.""" + """Return a `str` version of this SubRule object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportPage') -> bool: + def __eq__(self, other: 'SubRule') -> 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: 'ReportPage') -> bool: + def __ne__(self, other: 'SubRule') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReportSummary: +class SubScope: """ - The report summary. - - :attr str report_id: (optional) The ID of the report. - :attr str isntance_id: (optional) Instance ID. - :attr Account account: (optional) The account that is associated with a report. - :attr ComplianceScore score: (optional) The compliance score. - :attr ComplianceStats controls: (optional) The compliance stats. - :attr EvalStats evaluations: (optional) The evaluation stats. - :attr ResourceSummary resources: (optional) The resource summary. + A segment of a scope. Subscopes are used to ensure that the members of your teams who + review results only have access to the information regarding the instances that they + have access to. + + :param str id: (optional) The Subscope ID. + :param str name: (optional) The name of the Subscope. + :param str description: (optional) Text to describe the Subscope. + :param str environment: (optional) The virtual space where applications can be + deployed and managed. + :param List[ScopeProperty] properties: Additional attributes that are supported + for scoping by this environment. """ def __init__( self, + properties: List['ScopeProperty'], *, - report_id: str = None, - isntance_id: str = None, - account: 'Account' = None, - score: 'ComplianceScore' = None, - controls: 'ComplianceStats' = None, - evaluations: 'EvalStats' = None, - resources: 'ResourceSummary' = None, + id: Optional[str] = None, + name: Optional[str] = None, + description: Optional[str] = None, + environment: Optional[str] = None, ) -> None: """ - Initialize a ReportSummary object. + Initialize a SubScope object. - :param str report_id: (optional) The ID of the report. - :param str isntance_id: (optional) Instance ID. - :param Account account: (optional) The account that is associated with a - report. - :param ComplianceScore score: (optional) The compliance score. - :param ComplianceStats controls: (optional) The compliance stats. - :param EvalStats evaluations: (optional) The evaluation stats. - :param ResourceSummary resources: (optional) The resource summary. + :param List[ScopeProperty] properties: Additional attributes that are + supported for scoping by this environment. + :param str id: (optional) The Subscope ID. + :param str name: (optional) The name of the Subscope. + :param str description: (optional) Text to describe the Subscope. + :param str environment: (optional) The virtual space where applications can + be deployed and managed. """ - self.report_id = report_id - self.isntance_id = isntance_id - self.account = account - self.score = score - self.controls = controls - self.evaluations = evaluations - self.resources = resources + self.id = id + self.name = name + self.description = description + self.environment = environment + self.properties = properties @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportSummary': - """Initialize a ReportSummary object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SubScope': + """Initialize a SubScope object from a json dictionary.""" args = {} - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'isntance_id' in _dict: - args['isntance_id'] = _dict.get('isntance_id') - if 'account' in _dict: - args['account'] = Account.from_dict(_dict.get('account')) - if 'score' in _dict: - args['score'] = ComplianceScore.from_dict(_dict.get('score')) - if 'controls' in _dict: - args['controls'] = ComplianceStats.from_dict(_dict.get('controls')) - if 'evaluations' in _dict: - args['evaluations'] = EvalStats.from_dict(_dict.get('evaluations')) - if 'resources' in _dict: - args['resources'] = ResourceSummary.from_dict(_dict.get('resources')) + if (id := _dict.get('id')) is not None: + args['id'] = id + if (name := _dict.get('name')) is not None: + args['name'] = name + if (description := _dict.get('description')) is not None: + args['description'] = description + if (environment := _dict.get('environment')) is not None: + args['environment'] = environment + if (properties := _dict.get('properties')) is not None: + args['properties'] = properties + else: + raise ValueError('Required property \'properties\' not present in SubScope JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReportSummary object from a json dictionary.""" + """Initialize a SubScope 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, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'isntance_id') and self.isntance_id is not None: - _dict['isntance_id'] = self.isntance_id - if hasattr(self, 'account') and self.account is not None: - if isinstance(self.account, dict): - _dict['account'] = self.account - else: - _dict['account'] = self.account.to_dict() - if hasattr(self, 'score') and self.score is not None: - if isinstance(self.score, dict): - _dict['score'] = self.score - else: - _dict['score'] = self.score.to_dict() - if hasattr(self, 'controls') and self.controls is not None: - if isinstance(self.controls, dict): - _dict['controls'] = self.controls - else: - _dict['controls'] = self.controls.to_dict() - if hasattr(self, 'evaluations') and self.evaluations is not None: - if isinstance(self.evaluations, dict): - _dict['evaluations'] = self.evaluations - else: - _dict['evaluations'] = self.evaluations.to_dict() - if hasattr(self, 'resources') and self.resources is not None: - if isinstance(self.resources, dict): - _dict['resources'] = self.resources - else: - _dict['resources'] = self.resources.to_dict() + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'environment') and self.environment is not None: + _dict['environment'] = self.environment + if hasattr(self, 'properties') and self.properties is not None: + properties_list = [] + for v in self.properties: + if isinstance(v, dict): + properties_list.append(v) + else: + properties_list.append(v.to_dict()) + _dict['properties'] = properties_list return _dict def _to_dict(self): @@ -10150,68 +16113,109 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportSummary object.""" + """Return a `str` version of this SubScope object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportSummary') -> bool: + def __eq__(self, other: 'SubScope') -> 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: 'ReportSummary') -> bool: + def __ne__(self, other: 'SubScope') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReportTags: +class SubScopeCollection: """ - The response body of the `get_tags` operation. - - :attr str report_id: (optional) The ID of the report. - :attr Tags tags: (optional) The collection of different types of tags. + The response body of the subscopes. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param List[SubScope] subscopes: The array of subscopes. """ def __init__( self, + limit: int, + total_count: int, + subscopes: List['SubScope'], *, - report_id: str = None, - tags: 'Tags' = None, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, ) -> None: """ - Initialize a ReportTags object. + Initialize a SubScopeCollection object. - :param str report_id: (optional) The ID of the report. - :param Tags tags: (optional) The collection of different types of tags. + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param List[SubScope] subscopes: The array of subscopes. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. """ - self.report_id = report_id - self.tags = tags + self.limit = limit + self.total_count = total_count + self.first = first + self.next = next + self.subscopes = subscopes @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportTags': - """Initialize a ReportTags object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SubScopeCollection': + """Initialize a SubScopeCollection object from a json dictionary.""" args = {} - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'tags' in _dict: - args['tags'] = Tags.from_dict(_dict.get('tags')) + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit + else: + raise ValueError('Required property \'limit\' not present in SubScopeCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count + else: + raise ValueError('Required property \'total_count\' not present in SubScopeCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (subscopes := _dict.get('subscopes')) is not None: + args['subscopes'] = [SubScope.from_dict(v) for v in subscopes] + else: + raise ValueError('Required property \'subscopes\' not present in SubScopeCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReportTags object from a json dictionary.""" + """Initialize a SubScopeCollection 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, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'tags') and self.tags is not None: - if isinstance(self.tags, dict): - _dict['tags'] = self.tags + if hasattr(self, 'limit') and self.limit is not None: + _dict['limit'] = self.limit + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count + if hasattr(self, 'first') and self.first is not None: + if isinstance(self.first, dict): + _dict['first'] = self.first else: - _dict['tags'] = self.tags.to_dict() + _dict['first'] = self.first.to_dict() + if hasattr(self, 'next') and self.next is not None: + if isinstance(self.next, dict): + _dict['next'] = self.next + else: + _dict['next'] = self.next.to_dict() + if hasattr(self, 'subscopes') and self.subscopes is not None: + subscopes_list = [] + for v in self.subscopes: + if isinstance(v, dict): + subscopes_list.append(v) + else: + subscopes_list.append(v.to_dict()) + _dict['subscopes'] = subscopes_list return _dict def _to_dict(self): @@ -10219,86 +16223,64 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportTags object.""" + """Return a `str` version of this SubScopeCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportTags') -> bool: + def __eq__(self, other: 'SubScopeCollection') -> 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: 'ReportTags') -> bool: + def __ne__(self, other: 'SubScopeCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReportViolationDataPoint: +class SubScopeResponse: """ - The report violation data point. + The response body of the subscope. - :attr str report_id: (optional) The ID of the report. - :attr str report_group_id: (optional) The group ID that is associated with the - report. The group ID combines profile, scope, and attachment IDs. - :attr str scan_time: (optional) The date when the scan was run. - :attr ComplianceStats controls: (optional) The compliance stats. + :param List[SubScope] subscopes: The array of subscopes. """ def __init__( self, - *, - report_id: str = None, - report_group_id: str = None, - scan_time: str = None, - controls: 'ComplianceStats' = None, + subscopes: List['SubScope'], ) -> None: """ - Initialize a ReportViolationDataPoint object. + Initialize a SubScopeResponse object. - :param str report_id: (optional) The ID of the report. - :param str report_group_id: (optional) The group ID that is associated with - the report. The group ID combines profile, scope, and attachment IDs. - :param str scan_time: (optional) The date when the scan was run. - :param ComplianceStats controls: (optional) The compliance stats. + :param List[SubScope] subscopes: The array of subscopes. """ - self.report_id = report_id - self.report_group_id = report_group_id - self.scan_time = scan_time - self.controls = controls + self.subscopes = subscopes @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportViolationDataPoint': - """Initialize a ReportViolationDataPoint object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SubScopeResponse': + """Initialize a SubScopeResponse object from a json dictionary.""" args = {} - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'report_group_id' in _dict: - args['report_group_id'] = _dict.get('report_group_id') - if 'scan_time' in _dict: - args['scan_time'] = _dict.get('scan_time') - if 'controls' in _dict: - args['controls'] = ComplianceStats.from_dict(_dict.get('controls')) - return cls(**args) - - @classmethod - def _from_dict(cls, _dict): - """Initialize a ReportViolationDataPoint 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, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'report_group_id') and self.report_group_id is not None: - _dict['report_group_id'] = self.report_group_id - if hasattr(self, 'scan_time') and self.scan_time is not None: - _dict['scan_time'] = self.scan_time - if hasattr(self, 'controls') and self.controls is not None: - if isinstance(self.controls, dict): - _dict['controls'] = self.controls - else: - _dict['controls'] = self.controls.to_dict() + if (subscopes := _dict.get('subscopes')) is not None: + args['subscopes'] = [SubScope.from_dict(v) for v in subscopes] + else: + raise ValueError('Required property \'subscopes\' not present in SubScopeResponse JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a SubScopeResponse 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, 'subscopes') and self.subscopes is not None: + subscopes_list = [] + for v in self.subscopes: + if isinstance(v, dict): + subscopes_list.append(v) + else: + subscopes_list.append(v.to_dict()) + _dict['subscopes'] = subscopes_list return _dict def _to_dict(self): @@ -10306,81 +16288,135 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportViolationDataPoint object.""" + """Return a `str` version of this SubScopeResponse object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportViolationDataPoint') -> bool: + def __eq__(self, other: 'SubScopeResponse') -> 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: 'ReportViolationDataPoint') -> bool: + def __ne__(self, other: 'SubScopeResponse') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ReportViolationsDrift: +class SupportedConfigs: """ - The response body of the `get_report_violations_drift` operation. - - :attr str home_account_id: (optional) The ID of the home account. - :attr str report_id: (optional) The ID of the report. - :attr List[ReportViolationDataPoint] data_points: (optional) The list of report - violations data points. + The location information of supported configurations. + + :param str resource_kind: (optional) The supported config resource kind. + :param List[AdditionalTargetAttribute] additional_target_attributes: (optional) + The supported config list of additional target attributes. + :param List[RuleProperty] properties: (optional) The supported config list + properties. + :param str description: (optional) The supported config description. + :param bool cip_requires_service_instance: (optional) The indication of whether + the configuration information point (CIP) requires a service instance. + :param bool resource_group_support: (optional) The supported config resource + group support. + :param bool tagging_support: (optional) The supported config tagging support. + :param bool inherit_tags: (optional) The supported config inherited tags. """ def __init__( self, *, - home_account_id: str = None, - report_id: str = None, - data_points: List['ReportViolationDataPoint'] = None, + resource_kind: Optional[str] = None, + additional_target_attributes: Optional[List['AdditionalTargetAttribute']] = None, + properties: Optional[List['RuleProperty']] = None, + description: Optional[str] = None, + cip_requires_service_instance: Optional[bool] = None, + resource_group_support: Optional[bool] = None, + tagging_support: Optional[bool] = None, + inherit_tags: Optional[bool] = None, ) -> None: """ - Initialize a ReportViolationsDrift object. + Initialize a SupportedConfigs object. - :param str home_account_id: (optional) The ID of the home account. - :param str report_id: (optional) The ID of the report. - :param List[ReportViolationDataPoint] data_points: (optional) The list of - report violations data points. + :param str resource_kind: (optional) The supported config resource kind. + :param List[AdditionalTargetAttribute] additional_target_attributes: + (optional) The supported config list of additional target attributes. + :param List[RuleProperty] properties: (optional) The supported config list + properties. + :param str description: (optional) The supported config description. + :param bool cip_requires_service_instance: (optional) The indication of + whether the configuration information point (CIP) requires a service + instance. + :param bool resource_group_support: (optional) The supported config + resource group support. + :param bool tagging_support: (optional) The supported config tagging + support. + :param bool inherit_tags: (optional) The supported config inherited tags. """ - self.home_account_id = home_account_id - self.report_id = report_id - self.data_points = data_points + self.resource_kind = resource_kind + self.additional_target_attributes = additional_target_attributes + self.properties = properties + self.description = description + self.cip_requires_service_instance = cip_requires_service_instance + self.resource_group_support = resource_group_support + self.tagging_support = tagging_support + self.inherit_tags = inherit_tags @classmethod - def from_dict(cls, _dict: Dict) -> 'ReportViolationsDrift': - """Initialize a ReportViolationsDrift object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'SupportedConfigs': + """Initialize a SupportedConfigs object from a json dictionary.""" args = {} - if 'home_account_id' in _dict: - args['home_account_id'] = _dict.get('home_account_id') - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'data_points' in _dict: - args['data_points'] = [ReportViolationDataPoint.from_dict(v) for v in _dict.get('data_points')] + if (resource_kind := _dict.get('resource_kind')) is not None: + args['resource_kind'] = resource_kind + if (additional_target_attributes := _dict.get('additional_target_attributes')) is not None: + args['additional_target_attributes'] = [AdditionalTargetAttribute.from_dict(v) for v in additional_target_attributes] + if (properties := _dict.get('properties')) is not None: + args['properties'] = [RuleProperty.from_dict(v) for v in properties] + if (description := _dict.get('description')) is not None: + args['description'] = description + if (cip_requires_service_instance := _dict.get('cip_requires_service_instance')) is not None: + args['cip_requires_service_instance'] = cip_requires_service_instance + if (resource_group_support := _dict.get('resource_group_support')) is not None: + args['resource_group_support'] = resource_group_support + if (tagging_support := _dict.get('tagging_support')) is not None: + args['tagging_support'] = tagging_support + if (inherit_tags := _dict.get('inherit_tags')) is not None: + args['inherit_tags'] = inherit_tags return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ReportViolationsDrift object from a json dictionary.""" + """Initialize a SupportedConfigs 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, 'home_account_id') and self.home_account_id is not None: - _dict['home_account_id'] = self.home_account_id - if hasattr(self, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'data_points') and self.data_points is not None: - data_points_list = [] - for v in self.data_points: + if hasattr(self, 'resource_kind') and self.resource_kind is not None: + _dict['resource_kind'] = self.resource_kind + if hasattr(self, 'additional_target_attributes') and self.additional_target_attributes is not None: + additional_target_attributes_list = [] + for v in self.additional_target_attributes: if isinstance(v, dict): - data_points_list.append(v) + additional_target_attributes_list.append(v) else: - data_points_list.append(v.to_dict()) - _dict['data_points'] = data_points_list + additional_target_attributes_list.append(v.to_dict()) + _dict['additional_target_attributes'] = additional_target_attributes_list + if hasattr(self, 'properties') and self.properties is not None: + properties_list = [] + for v in self.properties: + if isinstance(v, dict): + properties_list.append(v) + else: + properties_list.append(v.to_dict()) + _dict['properties'] = properties_list + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'cip_requires_service_instance') and self.cip_requires_service_instance is not None: + _dict['cip_requires_service_instance'] = self.cip_requires_service_instance + if hasattr(self, 'resource_group_support') and self.resource_group_support is not None: + _dict['resource_group_support'] = self.resource_group_support + if hasattr(self, 'tagging_support') and self.tagging_support is not None: + _dict['tagging_support'] = self.tagging_support + if hasattr(self, 'inherit_tags') and self.inherit_tags is not None: + _dict['inherit_tags'] = self.inherit_tags return _dict def _to_dict(self): @@ -10388,192 +16424,213 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ReportViolationsDrift object.""" + """Return a `str` version of this SupportedConfigs object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ReportViolationsDrift') -> bool: + def __eq__(self, other: 'SupportedConfigs') -> 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: 'ReportViolationsDrift') -> bool: + def __ne__(self, other: 'SupportedConfigs') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RequiredConfig: +class Tags: """ - The required configurations. + The collection of different types of tags. + :param List[str] user: (optional) The collection of user tags. + :param List[str] access: (optional) The collection of access tags. + :param List[str] service: (optional) The collection of service tags. """ def __init__( self, + *, + user: Optional[List[str]] = None, + access: Optional[List[str]] = None, + service: Optional[List[str]] = None, ) -> None: """ - Initialize a RequiredConfig object. + Initialize a Tags object. + :param List[str] user: (optional) The collection of user tags. + :param List[str] access: (optional) The collection of access tags. + :param List[str] service: (optional) The collection of service tags. """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['RequiredConfigRequiredConfigAnd', 'RequiredConfigRequiredConfigOr', 'RequiredConfigRequiredConfigBase']) - ) - raise Exception(msg) + self.user = user + self.access = access + self.service = service + @classmethod + def from_dict(cls, _dict: Dict) -> 'Tags': + """Initialize a Tags object from a json dictionary.""" + args = {} + if (user := _dict.get('user')) is not None: + args['user'] = user + if (access := _dict.get('access')) is not None: + args['access'] = access + if (service := _dict.get('service')) is not None: + args['service'] = service + return cls(**args) -class RequiredConfigItems: - """ - RequiredConfigItems. + @classmethod + def _from_dict(cls, _dict): + """Initialize a Tags 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, 'user') and self.user is not None: + _dict['user'] = self.user + if hasattr(self, 'access') and self.access is not None: + _dict['access'] = self.access + if hasattr(self, 'service') and self.service is not None: + _dict['service'] = self.service + return _dict - def __init__( - self, - ) -> None: - """ - Initialize a RequiredConfigItems object. + def _to_dict(self): + """Return a json dictionary representing this model.""" + return self.to_dict() - """ - msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( - ", ".join(['RequiredConfigItemsRequiredConfigOr', 'RequiredConfigItemsRequiredConfigAnd', 'RequiredConfigItemsRequiredConfigBase']) - ) - raise Exception(msg) + def __str__(self) -> str: + """Return a `str` version of this Tags object.""" + return json.dumps(self.to_dict(), indent=2) + def __eq__(self, other: 'Tags') -> 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 Resource: - """ - The resource. + def __ne__(self, other: 'Tags') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other - :attr str report_id: (optional) The ID of the report. - :attr str id: (optional) The resource CRN. - :attr str resource_name: (optional) The resource name. - :attr str component_id: (optional) The ID of the component. - :attr str environment: (optional) The environment. - :attr Account account: (optional) The account that is associated with a report. - :attr str status: (optional) The allowed values of an aggregated status for - controls, specifications, assessments, and resources. - :attr int total_count: (optional) The total number of evaluations. - :attr int pass_count: (optional) The number of passed evaluations. - :attr int failure_count: (optional) The number of failed evaluations. - :attr int error_count: (optional) The number of evaluations that started, but - did not finish, and ended with errors. - :attr int completed_count: (optional) The total number of completed evaluations. + +class Target: + """ + The details of the target account. + + :param str id: The UUID of the target. + :param str account_id: The target account ID. + :param str trusted_profile_id: The trusted profile ID. + :param str name: The target name. + :param List[CredentialResponse] credentials: List of credentials. + :param str created_by: (optional) The user ID who created the target. + :param datetime created_on: (optional) The time when the target was created. + :param str updated_by: (optional) The user ID who updated the target. + :param datetime updated_on: (optional) The time when the target was updated. """ def __init__( self, + id: str, + account_id: str, + trusted_profile_id: str, + name: str, + credentials: List['CredentialResponse'], *, - report_id: str = None, - id: str = None, - resource_name: str = None, - component_id: str = None, - environment: str = None, - account: 'Account' = None, - status: str = None, - total_count: int = None, - pass_count: int = None, - failure_count: int = None, - error_count: int = None, - completed_count: int = None, + created_by: Optional[str] = None, + created_on: Optional[datetime] = None, + updated_by: Optional[str] = None, + updated_on: Optional[datetime] = None, ) -> None: """ - Initialize a Resource object. + Initialize a Target object. - :param str report_id: (optional) The ID of the report. - :param str id: (optional) The resource CRN. - :param str resource_name: (optional) The resource name. - :param str component_id: (optional) The ID of the component. - :param str environment: (optional) The environment. - :param Account account: (optional) The account that is associated with a - report. - :param str status: (optional) The allowed values of an aggregated status - for controls, specifications, assessments, and resources. - :param int total_count: (optional) The total number of evaluations. - :param int pass_count: (optional) The number of passed evaluations. - :param int failure_count: (optional) The number of failed evaluations. - :param int error_count: (optional) The number of evaluations that started, - but did not finish, and ended with errors. - :param int completed_count: (optional) The total number of completed - evaluations. + :param str id: The UUID of the target. + :param str account_id: The target account ID. + :param str trusted_profile_id: The trusted profile ID. + :param str name: The target name. + :param List[CredentialResponse] credentials: List of credentials. + :param str created_by: (optional) The user ID who created the target. + :param datetime created_on: (optional) The time when the target was + created. + :param str updated_by: (optional) The user ID who updated the target. + :param datetime updated_on: (optional) The time when the target was + updated. """ - self.report_id = report_id self.id = id - self.resource_name = resource_name - self.component_id = component_id - self.environment = environment - self.account = account - self.status = status - self.total_count = total_count - self.pass_count = pass_count - self.failure_count = failure_count - self.error_count = error_count - self.completed_count = completed_count + self.account_id = account_id + self.trusted_profile_id = trusted_profile_id + self.name = name + self.credentials = credentials + self.created_by = created_by + self.created_on = created_on + self.updated_by = updated_by + self.updated_on = updated_on @classmethod - def from_dict(cls, _dict: Dict) -> 'Resource': - """Initialize a Resource object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'Target': + """Initialize a Target object from a json dictionary.""" args = {} - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'resource_name' in _dict: - args['resource_name'] = _dict.get('resource_name') - if 'component_id' in _dict: - args['component_id'] = _dict.get('component_id') - if 'environment' in _dict: - args['environment'] = _dict.get('environment') - if 'account' in _dict: - args['account'] = Account.from_dict(_dict.get('account')) - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'pass_count' in _dict: - args['pass_count'] = _dict.get('pass_count') - if 'failure_count' in _dict: - args['failure_count'] = _dict.get('failure_count') - if 'error_count' in _dict: - args['error_count'] = _dict.get('error_count') - if 'completed_count' in _dict: - args['completed_count'] = _dict.get('completed_count') + if (id := _dict.get('id')) is not None: + args['id'] = id + else: + raise ValueError('Required property \'id\' not present in Target 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 Target JSON') + if (trusted_profile_id := _dict.get('trusted_profile_id')) is not None: + args['trusted_profile_id'] = trusted_profile_id + else: + raise ValueError('Required property \'trusted_profile_id\' not present in Target JSON') + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in Target JSON') + if (credentials := _dict.get('credentials')) is not None: + args['credentials'] = [CredentialResponse.from_dict(v) for v in credentials] + else: + raise ValueError('Required property \'credentials\' not present in Target JSON') + if (created_by := _dict.get('created_by')) is not None: + args['created_by'] = created_by + if (created_on := _dict.get('created_on')) is not None: + args['created_on'] = string_to_datetime(created_on) + if (updated_by := _dict.get('updated_by')) is not None: + args['updated_by'] = updated_by + if (updated_on := _dict.get('updated_on')) is not None: + args['updated_on'] = string_to_datetime(updated_on) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Resource object from a json dictionary.""" + """Initialize a Target 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, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id if hasattr(self, 'id') and self.id is not None: _dict['id'] = self.id - if hasattr(self, 'resource_name') and self.resource_name is not None: - _dict['resource_name'] = self.resource_name - if hasattr(self, 'component_id') and self.component_id is not None: - _dict['component_id'] = self.component_id - if hasattr(self, 'environment') and self.environment is not None: - _dict['environment'] = self.environment - if hasattr(self, 'account') and self.account is not None: - if isinstance(self.account, dict): - _dict['account'] = self.account - else: - _dict['account'] = self.account.to_dict() - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'pass_count') and self.pass_count is not None: - _dict['pass_count'] = self.pass_count - if hasattr(self, 'failure_count') and self.failure_count is not None: - _dict['failure_count'] = self.failure_count - if hasattr(self, 'error_count') and self.error_count is not None: - _dict['error_count'] = self.error_count - if hasattr(self, 'completed_count') and self.completed_count is not None: - _dict['completed_count'] = self.completed_count + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'trusted_profile_id') and self.trusted_profile_id is not None: + _dict['trusted_profile_id'] = self.trusted_profile_id + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'credentials') and self.credentials is not None: + credentials_list = [] + for v in self.credentials: + if isinstance(v, dict): + credentials_list.append(v) + else: + credentials_list.append(v.to_dict()) + _dict['credentials'] = credentials_list + if hasattr(self, 'created_by') and self.created_by is not None: + _dict['created_by'] = self.created_by + if hasattr(self, 'created_on') and self.created_on is not None: + _dict['created_on'] = datetime_to_string(self.created_on) + if hasattr(self, 'updated_by') and self.updated_by is not None: + _dict['updated_by'] = self.updated_by + if hasattr(self, 'updated_on') and self.updated_on is not None: + _dict['updated_on'] = datetime_to_string(self.updated_on) return _dict def _to_dict(self): @@ -10581,124 +16638,91 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Resource object.""" + """Return a `str` version of this Target object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Resource') -> bool: + def __eq__(self, other: 'Target') -> 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: 'Resource') -> bool: + def __ne__(self, other: 'Target') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): - """ - The allowed values of an aggregated status for controls, specifications, - assessments, and resources. - """ - - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' - - -class ResourcePage: +class TargetCollection: """ - The page of resource evaluation summaries. - - :attr int total_count: The total number of resources that are in the collection. - :attr int limit: The requested page limi.t. - :attr str start: (optional) The token of the next page, when it's present. - :attr PageHRef first: The page reference. - :attr PageHRef next: (optional) The page reference. - :attr str home_account_id: (optional) The ID of the home account. - :attr str report_id: (optional) The ID of the report. - :attr List[Resource] resources: (optional) The list of resource evaluation - summaries that are on the page. + The target list collection. + + :param int limit: The requested page limit. + :param int total_count: The total number of resources that are in the + collection. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. + :param List[Target] targets: The details of the target account. """ def __init__( self, - total_count: int, limit: int, - first: 'PageHRef', + total_count: int, + targets: List['Target'], *, - start: str = None, - next: 'PageHRef' = None, - home_account_id: str = None, - report_id: str = None, - resources: List['Resource'] = None, + first: Optional['PageHRefFirst'] = None, + next: Optional['PageHRefNext'] = None, ) -> None: """ - Initialize a ResourcePage object. + Initialize a TargetCollection object. + :param int limit: The requested page limit. :param int total_count: The total number of resources that are in the - collection. - :param int limit: The requested page limi.t. - :param PageHRef first: The page reference. - :param str start: (optional) The token of the next page, when it's present. - :param PageHRef next: (optional) The page reference. - :param str home_account_id: (optional) The ID of the home account. - :param str report_id: (optional) The ID of the report. - :param List[Resource] resources: (optional) The list of resource evaluation - summaries that are on the page. + collection. + :param List[Target] targets: The details of the target account. + :param PageHRefFirst first: (optional) A page reference. + :param PageHRefNext next: (optional) A page reference. """ - self.total_count = total_count self.limit = limit - self.start = start + self.total_count = total_count self.first = first self.next = next - self.home_account_id = home_account_id - self.report_id = report_id - self.resources = resources + self.targets = targets @classmethod - def from_dict(cls, _dict: Dict) -> 'ResourcePage': - """Initialize a ResourcePage object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'TargetCollection': + """Initialize a TargetCollection object from a json dictionary.""" args = {} - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') + if (limit := _dict.get('limit')) is not None: + args['limit'] = limit else: - raise ValueError('Required property \'total_count\' not present in ResourcePage JSON') - if 'limit' in _dict: - args['limit'] = _dict.get('limit') + raise ValueError('Required property \'limit\' not present in TargetCollection JSON') + if (total_count := _dict.get('total_count')) is not None: + args['total_count'] = total_count else: - raise ValueError('Required property \'limit\' not present in ResourcePage JSON') - if 'start' in _dict: - args['start'] = _dict.get('start') - if 'first' in _dict: - args['first'] = PageHRef.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in ResourcePage JSON') - if 'next' in _dict: - args['next'] = PageHRef.from_dict(_dict.get('next')) - if 'home_account_id' in _dict: - args['home_account_id'] = _dict.get('home_account_id') - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'resources' in _dict: - args['resources'] = [Resource.from_dict(v) for v in _dict.get('resources')] + raise ValueError('Required property \'total_count\' not present in TargetCollection JSON') + if (first := _dict.get('first')) is not None: + args['first'] = PageHRefFirst.from_dict(first) + if (next := _dict.get('next')) is not None: + args['next'] = PageHRefNext.from_dict(next) + if (targets := _dict.get('targets')) is not None: + args['targets'] = [Target.from_dict(v) for v in targets] + else: + raise ValueError('Required property \'targets\' not present in TargetCollection JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ResourcePage object from a json dictionary.""" + """Initialize a TargetCollection 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, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count if hasattr(self, 'limit') and self.limit is not None: _dict['limit'] = self.limit - if hasattr(self, 'start') and self.start is not None: - _dict['start'] = self.start + if hasattr(self, 'total_count') and self.total_count is not None: + _dict['total_count'] = self.total_count if hasattr(self, 'first') and self.first is not None: if isinstance(self.first, dict): _dict['first'] = self.first @@ -10709,18 +16733,14 @@ def to_dict(self) -> Dict: _dict['next'] = self.next else: _dict['next'] = self.next.to_dict() - if hasattr(self, 'home_account_id') and self.home_account_id is not None: - _dict['home_account_id'] = self.home_account_id - if hasattr(self, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'resources') and self.resources is not None: - resources_list = [] - for v in self.resources: + if hasattr(self, 'targets') and self.targets is not None: + targets_list = [] + for v in self.targets: if isinstance(v, dict): - resources_list.append(v) + targets_list.append(v) else: - resources_list.append(v.to_dict()) - _dict['resources'] = resources_list + targets_list.append(v.to_dict()) + _dict['targets'] = targets_list return _dict def _to_dict(self): @@ -10728,121 +16748,109 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ResourcePage object.""" + """Return a `str` version of this TargetCollection object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ResourcePage') -> bool: + def __eq__(self, other: 'TargetCollection') -> 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: 'ResourcePage') -> bool: + def __ne__(self, other: 'TargetCollection') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class ResourceSummary: +class TargetInfo: """ - The resource summary. + The evaluation target. - :attr str status: (optional) The allowed values of an aggregated status for - controls, specifications, assessments, and resources. - :attr int total_count: (optional) The total number of checks. - :attr int compliant_count: (optional) The number of compliant checks. - :attr int not_compliant_count: (optional) The number of checks that are not - compliant. - :attr int unable_to_perform_count: (optional) The number of checks that are - unable to perform. - :attr int user_evaluation_required_count: (optional) The number of checks that - require a user evaluation. - :attr List[ResourceSummaryItem] top_failed: (optional) The top 10 resources that - have the most failures. + :param str id: (optional) The target ID. + :param str account_id: (optional) The target account ID. + :param str service_name: (optional) The target service name. + :param str service_display_name: (optional) The target service display name. + :param str resource_crn: (optional) The target resource CRN. + :param str resource_name: (optional) The target resource name. + :param Tags tags: (optional) The collection of different types of tags. """ def __init__( self, *, - status: str = None, - total_count: int = None, - compliant_count: int = None, - not_compliant_count: int = None, - unable_to_perform_count: int = None, - user_evaluation_required_count: int = None, - top_failed: List['ResourceSummaryItem'] = None, + id: Optional[str] = None, + account_id: Optional[str] = None, + service_name: Optional[str] = None, + service_display_name: Optional[str] = None, + resource_crn: Optional[str] = None, + resource_name: Optional[str] = None, + tags: Optional['Tags'] = None, ) -> None: """ - Initialize a ResourceSummary object. + Initialize a TargetInfo object. - :param str status: (optional) The allowed values of an aggregated status - for controls, specifications, assessments, and resources. - :param int total_count: (optional) The total number of checks. - :param int compliant_count: (optional) The number of compliant checks. - :param int not_compliant_count: (optional) The number of checks that are - not compliant. - :param int unable_to_perform_count: (optional) The number of checks that - are unable to perform. - :param int user_evaluation_required_count: (optional) The number of checks - that require a user evaluation. - :param List[ResourceSummaryItem] top_failed: (optional) The top 10 - resources that have the most failures. + :param str id: (optional) The target ID. + :param str account_id: (optional) The target account ID. + :param str service_name: (optional) The target service name. + :param str service_display_name: (optional) The target service display + name. + :param str resource_crn: (optional) The target resource CRN. + :param str resource_name: (optional) The target resource name. + :param Tags tags: (optional) The collection of different types of tags. """ - self.status = status - self.total_count = total_count - self.compliant_count = compliant_count - self.not_compliant_count = not_compliant_count - self.unable_to_perform_count = unable_to_perform_count - self.user_evaluation_required_count = user_evaluation_required_count - self.top_failed = top_failed + self.id = id + self.account_id = account_id + self.service_name = service_name + self.service_display_name = service_display_name + self.resource_crn = resource_crn + self.resource_name = resource_name + self.tags = tags @classmethod - def from_dict(cls, _dict: Dict) -> 'ResourceSummary': - """Initialize a ResourceSummary object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'TargetInfo': + """Initialize a TargetInfo object from a json dictionary.""" args = {} - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'compliant_count' in _dict: - args['compliant_count'] = _dict.get('compliant_count') - if 'not_compliant_count' in _dict: - args['not_compliant_count'] = _dict.get('not_compliant_count') - if 'unable_to_perform_count' in _dict: - args['unable_to_perform_count'] = _dict.get('unable_to_perform_count') - if 'user_evaluation_required_count' in _dict: - args['user_evaluation_required_count'] = _dict.get('user_evaluation_required_count') - if 'top_failed' in _dict: - args['top_failed'] = [ResourceSummaryItem.from_dict(v) for v in _dict.get('top_failed')] + if (id := _dict.get('id')) is not None: + args['id'] = id + if (account_id := _dict.get('account_id')) is not None: + args['account_id'] = account_id + if (service_name := _dict.get('service_name')) is not None: + args['service_name'] = service_name + if (service_display_name := _dict.get('service_display_name')) is not None: + args['service_display_name'] = service_display_name + if (resource_crn := _dict.get('resource_crn')) is not None: + args['resource_crn'] = resource_crn + if (resource_name := _dict.get('resource_name')) is not None: + args['resource_name'] = resource_name + if (tags := _dict.get('tags')) is not None: + args['tags'] = Tags.from_dict(tags) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ResourceSummary object from a json dictionary.""" + """Initialize a TargetInfo 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, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'compliant_count') and self.compliant_count is not None: - _dict['compliant_count'] = self.compliant_count - if hasattr(self, 'not_compliant_count') and self.not_compliant_count is not None: - _dict['not_compliant_count'] = self.not_compliant_count - if hasattr(self, 'unable_to_perform_count') and self.unable_to_perform_count is not None: - _dict['unable_to_perform_count'] = self.unable_to_perform_count - if hasattr(self, 'user_evaluation_required_count') and self.user_evaluation_required_count is not None: - _dict['user_evaluation_required_count'] = self.user_evaluation_required_count - if hasattr(self, 'top_failed') and self.top_failed is not None: - top_failed_list = [] - for v in self.top_failed: - if isinstance(v, dict): - top_failed_list.append(v) - else: - top_failed_list.append(v.to_dict()) - _dict['top_failed'] = top_failed_list + if hasattr(self, 'id') and self.id is not None: + _dict['id'] = self.id + if hasattr(self, 'account_id') and self.account_id is not None: + _dict['account_id'] = self.account_id + if hasattr(self, 'service_name') and self.service_name is not None: + _dict['service_name'] = self.service_name + if hasattr(self, 'service_display_name') and self.service_display_name is not None: + _dict['service_display_name'] = self.service_display_name + if hasattr(self, 'resource_crn') and self.resource_crn is not None: + _dict['resource_crn'] = self.resource_crn + if hasattr(self, 'resource_name') and self.resource_name is not None: + _dict['resource_name'] = self.resource_name + if hasattr(self, 'tags') and self.tags is not None: + if isinstance(self.tags, dict): + _dict['tags'] = self.tags + else: + _dict['tags'] = self.tags.to_dict() return _dict def _to_dict(self): @@ -10850,157 +16858,147 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ResourceSummary object.""" + """Return a `str` version of this TargetInfo object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ResourceSummary') -> bool: + def __eq__(self, other: 'TargetInfo') -> 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: 'ResourceSummary') -> bool: + def __ne__(self, other: 'TargetInfo') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): + +class TestEvent: + """ + The details of a test event response. + + :param bool success: The indication of whether the event was received by Event + Notifications. + """ + + def __init__( + self, + success: bool, + ) -> None: """ - The allowed values of an aggregated status for controls, specifications, - assessments, and resources. + Initialize a TestEvent object. + + :param bool success: The indication of whether the event was received by + Event Notifications. """ + self.success = success - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' + @classmethod + def from_dict(cls, _dict: Dict) -> 'TestEvent': + """Initialize a TestEvent object from a json dictionary.""" + args = {} + if (success := _dict.get('success')) is not None: + args['success'] = success + else: + raise ValueError('Required property \'success\' not present in TestEvent JSON') + return cls(**args) + + @classmethod + def _from_dict(cls, _dict): + """Initialize a TestEvent 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, 'success') and self.success is not None: + _dict['success'] = self.success + 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 TestEvent object.""" + return json.dumps(self.to_dict(), indent=2) -class ResourceSummaryItem: + def __eq__(self, other: 'TestEvent') -> 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: 'TestEvent') -> bool: + """Return `true` when self and other are not equal, false otherwise.""" + return not self == other + + +class ConditionItemConditionBase(ConditionItem): """ - The resource summary item. + The required configuration base object. - :attr str name: (optional) The resource name. - :attr str id: (optional) The resource ID. - :attr str service: (optional) The service that is managing the resource. - :attr Tags tags: (optional) The collection of different types of tags. - :attr str account: (optional) The account that owns the resource. - :attr str status: (optional) The allowed values of an aggregated status for - controls, specifications, assessments, and resources. - :attr int total_count: (optional) The total number of evaluations. - :attr int pass_count: (optional) The number of passed evaluations. - :attr int failure_count: (optional) The number of failed evaluations. - :attr int error_count: (optional) The number of evaluations that started, but - did not finish, and ended with errors. - :attr int completed_count: (optional) The total number of completed evaluations. + :param str description: (optional) The required config description. + :param str property: The property. + :param str operator: The operator. + :param object value: (optional) """ def __init__( self, + property: str, + operator: str, *, - name: str = None, - id: str = None, - service: str = None, - tags: 'Tags' = None, - account: str = None, - status: str = None, - total_count: int = None, - pass_count: int = None, - failure_count: int = None, - error_count: int = None, - completed_count: int = None, + description: Optional[str] = None, + value: Optional[object] = None, ) -> None: """ - Initialize a ResourceSummaryItem object. + Initialize a ConditionItemConditionBase object. - :param str name: (optional) The resource name. - :param str id: (optional) The resource ID. - :param str service: (optional) The service that is managing the resource. - :param Tags tags: (optional) The collection of different types of tags. - :param str account: (optional) The account that owns the resource. - :param str status: (optional) The allowed values of an aggregated status - for controls, specifications, assessments, and resources. - :param int total_count: (optional) The total number of evaluations. - :param int pass_count: (optional) The number of passed evaluations. - :param int failure_count: (optional) The number of failed evaluations. - :param int error_count: (optional) The number of evaluations that started, - but did not finish, and ended with errors. - :param int completed_count: (optional) The total number of completed - evaluations. + :param str property: The property. + :param str operator: The operator. + :param str description: (optional) The required config description. + :param object value: (optional) """ - self.name = name - self.id = id - self.service = service - self.tags = tags - self.account = account - self.status = status - self.total_count = total_count - self.pass_count = pass_count - self.failure_count = failure_count - self.error_count = error_count - self.completed_count = completed_count + # pylint: disable=super-init-not-called + self.description = description + self.property = property + self.operator = operator + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'ResourceSummaryItem': - """Initialize a ResourceSummaryItem object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ConditionItemConditionBase': + """Initialize a ConditionItemConditionBase object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'service' in _dict: - args['service'] = _dict.get('service') - if 'tags' in _dict: - args['tags'] = Tags.from_dict(_dict.get('tags')) - if 'account' in _dict: - args['account'] = _dict.get('account') - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - if 'pass_count' in _dict: - args['pass_count'] = _dict.get('pass_count') - if 'failure_count' in _dict: - args['failure_count'] = _dict.get('failure_count') - if 'error_count' in _dict: - args['error_count'] = _dict.get('error_count') - if 'completed_count' in _dict: - args['completed_count'] = _dict.get('completed_count') + if (description := _dict.get('description')) is not None: + args['description'] = description + if (property := _dict.get('property')) is not None: + args['property'] = property + else: + raise ValueError('Required property \'property\' not present in ConditionItemConditionBase JSON') + if (operator := _dict.get('operator')) is not None: + args['operator'] = operator + else: + raise ValueError('Required property \'operator\' not present in ConditionItemConditionBase JSON') + if (value := _dict.get('value')) is not None: + args['value'] = value return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ResourceSummaryItem object from a json dictionary.""" + """Initialize a ConditionItemConditionBase 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, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'service') and self.service is not None: - _dict['service'] = self.service - if hasattr(self, 'tags') and self.tags is not None: - if isinstance(self.tags, dict): - _dict['tags'] = self.tags - else: - _dict['tags'] = self.tags.to_dict() - if hasattr(self, 'account') and self.account is not None: - _dict['account'] = self.account - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'pass_count') and self.pass_count is not None: - _dict['pass_count'] = self.pass_count - if hasattr(self, 'failure_count') and self.failure_count is not None: - _dict['failure_count'] = self.failure_count - if hasattr(self, 'error_count') and self.error_count is not None: - _dict['error_count'] = self.error_count - if hasattr(self, 'completed_count') and self.completed_count is not None: - _dict['completed_count'] = self.completed_count + """Return a json dictionary representing this model.""" + _dict = {} + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'property') and self.property is not None: + _dict['property'] = self.property + 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): @@ -11008,200 +17006,156 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ResourceSummaryItem object.""" + """Return a `str` version of this ConditionItemConditionBase object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ResourceSummaryItem') -> bool: + def __eq__(self, other: 'ConditionItemConditionBase') -> 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: 'ResourceSummaryItem') -> bool: + def __ne__(self, other: 'ConditionItemConditionBase') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): + class OperatorEnum(str, Enum): """ - The allowed values of an aggregated status for controls, specifications, - assessments, and resources. + The operator. """ - COMPLIANT = 'compliant' - NOT_COMPLIANT = 'not_compliant' - UNABLE_TO_PERFORM = 'unable_to_perform' - USER_EVALUATION_REQUIRED = 'user_evaluation_required' + STRING_EQUALS = 'string_equals' + STRING_NOT_EQUALS = 'string_not_equals' + STRING_MATCH = 'string_match' + STRING_NOT_MATCH = 'string_not_match' + STRING_CONTAINS = 'string_contains' + STRING_NOT_CONTAINS = 'string_not_contains' + NUM_EQUALS = 'num_equals' + NUM_NOT_EQUALS = 'num_not_equals' + NUM_LESS_THAN = 'num_less_than' + NUM_LESS_THAN_EQUALS = 'num_less_than_equals' + NUM_GREATER_THAN = 'num_greater_than' + NUM_GREATER_THAN_EQUALS = 'num_greater_than_equals' + IS_EMPTY = 'is_empty' + IS_NOT_EMPTY = 'is_not_empty' + IS_TRUE = 'is_true' + IS_FALSE = 'is_false' + STRINGS_IN_LIST = 'strings_in_list' + STRINGS_ALLOWED = 'strings_allowed' + STRINGS_REQUIRED = 'strings_required' + IPS_IN_RANGE = 'ips_in_range' + IPS_EQUALS = 'ips_equals' + IPS_NOT_EQUALS = 'ips_not_equals' + DAYS_LESS_THAN = 'days_less_than' -class Rule: +class ConditionItemConditionList(ConditionItem): """ - The rule response that corresponds to an account instance. + A list of required configurations. - :attr datetime created_on: The date when the rule was created. - :attr str created_by: The user who created the rule. - :attr datetime updated_on: The date when the rule was modified. - :attr str updated_by: The user who modified the rule. - :attr str id: The rule ID. - :attr str account_id: The account ID. - :attr str description: The details of a rule's response. - :attr str type: The rule type (allowable values are `user_defined` or - `system_defined`). - :attr str version: The version number of a rule. - :attr Import import_: (optional) The collection of import parameters. - :attr Target target: The rule target. - :attr RequiredConfig required_config: The required configurations. - :attr List[str] labels: The list of labels. """ def __init__( self, - created_on: datetime, - created_by: str, - updated_on: datetime, - updated_by: str, - id: str, - account_id: str, - description: str, - type: str, - version: str, - target: 'Target', - required_config: 'RequiredConfig', - labels: List[str], + ) -> None: + """ + Initialize a ConditionItemConditionList object. + + """ + # pylint: disable=super-init-not-called + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ConditionItemConditionListConditionListConditionOr', 'ConditionItemConditionListConditionListConditionAnd']) + ) + raise Exception(msg) + + +class ConditionItemConditionSubRule(ConditionItem): + """ + ConditionItemConditionSubRule. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a ConditionItemConditionSubRule object. + + """ + # pylint: disable=super-init-not-called + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['ConditionItemConditionSubRuleConditionSubRuleConditionAny', 'ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf', 'ConditionItemConditionSubRuleConditionSubRuleConditionAll', 'ConditionItemConditionSubRuleConditionSubRuleConditionAllIf']) + ) + raise Exception(msg) + + +class RequiredConfigConditionBase(RequiredConfig): + """ + The required configuration base object. + + :param str description: (optional) The required config description. + :param str property: The property. + :param str operator: The operator. + :param object value: (optional) + """ + + def __init__( + self, + property: str, + operator: str, *, - import_: 'Import' = None, + description: Optional[str] = None, + value: Optional[object] = None, ) -> None: """ - Initialize a Rule object. + Initialize a RequiredConfigConditionBase object. - :param datetime created_on: The date when the rule was created. - :param str created_by: The user who created the rule. - :param datetime updated_on: The date when the rule was modified. - :param str updated_by: The user who modified the rule. - :param str id: The rule ID. - :param str account_id: The account ID. - :param str description: The details of a rule's response. - :param str type: The rule type (allowable values are `user_defined` or - `system_defined`). - :param str version: The version number of a rule. - :param Target target: The rule target. - :param RequiredConfig required_config: The required configurations. - :param List[str] labels: The list of labels. - :param Import import_: (optional) The collection of import parameters. + :param str property: The property. + :param str operator: The operator. + :param str description: (optional) The required config description. + :param object value: (optional) """ - self.created_on = created_on - self.created_by = created_by - self.updated_on = updated_on - self.updated_by = updated_by - self.id = id - self.account_id = account_id + # pylint: disable=super-init-not-called self.description = description - self.type = type - self.version = version - self.import_ = import_ - self.target = target - self.required_config = required_config - self.labels = labels + self.property = property + self.operator = operator + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'Rule': - """Initialize a Rule object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RequiredConfigConditionBase': + """Initialize a RequiredConfigConditionBase object from a json dictionary.""" args = {} - if 'created_on' in _dict: - args['created_on'] = string_to_datetime(_dict.get('created_on')) + if (description := _dict.get('description')) is not None: + args['description'] = description + if (property := _dict.get('property')) is not None: + args['property'] = property else: - raise ValueError('Required property \'created_on\' not present in Rule JSON') - if 'created_by' in _dict: - args['created_by'] = _dict.get('created_by') - else: - raise ValueError('Required property \'created_by\' not present in Rule JSON') - if 'updated_on' in _dict: - args['updated_on'] = string_to_datetime(_dict.get('updated_on')) - else: - raise ValueError('Required property \'updated_on\' not present in Rule JSON') - if 'updated_by' in _dict: - args['updated_by'] = _dict.get('updated_by') - else: - raise ValueError('Required property \'updated_by\' not present in Rule JSON') - if 'id' in _dict: - args['id'] = _dict.get('id') - else: - raise ValueError('Required property \'id\' not present in Rule JSON') - if 'account_id' in _dict: - args['account_id'] = _dict.get('account_id') - else: - raise ValueError('Required property \'account_id\' not present in Rule JSON') - if 'description' in _dict: - args['description'] = _dict.get('description') - else: - raise ValueError('Required property \'description\' not present in Rule JSON') - if 'type' in _dict: - args['type'] = _dict.get('type') - else: - raise ValueError('Required property \'type\' not present in Rule JSON') - if 'version' in _dict: - args['version'] = _dict.get('version') - else: - raise ValueError('Required property \'version\' not present in Rule JSON') - if 'import' in _dict: - args['import_'] = Import.from_dict(_dict.get('import')) - if 'target' in _dict: - args['target'] = Target.from_dict(_dict.get('target')) - else: - raise ValueError('Required property \'target\' not present in Rule JSON') - if 'required_config' in _dict: - args['required_config'] = _dict.get('required_config') - else: - raise ValueError('Required property \'required_config\' not present in Rule JSON') - if 'labels' in _dict: - args['labels'] = _dict.get('labels') + raise ValueError('Required property \'property\' not present in RequiredConfigConditionBase JSON') + if (operator := _dict.get('operator')) is not None: + args['operator'] = operator else: - raise ValueError('Required property \'labels\' not present in Rule JSON') + raise ValueError('Required property \'operator\' not present in RequiredConfigConditionBase JSON') + if (value := _dict.get('value')) is not None: + args['value'] = value return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Rule object from a json dictionary.""" + """Initialize a RequiredConfigConditionBase 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_on') and self.created_on is not None: - _dict['created_on'] = datetime_to_string(self.created_on) - if hasattr(self, 'created_by') and self.created_by is not None: - _dict['created_by'] = self.created_by - if hasattr(self, 'updated_on') and self.updated_on is not None: - _dict['updated_on'] = datetime_to_string(self.updated_on) - if hasattr(self, 'updated_by') and self.updated_by is not None: - _dict['updated_by'] = self.updated_by - if hasattr(self, 'id') and self.id is not None: - _dict['id'] = self.id - if hasattr(self, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id if hasattr(self, 'description') and self.description is not None: _dict['description'] = self.description - if hasattr(self, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'version') and self.version is not None: - _dict['version'] = self.version - if hasattr(self, 'import_') and self.import_ is not None: - if isinstance(self.import_, dict): - _dict['import'] = self.import_ - else: - _dict['import'] = self.import_.to_dict() - if hasattr(self, 'target') and self.target is not None: - if isinstance(self.target, dict): - _dict['target'] = self.target - else: - _dict['target'] = self.target.to_dict() - if hasattr(self, 'required_config') and self.required_config is not None: - if isinstance(self.required_config, dict): - _dict['required_config'] = self.required_config - else: - _dict['required_config'] = self.required_config.to_dict() - if hasattr(self, 'labels') and self.labels is not None: - _dict['labels'] = self.labels + if hasattr(self, 'property') and self.property is not None: + _dict['property'] = self.property + 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): @@ -11209,138 +17163,146 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Rule object.""" + """Return a `str` version of this RequiredConfigConditionBase object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Rule') -> bool: + def __eq__(self, other: 'RequiredConfigConditionBase') -> 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: 'Rule') -> bool: + def __ne__(self, other: 'RequiredConfigConditionBase') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class TypeEnum(str, Enum): + class OperatorEnum(str, Enum): """ - The rule type (allowable values are `user_defined` or `system_defined`). + The operator. """ - USER_DEFINED = 'user_defined' - SYSTEM_DEFINED = 'system_defined' + STRING_EQUALS = 'string_equals' + STRING_NOT_EQUALS = 'string_not_equals' + STRING_MATCH = 'string_match' + STRING_NOT_MATCH = 'string_not_match' + STRING_CONTAINS = 'string_contains' + STRING_NOT_CONTAINS = 'string_not_contains' + NUM_EQUALS = 'num_equals' + NUM_NOT_EQUALS = 'num_not_equals' + NUM_LESS_THAN = 'num_less_than' + NUM_LESS_THAN_EQUALS = 'num_less_than_equals' + NUM_GREATER_THAN = 'num_greater_than' + NUM_GREATER_THAN_EQUALS = 'num_greater_than_equals' + IS_EMPTY = 'is_empty' + IS_NOT_EMPTY = 'is_not_empty' + IS_TRUE = 'is_true' + IS_FALSE = 'is_false' + STRINGS_IN_LIST = 'strings_in_list' + STRINGS_ALLOWED = 'strings_allowed' + STRINGS_REQUIRED = 'strings_required' + IPS_IN_RANGE = 'ips_in_range' + IPS_EQUALS = 'ips_equals' + IPS_NOT_EQUALS = 'ips_not_equals' + DAYS_LESS_THAN = 'days_less_than' -class RuleInfo: +class RequiredConfigConditionList(RequiredConfig): """ - The rule. + A list of required configurations. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a RequiredConfigConditionList object. + + """ + # pylint: disable=super-init-not-called + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['RequiredConfigConditionListConditionListConditionOr', 'RequiredConfigConditionListConditionListConditionAnd']) + ) + raise Exception(msg) + + +class RequiredConfigConditionSubRule(RequiredConfig): + """ + RequiredConfigConditionSubRule. + + """ + + def __init__( + self, + ) -> None: + """ + Initialize a RequiredConfigConditionSubRule object. + + """ + # pylint: disable=super-init-not-called + msg = "Cannot instantiate base class. Instead, instantiate one of the defined subclasses: {0}".format( + ", ".join(['RequiredConfigConditionSubRuleConditionSubRuleConditionAny', 'RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf', 'RequiredConfigConditionSubRuleConditionSubRuleConditionAll', 'RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf']) + ) + raise Exception(msg) + + +class ScopePropertyExclusions(ScopeProperty): + """ + Any exclusions or resources that should not be part of the scope. Has to be the same + type as the one specified. - :attr str id: (optional) The rule ID. - :attr str type: (optional) The rule type. - :attr str description: (optional) The rule description. - :attr str version: (optional) The rule version. - :attr str account_id: (optional) The rule account ID. - :attr str created_on: (optional) The date when the rule was created. - :attr str created_by: (optional) The ID of the user who created the rule. - :attr str updated_on: (optional) The date when the rule was updated. - :attr str updated_by: (optional) The ID of the user who updated the rule. - :attr List[str] labels: (optional) The rule labels. + :param str name: The key that denotes the user is declaring the exclusions. + :param List[ScopePropertyExclusionItem] value: """ def __init__( self, - *, - id: str = None, - type: str = None, - description: str = None, - version: str = None, - account_id: str = None, - created_on: str = None, - created_by: str = None, - updated_on: str = None, - updated_by: str = None, - labels: List[str] = None, + name: str, + value: List['ScopePropertyExclusionItem'], ) -> None: """ - Initialize a RuleInfo object. + Initialize a ScopePropertyExclusions object. - :param str id: (optional) The rule ID. - :param str type: (optional) The rule type. - :param str description: (optional) The rule description. - :param str version: (optional) The rule version. - :param str account_id: (optional) The rule account ID. - :param str created_on: (optional) The date when the rule was created. - :param str created_by: (optional) The ID of the user who created the rule. - :param str updated_on: (optional) The date when the rule was updated. - :param str updated_by: (optional) The ID of the user who updated the rule. - :param List[str] labels: (optional) The rule labels. + :param str name: The key that denotes the user is declaring the exclusions. + :param List[ScopePropertyExclusionItem] value: """ - self.id = id - self.type = type - self.description = description - self.version = version - self.account_id = account_id - self.created_on = created_on - self.created_by = created_by - self.updated_on = updated_on - self.updated_by = updated_by - self.labels = labels + # pylint: disable=super-init-not-called + self.name = name + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'RuleInfo': - """Initialize a RuleInfo object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ScopePropertyExclusions': + """Initialize a ScopePropertyExclusions object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'type' in _dict: - args['type'] = _dict.get('type') - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'version' in _dict: - args['version'] = _dict.get('version') - if 'account_id' in _dict: - args['account_id'] = _dict.get('account_id') - if 'created_on' in _dict: - args['created_on'] = _dict.get('created_on') - if 'created_by' in _dict: - args['created_by'] = _dict.get('created_by') - if 'updated_on' in _dict: - args['updated_on'] = _dict.get('updated_on') - if 'updated_by' in _dict: - args['updated_by'] = _dict.get('updated_by') - if 'labels' in _dict: - args['labels'] = _dict.get('labels') + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in ScopePropertyExclusions JSON') + if (value := _dict.get('value')) is not None: + args['value'] = [ScopePropertyExclusionItem.from_dict(v) for v in value] + else: + raise ValueError('Required property \'value\' not present in ScopePropertyExclusions JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RuleInfo object from a json dictionary.""" + """Initialize a ScopePropertyExclusions 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, 'type') and self.type is not None: - _dict['type'] = self.type - if hasattr(self, 'description') and self.description is not None: - _dict['description'] = self.description - if hasattr(self, 'version') and self.version is not None: - _dict['version'] = self.version - if hasattr(self, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'created_on') and self.created_on is not None: - _dict['created_on'] = self.created_on - if hasattr(self, 'created_by') and self.created_by is not None: - _dict['created_by'] = self.created_by - if hasattr(self, 'updated_on') and self.updated_on is not None: - _dict['updated_on'] = self.updated_on - if hasattr(self, 'updated_by') and self.updated_by is not None: - _dict['updated_by'] = self.updated_by - if hasattr(self, 'labels') and self.labels is not None: - _dict['labels'] = self.labels + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'value') and self.value is not None: + value_list = [] + for v in self.value: + if isinstance(v, dict): + value_list.append(v) + else: + value_list.append(v.to_dict()) + _dict['value'] = value_list return _dict def _to_dict(self): @@ -11348,111 +17310,78 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RuleInfo object.""" + """Return a `str` version of this ScopePropertyExclusions object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RuleInfo') -> bool: + def __eq__(self, other: 'ScopePropertyExclusions') -> 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: 'RuleInfo') -> bool: + def __ne__(self, other: 'ScopePropertyExclusions') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class NameEnum(str, Enum): + """ + The key that denotes the user is declaring the exclusions. + """ + + EXCLUSIONS = 'exclusions' + -class RulesPageBase: + +class ScopePropertyScopeId(ScopeProperty): """ - Page common fields. + The value of the identifier that correlates to scope type. If ScopePropertyScopeType + schema uses the value enterprise.account_group, the value should be the identifier or + ID of the account_group within the enterprise. - :attr int limit: The requested page limit. - :attr int total_count: The total number of resources in the collection. - :attr PageHRefFirst first: A page reference. - :attr PageHRefNext next: (optional) A page reference. - :attr List[Rule] rules: (optional) The collection of rules that correspond to an - account instance. Maximum of 100/500 custom rules per stand-alone/enterprise - account. + :param str name: The key for the scope property. + :param str value: (optional) The identifier for the scope_type specified. """ def __init__( self, - limit: int, - total_count: int, - first: 'PageHRefFirst', + name: str, *, - next: 'PageHRefNext' = None, - rules: List['Rule'] = None, + value: Optional[str] = None, ) -> None: """ - Initialize a RulesPageBase object. + Initialize a ScopePropertyScopeId object. - :param int limit: The requested page limit. - :param int total_count: The total number of resources in the collection. - :param PageHRefFirst first: A page reference. - :param PageHRefNext next: (optional) A page reference. - :param List[Rule] rules: (optional) The collection of rules that correspond - to an account instance. Maximum of 100/500 custom rules per - stand-alone/enterprise account. + :param str name: The key for the scope property. + :param str value: (optional) The identifier for the scope_type specified. """ - self.limit = limit - self.total_count = total_count - self.first = first - self.next = next - self.rules = rules + # pylint: disable=super-init-not-called + self.name = name + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'RulesPageBase': - """Initialize a RulesPageBase object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ScopePropertyScopeId': + """Initialize a ScopePropertyScopeId object from a json dictionary.""" args = {} - if 'limit' in _dict: - args['limit'] = _dict.get('limit') - else: - raise ValueError('Required property \'limit\' not present in RulesPageBase JSON') - if 'total_count' in _dict: - args['total_count'] = _dict.get('total_count') - else: - raise ValueError('Required property \'total_count\' not present in RulesPageBase JSON') - if 'first' in _dict: - args['first'] = PageHRefFirst.from_dict(_dict.get('first')) - else: - raise ValueError('Required property \'first\' not present in RulesPageBase JSON') - if 'next' in _dict: - args['next'] = PageHRefNext.from_dict(_dict.get('next')) - if 'rules' in _dict: - args['rules'] = [Rule.from_dict(v) for v in _dict.get('rules')] + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in ScopePropertyScopeId JSON') + if (value := _dict.get('value')) is not None: + args['value'] = value return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RulesPageBase object from a json dictionary.""" + """Initialize a ScopePropertyScopeId 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, 'limit') and self.limit is not None: - _dict['limit'] = self.limit - if hasattr(self, 'total_count') and self.total_count is not None: - _dict['total_count'] = self.total_count - if hasattr(self, 'first') and self.first is not None: - if isinstance(self.first, dict): - _dict['first'] = self.first - else: - _dict['first'] = self.first.to_dict() - if hasattr(self, 'next') and self.next is not None: - if isinstance(self.next, dict): - _dict['next'] = self.next - else: - _dict['next'] = self.next.to_dict() - if hasattr(self, '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, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -11460,121 +17389,92 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RulesPageBase object.""" + """Return a `str` version of this ScopePropertyScopeId object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RulesPageBase') -> bool: + def __eq__(self, other: 'ScopePropertyScopeId') -> 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: 'RulesPageBase') -> bool: + def __ne__(self, other: 'ScopePropertyScopeId') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other + class NameEnum(str, Enum): + """ + The key for the scope property. + """ -class Scan: - """ - The response schema for creating a scan. + SCOPE_ID = 'scope_id' - :attr str id: (optional) The scan ID. - :attr str account_id: (optional) The account ID. - :attr str attachment_id: (optional) The attachment ID of a profile. - :attr str report_id: (optional) The report ID. - :attr str status: (optional) The status of the scan. - :attr str last_scan_time: (optional) The last scan time. - :attr str next_scan_time: (optional) The next scan time. - :attr str scan_type: (optional) The type of scan. - :attr int occurence: (optional) The occurrence of the scan. + + +class ScopePropertyScopeType(ScopeProperty): + """ + Attribute that details what kind of type of scope. + + :param str name: key to say the attribute targets the scope type. + :param str value: The type of scope it targets + The scope values are as followed: + - enterprise: The scope targets an enterprise account + - enterprise.account_group: The scope targets an account group within an + enterprise + - enterprise.account: The scope targets an account within an enterprise + - account: The scope targets an account not tied to an enterprise + - account.resource_group: The scope targets a resource group within an account. """ def __init__( self, - *, - id: str = None, - account_id: str = None, - attachment_id: str = None, - report_id: str = None, - status: str = None, - last_scan_time: str = None, - next_scan_time: str = None, - scan_type: str = None, - occurence: int = None, + name: str, + value: str, ) -> None: """ - Initialize a Scan object. + Initialize a ScopePropertyScopeType object. - :param str id: (optional) The scan ID. - :param str account_id: (optional) The account ID. - :param str attachment_id: (optional) The attachment ID of a profile. - :param str report_id: (optional) The report ID. - :param str status: (optional) The status of the scan. - :param str last_scan_time: (optional) The last scan time. - :param str next_scan_time: (optional) The next scan time. - :param str scan_type: (optional) The type of scan. - :param int occurence: (optional) The occurrence of the scan. + :param str name: key to say the attribute targets the scope type. + :param str value: The type of scope it targets + The scope values are as followed: + - enterprise: The scope targets an enterprise account + - enterprise.account_group: The scope targets an account group within an + enterprise + - enterprise.account: The scope targets an account within an enterprise + - account: The scope targets an account not tied to an enterprise + - account.resource_group: The scope targets a resource group within an + account. """ - self.id = id - self.account_id = account_id - self.attachment_id = attachment_id - self.report_id = report_id - self.status = status - self.last_scan_time = last_scan_time - self.next_scan_time = next_scan_time - self.scan_type = scan_type - self.occurence = occurence + # pylint: disable=super-init-not-called + self.name = name + self.value = value @classmethod - def from_dict(cls, _dict: Dict) -> 'Scan': - """Initialize a Scan object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ScopePropertyScopeType': + """Initialize a ScopePropertyScopeType object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'account_id' in _dict: - args['account_id'] = _dict.get('account_id') - if 'attachment_id' in _dict: - args['attachment_id'] = _dict.get('attachment_id') - if 'report_id' in _dict: - args['report_id'] = _dict.get('report_id') - if 'status' in _dict: - args['status'] = _dict.get('status') - if 'last_scan_time' in _dict: - args['last_scan_time'] = _dict.get('last_scan_time') - if 'next_scan_time' in _dict: - args['next_scan_time'] = _dict.get('next_scan_time') - if 'scan_type' in _dict: - args['scan_type'] = _dict.get('scan_type') - if 'occurence' in _dict: - args['occurence'] = _dict.get('occurence') + if (name := _dict.get('name')) is not None: + args['name'] = name + else: + raise ValueError('Required property \'name\' not present in ScopePropertyScopeType JSON') + if (value := _dict.get('value')) is not None: + args['value'] = value + else: + raise ValueError('Required property \'value\' not present in ScopePropertyScopeType JSON') return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Scan object from a json dictionary.""" + """Initialize a ScopePropertyScopeType 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, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'attachment_id') and self.attachment_id is not None: - _dict['attachment_id'] = self.attachment_id - if hasattr(self, 'report_id') and self.report_id is not None: - _dict['report_id'] = self.report_id - if hasattr(self, 'status') and self.status is not None: - _dict['status'] = self.status - if hasattr(self, 'last_scan_time') and self.last_scan_time is not None: - _dict['last_scan_time'] = self.last_scan_time - if hasattr(self, 'next_scan_time') and self.next_scan_time is not None: - _dict['next_scan_time'] = self.next_scan_time - if hasattr(self, 'scan_type') and self.scan_type is not None: - _dict['scan_type'] = self.scan_type - if hasattr(self, 'occurence') and self.occurence is not None: - _dict['occurence'] = self.occurence + if hasattr(self, 'name') and self.name is not None: + _dict['name'] = self.name + if hasattr(self, 'value') and self.value is not None: + _dict['value'] = self.value return _dict def _to_dict(self): @@ -11582,83 +17482,101 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Scan object.""" + """Return a `str` version of this ScopePropertyScopeType object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Scan') -> bool: + def __eq__(self, other: 'ScopePropertyScopeType') -> 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: 'Scan') -> bool: + def __ne__(self, other: 'ScopePropertyScopeType') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class StatusEnum(str, Enum): + class NameEnum(str, Enum): """ - The status of the scan. + key to say the attribute targets the scope type. """ - COMPLETED = 'completed' - IN_PROGRESS = 'in_progress' + SCOPE_TYPE = 'scope_type' - class ScanTypeEnum(str, Enum): + class ValueEnum(str, Enum): """ - The type of scan. + The type of scope it targets + The scope values are as followed: + - enterprise: The scope targets an enterprise account + - enterprise.account_group: The scope targets an account group within an + enterprise + - enterprise.account: The scope targets an account within an enterprise + - account: The scope targets an account not tied to an enterprise + - account.resource_group: The scope targets a resource group within an account. """ - ONDEMAND = 'ondemand' - SCHEDULED = 'scheduled' + ACCOUNT = 'account' + ACCOUNT_RESOURCE_GROUP = 'account.resource_group' + ENTERPRISE = 'enterprise' + ENTERPRISE_ACCOUNT_GROUP = 'enterprise.account_group' + ENTERPRISE_ACCOUNT = 'enterprise.account' -class ScopeProperty: +class ConditionItemConditionListConditionListConditionAnd(ConditionItemConditionList): """ - The properties that are supported for scoping by this attachment. + ConditionItemConditionListConditionListConditionAnd. - :attr str name: (optional) The property name. - :attr str value: (optional) The property value. + :param str description: (optional) The required config description. + :param List[ConditionItem] and_: (optional) A list of required configurations + where all items should evaluate to true. """ def __init__( self, *, - name: str = None, - value: str = None, + description: Optional[str] = None, + and_: Optional[List['ConditionItem']] = None, ) -> None: """ - Initialize a ScopeProperty object. + Initialize a ConditionItemConditionListConditionListConditionAnd object. - :param str name: (optional) The property name. - :param str value: (optional) The property value. + :param str description: (optional) The required config description. + :param List[ConditionItem] and_: (optional) A list of required + configurations where all items should evaluate to true. """ - self.name = name - self.value = value + # pylint: disable=super-init-not-called + self.description = description + self.and_ = and_ @classmethod - def from_dict(cls, _dict: Dict) -> 'ScopeProperty': - """Initialize a ScopeProperty object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ConditionItemConditionListConditionListConditionAnd': + """Initialize a ConditionItemConditionListConditionListConditionAnd object from a json dictionary.""" args = {} - if 'name' in _dict: - args['name'] = _dict.get('name') - if 'value' in _dict: - args['value'] = _dict.get('value') + if (description := _dict.get('description')) is not None: + args['description'] = description + if (and_ := _dict.get('and')) is not None: + args['and_'] = and_ return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a ScopeProperty object from a json dictionary.""" + """Initialize a ConditionItemConditionListConditionListConditionAnd 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, 'name') and self.name is not None: - _dict['name'] = self.name - if hasattr(self, 'value') and self.value is not None: - _dict['value'] = self.value + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'and_') and self.and_ is not None: + and_list = [] + for v in self.and_: + if isinstance(v, dict): + and_list.append(v) + else: + and_list.append(v.to_dict()) + _dict['and'] = and_list return _dict def _to_dict(self): @@ -11666,75 +17584,74 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this ScopeProperty object.""" + """Return a `str` version of this ConditionItemConditionListConditionListConditionAnd object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'ScopeProperty') -> bool: + def __eq__(self, other: 'ConditionItemConditionListConditionListConditionAnd') -> 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: 'ScopeProperty') -> bool: + def __ne__(self, other: 'ConditionItemConditionListConditionListConditionAnd') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Settings: +class ConditionItemConditionListConditionListConditionOr(ConditionItemConditionList): """ - The settings. + The `OR` required configurations. - :attr EventNotifications event_notifications: (optional) The Event Notifications - settings. - :attr ObjectStorage object_storage: (optional) The Cloud Object Storage - settings. + :param str description: (optional) The required config description. + :param List[ConditionItem] or_: (optional) A list of required configurations + where one item should evaluate to true. """ def __init__( self, *, - event_notifications: 'EventNotifications' = None, - object_storage: 'ObjectStorage' = None, + description: Optional[str] = None, + or_: Optional[List['ConditionItem']] = None, ) -> None: """ - Initialize a Settings object. + Initialize a ConditionItemConditionListConditionListConditionOr object. - :param EventNotifications event_notifications: (optional) The Event - Notifications settings. - :param ObjectStorage object_storage: (optional) The Cloud Object Storage - settings. + :param str description: (optional) The required config description. + :param List[ConditionItem] or_: (optional) A list of required + configurations where one item should evaluate to true. """ - self.event_notifications = event_notifications - self.object_storage = object_storage + # pylint: disable=super-init-not-called + self.description = description + self.or_ = or_ @classmethod - def from_dict(cls, _dict: Dict) -> 'Settings': - """Initialize a Settings object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ConditionItemConditionListConditionListConditionOr': + """Initialize a ConditionItemConditionListConditionListConditionOr object from a json dictionary.""" args = {} - if 'event_notifications' in _dict: - args['event_notifications'] = EventNotifications.from_dict(_dict.get('event_notifications')) - if 'object_storage' in _dict: - args['object_storage'] = ObjectStorage.from_dict(_dict.get('object_storage')) + if (description := _dict.get('description')) is not None: + args['description'] = description + if (or_ := _dict.get('or')) is not None: + args['or_'] = or_ return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Settings object from a json dictionary.""" + """Initialize a ConditionItemConditionListConditionListConditionOr 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, 'event_notifications') and self.event_notifications is not None: - if isinstance(self.event_notifications, dict): - _dict['event_notifications'] = self.event_notifications - else: - _dict['event_notifications'] = self.event_notifications.to_dict() - if hasattr(self, 'object_storage') and self.object_storage is not None: - if isinstance(self.object_storage, dict): - _dict['object_storage'] = self.object_storage - else: - _dict['object_storage'] = self.object_storage.to_dict() + if hasattr(self, 'description') and self.description is not None: + _dict['description'] = self.description + if hasattr(self, 'or_') and self.or_ is not None: + or_list = [] + for v in self.or_: + if isinstance(v, dict): + or_list.append(v) + else: + or_list.append(v.to_dict()) + _dict['or'] = or_list return _dict def _to_dict(self): @@ -11742,73 +17659,62 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Settings object.""" + """Return a `str` version of this ConditionItemConditionListConditionListConditionOr object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Settings') -> bool: + def __eq__(self, other: 'ConditionItemConditionListConditionListConditionOr') -> 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: 'Settings') -> bool: + def __ne__(self, other: 'ConditionItemConditionListConditionListConditionOr') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Tags: +class ConditionItemConditionSubRuleConditionSubRuleConditionAll(ConditionItemConditionSubRule): """ - The collection of different types of tags. + A subrule using the 'all' operator. - :attr List[str] user: (optional) The collection of user tags. - :attr List[str] access: (optional) The collection of access tags. - :attr List[str] service: (optional) The collection of service tags. + :param SubRule all: (optional) A rule within a rule used in the requiredConfig. """ def __init__( self, *, - user: List[str] = None, - access: List[str] = None, - service: List[str] = None, + all: Optional['SubRule'] = None, ) -> None: """ - Initialize a Tags object. + Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAll object. - :param List[str] user: (optional) The collection of user tags. - :param List[str] access: (optional) The collection of access tags. - :param List[str] service: (optional) The collection of service tags. + :param SubRule all: (optional) A rule within a rule used in the + requiredConfig. """ - self.user = user - self.access = access - self.service = service + # pylint: disable=super-init-not-called + self.all = all @classmethod - def from_dict(cls, _dict: Dict) -> 'Tags': - """Initialize a Tags object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ConditionItemConditionSubRuleConditionSubRuleConditionAll': + """Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAll object from a json dictionary.""" args = {} - if 'user' in _dict: - args['user'] = _dict.get('user') - if 'access' in _dict: - args['access'] = _dict.get('access') - if 'service' in _dict: - args['service'] = _dict.get('service') + if (all := _dict.get('all')) is not None: + args['all'] = SubRule.from_dict(all) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Tags object from a json dictionary.""" + """Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAll 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, 'user') and self.user is not None: - _dict['user'] = self.user - if hasattr(self, 'access') and self.access is not None: - _dict['access'] = self.access - if hasattr(self, 'service') and self.service is not None: - _dict['service'] = self.service + if hasattr(self, 'all') and self.all is not None: + if isinstance(self.all, dict): + _dict['all'] = self.all + else: + _dict['all'] = self.all.to_dict() return _dict def _to_dict(self): @@ -11816,95 +17722,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Tags object.""" + """Return a `str` version of this ConditionItemConditionSubRuleConditionSubRuleConditionAll object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Tags') -> bool: + def __eq__(self, other: 'ConditionItemConditionSubRuleConditionSubRuleConditionAll') -> 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: 'Tags') -> bool: + def __ne__(self, other: 'ConditionItemConditionSubRuleConditionSubRuleConditionAll') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class Target: +class ConditionItemConditionSubRuleConditionSubRuleConditionAllIf(ConditionItemConditionSubRule): """ - The rule target. + A subrule using the 'all_ifexists' operator. - :attr str service_name: The target service name. - :attr str service_display_name: (optional) The display name of the target - service. - :attr str resource_kind: The target resource kind. - :attr List[AdditionalTargetAttribute] additional_target_attributes: (optional) - The list of targets supported properties. + :param SubRule all_ifexists: (optional) A rule within a rule used in the + requiredConfig. """ def __init__( self, - service_name: str, - resource_kind: str, *, - service_display_name: str = None, - additional_target_attributes: List['AdditionalTargetAttribute'] = None, + all_ifexists: Optional['SubRule'] = None, ) -> None: """ - Initialize a Target object. + Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAllIf object. - :param str service_name: The target service name. - :param str resource_kind: The target resource kind. - :param str service_display_name: (optional) The display name of the target - service. - :param List[AdditionalTargetAttribute] additional_target_attributes: - (optional) The list of targets supported properties. + :param SubRule all_ifexists: (optional) A rule within a rule used in the + requiredConfig. """ - self.service_name = service_name - self.service_display_name = service_display_name - self.resource_kind = resource_kind - self.additional_target_attributes = additional_target_attributes + # pylint: disable=super-init-not-called + self.all_ifexists = all_ifexists @classmethod - def from_dict(cls, _dict: Dict) -> 'Target': - """Initialize a Target object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ConditionItemConditionSubRuleConditionSubRuleConditionAllIf': + """Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAllIf object from a json dictionary.""" args = {} - if 'service_name' in _dict: - args['service_name'] = _dict.get('service_name') - else: - raise ValueError('Required property \'service_name\' not present in Target JSON') - if 'service_display_name' in _dict: - args['service_display_name'] = _dict.get('service_display_name') - if 'resource_kind' in _dict: - args['resource_kind'] = _dict.get('resource_kind') - else: - raise ValueError('Required property \'resource_kind\' not present in Target JSON') - if 'additional_target_attributes' in _dict: - args['additional_target_attributes'] = [AdditionalTargetAttribute.from_dict(v) for v in _dict.get('additional_target_attributes')] + if (all_ifexists := _dict.get('all_ifexists')) is not None: + args['all_ifexists'] = SubRule.from_dict(all_ifexists) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a Target object from a json dictionary.""" + """Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAllIf 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, 'service_name') and self.service_name is not None: - _dict['service_name'] = self.service_name - if hasattr(self, 'service_display_name') and self.service_display_name is not None: - _dict['service_display_name'] = self.service_display_name - if hasattr(self, 'resource_kind') and self.resource_kind is not None: - _dict['resource_kind'] = self.resource_kind - if hasattr(self, 'additional_target_attributes') and self.additional_target_attributes is not None: - additional_target_attributes_list = [] - for v in self.additional_target_attributes: - if isinstance(v, dict): - additional_target_attributes_list.append(v) - else: - additional_target_attributes_list.append(v.to_dict()) - _dict['additional_target_attributes'] = additional_target_attributes_list + if hasattr(self, 'all_ifexists') and self.all_ifexists is not None: + if isinstance(self.all_ifexists, dict): + _dict['all_ifexists'] = self.all_ifexists + else: + _dict['all_ifexists'] = self.all_ifexists.to_dict() return _dict def _to_dict(self): @@ -11912,89 +17786,62 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this Target object.""" + """Return a `str` version of this ConditionItemConditionSubRuleConditionSubRuleConditionAllIf object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'Target') -> bool: + def __eq__(self, other: 'ConditionItemConditionSubRuleConditionSubRuleConditionAllIf') -> 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: 'Target') -> bool: + def __ne__(self, other: 'ConditionItemConditionSubRuleConditionSubRuleConditionAllIf') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class TargetInfo: +class ConditionItemConditionSubRuleConditionSubRuleConditionAny(ConditionItemConditionSubRule): """ - The evaluation target. + A subrule using the 'any' operator. - :attr str id: (optional) The target ID. - :attr str account_id: (optional) The target account ID. - :attr str resource_crn: (optional) The target resource CRN. - :attr str resource_name: (optional) The target resource name. - :attr str service_name: (optional) The target service name. + :param SubRule any: (optional) A rule within a rule used in the requiredConfig. """ def __init__( self, *, - id: str = None, - account_id: str = None, - resource_crn: str = None, - resource_name: str = None, - service_name: str = None, + any: Optional['SubRule'] = None, ) -> None: """ - Initialize a TargetInfo object. + Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAny object. - :param str id: (optional) The target ID. - :param str account_id: (optional) The target account ID. - :param str resource_crn: (optional) The target resource CRN. - :param str resource_name: (optional) The target resource name. - :param str service_name: (optional) The target service name. + :param SubRule any: (optional) A rule within a rule used in the + requiredConfig. """ - self.id = id - self.account_id = account_id - self.resource_crn = resource_crn - self.resource_name = resource_name - self.service_name = service_name + # pylint: disable=super-init-not-called + self.any = any @classmethod - def from_dict(cls, _dict: Dict) -> 'TargetInfo': - """Initialize a TargetInfo object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ConditionItemConditionSubRuleConditionSubRuleConditionAny': + """Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAny object from a json dictionary.""" args = {} - if 'id' in _dict: - args['id'] = _dict.get('id') - if 'account_id' in _dict: - args['account_id'] = _dict.get('account_id') - if 'resource_crn' in _dict: - args['resource_crn'] = _dict.get('resource_crn') - if 'resource_name' in _dict: - args['resource_name'] = _dict.get('resource_name') - if 'service_name' in _dict: - args['service_name'] = _dict.get('service_name') + if (any := _dict.get('any')) is not None: + args['any'] = SubRule.from_dict(any) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a TargetInfo object from a json dictionary.""" + """Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAny 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, 'account_id') and self.account_id is not None: - _dict['account_id'] = self.account_id - if hasattr(self, 'resource_crn') and self.resource_crn is not None: - _dict['resource_crn'] = self.resource_crn - if hasattr(self, 'resource_name') and self.resource_name is not None: - _dict['resource_name'] = self.resource_name - if hasattr(self, 'service_name') and self.service_name is not None: - _dict['service_name'] = self.service_name + if hasattr(self, 'any') and self.any is not None: + if isinstance(self.any, dict): + _dict['any'] = self.any + else: + _dict['any'] = self.any.to_dict() return _dict def _to_dict(self): @@ -12002,60 +17849,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this TargetInfo object.""" + """Return a `str` version of this ConditionItemConditionSubRuleConditionSubRuleConditionAny object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'TargetInfo') -> bool: + def __eq__(self, other: 'ConditionItemConditionSubRuleConditionSubRuleConditionAny') -> 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: 'TargetInfo') -> bool: + def __ne__(self, other: 'ConditionItemConditionSubRuleConditionSubRuleConditionAny') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class TestEvent: +class ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf(ConditionItemConditionSubRule): """ - The details of a test event response. + A subrule using the 'any_ifexists' operator. - :attr bool success: The indication of whether the event was received by Event - Notifications. + :param SubRule any_ifexists: (optional) A rule within a rule used in the + requiredConfig. """ def __init__( self, - success: bool, + *, + any_ifexists: Optional['SubRule'] = None, ) -> None: """ - Initialize a TestEvent object. + Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf object. - :param bool success: The indication of whether the event was received by - Event Notifications. + :param SubRule any_ifexists: (optional) A rule within a rule used in the + requiredConfig. """ - self.success = success + # pylint: disable=super-init-not-called + self.any_ifexists = any_ifexists @classmethod - def from_dict(cls, _dict: Dict) -> 'TestEvent': - """Initialize a TestEvent object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf': + """Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf object from a json dictionary.""" args = {} - if 'success' in _dict: - args['success'] = _dict.get('success') - else: - raise ValueError('Required property \'success\' not present in TestEvent JSON') + if (any_ifexists := _dict.get('any_ifexists')) is not None: + args['any_ifexists'] = SubRule.from_dict(any_ifexists) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a TestEvent object from a json dictionary.""" + """Initialize a ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf 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, 'success') and self.success is not None: - _dict['success'] = self.success + if hasattr(self, 'any_ifexists') and self.any_ifexists is not None: + if isinstance(self.any_ifexists, dict): + _dict['any_ifexists'] = self.any_ifexists + else: + _dict['any_ifexists'] = self.any_ifexists.to_dict() return _dict def _to_dict(self): @@ -12063,59 +17913,59 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this TestEvent object.""" + """Return a `str` version of this ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'TestEvent') -> bool: + def __eq__(self, other: 'ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf') -> 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: 'TestEvent') -> bool: + def __ne__(self, other: 'ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RequiredConfigItemsRequiredConfigAnd(RequiredConfigItems): +class RequiredConfigConditionListConditionListConditionAnd(RequiredConfigConditionList): """ - RequiredConfigItemsRequiredConfigAnd. + RequiredConfigConditionListConditionListConditionAnd. - :attr str description: (optional) The required config description. - :attr List[RequiredConfigItems] and_: (optional) The `AND` required - configurations. + :param str description: (optional) The required config description. + :param List[ConditionItem] and_: (optional) A list of required configurations + where all items should evaluate to true. """ def __init__( self, *, - description: str = None, - and_: List['RequiredConfigItems'] = None, + description: Optional[str] = None, + and_: Optional[List['ConditionItem']] = None, ) -> None: """ - Initialize a RequiredConfigItemsRequiredConfigAnd object. + Initialize a RequiredConfigConditionListConditionListConditionAnd object. :param str description: (optional) The required config description. - :param List[RequiredConfigItems] and_: (optional) The `AND` required - configurations. + :param List[ConditionItem] and_: (optional) A list of required + configurations where all items should evaluate to true. """ # pylint: disable=super-init-not-called self.description = description self.and_ = and_ @classmethod - def from_dict(cls, _dict: Dict) -> 'RequiredConfigItemsRequiredConfigAnd': - """Initialize a RequiredConfigItemsRequiredConfigAnd object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RequiredConfigConditionListConditionListConditionAnd': + """Initialize a RequiredConfigConditionListConditionListConditionAnd object from a json dictionary.""" args = {} - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'and' in _dict: - args['and_'] = _dict.get('and') + if (description := _dict.get('description')) is not None: + args['description'] = description + if (and_ := _dict.get('and')) is not None: + args['and_'] = and_ return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RequiredConfigItemsRequiredConfigAnd object from a json dictionary.""" + """Initialize a RequiredConfigConditionListConditionListConditionAnd object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -12138,73 +17988,59 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RequiredConfigItemsRequiredConfigAnd object.""" + """Return a `str` version of this RequiredConfigConditionListConditionListConditionAnd object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RequiredConfigItemsRequiredConfigAnd') -> bool: + def __eq__(self, other: 'RequiredConfigConditionListConditionListConditionAnd') -> 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: 'RequiredConfigItemsRequiredConfigAnd') -> bool: + def __ne__(self, other: 'RequiredConfigConditionListConditionListConditionAnd') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RequiredConfigItemsRequiredConfigBase(RequiredConfigItems): +class RequiredConfigConditionListConditionListConditionOr(RequiredConfigConditionList): """ - The required configuration base object. + The `OR` required configurations. - :attr str description: (optional) The required config description. - :attr str property: The property. - :attr str operator: The operator. - :attr object value: (optional) Schema for any JSON type. + :param str description: (optional) The required config description. + :param List[ConditionItem] or_: (optional) A list of required configurations + where one item should evaluate to true. """ def __init__( self, - property: str, - operator: str, *, - description: str = None, - value: object = None, + description: Optional[str] = None, + or_: Optional[List['ConditionItem']] = None, ) -> None: """ - Initialize a RequiredConfigItemsRequiredConfigBase object. + Initialize a RequiredConfigConditionListConditionListConditionOr object. - :param str property: The property. - :param str operator: The operator. :param str description: (optional) The required config description. - :param object value: (optional) Schema for any JSON type. + :param List[ConditionItem] or_: (optional) A list of required + configurations where one item should evaluate to true. """ # pylint: disable=super-init-not-called self.description = description - self.property = property - self.operator = operator - self.value = value + self.or_ = or_ @classmethod - def from_dict(cls, _dict: Dict) -> 'RequiredConfigItemsRequiredConfigBase': - """Initialize a RequiredConfigItemsRequiredConfigBase object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RequiredConfigConditionListConditionListConditionOr': + """Initialize a RequiredConfigConditionListConditionListConditionOr object from a json dictionary.""" args = {} - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'property' in _dict: - args['property'] = _dict.get('property') - else: - raise ValueError('Required property \'property\' not present in RequiredConfigItemsRequiredConfigBase JSON') - if 'operator' in _dict: - args['operator'] = _dict.get('operator') - else: - raise ValueError('Required property \'operator\' not present in RequiredConfigItemsRequiredConfigBase JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + if (description := _dict.get('description')) is not None: + args['description'] = description + if (or_ := _dict.get('or')) is not None: + args['or_'] = or_ return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RequiredConfigItemsRequiredConfigBase object from a json dictionary.""" + """Initialize a RequiredConfigConditionListConditionListConditionOr object from a json dictionary.""" return cls.from_dict(_dict) def to_dict(self) -> Dict: @@ -12212,12 +18048,14 @@ def to_dict(self) -> Dict: _dict = {} if hasattr(self, 'description') and self.description is not None: _dict['description'] = self.description - if hasattr(self, 'property') and self.property is not None: - _dict['property'] = self.property - 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, 'or_') and self.or_ is not None: + or_list = [] + for v in self.or_: + if isinstance(v, dict): + or_list.append(v) + else: + or_list.append(v.to_dict()) + _dict['or'] = or_list return _dict def _to_dict(self): @@ -12225,104 +18063,62 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RequiredConfigItemsRequiredConfigBase object.""" + """Return a `str` version of this RequiredConfigConditionListConditionListConditionOr object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RequiredConfigItemsRequiredConfigBase') -> bool: + def __eq__(self, other: 'RequiredConfigConditionListConditionListConditionOr') -> 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: 'RequiredConfigItemsRequiredConfigBase') -> bool: + def __ne__(self, other: 'RequiredConfigConditionListConditionListConditionOr') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class OperatorEnum(str, Enum): - """ - The operator. - """ - - STRING_EQUALS = 'string_equals' - STRING_NOT_EQUALS = 'string_not_equals' - STRING_MATCH = 'string_match' - STRING_NOT_MATCH = 'string_not_match' - STRING_CONTAINS = 'string_contains' - STRING_NOT_CONTAINS = 'string_not_contains' - NUM_EQUALS = 'num_equals' - NUM_NOT_EQUALS = 'num_not_equals' - NUM_LESS_THAN = 'num_less_than' - NUM_LESS_THAN_EQUALS = 'num_less_than_equals' - NUM_GREATER_THAN = 'num_greater_than' - NUM_GREATER_THAN_EQUALS = 'num_greater_than_equals' - IS_EMPTY = 'is_empty' - IS_NOT_EMPTY = 'is_not_empty' - IS_TRUE = 'is_true' - IS_FALSE = 'is_false' - STRINGS_IN_LIST = 'strings_in_list' - STRINGS_ALLOWED = 'strings_allowed' - STRINGS_REQUIRED = 'strings_required' - IPS_IN_RANGE = 'ips_in_range' - IPS_EQUALS = 'ips_equals' - IPS_NOT_EQUALS = 'ips_not_equals' - DAYS_LESS_THAN = 'days_less_than' - - -class RequiredConfigItemsRequiredConfigOr(RequiredConfigItems): +class RequiredConfigConditionSubRuleConditionSubRuleConditionAll(RequiredConfigConditionSubRule): """ - The `OR` required configurations. + A subrule using the 'all' operator. - :attr str description: (optional) The required config description. - :attr List[RequiredConfigItems] or_: (optional) The `OR` required - configurations. + :param SubRule all: (optional) A rule within a rule used in the requiredConfig. """ def __init__( self, *, - description: str = None, - or_: List['RequiredConfigItems'] = None, + all: Optional['SubRule'] = None, ) -> None: """ - Initialize a RequiredConfigItemsRequiredConfigOr object. + Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAll object. - :param str description: (optional) The required config description. - :param List[RequiredConfigItems] or_: (optional) The `OR` required - configurations. + :param SubRule all: (optional) A rule within a rule used in the + requiredConfig. """ # pylint: disable=super-init-not-called - self.description = description - self.or_ = or_ + self.all = all @classmethod - def from_dict(cls, _dict: Dict) -> 'RequiredConfigItemsRequiredConfigOr': - """Initialize a RequiredConfigItemsRequiredConfigOr object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RequiredConfigConditionSubRuleConditionSubRuleConditionAll': + """Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAll object from a json dictionary.""" args = {} - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'or' in _dict: - args['or_'] = _dict.get('or') + if (all := _dict.get('all')) is not None: + args['all'] = SubRule.from_dict(all) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RequiredConfigItemsRequiredConfigOr object from a json dictionary.""" + """Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAll 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, 'description') and self.description is not None: - _dict['description'] = self.description - if hasattr(self, 'or_') and self.or_ is not None: - or_list = [] - for v in self.or_: - if isinstance(v, dict): - or_list.append(v) - else: - or_list.append(v.to_dict()) - _dict['or'] = or_list + if hasattr(self, 'all') and self.all is not None: + if isinstance(self.all, dict): + _dict['all'] = self.all + else: + _dict['all'] = self.all.to_dict() return _dict def _to_dict(self): @@ -12330,74 +18126,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RequiredConfigItemsRequiredConfigOr object.""" + """Return a `str` version of this RequiredConfigConditionSubRuleConditionSubRuleConditionAll object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RequiredConfigItemsRequiredConfigOr') -> bool: + def __eq__(self, other: 'RequiredConfigConditionSubRuleConditionSubRuleConditionAll') -> 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: 'RequiredConfigItemsRequiredConfigOr') -> bool: + def __ne__(self, other: 'RequiredConfigConditionSubRuleConditionSubRuleConditionAll') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RequiredConfigRequiredConfigAnd(RequiredConfig): +class RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf(RequiredConfigConditionSubRule): """ - RequiredConfigRequiredConfigAnd. + A subrule using the 'all_ifexists' operator. - :attr str description: (optional) The required config description. - :attr List[RequiredConfigItems] and_: (optional) The `AND` required - configurations. + :param SubRule all_ifexists: (optional) A rule within a rule used in the + requiredConfig. """ def __init__( self, *, - description: str = None, - and_: List['RequiredConfigItems'] = None, + all_ifexists: Optional['SubRule'] = None, ) -> None: """ - Initialize a RequiredConfigRequiredConfigAnd object. + Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf object. - :param str description: (optional) The required config description. - :param List[RequiredConfigItems] and_: (optional) The `AND` required - configurations. + :param SubRule all_ifexists: (optional) A rule within a rule used in the + requiredConfig. """ # pylint: disable=super-init-not-called - self.description = description - self.and_ = and_ + self.all_ifexists = all_ifexists @classmethod - def from_dict(cls, _dict: Dict) -> 'RequiredConfigRequiredConfigAnd': - """Initialize a RequiredConfigRequiredConfigAnd object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf': + """Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf object from a json dictionary.""" args = {} - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'and' in _dict: - args['and_'] = _dict.get('and') + if (all_ifexists := _dict.get('all_ifexists')) is not None: + args['all_ifexists'] = SubRule.from_dict(all_ifexists) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RequiredConfigRequiredConfigAnd object from a json dictionary.""" + """Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf 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, 'description') and self.description is not None: - _dict['description'] = self.description - if hasattr(self, 'and_') and self.and_ is not None: - and_list = [] - for v in self.and_: - if isinstance(v, dict): - and_list.append(v) - else: - and_list.append(v.to_dict()) - _dict['and'] = and_list + if hasattr(self, 'all_ifexists') and self.all_ifexists is not None: + if isinstance(self.all_ifexists, dict): + _dict['all_ifexists'] = self.all_ifexists + else: + _dict['all_ifexists'] = self.all_ifexists.to_dict() return _dict def _to_dict(self): @@ -12405,86 +18190,62 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RequiredConfigRequiredConfigAnd object.""" + """Return a `str` version of this RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RequiredConfigRequiredConfigAnd') -> bool: + def __eq__(self, other: 'RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf') -> 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: 'RequiredConfigRequiredConfigAnd') -> bool: + def __ne__(self, other: 'RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other -class RequiredConfigRequiredConfigBase(RequiredConfig): +class RequiredConfigConditionSubRuleConditionSubRuleConditionAny(RequiredConfigConditionSubRule): """ - The required configuration base object. + A subrule using the 'any' operator. - :attr str description: (optional) The required config description. - :attr str property: The property. - :attr str operator: The operator. - :attr object value: (optional) Schema for any JSON type. + :param SubRule any: (optional) A rule within a rule used in the requiredConfig. """ def __init__( self, - property: str, - operator: str, *, - description: str = None, - value: object = None, + any: Optional['SubRule'] = None, ) -> None: """ - Initialize a RequiredConfigRequiredConfigBase object. + Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAny object. - :param str property: The property. - :param str operator: The operator. - :param str description: (optional) The required config description. - :param object value: (optional) Schema for any JSON type. + :param SubRule any: (optional) A rule within a rule used in the + requiredConfig. """ # pylint: disable=super-init-not-called - self.description = description - self.property = property - self.operator = operator - self.value = value + self.any = any @classmethod - def from_dict(cls, _dict: Dict) -> 'RequiredConfigRequiredConfigBase': - """Initialize a RequiredConfigRequiredConfigBase object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RequiredConfigConditionSubRuleConditionSubRuleConditionAny': + """Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAny object from a json dictionary.""" args = {} - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'property' in _dict: - args['property'] = _dict.get('property') - else: - raise ValueError('Required property \'property\' not present in RequiredConfigRequiredConfigBase JSON') - if 'operator' in _dict: - args['operator'] = _dict.get('operator') - else: - raise ValueError('Required property \'operator\' not present in RequiredConfigRequiredConfigBase JSON') - if 'value' in _dict: - args['value'] = _dict.get('value') + if (any := _dict.get('any')) is not None: + args['any'] = SubRule.from_dict(any) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RequiredConfigRequiredConfigBase object from a json dictionary.""" + """Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAny 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, 'description') and self.description is not None: - _dict['description'] = self.description - if hasattr(self, 'property') and self.property is not None: - _dict['property'] = self.property - 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, 'any') and self.any is not None: + if isinstance(self.any, dict): + _dict['any'] = self.any + else: + _dict['any'] = self.any.to_dict() return _dict def _to_dict(self): @@ -12492,104 +18253,63 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RequiredConfigRequiredConfigBase object.""" + """Return a `str` version of this RequiredConfigConditionSubRuleConditionSubRuleConditionAny object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RequiredConfigRequiredConfigBase') -> bool: + def __eq__(self, other: 'RequiredConfigConditionSubRuleConditionSubRuleConditionAny') -> 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: 'RequiredConfigRequiredConfigBase') -> bool: + def __ne__(self, other: 'RequiredConfigConditionSubRuleConditionSubRuleConditionAny') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other - class OperatorEnum(str, Enum): - """ - The operator. - """ - - STRING_EQUALS = 'string_equals' - STRING_NOT_EQUALS = 'string_not_equals' - STRING_MATCH = 'string_match' - STRING_NOT_MATCH = 'string_not_match' - STRING_CONTAINS = 'string_contains' - STRING_NOT_CONTAINS = 'string_not_contains' - NUM_EQUALS = 'num_equals' - NUM_NOT_EQUALS = 'num_not_equals' - NUM_LESS_THAN = 'num_less_than' - NUM_LESS_THAN_EQUALS = 'num_less_than_equals' - NUM_GREATER_THAN = 'num_greater_than' - NUM_GREATER_THAN_EQUALS = 'num_greater_than_equals' - IS_EMPTY = 'is_empty' - IS_NOT_EMPTY = 'is_not_empty' - IS_TRUE = 'is_true' - IS_FALSE = 'is_false' - STRINGS_IN_LIST = 'strings_in_list' - STRINGS_ALLOWED = 'strings_allowed' - STRINGS_REQUIRED = 'strings_required' - IPS_IN_RANGE = 'ips_in_range' - IPS_EQUALS = 'ips_equals' - IPS_NOT_EQUALS = 'ips_not_equals' - DAYS_LESS_THAN = 'days_less_than' - - -class RequiredConfigRequiredConfigOr(RequiredConfig): +class RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf(RequiredConfigConditionSubRule): """ - The `OR` required configurations. + A subrule using the 'any_ifexists' operator. - :attr str description: (optional) The required config description. - :attr List[RequiredConfigItems] or_: (optional) The `OR` required - configurations. + :param SubRule any_ifexists: (optional) A rule within a rule used in the + requiredConfig. """ def __init__( self, *, - description: str = None, - or_: List['RequiredConfigItems'] = None, + any_ifexists: Optional['SubRule'] = None, ) -> None: """ - Initialize a RequiredConfigRequiredConfigOr object. + Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf object. - :param str description: (optional) The required config description. - :param List[RequiredConfigItems] or_: (optional) The `OR` required - configurations. + :param SubRule any_ifexists: (optional) A rule within a rule used in the + requiredConfig. """ # pylint: disable=super-init-not-called - self.description = description - self.or_ = or_ + self.any_ifexists = any_ifexists @classmethod - def from_dict(cls, _dict: Dict) -> 'RequiredConfigRequiredConfigOr': - """Initialize a RequiredConfigRequiredConfigOr object from a json dictionary.""" + def from_dict(cls, _dict: Dict) -> 'RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf': + """Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf object from a json dictionary.""" args = {} - if 'description' in _dict: - args['description'] = _dict.get('description') - if 'or' in _dict: - args['or_'] = _dict.get('or') + if (any_ifexists := _dict.get('any_ifexists')) is not None: + args['any_ifexists'] = SubRule.from_dict(any_ifexists) return cls(**args) @classmethod def _from_dict(cls, _dict): - """Initialize a RequiredConfigRequiredConfigOr object from a json dictionary.""" + """Initialize a RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf 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, 'description') and self.description is not None: - _dict['description'] = self.description - if hasattr(self, 'or_') and self.or_ is not None: - or_list = [] - for v in self.or_: - if isinstance(v, dict): - or_list.append(v) - else: - or_list.append(v.to_dict()) - _dict['or'] = or_list + if hasattr(self, 'any_ifexists') and self.any_ifexists is not None: + if isinstance(self.any_ifexists, dict): + _dict['any_ifexists'] = self.any_ifexists + else: + _dict['any_ifexists'] = self.any_ifexists.to_dict() return _dict def _to_dict(self): @@ -12597,16 +18317,16 @@ def _to_dict(self): return self.to_dict() def __str__(self) -> str: - """Return a `str` version of this RequiredConfigRequiredConfigOr object.""" + """Return a `str` version of this RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf object.""" return json.dumps(self.to_dict(), indent=2) - def __eq__(self, other: 'RequiredConfigRequiredConfigOr') -> bool: + def __eq__(self, other: 'RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf') -> 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: 'RequiredConfigRequiredConfigOr') -> bool: + def __ne__(self, other: 'RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf') -> bool: """Return `true` when self and other are not equal, false otherwise.""" return not self == other @@ -12615,44 +18335,45 @@ def __ne__(self, other: 'RequiredConfigRequiredConfigOr') -> bool: ############################################################################## -class ControlLibrariesPager: +class InstanceAttachmentsPager: """ - ControlLibrariesPager can be used to simplify the use of the "list_control_libraries" method. + InstanceAttachmentsPager can be used to simplify the use of the "list_instance_attachments" method. """ def __init__( self, *, client: SecurityAndComplianceCenterApiV3, - x_correlation_id: str = None, - x_request_id: str = None, + instance_id: str, + account_id: str = None, + version_group_label: str = None, limit: int = None, - control_library_type: str = None, - ) -> None: - """ - Initialize a ControlLibrariesPager object. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param int limit: (optional) The field that indicates how many resources to - return, unless the response is the last page of resources. - :param str control_library_type: (optional) The field that indicate how you - want the resources to be filtered by. + sort: str = None, + direction: str = None, + ) -> None: + """ + Initialize a InstanceAttachmentsPager object. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str account_id: (optional) The user account ID. + :param str version_group_label: (optional) The profile version group label. + :param int limit: (optional) The number of items that are retrieved in a + collection. + :param str sort: (optional) The sorted collection of attachments. The + available values are `created_on` and `scope_type`. + :param str direction: (optional) The collection of attachments that is + sorted in ascending order. To sort the collection in descending order, use + the `DESC` schema. """ self._has_next = True self._client = client self._page_context = {'next': None} - self._x_correlation_id = x_correlation_id - self._x_request_id = x_request_id + self._instance_id = instance_id + self._account_id = account_id + self._version_group_label = version_group_label self._limit = limit - self._control_library_type = control_library_type + self._sort = sort + self._direction = direction def has_next(self) -> bool: """ @@ -12663,17 +18384,19 @@ def has_next(self) -> bool: def get_next(self) -> List[dict]: """ Returns the next page of results. - :return: A List[dict], where each element is a dict that represents an instance of ControlLibraryItem. + :return: A List[dict], where each element is a dict that represents an instance of ProfileAttachment. :rtype: List[dict] """ if not self.has_next(): raise StopIteration(message='No more results available') - result = self._client.list_control_libraries( - x_correlation_id=self._x_correlation_id, - x_request_id=self._x_request_id, + result = self._client.list_instance_attachments( + instance_id=self._instance_id, + account_id=self._account_id, + version_group_label=self._version_group_label, limit=self._limit, - control_library_type=self._control_library_type, + sort=self._sort, + direction=self._direction, start=self._page_context.get('next'), ).get_result() @@ -12685,13 +18408,13 @@ def get_next(self) -> List[dict]: if next is None: self._has_next = False - return result.get('control_libraries') + return result.get('attachments') def get_all(self) -> List[dict]: """ Returns all results by invoking get_next() repeatedly until all pages of results have been retrieved. - :return: A List[dict], where each element is a dict that represents an instance of ControlLibraryItem. + :return: A List[dict], where each element is a dict that represents an instance of ProfileAttachment. :rtype: List[dict] """ results = [] @@ -12701,44 +18424,47 @@ def get_all(self) -> List[dict]: return results -class ProfilesPager: +class ReportsPager: """ - ProfilesPager can be used to simplify the use of the "list_profiles" method. + ReportsPager can be used to simplify the use of the "list_reports" method. """ def __init__( self, *, client: SecurityAndComplianceCenterApiV3, - x_correlation_id: str = None, - x_request_id: str = None, + instance_id: str, + attachment_id: str = None, + group_id: str = None, + profile_id: str = None, + type: str = None, limit: int = None, - profile_type: str = None, - ) -> None: - """ - Initialize a ProfilesPager object. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request, and repeated in a response header for - the corresponding response. The same value is used for downstream requests, - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param int limit: (optional) The indication of how many resources to - return, unless the response is the last page of resources. - :param str profile_type: (optional) The field that indicate how you want - the resources to be filtered by. + sort: str = None, + ) -> None: + """ + Initialize a ReportsPager object. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str attachment_id: (optional) The ID of the attachment. + :param str group_id: (optional) The report group ID. + :param str profile_id: (optional) The ID of the profile. + :param str type: (optional) The type of the scan. + :param int limit: (optional) The indication of many resources to return, + unless the response is the last page of resources. + :param str sort: (optional) This field sorts results by using a valid sort + field. To learn more, see + [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). """ self._has_next = True self._client = client self._page_context = {'next': None} - self._x_correlation_id = x_correlation_id - self._x_request_id = x_request_id + self._instance_id = instance_id + self._attachment_id = attachment_id + self._group_id = group_id + self._profile_id = profile_id + self._type = type self._limit = limit - self._profile_type = profile_type + self._sort = sort def has_next(self) -> bool: """ @@ -12749,17 +18475,20 @@ def has_next(self) -> bool: def get_next(self) -> List[dict]: """ Returns the next page of results. - :return: A List[dict], where each element is a dict that represents an instance of ProfileItem. + :return: A List[dict], where each element is a dict that represents an instance of Report. :rtype: List[dict] """ if not self.has_next(): raise StopIteration(message='No more results available') - result = self._client.list_profiles( - x_correlation_id=self._x_correlation_id, - x_request_id=self._x_request_id, + result = self._client.list_reports( + instance_id=self._instance_id, + attachment_id=self._attachment_id, + group_id=self._group_id, + profile_id=self._profile_id, + type=self._type, limit=self._limit, - profile_type=self._profile_type, + sort=self._sort, start=self._page_context.get('next'), ).get_result() @@ -12771,13 +18500,13 @@ def get_next(self) -> List[dict]: if next is None: self._has_next = False - return result.get('profiles') + return result.get('reports') def get_all(self) -> List[dict]: """ Returns all results by invoking get_next() repeatedly until all pages of results have been retrieved. - :return: A List[dict], where each element is a dict that represents an instance of ProfileItem. + :return: A List[dict], where each element is a dict that represents an instance of Report. :rtype: List[dict] """ results = [] @@ -12787,43 +18516,65 @@ def get_all(self) -> List[dict]: return results -class AttachmentsPager: +class ReportEvaluationsPager: """ - AttachmentsPager can be used to simplify the use of the "list_attachments" method. + ReportEvaluationsPager can be used to simplify the use of the "list_report_evaluations" method. """ def __init__( self, *, client: SecurityAndComplianceCenterApiV3, - profile_id: str, - x_correlation_id: str = None, - x_request_id: str = None, + instance_id: str, + report_id: str, + assessment_id: str = None, + assessment_method: str = None, + component_id: str = None, + target_id: str = None, + target_env: str = None, + target_name: str = None, + status: str = None, limit: int = None, + sort: str = None, + scope_id: str = None, + subscope_id: str = None, ) -> None: """ - Initialize a AttachmentsPager object. - :param str profile_id: The profile ID. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param int limit: (optional) The indication of how many resources to - return, unless the response is the last page of resources. + Initialize a ReportEvaluationsPager object. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str report_id: The ID of the scan that is associated with a report. + :param str assessment_id: (optional) The ID of the assessment. + :param str assessment_method: (optional) The assessment method. + :param str component_id: (optional) The ID of component. + :param str target_id: (optional) The ID of the evaluation target. + :param str target_env: (optional) The environment of the evaluation target. + :param str target_name: (optional) The name of the evaluation target. + :param str status: (optional) The evaluation status value. + :param int limit: (optional) The indication of many resources to return, + unless the response is the last page of resources. + :param str sort: (optional) This field sorts results by using a valid sort + field. To learn more, see + [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the subscope. """ self._has_next = True self._client = client self._page_context = {'next': None} - self._profile_id = profile_id - self._x_correlation_id = x_correlation_id - self._x_request_id = x_request_id + self._instance_id = instance_id + self._report_id = report_id + self._assessment_id = assessment_id + self._assessment_method = assessment_method + self._component_id = component_id + self._target_id = target_id + self._target_env = target_env + self._target_name = target_name + self._status = status self._limit = limit + self._sort = sort + self._scope_id = scope_id + self._subscope_id = subscope_id def has_next(self) -> bool: """ @@ -12834,17 +18585,26 @@ def has_next(self) -> bool: def get_next(self) -> List[dict]: """ Returns the next page of results. - :return: A List[dict], where each element is a dict that represents an instance of AttachmentItem. + :return: A List[dict], where each element is a dict that represents an instance of Evaluation. :rtype: List[dict] """ if not self.has_next(): raise StopIteration(message='No more results available') - result = self._client.list_attachments( - profile_id=self._profile_id, - x_correlation_id=self._x_correlation_id, - x_request_id=self._x_request_id, + result = self._client.list_report_evaluations( + instance_id=self._instance_id, + report_id=self._report_id, + assessment_id=self._assessment_id, + assessment_method=self._assessment_method, + component_id=self._component_id, + target_id=self._target_id, + target_env=self._target_env, + target_name=self._target_name, + status=self._status, limit=self._limit, + sort=self._sort, + scope_id=self._scope_id, + subscope_id=self._subscope_id, start=self._page_context.get('next'), ).get_result() @@ -12856,13 +18616,13 @@ def get_next(self) -> List[dict]: if next is None: self._has_next = False - return result.get('attachments') + return result.get('evaluations') def get_all(self) -> List[dict]: """ Returns all results by invoking get_next() repeatedly until all pages of results have been retrieved. - :return: A List[dict], where each element is a dict that represents an instance of AttachmentItem. + :return: A List[dict], where each element is a dict that represents an instance of Evaluation. :rtype: List[dict] """ results = [] @@ -12872,40 +18632,59 @@ def get_all(self) -> List[dict]: return results -class AttachmentsAccountPager: +class ReportResourcesPager: """ - AttachmentsAccountPager can be used to simplify the use of the "list_attachments_account" method. + ReportResourcesPager can be used to simplify the use of the "list_report_resources" method. """ def __init__( self, *, client: SecurityAndComplianceCenterApiV3, - x_correlation_id: str = None, - x_request_id: str = None, + instance_id: str, + report_id: str, + id: str = None, + resource_name: str = None, + account_id: str = None, + component_id: str = None, + status: str = None, + sort: str = None, limit: int = None, + scope_id: str = None, + subscope_id: str = None, ) -> None: """ - Initialize a AttachmentsAccountPager object. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param int limit: (optional) The indication of how many resources to - return, unless the response is the last page of resources. + Initialize a ReportResourcesPager object. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str report_id: The ID of the scan that is associated with a report. + :param str id: (optional) The ID of the resource. + :param str resource_name: (optional) The name of the resource. + :param str account_id: (optional) The user account ID. + :param str component_id: (optional) The ID of component. + :param str status: (optional) The compliance status value. + :param str sort: (optional) This field sorts resources by using a valid + sort field. To learn more, see + [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + :param int limit: (optional) The indication of many resources to return, + unless the response is the last page of resources. + :param str scope_id: (optional) The ID of the scope. + :param str subscope_id: (optional) The ID of the subscope. """ self._has_next = True self._client = client self._page_context = {'next': None} - self._x_correlation_id = x_correlation_id - self._x_request_id = x_request_id + self._instance_id = instance_id + self._report_id = report_id + self._id = id + self._resource_name = resource_name + self._account_id = account_id + self._component_id = component_id + self._status = status + self._sort = sort self._limit = limit + self._scope_id = scope_id + self._subscope_id = subscope_id def has_next(self) -> bool: """ @@ -12916,16 +18695,24 @@ def has_next(self) -> bool: def get_next(self) -> List[dict]: """ Returns the next page of results. - :return: A List[dict], where each element is a dict that represents an instance of AttachmentItem. + :return: A List[dict], where each element is a dict that represents an instance of Resource. :rtype: List[dict] """ if not self.has_next(): raise StopIteration(message='No more results available') - result = self._client.list_attachments_account( - x_correlation_id=self._x_correlation_id, - x_request_id=self._x_request_id, + result = self._client.list_report_resources( + instance_id=self._instance_id, + report_id=self._report_id, + id=self._id, + resource_name=self._resource_name, + account_id=self._account_id, + component_id=self._component_id, + status=self._status, + sort=self._sort, limit=self._limit, + scope_id=self._scope_id, + subscope_id=self._subscope_id, start=self._page_context.get('next'), ).get_result() @@ -12937,13 +18724,13 @@ def get_next(self) -> List[dict]: if next is None: self._has_next = False - return result.get('attachments') + return result.get('resources') def get_all(self) -> List[dict]: """ Returns all results by invoking get_next() repeatedly until all pages of results have been retrieved. - :return: A List[dict], where each element is a dict that represents an instance of AttachmentItem. + :return: A List[dict], where each element is a dict that represents an instance of Resource. :rtype: List[dict] """ results = [] @@ -12953,56 +18740,45 @@ def get_all(self) -> List[dict]: return results -class ReportsPager: +class RulesPager: """ - ReportsPager can be used to simplify the use of the "list_reports" method. + RulesPager can be used to simplify the use of the "list_rules" method. """ def __init__( self, *, client: SecurityAndComplianceCenterApiV3, - x_correlation_id: str = None, - x_request_id: str = None, - attachment_id: str = None, - group_id: str = None, - profile_id: str = None, - type: str = None, + instance_id: str, limit: int = None, + type: str = None, + search: str = None, + service_name: str = None, sort: str = None, ) -> None: """ - Initialize a ReportsPager object. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. - :param str attachment_id: (optional) The ID of the attachment. - :param str group_id: (optional) The report group ID. - :param str profile_id: (optional) The ID of the profile. - :param str type: (optional) The type of the scan. - :param int limit: (optional) The indication of many resources to return, - unless the response is the last page of resources. - :param str sort: (optional) This field sorts results by using a valid sort - field. To learn more, see - [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). + Initialize a RulesPager object. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param int limit: (optional) The indication of how many resources to + return, unless the response is the last page of resources. + :param str type: (optional) The list of only user-defined, or + system-defined rules. + :param str search: (optional) The indication of whether to search for rules + with a specific string string in the name, description, or labels. + :param str service_name: (optional) Searches for rules targeting + corresponding service. + :param str sort: (optional) Field used to sort rules. Rules can be sorted + in ascending or descending order. """ self._has_next = True self._client = client self._page_context = {'next': None} - self._x_correlation_id = x_correlation_id - self._x_request_id = x_request_id - self._attachment_id = attachment_id - self._group_id = group_id - self._profile_id = profile_id - self._type = type + self._instance_id = instance_id self._limit = limit + self._type = type + self._search = search + self._service_name = service_name self._sort = sort def has_next(self) -> bool: @@ -13014,20 +18790,18 @@ def has_next(self) -> bool: def get_next(self) -> List[dict]: """ Returns the next page of results. - :return: A List[dict], where each element is a dict that represents an instance of Report. + :return: A List[dict], where each element is a dict that represents an instance of Rule. :rtype: List[dict] """ if not self.has_next(): raise StopIteration(message='No more results available') - result = self._client.list_reports( - x_correlation_id=self._x_correlation_id, - x_request_id=self._x_request_id, - attachment_id=self._attachment_id, - group_id=self._group_id, - profile_id=self._profile_id, - type=self._type, + result = self._client.list_rules( + instance_id=self._instance_id, limit=self._limit, + type=self._type, + search=self._search, + service_name=self._service_name, sort=self._sort, start=self._page_context.get('next'), ).get_result() @@ -13035,18 +18809,18 @@ def get_next(self) -> List[dict]: next = None next_page_link = result.get('next') if next_page_link is not None: - next = get_query_param(next_page_link.get('href'), 'start') + next = next_page_link.get('start') self._page_context['next'] = next if next is None: self._has_next = False - return result.get('reports') + return result.get('rules') def get_all(self) -> List[dict]: """ Returns all results by invoking get_next() repeatedly until all pages of results have been retrieved. - :return: A List[dict], where each element is a dict that represents an instance of Report. + :return: A List[dict], where each element is a dict that represents an instance of Rule. :rtype: List[dict] """ results = [] @@ -13056,58 +18830,41 @@ def get_all(self) -> List[dict]: return results -class ReportEvaluationsPager: +class ScopesPager: """ - ReportEvaluationsPager can be used to simplify the use of the "list_report_evaluations" method. + ScopesPager can be used to simplify the use of the "list_scopes" method. """ def __init__( self, *, client: SecurityAndComplianceCenterApiV3, - report_id: str, - x_correlation_id: str = None, - x_request_id: str = None, - assessment_id: str = None, - component_id: str = None, - target_id: str = None, - target_name: str = None, - status: str = None, + instance_id: str, limit: int = None, + name: str = None, + description: str = None, + environment: str = None, ) -> None: """ - Initialize a ReportEvaluationsPager object. - :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. - :param str assessment_id: (optional) The ID of the assessment. - :param str component_id: (optional) The ID of component. - :param str target_id: (optional) The ID of the evaluation target. - :param str target_name: (optional) The name of the evaluation target. - :param str status: (optional) The evaluation status value. - :param int limit: (optional) The indication of many resources to return, - unless the response is the last page of resources. + Initialize a ScopesPager object. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param int limit: (optional) The indication of how many resources to + return, unless the response is the last page of resources. + :param str name: (optional) determine name of scope returned in response. + :param str description: (optional) determine descriptions of scope returned + in response. + :param str environment: (optional) determine environment of scopes returned + in response. """ self._has_next = True self._client = client self._page_context = {'next': None} - self._report_id = report_id - self._x_correlation_id = x_correlation_id - self._x_request_id = x_request_id - self._assessment_id = assessment_id - self._component_id = component_id - self._target_id = target_id - self._target_name = target_name - self._status = status + self._instance_id = instance_id self._limit = limit + self._name = name + self._description = description + self._environment = environment def has_next(self) -> bool: """ @@ -13118,40 +18875,36 @@ def has_next(self) -> bool: def get_next(self) -> List[dict]: """ Returns the next page of results. - :return: A List[dict], where each element is a dict that represents an instance of Evaluation. + :return: A List[dict], where each element is a dict that represents an instance of Scope. :rtype: List[dict] """ if not self.has_next(): raise StopIteration(message='No more results available') - result = self._client.list_report_evaluations( - report_id=self._report_id, - x_correlation_id=self._x_correlation_id, - x_request_id=self._x_request_id, - assessment_id=self._assessment_id, - component_id=self._component_id, - target_id=self._target_id, - target_name=self._target_name, - status=self._status, + result = self._client.list_scopes( + instance_id=self._instance_id, limit=self._limit, + name=self._name, + description=self._description, + environment=self._environment, start=self._page_context.get('next'), ).get_result() next = None next_page_link = result.get('next') if next_page_link is not None: - next = get_query_param(next_page_link.get('href'), 'start') + next = next_page_link.get('start') self._page_context['next'] = next if next is None: self._has_next = False - return result.get('evaluations') + return result.get('scopes') def get_all(self) -> List[dict]: """ Returns all results by invoking get_next() repeatedly until all pages of results have been retrieved. - :return: A List[dict], where each element is a dict that represents an instance of Evaluation. + :return: A List[dict], where each element is a dict that represents an instance of Scope. :rtype: List[dict] """ results = [] @@ -13161,63 +18914,45 @@ def get_all(self) -> List[dict]: return results -class ReportResourcesPager: +class SubscopesPager: """ - ReportResourcesPager can be used to simplify the use of the "list_report_resources" method. + SubscopesPager can be used to simplify the use of the "list_subscopes" method. """ def __init__( self, *, client: SecurityAndComplianceCenterApiV3, - report_id: str, - x_correlation_id: str = None, - x_request_id: str = None, - id: str = None, - resource_name: str = None, - account_id: str = None, - component_id: str = None, - status: str = None, - sort: str = None, + instance_id: str, + scope_id: str, limit: int = None, + name: str = None, + description: str = None, + environment: str = None, ) -> None: """ - Initialize a ReportResourcesPager object. - :param str report_id: The ID of the scan that is associated with a report. - :param str x_correlation_id: (optional) The supplied or generated value of - this header is logged for a request and repeated in a response header for - the corresponding response. The same value is used for downstream requests - and retries of those requests. If a value of this header is not supplied in - a request, the service generates a random (version 4) UUID. - :param str x_request_id: (optional) The supplied or generated value of this - header is logged for a request and repeated in a response header for the - corresponding response. The same value is not used for downstream requests - and retries of those requests. If a value of this header is not supplied - in a request, the service generates a random (version 4) UUID. - :param str id: (optional) The ID of the resource. - :param str resource_name: (optional) The name of the resource. - :param str account_id: (optional) The ID of the account owning a resource. - :param str component_id: (optional) The ID of component. - :param str status: (optional) The compliance status value. - :param str sort: (optional) This field sorts resources by using a valid - sort field. To learn more, see - [Sorting](https://cloud.ibm.com/docs/api-handbook?topic=api-handbook-sorting). - :param int limit: (optional) The indication of many resources to return, - unless the response is the last page of resources. + Initialize a SubscopesPager object. + :param str instance_id: The ID of the Security and Compliance Center + instance. + :param str scope_id: The ID of the scope being targeted. + :param int limit: (optional) The indication of how many resources to + return, unless the response is the last page of resources. + :param str name: (optional) determine name of subscope returned in + response. + :param str description: (optional) determine descriptions of subscopes + returned in response. + :param str environment: (optional) determine environment of subscopes + returned in response. """ self._has_next = True self._client = client self._page_context = {'next': None} - self._report_id = report_id - self._x_correlation_id = x_correlation_id - self._x_request_id = x_request_id - self._id = id - self._resource_name = resource_name - self._account_id = account_id - self._component_id = component_id - self._status = status - self._sort = sort + self._instance_id = instance_id + self._scope_id = scope_id self._limit = limit + self._name = name + self._description = description + self._environment = environment def has_next(self) -> bool: """ @@ -13228,41 +18963,37 @@ def has_next(self) -> bool: def get_next(self) -> List[dict]: """ Returns the next page of results. - :return: A List[dict], where each element is a dict that represents an instance of Resource. + :return: A List[dict], where each element is a dict that represents an instance of SubScope. :rtype: List[dict] """ if not self.has_next(): raise StopIteration(message='No more results available') - result = self._client.list_report_resources( - report_id=self._report_id, - x_correlation_id=self._x_correlation_id, - x_request_id=self._x_request_id, - id=self._id, - resource_name=self._resource_name, - account_id=self._account_id, - component_id=self._component_id, - status=self._status, - sort=self._sort, + result = self._client.list_subscopes( + instance_id=self._instance_id, + scope_id=self._scope_id, limit=self._limit, + name=self._name, + description=self._description, + environment=self._environment, start=self._page_context.get('next'), ).get_result() next = None next_page_link = result.get('next') if next_page_link is not None: - next = get_query_param(next_page_link.get('href'), 'start') + next = next_page_link.get('start') self._page_context['next'] = next if next is None: self._has_next = False - return result.get('resources') + return result.get('subscopes') def get_all(self) -> List[dict]: """ Returns all results by invoking get_next() repeatedly until all pages of results have been retrieved. - :return: A List[dict], where each element is a dict that represents an instance of Resource. + :return: A List[dict], where each element is a dict that represents an instance of SubScope. :rtype: List[dict] """ results = [] diff --git a/ibm_scc/version.py b/ibm_scc/version.py index 799a16a..1280279 100644 --- a/ibm_scc/version.py +++ b/ibm_scc/version.py @@ -17,4 +17,4 @@ """ Version of mysdk """ -__version__ = '4.0.1' \ No newline at end of file +__version__ = '5.0.0' \ No newline at end of file diff --git a/setup.py b/setup.py index ae678bf..4cbe548 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ import sys import pkg_resources -__version__ = '4.0.1' +__version__ = '5.0.0' PACKAGE_NAME = 'ibm_scc' PACKAGE_DESC = 'Python client library for IBM Cloud Security & Compliance Center Services' diff --git a/test/integration/test_security_and_compliance_center_api_v3.py b/test/integration/test_security_and_compliance_center_api_v3.py new file mode 100644 index 0000000..25ef4b3 --- /dev/null +++ b/test/integration/test_security_and_compliance_center_api_v3.py @@ -0,0 +1,1670 @@ +# -*- coding: utf-8 -*- +# (C) Copyright IBM Corp. 2025. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Integration Tests for SecurityAndComplianceCenterApiV3 +""" + +from ibm_cloud_sdk_core import * +import os +import pytest +from ibm_scc.security_and_compliance_center_api_v3 import * + +# Config file name +config_file = 'security_and_compliance_center_api_v3.env' + +# Variables to hold link values +account_id_for_report_link = None +attachment_id_for_report_link = None +attachment_id_link = None +control_library_id_link = None +e_tag_link = None +event_notifications_crn_for_update_settings_link = None +group_id_for_report_link = None +object_storage_bucket_for_update_settings_link = None +object_storage_crn_for_update_settings_link = None +object_storage_location_for_update_settings_link = None +profile_id_for_report_link = None +profile_id_link = None +provider_type_id_link = None +provider_type_instance_id_link = None +report_id_for_report_link = None +rule_id_link = None +scope_id_link = None +sub_scope_id_link = None +type_for_report_link = None + + +class TestSecurityAndComplianceCenterApiV3: + """ + Integration Test Class for SecurityAndComplianceCenterApiV3 + """ + + @classmethod + def setup_class(cls): + if os.path.exists(config_file): + os.environ['IBM_CREDENTIALS_FILE'] = config_file + + cls.security_and_compliance_center_api_service = SecurityAndComplianceCenterApiV3.new_instance( + ) + assert cls.security_and_compliance_center_api_service is not None + + cls.config = read_external_sources(SecurityAndComplianceCenterApiV3.DEFAULT_SERVICE_NAME) + assert cls.config is not None + + cls.security_and_compliance_center_api_service.enable_retries() + + print('Setup complete.') + + needscredentials = pytest.mark.skipif( + not os.path.exists(config_file), reason="External configuration not available, skipping..." + ) + + @needscredentials + def test_get_latest_reports(self): + global account_id_for_report_link + global report_id_for_report_link + global attachment_id_for_report_link + global group_id_for_report_link + global profile_id_for_report_link + global type_for_report_link + + response = self.security_and_compliance_center_api_service.get_latest_reports( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + sort='profile_name', + ) + + assert response.get_status_code() == 200 + report_latest = response.get_result() + assert report_latest is not None + + account_id_for_report_link = report_latest['reports'][0]['account']['id'] + report_id_for_report_link = report_latest['reports'][0]['id'] + attachment_id_for_report_link = report_latest['reports'][0]['attachment']['id'] + group_id_for_report_link = report_latest['reports'][0]['group_id'] + profile_id_for_report_link = report_latest['reports'][0]['profile']['id'] + type_for_report_link = report_latest['reports'][0]['type'] + + @needscredentials + def test_create_profile_attachment(self): + global attachment_id_link + + # Construct a dict representation of a Parameter model + parameter_model = { + 'assessment_type': 'automated', + 'assessment_id': 'rule-e16fcfea-fe21-4d30-a721-423611481fea', + 'parameter_name': 'tls_version', + 'parameter_display_name': 'IBM Cloud Internet Services TLS version', + 'parameter_type': 'string_list', + 'parameter_value': '["1.2", "1.3"]', + } + # Construct a dict representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model = { + 'threshold_limit': 15, + 'failed_control_ids': [], + } + # Construct a dict representation of a AttachmentNotifications model + attachment_notifications_model = { + 'enabled': True, + 'controls': attachment_notifications_controls_model, + } + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = { + 'name': 'scope_type', + 'value': 'account', + } + # Construct a dict representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model = { + 'id': '8baad3b5-2e69-4027-9967-efac19508e1c', + 'environment': 'testString', + 'properties': [scope_property_model], + } + # Construct a dict representation of a DateRange model + date_range_model = { + 'start_date': '2025-02-28T05:42:58.000Z', + 'end_date': '2025-02-28T05:42:58.000Z', + } + # Construct a dict representation of a ProfileAttachmentBase model + profile_attachment_base_model = { + 'attachment_parameters': [parameter_model], + 'description': 'This is a profile attachment targeting IBM CIS Foundation using a SDK', + 'name': 'Profile Attachment for IBM CIS Foundation SDK test', + 'notifications': attachment_notifications_model, + 'schedule': 'daily', + 'scope': [multi_cloud_scope_payload_model], + 'status': 'disabled', + 'data_selection_range': date_range_model, + } + + response = self.security_and_compliance_center_api_service.create_profile_attachment( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + attachments=[profile_attachment_base_model], + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 201 + profile_attachment_response = response.get_result() + assert profile_attachment_response is not None + + attachment_id_link = profile_attachment_response['attachments'][0]['id'] + + @needscredentials + def test_create_custom_control_library(self): + global control_library_id_link + + # Construct a dict representation of a AssessmentPrototype model + assessment_prototype_model = { + 'assessment_id': 'rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e', + 'assessment_description': 'This rule will check on regulation', + } + # Construct a dict representation of a ControlSpecificationPrototype model + control_specification_prototype_model = { + 'component_id': 'apprapp', + 'environment': 'ibm-cloud', + 'control_specification_id': 'testString', + 'control_specification_description': 'This field is used to describe a control specification', + 'assessments': [assessment_prototype_model], + } + # Construct a dict representation of a ControlDoc model + control_doc_model = { + 'control_docs_id': 'testString', + 'control_docs_type': 'testString', + } + # Construct a dict representation of a ControlPrototype model + control_prototype_model = { + 'control_name': 'security', + 'control_description': 'This is a description of a control', + 'control_category': 'test-control', + 'control_requirement': True, + 'control_parent': 'testString', + 'control_specifications': [control_specification_prototype_model], + 'control_docs': control_doc_model, + 'status': 'disabled', + } + + response = self.security_and_compliance_center_api_service.create_custom_control_library( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + control_library_name='custom control library from SDK', + control_library_description='This is a custom control library made from the SDK test framework', + control_library_type='custom', + control_library_version='0.0.1', + controls=[control_prototype_model], + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 201 + control_library = response.get_result() + assert control_library is not None + + control_library_id_link = control_library['id'] + + @needscredentials + def test_create_profile(self): + global profile_id_link + + # Construct a dict representation of a ProfileControlsPrototype model + profile_controls_prototype_model = { + 'control_library_id': 'testString', + 'control_id': 'testString', + } + # Construct a dict representation of a DefaultParameters model + default_parameters_model = { + 'assessment_type': 'testString', + 'assessment_id': 'testString', + 'parameter_name': 'testString', + 'parameter_default_value': 'testString', + 'parameter_display_name': 'testString', + 'parameter_type': 'testString', + } + + response = self.security_and_compliance_center_api_service.create_profile( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + controls=[profile_controls_prototype_model], + default_parameters=[default_parameters_model], + profile_name='testString', + profile_description='testString', + profile_version='testString', + latest=True, + version_group_label='testString', + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 201 + profile = response.get_result() + assert profile is not None + + profile_id_link = profile['id'] + + @needscredentials + def test_create_rule(self): + global e_tag_link + global rule_id_link + + # Construct a dict representation of a AdditionalTargetAttribute model + additional_target_attribute_model = { + 'name': 'location', + 'operator': 'string_equals', + 'value': 'us-east', + } + # Construct a dict representation of a RuleTargetPrototype model + rule_target_prototype_model = { + 'service_name': 'cloud-object-storage', + 'resource_kind': 'bucket', + 'additional_target_attributes': [additional_target_attribute_model], + } + # Construct a dict representation of a RequiredConfigConditionBase model + required_config_model = { + 'description': 'The Cloud Object Storage rule.', + 'property': 'testString', + 'operator': 'string_equals', + 'value': 'testString', + } + # Construct a dict representation of a RuleParameter model + rule_parameter_model = { + 'name': 'hard_quota', + 'display_name': 'The Cloud Object Storage bucket quota.', + 'description': 'The maximum bytes that are allocated to the Cloud Object Storage bucket.', + 'type': 'numeric', + } + # Construct a dict representation of a Import model + import_model = { + 'parameters': [rule_parameter_model], + } + + response = self.security_and_compliance_center_api_service.create_rule( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + description='Example rule', + target=rule_target_prototype_model, + required_config=required_config_model, + version='1.0.0', + import_=import_model, + labels=[], + ) + + assert response.get_status_code() == 201 + rule = response.get_result() + assert rule is not None + + e_tag_link = response.get_headers().get('ETag') + rule_id_link = rule['id'] + + @needscredentials + def test_get_rule(self): + global e_tag_link + + response = self.security_and_compliance_center_api_service.get_rule( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + rule_id='rule-8d444f8c-fd1d-48de-bcaa-f43732568761', + ) + + assert response.get_status_code() == 200 + rule = response.get_result() + assert rule is not None + + e_tag_link = response.get_headers().get('ETag') + + @needscredentials + def test_replace_rule(self): + global e_tag_link + + # Construct a dict representation of a AdditionalTargetAttribute model + additional_target_attribute_model = { + 'name': 'location', + 'operator': 'string_equals', + 'value': 'us-south', + } + # Construct a dict representation of a RuleTargetPrototype model + rule_target_prototype_model = { + 'service_name': 'cloud-object-storage', + 'resource_kind': 'bucket', + 'additional_target_attributes': [additional_target_attribute_model], + } + # Construct a dict representation of a RequiredConfigConditionBase model + required_config_model = { + 'description': 'The Cloud Object Storage rule.', + 'property': 'testString', + 'operator': 'string_equals', + 'value': 'testString', + } + # Construct a dict representation of a RuleParameter model + rule_parameter_model = { + 'name': 'hard_quota', + 'display_name': 'The Cloud Object Storage bucket quota.', + 'description': 'The maximum bytes that are allocated to the Cloud Object Storage bucket.', + 'type': 'numeric', + } + # Construct a dict representation of a Import model + import_model = { + 'parameters': [rule_parameter_model], + } + + response = self.security_and_compliance_center_api_service.replace_rule( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + rule_id='rule-8d444f8c-fd1d-48de-bcaa-f43732568761', + if_match='testString', + description='Example rule', + target=rule_target_prototype_model, + required_config=required_config_model, + version='1.0.1', + import_=import_model, + labels=[], + ) + + assert response.get_status_code() == 200 + rule = response.get_result() + assert rule is not None + + e_tag_link = response.get_headers().get('ETag') + + @needscredentials + def test_create_scope(self): + global scope_id_link + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = { + 'name': 'scope_id', + 'value': '1234567', + } + + response = self.security_and_compliance_center_api_service.create_scope( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + name='ibm scope', + description='The scope that is defined for IBM resources.', + environment='ibm-cloud', + properties=[scope_property_model], + ) + + assert response.get_status_code() == 201 + scope = response.get_result() + assert scope is not None + + scope_id_link = scope['id'] + + @needscredentials + def test_create_subscope(self): + global sub_scope_id_link + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = { + 'name': 'scope_id', + 'value': '1234567', + } + # Construct a dict representation of a ScopePrototype model + scope_prototype_model = { + 'name': 'ibm subscope', + 'description': 'The subscope that is defined for IBM resources.', + 'environment': 'ibm-cloud', + 'properties': [scope_property_model], + } + + response = self.security_and_compliance_center_api_service.create_subscope( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + subscopes=[scope_prototype_model], + ) + + assert response.get_status_code() == 201 + sub_scope_response = response.get_result() + assert sub_scope_response is not None + + sub_scope_id_link = sub_scope_response['subscopes'][0]['id'] + + @needscredentials + def test_get_settings(self): + global event_notifications_crn_for_update_settings_link + global object_storage_crn_for_update_settings_link + global object_storage_bucket_for_update_settings_link + global object_storage_location_for_update_settings_link + + response = self.security_and_compliance_center_api_service.get_settings( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + ) + + assert response.get_status_code() == 200 + settings = response.get_result() + assert settings is not None + + event_notifications_crn_for_update_settings_link = settings['event_notifications']['instance_crn'] + object_storage_crn_for_update_settings_link = settings['object_storage']['instance_crn'] + object_storage_bucket_for_update_settings_link = settings['object_storage']['bucket'] + object_storage_location_for_update_settings_link = settings['object_storage']['bucket_location'] + + @needscredentials + def test_list_instance_attachments(self): + response = self.security_and_compliance_center_api_service.list_instance_attachments( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + account_id=account_id_for_report_link, + version_group_label='testString', + limit=25, + sort='created_on', + direction='desc', + start='testString', + ) + + assert response.get_status_code() == 200 + profile_attachment_collection = response.get_result() + assert profile_attachment_collection is not None + + @needscredentials + def test_list_instance_attachments_with_pager(self): + all_results = [] + + # Test get_next(). + pager = InstanceAttachmentsPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + account_id=account_id_for_report_link, + version_group_label='testString', + limit=10, + sort='created_on', + direction='desc', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + + # Test get_all(). + pager = InstanceAttachmentsPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + account_id=account_id_for_report_link, + version_group_label='testString', + limit=10, + sort='created_on', + direction='desc', + ) + all_items = pager.get_all() + assert all_items is not None + + assert len(all_results) == len(all_items) + print(f'\nlist_instance_attachments() returned a total of {len(all_results)} items(s) using InstanceAttachmentsPager.') + + @needscredentials + def test_get_profile_attachment(self): + response = self.security_and_compliance_center_api_service.get_profile_attachment( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + attachment_id=attachment_id_link, + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile_attachment = response.get_result() + assert profile_attachment is not None + + @needscredentials + def test_replace_profile_attachment(self): + # Construct a dict representation of a Parameter model + parameter_model = { + 'assessment_type': 'testString', + 'assessment_id': 'testString', + 'parameter_name': 'location', + 'parameter_display_name': 'Location', + 'parameter_type': 'string', + 'parameter_value': 'testString', + } + # Construct a dict representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model = { + 'threshold_limit': 15, + 'failed_control_ids': ['testString'], + } + # Construct a dict representation of a AttachmentNotifications model + attachment_notifications_model = { + 'enabled': True, + 'controls': attachment_notifications_controls_model, + } + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = { + 'name': 'scope_type', + 'value': 'account', + } + # Construct a dict representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model = { + 'id': 'testString', + 'environment': 'testString', + 'properties': [scope_property_model], + } + # Construct a dict representation of a DateRange model + date_range_model = { + 'start_date': '2025-02-28T05:42:58.000Z', + 'end_date': '2025-02-28T05:42:58.000Z', + } + # Construct a dict representation of a ProfileAttachmentBase model + profile_attachment_base_model = { + 'attachment_parameters': [parameter_model], + 'description': 'testString', + 'name': 'testString', + 'notifications': attachment_notifications_model, + 'schedule': 'daily', + 'scope': [multi_cloud_scope_payload_model], + 'status': 'enabled', + 'data_selection_range': date_range_model, + } + + response = self.security_and_compliance_center_api_service.replace_profile_attachment( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + attachment_id=attachment_id_link, + attachments=[profile_attachment_base_model], + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile_attachment = response.get_result() + assert profile_attachment is not None + + @needscredentials + def test_upgrade_attachment(self): + # Construct a dict representation of a Parameter model + parameter_model = { + 'assessment_type': 'testString', + 'assessment_id': 'testString', + 'parameter_name': 'location', + 'parameter_display_name': 'Location', + 'parameter_type': 'string', + 'parameter_value': 'testString', + } + + response = self.security_and_compliance_center_api_service.upgrade_attachment( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + attachment_id=attachment_id_link, + attachment_parameters=[parameter_model], + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile_attachment = response.get_result() + assert profile_attachment is not None + + @needscredentials + def test_create_scan(self): + response = self.security_and_compliance_center_api_service.create_scan( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + attachment_id='testString', + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 201 + create_scan_response = response.get_result() + assert create_scan_response is not None + + @needscredentials + def test_list_control_libraries(self): + response = self.security_and_compliance_center_api_service.list_control_libraries( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + control_library_collection = response.get_result() + assert control_library_collection is not None + + @needscredentials + def test_replace_custom_control_library(self): + # Construct a dict representation of a AssessmentPrototype model + assessment_prototype_model = { + 'assessment_id': 'testString', + 'assessment_description': 'testString', + } + # Construct a dict representation of a ControlSpecificationPrototype model + control_specification_prototype_model = { + 'component_id': 'testString', + 'environment': 'ibm-cloud', + 'control_specification_id': 'testString', + 'control_specification_description': 'testString', + 'assessments': [assessment_prototype_model], + } + # Construct a dict representation of a ControlDoc model + control_doc_model = { + 'control_docs_id': 'testString', + 'control_docs_type': 'testString', + } + # Construct a dict representation of a ControlPrototype model + control_prototype_model = { + 'control_name': 'testString', + 'control_description': 'testString', + 'control_category': 'testString', + 'control_requirement': True, + 'control_parent': 'testString', + 'control_specifications': [control_specification_prototype_model], + 'control_docs': control_doc_model, + 'status': 'testString', + } + + response = self.security_and_compliance_center_api_service.replace_custom_control_library( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + control_library_id=control_library_id_link, + control_library_name='testString', + control_library_description='testString', + control_library_type='custom', + control_library_version='testString', + controls=[control_prototype_model], + bss_account='testString', + ) + + assert response.get_status_code() == 200 + control_library = response.get_result() + assert control_library is not None + + @needscredentials + def test_get_control_library(self): + response = self.security_and_compliance_center_api_service.get_control_library( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + control_library_id=control_library_id_link, + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + control_library = response.get_result() + assert control_library is not None + + @needscredentials + def test_list_profiles(self): + response = self.security_and_compliance_center_api_service.list_profiles( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile_collection = response.get_result() + assert profile_collection is not None + + @needscredentials + def test_replace_profile(self): + # Construct a dict representation of a ProfileControlsPrototype model + profile_controls_prototype_model = { + 'control_library_id': 'testString', + 'control_id': 'testString', + } + # Construct a dict representation of a DefaultParameters model + default_parameters_model = { + 'assessment_type': 'testString', + 'assessment_id': 'testString', + 'parameter_name': 'testString', + 'parameter_default_value': 'testString', + 'parameter_display_name': 'testString', + 'parameter_type': 'testString', + } + + response = self.security_and_compliance_center_api_service.replace_profile( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + controls=[profile_controls_prototype_model], + default_parameters=[default_parameters_model], + profile_name='testString', + profile_description='testString', + profile_version='testString', + latest=True, + version_group_label='testString', + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile = response.get_result() + assert profile is not None + + @needscredentials + def test_get_profile(self): + response = self.security_and_compliance_center_api_service.get_profile( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile = response.get_result() + assert profile is not None + + @needscredentials + def test_replace_profile_parameters(self): + # Construct a dict representation of a DefaultParameters model + default_parameters_model = { + 'assessment_type': 'testString', + 'assessment_id': 'testString', + 'parameter_name': 'testString', + 'parameter_default_value': 'testString', + 'parameter_display_name': 'testString', + 'parameter_type': 'testString', + } + + response = self.security_and_compliance_center_api_service.replace_profile_parameters( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + default_parameters=[default_parameters_model], + id='testString', + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile_default_parameters_response = response.get_result() + assert profile_default_parameters_response is not None + + @needscredentials + def test_list_profile_parameters(self): + response = self.security_and_compliance_center_api_service.list_profile_parameters( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + ) + + assert response.get_status_code() == 200 + profile_default_parameters_response = response.get_result() + assert profile_default_parameters_response is not None + + @needscredentials + def test_compare_profiles(self): + response = self.security_and_compliance_center_api_service.compare_profiles( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + compare_predefined_profiles_response = response.get_result() + assert compare_predefined_profiles_response is not None + + @needscredentials + def test_list_profile_attachments(self): + response = self.security_and_compliance_center_api_service.list_profile_attachments( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile_attachment_collection = response.get_result() + assert profile_attachment_collection is not None + + @needscredentials + def test_list_provider_types(self): + global provider_type_id_link + + response = self.security_and_compliance_center_api_service.list_provider_types( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + ) + + assert response.get_status_code() == 200 + provider_type_collection = response.get_result() + assert provider_type_collection is not None + + provider_type_id_link = provider_type_collection['provider_types'][0]['id'] + + @needscredentials + def test_get_provider_type_by_id(self): + response = self.security_and_compliance_center_api_service.get_provider_type_by_id( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + provider_type_id=provider_type_id_link, + ) + + assert response.get_status_code() == 200 + provider_type = response.get_result() + assert provider_type is not None + + @needscredentials + def test_create_provider_type_instance(self): + global provider_type_instance_id_link + + response = self.security_and_compliance_center_api_service.create_provider_type_instance( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + provider_type_id=provider_type_id_link, + name='workload-protection-instance-1', + attributes={'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'}, + ) + + assert response.get_status_code() == 201 + provider_type_instance = response.get_result() + assert provider_type_instance is not None + + provider_type_instance_id_link = provider_type_instance['id'] + + @needscredentials + def test_list_provider_type_instances(self): + response = self.security_and_compliance_center_api_service.list_provider_type_instances( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + provider_type_id=provider_type_id_link, + ) + + assert response.get_status_code() == 200 + provider_type_instance_collection = response.get_result() + assert provider_type_instance_collection is not None + + @needscredentials + def test_get_provider_type_instance(self): + response = self.security_and_compliance_center_api_service.get_provider_type_instance( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + provider_type_id=provider_type_id_link, + provider_type_instance_id=provider_type_instance_id_link, + ) + + assert response.get_status_code() == 200 + provider_type_instance = response.get_result() + assert provider_type_instance is not None + + @needscredentials + def test_update_provider_type_instance(self): + response = self.security_and_compliance_center_api_service.update_provider_type_instance( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + provider_type_id=provider_type_id_link, + provider_type_instance_id=provider_type_instance_id_link, + name='workload-protection-instance-1', + attributes={'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'}, + ) + + assert response.get_status_code() == 200 + provider_type_instance = response.get_result() + assert provider_type_instance is not None + + @needscredentials + def test_list_reports(self): + response = self.security_and_compliance_center_api_service.list_reports( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + attachment_id=attachment_id_for_report_link, + group_id=group_id_for_report_link, + profile_id=profile_id_for_report_link, + type=type_for_report_link, + start='testString', + limit=50, + sort='profile_name', + ) + + assert response.get_status_code() == 200 + report_collection = response.get_result() + assert report_collection is not None + + @needscredentials + def test_list_reports_with_pager(self): + all_results = [] + + # Test get_next(). + pager = ReportsPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + attachment_id=attachment_id_for_report_link, + group_id=group_id_for_report_link, + profile_id=profile_id_for_report_link, + type=type_for_report_link, + limit=10, + sort='profile_name', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + + # Test get_all(). + pager = ReportsPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + attachment_id=attachment_id_for_report_link, + group_id=group_id_for_report_link, + profile_id=profile_id_for_report_link, + type=type_for_report_link, + limit=10, + sort='profile_name', + ) + all_items = pager.get_all() + assert all_items is not None + + assert len(all_results) == len(all_items) + print(f'\nlist_reports() returned a total of {len(all_results)} items(s) using ReportsPager.') + + @needscredentials + def test_get_report(self): + response = self.security_and_compliance_center_api_service.get_report( + report_id=report_id_for_report_link, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + subscope_id='testString', + ) + + assert response.get_status_code() == 200 + report = response.get_result() + assert report is not None + + @needscredentials + def test_get_report_summary(self): + response = self.security_and_compliance_center_api_service.get_report_summary( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + ) + + assert response.get_status_code() == 200 + report_summary = response.get_result() + assert report_summary is not None + + @needscredentials + def test_get_report_download_file(self): + response = self.security_and_compliance_center_api_service.get_report_download_file( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + accept='application/csv', + exclude_summary=True, + ) + + assert response.get_status_code() == 200 + result = response.get_result() + assert result is not None + + @needscredentials + def test_get_report_controls(self): + response = self.security_and_compliance_center_api_service.get_report_controls( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + control_id='testString', + control_name='testString', + control_description='testString', + control_category='testString', + status='compliant', + sort='control_name', + scope_id='testString', + subscope_id='testString', + ) + + assert response.get_status_code() == 200 + report_controls = response.get_result() + assert report_controls is not None + + @needscredentials + def test_get_report_rule(self): + response = self.security_and_compliance_center_api_service.get_report_rule( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + rule_id='rule-8d444f8c-fd1d-48de-bcaa-f43732568761', + ) + + assert response.get_status_code() == 200 + rule_info = response.get_result() + assert rule_info is not None + + @needscredentials + def test_list_report_evaluations(self): + response = self.security_and_compliance_center_api_service.list_report_evaluations( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + assessment_id='testString', + assessment_method='testString', + component_id='testString', + target_id='testString', + target_env='testString', + target_name='testString', + status='failure', + start='testString', + limit=50, + sort='profile_name', + scope_id='testString', + subscope_id='testString', + ) + + assert response.get_status_code() == 200 + evaluation_page = response.get_result() + assert evaluation_page is not None + + @needscredentials + def test_list_report_evaluations_with_pager(self): + all_results = [] + + # Test get_next(). + pager = ReportEvaluationsPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + assessment_id='testString', + assessment_method='testString', + component_id='testString', + target_id='testString', + target_env='testString', + target_name='testString', + status='failure', + limit=10, + sort='profile_name', + scope_id='testString', + subscope_id='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + + # Test get_all(). + pager = ReportEvaluationsPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + assessment_id='testString', + assessment_method='testString', + component_id='testString', + target_id='testString', + target_env='testString', + target_name='testString', + status='failure', + limit=10, + sort='profile_name', + scope_id='testString', + subscope_id='testString', + ) + all_items = pager.get_all() + assert all_items is not None + + assert len(all_results) == len(all_items) + print(f'\nlist_report_evaluations() returned a total of {len(all_results)} items(s) using ReportEvaluationsPager.') + + @needscredentials + def test_list_report_resources(self): + response = self.security_and_compliance_center_api_service.list_report_resources( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + id='testString', + resource_name='testString', + account_id=account_id_for_report_link, + component_id='testString', + status='compliant', + sort='account_id', + start='testString', + limit=50, + scope_id='testString', + subscope_id='testString', + ) + + assert response.get_status_code() == 200 + resource_page = response.get_result() + assert resource_page is not None + + @needscredentials + def test_list_report_resources_with_pager(self): + all_results = [] + + # Test get_next(). + pager = ReportResourcesPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + id='testString', + resource_name='testString', + account_id=account_id_for_report_link, + component_id='testString', + status='compliant', + sort='account_id', + limit=10, + scope_id='testString', + subscope_id='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + + # Test get_all(). + pager = ReportResourcesPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + id='testString', + resource_name='testString', + account_id=account_id_for_report_link, + component_id='testString', + status='compliant', + sort='account_id', + limit=10, + scope_id='testString', + subscope_id='testString', + ) + all_items = pager.get_all() + assert all_items is not None + + assert len(all_results) == len(all_items) + print(f'\nlist_report_resources() returned a total of {len(all_results)} items(s) using ReportResourcesPager.') + + @needscredentials + def test_get_report_tags(self): + response = self.security_and_compliance_center_api_service.get_report_tags( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + ) + + assert response.get_status_code() == 200 + report_tags = response.get_result() + assert report_tags is not None + + @needscredentials + def test_get_report_violations_drift(self): + response = self.security_and_compliance_center_api_service.get_report_violations_drift( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + scan_time_duration=0, + scope_id='testString', + subscope_id='testString', + ) + + assert response.get_status_code() == 200 + report_violations_drift = response.get_result() + assert report_violations_drift is not None + + @needscredentials + def test_list_scan_reports(self): + response = self.security_and_compliance_center_api_service.list_scan_reports( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + scope_id='testString', + subscope_id='testString', + ) + + assert response.get_status_code() == 200 + scan_report_collection = response.get_result() + assert scan_report_collection is not None + + @needscredentials + def test_create_scan_report(self): + response = self.security_and_compliance_center_api_service.create_scan_report( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + format='csv', + scope_id='132009ff-b982-412e-a110-ad8797e10f84', + subscope_id='c7ddcbcc-6a43-4ab3-b6a7-b2d8f65cd54a', + ) + + assert response.get_status_code() == 202 + create_scan_report = response.get_result() + assert create_scan_report is not None + + @needscredentials + def test_get_scan_report(self): + response = self.security_and_compliance_center_api_service.get_scan_report( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + job_id='testString', + ) + + assert response.get_status_code() == 200 + scan_report = response.get_result() + assert scan_report is not None + + @needscredentials + def test_get_scan_report_download_file(self): + response = self.security_and_compliance_center_api_service.get_scan_report_download_file( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id=report_id_for_report_link, + job_id='testString', + accept='application/csv', + ) + + assert response.get_status_code() == 200 + result = response.get_result() + assert result is not None + + @needscredentials + def test_list_rules(self): + response = self.security_and_compliance_center_api_service.list_rules( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=50, + start='testString', + type='system_defined', + search='testString', + service_name='testString', + sort='updated_on', + ) + + assert response.get_status_code() == 200 + rule_collection = response.get_result() + assert rule_collection is not None + + @needscredentials + def test_list_rules_with_pager(self): + all_results = [] + + # Test get_next(). + pager = RulesPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=10, + type='system_defined', + search='testString', + service_name='testString', + sort='updated_on', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + + # Test get_all(). + pager = RulesPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=10, + type='system_defined', + search='testString', + service_name='testString', + sort='updated_on', + ) + all_items = pager.get_all() + assert all_items is not None + + assert len(all_results) == len(all_items) + print(f'\nlist_rules() returned a total of {len(all_results)} items(s) using RulesPager.') + + @needscredentials + def test_list_scopes(self): + response = self.security_and_compliance_center_api_service.list_scopes( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=50, + start='testString', + name='testString', + description='testString', + environment='testString', + ) + + assert response.get_status_code() == 200 + scope_collection = response.get_result() + assert scope_collection is not None + + @needscredentials + def test_list_scopes_with_pager(self): + all_results = [] + + # Test get_next(). + pager = ScopesPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=10, + name='testString', + description='testString', + environment='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + + # Test get_all(). + pager = ScopesPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=10, + name='testString', + description='testString', + environment='testString', + ) + all_items = pager.get_all() + assert all_items is not None + + assert len(all_results) == len(all_items) + print(f'\nlist_scopes() returned a total of {len(all_results)} items(s) using ScopesPager.') + + @needscredentials + def test_update_scope(self): + response = self.security_and_compliance_center_api_service.update_scope( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + name='updated name of scope', + description='updated scope description', + ) + + assert response.get_status_code() == 200 + scope = response.get_result() + assert scope is not None + + @needscredentials + def test_get_scope(self): + response = self.security_and_compliance_center_api_service.get_scope( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + ) + + assert response.get_status_code() == 200 + scope = response.get_result() + assert scope is not None + + @needscredentials + def test_list_subscopes(self): + response = self.security_and_compliance_center_api_service.list_subscopes( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + limit=50, + start='testString', + name='testString', + description='testString', + environment='testString', + ) + + assert response.get_status_code() == 200 + sub_scope_collection = response.get_result() + assert sub_scope_collection is not None + + @needscredentials + def test_list_subscopes_with_pager(self): + all_results = [] + + # Test get_next(). + pager = SubscopesPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + limit=10, + name='testString', + description='testString', + environment='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + + # Test get_all(). + pager = SubscopesPager( + client=self.security_and_compliance_center_api_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + limit=10, + name='testString', + description='testString', + environment='testString', + ) + all_items = pager.get_all() + assert all_items is not None + + assert len(all_results) == len(all_items) + print(f'\nlist_subscopes() returned a total of {len(all_results)} items(s) using SubscopesPager.') + + @needscredentials + def test_get_subscope(self): + response = self.security_and_compliance_center_api_service.get_subscope( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + subscope_id='testString', + ) + + assert response.get_status_code() == 200 + sub_scope = response.get_result() + assert sub_scope is not None + + @needscredentials + def test_update_subscope(self): + response = self.security_and_compliance_center_api_service.update_subscope( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + subscope_id='testString', + name='updated name of scope', + description='updated scope description', + ) + + assert response.get_status_code() == 200 + sub_scope = response.get_result() + assert sub_scope is not None + + @needscredentials + def test_list_services(self): + response = self.security_and_compliance_center_api_service.list_services() + + assert response.get_status_code() == 200 + service_collection = response.get_result() + assert service_collection is not None + + @needscredentials + def test_get_service(self): + response = self.security_and_compliance_center_api_service.get_service( + services_name='cloud-object-storage', + ) + + assert response.get_status_code() == 200 + service = response.get_result() + assert service is not None + + @needscredentials + def test_update_settings(self): + # Construct a dict representation of a ObjectStoragePrototype model + object_storage_prototype_model = { + 'bucket': 'px-scan-results', + 'instance_crn': 'crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::', + } + # Construct a dict representation of a EventNotificationsPrototype model + event_notifications_prototype_model = { + 'instance_crn': 'crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::', + 'source_description': 'This source is used for integration with IBM Cloud Security and Compliance Center.', + 'source_name': 'scc-sdk-integration', + } + + response = self.security_and_compliance_center_api_service.update_settings( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + object_storage=object_storage_prototype_model, + event_notifications=event_notifications_prototype_model, + ) + + assert response.get_status_code() == 200 + settings = response.get_result() + assert settings is not None + + @needscredentials + def test_post_test_event(self): + response = self.security_and_compliance_center_api_service.post_test_event( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + ) + + assert response.get_status_code() == 202 + test_event = response.get_result() + assert test_event is not None + + @needscredentials + def test_create_target(self): + # Construct a dict representation of a Account model + account_model = { + 'id': '531fc3e28bfc43c5a2cea07786d93f5c', + 'name': 'NIST', + 'type': 'account_type', + } + # Construct a dict representation of a Tags model + tags_model = { + 'user': ['testString'], + 'access': ['testString'], + 'service': ['testString'], + } + # Construct a dict representation of a Resource model + resource_model = { + 'report_id': '30b434b3-cb08-4845-af10-7a8fc682b6a8', + 'home_account_id': '2411ffdc16844b07b42521c3443f456d', + 'id': 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::', + 'resource_name': 'jeff\'s key', + 'account': account_model, + 'component_id': 'cloud-object_storage', + 'component_name': 'cloud-object_storage', + 'environment': 'ibm cloud', + 'tags': tags_model, + 'status': 'compliant', + 'total_count': 140, + 'pass_count': 123, + 'failure_count': 12, + 'error_count': 5, + 'skipped_count': 7, + 'completed_count': 135, + 'service_name': 'pm-20', + 'instance_crn': 'testString', + } + # Construct a dict representation of a Credential model + credential_model = { + 'secret_crn': 'dummy', + 'resources': [resource_model], + } + + response = self.security_and_compliance_center_api_service.create_target( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + account_id='be200c80cabc456e91139e4152327823', + trusted_profile_id='Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3', + name='Target accountA', + credentials=[credential_model], + ) + + assert response.get_status_code() == 201 + target = response.get_result() + assert target is not None + + @needscredentials + def test_list_targets(self): + response = self.security_and_compliance_center_api_service.list_targets( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + ) + + assert response.get_status_code() == 200 + target_collection = response.get_result() + assert target_collection is not None + + @needscredentials + def test_get_target(self): + response = self.security_and_compliance_center_api_service.get_target( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + target_id='testString', + ) + + assert response.get_status_code() == 200 + target = response.get_result() + assert target is not None + + @needscredentials + def test_replace_target(self): + # Construct a dict representation of a Account model + account_model = { + 'id': '531fc3e28bfc43c5a2cea07786d93f5c', + 'name': 'NIST', + 'type': 'account_type', + } + # Construct a dict representation of a Tags model + tags_model = { + 'user': ['testString'], + 'access': ['testString'], + 'service': ['testString'], + } + # Construct a dict representation of a Resource model + resource_model = { + 'report_id': '30b434b3-cb08-4845-af10-7a8fc682b6a8', + 'home_account_id': '2411ffdc16844b07b42521c3443f456d', + 'id': 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::', + 'resource_name': 'jeff\'s key', + 'account': account_model, + 'component_id': 'cloud-object_storage', + 'component_name': 'cloud-object_storage', + 'environment': 'ibm cloud', + 'tags': tags_model, + 'status': 'compliant', + 'total_count': 140, + 'pass_count': 123, + 'failure_count': 12, + 'error_count': 5, + 'skipped_count': 7, + 'completed_count': 135, + 'service_name': 'pm-20', + 'instance_crn': 'testString', + } + # Construct a dict representation of a Credential model + credential_model = { + 'secret_crn': 'dummy', + 'resources': [resource_model], + } + + response = self.security_and_compliance_center_api_service.replace_target( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + target_id='testString', + account_id='be200c80cabc456e91139e4152327823', + trusted_profile_id='Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3', + name='Target accountA', + credentials=[credential_model], + ) + + assert response.get_status_code() == 200 + target = response.get_result() + assert target is not None + + @needscredentials + def test_delete_profile_attachment(self): + response = self.security_and_compliance_center_api_service.delete_profile_attachment( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + attachment_id=attachment_id_link, + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile_attachment = response.get_result() + assert profile_attachment is not None + + @needscredentials + def test_delete_custom_control_library(self): + response = self.security_and_compliance_center_api_service.delete_custom_control_library( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + control_library_id=control_library_id_link, + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + control_library = response.get_result() + assert control_library is not None + + @needscredentials + def test_delete_custom_profile(self): + response = self.security_and_compliance_center_api_service.delete_custom_profile( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + profile_id=profile_id_link, + account_id=account_id_for_report_link, + ) + + assert response.get_status_code() == 200 + profile = response.get_result() + assert profile is not None + + @needscredentials + def test_delete_provider_type_instance(self): + response = self.security_and_compliance_center_api_service.delete_provider_type_instance( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + provider_type_id=provider_type_id_link, + provider_type_instance_id=provider_type_instance_id_link, + ) + + assert response.get_status_code() == 204 + + @needscredentials + def test_delete_rule(self): + response = self.security_and_compliance_center_api_service.delete_rule( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + rule_id='rule-8d444f8c-fd1d-48de-bcaa-f43732568761', + ) + + assert response.get_status_code() == 204 + + @needscredentials + def test_delete_scope(self): + response = self.security_and_compliance_center_api_service.delete_scope( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + ) + + assert response.get_status_code() == 204 + + @needscredentials + def test_delete_subscope(self): + response = self.security_and_compliance_center_api_service.delete_subscope( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + subscope_id='testString', + ) + + assert response.get_status_code() == 204 + + @needscredentials + def test_delete_target(self): + response = self.security_and_compliance_center_api_service.delete_target( + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + target_id='testString', + ) + + assert response.get_status_code() == 204 diff --git a/test/unit/test_security_and_compliance_center_api_v3.py b/test/unit/test_security_and_compliance_center_api_v3.py new file mode 100644 index 0000000..23c0d5e --- /dev/null +++ b/test/unit/test_security_and_compliance_center_api_v3.py @@ -0,0 +1,16488 @@ +# -*- coding: utf-8 -*- +# (C) Copyright IBM Corp. 2025. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Unit Tests for SecurityAndComplianceCenterApiV3 +""" + +from datetime import datetime, timezone +from ibm_cloud_sdk_core.authenticators.no_auth_authenticator import NoAuthAuthenticator +from ibm_cloud_sdk_core.utils import datetime_to_string, string_to_datetime +import inspect +import json +import os +import pytest +import re +import requests +import responses +import urllib +from ibm_scc.security_and_compliance_center_api_v3 import * + + +_service = SecurityAndComplianceCenterApiV3( + authenticator=NoAuthAuthenticator() +) + +_base_url = 'https://us-south.compliance.cloud.ibm.com' +_service.set_service_url(_base_url) + + +def preprocess_url(operation_path: str): + """ + Returns the request url associated with the specified operation path. + This will be base_url concatenated with a quoted version of operation_path. + The returned request URL is used to register the mock response so it needs + to match the request URL that is formed by the requests library. + """ + + # Form the request URL from the base URL and operation path. + request_url = _base_url + operation_path + + # If the request url does NOT end with a /, then just return it as-is. + # Otherwise, return a regular expression that matches one or more trailing /. + if not request_url.endswith('/'): + return request_url + return re.compile(request_url.rstrip('/') + '/+') + + +def test_get_service_url_for_region(): + """ + get_service_url_for_region() + """ + assert SecurityAndComplianceCenterApiV3.get_service_url_for_region('INVALID_REGION') is None + assert SecurityAndComplianceCenterApiV3.get_service_url_for_region('us-south') == 'https://us-south.compliance.cloud.ibm.com' + assert SecurityAndComplianceCenterApiV3.get_service_url_for_region('eu-de') == 'https://eu-de.compliance.cloud.ibm.com' + assert SecurityAndComplianceCenterApiV3.get_service_url_for_region('eu-fr2') == 'https://eu-fr2.compliance.cloud.ibm.com' + assert SecurityAndComplianceCenterApiV3.get_service_url_for_region('ca-tor') == 'https://ca-tor.compliance.cloud.ibm.com' + assert SecurityAndComplianceCenterApiV3.get_service_url_for_region('au-syd') == 'https://au-syd.compliance.cloud.ibm.com' + assert SecurityAndComplianceCenterApiV3.get_service_url_for_region('eu-es') == 'https://eu-es.compliance.cloud.ibm.com' + + +############################################################################## +# Start of Service: Attachment +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestListInstanceAttachments: + """ + Test Class for list_instance_attachments + """ + + @responses.activate + def test_list_instance_attachments_all_params(self): + """ + list_instance_attachments() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/attachments') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + account_id = 'testString' + version_group_label = 'testString' + limit = 25 + sort = 'created_on' + direction = 'desc' + start = 'testString' + + # Invoke method + response = _service.list_instance_attachments( + instance_id, + account_id=account_id, + version_group_label=version_group_label, + limit=limit, + sort=sort, + direction=direction, + start=start, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + assert 'version_group_label={}'.format(version_group_label) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'sort={}'.format(sort) in query_string + assert 'direction={}'.format(direction) in query_string + assert 'start={}'.format(start) in query_string + + def test_list_instance_attachments_all_params_with_retries(self): + # Enable retries and run test_list_instance_attachments_all_params. + _service.enable_retries() + self.test_list_instance_attachments_all_params() + + # Disable retries and run test_list_instance_attachments_all_params. + _service.disable_retries() + self.test_list_instance_attachments_all_params() + + @responses.activate + def test_list_instance_attachments_required_params(self): + """ + test_list_instance_attachments_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/attachments') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.list_instance_attachments( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_instance_attachments_required_params_with_retries(self): + # Enable retries and run test_list_instance_attachments_required_params. + _service.enable_retries() + self.test_list_instance_attachments_required_params() + + # Disable retries and run test_list_instance_attachments_required_params. + _service.disable_retries() + self.test_list_instance_attachments_required_params() + + @responses.activate + def test_list_instance_attachments_value_error(self): + """ + test_list_instance_attachments_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/attachments') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_instance_attachments(**req_copy) + + def test_list_instance_attachments_value_error_with_retries(self): + # Enable retries and run test_list_instance_attachments_value_error. + _service.enable_retries() + self.test_list_instance_attachments_value_error() + + # Disable retries and run test_list_instance_attachments_value_error. + _service.disable_retries() + self.test_list_instance_attachments_value_error() + + @responses.activate + def test_list_instance_attachments_with_pager_get_next(self): + """ + test_list_instance_attachments_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/attachments') + mock_response1 = '{"next":{"start":"1"},"attachments":[{"attachment_parameters":[{"assessment_type":"assessment_type","assessment_id":"assessment_id","parameter_name":"location","parameter_display_name":"Location","parameter_type":"string","parameter_value":"anyValue"}],"description":"description","name":"name","notifications":{"enabled":false,"controls":{"threshold_limit":15,"failed_control_ids":["failed_control_ids"]}},"schedule":"daily","scope":[{"id":"id","environment":"environment","properties":[{"name":"scope_type","value":"account"}]}],"status":"enabled","data_selection_range":{"start_date":"2025-02-28T05:42:58.000Z","end_date":"2025-02-28T05:42:58.000Z"},"account_id":"account_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","id":"id","instance_id":"instance_id","last_scan":{"id":"id","status":"status","time":"2019-01-01T12:00:00.000Z"},"next_scan_time":"2019-01-01T12:00:00.000Z","profile_id":"profile_id","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}' + mock_response2 = '{"attachments":[{"attachment_parameters":[{"assessment_type":"assessment_type","assessment_id":"assessment_id","parameter_name":"location","parameter_display_name":"Location","parameter_type":"string","parameter_value":"anyValue"}],"description":"description","name":"name","notifications":{"enabled":false,"controls":{"threshold_limit":15,"failed_control_ids":["failed_control_ids"]}},"schedule":"daily","scope":[{"id":"id","environment":"environment","properties":[{"name":"scope_type","value":"account"}]}],"status":"enabled","data_selection_range":{"start_date":"2025-02-28T05:42:58.000Z","end_date":"2025-02-28T05:42:58.000Z"},"account_id":"account_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","id":"id","instance_id":"instance_id","last_scan":{"id":"id","status":"status","time":"2019-01-01T12:00:00.000Z"},"next_scan_time":"2019-01-01T12:00:00.000Z","profile_id":"profile_id","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = InstanceAttachmentsPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + account_id='testString', + version_group_label='testString', + limit=10, + sort='created_on', + direction='desc', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_instance_attachments_with_pager_get_all(self): + """ + test_list_instance_attachments_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/attachments') + mock_response1 = '{"next":{"start":"1"},"attachments":[{"attachment_parameters":[{"assessment_type":"assessment_type","assessment_id":"assessment_id","parameter_name":"location","parameter_display_name":"Location","parameter_type":"string","parameter_value":"anyValue"}],"description":"description","name":"name","notifications":{"enabled":false,"controls":{"threshold_limit":15,"failed_control_ids":["failed_control_ids"]}},"schedule":"daily","scope":[{"id":"id","environment":"environment","properties":[{"name":"scope_type","value":"account"}]}],"status":"enabled","data_selection_range":{"start_date":"2025-02-28T05:42:58.000Z","end_date":"2025-02-28T05:42:58.000Z"},"account_id":"account_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","id":"id","instance_id":"instance_id","last_scan":{"id":"id","status":"status","time":"2019-01-01T12:00:00.000Z"},"next_scan_time":"2019-01-01T12:00:00.000Z","profile_id":"profile_id","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}' + mock_response2 = '{"attachments":[{"attachment_parameters":[{"assessment_type":"assessment_type","assessment_id":"assessment_id","parameter_name":"location","parameter_display_name":"Location","parameter_type":"string","parameter_value":"anyValue"}],"description":"description","name":"name","notifications":{"enabled":false,"controls":{"threshold_limit":15,"failed_control_ids":["failed_control_ids"]}},"schedule":"daily","scope":[{"id":"id","environment":"environment","properties":[{"name":"scope_type","value":"account"}]}],"status":"enabled","data_selection_range":{"start_date":"2025-02-28T05:42:58.000Z","end_date":"2025-02-28T05:42:58.000Z"},"account_id":"account_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","id":"id","instance_id":"instance_id","last_scan":{"id":"id","status":"status","time":"2019-01-01T12:00:00.000Z"},"next_scan_time":"2019-01-01T12:00:00.000Z","profile_id":"profile_id","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z"}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = InstanceAttachmentsPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + account_id='testString', + version_group_label='testString', + limit=10, + sort='created_on', + direction='desc', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestCreateProfileAttachment: + """ + Test Class for create_profile_attachment + """ + + @responses.activate + def test_create_profile_attachment_all_params(self): + """ + create_profile_attachment() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments') + mock_response = '{"profile_id": "profile_id", "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'automated' + parameter_model['assessment_id'] = 'rule-e16fcfea-fe21-4d30-a721-423611481fea' + parameter_model['parameter_name'] = 'tls_version' + parameter_model['parameter_display_name'] = 'IBM Cloud Internet Services TLS version' + parameter_model['parameter_type'] = 'string_list' + parameter_model['parameter_value'] = '["1.2", "1.3"]' + + # Construct a dict representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model = {} + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = [] + + # Construct a dict representation of a AttachmentNotifications model + attachment_notifications_model = {} + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a dict representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model = {} + multi_cloud_scope_payload_model['id'] = '8baad3b5-2e69-4027-9967-efac19508e1c' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + # Construct a dict representation of a DateRange model + date_range_model = {} + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + # Construct a dict representation of a ProfileAttachmentBase model + profile_attachment_base_model = {} + profile_attachment_base_model['attachment_parameters'] = [parameter_model] + profile_attachment_base_model['description'] = 'This is a profile attachment targeting IBM CIS Foundation using a SDK' + profile_attachment_base_model['name'] = 'Profile Attachment for IBM CIS Foundation SDK test' + profile_attachment_base_model['notifications'] = attachment_notifications_model + profile_attachment_base_model['schedule'] = 'daily' + profile_attachment_base_model['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_base_model['status'] = 'disabled' + profile_attachment_base_model['data_selection_range'] = date_range_model + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachments = [profile_attachment_base_model] + account_id = 'testString' + + # Invoke method + response = _service.create_profile_attachment( + instance_id, + profile_id, + attachments, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['attachments'] == [profile_attachment_base_model] + + def test_create_profile_attachment_all_params_with_retries(self): + # Enable retries and run test_create_profile_attachment_all_params. + _service.enable_retries() + self.test_create_profile_attachment_all_params() + + # Disable retries and run test_create_profile_attachment_all_params. + _service.disable_retries() + self.test_create_profile_attachment_all_params() + + @responses.activate + def test_create_profile_attachment_required_params(self): + """ + test_create_profile_attachment_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments') + mock_response = '{"profile_id": "profile_id", "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'automated' + parameter_model['assessment_id'] = 'rule-e16fcfea-fe21-4d30-a721-423611481fea' + parameter_model['parameter_name'] = 'tls_version' + parameter_model['parameter_display_name'] = 'IBM Cloud Internet Services TLS version' + parameter_model['parameter_type'] = 'string_list' + parameter_model['parameter_value'] = '["1.2", "1.3"]' + + # Construct a dict representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model = {} + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = [] + + # Construct a dict representation of a AttachmentNotifications model + attachment_notifications_model = {} + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a dict representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model = {} + multi_cloud_scope_payload_model['id'] = '8baad3b5-2e69-4027-9967-efac19508e1c' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + # Construct a dict representation of a DateRange model + date_range_model = {} + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + # Construct a dict representation of a ProfileAttachmentBase model + profile_attachment_base_model = {} + profile_attachment_base_model['attachment_parameters'] = [parameter_model] + profile_attachment_base_model['description'] = 'This is a profile attachment targeting IBM CIS Foundation using a SDK' + profile_attachment_base_model['name'] = 'Profile Attachment for IBM CIS Foundation SDK test' + profile_attachment_base_model['notifications'] = attachment_notifications_model + profile_attachment_base_model['schedule'] = 'daily' + profile_attachment_base_model['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_base_model['status'] = 'disabled' + profile_attachment_base_model['data_selection_range'] = date_range_model + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachments = [profile_attachment_base_model] + + # Invoke method + response = _service.create_profile_attachment( + instance_id, + profile_id, + attachments, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['attachments'] == [profile_attachment_base_model] + + def test_create_profile_attachment_required_params_with_retries(self): + # Enable retries and run test_create_profile_attachment_required_params. + _service.enable_retries() + self.test_create_profile_attachment_required_params() + + # Disable retries and run test_create_profile_attachment_required_params. + _service.disable_retries() + self.test_create_profile_attachment_required_params() + + @responses.activate + def test_create_profile_attachment_value_error(self): + """ + test_create_profile_attachment_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments') + mock_response = '{"profile_id": "profile_id", "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'automated' + parameter_model['assessment_id'] = 'rule-e16fcfea-fe21-4d30-a721-423611481fea' + parameter_model['parameter_name'] = 'tls_version' + parameter_model['parameter_display_name'] = 'IBM Cloud Internet Services TLS version' + parameter_model['parameter_type'] = 'string_list' + parameter_model['parameter_value'] = '["1.2", "1.3"]' + + # Construct a dict representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model = {} + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = [] + + # Construct a dict representation of a AttachmentNotifications model + attachment_notifications_model = {} + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a dict representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model = {} + multi_cloud_scope_payload_model['id'] = '8baad3b5-2e69-4027-9967-efac19508e1c' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + # Construct a dict representation of a DateRange model + date_range_model = {} + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + # Construct a dict representation of a ProfileAttachmentBase model + profile_attachment_base_model = {} + profile_attachment_base_model['attachment_parameters'] = [parameter_model] + profile_attachment_base_model['description'] = 'This is a profile attachment targeting IBM CIS Foundation using a SDK' + profile_attachment_base_model['name'] = 'Profile Attachment for IBM CIS Foundation SDK test' + profile_attachment_base_model['notifications'] = attachment_notifications_model + profile_attachment_base_model['schedule'] = 'daily' + profile_attachment_base_model['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_base_model['status'] = 'disabled' + profile_attachment_base_model['data_selection_range'] = date_range_model + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachments = [profile_attachment_base_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + "attachments": attachments, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_profile_attachment(**req_copy) + + def test_create_profile_attachment_value_error_with_retries(self): + # Enable retries and run test_create_profile_attachment_value_error. + _service.enable_retries() + self.test_create_profile_attachment_value_error() + + # Disable retries and run test_create_profile_attachment_value_error. + _service.disable_retries() + self.test_create_profile_attachment_value_error() + + +class TestGetProfileAttachment: + """ + Test Class for get_profile_attachment + """ + + @responses.activate + def test_get_profile_attachment_all_params(self): + """ + get_profile_attachment() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + account_id = 'testString' + + # Invoke method + response = _service.get_profile_attachment( + instance_id, + profile_id, + attachment_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_get_profile_attachment_all_params_with_retries(self): + # Enable retries and run test_get_profile_attachment_all_params. + _service.enable_retries() + self.test_get_profile_attachment_all_params() + + # Disable retries and run test_get_profile_attachment_all_params. + _service.disable_retries() + self.test_get_profile_attachment_all_params() + + @responses.activate + def test_get_profile_attachment_required_params(self): + """ + test_get_profile_attachment_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + + # Invoke method + response = _service.get_profile_attachment( + instance_id, + profile_id, + attachment_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_profile_attachment_required_params_with_retries(self): + # Enable retries and run test_get_profile_attachment_required_params. + _service.enable_retries() + self.test_get_profile_attachment_required_params() + + # Disable retries and run test_get_profile_attachment_required_params. + _service.disable_retries() + self.test_get_profile_attachment_required_params() + + @responses.activate + def test_get_profile_attachment_value_error(self): + """ + test_get_profile_attachment_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + "attachment_id": attachment_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_profile_attachment(**req_copy) + + def test_get_profile_attachment_value_error_with_retries(self): + # Enable retries and run test_get_profile_attachment_value_error. + _service.enable_retries() + self.test_get_profile_attachment_value_error() + + # Disable retries and run test_get_profile_attachment_value_error. + _service.disable_retries() + self.test_get_profile_attachment_value_error() + + +class TestReplaceProfileAttachment: + """ + Test Class for replace_profile_attachment + """ + + @responses.activate + def test_replace_profile_attachment_all_params(self): + """ + replace_profile_attachment() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + # Construct a dict representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model = {} + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + # Construct a dict representation of a AttachmentNotifications model + attachment_notifications_model = {} + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a dict representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model = {} + multi_cloud_scope_payload_model['id'] = 'testString' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + # Construct a dict representation of a DateRange model + date_range_model = {} + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + # Construct a dict representation of a ProfileAttachmentBase model + profile_attachment_base_model = {} + profile_attachment_base_model['attachment_parameters'] = [parameter_model] + profile_attachment_base_model['description'] = 'testString' + profile_attachment_base_model['name'] = 'testString' + profile_attachment_base_model['notifications'] = attachment_notifications_model + profile_attachment_base_model['schedule'] = 'daily' + profile_attachment_base_model['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_base_model['status'] = 'enabled' + profile_attachment_base_model['data_selection_range'] = date_range_model + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + attachments = [profile_attachment_base_model] + account_id = 'testString' + + # Invoke method + response = _service.replace_profile_attachment( + instance_id, + profile_id, + attachment_id, + attachments, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['attachments'] == [profile_attachment_base_model] + + def test_replace_profile_attachment_all_params_with_retries(self): + # Enable retries and run test_replace_profile_attachment_all_params. + _service.enable_retries() + self.test_replace_profile_attachment_all_params() + + # Disable retries and run test_replace_profile_attachment_all_params. + _service.disable_retries() + self.test_replace_profile_attachment_all_params() + + @responses.activate + def test_replace_profile_attachment_required_params(self): + """ + test_replace_profile_attachment_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + # Construct a dict representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model = {} + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + # Construct a dict representation of a AttachmentNotifications model + attachment_notifications_model = {} + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a dict representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model = {} + multi_cloud_scope_payload_model['id'] = 'testString' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + # Construct a dict representation of a DateRange model + date_range_model = {} + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + # Construct a dict representation of a ProfileAttachmentBase model + profile_attachment_base_model = {} + profile_attachment_base_model['attachment_parameters'] = [parameter_model] + profile_attachment_base_model['description'] = 'testString' + profile_attachment_base_model['name'] = 'testString' + profile_attachment_base_model['notifications'] = attachment_notifications_model + profile_attachment_base_model['schedule'] = 'daily' + profile_attachment_base_model['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_base_model['status'] = 'enabled' + profile_attachment_base_model['data_selection_range'] = date_range_model + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + attachments = [profile_attachment_base_model] + + # Invoke method + response = _service.replace_profile_attachment( + instance_id, + profile_id, + attachment_id, + attachments, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['attachments'] == [profile_attachment_base_model] + + def test_replace_profile_attachment_required_params_with_retries(self): + # Enable retries and run test_replace_profile_attachment_required_params. + _service.enable_retries() + self.test_replace_profile_attachment_required_params() + + # Disable retries and run test_replace_profile_attachment_required_params. + _service.disable_retries() + self.test_replace_profile_attachment_required_params() + + @responses.activate + def test_replace_profile_attachment_value_error(self): + """ + test_replace_profile_attachment_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + # Construct a dict representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model = {} + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + # Construct a dict representation of a AttachmentNotifications model + attachment_notifications_model = {} + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a dict representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model = {} + multi_cloud_scope_payload_model['id'] = 'testString' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + # Construct a dict representation of a DateRange model + date_range_model = {} + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + # Construct a dict representation of a ProfileAttachmentBase model + profile_attachment_base_model = {} + profile_attachment_base_model['attachment_parameters'] = [parameter_model] + profile_attachment_base_model['description'] = 'testString' + profile_attachment_base_model['name'] = 'testString' + profile_attachment_base_model['notifications'] = attachment_notifications_model + profile_attachment_base_model['schedule'] = 'daily' + profile_attachment_base_model['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_base_model['status'] = 'enabled' + profile_attachment_base_model['data_selection_range'] = date_range_model + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + attachments = [profile_attachment_base_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + "attachment_id": attachment_id, + "attachments": attachments, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.replace_profile_attachment(**req_copy) + + def test_replace_profile_attachment_value_error_with_retries(self): + # Enable retries and run test_replace_profile_attachment_value_error. + _service.enable_retries() + self.test_replace_profile_attachment_value_error() + + # Disable retries and run test_replace_profile_attachment_value_error. + _service.disable_retries() + self.test_replace_profile_attachment_value_error() + + +class TestDeleteProfileAttachment: + """ + Test Class for delete_profile_attachment + """ + + @responses.activate + def test_delete_profile_attachment_all_params(self): + """ + delete_profile_attachment() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + account_id = 'testString' + + # Invoke method + response = _service.delete_profile_attachment( + instance_id, + profile_id, + attachment_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_delete_profile_attachment_all_params_with_retries(self): + # Enable retries and run test_delete_profile_attachment_all_params. + _service.enable_retries() + self.test_delete_profile_attachment_all_params() + + # Disable retries and run test_delete_profile_attachment_all_params. + _service.disable_retries() + self.test_delete_profile_attachment_all_params() + + @responses.activate + def test_delete_profile_attachment_required_params(self): + """ + test_delete_profile_attachment_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + + # Invoke method + response = _service.delete_profile_attachment( + instance_id, + profile_id, + attachment_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_delete_profile_attachment_required_params_with_retries(self): + # Enable retries and run test_delete_profile_attachment_required_params. + _service.enable_retries() + self.test_delete_profile_attachment_required_params() + + # Disable retries and run test_delete_profile_attachment_required_params. + _service.disable_retries() + self.test_delete_profile_attachment_required_params() + + @responses.activate + def test_delete_profile_attachment_value_error(self): + """ + test_delete_profile_attachment_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + "attachment_id": attachment_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_profile_attachment(**req_copy) + + def test_delete_profile_attachment_value_error_with_retries(self): + # Enable retries and run test_delete_profile_attachment_value_error. + _service.enable_retries() + self.test_delete_profile_attachment_value_error() + + # Disable retries and run test_delete_profile_attachment_value_error. + _service.disable_retries() + self.test_delete_profile_attachment_value_error() + + +class TestUpgradeAttachment: + """ + Test Class for upgrade_attachment + """ + + @responses.activate + def test_upgrade_attachment_all_params(self): + """ + upgrade_attachment() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString/upgrade') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + attachment_parameters = [parameter_model] + account_id = 'testString' + + # Invoke method + response = _service.upgrade_attachment( + instance_id, + profile_id, + attachment_id, + attachment_parameters, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['attachment_parameters'] == [parameter_model] + + def test_upgrade_attachment_all_params_with_retries(self): + # Enable retries and run test_upgrade_attachment_all_params. + _service.enable_retries() + self.test_upgrade_attachment_all_params() + + # Disable retries and run test_upgrade_attachment_all_params. + _service.disable_retries() + self.test_upgrade_attachment_all_params() + + @responses.activate + def test_upgrade_attachment_required_params(self): + """ + test_upgrade_attachment_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString/upgrade') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + attachment_parameters = [parameter_model] + + # Invoke method + response = _service.upgrade_attachment( + instance_id, + profile_id, + attachment_id, + attachment_parameters, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['attachment_parameters'] == [parameter_model] + + def test_upgrade_attachment_required_params_with_retries(self): + # Enable retries and run test_upgrade_attachment_required_params. + _service.enable_retries() + self.test_upgrade_attachment_required_params() + + # Disable retries and run test_upgrade_attachment_required_params. + _service.disable_retries() + self.test_upgrade_attachment_required_params() + + @responses.activate + def test_upgrade_attachment_value_error(self): + """ + test_upgrade_attachment_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments/testString/upgrade') + mock_response = '{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a Parameter model + parameter_model = {} + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + attachment_id = 'testString' + attachment_parameters = [parameter_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + "attachment_id": attachment_id, + "attachment_parameters": attachment_parameters, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.upgrade_attachment(**req_copy) + + def test_upgrade_attachment_value_error_with_retries(self): + # Enable retries and run test_upgrade_attachment_value_error. + _service.enable_retries() + self.test_upgrade_attachment_value_error() + + # Disable retries and run test_upgrade_attachment_value_error. + _service.disable_retries() + self.test_upgrade_attachment_value_error() + + +class TestCreateScan: + """ + Test Class for create_scan + """ + + @responses.activate + def test_create_scan_all_params(self): + """ + create_scan() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scans') + mock_response = '{"id": "id", "account_id": "account_id", "attachment_id": "attachment_id", "report_id": "report_id", "status": "status", "last_scan_time": "2019-01-01T12:00:00.000Z", "next_scan_time": "2019-01-01T12:00:00.000Z", "scan_type": "scan_type", "occurence": 9}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + attachment_id = 'testString' + account_id = 'testString' + + # Invoke method + response = _service.create_scan( + instance_id, + attachment_id=attachment_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['attachment_id'] == 'testString' + + def test_create_scan_all_params_with_retries(self): + # Enable retries and run test_create_scan_all_params. + _service.enable_retries() + self.test_create_scan_all_params() + + # Disable retries and run test_create_scan_all_params. + _service.disable_retries() + self.test_create_scan_all_params() + + @responses.activate + def test_create_scan_required_params(self): + """ + test_create_scan_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scans') + mock_response = '{"id": "id", "account_id": "account_id", "attachment_id": "attachment_id", "report_id": "report_id", "status": "status", "last_scan_time": "2019-01-01T12:00:00.000Z", "next_scan_time": "2019-01-01T12:00:00.000Z", "scan_type": "scan_type", "occurence": 9}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + attachment_id = 'testString' + + # Invoke method + response = _service.create_scan( + instance_id, + attachment_id=attachment_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['attachment_id'] == 'testString' + + def test_create_scan_required_params_with_retries(self): + # Enable retries and run test_create_scan_required_params. + _service.enable_retries() + self.test_create_scan_required_params() + + # Disable retries and run test_create_scan_required_params. + _service.disable_retries() + self.test_create_scan_required_params() + + @responses.activate + def test_create_scan_value_error(self): + """ + test_create_scan_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scans') + mock_response = '{"id": "id", "account_id": "account_id", "attachment_id": "attachment_id", "report_id": "report_id", "status": "status", "last_scan_time": "2019-01-01T12:00:00.000Z", "next_scan_time": "2019-01-01T12:00:00.000Z", "scan_type": "scan_type", "occurence": 9}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + attachment_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_scan(**req_copy) + + def test_create_scan_value_error_with_retries(self): + # Enable retries and run test_create_scan_value_error. + _service.enable_retries() + self.test_create_scan_value_error() + + # Disable retries and run test_create_scan_value_error. + _service.disable_retries() + self.test_create_scan_value_error() + + +# endregion +############################################################################## +# End of Service: Attachment +############################################################################## + +############################################################################## +# Start of Service: ControlLibrary +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestCreateCustomControlLibrary: + """ + Test Class for create_custom_control_library + """ + + @responses.activate + def test_create_custom_control_library_all_params(self): + """ + create_custom_control_library() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a AssessmentPrototype model + assessment_prototype_model = {} + assessment_prototype_model['assessment_id'] = 'rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e' + assessment_prototype_model['assessment_description'] = 'This rule will check on regulation' + + # Construct a dict representation of a ControlSpecificationPrototype model + control_specification_prototype_model = {} + control_specification_prototype_model['component_id'] = 'apprapp' + control_specification_prototype_model['environment'] = 'ibm-cloud' + control_specification_prototype_model['control_specification_id'] = 'testString' + control_specification_prototype_model['control_specification_description'] = 'This field is used to describe a control specification' + control_specification_prototype_model['assessments'] = [assessment_prototype_model] + + # Construct a dict representation of a ControlDoc model + control_doc_model = {} + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + # Construct a dict representation of a ControlPrototype model + control_prototype_model = {} + control_prototype_model['control_name'] = 'security' + control_prototype_model['control_description'] = 'This is a description of a control' + control_prototype_model['control_category'] = 'test-control' + control_prototype_model['control_requirement'] = True + control_prototype_model['control_parent'] = 'testString' + control_prototype_model['control_specifications'] = [control_specification_prototype_model] + control_prototype_model['control_docs'] = control_doc_model + control_prototype_model['status'] = 'disabled' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_name = 'custom control library from SDK' + control_library_description = 'This is a custom control library made from the SDK test framework' + control_library_type = 'custom' + control_library_version = '0.0.1' + controls = [control_prototype_model] + account_id = 'testString' + + # Invoke method + response = _service.create_custom_control_library( + instance_id, + control_library_name, + control_library_description, + control_library_type, + control_library_version, + controls, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['control_library_name'] == 'custom control library from SDK' + assert req_body['control_library_description'] == 'This is a custom control library made from the SDK test framework' + assert req_body['control_library_type'] == 'custom' + assert req_body['control_library_version'] == '0.0.1' + assert req_body['controls'] == [control_prototype_model] + + def test_create_custom_control_library_all_params_with_retries(self): + # Enable retries and run test_create_custom_control_library_all_params. + _service.enable_retries() + self.test_create_custom_control_library_all_params() + + # Disable retries and run test_create_custom_control_library_all_params. + _service.disable_retries() + self.test_create_custom_control_library_all_params() + + @responses.activate + def test_create_custom_control_library_required_params(self): + """ + test_create_custom_control_library_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a AssessmentPrototype model + assessment_prototype_model = {} + assessment_prototype_model['assessment_id'] = 'rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e' + assessment_prototype_model['assessment_description'] = 'This rule will check on regulation' + + # Construct a dict representation of a ControlSpecificationPrototype model + control_specification_prototype_model = {} + control_specification_prototype_model['component_id'] = 'apprapp' + control_specification_prototype_model['environment'] = 'ibm-cloud' + control_specification_prototype_model['control_specification_id'] = 'testString' + control_specification_prototype_model['control_specification_description'] = 'This field is used to describe a control specification' + control_specification_prototype_model['assessments'] = [assessment_prototype_model] + + # Construct a dict representation of a ControlDoc model + control_doc_model = {} + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + # Construct a dict representation of a ControlPrototype model + control_prototype_model = {} + control_prototype_model['control_name'] = 'security' + control_prototype_model['control_description'] = 'This is a description of a control' + control_prototype_model['control_category'] = 'test-control' + control_prototype_model['control_requirement'] = True + control_prototype_model['control_parent'] = 'testString' + control_prototype_model['control_specifications'] = [control_specification_prototype_model] + control_prototype_model['control_docs'] = control_doc_model + control_prototype_model['status'] = 'disabled' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_name = 'custom control library from SDK' + control_library_description = 'This is a custom control library made from the SDK test framework' + control_library_type = 'custom' + control_library_version = '0.0.1' + controls = [control_prototype_model] + + # Invoke method + response = _service.create_custom_control_library( + instance_id, + control_library_name, + control_library_description, + control_library_type, + control_library_version, + controls, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['control_library_name'] == 'custom control library from SDK' + assert req_body['control_library_description'] == 'This is a custom control library made from the SDK test framework' + assert req_body['control_library_type'] == 'custom' + assert req_body['control_library_version'] == '0.0.1' + assert req_body['controls'] == [control_prototype_model] + + def test_create_custom_control_library_required_params_with_retries(self): + # Enable retries and run test_create_custom_control_library_required_params. + _service.enable_retries() + self.test_create_custom_control_library_required_params() + + # Disable retries and run test_create_custom_control_library_required_params. + _service.disable_retries() + self.test_create_custom_control_library_required_params() + + @responses.activate + def test_create_custom_control_library_value_error(self): + """ + test_create_custom_control_library_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a AssessmentPrototype model + assessment_prototype_model = {} + assessment_prototype_model['assessment_id'] = 'rule-d1bd9f3f-bee1-46c5-9533-da8bba9eed4e' + assessment_prototype_model['assessment_description'] = 'This rule will check on regulation' + + # Construct a dict representation of a ControlSpecificationPrototype model + control_specification_prototype_model = {} + control_specification_prototype_model['component_id'] = 'apprapp' + control_specification_prototype_model['environment'] = 'ibm-cloud' + control_specification_prototype_model['control_specification_id'] = 'testString' + control_specification_prototype_model['control_specification_description'] = 'This field is used to describe a control specification' + control_specification_prototype_model['assessments'] = [assessment_prototype_model] + + # Construct a dict representation of a ControlDoc model + control_doc_model = {} + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + # Construct a dict representation of a ControlPrototype model + control_prototype_model = {} + control_prototype_model['control_name'] = 'security' + control_prototype_model['control_description'] = 'This is a description of a control' + control_prototype_model['control_category'] = 'test-control' + control_prototype_model['control_requirement'] = True + control_prototype_model['control_parent'] = 'testString' + control_prototype_model['control_specifications'] = [control_specification_prototype_model] + control_prototype_model['control_docs'] = control_doc_model + control_prototype_model['status'] = 'disabled' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_name = 'custom control library from SDK' + control_library_description = 'This is a custom control library made from the SDK test framework' + control_library_type = 'custom' + control_library_version = '0.0.1' + controls = [control_prototype_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "control_library_name": control_library_name, + "control_library_description": control_library_description, + "control_library_type": control_library_type, + "control_library_version": control_library_version, + "controls": controls, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_custom_control_library(**req_copy) + + def test_create_custom_control_library_value_error_with_retries(self): + # Enable retries and run test_create_custom_control_library_value_error. + _service.enable_retries() + self.test_create_custom_control_library_value_error() + + # Disable retries and run test_create_custom_control_library_value_error. + _service.disable_retries() + self.test_create_custom_control_library_value_error() + + +class TestListControlLibraries: + """ + Test Class for list_control_libraries + """ + + @responses.activate + def test_list_control_libraries_all_params(self): + """ + list_control_libraries() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "control_libraries": [{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + account_id = 'testString' + + # Invoke method + response = _service.list_control_libraries( + instance_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_list_control_libraries_all_params_with_retries(self): + # Enable retries and run test_list_control_libraries_all_params. + _service.enable_retries() + self.test_list_control_libraries_all_params() + + # Disable retries and run test_list_control_libraries_all_params. + _service.disable_retries() + self.test_list_control_libraries_all_params() + + @responses.activate + def test_list_control_libraries_required_params(self): + """ + test_list_control_libraries_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "control_libraries": [{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.list_control_libraries( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_control_libraries_required_params_with_retries(self): + # Enable retries and run test_list_control_libraries_required_params. + _service.enable_retries() + self.test_list_control_libraries_required_params() + + # Disable retries and run test_list_control_libraries_required_params. + _service.disable_retries() + self.test_list_control_libraries_required_params() + + @responses.activate + def test_list_control_libraries_value_error(self): + """ + test_list_control_libraries_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "control_libraries": [{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_control_libraries(**req_copy) + + def test_list_control_libraries_value_error_with_retries(self): + # Enable retries and run test_list_control_libraries_value_error. + _service.enable_retries() + self.test_list_control_libraries_value_error() + + # Disable retries and run test_list_control_libraries_value_error. + _service.disable_retries() + self.test_list_control_libraries_value_error() + + +class TestReplaceCustomControlLibrary: + """ + Test Class for replace_custom_control_library + """ + + @responses.activate + def test_replace_custom_control_library_all_params(self): + """ + replace_custom_control_library() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a AssessmentPrototype model + assessment_prototype_model = {} + assessment_prototype_model['assessment_id'] = 'testString' + assessment_prototype_model['assessment_description'] = 'testString' + + # Construct a dict representation of a ControlSpecificationPrototype model + control_specification_prototype_model = {} + control_specification_prototype_model['component_id'] = 'testString' + control_specification_prototype_model['environment'] = 'ibm-cloud' + control_specification_prototype_model['control_specification_id'] = 'testString' + control_specification_prototype_model['control_specification_description'] = 'testString' + control_specification_prototype_model['assessments'] = [assessment_prototype_model] + + # Construct a dict representation of a ControlDoc model + control_doc_model = {} + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + # Construct a dict representation of a ControlPrototype model + control_prototype_model = {} + control_prototype_model['control_name'] = 'testString' + control_prototype_model['control_description'] = 'testString' + control_prototype_model['control_category'] = 'testString' + control_prototype_model['control_requirement'] = True + control_prototype_model['control_parent'] = 'testString' + control_prototype_model['control_specifications'] = [control_specification_prototype_model] + control_prototype_model['control_docs'] = control_doc_model + control_prototype_model['status'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + control_library_name = 'testString' + control_library_description = 'testString' + control_library_type = 'custom' + control_library_version = 'testString' + controls = [control_prototype_model] + bss_account = 'testString' + + # Invoke method + response = _service.replace_custom_control_library( + instance_id, + control_library_id, + control_library_name, + control_library_description, + control_library_type, + control_library_version, + controls, + bss_account=bss_account, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'bss_account={}'.format(bss_account) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['control_library_name'] == 'testString' + assert req_body['control_library_description'] == 'testString' + assert req_body['control_library_type'] == 'custom' + assert req_body['control_library_version'] == 'testString' + assert req_body['controls'] == [control_prototype_model] + + def test_replace_custom_control_library_all_params_with_retries(self): + # Enable retries and run test_replace_custom_control_library_all_params. + _service.enable_retries() + self.test_replace_custom_control_library_all_params() + + # Disable retries and run test_replace_custom_control_library_all_params. + _service.disable_retries() + self.test_replace_custom_control_library_all_params() + + @responses.activate + def test_replace_custom_control_library_required_params(self): + """ + test_replace_custom_control_library_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a AssessmentPrototype model + assessment_prototype_model = {} + assessment_prototype_model['assessment_id'] = 'testString' + assessment_prototype_model['assessment_description'] = 'testString' + + # Construct a dict representation of a ControlSpecificationPrototype model + control_specification_prototype_model = {} + control_specification_prototype_model['component_id'] = 'testString' + control_specification_prototype_model['environment'] = 'ibm-cloud' + control_specification_prototype_model['control_specification_id'] = 'testString' + control_specification_prototype_model['control_specification_description'] = 'testString' + control_specification_prototype_model['assessments'] = [assessment_prototype_model] + + # Construct a dict representation of a ControlDoc model + control_doc_model = {} + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + # Construct a dict representation of a ControlPrototype model + control_prototype_model = {} + control_prototype_model['control_name'] = 'testString' + control_prototype_model['control_description'] = 'testString' + control_prototype_model['control_category'] = 'testString' + control_prototype_model['control_requirement'] = True + control_prototype_model['control_parent'] = 'testString' + control_prototype_model['control_specifications'] = [control_specification_prototype_model] + control_prototype_model['control_docs'] = control_doc_model + control_prototype_model['status'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + control_library_name = 'testString' + control_library_description = 'testString' + control_library_type = 'custom' + control_library_version = 'testString' + controls = [control_prototype_model] + + # Invoke method + response = _service.replace_custom_control_library( + instance_id, + control_library_id, + control_library_name, + control_library_description, + control_library_type, + control_library_version, + controls, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['control_library_name'] == 'testString' + assert req_body['control_library_description'] == 'testString' + assert req_body['control_library_type'] == 'custom' + assert req_body['control_library_version'] == 'testString' + assert req_body['controls'] == [control_prototype_model] + + def test_replace_custom_control_library_required_params_with_retries(self): + # Enable retries and run test_replace_custom_control_library_required_params. + _service.enable_retries() + self.test_replace_custom_control_library_required_params() + + # Disable retries and run test_replace_custom_control_library_required_params. + _service.disable_retries() + self.test_replace_custom_control_library_required_params() + + @responses.activate + def test_replace_custom_control_library_value_error(self): + """ + test_replace_custom_control_library_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a AssessmentPrototype model + assessment_prototype_model = {} + assessment_prototype_model['assessment_id'] = 'testString' + assessment_prototype_model['assessment_description'] = 'testString' + + # Construct a dict representation of a ControlSpecificationPrototype model + control_specification_prototype_model = {} + control_specification_prototype_model['component_id'] = 'testString' + control_specification_prototype_model['environment'] = 'ibm-cloud' + control_specification_prototype_model['control_specification_id'] = 'testString' + control_specification_prototype_model['control_specification_description'] = 'testString' + control_specification_prototype_model['assessments'] = [assessment_prototype_model] + + # Construct a dict representation of a ControlDoc model + control_doc_model = {} + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + # Construct a dict representation of a ControlPrototype model + control_prototype_model = {} + control_prototype_model['control_name'] = 'testString' + control_prototype_model['control_description'] = 'testString' + control_prototype_model['control_category'] = 'testString' + control_prototype_model['control_requirement'] = True + control_prototype_model['control_parent'] = 'testString' + control_prototype_model['control_specifications'] = [control_specification_prototype_model] + control_prototype_model['control_docs'] = control_doc_model + control_prototype_model['status'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + control_library_name = 'testString' + control_library_description = 'testString' + control_library_type = 'custom' + control_library_version = 'testString' + controls = [control_prototype_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "control_library_id": control_library_id, + "control_library_name": control_library_name, + "control_library_description": control_library_description, + "control_library_type": control_library_type, + "control_library_version": control_library_version, + "controls": controls, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.replace_custom_control_library(**req_copy) + + def test_replace_custom_control_library_value_error_with_retries(self): + # Enable retries and run test_replace_custom_control_library_value_error. + _service.enable_retries() + self.test_replace_custom_control_library_value_error() + + # Disable retries and run test_replace_custom_control_library_value_error. + _service.disable_retries() + self.test_replace_custom_control_library_value_error() + + +class TestGetControlLibrary: + """ + Test Class for get_control_library + """ + + @responses.activate + def test_get_control_library_all_params(self): + """ + get_control_library() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + account_id = 'testString' + + # Invoke method + response = _service.get_control_library( + instance_id, + control_library_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_get_control_library_all_params_with_retries(self): + # Enable retries and run test_get_control_library_all_params. + _service.enable_retries() + self.test_get_control_library_all_params() + + # Disable retries and run test_get_control_library_all_params. + _service.disable_retries() + self.test_get_control_library_all_params() + + @responses.activate + def test_get_control_library_required_params(self): + """ + test_get_control_library_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + + # Invoke method + response = _service.get_control_library( + instance_id, + control_library_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_control_library_required_params_with_retries(self): + # Enable retries and run test_get_control_library_required_params. + _service.enable_retries() + self.test_get_control_library_required_params() + + # Disable retries and run test_get_control_library_required_params. + _service.disable_retries() + self.test_get_control_library_required_params() + + @responses.activate + def test_get_control_library_value_error(self): + """ + test_get_control_library_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "control_library_id": control_library_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_control_library(**req_copy) + + def test_get_control_library_value_error_with_retries(self): + # Enable retries and run test_get_control_library_value_error. + _service.enable_retries() + self.test_get_control_library_value_error() + + # Disable retries and run test_get_control_library_value_error. + _service.disable_retries() + self.test_get_control_library_value_error() + + +class TestDeleteCustomControlLibrary: + """ + Test Class for delete_custom_control_library + """ + + @responses.activate + def test_delete_custom_control_library_all_params(self): + """ + delete_custom_control_library() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + account_id = 'testString' + + # Invoke method + response = _service.delete_custom_control_library( + instance_id, + control_library_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_delete_custom_control_library_all_params_with_retries(self): + # Enable retries and run test_delete_custom_control_library_all_params. + _service.enable_retries() + self.test_delete_custom_control_library_all_params() + + # Disable retries and run test_delete_custom_control_library_all_params. + _service.disable_retries() + self.test_delete_custom_control_library_all_params() + + @responses.activate + def test_delete_custom_control_library_required_params(self): + """ + test_delete_custom_control_library_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + + # Invoke method + response = _service.delete_custom_control_library( + instance_id, + control_library_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_delete_custom_control_library_required_params_with_retries(self): + # Enable retries and run test_delete_custom_control_library_required_params. + _service.enable_retries() + self.test_delete_custom_control_library_required_params() + + # Disable retries and run test_delete_custom_control_library_required_params. + _service.disable_retries() + self.test_delete_custom_control_library_required_params() + + @responses.activate + def test_delete_custom_control_library_value_error(self): + """ + test_delete_custom_control_library_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/control_libraries/testString') + mock_response = '{"control_library_name": "control_library_name", "control_library_description": "control_library_description", "control_library_type": "custom", "control_library_version": "control_library_version", "controls": [{"control_name": "control_name", "control_id": "control_id", "control_description": "control_description", "control_category": "control_category", "control_parent": "control_parent", "control_severity": "control_severity", "control_tags": ["control_tags"], "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}], "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "status": "status"}], "id": "id", "account_id": "account_id", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "hierarchy_enabled": false, "controls_count": 14, "control_parents_count": 21}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + control_library_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "control_library_id": control_library_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_custom_control_library(**req_copy) + + def test_delete_custom_control_library_value_error_with_retries(self): + # Enable retries and run test_delete_custom_control_library_value_error. + _service.enable_retries() + self.test_delete_custom_control_library_value_error() + + # Disable retries and run test_delete_custom_control_library_value_error. + _service.disable_retries() + self.test_delete_custom_control_library_value_error() + + +# endregion +############################################################################## +# End of Service: ControlLibrary +############################################################################## + +############################################################################## +# Start of Service: Profile +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestCreateProfile: + """ + Test Class for create_profile + """ + + @responses.activate + def test_create_profile_all_params(self): + """ + create_profile() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a ProfileControlsPrototype model + profile_controls_prototype_model = {} + profile_controls_prototype_model['control_library_id'] = 'testString' + profile_controls_prototype_model['control_id'] = 'testString' + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + controls = [profile_controls_prototype_model] + default_parameters = [default_parameters_model] + profile_name = 'testString' + profile_description = 'testString' + profile_version = 'testString' + latest = True + version_group_label = 'testString' + account_id = 'testString' + + # Invoke method + response = _service.create_profile( + instance_id, + controls, + default_parameters, + profile_name=profile_name, + profile_description=profile_description, + profile_version=profile_version, + latest=latest, + version_group_label=version_group_label, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['controls'] == [profile_controls_prototype_model] + assert req_body['default_parameters'] == [default_parameters_model] + assert req_body['profile_name'] == 'testString' + assert req_body['profile_description'] == 'testString' + assert req_body['profile_version'] == 'testString' + assert req_body['latest'] == True + assert req_body['version_group_label'] == 'testString' + + def test_create_profile_all_params_with_retries(self): + # Enable retries and run test_create_profile_all_params. + _service.enable_retries() + self.test_create_profile_all_params() + + # Disable retries and run test_create_profile_all_params. + _service.disable_retries() + self.test_create_profile_all_params() + + @responses.activate + def test_create_profile_required_params(self): + """ + test_create_profile_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a ProfileControlsPrototype model + profile_controls_prototype_model = {} + profile_controls_prototype_model['control_library_id'] = 'testString' + profile_controls_prototype_model['control_id'] = 'testString' + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + controls = [profile_controls_prototype_model] + default_parameters = [default_parameters_model] + profile_name = 'testString' + profile_description = 'testString' + profile_version = 'testString' + latest = True + version_group_label = 'testString' + + # Invoke method + response = _service.create_profile( + instance_id, + controls, + default_parameters, + profile_name=profile_name, + profile_description=profile_description, + profile_version=profile_version, + latest=latest, + version_group_label=version_group_label, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['controls'] == [profile_controls_prototype_model] + assert req_body['default_parameters'] == [default_parameters_model] + assert req_body['profile_name'] == 'testString' + assert req_body['profile_description'] == 'testString' + assert req_body['profile_version'] == 'testString' + assert req_body['latest'] == True + assert req_body['version_group_label'] == 'testString' + + def test_create_profile_required_params_with_retries(self): + # Enable retries and run test_create_profile_required_params. + _service.enable_retries() + self.test_create_profile_required_params() + + # Disable retries and run test_create_profile_required_params. + _service.disable_retries() + self.test_create_profile_required_params() + + @responses.activate + def test_create_profile_value_error(self): + """ + test_create_profile_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a ProfileControlsPrototype model + profile_controls_prototype_model = {} + profile_controls_prototype_model['control_library_id'] = 'testString' + profile_controls_prototype_model['control_id'] = 'testString' + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + controls = [profile_controls_prototype_model] + default_parameters = [default_parameters_model] + profile_name = 'testString' + profile_description = 'testString' + profile_version = 'testString' + latest = True + version_group_label = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "controls": controls, + "default_parameters": default_parameters, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_profile(**req_copy) + + def test_create_profile_value_error_with_retries(self): + # Enable retries and run test_create_profile_value_error. + _service.enable_retries() + self.test_create_profile_value_error() + + # Disable retries and run test_create_profile_value_error. + _service.disable_retries() + self.test_create_profile_value_error() + + +class TestListProfiles: + """ + Test Class for list_profiles + """ + + @responses.activate + def test_list_profiles_all_params(self): + """ + list_profiles() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "profiles": [{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + account_id = 'testString' + + # Invoke method + response = _service.list_profiles( + instance_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_list_profiles_all_params_with_retries(self): + # Enable retries and run test_list_profiles_all_params. + _service.enable_retries() + self.test_list_profiles_all_params() + + # Disable retries and run test_list_profiles_all_params. + _service.disable_retries() + self.test_list_profiles_all_params() + + @responses.activate + def test_list_profiles_required_params(self): + """ + test_list_profiles_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "profiles": [{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.list_profiles( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_profiles_required_params_with_retries(self): + # Enable retries and run test_list_profiles_required_params. + _service.enable_retries() + self.test_list_profiles_required_params() + + # Disable retries and run test_list_profiles_required_params. + _service.disable_retries() + self.test_list_profiles_required_params() + + @responses.activate + def test_list_profiles_value_error(self): + """ + test_list_profiles_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "profiles": [{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_profiles(**req_copy) + + def test_list_profiles_value_error_with_retries(self): + # Enable retries and run test_list_profiles_value_error. + _service.enable_retries() + self.test_list_profiles_value_error() + + # Disable retries and run test_list_profiles_value_error. + _service.disable_retries() + self.test_list_profiles_value_error() + + +class TestReplaceProfile: + """ + Test Class for replace_profile + """ + + @responses.activate + def test_replace_profile_all_params(self): + """ + replace_profile() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a ProfileControlsPrototype model + profile_controls_prototype_model = {} + profile_controls_prototype_model['control_library_id'] = 'testString' + profile_controls_prototype_model['control_id'] = 'testString' + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + controls = [profile_controls_prototype_model] + default_parameters = [default_parameters_model] + profile_name = 'testString' + profile_description = 'testString' + profile_version = 'testString' + latest = True + version_group_label = 'testString' + account_id = 'testString' + + # Invoke method + response = _service.replace_profile( + instance_id, + profile_id, + controls, + default_parameters, + profile_name=profile_name, + profile_description=profile_description, + profile_version=profile_version, + latest=latest, + version_group_label=version_group_label, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['controls'] == [profile_controls_prototype_model] + assert req_body['default_parameters'] == [default_parameters_model] + assert req_body['profile_name'] == 'testString' + assert req_body['profile_description'] == 'testString' + assert req_body['profile_version'] == 'testString' + assert req_body['latest'] == True + assert req_body['version_group_label'] == 'testString' + + def test_replace_profile_all_params_with_retries(self): + # Enable retries and run test_replace_profile_all_params. + _service.enable_retries() + self.test_replace_profile_all_params() + + # Disable retries and run test_replace_profile_all_params. + _service.disable_retries() + self.test_replace_profile_all_params() + + @responses.activate + def test_replace_profile_required_params(self): + """ + test_replace_profile_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a ProfileControlsPrototype model + profile_controls_prototype_model = {} + profile_controls_prototype_model['control_library_id'] = 'testString' + profile_controls_prototype_model['control_id'] = 'testString' + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + controls = [profile_controls_prototype_model] + default_parameters = [default_parameters_model] + profile_name = 'testString' + profile_description = 'testString' + profile_version = 'testString' + latest = True + version_group_label = 'testString' + + # Invoke method + response = _service.replace_profile( + instance_id, + profile_id, + controls, + default_parameters, + profile_name=profile_name, + profile_description=profile_description, + profile_version=profile_version, + latest=latest, + version_group_label=version_group_label, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['controls'] == [profile_controls_prototype_model] + assert req_body['default_parameters'] == [default_parameters_model] + assert req_body['profile_name'] == 'testString' + assert req_body['profile_description'] == 'testString' + assert req_body['profile_version'] == 'testString' + assert req_body['latest'] == True + assert req_body['version_group_label'] == 'testString' + + def test_replace_profile_required_params_with_retries(self): + # Enable retries and run test_replace_profile_required_params. + _service.enable_retries() + self.test_replace_profile_required_params() + + # Disable retries and run test_replace_profile_required_params. + _service.disable_retries() + self.test_replace_profile_required_params() + + @responses.activate + def test_replace_profile_value_error(self): + """ + test_replace_profile_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a ProfileControlsPrototype model + profile_controls_prototype_model = {} + profile_controls_prototype_model['control_library_id'] = 'testString' + profile_controls_prototype_model['control_id'] = 'testString' + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + controls = [profile_controls_prototype_model] + default_parameters = [default_parameters_model] + profile_name = 'testString' + profile_description = 'testString' + profile_version = 'testString' + latest = True + version_group_label = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + "controls": controls, + "default_parameters": default_parameters, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.replace_profile(**req_copy) + + def test_replace_profile_value_error_with_retries(self): + # Enable retries and run test_replace_profile_value_error. + _service.enable_retries() + self.test_replace_profile_value_error() + + # Disable retries and run test_replace_profile_value_error. + _service.disable_retries() + self.test_replace_profile_value_error() + + +class TestGetProfile: + """ + Test Class for get_profile + """ + + @responses.activate + def test_get_profile_all_params(self): + """ + get_profile() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + account_id = 'testString' + + # Invoke method + response = _service.get_profile( + instance_id, + profile_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_get_profile_all_params_with_retries(self): + # Enable retries and run test_get_profile_all_params. + _service.enable_retries() + self.test_get_profile_all_params() + + # Disable retries and run test_get_profile_all_params. + _service.disable_retries() + self.test_get_profile_all_params() + + @responses.activate + def test_get_profile_required_params(self): + """ + test_get_profile_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Invoke method + response = _service.get_profile( + instance_id, + profile_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_profile_required_params_with_retries(self): + # Enable retries and run test_get_profile_required_params. + _service.enable_retries() + self.test_get_profile_required_params() + + # Disable retries and run test_get_profile_required_params. + _service.disable_retries() + self.test_get_profile_required_params() + + @responses.activate + def test_get_profile_value_error(self): + """ + test_get_profile_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_profile(**req_copy) + + def test_get_profile_value_error_with_retries(self): + # Enable retries and run test_get_profile_value_error. + _service.enable_retries() + self.test_get_profile_value_error() + + # Disable retries and run test_get_profile_value_error. + _service.disable_retries() + self.test_get_profile_value_error() + + +class TestDeleteCustomProfile: + """ + Test Class for delete_custom_profile + """ + + @responses.activate + def test_delete_custom_profile_all_params(self): + """ + delete_custom_profile() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + account_id = 'testString' + + # Invoke method + response = _service.delete_custom_profile( + instance_id, + profile_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_delete_custom_profile_all_params_with_retries(self): + # Enable retries and run test_delete_custom_profile_all_params. + _service.enable_retries() + self.test_delete_custom_profile_all_params() + + # Disable retries and run test_delete_custom_profile_all_params. + _service.disable_retries() + self.test_delete_custom_profile_all_params() + + @responses.activate + def test_delete_custom_profile_required_params(self): + """ + test_delete_custom_profile_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Invoke method + response = _service.delete_custom_profile( + instance_id, + profile_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_delete_custom_profile_required_params_with_retries(self): + # Enable retries and run test_delete_custom_profile_required_params. + _service.enable_retries() + self.test_delete_custom_profile_required_params() + + # Disable retries and run test_delete_custom_profile_required_params. + _service.disable_retries() + self.test_delete_custom_profile_required_params() + + @responses.activate + def test_delete_custom_profile_value_error(self): + """ + test_delete_custom_profile_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a') + mock_response = '{"id": "id", "profile_name": "profile_name", "instance_id": "instance_id", "hierarchy_enabled": false, "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14, "attachments_count": 17, "controls": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.DELETE, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_custom_profile(**req_copy) + + def test_delete_custom_profile_value_error_with_retries(self): + # Enable retries and run test_delete_custom_profile_value_error. + _service.enable_retries() + self.test_delete_custom_profile_value_error() + + # Disable retries and run test_delete_custom_profile_value_error. + _service.disable_retries() + self.test_delete_custom_profile_value_error() + + +class TestReplaceProfileParameters: + """ + Test Class for replace_profile_parameters + """ + + @responses.activate + def test_replace_profile_parameters_all_params(self): + """ + replace_profile_parameters() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/parameters') + mock_response = '{"id": "id", "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + default_parameters = [default_parameters_model] + id = 'testString' + account_id = 'testString' + + # Invoke method + response = _service.replace_profile_parameters( + instance_id, + profile_id, + default_parameters, + id=id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['default_parameters'] == [default_parameters_model] + assert req_body['id'] == 'testString' + + def test_replace_profile_parameters_all_params_with_retries(self): + # Enable retries and run test_replace_profile_parameters_all_params. + _service.enable_retries() + self.test_replace_profile_parameters_all_params() + + # Disable retries and run test_replace_profile_parameters_all_params. + _service.disable_retries() + self.test_replace_profile_parameters_all_params() + + @responses.activate + def test_replace_profile_parameters_required_params(self): + """ + test_replace_profile_parameters_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/parameters') + mock_response = '{"id": "id", "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + default_parameters = [default_parameters_model] + id = 'testString' + + # Invoke method + response = _service.replace_profile_parameters( + instance_id, + profile_id, + default_parameters, + id=id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['default_parameters'] == [default_parameters_model] + assert req_body['id'] == 'testString' + + def test_replace_profile_parameters_required_params_with_retries(self): + # Enable retries and run test_replace_profile_parameters_required_params. + _service.enable_retries() + self.test_replace_profile_parameters_required_params() + + # Disable retries and run test_replace_profile_parameters_required_params. + _service.disable_retries() + self.test_replace_profile_parameters_required_params() + + @responses.activate + def test_replace_profile_parameters_value_error(self): + """ + test_replace_profile_parameters_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/parameters') + mock_response = '{"id": "id", "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a DefaultParameters model + default_parameters_model = {} + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + default_parameters = [default_parameters_model] + id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + "default_parameters": default_parameters, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.replace_profile_parameters(**req_copy) + + def test_replace_profile_parameters_value_error_with_retries(self): + # Enable retries and run test_replace_profile_parameters_value_error. + _service.enable_retries() + self.test_replace_profile_parameters_value_error() + + # Disable retries and run test_replace_profile_parameters_value_error. + _service.disable_retries() + self.test_replace_profile_parameters_value_error() + + +class TestListProfileParameters: + """ + Test Class for list_profile_parameters + """ + + @responses.activate + def test_list_profile_parameters_all_params(self): + """ + list_profile_parameters() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/parameters') + mock_response = '{"id": "id", "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Invoke method + response = _service.list_profile_parameters( + instance_id, + profile_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_profile_parameters_all_params_with_retries(self): + # Enable retries and run test_list_profile_parameters_all_params. + _service.enable_retries() + self.test_list_profile_parameters_all_params() + + # Disable retries and run test_list_profile_parameters_all_params. + _service.disable_retries() + self.test_list_profile_parameters_all_params() + + @responses.activate + def test_list_profile_parameters_value_error(self): + """ + test_list_profile_parameters_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/parameters') + mock_response = '{"id": "id", "default_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_profile_parameters(**req_copy) + + def test_list_profile_parameters_value_error_with_retries(self): + # Enable retries and run test_list_profile_parameters_value_error. + _service.enable_retries() + self.test_list_profile_parameters_value_error() + + # Disable retries and run test_list_profile_parameters_value_error. + _service.disable_retries() + self.test_list_profile_parameters_value_error() + + +class TestCompareProfiles: + """ + Test Class for compare_profiles + """ + + @responses.activate + def test_compare_profiles_all_params(self): + """ + compare_profiles() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/compare') + mock_response = '{"current_predefined_version": {"id": "id", "profile_name": "profile_name", "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14}, "latest_predefined_version": {"id": "id", "profile_name": "profile_name", "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14}, "controls_changes": {"total_added": 11, "total_removed": 13, "total_updated": 13, "added": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "removed": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "updated": [{"current": {"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}, "latest": {"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}}]}, "default_parameters_changes": {"total_added": 11, "total_removed": 13, "total_updated": 13, "added": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}], "removed": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}], "updated": [{"current": {"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}, "latest": {"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}}]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + account_id = 'testString' + + # Invoke method + response = _service.compare_profiles( + instance_id, + profile_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_compare_profiles_all_params_with_retries(self): + # Enable retries and run test_compare_profiles_all_params. + _service.enable_retries() + self.test_compare_profiles_all_params() + + # Disable retries and run test_compare_profiles_all_params. + _service.disable_retries() + self.test_compare_profiles_all_params() + + @responses.activate + def test_compare_profiles_required_params(self): + """ + test_compare_profiles_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/compare') + mock_response = '{"current_predefined_version": {"id": "id", "profile_name": "profile_name", "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14}, "latest_predefined_version": {"id": "id", "profile_name": "profile_name", "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14}, "controls_changes": {"total_added": 11, "total_removed": 13, "total_updated": 13, "added": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "removed": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "updated": [{"current": {"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}, "latest": {"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}}]}, "default_parameters_changes": {"total_added": 11, "total_removed": 13, "total_updated": 13, "added": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}], "removed": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}], "updated": [{"current": {"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}, "latest": {"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}}]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Invoke method + response = _service.compare_profiles( + instance_id, + profile_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_compare_profiles_required_params_with_retries(self): + # Enable retries and run test_compare_profiles_required_params. + _service.enable_retries() + self.test_compare_profiles_required_params() + + # Disable retries and run test_compare_profiles_required_params. + _service.disable_retries() + self.test_compare_profiles_required_params() + + @responses.activate + def test_compare_profiles_value_error(self): + """ + test_compare_profiles_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/compare') + mock_response = '{"current_predefined_version": {"id": "id", "profile_name": "profile_name", "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14}, "latest_predefined_version": {"id": "id", "profile_name": "profile_name", "profile_description": "profile_description", "profile_type": "custom", "profile_version": "profile_version", "version_group_label": "version_group_label", "latest": true, "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "controls_count": 14}, "controls_changes": {"total_added": 11, "total_removed": 13, "total_updated": 13, "added": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "removed": [{"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}], "updated": [{"current": {"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}, "latest": {"control_requirement": false, "control_library_id": "control_library_id", "control_id": "control_id", "control_library_version": "control_library_version", "control_name": "control_name", "control_description": "control_description", "control_severity": "control_severity", "control_category": "control_category", "control_parent": "control_parent", "control_docs": {"control_docs_id": "control_docs_id", "control_docs_type": "control_docs_type"}, "control_specifications": [{"id": "id", "responsibility": "responsibility", "component_id": "component_id", "component_name": "component_name", "component_type": "component_type", "environment": "environment", "description": "description", "assessments_count": 17, "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}]}]}}]}, "default_parameters_changes": {"total_added": 11, "total_removed": 13, "total_updated": 13, "added": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}], "removed": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}], "updated": [{"current": {"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}, "latest": {"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "parameter_name", "parameter_default_value": "parameter_default_value", "parameter_display_name": "parameter_display_name", "parameter_type": "parameter_type"}}]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.compare_profiles(**req_copy) + + def test_compare_profiles_value_error_with_retries(self): + # Enable retries and run test_compare_profiles_value_error. + _service.enable_retries() + self.test_compare_profiles_value_error() + + # Disable retries and run test_compare_profiles_value_error. + _service.disable_retries() + self.test_compare_profiles_value_error() + + +class TestListProfileAttachments: + """ + Test Class for list_profile_attachments + """ + + @responses.activate + def test_list_profile_attachments_all_params(self): + """ + list_profile_attachments() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + account_id = 'testString' + + # Invoke method + response = _service.list_profile_attachments( + instance_id, + profile_id, + account_id=account_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'account_id={}'.format(account_id) in query_string + + def test_list_profile_attachments_all_params_with_retries(self): + # Enable retries and run test_list_profile_attachments_all_params. + _service.enable_retries() + self.test_list_profile_attachments_all_params() + + # Disable retries and run test_list_profile_attachments_all_params. + _service.disable_retries() + self.test_list_profile_attachments_all_params() + + @responses.activate + def test_list_profile_attachments_required_params(self): + """ + test_list_profile_attachments_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Invoke method + response = _service.list_profile_attachments( + instance_id, + profile_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_profile_attachments_required_params_with_retries(self): + # Enable retries and run test_list_profile_attachments_required_params. + _service.enable_retries() + self.test_list_profile_attachments_required_params() + + # Disable retries and run test_list_profile_attachments_required_params. + _service.disable_retries() + self.test_list_profile_attachments_required_params() + + @responses.activate + def test_list_profile_attachments_value_error(self): + """ + test_list_profile_attachments_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/profiles/48279384-3d29-4089-8259-8ed354774b4a/attachments') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "attachments": [{"attachment_parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "description": "description", "name": "name", "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}, "schedule": "daily", "scope": [{"id": "id", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}], "status": "enabled", "data_selection_range": {"start_date": "2025-02-28T05:42:58.000Z", "end_date": "2025-02-28T05:42:58.000Z"}, "account_id": "account_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "id": "id", "instance_id": "instance_id", "last_scan": {"id": "id", "status": "status", "time": "2019-01-01T12:00:00.000Z"}, "next_scan_time": "2019-01-01T12:00:00.000Z", "profile_id": "profile_id", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + profile_id = '48279384-3d29-4089-8259-8ed354774b4a' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "profile_id": profile_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_profile_attachments(**req_copy) + + def test_list_profile_attachments_value_error_with_retries(self): + # Enable retries and run test_list_profile_attachments_value_error. + _service.enable_retries() + self.test_list_profile_attachments_value_error() + + # Disable retries and run test_list_profile_attachments_value_error. + _service.disable_retries() + self.test_list_profile_attachments_value_error() + + +# endregion +############################################################################## +# End of Service: Profile +############################################################################## + +############################################################################## +# Start of Service: ProviderType +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestListProviderTypes: + """ + Test Class for list_provider_types + """ + + @responses.activate + def test_list_provider_types_all_params(self): + """ + list_provider_types() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types') + mock_response = '{"provider_types": [{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection", "description": "Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.", "s2s_enabled": true, "instance_limit": 1, "mode": "PULL", "data_type": "com.sysdig.secure.results", "icon": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+", "label": {"text": "1 per instance", "tip": "Only 1 per instance"}, "attributes": {"mapKey": {"type": "text", "display_name": "Workload Protection Instance CRN"}}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.list_provider_types( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_provider_types_all_params_with_retries(self): + # Enable retries and run test_list_provider_types_all_params. + _service.enable_retries() + self.test_list_provider_types_all_params() + + # Disable retries and run test_list_provider_types_all_params. + _service.disable_retries() + self.test_list_provider_types_all_params() + + @responses.activate + def test_list_provider_types_value_error(self): + """ + test_list_provider_types_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types') + mock_response = '{"provider_types": [{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection", "description": "Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.", "s2s_enabled": true, "instance_limit": 1, "mode": "PULL", "data_type": "com.sysdig.secure.results", "icon": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+", "label": {"text": "1 per instance", "tip": "Only 1 per instance"}, "attributes": {"mapKey": {"type": "text", "display_name": "Workload Protection Instance CRN"}}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_provider_types(**req_copy) + + def test_list_provider_types_value_error_with_retries(self): + # Enable retries and run test_list_provider_types_value_error. + _service.enable_retries() + self.test_list_provider_types_value_error() + + # Disable retries and run test_list_provider_types_value_error. + _service.disable_retries() + self.test_list_provider_types_value_error() + + +class TestGetProviderTypeById: + """ + Test Class for get_provider_type_by_id + """ + + @responses.activate + def test_get_provider_type_by_id_all_params(self): + """ + get_provider_type_by_id() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString') + mock_response = '{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection", "description": "Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.", "s2s_enabled": true, "instance_limit": 1, "mode": "PULL", "data_type": "com.sysdig.secure.results", "icon": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+", "label": {"text": "1 per instance", "tip": "Only 1 per instance"}, "attributes": {"mapKey": {"type": "text", "display_name": "Workload Protection Instance CRN"}}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + + # Invoke method + response = _service.get_provider_type_by_id( + instance_id, + provider_type_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_provider_type_by_id_all_params_with_retries(self): + # Enable retries and run test_get_provider_type_by_id_all_params. + _service.enable_retries() + self.test_get_provider_type_by_id_all_params() + + # Disable retries and run test_get_provider_type_by_id_all_params. + _service.disable_retries() + self.test_get_provider_type_by_id_all_params() + + @responses.activate + def test_get_provider_type_by_id_value_error(self): + """ + test_get_provider_type_by_id_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString') + mock_response = '{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection", "description": "Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.", "s2s_enabled": true, "instance_limit": 1, "mode": "PULL", "data_type": "com.sysdig.secure.results", "icon": "PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+", "label": {"text": "1 per instance", "tip": "Only 1 per instance"}, "attributes": {"mapKey": {"type": "text", "display_name": "Workload Protection Instance CRN"}}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "provider_type_id": provider_type_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_provider_type_by_id(**req_copy) + + def test_get_provider_type_by_id_value_error_with_retries(self): + # Enable retries and run test_get_provider_type_by_id_value_error. + _service.enable_retries() + self.test_get_provider_type_by_id_value_error() + + # Disable retries and run test_get_provider_type_by_id_value_error. + _service.disable_retries() + self.test_get_provider_type_by_id_value_error() + + +# endregion +############################################################################## +# End of Service: ProviderType +############################################################################## + +############################################################################## +# Start of Service: ProviderTypeInstance +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestCreateProviderTypeInstance: + """ + Test Class for create_provider_type_instance + """ + + @responses.activate + def test_create_provider_type_instance_all_params(self): + """ + create_provider_type_instance() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances') + mock_response = '{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection-instance-1", "attributes": {"anyKey": "anyValue"}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + name = 'workload-protection-instance-1' + attributes = {'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'} + + # Invoke method + response = _service.create_provider_type_instance( + instance_id, + provider_type_id, + name=name, + attributes=attributes, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['name'] == 'workload-protection-instance-1' + assert req_body['attributes'] == {'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'} + + def test_create_provider_type_instance_all_params_with_retries(self): + # Enable retries and run test_create_provider_type_instance_all_params. + _service.enable_retries() + self.test_create_provider_type_instance_all_params() + + # Disable retries and run test_create_provider_type_instance_all_params. + _service.disable_retries() + self.test_create_provider_type_instance_all_params() + + @responses.activate + def test_create_provider_type_instance_value_error(self): + """ + test_create_provider_type_instance_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances') + mock_response = '{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection-instance-1", "attributes": {"anyKey": "anyValue"}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + name = 'workload-protection-instance-1' + attributes = {'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'} + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "provider_type_id": provider_type_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_provider_type_instance(**req_copy) + + def test_create_provider_type_instance_value_error_with_retries(self): + # Enable retries and run test_create_provider_type_instance_value_error. + _service.enable_retries() + self.test_create_provider_type_instance_value_error() + + # Disable retries and run test_create_provider_type_instance_value_error. + _service.disable_retries() + self.test_create_provider_type_instance_value_error() + + +class TestListProviderTypeInstances: + """ + Test Class for list_provider_type_instances + """ + + @responses.activate + def test_list_provider_type_instances_all_params(self): + """ + list_provider_type_instances() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances') + mock_response = '{"provider_type_instances": [{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection-instance-1", "attributes": {"anyKey": "anyValue"}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + + # Invoke method + response = _service.list_provider_type_instances( + instance_id, + provider_type_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_provider_type_instances_all_params_with_retries(self): + # Enable retries and run test_list_provider_type_instances_all_params. + _service.enable_retries() + self.test_list_provider_type_instances_all_params() + + # Disable retries and run test_list_provider_type_instances_all_params. + _service.disable_retries() + self.test_list_provider_type_instances_all_params() + + @responses.activate + def test_list_provider_type_instances_value_error(self): + """ + test_list_provider_type_instances_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances') + mock_response = '{"provider_type_instances": [{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection-instance-1", "attributes": {"anyKey": "anyValue"}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "provider_type_id": provider_type_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_provider_type_instances(**req_copy) + + def test_list_provider_type_instances_value_error_with_retries(self): + # Enable retries and run test_list_provider_type_instances_value_error. + _service.enable_retries() + self.test_list_provider_type_instances_value_error() + + # Disable retries and run test_list_provider_type_instances_value_error. + _service.disable_retries() + self.test_list_provider_type_instances_value_error() + + +class TestGetProviderTypeInstance: + """ + Test Class for get_provider_type_instance + """ + + @responses.activate + def test_get_provider_type_instance_all_params(self): + """ + get_provider_type_instance() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances/testString') + mock_response = '{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection-instance-1", "attributes": {"anyKey": "anyValue"}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + provider_type_instance_id = 'testString' + + # Invoke method + response = _service.get_provider_type_instance( + instance_id, + provider_type_id, + provider_type_instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_provider_type_instance_all_params_with_retries(self): + # Enable retries and run test_get_provider_type_instance_all_params. + _service.enable_retries() + self.test_get_provider_type_instance_all_params() + + # Disable retries and run test_get_provider_type_instance_all_params. + _service.disable_retries() + self.test_get_provider_type_instance_all_params() + + @responses.activate + def test_get_provider_type_instance_value_error(self): + """ + test_get_provider_type_instance_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances/testString') + mock_response = '{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection-instance-1", "attributes": {"anyKey": "anyValue"}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + provider_type_instance_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "provider_type_id": provider_type_id, + "provider_type_instance_id": provider_type_instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_provider_type_instance(**req_copy) + + def test_get_provider_type_instance_value_error_with_retries(self): + # Enable retries and run test_get_provider_type_instance_value_error. + _service.enable_retries() + self.test_get_provider_type_instance_value_error() + + # Disable retries and run test_get_provider_type_instance_value_error. + _service.disable_retries() + self.test_get_provider_type_instance_value_error() + + +class TestUpdateProviderTypeInstance: + """ + Test Class for update_provider_type_instance + """ + + @responses.activate + def test_update_provider_type_instance_all_params(self): + """ + update_provider_type_instance() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances/testString') + mock_response = '{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection-instance-1", "attributes": {"anyKey": "anyValue"}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + provider_type_instance_id = 'testString' + name = 'workload-protection-instance-1' + attributes = {'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'} + + # Invoke method + response = _service.update_provider_type_instance( + instance_id, + provider_type_id, + provider_type_instance_id, + name=name, + attributes=attributes, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['name'] == 'workload-protection-instance-1' + assert req_body['attributes'] == {'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'} + + def test_update_provider_type_instance_all_params_with_retries(self): + # Enable retries and run test_update_provider_type_instance_all_params. + _service.enable_retries() + self.test_update_provider_type_instance_all_params() + + # Disable retries and run test_update_provider_type_instance_all_params. + _service.disable_retries() + self.test_update_provider_type_instance_all_params() + + @responses.activate + def test_update_provider_type_instance_value_error(self): + """ + test_update_provider_type_instance_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances/testString') + mock_response = '{"id": "7588190cce3c05ac8f7942ea597dafce", "type": "workload-protection", "name": "workload-protection-instance-1", "attributes": {"anyKey": "anyValue"}, "created_at": "2023-07-24T13:14:18.884Z", "updated_at": "2023-07-24T13:14:18.884Z"}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + provider_type_instance_id = 'testString' + name = 'workload-protection-instance-1' + attributes = {'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'} + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "provider_type_id": provider_type_id, + "provider_type_instance_id": provider_type_instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_provider_type_instance(**req_copy) + + def test_update_provider_type_instance_value_error_with_retries(self): + # Enable retries and run test_update_provider_type_instance_value_error. + _service.enable_retries() + self.test_update_provider_type_instance_value_error() + + # Disable retries and run test_update_provider_type_instance_value_error. + _service.disable_retries() + self.test_update_provider_type_instance_value_error() + + +class TestDeleteProviderTypeInstance: + """ + Test Class for delete_provider_type_instance + """ + + @responses.activate + def test_delete_provider_type_instance_all_params(self): + """ + delete_provider_type_instance() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + provider_type_instance_id = 'testString' + + # Invoke method + response = _service.delete_provider_type_instance( + instance_id, + provider_type_id, + provider_type_instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_provider_type_instance_all_params_with_retries(self): + # Enable retries and run test_delete_provider_type_instance_all_params. + _service.enable_retries() + self.test_delete_provider_type_instance_all_params() + + # Disable retries and run test_delete_provider_type_instance_all_params. + _service.disable_retries() + self.test_delete_provider_type_instance_all_params() + + @responses.activate + def test_delete_provider_type_instance_value_error(self): + """ + test_delete_provider_type_instance_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/provider_types/testString/provider_type_instances/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + provider_type_id = 'testString' + provider_type_instance_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "provider_type_id": provider_type_id, + "provider_type_instance_id": provider_type_instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_provider_type_instance(**req_copy) + + def test_delete_provider_type_instance_value_error_with_retries(self): + # Enable retries and run test_delete_provider_type_instance_value_error. + _service.enable_retries() + self.test_delete_provider_type_instance_value_error() + + # Disable retries and run test_delete_provider_type_instance_value_error. + _service.disable_retries() + self.test_delete_provider_type_instance_value_error() + + +# endregion +############################################################################## +# End of Service: ProviderTypeInstance +############################################################################## + +############################################################################## +# Start of Service: Report +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestGetLatestReports: + """ + Test Class for get_latest_reports + """ + + @responses.activate + def test_get_latest_reports_all_params(self): + """ + get_latest_reports() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/latest') + mock_response = '{"home_account_id": "home_account_id", "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "score": {"passed": 1, "total_count": 4, "percent": 25}, "reports": [{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + sort = 'profile_name' + + # Invoke method + response = _service.get_latest_reports( + instance_id, + sort=sort, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'sort={}'.format(sort) in query_string + + def test_get_latest_reports_all_params_with_retries(self): + # Enable retries and run test_get_latest_reports_all_params. + _service.enable_retries() + self.test_get_latest_reports_all_params() + + # Disable retries and run test_get_latest_reports_all_params. + _service.disable_retries() + self.test_get_latest_reports_all_params() + + @responses.activate + def test_get_latest_reports_required_params(self): + """ + test_get_latest_reports_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/latest') + mock_response = '{"home_account_id": "home_account_id", "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "score": {"passed": 1, "total_count": 4, "percent": 25}, "reports": [{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.get_latest_reports( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_latest_reports_required_params_with_retries(self): + # Enable retries and run test_get_latest_reports_required_params. + _service.enable_retries() + self.test_get_latest_reports_required_params() + + # Disable retries and run test_get_latest_reports_required_params. + _service.disable_retries() + self.test_get_latest_reports_required_params() + + @responses.activate + def test_get_latest_reports_value_error(self): + """ + test_get_latest_reports_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/latest') + mock_response = '{"home_account_id": "home_account_id", "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "score": {"passed": 1, "total_count": 4, "percent": 25}, "reports": [{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_latest_reports(**req_copy) + + def test_get_latest_reports_value_error_with_retries(self): + # Enable retries and run test_get_latest_reports_value_error. + _service.enable_retries() + self.test_get_latest_reports_value_error() + + # Disable retries and run test_get_latest_reports_value_error. + _service.disable_retries() + self.test_get_latest_reports_value_error() + + +class TestListReports: + """ + Test Class for list_reports + """ + + @responses.activate + def test_list_reports_all_params(self): + """ + list_reports() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "home_account_id": "home_account_id", "reports": [{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + attachment_id = 'testString' + group_id = 'testString' + profile_id = 'testString' + type = 'scheduled' + start = 'testString' + limit = 50 + sort = 'profile_name' + + # Invoke method + response = _service.list_reports( + instance_id, + attachment_id=attachment_id, + group_id=group_id, + profile_id=profile_id, + type=type, + start=start, + limit=limit, + sort=sort, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'attachment_id={}'.format(attachment_id) in query_string + assert 'group_id={}'.format(group_id) in query_string + assert 'profile_id={}'.format(profile_id) in query_string + assert 'type={}'.format(type) in query_string + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'sort={}'.format(sort) in query_string + + def test_list_reports_all_params_with_retries(self): + # Enable retries and run test_list_reports_all_params. + _service.enable_retries() + self.test_list_reports_all_params() + + # Disable retries and run test_list_reports_all_params. + _service.disable_retries() + self.test_list_reports_all_params() + + @responses.activate + def test_list_reports_required_params(self): + """ + test_list_reports_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "home_account_id": "home_account_id", "reports": [{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.list_reports( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_reports_required_params_with_retries(self): + # Enable retries and run test_list_reports_required_params. + _service.enable_retries() + self.test_list_reports_required_params() + + # Disable retries and run test_list_reports_required_params. + _service.disable_retries() + self.test_list_reports_required_params() + + @responses.activate + def test_list_reports_value_error(self): + """ + test_list_reports_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "home_account_id": "home_account_id", "reports": [{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_reports(**req_copy) + + def test_list_reports_value_error_with_retries(self): + # Enable retries and run test_list_reports_value_error. + _service.enable_retries() + self.test_list_reports_value_error() + + # Disable retries and run test_list_reports_value_error. + _service.disable_retries() + self.test_list_reports_value_error() + + @responses.activate + def test_list_reports_with_pager_get_next(self): + """ + test_list_reports_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports') + mock_response1 = '{"next":{"start":"1"},"reports":[{"id":"44a5-a292-32114fa73558","type":"scheduled","group_id":"55b6-b3A4-432250b84669","created_on":"2022-08-15T12:30:01Z","scan_time":"2022-08-15T12:30:01Z","cos_object":"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7","instance_id":"instance_id","account":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"NIST","type":"account_type"},"profile":{"id":"44a5-a292-32114fa73558","name":"IBM FS Cloud","version":"0.1"},"scope":{"id":"2411ffdc16844b07b42521c3443f456d","type":"account"},"attachment":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"resource group - Default","description":"Scoped to the Default resource group","schedule":"daily","scope":"anyValue","scopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}],"account_id":"account_id","instance_id":"instance_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z","attachment_count":16}],"notifications":{"enabled":false,"controls":{"threshold_limit":15,"failed_control_ids":["failed_control_ids"]}}},"controls_summary":{"status":"compliant","total_count":150,"compliant_count":130,"not_compliant_count":5,"unable_to_perform_count":5,"user_evaluation_required_count":10,"not_applicable_count":7,"not_compliant_controls":[{"id":"382c2b06-e6b2-43ee-b189-c1c7743b67ee","control_name":"ibm-cloud-rule","control_description":"Ensure security questions are registered by the account owner"}]},"evaluations_summary":{"status":"compliant","total_count":140,"pass_count":123,"failure_count":12,"error_count":5,"skipped_count":7,"completed_count":135},"tags":{"user":["user"],"access":["access"],"service":["service"]},"scopes":[{"id":"id","name":"name","href":"href"}],"additional_details":{"created_by":"Security and Compliance Center","labels":["labels"],"links":[{"description":"description","href":"href"}]}}],"total_count":2,"limit":1}' + mock_response2 = '{"reports":[{"id":"44a5-a292-32114fa73558","type":"scheduled","group_id":"55b6-b3A4-432250b84669","created_on":"2022-08-15T12:30:01Z","scan_time":"2022-08-15T12:30:01Z","cos_object":"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7","instance_id":"instance_id","account":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"NIST","type":"account_type"},"profile":{"id":"44a5-a292-32114fa73558","name":"IBM FS Cloud","version":"0.1"},"scope":{"id":"2411ffdc16844b07b42521c3443f456d","type":"account"},"attachment":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"resource group - Default","description":"Scoped to the Default resource group","schedule":"daily","scope":"anyValue","scopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}],"account_id":"account_id","instance_id":"instance_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z","attachment_count":16}],"notifications":{"enabled":false,"controls":{"threshold_limit":15,"failed_control_ids":["failed_control_ids"]}}},"controls_summary":{"status":"compliant","total_count":150,"compliant_count":130,"not_compliant_count":5,"unable_to_perform_count":5,"user_evaluation_required_count":10,"not_applicable_count":7,"not_compliant_controls":[{"id":"382c2b06-e6b2-43ee-b189-c1c7743b67ee","control_name":"ibm-cloud-rule","control_description":"Ensure security questions are registered by the account owner"}]},"evaluations_summary":{"status":"compliant","total_count":140,"pass_count":123,"failure_count":12,"error_count":5,"skipped_count":7,"completed_count":135},"tags":{"user":["user"],"access":["access"],"service":["service"]},"scopes":[{"id":"id","name":"name","href":"href"}],"additional_details":{"created_by":"Security and Compliance Center","labels":["labels"],"links":[{"description":"description","href":"href"}]}}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = ReportsPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + attachment_id='testString', + group_id='testString', + profile_id='testString', + type='scheduled', + limit=10, + sort='profile_name', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_reports_with_pager_get_all(self): + """ + test_list_reports_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports') + mock_response1 = '{"next":{"start":"1"},"reports":[{"id":"44a5-a292-32114fa73558","type":"scheduled","group_id":"55b6-b3A4-432250b84669","created_on":"2022-08-15T12:30:01Z","scan_time":"2022-08-15T12:30:01Z","cos_object":"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7","instance_id":"instance_id","account":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"NIST","type":"account_type"},"profile":{"id":"44a5-a292-32114fa73558","name":"IBM FS Cloud","version":"0.1"},"scope":{"id":"2411ffdc16844b07b42521c3443f456d","type":"account"},"attachment":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"resource group - Default","description":"Scoped to the Default resource group","schedule":"daily","scope":"anyValue","scopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}],"account_id":"account_id","instance_id":"instance_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z","attachment_count":16}],"notifications":{"enabled":false,"controls":{"threshold_limit":15,"failed_control_ids":["failed_control_ids"]}}},"controls_summary":{"status":"compliant","total_count":150,"compliant_count":130,"not_compliant_count":5,"unable_to_perform_count":5,"user_evaluation_required_count":10,"not_applicable_count":7,"not_compliant_controls":[{"id":"382c2b06-e6b2-43ee-b189-c1c7743b67ee","control_name":"ibm-cloud-rule","control_description":"Ensure security questions are registered by the account owner"}]},"evaluations_summary":{"status":"compliant","total_count":140,"pass_count":123,"failure_count":12,"error_count":5,"skipped_count":7,"completed_count":135},"tags":{"user":["user"],"access":["access"],"service":["service"]},"scopes":[{"id":"id","name":"name","href":"href"}],"additional_details":{"created_by":"Security and Compliance Center","labels":["labels"],"links":[{"description":"description","href":"href"}]}}],"total_count":2,"limit":1}' + mock_response2 = '{"reports":[{"id":"44a5-a292-32114fa73558","type":"scheduled","group_id":"55b6-b3A4-432250b84669","created_on":"2022-08-15T12:30:01Z","scan_time":"2022-08-15T12:30:01Z","cos_object":"crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7","instance_id":"instance_id","account":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"NIST","type":"account_type"},"profile":{"id":"44a5-a292-32114fa73558","name":"IBM FS Cloud","version":"0.1"},"scope":{"id":"2411ffdc16844b07b42521c3443f456d","type":"account"},"attachment":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"resource group - Default","description":"Scoped to the Default resource group","schedule":"daily","scope":"anyValue","scopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}],"account_id":"account_id","instance_id":"instance_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z","attachment_count":16}],"notifications":{"enabled":false,"controls":{"threshold_limit":15,"failed_control_ids":["failed_control_ids"]}}},"controls_summary":{"status":"compliant","total_count":150,"compliant_count":130,"not_compliant_count":5,"unable_to_perform_count":5,"user_evaluation_required_count":10,"not_applicable_count":7,"not_compliant_controls":[{"id":"382c2b06-e6b2-43ee-b189-c1c7743b67ee","control_name":"ibm-cloud-rule","control_description":"Ensure security questions are registered by the account owner"}]},"evaluations_summary":{"status":"compliant","total_count":140,"pass_count":123,"failure_count":12,"error_count":5,"skipped_count":7,"completed_count":135},"tags":{"user":["user"],"access":["access"],"service":["service"]},"scopes":[{"id":"id","name":"name","href":"href"}],"additional_details":{"created_by":"Security and Compliance Center","labels":["labels"],"links":[{"description":"description","href":"href"}]}}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = ReportsPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + attachment_id='testString', + group_id='testString', + profile_id='testString', + type='scheduled', + limit=10, + sort='profile_name', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestGetReport: + """ + Test Class for get_report + """ + + @responses.activate + def test_get_report_all_params(self): + """ + get_report() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString') + mock_response = '{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + report_id = 'testString' + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscope_id = 'testString' + + # Invoke method + response = _service.get_report( + report_id, + instance_id, + scope_id=scope_id, + subscope_id=subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'scope_id={}'.format(scope_id) in query_string + assert 'subscope_id={}'.format(subscope_id) in query_string + + def test_get_report_all_params_with_retries(self): + # Enable retries and run test_get_report_all_params. + _service.enable_retries() + self.test_get_report_all_params() + + # Disable retries and run test_get_report_all_params. + _service.disable_retries() + self.test_get_report_all_params() + + @responses.activate + def test_get_report_required_params(self): + """ + test_get_report_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString') + mock_response = '{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + report_id = 'testString' + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.get_report( + report_id, + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_report_required_params_with_retries(self): + # Enable retries and run test_get_report_required_params. + _service.enable_retries() + self.test_get_report_required_params() + + # Disable retries and run test_get_report_required_params. + _service.disable_retries() + self.test_get_report_required_params() + + @responses.activate + def test_get_report_value_error(self): + """ + test_get_report_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString') + mock_response = '{"id": "44a5-a292-32114fa73558", "type": "scheduled", "group_id": "55b6-b3A4-432250b84669", "created_on": "2022-08-15T12:30:01Z", "scan_time": "2022-08-15T12:30:01Z", "cos_object": "crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7", "instance_id": "instance_id", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "profile": {"id": "44a5-a292-32114fa73558", "name": "IBM FS Cloud", "version": "0.1"}, "scope": {"id": "2411ffdc16844b07b42521c3443f456d", "type": "account"}, "attachment": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "resource group - Default", "description": "Scoped to the Default resource group", "schedule": "daily", "scope": "anyValue", "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}], "notifications": {"enabled": false, "controls": {"threshold_limit": 15, "failed_control_ids": ["failed_control_ids"]}}}, "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "not_compliant_controls": [{"id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "control_name": "ibm-cloud-rule", "control_description": "Ensure security questions are registered by the account owner"}]}, "evaluations_summary": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "scopes": [{"id": "id", "name": "name", "href": "href"}], "additional_details": {"created_by": "Security and Compliance Center", "labels": ["labels"], "links": [{"description": "description", "href": "href"}]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + report_id = 'testString' + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "report_id": report_id, + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_report(**req_copy) + + def test_get_report_value_error_with_retries(self): + # Enable retries and run test_get_report_value_error. + _service.enable_retries() + self.test_get_report_value_error() + + # Disable retries and run test_get_report_value_error. + _service.disable_retries() + self.test_get_report_value_error() + + +class TestGetReportSummary: + """ + Test Class for get_report_summary + """ + + @responses.activate + def test_get_report_summary_all_params(self): + """ + get_report_summary() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/summary') + mock_response = '{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "isntance_id": "84644a08-31b6-4988-b504-49a46ca69ccd", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "score": {"passed": 1, "total_count": 4, "percent": 25}, "evaluations": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "controls": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}, "resources": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "top_failed": [{"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "my-bucket", "account": "59bcbfa6ea2f006b4ed7094c1a08dcdd", "service": "cloud-object-storage", "service_display_name": "cloud-object-storage", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Invoke method + response = _service.get_report_summary( + instance_id, + report_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_report_summary_all_params_with_retries(self): + # Enable retries and run test_get_report_summary_all_params. + _service.enable_retries() + self.test_get_report_summary_all_params() + + # Disable retries and run test_get_report_summary_all_params. + _service.disable_retries() + self.test_get_report_summary_all_params() + + @responses.activate + def test_get_report_summary_value_error(self): + """ + test_get_report_summary_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/summary') + mock_response = '{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "isntance_id": "84644a08-31b6-4988-b504-49a46ca69ccd", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "score": {"passed": 1, "total_count": 4, "percent": 25}, "evaluations": {"status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}, "controls": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}, "resources": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7, "top_failed": [{"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "my-bucket", "account": "59bcbfa6ea2f006b4ed7094c1a08dcdd", "service": "cloud-object-storage", "service_display_name": "cloud-object-storage", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135}]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_report_summary(**req_copy) + + def test_get_report_summary_value_error_with_retries(self): + # Enable retries and run test_get_report_summary_value_error. + _service.enable_retries() + self.test_get_report_summary_value_error() + + # Disable retries and run test_get_report_summary_value_error. + _service.disable_retries() + self.test_get_report_summary_value_error() + + +class TestGetReportDownloadFile: + """ + Test Class for get_report_download_file + """ + + @responses.activate + def test_get_report_download_file_all_params(self): + """ + get_report_download_file() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/download') + mock_response = 'This is a mock binary response.' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/csv', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + accept = 'application/csv' + exclude_summary = True + + # Invoke method + response = _service.get_report_download_file( + instance_id, + report_id, + accept=accept, + exclude_summary=exclude_summary, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'exclude_summary={}'.format('true' if exclude_summary else 'false') in query_string + + def test_get_report_download_file_all_params_with_retries(self): + # Enable retries and run test_get_report_download_file_all_params. + _service.enable_retries() + self.test_get_report_download_file_all_params() + + # Disable retries and run test_get_report_download_file_all_params. + _service.disable_retries() + self.test_get_report_download_file_all_params() + + @responses.activate + def test_get_report_download_file_required_params(self): + """ + test_get_report_download_file_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/download') + mock_response = 'This is a mock binary response.' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/csv', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Invoke method + response = _service.get_report_download_file( + instance_id, + report_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_report_download_file_required_params_with_retries(self): + # Enable retries and run test_get_report_download_file_required_params. + _service.enable_retries() + self.test_get_report_download_file_required_params() + + # Disable retries and run test_get_report_download_file_required_params. + _service.disable_retries() + self.test_get_report_download_file_required_params() + + @responses.activate + def test_get_report_download_file_value_error(self): + """ + test_get_report_download_file_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/download') + mock_response = 'This is a mock binary response.' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/csv', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_report_download_file(**req_copy) + + def test_get_report_download_file_value_error_with_retries(self): + # Enable retries and run test_get_report_download_file_value_error. + _service.enable_retries() + self.test_get_report_download_file_value_error() + + # Disable retries and run test_get_report_download_file_value_error. + _service.disable_retries() + self.test_get_report_download_file_value_error() + + +class TestGetReportControls: + """ + Test Class for get_report_controls + """ + + @responses.activate + def test_get_report_controls_all_params(self): + """ + get_report_controls() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/controls') + mock_response = '{"report_id": "report_id", "home_account_id": "home_account_id", "controls": [{"report_id": "6f1fdb98-c08b-41a8-a2f9-df10b51ff34a", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "531fc3e28bfc43c5a2cea07786d93f5c", "control_library_id": "531fc3e28bfc43c5a2cea07786d93f5c", "control_library_version": "v1.2.3", "control_name": "Password Management", "control_description": "Password Management", "control_category": "Access Control", "control_specifications": [{"control_specification_id": "18d32a4430e54c81a6668952609763b2", "control_specification_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "responsibility": "user", "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "completed_count": 135}], "status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}], "resource_tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + control_id = 'testString' + control_name = 'testString' + control_description = 'testString' + control_category = 'testString' + status = 'compliant' + sort = 'control_name' + scope_id = 'testString' + subscope_id = 'testString' + + # Invoke method + response = _service.get_report_controls( + instance_id, + report_id, + control_id=control_id, + control_name=control_name, + control_description=control_description, + control_category=control_category, + status=status, + sort=sort, + scope_id=scope_id, + subscope_id=subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'control_id={}'.format(control_id) in query_string + assert 'control_name={}'.format(control_name) in query_string + assert 'control_description={}'.format(control_description) in query_string + assert 'control_category={}'.format(control_category) in query_string + assert 'status={}'.format(status) in query_string + assert 'sort={}'.format(sort) in query_string + assert 'scope_id={}'.format(scope_id) in query_string + assert 'subscope_id={}'.format(subscope_id) in query_string + + def test_get_report_controls_all_params_with_retries(self): + # Enable retries and run test_get_report_controls_all_params. + _service.enable_retries() + self.test_get_report_controls_all_params() + + # Disable retries and run test_get_report_controls_all_params. + _service.disable_retries() + self.test_get_report_controls_all_params() + + @responses.activate + def test_get_report_controls_required_params(self): + """ + test_get_report_controls_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/controls') + mock_response = '{"report_id": "report_id", "home_account_id": "home_account_id", "controls": [{"report_id": "6f1fdb98-c08b-41a8-a2f9-df10b51ff34a", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "531fc3e28bfc43c5a2cea07786d93f5c", "control_library_id": "531fc3e28bfc43c5a2cea07786d93f5c", "control_library_version": "v1.2.3", "control_name": "Password Management", "control_description": "Password Management", "control_category": "Access Control", "control_specifications": [{"control_specification_id": "18d32a4430e54c81a6668952609763b2", "control_specification_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "responsibility": "user", "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "completed_count": 135}], "status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}], "resource_tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Invoke method + response = _service.get_report_controls( + instance_id, + report_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_report_controls_required_params_with_retries(self): + # Enable retries and run test_get_report_controls_required_params. + _service.enable_retries() + self.test_get_report_controls_required_params() + + # Disable retries and run test_get_report_controls_required_params. + _service.disable_retries() + self.test_get_report_controls_required_params() + + @responses.activate + def test_get_report_controls_value_error(self): + """ + test_get_report_controls_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/controls') + mock_response = '{"report_id": "report_id", "home_account_id": "home_account_id", "controls": [{"report_id": "6f1fdb98-c08b-41a8-a2f9-df10b51ff34a", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "531fc3e28bfc43c5a2cea07786d93f5c", "control_library_id": "531fc3e28bfc43c5a2cea07786d93f5c", "control_library_version": "v1.2.3", "control_name": "Password Management", "control_description": "Password Management", "control_category": "Access Control", "control_specifications": [{"control_specification_id": "18d32a4430e54c81a6668952609763b2", "control_specification_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "responsibility": "user", "assessments": [{"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}], "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "completed_count": 135}], "status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}], "resource_tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_report_controls(**req_copy) + + def test_get_report_controls_value_error_with_retries(self): + # Enable retries and run test_get_report_controls_value_error. + _service.enable_retries() + self.test_get_report_controls_value_error() + + # Disable retries and run test_get_report_controls_value_error. + _service.disable_retries() + self.test_get_report_controls_value_error() + + +class TestGetReportRule: + """ + Test Class for get_report_rule + """ + + @responses.activate + def test_get_report_rule_all_params(self): + """ + get_report_rule() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761') + mock_response = '{"id": "rule-7b0560a4-df94-4629-bb76-680f3155ddda", "type": "user_defined/system_defined", "description": "rule", "version": "1.2.3", "account_id": "59bcbfa6ea2f006b4ed7094c1a08dcdd", "created_on": "2022-08-15T12:30:01.000Z", "created_by": "IBMid-12345", "updated_on": "2022-08-15T12:30:01.000Z", "updated_by": "IBMid-12345", "labels": ["labels"]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + rule_id = 'rule-8d444f8c-fd1d-48de-bcaa-f43732568761' + + # Invoke method + response = _service.get_report_rule( + instance_id, + report_id, + rule_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_report_rule_all_params_with_retries(self): + # Enable retries and run test_get_report_rule_all_params. + _service.enable_retries() + self.test_get_report_rule_all_params() + + # Disable retries and run test_get_report_rule_all_params. + _service.disable_retries() + self.test_get_report_rule_all_params() + + @responses.activate + def test_get_report_rule_value_error(self): + """ + test_get_report_rule_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761') + mock_response = '{"id": "rule-7b0560a4-df94-4629-bb76-680f3155ddda", "type": "user_defined/system_defined", "description": "rule", "version": "1.2.3", "account_id": "59bcbfa6ea2f006b4ed7094c1a08dcdd", "created_on": "2022-08-15T12:30:01.000Z", "created_by": "IBMid-12345", "updated_on": "2022-08-15T12:30:01.000Z", "updated_by": "IBMid-12345", "labels": ["labels"]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + rule_id = 'rule-8d444f8c-fd1d-48de-bcaa-f43732568761' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + "rule_id": rule_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_report_rule(**req_copy) + + def test_get_report_rule_value_error_with_retries(self): + # Enable retries and run test_get_report_rule_value_error. + _service.enable_retries() + self.test_get_report_rule_value_error() + + # Disable retries and run test_get_report_rule_value_error. + _service.disable_retries() + self.test_get_report_rule_value_error() + + +class TestListReportEvaluations: + """ + Test Class for list_report_evaluations + """ + + @responses.activate + def test_list_report_evaluations_all_params(self): + """ + list_report_evaluations() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/evaluations') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "report_id": "report_id", "home_account_id": "home_account_id", "evaluations": [{"report_id": "report_id", "home_account_id": "be200c80cabc456e91139e4152327456", "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "assessment": {"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}, "evaluate_time": "2022-06-30T11:03:44.630150782Z", "target": {"id": "crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket", "account_id": "59bcbfa6ea2f006b4ed7094c1a08dcdd", "service_name": "cloud-object-storage", "service_display_name": "cloud-object-storage", "resource_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket", "resource_name": "mybucket", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}}, "status": "failure", "reason": "One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met", "details": {"properties": [{"property": "property", "property_description": "property_description", "operator": "string_equals", "expected_value": "anyValue", "found_value": "anyValue"}], "provider_info": {"provider_type": "provider_type"}}, "evaluated_by": "abc@ibm.com"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + assessment_id = 'testString' + assessment_method = 'testString' + component_id = 'testString' + target_id = 'testString' + target_env = 'testString' + target_name = 'testString' + status = 'failure' + start = 'testString' + limit = 50 + sort = 'profile_name' + scope_id = 'testString' + subscope_id = 'testString' + + # Invoke method + response = _service.list_report_evaluations( + instance_id, + report_id, + assessment_id=assessment_id, + assessment_method=assessment_method, + component_id=component_id, + target_id=target_id, + target_env=target_env, + target_name=target_name, + status=status, + start=start, + limit=limit, + sort=sort, + scope_id=scope_id, + subscope_id=subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'assessment_id={}'.format(assessment_id) in query_string + assert 'assessment_method={}'.format(assessment_method) in query_string + assert 'component_id={}'.format(component_id) in query_string + assert 'target_id={}'.format(target_id) in query_string + assert 'target_env={}'.format(target_env) in query_string + assert 'target_name={}'.format(target_name) in query_string + assert 'status={}'.format(status) in query_string + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'sort={}'.format(sort) in query_string + assert 'scope_id={}'.format(scope_id) in query_string + assert 'subscope_id={}'.format(subscope_id) in query_string + + def test_list_report_evaluations_all_params_with_retries(self): + # Enable retries and run test_list_report_evaluations_all_params. + _service.enable_retries() + self.test_list_report_evaluations_all_params() + + # Disable retries and run test_list_report_evaluations_all_params. + _service.disable_retries() + self.test_list_report_evaluations_all_params() + + @responses.activate + def test_list_report_evaluations_required_params(self): + """ + test_list_report_evaluations_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/evaluations') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "report_id": "report_id", "home_account_id": "home_account_id", "evaluations": [{"report_id": "report_id", "home_account_id": "be200c80cabc456e91139e4152327456", "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "assessment": {"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}, "evaluate_time": "2022-06-30T11:03:44.630150782Z", "target": {"id": "crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket", "account_id": "59bcbfa6ea2f006b4ed7094c1a08dcdd", "service_name": "cloud-object-storage", "service_display_name": "cloud-object-storage", "resource_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket", "resource_name": "mybucket", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}}, "status": "failure", "reason": "One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met", "details": {"properties": [{"property": "property", "property_description": "property_description", "operator": "string_equals", "expected_value": "anyValue", "found_value": "anyValue"}], "provider_info": {"provider_type": "provider_type"}}, "evaluated_by": "abc@ibm.com"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Invoke method + response = _service.list_report_evaluations( + instance_id, + report_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_report_evaluations_required_params_with_retries(self): + # Enable retries and run test_list_report_evaluations_required_params. + _service.enable_retries() + self.test_list_report_evaluations_required_params() + + # Disable retries and run test_list_report_evaluations_required_params. + _service.disable_retries() + self.test_list_report_evaluations_required_params() + + @responses.activate + def test_list_report_evaluations_value_error(self): + """ + test_list_report_evaluations_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/evaluations') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "report_id": "report_id", "home_account_id": "home_account_id", "evaluations": [{"report_id": "report_id", "home_account_id": "be200c80cabc456e91139e4152327456", "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "assessment": {"assessment_id": "382c2b06-e6b2-43ee-b189-c1c7743b67ee", "assessment_type": "ibm-cloud-rule", "assessment_method": "ibm-cloud-rule", "assessment_description": "Check whether Cloud Object Storage is accessible only by using private endpoints", "parameter_count": 1, "parameters": [{"assessment_type": "assessment_type", "assessment_id": "assessment_id", "parameter_name": "location", "parameter_display_name": "Location", "parameter_type": "string", "parameter_value": "anyValue"}]}, "evaluate_time": "2022-06-30T11:03:44.630150782Z", "target": {"id": "crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket", "account_id": "59bcbfa6ea2f006b4ed7094c1a08dcdd", "service_name": "cloud-object-storage", "service_display_name": "cloud-object-storage", "resource_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket", "resource_name": "mybucket", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}}, "status": "failure", "reason": "One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met", "details": {"properties": [{"property": "property", "property_description": "property_description", "operator": "string_equals", "expected_value": "anyValue", "found_value": "anyValue"}], "provider_info": {"provider_type": "provider_type"}}, "evaluated_by": "abc@ibm.com"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_report_evaluations(**req_copy) + + def test_list_report_evaluations_value_error_with_retries(self): + # Enable retries and run test_list_report_evaluations_value_error. + _service.enable_retries() + self.test_list_report_evaluations_value_error() + + # Disable retries and run test_list_report_evaluations_value_error. + _service.disable_retries() + self.test_list_report_evaluations_value_error() + + @responses.activate + def test_list_report_evaluations_with_pager_get_next(self): + """ + test_list_report_evaluations_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/evaluations') + mock_response1 = '{"next":{"start":"1"},"evaluations":[{"report_id":"report_id","home_account_id":"be200c80cabc456e91139e4152327456","component_id":"cloud-object_storage","component_name":"cloud-object_storage","assessment":{"assessment_id":"382c2b06-e6b2-43ee-b189-c1c7743b67ee","assessment_type":"ibm-cloud-rule","assessment_method":"ibm-cloud-rule","assessment_description":"Check whether Cloud Object Storage is accessible only by using private endpoints","parameter_count":1,"parameters":[{"assessment_type":"assessment_type","assessment_id":"assessment_id","parameter_name":"location","parameter_display_name":"Location","parameter_type":"string","parameter_value":"anyValue"}]},"evaluate_time":"2022-06-30T11:03:44.630150782Z","target":{"id":"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket","account_id":"59bcbfa6ea2f006b4ed7094c1a08dcdd","service_name":"cloud-object-storage","service_display_name":"cloud-object-storage","resource_crn":"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket","resource_name":"mybucket","tags":{"user":["user"],"access":["access"],"service":["service"]}},"status":"failure","reason":"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met","details":{"properties":[{"property":"property","property_description":"property_description","operator":"string_equals","expected_value":"anyValue","found_value":"anyValue"}],"provider_info":{"provider_type":"provider_type"}},"evaluated_by":"abc@ibm.com"}],"total_count":2,"limit":1}' + mock_response2 = '{"evaluations":[{"report_id":"report_id","home_account_id":"be200c80cabc456e91139e4152327456","component_id":"cloud-object_storage","component_name":"cloud-object_storage","assessment":{"assessment_id":"382c2b06-e6b2-43ee-b189-c1c7743b67ee","assessment_type":"ibm-cloud-rule","assessment_method":"ibm-cloud-rule","assessment_description":"Check whether Cloud Object Storage is accessible only by using private endpoints","parameter_count":1,"parameters":[{"assessment_type":"assessment_type","assessment_id":"assessment_id","parameter_name":"location","parameter_display_name":"Location","parameter_type":"string","parameter_value":"anyValue"}]},"evaluate_time":"2022-06-30T11:03:44.630150782Z","target":{"id":"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket","account_id":"59bcbfa6ea2f006b4ed7094c1a08dcdd","service_name":"cloud-object-storage","service_display_name":"cloud-object-storage","resource_crn":"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket","resource_name":"mybucket","tags":{"user":["user"],"access":["access"],"service":["service"]}},"status":"failure","reason":"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met","details":{"properties":[{"property":"property","property_description":"property_description","operator":"string_equals","expected_value":"anyValue","found_value":"anyValue"}],"provider_info":{"provider_type":"provider_type"}},"evaluated_by":"abc@ibm.com"}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = ReportEvaluationsPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id='testString', + assessment_id='testString', + assessment_method='testString', + component_id='testString', + target_id='testString', + target_env='testString', + target_name='testString', + status='failure', + limit=10, + sort='profile_name', + scope_id='testString', + subscope_id='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_report_evaluations_with_pager_get_all(self): + """ + test_list_report_evaluations_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/evaluations') + mock_response1 = '{"next":{"start":"1"},"evaluations":[{"report_id":"report_id","home_account_id":"be200c80cabc456e91139e4152327456","component_id":"cloud-object_storage","component_name":"cloud-object_storage","assessment":{"assessment_id":"382c2b06-e6b2-43ee-b189-c1c7743b67ee","assessment_type":"ibm-cloud-rule","assessment_method":"ibm-cloud-rule","assessment_description":"Check whether Cloud Object Storage is accessible only by using private endpoints","parameter_count":1,"parameters":[{"assessment_type":"assessment_type","assessment_id":"assessment_id","parameter_name":"location","parameter_display_name":"Location","parameter_type":"string","parameter_value":"anyValue"}]},"evaluate_time":"2022-06-30T11:03:44.630150782Z","target":{"id":"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket","account_id":"59bcbfa6ea2f006b4ed7094c1a08dcdd","service_name":"cloud-object-storage","service_display_name":"cloud-object-storage","resource_crn":"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket","resource_name":"mybucket","tags":{"user":["user"],"access":["access"],"service":["service"]}},"status":"failure","reason":"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met","details":{"properties":[{"property":"property","property_description":"property_description","operator":"string_equals","expected_value":"anyValue","found_value":"anyValue"}],"provider_info":{"provider_type":"provider_type"}},"evaluated_by":"abc@ibm.com"}],"total_count":2,"limit":1}' + mock_response2 = '{"evaluations":[{"report_id":"report_id","home_account_id":"be200c80cabc456e91139e4152327456","component_id":"cloud-object_storage","component_name":"cloud-object_storage","assessment":{"assessment_id":"382c2b06-e6b2-43ee-b189-c1c7743b67ee","assessment_type":"ibm-cloud-rule","assessment_method":"ibm-cloud-rule","assessment_description":"Check whether Cloud Object Storage is accessible only by using private endpoints","parameter_count":1,"parameters":[{"assessment_type":"assessment_type","assessment_id":"assessment_id","parameter_name":"location","parameter_display_name":"Location","parameter_type":"string","parameter_value":"anyValue"}]},"evaluate_time":"2022-06-30T11:03:44.630150782Z","target":{"id":"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket","account_id":"59bcbfa6ea2f006b4ed7094c1a08dcdd","service_name":"cloud-object-storage","service_display_name":"cloud-object-storage","resource_crn":"crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket","resource_name":"mybucket","tags":{"user":["user"],"access":["access"],"service":["service"]}},"status":"failure","reason":"One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met","details":{"properties":[{"property":"property","property_description":"property_description","operator":"string_equals","expected_value":"anyValue","found_value":"anyValue"}],"provider_info":{"provider_type":"provider_type"}},"evaluated_by":"abc@ibm.com"}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = ReportEvaluationsPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id='testString', + assessment_id='testString', + assessment_method='testString', + component_id='testString', + target_id='testString', + target_env='testString', + target_name='testString', + status='failure', + limit=10, + sort='profile_name', + scope_id='testString', + subscope_id='testString', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestListReportResources: + """ + Test Class for list_report_resources + """ + + @responses.activate + def test_list_report_resources_all_params(self): + """ + list_report_resources() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/resources') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "report_id": "report_id", "home_account_id": "home_account_id", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + id = 'testString' + resource_name = 'testString' + account_id = 'testString' + component_id = 'testString' + status = 'compliant' + sort = 'account_id' + start = 'testString' + limit = 50 + scope_id = 'testString' + subscope_id = 'testString' + + # Invoke method + response = _service.list_report_resources( + instance_id, + report_id, + id=id, + resource_name=resource_name, + account_id=account_id, + component_id=component_id, + status=status, + sort=sort, + start=start, + limit=limit, + scope_id=scope_id, + subscope_id=subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'id={}'.format(id) in query_string + assert 'resource_name={}'.format(resource_name) in query_string + assert 'account_id={}'.format(account_id) in query_string + assert 'component_id={}'.format(component_id) in query_string + assert 'status={}'.format(status) in query_string + assert 'sort={}'.format(sort) in query_string + assert 'start={}'.format(start) in query_string + assert 'limit={}'.format(limit) in query_string + assert 'scope_id={}'.format(scope_id) in query_string + assert 'subscope_id={}'.format(subscope_id) in query_string + + def test_list_report_resources_all_params_with_retries(self): + # Enable retries and run test_list_report_resources_all_params. + _service.enable_retries() + self.test_list_report_resources_all_params() + + # Disable retries and run test_list_report_resources_all_params. + _service.disable_retries() + self.test_list_report_resources_all_params() + + @responses.activate + def test_list_report_resources_required_params(self): + """ + test_list_report_resources_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/resources') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "report_id": "report_id", "home_account_id": "home_account_id", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Invoke method + response = _service.list_report_resources( + instance_id, + report_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_report_resources_required_params_with_retries(self): + # Enable retries and run test_list_report_resources_required_params. + _service.enable_retries() + self.test_list_report_resources_required_params() + + # Disable retries and run test_list_report_resources_required_params. + _service.disable_retries() + self.test_list_report_resources_required_params() + + @responses.activate + def test_list_report_resources_value_error(self): + """ + test_list_report_resources_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/resources') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "report_id": "report_id", "home_account_id": "home_account_id", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_report_resources(**req_copy) + + def test_list_report_resources_value_error_with_retries(self): + # Enable retries and run test_list_report_resources_value_error. + _service.enable_retries() + self.test_list_report_resources_value_error() + + # Disable retries and run test_list_report_resources_value_error. + _service.disable_retries() + self.test_list_report_resources_value_error() + + @responses.activate + def test_list_report_resources_with_pager_get_next(self): + """ + test_list_report_resources_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/resources') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"resources":[{"report_id":"30b434b3-cb08-4845-af10-7a8fc682b6a8","home_account_id":"2411ffdc16844b07b42521c3443f456d","id":"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::","resource_name":"jeff\'s key","account":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"NIST","type":"account_type"},"component_id":"cloud-object_storage","component_name":"cloud-object_storage","environment":"ibm cloud","tags":{"user":["user"],"access":["access"],"service":["service"]},"status":"compliant","total_count":140,"pass_count":123,"failure_count":12,"error_count":5,"skipped_count":7,"completed_count":135,"service_name":"pm-20","instance_crn":"instance_crn"}]}' + mock_response2 = '{"total_count":2,"limit":1,"resources":[{"report_id":"30b434b3-cb08-4845-af10-7a8fc682b6a8","home_account_id":"2411ffdc16844b07b42521c3443f456d","id":"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::","resource_name":"jeff\'s key","account":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"NIST","type":"account_type"},"component_id":"cloud-object_storage","component_name":"cloud-object_storage","environment":"ibm cloud","tags":{"user":["user"],"access":["access"],"service":["service"]},"status":"compliant","total_count":140,"pass_count":123,"failure_count":12,"error_count":5,"skipped_count":7,"completed_count":135,"service_name":"pm-20","instance_crn":"instance_crn"}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = ReportResourcesPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id='testString', + id='testString', + resource_name='testString', + account_id='testString', + component_id='testString', + status='compliant', + sort='account_id', + limit=10, + scope_id='testString', + subscope_id='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_report_resources_with_pager_get_all(self): + """ + test_list_report_resources_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/resources') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"resources":[{"report_id":"30b434b3-cb08-4845-af10-7a8fc682b6a8","home_account_id":"2411ffdc16844b07b42521c3443f456d","id":"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::","resource_name":"jeff\'s key","account":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"NIST","type":"account_type"},"component_id":"cloud-object_storage","component_name":"cloud-object_storage","environment":"ibm cloud","tags":{"user":["user"],"access":["access"],"service":["service"]},"status":"compliant","total_count":140,"pass_count":123,"failure_count":12,"error_count":5,"skipped_count":7,"completed_count":135,"service_name":"pm-20","instance_crn":"instance_crn"}]}' + mock_response2 = '{"total_count":2,"limit":1,"resources":[{"report_id":"30b434b3-cb08-4845-af10-7a8fc682b6a8","home_account_id":"2411ffdc16844b07b42521c3443f456d","id":"crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::","resource_name":"jeff\'s key","account":{"id":"531fc3e28bfc43c5a2cea07786d93f5c","name":"NIST","type":"account_type"},"component_id":"cloud-object_storage","component_name":"cloud-object_storage","environment":"ibm cloud","tags":{"user":["user"],"access":["access"],"service":["service"]},"status":"compliant","total_count":140,"pass_count":123,"failure_count":12,"error_count":5,"skipped_count":7,"completed_count":135,"service_name":"pm-20","instance_crn":"instance_crn"}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = ReportResourcesPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + report_id='testString', + id='testString', + resource_name='testString', + account_id='testString', + component_id='testString', + status='compliant', + sort='account_id', + limit=10, + scope_id='testString', + subscope_id='testString', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestGetReportTags: + """ + Test Class for get_report_tags + """ + + @responses.activate + def test_get_report_tags_all_params(self): + """ + get_report_tags() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/tags') + mock_response = '{"report_id": "report_id", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Invoke method + response = _service.get_report_tags( + instance_id, + report_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_report_tags_all_params_with_retries(self): + # Enable retries and run test_get_report_tags_all_params. + _service.enable_retries() + self.test_get_report_tags_all_params() + + # Disable retries and run test_get_report_tags_all_params. + _service.disable_retries() + self.test_get_report_tags_all_params() + + @responses.activate + def test_get_report_tags_value_error(self): + """ + test_get_report_tags_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/tags') + mock_response = '{"report_id": "report_id", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_report_tags(**req_copy) + + def test_get_report_tags_value_error_with_retries(self): + # Enable retries and run test_get_report_tags_value_error. + _service.enable_retries() + self.test_get_report_tags_value_error() + + # Disable retries and run test_get_report_tags_value_error. + _service.disable_retries() + self.test_get_report_tags_value_error() + + +class TestGetReportViolationsDrift: + """ + Test Class for get_report_violations_drift + """ + + @responses.activate + def test_get_report_violations_drift_all_params(self): + """ + get_report_violations_drift() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/violations_drift') + mock_response = '{"home_account_id": "home_account_id", "report_group_id": "report_group_id", "data_points": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "report_group_id": "55b6-b3A4-432250b84669", "scan_time": "2022-08-15T12:30:01Z", "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + scan_time_duration = 0 + scope_id = 'testString' + subscope_id = 'testString' + + # Invoke method + response = _service.get_report_violations_drift( + instance_id, + report_id, + scan_time_duration=scan_time_duration, + scope_id=scope_id, + subscope_id=subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'scan_time_duration={}'.format(scan_time_duration) in query_string + assert 'scope_id={}'.format(scope_id) in query_string + assert 'subscope_id={}'.format(subscope_id) in query_string + + def test_get_report_violations_drift_all_params_with_retries(self): + # Enable retries and run test_get_report_violations_drift_all_params. + _service.enable_retries() + self.test_get_report_violations_drift_all_params() + + # Disable retries and run test_get_report_violations_drift_all_params. + _service.disable_retries() + self.test_get_report_violations_drift_all_params() + + @responses.activate + def test_get_report_violations_drift_required_params(self): + """ + test_get_report_violations_drift_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/violations_drift') + mock_response = '{"home_account_id": "home_account_id", "report_group_id": "report_group_id", "data_points": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "report_group_id": "55b6-b3A4-432250b84669", "scan_time": "2022-08-15T12:30:01Z", "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Invoke method + response = _service.get_report_violations_drift( + instance_id, + report_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_report_violations_drift_required_params_with_retries(self): + # Enable retries and run test_get_report_violations_drift_required_params. + _service.enable_retries() + self.test_get_report_violations_drift_required_params() + + # Disable retries and run test_get_report_violations_drift_required_params. + _service.disable_retries() + self.test_get_report_violations_drift_required_params() + + @responses.activate + def test_get_report_violations_drift_value_error(self): + """ + test_get_report_violations_drift_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/violations_drift') + mock_response = '{"home_account_id": "home_account_id", "report_group_id": "report_group_id", "data_points": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "report_group_id": "55b6-b3A4-432250b84669", "scan_time": "2022-08-15T12:30:01Z", "controls_summary": {"status": "compliant", "total_count": 150, "compliant_count": 130, "not_compliant_count": 5, "unable_to_perform_count": 5, "user_evaluation_required_count": 10, "not_applicable_count": 7}}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_report_violations_drift(**req_copy) + + def test_get_report_violations_drift_value_error_with_retries(self): + # Enable retries and run test_get_report_violations_drift_value_error. + _service.enable_retries() + self.test_get_report_violations_drift_value_error() + + # Disable retries and run test_get_report_violations_drift_value_error. + _service.disable_retries() + self.test_get_report_violations_drift_value_error() + + +class TestListScanReports: + """ + Test Class for list_scan_reports + """ + + @responses.activate + def test_list_scan_reports_all_params(self): + """ + list_scan_reports() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "scope_id": "44a5-a292-32114fa73558", "subscope_id": "44a5-a292-32114fa73555", "scan_reports": [{"id": "e44316e3-53bc-449b-a808-c16df680d462", "scan_id": "44a5-a292-32114fa73553", "instance_id": "instance_id", "scope_id": "44a5-a292-32114fa73558", "subscope_id": "44a5-a292-32114fa73555", "status": "completed", "created_on": "2024-05-08T12:30:01.000Z", "format": "pdf", "href": "href"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + scope_id = 'testString' + subscope_id = 'testString' + + # Invoke method + response = _service.list_scan_reports( + instance_id, + report_id, + scope_id=scope_id, + subscope_id=subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'scope_id={}'.format(scope_id) in query_string + assert 'subscope_id={}'.format(subscope_id) in query_string + + def test_list_scan_reports_all_params_with_retries(self): + # Enable retries and run test_list_scan_reports_all_params. + _service.enable_retries() + self.test_list_scan_reports_all_params() + + # Disable retries and run test_list_scan_reports_all_params. + _service.disable_retries() + self.test_list_scan_reports_all_params() + + @responses.activate + def test_list_scan_reports_required_params(self): + """ + test_list_scan_reports_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "scope_id": "44a5-a292-32114fa73558", "subscope_id": "44a5-a292-32114fa73555", "scan_reports": [{"id": "e44316e3-53bc-449b-a808-c16df680d462", "scan_id": "44a5-a292-32114fa73553", "instance_id": "instance_id", "scope_id": "44a5-a292-32114fa73558", "subscope_id": "44a5-a292-32114fa73555", "status": "completed", "created_on": "2024-05-08T12:30:01.000Z", "format": "pdf", "href": "href"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Invoke method + response = _service.list_scan_reports( + instance_id, + report_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_scan_reports_required_params_with_retries(self): + # Enable retries and run test_list_scan_reports_required_params. + _service.enable_retries() + self.test_list_scan_reports_required_params() + + # Disable retries and run test_list_scan_reports_required_params. + _service.disable_retries() + self.test_list_scan_reports_required_params() + + @responses.activate + def test_list_scan_reports_value_error(self): + """ + test_list_scan_reports_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "scope_id": "44a5-a292-32114fa73558", "subscope_id": "44a5-a292-32114fa73555", "scan_reports": [{"id": "e44316e3-53bc-449b-a808-c16df680d462", "scan_id": "44a5-a292-32114fa73553", "instance_id": "instance_id", "scope_id": "44a5-a292-32114fa73558", "subscope_id": "44a5-a292-32114fa73555", "status": "completed", "created_on": "2024-05-08T12:30:01.000Z", "format": "pdf", "href": "href"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_scan_reports(**req_copy) + + def test_list_scan_reports_value_error_with_retries(self): + # Enable retries and run test_list_scan_reports_value_error. + _service.enable_retries() + self.test_list_scan_reports_value_error() + + # Disable retries and run test_list_scan_reports_value_error. + _service.disable_retries() + self.test_list_scan_reports_value_error() + + +class TestCreateScanReport: + """ + Test Class for create_scan_report + """ + + @responses.activate + def test_create_scan_report_all_params(self): + """ + create_scan_report() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports') + mock_response = '{"id": "id"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=202, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + format = 'csv' + scope_id = '132009ff-b982-412e-a110-ad8797e10f84' + subscope_id = 'c7ddcbcc-6a43-4ab3-b6a7-b2d8f65cd54a' + + # Invoke method + response = _service.create_scan_report( + instance_id, + report_id, + format, + scope_id=scope_id, + subscope_id=subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 202 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['format'] == 'csv' + assert req_body['scope_id'] == '132009ff-b982-412e-a110-ad8797e10f84' + assert req_body['subscope_id'] == 'c7ddcbcc-6a43-4ab3-b6a7-b2d8f65cd54a' + + def test_create_scan_report_all_params_with_retries(self): + # Enable retries and run test_create_scan_report_all_params. + _service.enable_retries() + self.test_create_scan_report_all_params() + + # Disable retries and run test_create_scan_report_all_params. + _service.disable_retries() + self.test_create_scan_report_all_params() + + @responses.activate + def test_create_scan_report_value_error(self): + """ + test_create_scan_report_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports') + mock_response = '{"id": "id"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=202, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + format = 'csv' + scope_id = '132009ff-b982-412e-a110-ad8797e10f84' + subscope_id = 'c7ddcbcc-6a43-4ab3-b6a7-b2d8f65cd54a' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + "format": format, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_scan_report(**req_copy) + + def test_create_scan_report_value_error_with_retries(self): + # Enable retries and run test_create_scan_report_value_error. + _service.enable_retries() + self.test_create_scan_report_value_error() + + # Disable retries and run test_create_scan_report_value_error. + _service.disable_retries() + self.test_create_scan_report_value_error() + + +class TestGetScanReport: + """ + Test Class for get_scan_report + """ + + @responses.activate + def test_get_scan_report_all_params(self): + """ + get_scan_report() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports/testString') + mock_response = '{"id": "e44316e3-53bc-449b-a808-c16df680d462", "scan_id": "44a5-a292-32114fa73553", "instance_id": "instance_id", "scope_id": "44a5-a292-32114fa73558", "subscope_id": "44a5-a292-32114fa73555", "status": "completed", "created_on": "2024-05-08T12:30:01.000Z", "format": "pdf", "href": "href"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + job_id = 'testString' + + # Invoke method + response = _service.get_scan_report( + instance_id, + report_id, + job_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_scan_report_all_params_with_retries(self): + # Enable retries and run test_get_scan_report_all_params. + _service.enable_retries() + self.test_get_scan_report_all_params() + + # Disable retries and run test_get_scan_report_all_params. + _service.disable_retries() + self.test_get_scan_report_all_params() + + @responses.activate + def test_get_scan_report_value_error(self): + """ + test_get_scan_report_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports/testString') + mock_response = '{"id": "e44316e3-53bc-449b-a808-c16df680d462", "scan_id": "44a5-a292-32114fa73553", "instance_id": "instance_id", "scope_id": "44a5-a292-32114fa73558", "subscope_id": "44a5-a292-32114fa73555", "status": "completed", "created_on": "2024-05-08T12:30:01.000Z", "format": "pdf", "href": "href"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + job_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + "job_id": job_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_scan_report(**req_copy) + + def test_get_scan_report_value_error_with_retries(self): + # Enable retries and run test_get_scan_report_value_error. + _service.enable_retries() + self.test_get_scan_report_value_error() + + # Disable retries and run test_get_scan_report_value_error. + _service.disable_retries() + self.test_get_scan_report_value_error() + + +class TestGetScanReportDownloadFile: + """ + Test Class for get_scan_report_download_file + """ + + @responses.activate + def test_get_scan_report_download_file_all_params(self): + """ + get_scan_report_download_file() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports/testString/download') + mock_response = 'This is a mock binary response.' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/csv', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + job_id = 'testString' + accept = 'application/csv' + + # Invoke method + response = _service.get_scan_report_download_file( + instance_id, + report_id, + job_id, + accept=accept, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_scan_report_download_file_all_params_with_retries(self): + # Enable retries and run test_get_scan_report_download_file_all_params. + _service.enable_retries() + self.test_get_scan_report_download_file_all_params() + + # Disable retries and run test_get_scan_report_download_file_all_params. + _service.disable_retries() + self.test_get_scan_report_download_file_all_params() + + @responses.activate + def test_get_scan_report_download_file_required_params(self): + """ + test_get_scan_report_download_file_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports/testString/download') + mock_response = 'This is a mock binary response.' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/csv', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + job_id = 'testString' + + # Invoke method + response = _service.get_scan_report_download_file( + instance_id, + report_id, + job_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_scan_report_download_file_required_params_with_retries(self): + # Enable retries and run test_get_scan_report_download_file_required_params. + _service.enable_retries() + self.test_get_scan_report_download_file_required_params() + + # Disable retries and run test_get_scan_report_download_file_required_params. + _service.disable_retries() + self.test_get_scan_report_download_file_required_params() + + @responses.activate + def test_get_scan_report_download_file_value_error(self): + """ + test_get_scan_report_download_file_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/reports/testString/scan_reports/testString/download') + mock_response = 'This is a mock binary response.' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/csv', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + report_id = 'testString' + job_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "report_id": report_id, + "job_id": job_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_scan_report_download_file(**req_copy) + + def test_get_scan_report_download_file_value_error_with_retries(self): + # Enable retries and run test_get_scan_report_download_file_value_error. + _service.enable_retries() + self.test_get_scan_report_download_file_value_error() + + # Disable retries and run test_get_scan_report_download_file_value_error. + _service.disable_retries() + self.test_get_scan_report_download_file_value_error() + + +# endregion +############################################################################## +# End of Service: Report +############################################################################## + +############################################################################## +# Start of Service: Rule +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestListRules: + """ + Test Class for list_rules + """ + + @responses.activate + def test_list_rules_all_params(self): + """ + list_rules() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "rules": [{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + limit = 50 + start = 'testString' + type = 'system_defined' + search = 'testString' + service_name = 'testString' + sort = 'updated_on' + + # Invoke method + response = _service.list_rules( + instance_id, + limit=limit, + start=start, + type=type, + search=search, + service_name=service_name, + sort=sort, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'limit={}'.format(limit) in query_string + assert 'start={}'.format(start) in query_string + assert 'type={}'.format(type) in query_string + assert 'search={}'.format(search) in query_string + assert 'service_name={}'.format(service_name) in query_string + assert 'sort={}'.format(sort) in query_string + + def test_list_rules_all_params_with_retries(self): + # Enable retries and run test_list_rules_all_params. + _service.enable_retries() + self.test_list_rules_all_params() + + # Disable retries and run test_list_rules_all_params. + _service.disable_retries() + self.test_list_rules_all_params() + + @responses.activate + def test_list_rules_required_params(self): + """ + test_list_rules_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "rules": [{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.list_rules( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_rules_required_params_with_retries(self): + # Enable retries and run test_list_rules_required_params. + _service.enable_retries() + self.test_list_rules_required_params() + + # Disable retries and run test_list_rules_required_params. + _service.disable_retries() + self.test_list_rules_required_params() + + @responses.activate + def test_list_rules_value_error(self): + """ + test_list_rules_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "rules": [{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_rules(**req_copy) + + def test_list_rules_value_error_with_retries(self): + # Enable retries and run test_list_rules_value_error. + _service.enable_retries() + self.test_list_rules_value_error() + + # Disable retries and run test_list_rules_value_error. + _service.disable_retries() + self.test_list_rules_value_error() + + @responses.activate + def test_list_rules_with_pager_get_next(self): + """ + test_list_rules_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"rules":[{"created_on":"2019-01-01T12:00:00.000Z","created_by":"created_by","updated_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","id":"id","account_id":"account_id","description":"description","type":"user_defined","version":"version","import":{"parameters":[{"name":"name","display_name":"display_name","description":"description","type":"string"}]},"target":{"service_name":"service_name","service_display_name":"service_display_name","resource_kind":"resource_kind","additional_target_attributes":[{"name":"name","operator":"string_equals","value":"anyValue"}],"ref":"ref"},"required_config":{"description":"description","property":"property","operator":"string_equals","value":"anyValue"},"labels":["labels"]}]}' + mock_response2 = '{"total_count":2,"limit":1,"rules":[{"created_on":"2019-01-01T12:00:00.000Z","created_by":"created_by","updated_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","id":"id","account_id":"account_id","description":"description","type":"user_defined","version":"version","import":{"parameters":[{"name":"name","display_name":"display_name","description":"description","type":"string"}]},"target":{"service_name":"service_name","service_display_name":"service_display_name","resource_kind":"resource_kind","additional_target_attributes":[{"name":"name","operator":"string_equals","value":"anyValue"}],"ref":"ref"},"required_config":{"description":"description","property":"property","operator":"string_equals","value":"anyValue"},"labels":["labels"]}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = RulesPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=10, + type='system_defined', + search='testString', + service_name='testString', + sort='updated_on', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_rules_with_pager_get_all(self): + """ + test_list_rules_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"rules":[{"created_on":"2019-01-01T12:00:00.000Z","created_by":"created_by","updated_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","id":"id","account_id":"account_id","description":"description","type":"user_defined","version":"version","import":{"parameters":[{"name":"name","display_name":"display_name","description":"description","type":"string"}]},"target":{"service_name":"service_name","service_display_name":"service_display_name","resource_kind":"resource_kind","additional_target_attributes":[{"name":"name","operator":"string_equals","value":"anyValue"}],"ref":"ref"},"required_config":{"description":"description","property":"property","operator":"string_equals","value":"anyValue"},"labels":["labels"]}]}' + mock_response2 = '{"total_count":2,"limit":1,"rules":[{"created_on":"2019-01-01T12:00:00.000Z","created_by":"created_by","updated_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","id":"id","account_id":"account_id","description":"description","type":"user_defined","version":"version","import":{"parameters":[{"name":"name","display_name":"display_name","description":"description","type":"string"}]},"target":{"service_name":"service_name","service_display_name":"service_display_name","resource_kind":"resource_kind","additional_target_attributes":[{"name":"name","operator":"string_equals","value":"anyValue"}],"ref":"ref"},"required_config":{"description":"description","property":"property","operator":"string_equals","value":"anyValue"},"labels":["labels"]}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = RulesPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=10, + type='system_defined', + search='testString', + service_name='testString', + sort='updated_on', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestCreateRule: + """ + Test Class for create_rule + """ + + @responses.activate + def test_create_rule_all_params(self): + """ + create_rule() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules') + mock_response = '{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a AdditionalTargetAttribute model + additional_target_attribute_model = {} + additional_target_attribute_model['name'] = 'location' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'us-east' + + # Construct a dict representation of a RuleTargetPrototype model + rule_target_prototype_model = {} + rule_target_prototype_model['service_name'] = 'cloud-object-storage' + rule_target_prototype_model['resource_kind'] = 'bucket' + rule_target_prototype_model['additional_target_attributes'] = [additional_target_attribute_model] + + # Construct a dict representation of a RequiredConfigConditionBase model + required_config_model = {} + required_config_model['description'] = 'The Cloud Object Storage rule.' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + # Construct a dict representation of a RuleParameter model + rule_parameter_model = {} + rule_parameter_model['name'] = 'hard_quota' + rule_parameter_model['display_name'] = 'The Cloud Object Storage bucket quota.' + rule_parameter_model['description'] = 'The maximum bytes that are allocated to the Cloud Object Storage bucket.' + rule_parameter_model['type'] = 'numeric' + + # Construct a dict representation of a Import model + import_model = {} + import_model['parameters'] = [rule_parameter_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + description = 'Example rule' + target = rule_target_prototype_model + required_config = required_config_model + version = '1.0.0' + import_ = import_model + labels = [] + + # Invoke method + response = _service.create_rule( + instance_id, + description, + target, + required_config, + version=version, + import_=import_, + labels=labels, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['description'] == 'Example rule' + assert req_body['target'] == rule_target_prototype_model + assert req_body['required_config'] == required_config_model + assert req_body['version'] == '1.0.0' + assert req_body['import'] == import_model + assert req_body['labels'] == [] + + def test_create_rule_all_params_with_retries(self): + # Enable retries and run test_create_rule_all_params. + _service.enable_retries() + self.test_create_rule_all_params() + + # Disable retries and run test_create_rule_all_params. + _service.disable_retries() + self.test_create_rule_all_params() + + @responses.activate + def test_create_rule_value_error(self): + """ + test_create_rule_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules') + mock_response = '{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a AdditionalTargetAttribute model + additional_target_attribute_model = {} + additional_target_attribute_model['name'] = 'location' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'us-east' + + # Construct a dict representation of a RuleTargetPrototype model + rule_target_prototype_model = {} + rule_target_prototype_model['service_name'] = 'cloud-object-storage' + rule_target_prototype_model['resource_kind'] = 'bucket' + rule_target_prototype_model['additional_target_attributes'] = [additional_target_attribute_model] + + # Construct a dict representation of a RequiredConfigConditionBase model + required_config_model = {} + required_config_model['description'] = 'The Cloud Object Storage rule.' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + # Construct a dict representation of a RuleParameter model + rule_parameter_model = {} + rule_parameter_model['name'] = 'hard_quota' + rule_parameter_model['display_name'] = 'The Cloud Object Storage bucket quota.' + rule_parameter_model['description'] = 'The maximum bytes that are allocated to the Cloud Object Storage bucket.' + rule_parameter_model['type'] = 'numeric' + + # Construct a dict representation of a Import model + import_model = {} + import_model['parameters'] = [rule_parameter_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + description = 'Example rule' + target = rule_target_prototype_model + required_config = required_config_model + version = '1.0.0' + import_ = import_model + labels = [] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "description": description, + "target": target, + "required_config": required_config, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_rule(**req_copy) + + def test_create_rule_value_error_with_retries(self): + # Enable retries and run test_create_rule_value_error. + _service.enable_retries() + self.test_create_rule_value_error() + + # Disable retries and run test_create_rule_value_error. + _service.disable_retries() + self.test_create_rule_value_error() + + +class TestGetRule: + """ + Test Class for get_rule + """ + + @responses.activate + def test_get_rule_all_params(self): + """ + get_rule() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761') + mock_response = '{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + rule_id = 'rule-8d444f8c-fd1d-48de-bcaa-f43732568761' + + # Invoke method + response = _service.get_rule( + instance_id, + rule_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_rule_all_params_with_retries(self): + # Enable retries and run test_get_rule_all_params. + _service.enable_retries() + self.test_get_rule_all_params() + + # Disable retries and run test_get_rule_all_params. + _service.disable_retries() + self.test_get_rule_all_params() + + @responses.activate + def test_get_rule_value_error(self): + """ + test_get_rule_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761') + mock_response = '{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + rule_id = 'rule-8d444f8c-fd1d-48de-bcaa-f43732568761' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "rule_id": rule_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_rule(**req_copy) + + def test_get_rule_value_error_with_retries(self): + # Enable retries and run test_get_rule_value_error. + _service.enable_retries() + self.test_get_rule_value_error() + + # Disable retries and run test_get_rule_value_error. + _service.disable_retries() + self.test_get_rule_value_error() + + +class TestReplaceRule: + """ + Test Class for replace_rule + """ + + @responses.activate + def test_replace_rule_all_params(self): + """ + replace_rule() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761') + mock_response = '{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a AdditionalTargetAttribute model + additional_target_attribute_model = {} + additional_target_attribute_model['name'] = 'location' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'us-south' + + # Construct a dict representation of a RuleTargetPrototype model + rule_target_prototype_model = {} + rule_target_prototype_model['service_name'] = 'cloud-object-storage' + rule_target_prototype_model['resource_kind'] = 'bucket' + rule_target_prototype_model['additional_target_attributes'] = [additional_target_attribute_model] + + # Construct a dict representation of a RequiredConfigConditionBase model + required_config_model = {} + required_config_model['description'] = 'The Cloud Object Storage rule.' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + # Construct a dict representation of a RuleParameter model + rule_parameter_model = {} + rule_parameter_model['name'] = 'hard_quota' + rule_parameter_model['display_name'] = 'The Cloud Object Storage bucket quota.' + rule_parameter_model['description'] = 'The maximum bytes that are allocated to the Cloud Object Storage bucket.' + rule_parameter_model['type'] = 'numeric' + + # Construct a dict representation of a Import model + import_model = {} + import_model['parameters'] = [rule_parameter_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + rule_id = 'rule-8d444f8c-fd1d-48de-bcaa-f43732568761' + if_match = 'testString' + description = 'Example rule' + target = rule_target_prototype_model + required_config = required_config_model + version = '1.0.1' + import_ = import_model + labels = [] + + # Invoke method + response = _service.replace_rule( + instance_id, + rule_id, + if_match, + description, + target, + required_config, + version=version, + import_=import_, + labels=labels, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['description'] == 'Example rule' + assert req_body['target'] == rule_target_prototype_model + assert req_body['required_config'] == required_config_model + assert req_body['version'] == '1.0.1' + assert req_body['import'] == import_model + assert req_body['labels'] == [] + + def test_replace_rule_all_params_with_retries(self): + # Enable retries and run test_replace_rule_all_params. + _service.enable_retries() + self.test_replace_rule_all_params() + + # Disable retries and run test_replace_rule_all_params. + _service.disable_retries() + self.test_replace_rule_all_params() + + @responses.activate + def test_replace_rule_value_error(self): + """ + test_replace_rule_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761') + mock_response = '{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "id": "id", "account_id": "account_id", "description": "description", "type": "user_defined", "version": "version", "import": {"parameters": [{"name": "name", "display_name": "display_name", "description": "description", "type": "string"}]}, "target": {"service_name": "service_name", "service_display_name": "service_display_name", "resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "ref": "ref"}, "required_config": {"description": "description", "property": "property", "operator": "string_equals", "value": "anyValue"}, "labels": ["labels"]}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a AdditionalTargetAttribute model + additional_target_attribute_model = {} + additional_target_attribute_model['name'] = 'location' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'us-south' + + # Construct a dict representation of a RuleTargetPrototype model + rule_target_prototype_model = {} + rule_target_prototype_model['service_name'] = 'cloud-object-storage' + rule_target_prototype_model['resource_kind'] = 'bucket' + rule_target_prototype_model['additional_target_attributes'] = [additional_target_attribute_model] + + # Construct a dict representation of a RequiredConfigConditionBase model + required_config_model = {} + required_config_model['description'] = 'The Cloud Object Storage rule.' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + # Construct a dict representation of a RuleParameter model + rule_parameter_model = {} + rule_parameter_model['name'] = 'hard_quota' + rule_parameter_model['display_name'] = 'The Cloud Object Storage bucket quota.' + rule_parameter_model['description'] = 'The maximum bytes that are allocated to the Cloud Object Storage bucket.' + rule_parameter_model['type'] = 'numeric' + + # Construct a dict representation of a Import model + import_model = {} + import_model['parameters'] = [rule_parameter_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + rule_id = 'rule-8d444f8c-fd1d-48de-bcaa-f43732568761' + if_match = 'testString' + description = 'Example rule' + target = rule_target_prototype_model + required_config = required_config_model + version = '1.0.1' + import_ = import_model + labels = [] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "rule_id": rule_id, + "if_match": if_match, + "description": description, + "target": target, + "required_config": required_config, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.replace_rule(**req_copy) + + def test_replace_rule_value_error_with_retries(self): + # Enable retries and run test_replace_rule_value_error. + _service.enable_retries() + self.test_replace_rule_value_error() + + # Disable retries and run test_replace_rule_value_error. + _service.disable_retries() + self.test_replace_rule_value_error() + + +class TestDeleteRule: + """ + Test Class for delete_rule + """ + + @responses.activate + def test_delete_rule_all_params(self): + """ + delete_rule() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + rule_id = 'rule-8d444f8c-fd1d-48de-bcaa-f43732568761' + + # Invoke method + response = _service.delete_rule( + instance_id, + rule_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_rule_all_params_with_retries(self): + # Enable retries and run test_delete_rule_all_params. + _service.enable_retries() + self.test_delete_rule_all_params() + + # Disable retries and run test_delete_rule_all_params. + _service.disable_retries() + self.test_delete_rule_all_params() + + @responses.activate + def test_delete_rule_value_error(self): + """ + test_delete_rule_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/rules/rule-8d444f8c-fd1d-48de-bcaa-f43732568761') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + rule_id = 'rule-8d444f8c-fd1d-48de-bcaa-f43732568761' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "rule_id": rule_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_rule(**req_copy) + + def test_delete_rule_value_error_with_retries(self): + # Enable retries and run test_delete_rule_value_error. + _service.enable_retries() + self.test_delete_rule_value_error() + + # Disable retries and run test_delete_rule_value_error. + _service.disable_retries() + self.test_delete_rule_value_error() + + +# endregion +############################################################################## +# End of Service: Rule +############################################################################## + +############################################################################## +# Start of Service: Scope +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestCreateScope: + """ + Test Class for create_scope + """ + + @responses.activate + def test_create_scope_all_params(self): + """ + create_scope() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_id' + scope_property_model['value'] = '1234567' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + name = 'ibm scope' + description = 'The scope that is defined for IBM resources.' + environment = 'ibm-cloud' + properties = [scope_property_model] + + # Invoke method + response = _service.create_scope( + instance_id, + name=name, + description=description, + environment=environment, + properties=properties, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['name'] == 'ibm scope' + assert req_body['description'] == 'The scope that is defined for IBM resources.' + assert req_body['environment'] == 'ibm-cloud' + assert req_body['properties'] == [scope_property_model] + + def test_create_scope_all_params_with_retries(self): + # Enable retries and run test_create_scope_all_params. + _service.enable_retries() + self.test_create_scope_all_params() + + # Disable retries and run test_create_scope_all_params. + _service.disable_retries() + self.test_create_scope_all_params() + + @responses.activate + def test_create_scope_value_error(self): + """ + test_create_scope_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_id' + scope_property_model['value'] = '1234567' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + name = 'ibm scope' + description = 'The scope that is defined for IBM resources.' + environment = 'ibm-cloud' + properties = [scope_property_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_scope(**req_copy) + + def test_create_scope_value_error_with_retries(self): + # Enable retries and run test_create_scope_value_error. + _service.enable_retries() + self.test_create_scope_value_error() + + # Disable retries and run test_create_scope_value_error. + _service.disable_retries() + self.test_create_scope_value_error() + + +class TestListScopes: + """ + Test Class for list_scopes + """ + + @responses.activate + def test_list_scopes_all_params(self): + """ + list_scopes() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + limit = 50 + start = 'testString' + name = 'testString' + description = 'testString' + environment = 'testString' + + # Invoke method + response = _service.list_scopes( + instance_id, + limit=limit, + start=start, + name=name, + description=description, + environment=environment, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'limit={}'.format(limit) in query_string + assert 'start={}'.format(start) in query_string + assert 'name={}'.format(name) in query_string + assert 'description={}'.format(description) in query_string + assert 'environment={}'.format(environment) in query_string + + def test_list_scopes_all_params_with_retries(self): + # Enable retries and run test_list_scopes_all_params. + _service.enable_retries() + self.test_list_scopes_all_params() + + # Disable retries and run test_list_scopes_all_params. + _service.disable_retries() + self.test_list_scopes_all_params() + + @responses.activate + def test_list_scopes_required_params(self): + """ + test_list_scopes_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.list_scopes( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_scopes_required_params_with_retries(self): + # Enable retries and run test_list_scopes_required_params. + _service.enable_retries() + self.test_list_scopes_required_params() + + # Disable retries and run test_list_scopes_required_params. + _service.disable_retries() + self.test_list_scopes_required_params() + + @responses.activate + def test_list_scopes_value_error(self): + """ + test_list_scopes_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "scopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_scopes(**req_copy) + + def test_list_scopes_value_error_with_retries(self): + # Enable retries and run test_list_scopes_value_error. + _service.enable_retries() + self.test_list_scopes_value_error() + + # Disable retries and run test_list_scopes_value_error. + _service.disable_retries() + self.test_list_scopes_value_error() + + @responses.activate + def test_list_scopes_with_pager_get_next(self): + """ + test_list_scopes_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"scopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}],"account_id":"account_id","instance_id":"instance_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z","attachment_count":16}]}' + mock_response2 = '{"total_count":2,"limit":1,"scopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}],"account_id":"account_id","instance_id":"instance_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z","attachment_count":16}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = ScopesPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=10, + name='testString', + description='testString', + environment='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_scopes_with_pager_get_all(self): + """ + test_list_scopes_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes') + mock_response1 = '{"next":{"start":"1"},"total_count":2,"limit":1,"scopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}],"account_id":"account_id","instance_id":"instance_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z","attachment_count":16}]}' + mock_response2 = '{"total_count":2,"limit":1,"scopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}],"account_id":"account_id","instance_id":"instance_id","created_by":"created_by","created_on":"2019-01-01T12:00:00.000Z","updated_by":"updated_by","updated_on":"2019-01-01T12:00:00.000Z","attachment_count":16}]}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = ScopesPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + limit=10, + name='testString', + description='testString', + environment='testString', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestUpdateScope: + """ + Test Class for update_scope + """ + + @responses.activate + def test_update_scope_all_params(self): + """ + update_scope() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + name = 'updated name of scope' + description = 'updated scope description' + + # Invoke method + response = _service.update_scope( + instance_id, + scope_id, + name=name, + description=description, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['name'] == 'updated name of scope' + assert req_body['description'] == 'updated scope description' + + def test_update_scope_all_params_with_retries(self): + # Enable retries and run test_update_scope_all_params. + _service.enable_retries() + self.test_update_scope_all_params() + + # Disable retries and run test_update_scope_all_params. + _service.disable_retries() + self.test_update_scope_all_params() + + @responses.activate + def test_update_scope_value_error(self): + """ + test_update_scope_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + name = 'updated name of scope' + description = 'updated scope description' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "scope_id": scope_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_scope(**req_copy) + + def test_update_scope_value_error_with_retries(self): + # Enable retries and run test_update_scope_value_error. + _service.enable_retries() + self.test_update_scope_value_error() + + # Disable retries and run test_update_scope_value_error. + _service.disable_retries() + self.test_update_scope_value_error() + + +class TestGetScope: + """ + Test Class for get_scope + """ + + @responses.activate + def test_get_scope_all_params(self): + """ + get_scope() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + + # Invoke method + response = _service.get_scope( + instance_id, + scope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_scope_all_params_with_retries(self): + # Enable retries and run test_get_scope_all_params. + _service.enable_retries() + self.test_get_scope_all_params() + + # Disable retries and run test_get_scope_all_params. + _service.disable_retries() + self.test_get_scope_all_params() + + @responses.activate + def test_get_scope_value_error(self): + """ + test_get_scope_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}], "account_id": "account_id", "instance_id": "instance_id", "created_by": "created_by", "created_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "updated_on": "2019-01-01T12:00:00.000Z", "attachment_count": 16}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "scope_id": scope_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_scope(**req_copy) + + def test_get_scope_value_error_with_retries(self): + # Enable retries and run test_get_scope_value_error. + _service.enable_retries() + self.test_get_scope_value_error() + + # Disable retries and run test_get_scope_value_error. + _service.disable_retries() + self.test_get_scope_value_error() + + +class TestDeleteScope: + """ + Test Class for delete_scope + """ + + @responses.activate + def test_delete_scope_all_params(self): + """ + delete_scope() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + + # Invoke method + response = _service.delete_scope( + instance_id, + scope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_scope_all_params_with_retries(self): + # Enable retries and run test_delete_scope_all_params. + _service.enable_retries() + self.test_delete_scope_all_params() + + # Disable retries and run test_delete_scope_all_params. + _service.disable_retries() + self.test_delete_scope_all_params() + + @responses.activate + def test_delete_scope_value_error(self): + """ + test_delete_scope_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "scope_id": scope_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_scope(**req_copy) + + def test_delete_scope_value_error_with_retries(self): + # Enable retries and run test_delete_scope_value_error. + _service.enable_retries() + self.test_delete_scope_value_error() + + # Disable retries and run test_delete_scope_value_error. + _service.disable_retries() + self.test_delete_scope_value_error() + + +class TestCreateSubscope: + """ + Test Class for create_subscope + """ + + @responses.activate + def test_create_subscope_all_params(self): + """ + create_subscope() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes') + mock_response = '{"subscopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_id' + scope_property_model['value'] = '1234567' + + # Construct a dict representation of a ScopePrototype model + scope_prototype_model = {} + scope_prototype_model['name'] = 'ibm subscope' + scope_prototype_model['description'] = 'The subscope that is defined for IBM resources.' + scope_prototype_model['environment'] = 'ibm-cloud' + scope_prototype_model['properties'] = [scope_property_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscopes = [scope_prototype_model] + + # Invoke method + response = _service.create_subscope( + instance_id, + scope_id, + subscopes, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['subscopes'] == [scope_prototype_model] + + def test_create_subscope_all_params_with_retries(self): + # Enable retries and run test_create_subscope_all_params. + _service.enable_retries() + self.test_create_subscope_all_params() + + # Disable retries and run test_create_subscope_all_params. + _service.disable_retries() + self.test_create_subscope_all_params() + + @responses.activate + def test_create_subscope_value_error(self): + """ + test_create_subscope_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes') + mock_response = '{"subscopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}]}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a ScopePropertyScopeType model + scope_property_model = {} + scope_property_model['name'] = 'scope_id' + scope_property_model['value'] = '1234567' + + # Construct a dict representation of a ScopePrototype model + scope_prototype_model = {} + scope_prototype_model['name'] = 'ibm subscope' + scope_prototype_model['description'] = 'The subscope that is defined for IBM resources.' + scope_prototype_model['environment'] = 'ibm-cloud' + scope_prototype_model['properties'] = [scope_property_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscopes = [scope_prototype_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "scope_id": scope_id, + "subscopes": subscopes, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_subscope(**req_copy) + + def test_create_subscope_value_error_with_retries(self): + # Enable retries and run test_create_subscope_value_error. + _service.enable_retries() + self.test_create_subscope_value_error() + + # Disable retries and run test_create_subscope_value_error. + _service.disable_retries() + self.test_create_subscope_value_error() + + +class TestListSubscopes: + """ + Test Class for list_subscopes + """ + + @responses.activate + def test_list_subscopes_all_params(self): + """ + list_subscopes() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "subscopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + limit = 50 + start = 'testString' + name = 'testString' + description = 'testString' + environment = 'testString' + + # Invoke method + response = _service.list_subscopes( + instance_id, + scope_id, + limit=limit, + start=start, + name=name, + description=description, + environment=environment, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate query params + query_string = responses.calls[0].request.url.split('?', 1)[1] + query_string = urllib.parse.unquote_plus(query_string) + assert 'limit={}'.format(limit) in query_string + assert 'start={}'.format(start) in query_string + assert 'name={}'.format(name) in query_string + assert 'description={}'.format(description) in query_string + assert 'environment={}'.format(environment) in query_string + + def test_list_subscopes_all_params_with_retries(self): + # Enable retries and run test_list_subscopes_all_params. + _service.enable_retries() + self.test_list_subscopes_all_params() + + # Disable retries and run test_list_subscopes_all_params. + _service.disable_retries() + self.test_list_subscopes_all_params() + + @responses.activate + def test_list_subscopes_required_params(self): + """ + test_list_subscopes_required_params() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "subscopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + + # Invoke method + response = _service.list_subscopes( + instance_id, + scope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_subscopes_required_params_with_retries(self): + # Enable retries and run test_list_subscopes_required_params. + _service.enable_retries() + self.test_list_subscopes_required_params() + + # Disable retries and run test_list_subscopes_required_params. + _service.disable_retries() + self.test_list_subscopes_required_params() + + @responses.activate + def test_list_subscopes_value_error(self): + """ + test_list_subscopes_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "subscopes": [{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "scope_id": scope_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_subscopes(**req_copy) + + def test_list_subscopes_value_error_with_retries(self): + # Enable retries and run test_list_subscopes_value_error. + _service.enable_retries() + self.test_list_subscopes_value_error() + + # Disable retries and run test_list_subscopes_value_error. + _service.disable_retries() + self.test_list_subscopes_value_error() + + @responses.activate + def test_list_subscopes_with_pager_get_next(self): + """ + test_list_subscopes_with_pager_get_next() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes') + mock_response1 = '{"next":{"start":"1"},"subscopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}]}],"total_count":2,"limit":1}' + mock_response2 = '{"subscopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}]}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + all_results = [] + pager = SubscopesPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + limit=10, + name='testString', + description='testString', + environment='testString', + ) + while pager.has_next(): + next_page = pager.get_next() + assert next_page is not None + all_results.extend(next_page) + assert len(all_results) == 2 + + @responses.activate + def test_list_subscopes_with_pager_get_all(self): + """ + test_list_subscopes_with_pager_get_all() + """ + # Set up a two-page mock response + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes') + mock_response1 = '{"next":{"start":"1"},"subscopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}]}],"total_count":2,"limit":1}' + mock_response2 = '{"subscopes":[{"id":"id","name":"name","description":"description","environment":"environment","properties":[{"name":"scope_type","value":"account"}]}],"total_count":2,"limit":1}' + responses.add( + responses.GET, + url, + body=mock_response1, + content_type='application/json', + status=200, + ) + responses.add( + responses.GET, + url, + body=mock_response2, + content_type='application/json', + status=200, + ) + + # Exercise the pager class for this operation + pager = SubscopesPager( + client=_service, + instance_id='acd7032c-15a3-484f-bf5b-67d41534d940', + scope_id='testString', + limit=10, + name='testString', + description='testString', + environment='testString', + ) + all_results = pager.get_all() + assert all_results is not None + assert len(all_results) == 2 + + +class TestGetSubscope: + """ + Test Class for get_subscope + """ + + @responses.activate + def test_get_subscope_all_params(self): + """ + get_subscope() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscope_id = 'testString' + + # Invoke method + response = _service.get_subscope( + instance_id, + scope_id, + subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_subscope_all_params_with_retries(self): + # Enable retries and run test_get_subscope_all_params. + _service.enable_retries() + self.test_get_subscope_all_params() + + # Disable retries and run test_get_subscope_all_params. + _service.disable_retries() + self.test_get_subscope_all_params() + + @responses.activate + def test_get_subscope_value_error(self): + """ + test_get_subscope_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscope_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "scope_id": scope_id, + "subscope_id": subscope_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_subscope(**req_copy) + + def test_get_subscope_value_error_with_retries(self): + # Enable retries and run test_get_subscope_value_error. + _service.enable_retries() + self.test_get_subscope_value_error() + + # Disable retries and run test_get_subscope_value_error. + _service.disable_retries() + self.test_get_subscope_value_error() + + +class TestUpdateSubscope: + """ + Test Class for update_subscope + """ + + @responses.activate + def test_update_subscope_all_params(self): + """ + update_subscope() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscope_id = 'testString' + name = 'updated name of scope' + description = 'updated scope description' + + # Invoke method + response = _service.update_subscope( + instance_id, + scope_id, + subscope_id, + name=name, + description=description, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['name'] == 'updated name of scope' + assert req_body['description'] == 'updated scope description' + + def test_update_subscope_all_params_with_retries(self): + # Enable retries and run test_update_subscope_all_params. + _service.enable_retries() + self.test_update_subscope_all_params() + + # Disable retries and run test_update_subscope_all_params. + _service.disable_retries() + self.test_update_subscope_all_params() + + @responses.activate + def test_update_subscope_value_error(self): + """ + test_update_subscope_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString') + mock_response = '{"id": "id", "name": "name", "description": "description", "environment": "environment", "properties": [{"name": "scope_type", "value": "account"}]}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscope_id = 'testString' + name = 'updated name of scope' + description = 'updated scope description' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "scope_id": scope_id, + "subscope_id": subscope_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_subscope(**req_copy) + + def test_update_subscope_value_error_with_retries(self): + # Enable retries and run test_update_subscope_value_error. + _service.enable_retries() + self.test_update_subscope_value_error() + + # Disable retries and run test_update_subscope_value_error. + _service.disable_retries() + self.test_update_subscope_value_error() + + +class TestDeleteSubscope: + """ + Test Class for delete_subscope + """ + + @responses.activate + def test_delete_subscope_all_params(self): + """ + delete_subscope() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscope_id = 'testString' + + # Invoke method + response = _service.delete_subscope( + instance_id, + scope_id, + subscope_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_subscope_all_params_with_retries(self): + # Enable retries and run test_delete_subscope_all_params. + _service.enable_retries() + self.test_delete_subscope_all_params() + + # Disable retries and run test_delete_subscope_all_params. + _service.disable_retries() + self.test_delete_subscope_all_params() + + @responses.activate + def test_delete_subscope_value_error(self): + """ + test_delete_subscope_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/scopes/testString/subscopes/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + scope_id = 'testString' + subscope_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "scope_id": scope_id, + "subscope_id": subscope_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_subscope(**req_copy) + + def test_delete_subscope_value_error_with_retries(self): + # Enable retries and run test_delete_subscope_value_error. + _service.enable_retries() + self.test_delete_subscope_value_error() + + # Disable retries and run test_delete_subscope_value_error. + _service.disable_retries() + self.test_delete_subscope_value_error() + + +# endregion +############################################################################## +# End of Service: Scope +############################################################################## + +############################################################################## +# Start of Service: Service +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestListServices: + """ + Test Class for list_services + """ + + @responses.activate + def test_list_services_all_params(self): + """ + list_services() + """ + # Set up mock + url = preprocess_url('/v3/services') + mock_response = '{"services": [{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "service_name": "service_name", "service_display_name": "service_display_name", "description": "description", "monitoring_enabled": true, "enforcement_enabled": false, "service_listing_enabled": false, "config_information_point": {"type": "type", "endpoints": [{"host": "host", "path": "path", "region": "region", "advisory_call_limit": 19}]}, "supported_configs": [{"resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "properties": [{"name": "name", "description": "description", "type": "string"}], "description": "description", "cip_requires_service_instance": false, "resource_group_support": true, "tagging_support": false, "inherit_tags": true}]}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Invoke method + response = _service.list_services() + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_services_all_params_with_retries(self): + # Enable retries and run test_list_services_all_params. + _service.enable_retries() + self.test_list_services_all_params() + + # Disable retries and run test_list_services_all_params. + _service.disable_retries() + self.test_list_services_all_params() + + +class TestGetService: + """ + Test Class for get_service + """ + + @responses.activate + def test_get_service_all_params(self): + """ + get_service() + """ + # Set up mock + url = preprocess_url('/v3/services/cloud-object-storage') + mock_response = '{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "service_name": "service_name", "service_display_name": "service_display_name", "description": "description", "monitoring_enabled": true, "enforcement_enabled": false, "service_listing_enabled": false, "config_information_point": {"type": "type", "endpoints": [{"host": "host", "path": "path", "region": "region", "advisory_call_limit": 19}]}, "supported_configs": [{"resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "properties": [{"name": "name", "description": "description", "type": "string"}], "description": "description", "cip_requires_service_instance": false, "resource_group_support": true, "tagging_support": false, "inherit_tags": true}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + services_name = 'cloud-object-storage' + + # Invoke method + response = _service.get_service( + services_name, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_service_all_params_with_retries(self): + # Enable retries and run test_get_service_all_params. + _service.enable_retries() + self.test_get_service_all_params() + + # Disable retries and run test_get_service_all_params. + _service.disable_retries() + self.test_get_service_all_params() + + @responses.activate + def test_get_service_value_error(self): + """ + test_get_service_value_error() + """ + # Set up mock + url = preprocess_url('/v3/services/cloud-object-storage') + mock_response = '{"created_on": "2019-01-01T12:00:00.000Z", "created_by": "created_by", "updated_on": "2019-01-01T12:00:00.000Z", "updated_by": "updated_by", "service_name": "service_name", "service_display_name": "service_display_name", "description": "description", "monitoring_enabled": true, "enforcement_enabled": false, "service_listing_enabled": false, "config_information_point": {"type": "type", "endpoints": [{"host": "host", "path": "path", "region": "region", "advisory_call_limit": 19}]}, "supported_configs": [{"resource_kind": "resource_kind", "additional_target_attributes": [{"name": "name", "operator": "string_equals", "value": "anyValue"}], "properties": [{"name": "name", "description": "description", "type": "string"}], "description": "description", "cip_requires_service_instance": false, "resource_group_support": true, "tagging_support": false, "inherit_tags": true}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + services_name = 'cloud-object-storage' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "services_name": services_name, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_service(**req_copy) + + def test_get_service_value_error_with_retries(self): + # Enable retries and run test_get_service_value_error. + _service.enable_retries() + self.test_get_service_value_error() + + # Disable retries and run test_get_service_value_error. + _service.disable_retries() + self.test_get_service_value_error() + + +# endregion +############################################################################## +# End of Service: Service +############################################################################## + +############################################################################## +# Start of Service: Setting +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestGetSettings: + """ + Test Class for get_settings + """ + + @responses.activate + def test_get_settings_all_params(self): + """ + get_settings() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/settings') + mock_response = '{"event_notifications": {"instance_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::", "updated_on": "2019-01-01T12:00:00.000Z", "source_id": "crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::", "source_description": "This source is used for integration with IBM Cloud Security and Compliance Center.", "source_name": "compliance"}, "object_storage": {"instance_crn": "instance_crn", "bucket": "bucket", "bucket_location": "bucket_location", "bucket_endpoint": "bucket_endpoint", "updated_on": "2019-01-01T12:00:00.000Z"}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.get_settings( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_settings_all_params_with_retries(self): + # Enable retries and run test_get_settings_all_params. + _service.enable_retries() + self.test_get_settings_all_params() + + # Disable retries and run test_get_settings_all_params. + _service.disable_retries() + self.test_get_settings_all_params() + + @responses.activate + def test_get_settings_value_error(self): + """ + test_get_settings_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/settings') + mock_response = '{"event_notifications": {"instance_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::", "updated_on": "2019-01-01T12:00:00.000Z", "source_id": "crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::", "source_description": "This source is used for integration with IBM Cloud Security and Compliance Center.", "source_name": "compliance"}, "object_storage": {"instance_crn": "instance_crn", "bucket": "bucket", "bucket_location": "bucket_location", "bucket_endpoint": "bucket_endpoint", "updated_on": "2019-01-01T12:00:00.000Z"}}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_settings(**req_copy) + + def test_get_settings_value_error_with_retries(self): + # Enable retries and run test_get_settings_value_error. + _service.enable_retries() + self.test_get_settings_value_error() + + # Disable retries and run test_get_settings_value_error. + _service.disable_retries() + self.test_get_settings_value_error() + + +class TestUpdateSettings: + """ + Test Class for update_settings + """ + + @responses.activate + def test_update_settings_all_params(self): + """ + update_settings() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/settings') + mock_response = '{"event_notifications": {"instance_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::", "updated_on": "2019-01-01T12:00:00.000Z", "source_id": "crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::", "source_description": "This source is used for integration with IBM Cloud Security and Compliance Center.", "source_name": "compliance"}, "object_storage": {"instance_crn": "instance_crn", "bucket": "bucket", "bucket_location": "bucket_location", "bucket_endpoint": "bucket_endpoint", "updated_on": "2019-01-01T12:00:00.000Z"}}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a ObjectStoragePrototype model + object_storage_prototype_model = {} + object_storage_prototype_model['bucket'] = 'px-scan-results' + object_storage_prototype_model['instance_crn'] = 'crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::' + + # Construct a dict representation of a EventNotificationsPrototype model + event_notifications_prototype_model = {} + event_notifications_prototype_model['instance_crn'] = 'crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::' + event_notifications_prototype_model['source_description'] = 'This source is used for integration with IBM Cloud Security and Compliance Center.' + event_notifications_prototype_model['source_name'] = 'scc-sdk-integration' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + object_storage = object_storage_prototype_model + event_notifications = event_notifications_prototype_model + + # Invoke method + response = _service.update_settings( + instance_id, + object_storage=object_storage, + event_notifications=event_notifications, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['object_storage'] == object_storage_prototype_model + assert req_body['event_notifications'] == event_notifications_prototype_model + + def test_update_settings_all_params_with_retries(self): + # Enable retries and run test_update_settings_all_params. + _service.enable_retries() + self.test_update_settings_all_params() + + # Disable retries and run test_update_settings_all_params. + _service.disable_retries() + self.test_update_settings_all_params() + + @responses.activate + def test_update_settings_value_error(self): + """ + test_update_settings_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/settings') + mock_response = '{"event_notifications": {"instance_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::", "updated_on": "2019-01-01T12:00:00.000Z", "source_id": "crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::", "source_description": "This source is used for integration with IBM Cloud Security and Compliance Center.", "source_name": "compliance"}, "object_storage": {"instance_crn": "instance_crn", "bucket": "bucket", "bucket_location": "bucket_location", "bucket_endpoint": "bucket_endpoint", "updated_on": "2019-01-01T12:00:00.000Z"}}' + responses.add( + responses.PATCH, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a ObjectStoragePrototype model + object_storage_prototype_model = {} + object_storage_prototype_model['bucket'] = 'px-scan-results' + object_storage_prototype_model['instance_crn'] = 'crn:v1:staging:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::' + + # Construct a dict representation of a EventNotificationsPrototype model + event_notifications_prototype_model = {} + event_notifications_prototype_model['instance_crn'] = 'crn:v1:staging:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::' + event_notifications_prototype_model['source_description'] = 'This source is used for integration with IBM Cloud Security and Compliance Center.' + event_notifications_prototype_model['source_name'] = 'scc-sdk-integration' + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + object_storage = object_storage_prototype_model + event_notifications = event_notifications_prototype_model + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.update_settings(**req_copy) + + def test_update_settings_value_error_with_retries(self): + # Enable retries and run test_update_settings_value_error. + _service.enable_retries() + self.test_update_settings_value_error() + + # Disable retries and run test_update_settings_value_error. + _service.disable_retries() + self.test_update_settings_value_error() + + +class TestPostTestEvent: + """ + Test Class for post_test_event + """ + + @responses.activate + def test_post_test_event_all_params(self): + """ + post_test_event() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/test_event') + mock_response = '{"success": false}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=202, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.post_test_event( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 202 + + def test_post_test_event_all_params_with_retries(self): + # Enable retries and run test_post_test_event_all_params. + _service.enable_retries() + self.test_post_test_event_all_params() + + # Disable retries and run test_post_test_event_all_params. + _service.disable_retries() + self.test_post_test_event_all_params() + + @responses.activate + def test_post_test_event_value_error(self): + """ + test_post_test_event_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/test_event') + mock_response = '{"success": false}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=202, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.post_test_event(**req_copy) + + def test_post_test_event_value_error_with_retries(self): + # Enable retries and run test_post_test_event_value_error. + _service.enable_retries() + self.test_post_test_event_value_error() + + # Disable retries and run test_post_test_event_value_error. + _service.disable_retries() + self.test_post_test_event_value_error() + + +# endregion +############################################################################## +# End of Service: Setting +############################################################################## + +############################################################################## +# Start of Service: Target +############################################################################## +# region + + +class TestNewInstance: + """ + Test Class for new_instance + """ + + def test_new_instance(self): + """ + new_instance() + """ + os.environ['TEST_SERVICE_AUTH_TYPE'] = 'noAuth' + + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE', + ) + + assert service is not None + assert isinstance(service, SecurityAndComplianceCenterApiV3) + + def test_new_instance_without_authenticator(self): + """ + new_instance_without_authenticator() + """ + with pytest.raises(ValueError, match='authenticator must be provided'): + service = SecurityAndComplianceCenterApiV3.new_instance( + service_name='TEST_SERVICE_NOT_FOUND', + ) + + +class TestCreateTarget: + """ + Test Class for create_target + """ + + @responses.activate + def test_create_target_all_params(self): + """ + create_target() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets') + mock_response = '{"id": "a2366444-ad87-40b1-81d0-476df1cc1f18", "account_id": "be200c80cabc456e91139e4152327823", "trusted_profile_id": "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3", "name": "Target Account-A", "credentials": [{"type": "iam_credentials", "secret_crn": "secret_crn", "secret_name": "my secret", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}], "created_by": "IBMid-270007EPPC", "created_on": "2024-02-07T05:42:58.000Z", "updated_by": "IBMid-270007EPPC", "updated_on": "2024-02-07T05:42:58.000Z"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a Account model + account_model = {} + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + # Construct a dict representation of a Tags model + tags_model = {} + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a dict representation of a Resource model + resource_model = {} + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + # Construct a dict representation of a Credential model + credential_model = {} + credential_model['secret_crn'] = 'dummy' + credential_model['resources'] = [resource_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + account_id = 'be200c80cabc456e91139e4152327823' + trusted_profile_id = 'Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3' + name = 'Target accountA' + credentials = [credential_model] + + # Invoke method + response = _service.create_target( + instance_id, + account_id, + trusted_profile_id, + name, + credentials=credentials, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 201 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['account_id'] == 'be200c80cabc456e91139e4152327823' + assert req_body['trusted_profile_id'] == 'Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3' + assert req_body['name'] == 'Target accountA' + assert req_body['credentials'] == [credential_model] + + def test_create_target_all_params_with_retries(self): + # Enable retries and run test_create_target_all_params. + _service.enable_retries() + self.test_create_target_all_params() + + # Disable retries and run test_create_target_all_params. + _service.disable_retries() + self.test_create_target_all_params() + + @responses.activate + def test_create_target_value_error(self): + """ + test_create_target_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets') + mock_response = '{"id": "a2366444-ad87-40b1-81d0-476df1cc1f18", "account_id": "be200c80cabc456e91139e4152327823", "trusted_profile_id": "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3", "name": "Target Account-A", "credentials": [{"type": "iam_credentials", "secret_crn": "secret_crn", "secret_name": "my secret", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}], "created_by": "IBMid-270007EPPC", "created_on": "2024-02-07T05:42:58.000Z", "updated_by": "IBMid-270007EPPC", "updated_on": "2024-02-07T05:42:58.000Z"}' + responses.add( + responses.POST, + url, + body=mock_response, + content_type='application/json', + status=201, + ) + + # Construct a dict representation of a Account model + account_model = {} + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + # Construct a dict representation of a Tags model + tags_model = {} + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a dict representation of a Resource model + resource_model = {} + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + # Construct a dict representation of a Credential model + credential_model = {} + credential_model['secret_crn'] = 'dummy' + credential_model['resources'] = [resource_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + account_id = 'be200c80cabc456e91139e4152327823' + trusted_profile_id = 'Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3' + name = 'Target accountA' + credentials = [credential_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "account_id": account_id, + "trusted_profile_id": trusted_profile_id, + "name": name, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.create_target(**req_copy) + + def test_create_target_value_error_with_retries(self): + # Enable retries and run test_create_target_value_error. + _service.enable_retries() + self.test_create_target_value_error() + + # Disable retries and run test_create_target_value_error. + _service.disable_retries() + self.test_create_target_value_error() + + +class TestListTargets: + """ + Test Class for list_targets + """ + + @responses.activate + def test_list_targets_all_params(self): + """ + list_targets() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "targets": [{"id": "a2366444-ad87-40b1-81d0-476df1cc1f18", "account_id": "be200c80cabc456e91139e4152327823", "trusted_profile_id": "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3", "name": "Target Account-A", "credentials": [{"type": "iam_credentials", "secret_crn": "secret_crn", "secret_name": "my secret", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}], "created_by": "IBMid-270007EPPC", "created_on": "2024-02-07T05:42:58.000Z", "updated_by": "IBMid-270007EPPC", "updated_on": "2024-02-07T05:42:58.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Invoke method + response = _service.list_targets( + instance_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_list_targets_all_params_with_retries(self): + # Enable retries and run test_list_targets_all_params. + _service.enable_retries() + self.test_list_targets_all_params() + + # Disable retries and run test_list_targets_all_params. + _service.disable_retries() + self.test_list_targets_all_params() + + @responses.activate + def test_list_targets_value_error(self): + """ + test_list_targets_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets') + mock_response = '{"limit": 50, "total_count": 230, "first": {"href": "href"}, "next": {"href": "href", "start": "start"}, "targets": [{"id": "a2366444-ad87-40b1-81d0-476df1cc1f18", "account_id": "be200c80cabc456e91139e4152327823", "trusted_profile_id": "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3", "name": "Target Account-A", "credentials": [{"type": "iam_credentials", "secret_crn": "secret_crn", "secret_name": "my secret", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}], "created_by": "IBMid-270007EPPC", "created_on": "2024-02-07T05:42:58.000Z", "updated_by": "IBMid-270007EPPC", "updated_on": "2024-02-07T05:42:58.000Z"}]}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.list_targets(**req_copy) + + def test_list_targets_value_error_with_retries(self): + # Enable retries and run test_list_targets_value_error. + _service.enable_retries() + self.test_list_targets_value_error() + + # Disable retries and run test_list_targets_value_error. + _service.disable_retries() + self.test_list_targets_value_error() + + +class TestGetTarget: + """ + Test Class for get_target + """ + + @responses.activate + def test_get_target_all_params(self): + """ + get_target() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString') + mock_response = '{"id": "a2366444-ad87-40b1-81d0-476df1cc1f18", "account_id": "be200c80cabc456e91139e4152327823", "trusted_profile_id": "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3", "name": "Target Account-A", "credentials": [{"type": "iam_credentials", "secret_crn": "secret_crn", "secret_name": "my secret", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}], "created_by": "IBMid-270007EPPC", "created_on": "2024-02-07T05:42:58.000Z", "updated_by": "IBMid-270007EPPC", "updated_on": "2024-02-07T05:42:58.000Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + target_id = 'testString' + + # Invoke method + response = _service.get_target( + instance_id, + target_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + + def test_get_target_all_params_with_retries(self): + # Enable retries and run test_get_target_all_params. + _service.enable_retries() + self.test_get_target_all_params() + + # Disable retries and run test_get_target_all_params. + _service.disable_retries() + self.test_get_target_all_params() + + @responses.activate + def test_get_target_value_error(self): + """ + test_get_target_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString') + mock_response = '{"id": "a2366444-ad87-40b1-81d0-476df1cc1f18", "account_id": "be200c80cabc456e91139e4152327823", "trusted_profile_id": "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3", "name": "Target Account-A", "credentials": [{"type": "iam_credentials", "secret_crn": "secret_crn", "secret_name": "my secret", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}], "created_by": "IBMid-270007EPPC", "created_on": "2024-02-07T05:42:58.000Z", "updated_by": "IBMid-270007EPPC", "updated_on": "2024-02-07T05:42:58.000Z"}' + responses.add( + responses.GET, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + target_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "target_id": target_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.get_target(**req_copy) + + def test_get_target_value_error_with_retries(self): + # Enable retries and run test_get_target_value_error. + _service.enable_retries() + self.test_get_target_value_error() + + # Disable retries and run test_get_target_value_error. + _service.disable_retries() + self.test_get_target_value_error() + + +class TestReplaceTarget: + """ + Test Class for replace_target + """ + + @responses.activate + def test_replace_target_all_params(self): + """ + replace_target() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString') + mock_response = '{"id": "a2366444-ad87-40b1-81d0-476df1cc1f18", "account_id": "be200c80cabc456e91139e4152327823", "trusted_profile_id": "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3", "name": "Target Account-A", "credentials": [{"type": "iam_credentials", "secret_crn": "secret_crn", "secret_name": "my secret", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}], "created_by": "IBMid-270007EPPC", "created_on": "2024-02-07T05:42:58.000Z", "updated_by": "IBMid-270007EPPC", "updated_on": "2024-02-07T05:42:58.000Z"}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a Account model + account_model = {} + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + # Construct a dict representation of a Tags model + tags_model = {} + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a dict representation of a Resource model + resource_model = {} + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + # Construct a dict representation of a Credential model + credential_model = {} + credential_model['secret_crn'] = 'dummy' + credential_model['resources'] = [resource_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + target_id = 'testString' + account_id = 'be200c80cabc456e91139e4152327823' + trusted_profile_id = 'Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3' + name = 'Target accountA' + credentials = [credential_model] + + # Invoke method + response = _service.replace_target( + instance_id, + target_id, + account_id, + trusted_profile_id, + name, + credentials=credentials, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 200 + # Validate body params + req_body = json.loads(str(responses.calls[0].request.body, 'utf-8')) + assert req_body['account_id'] == 'be200c80cabc456e91139e4152327823' + assert req_body['trusted_profile_id'] == 'Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3' + assert req_body['name'] == 'Target accountA' + assert req_body['credentials'] == [credential_model] + + def test_replace_target_all_params_with_retries(self): + # Enable retries and run test_replace_target_all_params. + _service.enable_retries() + self.test_replace_target_all_params() + + # Disable retries and run test_replace_target_all_params. + _service.disable_retries() + self.test_replace_target_all_params() + + @responses.activate + def test_replace_target_value_error(self): + """ + test_replace_target_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString') + mock_response = '{"id": "a2366444-ad87-40b1-81d0-476df1cc1f18", "account_id": "be200c80cabc456e91139e4152327823", "trusted_profile_id": "Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3", "name": "Target Account-A", "credentials": [{"type": "iam_credentials", "secret_crn": "secret_crn", "secret_name": "my secret", "resources": [{"report_id": "30b434b3-cb08-4845-af10-7a8fc682b6a8", "home_account_id": "2411ffdc16844b07b42521c3443f456d", "id": "crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::", "resource_name": "jeff\'s key", "account": {"id": "531fc3e28bfc43c5a2cea07786d93f5c", "name": "NIST", "type": "account_type"}, "component_id": "cloud-object_storage", "component_name": "cloud-object_storage", "environment": "ibm cloud", "tags": {"user": ["user"], "access": ["access"], "service": ["service"]}, "status": "compliant", "total_count": 140, "pass_count": 123, "failure_count": 12, "error_count": 5, "skipped_count": 7, "completed_count": 135, "service_name": "pm-20", "instance_crn": "instance_crn"}]}], "created_by": "IBMid-270007EPPC", "created_on": "2024-02-07T05:42:58.000Z", "updated_by": "IBMid-270007EPPC", "updated_on": "2024-02-07T05:42:58.000Z"}' + responses.add( + responses.PUT, + url, + body=mock_response, + content_type='application/json', + status=200, + ) + + # Construct a dict representation of a Account model + account_model = {} + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + # Construct a dict representation of a Tags model + tags_model = {} + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a dict representation of a Resource model + resource_model = {} + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + # Construct a dict representation of a Credential model + credential_model = {} + credential_model['secret_crn'] = 'dummy' + credential_model['resources'] = [resource_model] + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + target_id = 'testString' + account_id = 'be200c80cabc456e91139e4152327823' + trusted_profile_id = 'Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3' + name = 'Target accountA' + credentials = [credential_model] + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "target_id": target_id, + "account_id": account_id, + "trusted_profile_id": trusted_profile_id, + "name": name, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.replace_target(**req_copy) + + def test_replace_target_value_error_with_retries(self): + # Enable retries and run test_replace_target_value_error. + _service.enable_retries() + self.test_replace_target_value_error() + + # Disable retries and run test_replace_target_value_error. + _service.disable_retries() + self.test_replace_target_value_error() + + +class TestDeleteTarget: + """ + Test Class for delete_target + """ + + @responses.activate + def test_delete_target_all_params(self): + """ + delete_target() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + target_id = 'testString' + + # Invoke method + response = _service.delete_target( + instance_id, + target_id, + headers={}, + ) + + # Check for correct operation + assert len(responses.calls) == 1 + assert response.status_code == 204 + + def test_delete_target_all_params_with_retries(self): + # Enable retries and run test_delete_target_all_params. + _service.enable_retries() + self.test_delete_target_all_params() + + # Disable retries and run test_delete_target_all_params. + _service.disable_retries() + self.test_delete_target_all_params() + + @responses.activate + def test_delete_target_value_error(self): + """ + test_delete_target_value_error() + """ + # Set up mock + url = preprocess_url('/instances/acd7032c-15a3-484f-bf5b-67d41534d940/v3/targets/testString') + responses.add( + responses.DELETE, + url, + status=204, + ) + + # Set up parameter values + instance_id = 'acd7032c-15a3-484f-bf5b-67d41534d940' + target_id = 'testString' + + # Pass in all but one required param and check for a ValueError + req_param_dict = { + "instance_id": instance_id, + "target_id": target_id, + } + for param in req_param_dict.keys(): + req_copy = {key: val if key is not param else None for (key, val) in req_param_dict.items()} + with pytest.raises(ValueError): + _service.delete_target(**req_copy) + + def test_delete_target_value_error_with_retries(self): + # Enable retries and run test_delete_target_value_error. + _service.enable_retries() + self.test_delete_target_value_error() + + # Disable retries and run test_delete_target_value_error. + _service.disable_retries() + self.test_delete_target_value_error() + + +# endregion +############################################################################## +# End of Service: Target +############################################################################## + + +############################################################################## +# Start of Model Tests +############################################################################## +# region + + +class TestModel_Account: + """ + Test Class for Account + """ + + def test_account_serialization(self): + """ + Test serialization/deserialization for Account + """ + + # Construct a json representation of a Account model + account_model_json = {} + account_model_json['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model_json['name'] = 'NIST' + account_model_json['type'] = 'account_type' + + # Construct a model instance of Account by calling from_dict on the json representation + account_model = Account.from_dict(account_model_json) + assert account_model != False + + # Construct a model instance of Account by calling from_dict on the json representation + account_model_dict = Account.from_dict(account_model_json).__dict__ + account_model2 = Account(**account_model_dict) + + # Verify the model instances are equivalent + assert account_model == account_model2 + + # Convert model instance back to dict and verify no loss of data + account_model_json2 = account_model.to_dict() + assert account_model_json2 == account_model_json + + +class TestModel_AdditionalDetails: + """ + Test Class for AdditionalDetails + """ + + def test_additional_details_serialization(self): + """ + Test serialization/deserialization for AdditionalDetails + """ + + # Construct dict forms of any model objects needed in order to build this model. + + link_model = {} # Link + link_model['description'] = 'testString' + link_model['href'] = 'testString' + + # Construct a json representation of a AdditionalDetails model + additional_details_model_json = {} + additional_details_model_json['created_by'] = 'Security and Compliance Center' + additional_details_model_json['labels'] = ['testString'] + additional_details_model_json['links'] = [link_model] + + # Construct a model instance of AdditionalDetails by calling from_dict on the json representation + additional_details_model = AdditionalDetails.from_dict(additional_details_model_json) + assert additional_details_model != False + + # Construct a model instance of AdditionalDetails by calling from_dict on the json representation + additional_details_model_dict = AdditionalDetails.from_dict(additional_details_model_json).__dict__ + additional_details_model2 = AdditionalDetails(**additional_details_model_dict) + + # Verify the model instances are equivalent + assert additional_details_model == additional_details_model2 + + # Convert model instance back to dict and verify no loss of data + additional_details_model_json2 = additional_details_model.to_dict() + assert additional_details_model_json2 == additional_details_model_json + + +class TestModel_AdditionalProperty: + """ + Test Class for AdditionalProperty + """ + + def test_additional_property_serialization(self): + """ + Test serialization/deserialization for AdditionalProperty + """ + + # Construct a json representation of a AdditionalProperty model + additional_property_model_json = {} + additional_property_model_json['type'] = 'text' + additional_property_model_json['display_name'] = 'Workload Protection Instance CRN' + + # Construct a model instance of AdditionalProperty by calling from_dict on the json representation + additional_property_model = AdditionalProperty.from_dict(additional_property_model_json) + assert additional_property_model != False + + # Construct a model instance of AdditionalProperty by calling from_dict on the json representation + additional_property_model_dict = AdditionalProperty.from_dict(additional_property_model_json).__dict__ + additional_property_model2 = AdditionalProperty(**additional_property_model_dict) + + # Verify the model instances are equivalent + assert additional_property_model == additional_property_model2 + + # Convert model instance back to dict and verify no loss of data + additional_property_model_json2 = additional_property_model.to_dict() + assert additional_property_model_json2 == additional_property_model_json + + +class TestModel_AdditionalTargetAttribute: + """ + Test Class for AdditionalTargetAttribute + """ + + def test_additional_target_attribute_serialization(self): + """ + Test serialization/deserialization for AdditionalTargetAttribute + """ + + # Construct a json representation of a AdditionalTargetAttribute model + additional_target_attribute_model_json = {} + additional_target_attribute_model_json['name'] = 'testString' + additional_target_attribute_model_json['operator'] = 'string_equals' + additional_target_attribute_model_json['value'] = 'testString' + + # Construct a model instance of AdditionalTargetAttribute by calling from_dict on the json representation + additional_target_attribute_model = AdditionalTargetAttribute.from_dict(additional_target_attribute_model_json) + assert additional_target_attribute_model != False + + # Construct a model instance of AdditionalTargetAttribute by calling from_dict on the json representation + additional_target_attribute_model_dict = AdditionalTargetAttribute.from_dict(additional_target_attribute_model_json).__dict__ + additional_target_attribute_model2 = AdditionalTargetAttribute(**additional_target_attribute_model_dict) + + # Verify the model instances are equivalent + assert additional_target_attribute_model == additional_target_attribute_model2 + + # Convert model instance back to dict and verify no loss of data + additional_target_attribute_model_json2 = additional_target_attribute_model.to_dict() + assert additional_target_attribute_model_json2 == additional_target_attribute_model_json + + +class TestModel_Assessment: + """ + Test Class for Assessment + """ + + def test_assessment_serialization(self): + """ + Test serialization/deserialization for Assessment + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + # Construct a json representation of a Assessment model + assessment_model_json = {} + assessment_model_json['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model_json['assessment_type'] = 'ibm-cloud-rule' + assessment_model_json['assessment_method'] = 'ibm-cloud-rule' + assessment_model_json['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model_json['parameter_count'] = 1 + assessment_model_json['parameters'] = [parameter_model] + + # Construct a model instance of Assessment by calling from_dict on the json representation + assessment_model = Assessment.from_dict(assessment_model_json) + assert assessment_model != False + + # Construct a model instance of Assessment by calling from_dict on the json representation + assessment_model_dict = Assessment.from_dict(assessment_model_json).__dict__ + assessment_model2 = Assessment(**assessment_model_dict) + + # Verify the model instances are equivalent + assert assessment_model == assessment_model2 + + # Convert model instance back to dict and verify no loss of data + assessment_model_json2 = assessment_model.to_dict() + assert assessment_model_json2 == assessment_model_json + + +class TestModel_AssessmentPrototype: + """ + Test Class for AssessmentPrototype + """ + + def test_assessment_prototype_serialization(self): + """ + Test serialization/deserialization for AssessmentPrototype + """ + + # Construct a json representation of a AssessmentPrototype model + assessment_prototype_model_json = {} + assessment_prototype_model_json['assessment_id'] = 'testString' + assessment_prototype_model_json['assessment_description'] = 'testString' + + # Construct a model instance of AssessmentPrototype by calling from_dict on the json representation + assessment_prototype_model = AssessmentPrototype.from_dict(assessment_prototype_model_json) + assert assessment_prototype_model != False + + # Construct a model instance of AssessmentPrototype by calling from_dict on the json representation + assessment_prototype_model_dict = AssessmentPrototype.from_dict(assessment_prototype_model_json).__dict__ + assessment_prototype_model2 = AssessmentPrototype(**assessment_prototype_model_dict) + + # Verify the model instances are equivalent + assert assessment_prototype_model == assessment_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + assessment_prototype_model_json2 = assessment_prototype_model.to_dict() + assert assessment_prototype_model_json2 == assessment_prototype_model_json + + +class TestModel_AssessmentWithStats: + """ + Test Class for AssessmentWithStats + """ + + def test_assessment_with_stats_serialization(self): + """ + Test serialization/deserialization for AssessmentWithStats + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + # Construct a json representation of a AssessmentWithStats model + assessment_with_stats_model_json = {} + assessment_with_stats_model_json['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_with_stats_model_json['assessment_type'] = 'ibm-cloud-rule' + assessment_with_stats_model_json['assessment_method'] = 'ibm-cloud-rule' + assessment_with_stats_model_json['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_with_stats_model_json['parameter_count'] = 1 + assessment_with_stats_model_json['parameters'] = [parameter_model] + assessment_with_stats_model_json['total_count'] = 140 + assessment_with_stats_model_json['pass_count'] = 123 + assessment_with_stats_model_json['failure_count'] = 12 + assessment_with_stats_model_json['error_count'] = 5 + assessment_with_stats_model_json['completed_count'] = 135 + + # Construct a model instance of AssessmentWithStats by calling from_dict on the json representation + assessment_with_stats_model = AssessmentWithStats.from_dict(assessment_with_stats_model_json) + assert assessment_with_stats_model != False + + # Construct a model instance of AssessmentWithStats by calling from_dict on the json representation + assessment_with_stats_model_dict = AssessmentWithStats.from_dict(assessment_with_stats_model_json).__dict__ + assessment_with_stats_model2 = AssessmentWithStats(**assessment_with_stats_model_dict) + + # Verify the model instances are equivalent + assert assessment_with_stats_model == assessment_with_stats_model2 + + # Convert model instance back to dict and verify no loss of data + assessment_with_stats_model_json2 = assessment_with_stats_model.to_dict() + assert assessment_with_stats_model_json2 == assessment_with_stats_model_json + + +class TestModel_Attachment: + """ + Test Class for Attachment + """ + + def test_attachment_serialization(self): + """ + Test serialization/deserialization for Attachment + """ + + # Construct dict forms of any model objects needed in order to build this model. + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + scope_model = {} # Scope + scope_model['id'] = 'testString' + scope_model['name'] = 'testString' + scope_model['description'] = 'testString' + scope_model['environment'] = 'testString' + scope_model['properties'] = [scope_property_model] + scope_model['account_id'] = 'testString' + scope_model['instance_id'] = 'testString' + scope_model['created_by'] = 'testString' + scope_model['created_on'] = '2019-01-01T12:00:00Z' + scope_model['updated_by'] = 'testString' + scope_model['updated_on'] = '2019-01-01T12:00:00Z' + scope_model['attachment_count'] = 72.5 + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + attachment_notifications_model = {} # AttachmentNotifications + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + # Construct a json representation of a Attachment model + attachment_model_json = {} + attachment_model_json['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + attachment_model_json['name'] = 'resource group - Default' + attachment_model_json['description'] = 'Scoped to the Default resource group' + attachment_model_json['schedule'] = 'daily' + attachment_model_json['scope'] = 'testString' + attachment_model_json['scopes'] = [scope_model] + attachment_model_json['notifications'] = attachment_notifications_model + + # Construct a model instance of Attachment by calling from_dict on the json representation + attachment_model = Attachment.from_dict(attachment_model_json) + assert attachment_model != False + + # Construct a model instance of Attachment by calling from_dict on the json representation + attachment_model_dict = Attachment.from_dict(attachment_model_json).__dict__ + attachment_model2 = Attachment(**attachment_model_dict) + + # Verify the model instances are equivalent + assert attachment_model == attachment_model2 + + # Convert model instance back to dict and verify no loss of data + attachment_model_json2 = attachment_model.to_dict() + assert attachment_model_json2 == attachment_model_json + + +class TestModel_AttachmentNotifications: + """ + Test Class for AttachmentNotifications + """ + + def test_attachment_notifications_serialization(self): + """ + Test serialization/deserialization for AttachmentNotifications + """ + + # Construct dict forms of any model objects needed in order to build this model. + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + # Construct a json representation of a AttachmentNotifications model + attachment_notifications_model_json = {} + attachment_notifications_model_json['enabled'] = True + attachment_notifications_model_json['controls'] = attachment_notifications_controls_model + + # Construct a model instance of AttachmentNotifications by calling from_dict on the json representation + attachment_notifications_model = AttachmentNotifications.from_dict(attachment_notifications_model_json) + assert attachment_notifications_model != False + + # Construct a model instance of AttachmentNotifications by calling from_dict on the json representation + attachment_notifications_model_dict = AttachmentNotifications.from_dict(attachment_notifications_model_json).__dict__ + attachment_notifications_model2 = AttachmentNotifications(**attachment_notifications_model_dict) + + # Verify the model instances are equivalent + assert attachment_notifications_model == attachment_notifications_model2 + + # Convert model instance back to dict and verify no loss of data + attachment_notifications_model_json2 = attachment_notifications_model.to_dict() + assert attachment_notifications_model_json2 == attachment_notifications_model_json + + +class TestModel_AttachmentNotificationsControls: + """ + Test Class for AttachmentNotificationsControls + """ + + def test_attachment_notifications_controls_serialization(self): + """ + Test serialization/deserialization for AttachmentNotificationsControls + """ + + # Construct a json representation of a AttachmentNotificationsControls model + attachment_notifications_controls_model_json = {} + attachment_notifications_controls_model_json['threshold_limit'] = 15 + attachment_notifications_controls_model_json['failed_control_ids'] = ['testString'] + + # Construct a model instance of AttachmentNotificationsControls by calling from_dict on the json representation + attachment_notifications_controls_model = AttachmentNotificationsControls.from_dict(attachment_notifications_controls_model_json) + assert attachment_notifications_controls_model != False + + # Construct a model instance of AttachmentNotificationsControls by calling from_dict on the json representation + attachment_notifications_controls_model_dict = AttachmentNotificationsControls.from_dict(attachment_notifications_controls_model_json).__dict__ + attachment_notifications_controls_model2 = AttachmentNotificationsControls(**attachment_notifications_controls_model_dict) + + # Verify the model instances are equivalent + assert attachment_notifications_controls_model == attachment_notifications_controls_model2 + + # Convert model instance back to dict and verify no loss of data + attachment_notifications_controls_model_json2 = attachment_notifications_controls_model.to_dict() + assert attachment_notifications_controls_model_json2 == attachment_notifications_controls_model_json + + +class TestModel_ComparePredefinedProfilesResponse: + """ + Test Class for ComparePredefinedProfilesResponse + """ + + def test_compare_predefined_profiles_response_serialization(self): + """ + Test serialization/deserialization for ComparePredefinedProfilesResponse + """ + + # Construct dict forms of any model objects needed in order to build this model. + + compare_profile_response_model = {} # CompareProfileResponse + compare_profile_response_model['id'] = 'testString' + compare_profile_response_model['profile_name'] = 'testString' + compare_profile_response_model['profile_description'] = 'testString' + compare_profile_response_model['profile_type'] = 'custom' + compare_profile_response_model['profile_version'] = 'testString' + compare_profile_response_model['version_group_label'] = 'testString' + compare_profile_response_model['latest'] = True + compare_profile_response_model['created_by'] = 'testString' + compare_profile_response_model['created_on'] = '2019-01-01T12:00:00Z' + compare_profile_response_model['updated_by'] = 'testString' + compare_profile_response_model['updated_on'] = '2019-01-01T12:00:00Z' + compare_profile_response_model['controls_count'] = 38 + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + profile_controls_in_response_model = {} # ProfileControlsInResponse + profile_controls_in_response_model['control_requirement'] = True + profile_controls_in_response_model['control_library_id'] = 'testString' + profile_controls_in_response_model['control_id'] = 'testString' + profile_controls_in_response_model['control_library_version'] = 'testString' + profile_controls_in_response_model['control_name'] = 'testString' + profile_controls_in_response_model['control_description'] = 'testString' + profile_controls_in_response_model['control_severity'] = 'testString' + profile_controls_in_response_model['control_category'] = 'testString' + profile_controls_in_response_model['control_parent'] = 'testString' + profile_controls_in_response_model['control_docs'] = control_doc_model + profile_controls_in_response_model['control_specifications'] = [control_specification_model] + + control_changes_updated_model = {} # ControlChangesUpdated + control_changes_updated_model['current'] = profile_controls_in_response_model + control_changes_updated_model['latest'] = profile_controls_in_response_model + + control_changes_model = {} # ControlChanges + control_changes_model['total_added'] = 38 + control_changes_model['total_removed'] = 38 + control_changes_model['total_updated'] = 38 + control_changes_model['added'] = [profile_controls_in_response_model] + control_changes_model['removed'] = [profile_controls_in_response_model] + control_changes_model['updated'] = [control_changes_updated_model] + + default_parameters_model = {} # DefaultParameters + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + default_parameters_difference_model = {} # DefaultParametersDifference + default_parameters_difference_model['current'] = default_parameters_model + default_parameters_difference_model['latest'] = default_parameters_model + + default_parameters_changes_model = {} # DefaultParametersChanges + default_parameters_changes_model['total_added'] = 38 + default_parameters_changes_model['total_removed'] = 38 + default_parameters_changes_model['total_updated'] = 38 + default_parameters_changes_model['added'] = [default_parameters_model] + default_parameters_changes_model['removed'] = [default_parameters_model] + default_parameters_changes_model['updated'] = [default_parameters_difference_model] + + # Construct a json representation of a ComparePredefinedProfilesResponse model + compare_predefined_profiles_response_model_json = {} + compare_predefined_profiles_response_model_json['current_predefined_version'] = compare_profile_response_model + compare_predefined_profiles_response_model_json['latest_predefined_version'] = compare_profile_response_model + compare_predefined_profiles_response_model_json['controls_changes'] = control_changes_model + compare_predefined_profiles_response_model_json['default_parameters_changes'] = default_parameters_changes_model + + # Construct a model instance of ComparePredefinedProfilesResponse by calling from_dict on the json representation + compare_predefined_profiles_response_model = ComparePredefinedProfilesResponse.from_dict(compare_predefined_profiles_response_model_json) + assert compare_predefined_profiles_response_model != False + + # Construct a model instance of ComparePredefinedProfilesResponse by calling from_dict on the json representation + compare_predefined_profiles_response_model_dict = ComparePredefinedProfilesResponse.from_dict(compare_predefined_profiles_response_model_json).__dict__ + compare_predefined_profiles_response_model2 = ComparePredefinedProfilesResponse(**compare_predefined_profiles_response_model_dict) + + # Verify the model instances are equivalent + assert compare_predefined_profiles_response_model == compare_predefined_profiles_response_model2 + + # Convert model instance back to dict and verify no loss of data + compare_predefined_profiles_response_model_json2 = compare_predefined_profiles_response_model.to_dict() + assert compare_predefined_profiles_response_model_json2 == compare_predefined_profiles_response_model_json + + +class TestModel_CompareProfileResponse: + """ + Test Class for CompareProfileResponse + """ + + def test_compare_profile_response_serialization(self): + """ + Test serialization/deserialization for CompareProfileResponse + """ + + # Construct a json representation of a CompareProfileResponse model + compare_profile_response_model_json = {} + compare_profile_response_model_json['id'] = 'testString' + compare_profile_response_model_json['profile_name'] = 'testString' + compare_profile_response_model_json['profile_description'] = 'testString' + compare_profile_response_model_json['profile_type'] = 'custom' + compare_profile_response_model_json['profile_version'] = 'testString' + compare_profile_response_model_json['version_group_label'] = 'testString' + compare_profile_response_model_json['latest'] = True + compare_profile_response_model_json['created_by'] = 'testString' + compare_profile_response_model_json['created_on'] = '2019-01-01T12:00:00Z' + compare_profile_response_model_json['updated_by'] = 'testString' + compare_profile_response_model_json['updated_on'] = '2019-01-01T12:00:00Z' + compare_profile_response_model_json['controls_count'] = 38 + + # Construct a model instance of CompareProfileResponse by calling from_dict on the json representation + compare_profile_response_model = CompareProfileResponse.from_dict(compare_profile_response_model_json) + assert compare_profile_response_model != False + + # Construct a model instance of CompareProfileResponse by calling from_dict on the json representation + compare_profile_response_model_dict = CompareProfileResponse.from_dict(compare_profile_response_model_json).__dict__ + compare_profile_response_model2 = CompareProfileResponse(**compare_profile_response_model_dict) + + # Verify the model instances are equivalent + assert compare_profile_response_model == compare_profile_response_model2 + + # Convert model instance back to dict and verify no loss of data + compare_profile_response_model_json2 = compare_profile_response_model.to_dict() + assert compare_profile_response_model_json2 == compare_profile_response_model_json + + +class TestModel_ComplianceScore: + """ + Test Class for ComplianceScore + """ + + def test_compliance_score_serialization(self): + """ + Test serialization/deserialization for ComplianceScore + """ + + # Construct a json representation of a ComplianceScore model + compliance_score_model_json = {} + compliance_score_model_json['passed'] = 1 + compliance_score_model_json['total_count'] = 4 + compliance_score_model_json['percent'] = 25 + + # Construct a model instance of ComplianceScore by calling from_dict on the json representation + compliance_score_model = ComplianceScore.from_dict(compliance_score_model_json) + assert compliance_score_model != False + + # Construct a model instance of ComplianceScore by calling from_dict on the json representation + compliance_score_model_dict = ComplianceScore.from_dict(compliance_score_model_json).__dict__ + compliance_score_model2 = ComplianceScore(**compliance_score_model_dict) + + # Verify the model instances are equivalent + assert compliance_score_model == compliance_score_model2 + + # Convert model instance back to dict and verify no loss of data + compliance_score_model_json2 = compliance_score_model.to_dict() + assert compliance_score_model_json2 == compliance_score_model_json + + +class TestModel_ComplianceStats: + """ + Test Class for ComplianceStats + """ + + def test_compliance_stats_serialization(self): + """ + Test serialization/deserialization for ComplianceStats + """ + + # Construct a json representation of a ComplianceStats model + compliance_stats_model_json = {} + compliance_stats_model_json['status'] = 'compliant' + compliance_stats_model_json['total_count'] = 150 + compliance_stats_model_json['compliant_count'] = 130 + compliance_stats_model_json['not_compliant_count'] = 5 + compliance_stats_model_json['unable_to_perform_count'] = 5 + compliance_stats_model_json['user_evaluation_required_count'] = 10 + compliance_stats_model_json['not_applicable_count'] = 7 + + # Construct a model instance of ComplianceStats by calling from_dict on the json representation + compliance_stats_model = ComplianceStats.from_dict(compliance_stats_model_json) + assert compliance_stats_model != False + + # Construct a model instance of ComplianceStats by calling from_dict on the json representation + compliance_stats_model_dict = ComplianceStats.from_dict(compliance_stats_model_json).__dict__ + compliance_stats_model2 = ComplianceStats(**compliance_stats_model_dict) + + # Verify the model instances are equivalent + assert compliance_stats_model == compliance_stats_model2 + + # Convert model instance back to dict and verify no loss of data + compliance_stats_model_json2 = compliance_stats_model.to_dict() + assert compliance_stats_model_json2 == compliance_stats_model_json + + +class TestModel_ComplianceStatsWithNonCompliant: + """ + Test Class for ComplianceStatsWithNonCompliant + """ + + def test_compliance_stats_with_non_compliant_serialization(self): + """ + Test serialization/deserialization for ComplianceStatsWithNonCompliant + """ + + # Construct dict forms of any model objects needed in order to build this model. + + control_summary_model = {} # ControlSummary + control_summary_model['id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + control_summary_model['control_name'] = 'ibm-cloud-rule' + control_summary_model['control_description'] = 'Ensure security questions are registered by the account owner' + + # Construct a json representation of a ComplianceStatsWithNonCompliant model + compliance_stats_with_non_compliant_model_json = {} + compliance_stats_with_non_compliant_model_json['status'] = 'compliant' + compliance_stats_with_non_compliant_model_json['total_count'] = 150 + compliance_stats_with_non_compliant_model_json['compliant_count'] = 130 + compliance_stats_with_non_compliant_model_json['not_compliant_count'] = 5 + compliance_stats_with_non_compliant_model_json['unable_to_perform_count'] = 5 + compliance_stats_with_non_compliant_model_json['user_evaluation_required_count'] = 10 + compliance_stats_with_non_compliant_model_json['not_applicable_count'] = 7 + compliance_stats_with_non_compliant_model_json['not_compliant_controls'] = [control_summary_model] + + # Construct a model instance of ComplianceStatsWithNonCompliant by calling from_dict on the json representation + compliance_stats_with_non_compliant_model = ComplianceStatsWithNonCompliant.from_dict(compliance_stats_with_non_compliant_model_json) + assert compliance_stats_with_non_compliant_model != False + + # Construct a model instance of ComplianceStatsWithNonCompliant by calling from_dict on the json representation + compliance_stats_with_non_compliant_model_dict = ComplianceStatsWithNonCompliant.from_dict(compliance_stats_with_non_compliant_model_json).__dict__ + compliance_stats_with_non_compliant_model2 = ComplianceStatsWithNonCompliant(**compliance_stats_with_non_compliant_model_dict) + + # Verify the model instances are equivalent + assert compliance_stats_with_non_compliant_model == compliance_stats_with_non_compliant_model2 + + # Convert model instance back to dict and verify no loss of data + compliance_stats_with_non_compliant_model_json2 = compliance_stats_with_non_compliant_model.to_dict() + assert compliance_stats_with_non_compliant_model_json2 == compliance_stats_with_non_compliant_model_json + + +class TestModel_ConfigurationInformationPoints: + """ + Test Class for ConfigurationInformationPoints + """ + + def test_configuration_information_points_serialization(self): + """ + Test serialization/deserialization for ConfigurationInformationPoints + """ + + # Construct dict forms of any model objects needed in order to build this model. + + endpoint_model = {} # Endpoint + endpoint_model['host'] = 'testString' + endpoint_model['path'] = 'testString' + endpoint_model['region'] = 'testString' + endpoint_model['advisory_call_limit'] = 38 + + # Construct a json representation of a ConfigurationInformationPoints model + configuration_information_points_model_json = {} + configuration_information_points_model_json['type'] = 'testString' + configuration_information_points_model_json['endpoints'] = [endpoint_model] + + # Construct a model instance of ConfigurationInformationPoints by calling from_dict on the json representation + configuration_information_points_model = ConfigurationInformationPoints.from_dict(configuration_information_points_model_json) + assert configuration_information_points_model != False + + # Construct a model instance of ConfigurationInformationPoints by calling from_dict on the json representation + configuration_information_points_model_dict = ConfigurationInformationPoints.from_dict(configuration_information_points_model_json).__dict__ + configuration_information_points_model2 = ConfigurationInformationPoints(**configuration_information_points_model_dict) + + # Verify the model instances are equivalent + assert configuration_information_points_model == configuration_information_points_model2 + + # Convert model instance back to dict and verify no loss of data + configuration_information_points_model_json2 = configuration_information_points_model.to_dict() + assert configuration_information_points_model_json2 == configuration_information_points_model_json + + +class TestModel_Control: + """ + Test Class for Control + """ + + def test_control_serialization(self): + """ + Test serialization/deserialization for Control + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + # Construct a json representation of a Control model + control_model_json = {} + control_model_json['control_name'] = 'testString' + control_model_json['control_id'] = 'testString' + control_model_json['control_description'] = 'testString' + control_model_json['control_category'] = 'testString' + control_model_json['control_parent'] = 'testString' + control_model_json['control_severity'] = 'testString' + control_model_json['control_tags'] = ['testString'] + control_model_json['control_specifications'] = [control_specification_model] + control_model_json['control_docs'] = control_doc_model + control_model_json['status'] = 'testString' + + # Construct a model instance of Control by calling from_dict on the json representation + control_model = Control.from_dict(control_model_json) + assert control_model != False + + # Construct a model instance of Control by calling from_dict on the json representation + control_model_dict = Control.from_dict(control_model_json).__dict__ + control_model2 = Control(**control_model_dict) + + # Verify the model instances are equivalent + assert control_model == control_model2 + + # Convert model instance back to dict and verify no loss of data + control_model_json2 = control_model.to_dict() + assert control_model_json2 == control_model_json + + +class TestModel_ControlChanges: + """ + Test Class for ControlChanges + """ + + def test_control_changes_serialization(self): + """ + Test serialization/deserialization for ControlChanges + """ + + # Construct dict forms of any model objects needed in order to build this model. + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + profile_controls_in_response_model = {} # ProfileControlsInResponse + profile_controls_in_response_model['control_requirement'] = True + profile_controls_in_response_model['control_library_id'] = 'testString' + profile_controls_in_response_model['control_id'] = 'testString' + profile_controls_in_response_model['control_library_version'] = 'testString' + profile_controls_in_response_model['control_name'] = 'testString' + profile_controls_in_response_model['control_description'] = 'testString' + profile_controls_in_response_model['control_severity'] = 'testString' + profile_controls_in_response_model['control_category'] = 'testString' + profile_controls_in_response_model['control_parent'] = 'testString' + profile_controls_in_response_model['control_docs'] = control_doc_model + profile_controls_in_response_model['control_specifications'] = [control_specification_model] + + control_changes_updated_model = {} # ControlChangesUpdated + control_changes_updated_model['current'] = profile_controls_in_response_model + control_changes_updated_model['latest'] = profile_controls_in_response_model + + # Construct a json representation of a ControlChanges model + control_changes_model_json = {} + control_changes_model_json['total_added'] = 38 + control_changes_model_json['total_removed'] = 38 + control_changes_model_json['total_updated'] = 38 + control_changes_model_json['added'] = [profile_controls_in_response_model] + control_changes_model_json['removed'] = [profile_controls_in_response_model] + control_changes_model_json['updated'] = [control_changes_updated_model] + + # Construct a model instance of ControlChanges by calling from_dict on the json representation + control_changes_model = ControlChanges.from_dict(control_changes_model_json) + assert control_changes_model != False + + # Construct a model instance of ControlChanges by calling from_dict on the json representation + control_changes_model_dict = ControlChanges.from_dict(control_changes_model_json).__dict__ + control_changes_model2 = ControlChanges(**control_changes_model_dict) + + # Verify the model instances are equivalent + assert control_changes_model == control_changes_model2 + + # Convert model instance back to dict and verify no loss of data + control_changes_model_json2 = control_changes_model.to_dict() + assert control_changes_model_json2 == control_changes_model_json + + +class TestModel_ControlChangesUpdated: + """ + Test Class for ControlChangesUpdated + """ + + def test_control_changes_updated_serialization(self): + """ + Test serialization/deserialization for ControlChangesUpdated + """ + + # Construct dict forms of any model objects needed in order to build this model. + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + profile_controls_in_response_model = {} # ProfileControlsInResponse + profile_controls_in_response_model['control_requirement'] = True + profile_controls_in_response_model['control_library_id'] = 'testString' + profile_controls_in_response_model['control_id'] = 'testString' + profile_controls_in_response_model['control_library_version'] = 'testString' + profile_controls_in_response_model['control_name'] = 'testString' + profile_controls_in_response_model['control_description'] = 'testString' + profile_controls_in_response_model['control_severity'] = 'testString' + profile_controls_in_response_model['control_category'] = 'testString' + profile_controls_in_response_model['control_parent'] = 'testString' + profile_controls_in_response_model['control_docs'] = control_doc_model + profile_controls_in_response_model['control_specifications'] = [control_specification_model] + + # Construct a json representation of a ControlChangesUpdated model + control_changes_updated_model_json = {} + control_changes_updated_model_json['current'] = profile_controls_in_response_model + control_changes_updated_model_json['latest'] = profile_controls_in_response_model + + # Construct a model instance of ControlChangesUpdated by calling from_dict on the json representation + control_changes_updated_model = ControlChangesUpdated.from_dict(control_changes_updated_model_json) + assert control_changes_updated_model != False + + # Construct a model instance of ControlChangesUpdated by calling from_dict on the json representation + control_changes_updated_model_dict = ControlChangesUpdated.from_dict(control_changes_updated_model_json).__dict__ + control_changes_updated_model2 = ControlChangesUpdated(**control_changes_updated_model_dict) + + # Verify the model instances are equivalent + assert control_changes_updated_model == control_changes_updated_model2 + + # Convert model instance back to dict and verify no loss of data + control_changes_updated_model_json2 = control_changes_updated_model.to_dict() + assert control_changes_updated_model_json2 == control_changes_updated_model_json + + +class TestModel_ControlDoc: + """ + Test Class for ControlDoc + """ + + def test_control_doc_serialization(self): + """ + Test serialization/deserialization for ControlDoc + """ + + # Construct a json representation of a ControlDoc model + control_doc_model_json = {} + control_doc_model_json['control_docs_id'] = 'testString' + control_doc_model_json['control_docs_type'] = 'testString' + + # Construct a model instance of ControlDoc by calling from_dict on the json representation + control_doc_model = ControlDoc.from_dict(control_doc_model_json) + assert control_doc_model != False + + # Construct a model instance of ControlDoc by calling from_dict on the json representation + control_doc_model_dict = ControlDoc.from_dict(control_doc_model_json).__dict__ + control_doc_model2 = ControlDoc(**control_doc_model_dict) + + # Verify the model instances are equivalent + assert control_doc_model == control_doc_model2 + + # Convert model instance back to dict and verify no loss of data + control_doc_model_json2 = control_doc_model.to_dict() + assert control_doc_model_json2 == control_doc_model_json + + +class TestModel_ControlLibrary: + """ + Test Class for ControlLibrary + """ + + def test_control_library_serialization(self): + """ + Test serialization/deserialization for ControlLibrary + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + control_model = {} # Control + control_model['control_name'] = 'testString' + control_model['control_id'] = 'testString' + control_model['control_description'] = 'testString' + control_model['control_category'] = 'testString' + control_model['control_parent'] = 'testString' + control_model['control_severity'] = 'testString' + control_model['control_tags'] = ['testString'] + control_model['control_specifications'] = [control_specification_model] + control_model['control_docs'] = control_doc_model + control_model['status'] = 'testString' + + # Construct a json representation of a ControlLibrary model + control_library_model_json = {} + control_library_model_json['control_library_name'] = 'testString' + control_library_model_json['control_library_description'] = 'testString' + control_library_model_json['control_library_type'] = 'custom' + control_library_model_json['control_library_version'] = 'testString' + control_library_model_json['controls'] = [control_model] + control_library_model_json['id'] = 'testString' + control_library_model_json['account_id'] = 'testString' + control_library_model_json['version_group_label'] = 'testString' + control_library_model_json['latest'] = True + control_library_model_json['created_by'] = 'testString' + control_library_model_json['created_on'] = '2019-01-01T12:00:00Z' + control_library_model_json['updated_by'] = 'testString' + control_library_model_json['updated_on'] = '2019-01-01T12:00:00Z' + control_library_model_json['hierarchy_enabled'] = True + control_library_model_json['controls_count'] = 38 + control_library_model_json['control_parents_count'] = 38 + + # Construct a model instance of ControlLibrary by calling from_dict on the json representation + control_library_model = ControlLibrary.from_dict(control_library_model_json) + assert control_library_model != False + + # Construct a model instance of ControlLibrary by calling from_dict on the json representation + control_library_model_dict = ControlLibrary.from_dict(control_library_model_json).__dict__ + control_library_model2 = ControlLibrary(**control_library_model_dict) + + # Verify the model instances are equivalent + assert control_library_model == control_library_model2 + + # Convert model instance back to dict and verify no loss of data + control_library_model_json2 = control_library_model.to_dict() + assert control_library_model_json2 == control_library_model_json + + +class TestModel_ControlLibraryCollection: + """ + Test Class for ControlLibraryCollection + """ + + def test_control_library_collection_serialization(self): + """ + Test serialization/deserialization for ControlLibraryCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + control_model = {} # Control + control_model['control_name'] = 'testString' + control_model['control_id'] = 'testString' + control_model['control_description'] = 'testString' + control_model['control_category'] = 'testString' + control_model['control_parent'] = 'testString' + control_model['control_severity'] = 'testString' + control_model['control_tags'] = ['testString'] + control_model['control_specifications'] = [control_specification_model] + control_model['control_docs'] = control_doc_model + control_model['status'] = 'testString' + + control_library_model = {} # ControlLibrary + control_library_model['control_library_name'] = 'testString' + control_library_model['control_library_description'] = 'testString' + control_library_model['control_library_type'] = 'custom' + control_library_model['control_library_version'] = 'testString' + control_library_model['controls'] = [control_model] + control_library_model['id'] = 'testString' + control_library_model['account_id'] = 'testString' + control_library_model['version_group_label'] = 'testString' + control_library_model['latest'] = True + control_library_model['created_by'] = 'testString' + control_library_model['created_on'] = '2019-01-01T12:00:00Z' + control_library_model['updated_by'] = 'testString' + control_library_model['updated_on'] = '2019-01-01T12:00:00Z' + control_library_model['hierarchy_enabled'] = True + control_library_model['controls_count'] = 38 + control_library_model['control_parents_count'] = 38 + + # Construct a json representation of a ControlLibraryCollection model + control_library_collection_model_json = {} + control_library_collection_model_json['limit'] = 50 + control_library_collection_model_json['total_count'] = 230 + control_library_collection_model_json['first'] = page_h_ref_first_model + control_library_collection_model_json['next'] = page_h_ref_next_model + control_library_collection_model_json['control_libraries'] = [control_library_model] + + # Construct a model instance of ControlLibraryCollection by calling from_dict on the json representation + control_library_collection_model = ControlLibraryCollection.from_dict(control_library_collection_model_json) + assert control_library_collection_model != False + + # Construct a model instance of ControlLibraryCollection by calling from_dict on the json representation + control_library_collection_model_dict = ControlLibraryCollection.from_dict(control_library_collection_model_json).__dict__ + control_library_collection_model2 = ControlLibraryCollection(**control_library_collection_model_dict) + + # Verify the model instances are equivalent + assert control_library_collection_model == control_library_collection_model2 + + # Convert model instance back to dict and verify no loss of data + control_library_collection_model_json2 = control_library_collection_model.to_dict() + assert control_library_collection_model_json2 == control_library_collection_model_json + + +class TestModel_ControlPrototype: + """ + Test Class for ControlPrototype + """ + + def test_control_prototype_serialization(self): + """ + Test serialization/deserialization for ControlPrototype + """ + + # Construct dict forms of any model objects needed in order to build this model. + + assessment_prototype_model = {} # AssessmentPrototype + assessment_prototype_model['assessment_id'] = 'testString' + assessment_prototype_model['assessment_description'] = 'testString' + + control_specification_prototype_model = {} # ControlSpecificationPrototype + control_specification_prototype_model['component_id'] = 'testString' + control_specification_prototype_model['environment'] = 'ibm-cloud' + control_specification_prototype_model['control_specification_id'] = 'testString' + control_specification_prototype_model['control_specification_description'] = 'testString' + control_specification_prototype_model['assessments'] = [assessment_prototype_model] + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + # Construct a json representation of a ControlPrototype model + control_prototype_model_json = {} + control_prototype_model_json['control_name'] = 'testString' + control_prototype_model_json['control_description'] = 'testString' + control_prototype_model_json['control_category'] = 'testString' + control_prototype_model_json['control_requirement'] = True + control_prototype_model_json['control_parent'] = 'testString' + control_prototype_model_json['control_specifications'] = [control_specification_prototype_model] + control_prototype_model_json['control_docs'] = control_doc_model + control_prototype_model_json['status'] = 'testString' + + # Construct a model instance of ControlPrototype by calling from_dict on the json representation + control_prototype_model = ControlPrototype.from_dict(control_prototype_model_json) + assert control_prototype_model != False + + # Construct a model instance of ControlPrototype by calling from_dict on the json representation + control_prototype_model_dict = ControlPrototype.from_dict(control_prototype_model_json).__dict__ + control_prototype_model2 = ControlPrototype(**control_prototype_model_dict) + + # Verify the model instances are equivalent + assert control_prototype_model == control_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + control_prototype_model_json2 = control_prototype_model.to_dict() + assert control_prototype_model_json2 == control_prototype_model_json + + +class TestModel_ControlSpecification: + """ + Test Class for ControlSpecification + """ + + def test_control_specification_serialization(self): + """ + Test serialization/deserialization for ControlSpecification + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + # Construct a json representation of a ControlSpecification model + control_specification_model_json = {} + control_specification_model_json['id'] = 'testString' + control_specification_model_json['responsibility'] = 'testString' + control_specification_model_json['component_id'] = 'testString' + control_specification_model_json['component_name'] = 'testString' + control_specification_model_json['component_type'] = 'testString' + control_specification_model_json['environment'] = 'testString' + control_specification_model_json['description'] = 'testString' + control_specification_model_json['assessments_count'] = 38 + control_specification_model_json['assessments'] = [assessment_model] + + # Construct a model instance of ControlSpecification by calling from_dict on the json representation + control_specification_model = ControlSpecification.from_dict(control_specification_model_json) + assert control_specification_model != False + + # Construct a model instance of ControlSpecification by calling from_dict on the json representation + control_specification_model_dict = ControlSpecification.from_dict(control_specification_model_json).__dict__ + control_specification_model2 = ControlSpecification(**control_specification_model_dict) + + # Verify the model instances are equivalent + assert control_specification_model == control_specification_model2 + + # Convert model instance back to dict and verify no loss of data + control_specification_model_json2 = control_specification_model.to_dict() + assert control_specification_model_json2 == control_specification_model_json + + +class TestModel_ControlSpecificationPrototype: + """ + Test Class for ControlSpecificationPrototype + """ + + def test_control_specification_prototype_serialization(self): + """ + Test serialization/deserialization for ControlSpecificationPrototype + """ + + # Construct dict forms of any model objects needed in order to build this model. + + assessment_prototype_model = {} # AssessmentPrototype + assessment_prototype_model['assessment_id'] = 'testString' + assessment_prototype_model['assessment_description'] = 'testString' + + # Construct a json representation of a ControlSpecificationPrototype model + control_specification_prototype_model_json = {} + control_specification_prototype_model_json['component_id'] = 'testString' + control_specification_prototype_model_json['environment'] = 'ibm-cloud' + control_specification_prototype_model_json['control_specification_id'] = 'testString' + control_specification_prototype_model_json['control_specification_description'] = 'testString' + control_specification_prototype_model_json['assessments'] = [assessment_prototype_model] + + # Construct a model instance of ControlSpecificationPrototype by calling from_dict on the json representation + control_specification_prototype_model = ControlSpecificationPrototype.from_dict(control_specification_prototype_model_json) + assert control_specification_prototype_model != False + + # Construct a model instance of ControlSpecificationPrototype by calling from_dict on the json representation + control_specification_prototype_model_dict = ControlSpecificationPrototype.from_dict(control_specification_prototype_model_json).__dict__ + control_specification_prototype_model2 = ControlSpecificationPrototype(**control_specification_prototype_model_dict) + + # Verify the model instances are equivalent + assert control_specification_prototype_model == control_specification_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + control_specification_prototype_model_json2 = control_specification_prototype_model.to_dict() + assert control_specification_prototype_model_json2 == control_specification_prototype_model_json + + +class TestModel_ControlSpecificationWithStats: + """ + Test Class for ControlSpecificationWithStats + """ + + def test_control_specification_with_stats_serialization(self): + """ + Test serialization/deserialization for ControlSpecificationWithStats + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_with_stats_model = {} # AssessmentWithStats + assessment_with_stats_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_with_stats_model['assessment_type'] = 'ibm-cloud-rule' + assessment_with_stats_model['assessment_method'] = 'ibm-cloud-rule' + assessment_with_stats_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_with_stats_model['parameter_count'] = 1 + assessment_with_stats_model['parameters'] = [parameter_model] + assessment_with_stats_model['total_count'] = 140 + assessment_with_stats_model['pass_count'] = 123 + assessment_with_stats_model['failure_count'] = 12 + assessment_with_stats_model['error_count'] = 5 + assessment_with_stats_model['completed_count'] = 135 + + # Construct a json representation of a ControlSpecificationWithStats model + control_specification_with_stats_model_json = {} + control_specification_with_stats_model_json['control_specification_id'] = '18d32a4430e54c81a6668952609763b2' + control_specification_with_stats_model_json['control_specification_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + control_specification_with_stats_model_json['component_id'] = 'cloud-object_storage' + control_specification_with_stats_model_json['component_name'] = 'cloud-object_storage' + control_specification_with_stats_model_json['environment'] = 'ibm cloud' + control_specification_with_stats_model_json['responsibility'] = 'user' + control_specification_with_stats_model_json['assessments'] = [assessment_with_stats_model] + control_specification_with_stats_model_json['status'] = 'compliant' + control_specification_with_stats_model_json['total_count'] = 150 + control_specification_with_stats_model_json['compliant_count'] = 130 + control_specification_with_stats_model_json['not_compliant_count'] = 5 + control_specification_with_stats_model_json['unable_to_perform_count'] = 5 + control_specification_with_stats_model_json['user_evaluation_required_count'] = 10 + control_specification_with_stats_model_json['not_applicable_count'] = 7 + + # Construct a model instance of ControlSpecificationWithStats by calling from_dict on the json representation + control_specification_with_stats_model = ControlSpecificationWithStats.from_dict(control_specification_with_stats_model_json) + assert control_specification_with_stats_model != False + + # Construct a model instance of ControlSpecificationWithStats by calling from_dict on the json representation + control_specification_with_stats_model_dict = ControlSpecificationWithStats.from_dict(control_specification_with_stats_model_json).__dict__ + control_specification_with_stats_model2 = ControlSpecificationWithStats(**control_specification_with_stats_model_dict) + + # Verify the model instances are equivalent + assert control_specification_with_stats_model == control_specification_with_stats_model2 + + # Convert model instance back to dict and verify no loss of data + control_specification_with_stats_model_json2 = control_specification_with_stats_model.to_dict() + assert control_specification_with_stats_model_json2 == control_specification_with_stats_model_json + + +class TestModel_ControlSummary: + """ + Test Class for ControlSummary + """ + + def test_control_summary_serialization(self): + """ + Test serialization/deserialization for ControlSummary + """ + + # Construct a json representation of a ControlSummary model + control_summary_model_json = {} + control_summary_model_json['id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + control_summary_model_json['control_name'] = 'ibm-cloud-rule' + control_summary_model_json['control_description'] = 'Ensure security questions are registered by the account owner' + + # Construct a model instance of ControlSummary by calling from_dict on the json representation + control_summary_model = ControlSummary.from_dict(control_summary_model_json) + assert control_summary_model != False + + # Construct a model instance of ControlSummary by calling from_dict on the json representation + control_summary_model_dict = ControlSummary.from_dict(control_summary_model_json).__dict__ + control_summary_model2 = ControlSummary(**control_summary_model_dict) + + # Verify the model instances are equivalent + assert control_summary_model == control_summary_model2 + + # Convert model instance back to dict and verify no loss of data + control_summary_model_json2 = control_summary_model.to_dict() + assert control_summary_model_json2 == control_summary_model_json + + +class TestModel_ControlWithStats: + """ + Test Class for ControlWithStats + """ + + def test_control_with_stats_serialization(self): + """ + Test serialization/deserialization for ControlWithStats + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_with_stats_model = {} # AssessmentWithStats + assessment_with_stats_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_with_stats_model['assessment_type'] = 'ibm-cloud-rule' + assessment_with_stats_model['assessment_method'] = 'ibm-cloud-rule' + assessment_with_stats_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_with_stats_model['parameter_count'] = 1 + assessment_with_stats_model['parameters'] = [parameter_model] + assessment_with_stats_model['total_count'] = 140 + assessment_with_stats_model['pass_count'] = 123 + assessment_with_stats_model['failure_count'] = 12 + assessment_with_stats_model['error_count'] = 5 + assessment_with_stats_model['completed_count'] = 135 + + control_specification_with_stats_model = {} # ControlSpecificationWithStats + control_specification_with_stats_model['control_specification_id'] = '18d32a4430e54c81a6668952609763b2' + control_specification_with_stats_model['control_specification_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + control_specification_with_stats_model['component_id'] = 'cloud-object_storage' + control_specification_with_stats_model['component_name'] = 'cloud-object_storage' + control_specification_with_stats_model['environment'] = 'ibm cloud' + control_specification_with_stats_model['responsibility'] = 'user' + control_specification_with_stats_model['assessments'] = [assessment_with_stats_model] + control_specification_with_stats_model['status'] = 'compliant' + control_specification_with_stats_model['total_count'] = 150 + control_specification_with_stats_model['compliant_count'] = 130 + control_specification_with_stats_model['not_compliant_count'] = 5 + control_specification_with_stats_model['unable_to_perform_count'] = 5 + control_specification_with_stats_model['user_evaluation_required_count'] = 10 + control_specification_with_stats_model['not_applicable_count'] = 7 + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a json representation of a ControlWithStats model + control_with_stats_model_json = {} + control_with_stats_model_json['report_id'] = '6f1fdb98-c08b-41a8-a2f9-df10b51ff34a' + control_with_stats_model_json['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + control_with_stats_model_json['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + control_with_stats_model_json['control_library_id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + control_with_stats_model_json['control_library_version'] = 'v1.2.3' + control_with_stats_model_json['control_name'] = 'Password Management' + control_with_stats_model_json['control_description'] = 'Password Management' + control_with_stats_model_json['control_category'] = 'Access Control' + control_with_stats_model_json['control_specifications'] = [control_specification_with_stats_model] + control_with_stats_model_json['resource_tags'] = tags_model + control_with_stats_model_json['status'] = 'compliant' + control_with_stats_model_json['total_count'] = 150 + control_with_stats_model_json['compliant_count'] = 130 + control_with_stats_model_json['not_compliant_count'] = 5 + control_with_stats_model_json['unable_to_perform_count'] = 5 + control_with_stats_model_json['user_evaluation_required_count'] = 10 + control_with_stats_model_json['not_applicable_count'] = 7 + + # Construct a model instance of ControlWithStats by calling from_dict on the json representation + control_with_stats_model = ControlWithStats.from_dict(control_with_stats_model_json) + assert control_with_stats_model != False + + # Construct a model instance of ControlWithStats by calling from_dict on the json representation + control_with_stats_model_dict = ControlWithStats.from_dict(control_with_stats_model_json).__dict__ + control_with_stats_model2 = ControlWithStats(**control_with_stats_model_dict) + + # Verify the model instances are equivalent + assert control_with_stats_model == control_with_stats_model2 + + # Convert model instance back to dict and verify no loss of data + control_with_stats_model_json2 = control_with_stats_model.to_dict() + assert control_with_stats_model_json2 == control_with_stats_model_json + + +class TestModel_CreateScanReport: + """ + Test Class for CreateScanReport + """ + + def test_create_scan_report_serialization(self): + """ + Test serialization/deserialization for CreateScanReport + """ + + # Construct a json representation of a CreateScanReport model + create_scan_report_model_json = {} + create_scan_report_model_json['id'] = 'testString' + + # Construct a model instance of CreateScanReport by calling from_dict on the json representation + create_scan_report_model = CreateScanReport.from_dict(create_scan_report_model_json) + assert create_scan_report_model != False + + # Construct a model instance of CreateScanReport by calling from_dict on the json representation + create_scan_report_model_dict = CreateScanReport.from_dict(create_scan_report_model_json).__dict__ + create_scan_report_model2 = CreateScanReport(**create_scan_report_model_dict) + + # Verify the model instances are equivalent + assert create_scan_report_model == create_scan_report_model2 + + # Convert model instance back to dict and verify no loss of data + create_scan_report_model_json2 = create_scan_report_model.to_dict() + assert create_scan_report_model_json2 == create_scan_report_model_json + + +class TestModel_CreateScanResponse: + """ + Test Class for CreateScanResponse + """ + + def test_create_scan_response_serialization(self): + """ + Test serialization/deserialization for CreateScanResponse + """ + + # Construct a json representation of a CreateScanResponse model + create_scan_response_model_json = {} + create_scan_response_model_json['id'] = 'testString' + create_scan_response_model_json['account_id'] = 'testString' + create_scan_response_model_json['attachment_id'] = 'testString' + create_scan_response_model_json['report_id'] = 'testString' + create_scan_response_model_json['status'] = 'testString' + create_scan_response_model_json['last_scan_time'] = '2019-01-01T12:00:00Z' + create_scan_response_model_json['next_scan_time'] = '2019-01-01T12:00:00Z' + create_scan_response_model_json['scan_type'] = 'testString' + create_scan_response_model_json['occurence'] = 38 + + # Construct a model instance of CreateScanResponse by calling from_dict on the json representation + create_scan_response_model = CreateScanResponse.from_dict(create_scan_response_model_json) + assert create_scan_response_model != False + + # Construct a model instance of CreateScanResponse by calling from_dict on the json representation + create_scan_response_model_dict = CreateScanResponse.from_dict(create_scan_response_model_json).__dict__ + create_scan_response_model2 = CreateScanResponse(**create_scan_response_model_dict) + + # Verify the model instances are equivalent + assert create_scan_response_model == create_scan_response_model2 + + # Convert model instance back to dict and verify no loss of data + create_scan_response_model_json2 = create_scan_response_model.to_dict() + assert create_scan_response_model_json2 == create_scan_response_model_json + + +class TestModel_Credential: + """ + Test Class for Credential + """ + + def test_credential_serialization(self): + """ + Test serialization/deserialization for Credential + """ + + # Construct dict forms of any model objects needed in order to build this model. + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + resource_model = {} # Resource + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + # Construct a json representation of a Credential model + credential_model_json = {} + credential_model_json['secret_crn'] = 'testString' + credential_model_json['resources'] = [resource_model] + + # Construct a model instance of Credential by calling from_dict on the json representation + credential_model = Credential.from_dict(credential_model_json) + assert credential_model != False + + # Construct a model instance of Credential by calling from_dict on the json representation + credential_model_dict = Credential.from_dict(credential_model_json).__dict__ + credential_model2 = Credential(**credential_model_dict) + + # Verify the model instances are equivalent + assert credential_model == credential_model2 + + # Convert model instance back to dict and verify no loss of data + credential_model_json2 = credential_model.to_dict() + assert credential_model_json2 == credential_model_json + + +class TestModel_CredentialResponse: + """ + Test Class for CredentialResponse + """ + + def test_credential_response_serialization(self): + """ + Test serialization/deserialization for CredentialResponse + """ + + # Construct dict forms of any model objects needed in order to build this model. + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + resource_model = {} # Resource + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + # Construct a json representation of a CredentialResponse model + credential_response_model_json = {} + credential_response_model_json['type'] = 'iam_credentials' + credential_response_model_json['secret_crn'] = 'testString' + credential_response_model_json['secret_name'] = 'my secret' + credential_response_model_json['resources'] = [resource_model] + + # Construct a model instance of CredentialResponse by calling from_dict on the json representation + credential_response_model = CredentialResponse.from_dict(credential_response_model_json) + assert credential_response_model != False + + # Construct a model instance of CredentialResponse by calling from_dict on the json representation + credential_response_model_dict = CredentialResponse.from_dict(credential_response_model_json).__dict__ + credential_response_model2 = CredentialResponse(**credential_response_model_dict) + + # Verify the model instances are equivalent + assert credential_response_model == credential_response_model2 + + # Convert model instance back to dict and verify no loss of data + credential_response_model_json2 = credential_response_model.to_dict() + assert credential_response_model_json2 == credential_response_model_json + + +class TestModel_DateRange: + """ + Test Class for DateRange + """ + + def test_date_range_serialization(self): + """ + Test serialization/deserialization for DateRange + """ + + # Construct a json representation of a DateRange model + date_range_model_json = {} + date_range_model_json['start_date'] = '2025-02-28T05:42:58Z' + date_range_model_json['end_date'] = '2025-02-28T05:42:58Z' + + # Construct a model instance of DateRange by calling from_dict on the json representation + date_range_model = DateRange.from_dict(date_range_model_json) + assert date_range_model != False + + # Construct a model instance of DateRange by calling from_dict on the json representation + date_range_model_dict = DateRange.from_dict(date_range_model_json).__dict__ + date_range_model2 = DateRange(**date_range_model_dict) + + # Verify the model instances are equivalent + assert date_range_model == date_range_model2 + + # Convert model instance back to dict and verify no loss of data + date_range_model_json2 = date_range_model.to_dict() + assert date_range_model_json2 == date_range_model_json + + +class TestModel_DefaultParameters: + """ + Test Class for DefaultParameters + """ + + def test_default_parameters_serialization(self): + """ + Test serialization/deserialization for DefaultParameters + """ + + # Construct a json representation of a DefaultParameters model + default_parameters_model_json = {} + default_parameters_model_json['assessment_type'] = 'testString' + default_parameters_model_json['assessment_id'] = 'testString' + default_parameters_model_json['parameter_name'] = 'testString' + default_parameters_model_json['parameter_default_value'] = 'testString' + default_parameters_model_json['parameter_display_name'] = 'testString' + default_parameters_model_json['parameter_type'] = 'testString' + + # Construct a model instance of DefaultParameters by calling from_dict on the json representation + default_parameters_model = DefaultParameters.from_dict(default_parameters_model_json) + assert default_parameters_model != False + + # Construct a model instance of DefaultParameters by calling from_dict on the json representation + default_parameters_model_dict = DefaultParameters.from_dict(default_parameters_model_json).__dict__ + default_parameters_model2 = DefaultParameters(**default_parameters_model_dict) + + # Verify the model instances are equivalent + assert default_parameters_model == default_parameters_model2 + + # Convert model instance back to dict and verify no loss of data + default_parameters_model_json2 = default_parameters_model.to_dict() + assert default_parameters_model_json2 == default_parameters_model_json + + +class TestModel_DefaultParametersChanges: + """ + Test Class for DefaultParametersChanges + """ + + def test_default_parameters_changes_serialization(self): + """ + Test serialization/deserialization for DefaultParametersChanges + """ + + # Construct dict forms of any model objects needed in order to build this model. + + default_parameters_model = {} # DefaultParameters + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + default_parameters_difference_model = {} # DefaultParametersDifference + default_parameters_difference_model['current'] = default_parameters_model + default_parameters_difference_model['latest'] = default_parameters_model + + # Construct a json representation of a DefaultParametersChanges model + default_parameters_changes_model_json = {} + default_parameters_changes_model_json['total_added'] = 38 + default_parameters_changes_model_json['total_removed'] = 38 + default_parameters_changes_model_json['total_updated'] = 38 + default_parameters_changes_model_json['added'] = [default_parameters_model] + default_parameters_changes_model_json['removed'] = [default_parameters_model] + default_parameters_changes_model_json['updated'] = [default_parameters_difference_model] + + # Construct a model instance of DefaultParametersChanges by calling from_dict on the json representation + default_parameters_changes_model = DefaultParametersChanges.from_dict(default_parameters_changes_model_json) + assert default_parameters_changes_model != False + + # Construct a model instance of DefaultParametersChanges by calling from_dict on the json representation + default_parameters_changes_model_dict = DefaultParametersChanges.from_dict(default_parameters_changes_model_json).__dict__ + default_parameters_changes_model2 = DefaultParametersChanges(**default_parameters_changes_model_dict) + + # Verify the model instances are equivalent + assert default_parameters_changes_model == default_parameters_changes_model2 + + # Convert model instance back to dict and verify no loss of data + default_parameters_changes_model_json2 = default_parameters_changes_model.to_dict() + assert default_parameters_changes_model_json2 == default_parameters_changes_model_json + + +class TestModel_DefaultParametersDifference: + """ + Test Class for DefaultParametersDifference + """ + + def test_default_parameters_difference_serialization(self): + """ + Test serialization/deserialization for DefaultParametersDifference + """ + + # Construct dict forms of any model objects needed in order to build this model. + + default_parameters_model = {} # DefaultParameters + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Construct a json representation of a DefaultParametersDifference model + default_parameters_difference_model_json = {} + default_parameters_difference_model_json['current'] = default_parameters_model + default_parameters_difference_model_json['latest'] = default_parameters_model + + # Construct a model instance of DefaultParametersDifference by calling from_dict on the json representation + default_parameters_difference_model = DefaultParametersDifference.from_dict(default_parameters_difference_model_json) + assert default_parameters_difference_model != False + + # Construct a model instance of DefaultParametersDifference by calling from_dict on the json representation + default_parameters_difference_model_dict = DefaultParametersDifference.from_dict(default_parameters_difference_model_json).__dict__ + default_parameters_difference_model2 = DefaultParametersDifference(**default_parameters_difference_model_dict) + + # Verify the model instances are equivalent + assert default_parameters_difference_model == default_parameters_difference_model2 + + # Convert model instance back to dict and verify no loss of data + default_parameters_difference_model_json2 = default_parameters_difference_model.to_dict() + assert default_parameters_difference_model_json2 == default_parameters_difference_model_json + + +class TestModel_Endpoint: + """ + Test Class for Endpoint + """ + + def test_endpoint_serialization(self): + """ + Test serialization/deserialization for Endpoint + """ + + # Construct a json representation of a Endpoint model + endpoint_model_json = {} + endpoint_model_json['host'] = 'testString' + endpoint_model_json['path'] = 'testString' + endpoint_model_json['region'] = 'testString' + endpoint_model_json['advisory_call_limit'] = 38 + + # Construct a model instance of Endpoint by calling from_dict on the json representation + endpoint_model = Endpoint.from_dict(endpoint_model_json) + assert endpoint_model != False + + # Construct a model instance of Endpoint by calling from_dict on the json representation + endpoint_model_dict = Endpoint.from_dict(endpoint_model_json).__dict__ + endpoint_model2 = Endpoint(**endpoint_model_dict) + + # Verify the model instances are equivalent + assert endpoint_model == endpoint_model2 + + # Convert model instance back to dict and verify no loss of data + endpoint_model_json2 = endpoint_model.to_dict() + assert endpoint_model_json2 == endpoint_model_json + + +class TestModel_EvalStats: + """ + Test Class for EvalStats + """ + + def test_eval_stats_serialization(self): + """ + Test serialization/deserialization for EvalStats + """ + + # Construct a json representation of a EvalStats model + eval_stats_model_json = {} + eval_stats_model_json['status'] = 'compliant' + eval_stats_model_json['total_count'] = 140 + eval_stats_model_json['pass_count'] = 123 + eval_stats_model_json['failure_count'] = 12 + eval_stats_model_json['error_count'] = 5 + eval_stats_model_json['skipped_count'] = 7 + eval_stats_model_json['completed_count'] = 135 + + # Construct a model instance of EvalStats by calling from_dict on the json representation + eval_stats_model = EvalStats.from_dict(eval_stats_model_json) + assert eval_stats_model != False + + # Construct a model instance of EvalStats by calling from_dict on the json representation + eval_stats_model_dict = EvalStats.from_dict(eval_stats_model_json).__dict__ + eval_stats_model2 = EvalStats(**eval_stats_model_dict) + + # Verify the model instances are equivalent + assert eval_stats_model == eval_stats_model2 + + # Convert model instance back to dict and verify no loss of data + eval_stats_model_json2 = eval_stats_model.to_dict() + assert eval_stats_model_json2 == eval_stats_model_json + + +class TestModel_Evaluation: + """ + Test Class for Evaluation + """ + + def test_evaluation_serialization(self): + """ + Test serialization/deserialization for Evaluation + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + target_info_model = {} # TargetInfo + target_info_model['id'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket' + target_info_model['account_id'] = '59bcbfa6ea2f006b4ed7094c1a08dcdd' + target_info_model['service_name'] = 'cloud-object-storage' + target_info_model['service_display_name'] = 'cloud-object-storage' + target_info_model['resource_crn'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket' + target_info_model['resource_name'] = 'mybucket' + target_info_model['tags'] = tags_model + + evaluation_property_model = {} # EvaluationProperty + evaluation_property_model['property'] = 'testString' + evaluation_property_model['property_description'] = 'testString' + evaluation_property_model['operator'] = 'string_equals' + evaluation_property_model['expected_value'] = 'testString' + evaluation_property_model['found_value'] = 'testString' + + evaluation_provider_info_model = {} # EvaluationProviderInfo + evaluation_provider_info_model['provider_type'] = 'testString' + + evaluation_details_model = {} # EvaluationDetails + evaluation_details_model['properties'] = [evaluation_property_model] + evaluation_details_model['provider_info'] = evaluation_provider_info_model + + # Construct a json representation of a Evaluation model + evaluation_model_json = {} + evaluation_model_json['report_id'] = 'testString' + evaluation_model_json['home_account_id'] = 'be200c80cabc456e91139e4152327456' + evaluation_model_json['component_id'] = 'cloud-object_storage' + evaluation_model_json['component_name'] = 'cloud-object_storage' + evaluation_model_json['assessment'] = assessment_model + evaluation_model_json['evaluate_time'] = '2022-06-30T11:03:44.630150782Z' + evaluation_model_json['target'] = target_info_model + evaluation_model_json['status'] = 'failure' + evaluation_model_json['reason'] = 'One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met' + evaluation_model_json['details'] = evaluation_details_model + evaluation_model_json['evaluated_by'] = 'abc@ibm.com' + + # Construct a model instance of Evaluation by calling from_dict on the json representation + evaluation_model = Evaluation.from_dict(evaluation_model_json) + assert evaluation_model != False + + # Construct a model instance of Evaluation by calling from_dict on the json representation + evaluation_model_dict = Evaluation.from_dict(evaluation_model_json).__dict__ + evaluation_model2 = Evaluation(**evaluation_model_dict) + + # Verify the model instances are equivalent + assert evaluation_model == evaluation_model2 + + # Convert model instance back to dict and verify no loss of data + evaluation_model_json2 = evaluation_model.to_dict() + assert evaluation_model_json2 == evaluation_model_json + + +class TestModel_EvaluationDetails: + """ + Test Class for EvaluationDetails + """ + + def test_evaluation_details_serialization(self): + """ + Test serialization/deserialization for EvaluationDetails + """ + + # Construct dict forms of any model objects needed in order to build this model. + + evaluation_property_model = {} # EvaluationProperty + evaluation_property_model['property'] = 'testString' + evaluation_property_model['property_description'] = 'testString' + evaluation_property_model['operator'] = 'string_equals' + evaluation_property_model['expected_value'] = 'testString' + evaluation_property_model['found_value'] = 'testString' + + evaluation_provider_info_model = {} # EvaluationProviderInfo + evaluation_provider_info_model['provider_type'] = 'testString' + + # Construct a json representation of a EvaluationDetails model + evaluation_details_model_json = {} + evaluation_details_model_json['properties'] = [evaluation_property_model] + evaluation_details_model_json['provider_info'] = evaluation_provider_info_model + + # Construct a model instance of EvaluationDetails by calling from_dict on the json representation + evaluation_details_model = EvaluationDetails.from_dict(evaluation_details_model_json) + assert evaluation_details_model != False + + # Construct a model instance of EvaluationDetails by calling from_dict on the json representation + evaluation_details_model_dict = EvaluationDetails.from_dict(evaluation_details_model_json).__dict__ + evaluation_details_model2 = EvaluationDetails(**evaluation_details_model_dict) + + # Verify the model instances are equivalent + assert evaluation_details_model == evaluation_details_model2 + + # Convert model instance back to dict and verify no loss of data + evaluation_details_model_json2 = evaluation_details_model.to_dict() + assert evaluation_details_model_json2 == evaluation_details_model_json + + +class TestModel_EvaluationPage: + """ + Test Class for EvaluationPage + """ + + def test_evaluation_page_serialization(self): + """ + Test serialization/deserialization for EvaluationPage + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + target_info_model = {} # TargetInfo + target_info_model['id'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket' + target_info_model['account_id'] = '59bcbfa6ea2f006b4ed7094c1a08dcdd' + target_info_model['service_name'] = 'cloud-object-storage' + target_info_model['service_display_name'] = 'cloud-object-storage' + target_info_model['resource_crn'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket' + target_info_model['resource_name'] = 'mybucket' + target_info_model['tags'] = tags_model + + evaluation_property_model = {} # EvaluationProperty + evaluation_property_model['property'] = 'testString' + evaluation_property_model['property_description'] = 'testString' + evaluation_property_model['operator'] = 'string_equals' + evaluation_property_model['expected_value'] = 'testString' + evaluation_property_model['found_value'] = 'testString' + + evaluation_provider_info_model = {} # EvaluationProviderInfo + evaluation_provider_info_model['provider_type'] = 'testString' + + evaluation_details_model = {} # EvaluationDetails + evaluation_details_model['properties'] = [evaluation_property_model] + evaluation_details_model['provider_info'] = evaluation_provider_info_model + + evaluation_model = {} # Evaluation + evaluation_model['report_id'] = 'testString' + evaluation_model['home_account_id'] = 'be200c80cabc456e91139e4152327456' + evaluation_model['component_id'] = 'cloud-object_storage' + evaluation_model['component_name'] = 'cloud-object_storage' + evaluation_model['assessment'] = assessment_model + evaluation_model['evaluate_time'] = '2022-06-30T11:03:44.630150782Z' + evaluation_model['target'] = target_info_model + evaluation_model['status'] = 'failure' + evaluation_model['reason'] = 'One or more conditions in rule rule-7b0560a4-df94-4629-bb76-680f3155ddda were not met' + evaluation_model['details'] = evaluation_details_model + evaluation_model['evaluated_by'] = 'abc@ibm.com' + + # Construct a json representation of a EvaluationPage model + evaluation_page_model_json = {} + evaluation_page_model_json['limit'] = 50 + evaluation_page_model_json['total_count'] = 230 + evaluation_page_model_json['first'] = page_h_ref_first_model + evaluation_page_model_json['next'] = page_h_ref_next_model + evaluation_page_model_json['report_id'] = 'testString' + evaluation_page_model_json['home_account_id'] = 'testString' + evaluation_page_model_json['evaluations'] = [evaluation_model] + + # Construct a model instance of EvaluationPage by calling from_dict on the json representation + evaluation_page_model = EvaluationPage.from_dict(evaluation_page_model_json) + assert evaluation_page_model != False + + # Construct a model instance of EvaluationPage by calling from_dict on the json representation + evaluation_page_model_dict = EvaluationPage.from_dict(evaluation_page_model_json).__dict__ + evaluation_page_model2 = EvaluationPage(**evaluation_page_model_dict) + + # Verify the model instances are equivalent + assert evaluation_page_model == evaluation_page_model2 + + # Convert model instance back to dict and verify no loss of data + evaluation_page_model_json2 = evaluation_page_model.to_dict() + assert evaluation_page_model_json2 == evaluation_page_model_json + + +class TestModel_EvaluationProperty: + """ + Test Class for EvaluationProperty + """ + + def test_evaluation_property_serialization(self): + """ + Test serialization/deserialization for EvaluationProperty + """ + + # Construct a json representation of a EvaluationProperty model + evaluation_property_model_json = {} + evaluation_property_model_json['property'] = 'testString' + evaluation_property_model_json['property_description'] = 'testString' + evaluation_property_model_json['operator'] = 'string_equals' + evaluation_property_model_json['expected_value'] = 'testString' + evaluation_property_model_json['found_value'] = 'testString' + + # Construct a model instance of EvaluationProperty by calling from_dict on the json representation + evaluation_property_model = EvaluationProperty.from_dict(evaluation_property_model_json) + assert evaluation_property_model != False + + # Construct a model instance of EvaluationProperty by calling from_dict on the json representation + evaluation_property_model_dict = EvaluationProperty.from_dict(evaluation_property_model_json).__dict__ + evaluation_property_model2 = EvaluationProperty(**evaluation_property_model_dict) + + # Verify the model instances are equivalent + assert evaluation_property_model == evaluation_property_model2 + + # Convert model instance back to dict and verify no loss of data + evaluation_property_model_json2 = evaluation_property_model.to_dict() + assert evaluation_property_model_json2 == evaluation_property_model_json + + +class TestModel_EvaluationProviderInfo: + """ + Test Class for EvaluationProviderInfo + """ + + def test_evaluation_provider_info_serialization(self): + """ + Test serialization/deserialization for EvaluationProviderInfo + """ + + # Construct a json representation of a EvaluationProviderInfo model + evaluation_provider_info_model_json = {} + evaluation_provider_info_model_json['provider_type'] = 'testString' + + # Construct a model instance of EvaluationProviderInfo by calling from_dict on the json representation + evaluation_provider_info_model = EvaluationProviderInfo.from_dict(evaluation_provider_info_model_json) + assert evaluation_provider_info_model != False + + # Construct a model instance of EvaluationProviderInfo by calling from_dict on the json representation + evaluation_provider_info_model_dict = EvaluationProviderInfo.from_dict(evaluation_provider_info_model_json).__dict__ + evaluation_provider_info_model2 = EvaluationProviderInfo(**evaluation_provider_info_model_dict) + + # Verify the model instances are equivalent + assert evaluation_provider_info_model == evaluation_provider_info_model2 + + # Convert model instance back to dict and verify no loss of data + evaluation_provider_info_model_json2 = evaluation_provider_info_model.to_dict() + assert evaluation_provider_info_model_json2 == evaluation_provider_info_model_json + + +class TestModel_EventNotifications: + """ + Test Class for EventNotifications + """ + + def test_event_notifications_serialization(self): + """ + Test serialization/deserialization for EventNotifications + """ + + # Construct a json representation of a EventNotifications model + event_notifications_model_json = {} + event_notifications_model_json['instance_crn'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::' + event_notifications_model_json['updated_on'] = '2019-01-01T12:00:00Z' + event_notifications_model_json['source_id'] = 'crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::' + event_notifications_model_json['source_description'] = 'This source is used for integration with IBM Cloud Security and Compliance Center.' + event_notifications_model_json['source_name'] = 'compliance' + + # Construct a model instance of EventNotifications by calling from_dict on the json representation + event_notifications_model = EventNotifications.from_dict(event_notifications_model_json) + assert event_notifications_model != False + + # Construct a model instance of EventNotifications by calling from_dict on the json representation + event_notifications_model_dict = EventNotifications.from_dict(event_notifications_model_json).__dict__ + event_notifications_model2 = EventNotifications(**event_notifications_model_dict) + + # Verify the model instances are equivalent + assert event_notifications_model == event_notifications_model2 + + # Convert model instance back to dict and verify no loss of data + event_notifications_model_json2 = event_notifications_model.to_dict() + assert event_notifications_model_json2 == event_notifications_model_json + + +class TestModel_EventNotificationsPrototype: + """ + Test Class for EventNotificationsPrototype + """ + + def test_event_notifications_prototype_serialization(self): + """ + Test serialization/deserialization for EventNotificationsPrototype + """ + + # Construct a json representation of a EventNotificationsPrototype model + event_notifications_prototype_model_json = {} + event_notifications_prototype_model_json['instance_crn'] = 'testString' + event_notifications_prototype_model_json['source_description'] = 'This source is used for integration with IBM Cloud Security and Compliance Center.' + event_notifications_prototype_model_json['source_name'] = 'compliance' + + # Construct a model instance of EventNotificationsPrototype by calling from_dict on the json representation + event_notifications_prototype_model = EventNotificationsPrototype.from_dict(event_notifications_prototype_model_json) + assert event_notifications_prototype_model != False + + # Construct a model instance of EventNotificationsPrototype by calling from_dict on the json representation + event_notifications_prototype_model_dict = EventNotificationsPrototype.from_dict(event_notifications_prototype_model_json).__dict__ + event_notifications_prototype_model2 = EventNotificationsPrototype(**event_notifications_prototype_model_dict) + + # Verify the model instances are equivalent + assert event_notifications_prototype_model == event_notifications_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + event_notifications_prototype_model_json2 = event_notifications_prototype_model.to_dict() + assert event_notifications_prototype_model_json2 == event_notifications_prototype_model_json + + +class TestModel_Import: + """ + Test Class for Import + """ + + def test_import_serialization(self): + """ + Test serialization/deserialization for Import + """ + + # Construct dict forms of any model objects needed in order to build this model. + + rule_parameter_model = {} # RuleParameter + rule_parameter_model['name'] = 'testString' + rule_parameter_model['display_name'] = 'testString' + rule_parameter_model['description'] = 'testString' + rule_parameter_model['type'] = 'string' + + # Construct a json representation of a Import model + import_model_json = {} + import_model_json['parameters'] = [rule_parameter_model] + + # Construct a model instance of Import by calling from_dict on the json representation + import_model = Import.from_dict(import_model_json) + assert import_model != False + + # Construct a model instance of Import by calling from_dict on the json representation + import_model_dict = Import.from_dict(import_model_json).__dict__ + import_model2 = Import(**import_model_dict) + + # Verify the model instances are equivalent + assert import_model == import_model2 + + # Convert model instance back to dict and verify no loss of data + import_model_json2 = import_model.to_dict() + assert import_model_json2 == import_model_json + + +class TestModel_LabelType: + """ + Test Class for LabelType + """ + + def test_label_type_serialization(self): + """ + Test serialization/deserialization for LabelType + """ + + # Construct a json representation of a LabelType model + label_type_model_json = {} + label_type_model_json['text'] = '1 per instance' + label_type_model_json['tip'] = 'Only 1 per instance' + + # Construct a model instance of LabelType by calling from_dict on the json representation + label_type_model = LabelType.from_dict(label_type_model_json) + assert label_type_model != False + + # Construct a model instance of LabelType by calling from_dict on the json representation + label_type_model_dict = LabelType.from_dict(label_type_model_json).__dict__ + label_type_model2 = LabelType(**label_type_model_dict) + + # Verify the model instances are equivalent + assert label_type_model == label_type_model2 + + # Convert model instance back to dict and verify no loss of data + label_type_model_json2 = label_type_model.to_dict() + assert label_type_model_json2 == label_type_model_json + + +class TestModel_LastScan: + """ + Test Class for LastScan + """ + + def test_last_scan_serialization(self): + """ + Test serialization/deserialization for LastScan + """ + + # Construct a json representation of a LastScan model + last_scan_model_json = {} + last_scan_model_json['id'] = 'testString' + last_scan_model_json['status'] = 'testString' + last_scan_model_json['time'] = '2019-01-01T12:00:00Z' + + # Construct a model instance of LastScan by calling from_dict on the json representation + last_scan_model = LastScan.from_dict(last_scan_model_json) + assert last_scan_model != False + + # Construct a model instance of LastScan by calling from_dict on the json representation + last_scan_model_dict = LastScan.from_dict(last_scan_model_json).__dict__ + last_scan_model2 = LastScan(**last_scan_model_dict) + + # Verify the model instances are equivalent + assert last_scan_model == last_scan_model2 + + # Convert model instance back to dict and verify no loss of data + last_scan_model_json2 = last_scan_model.to_dict() + assert last_scan_model_json2 == last_scan_model_json + + +class TestModel_Link: + """ + Test Class for Link + """ + + def test_link_serialization(self): + """ + Test serialization/deserialization for Link + """ + + # Construct a json representation of a Link model + link_model_json = {} + link_model_json['description'] = 'testString' + link_model_json['href'] = 'testString' + + # Construct a model instance of Link by calling from_dict on the json representation + link_model = Link.from_dict(link_model_json) + assert link_model != False + + # Construct a model instance of Link by calling from_dict on the json representation + link_model_dict = Link.from_dict(link_model_json).__dict__ + link_model2 = Link(**link_model_dict) + + # Verify the model instances are equivalent + assert link_model == link_model2 + + # Convert model instance back to dict and verify no loss of data + link_model_json2 = link_model.to_dict() + assert link_model_json2 == link_model_json + + +class TestModel_MultiCloudScopePayload: + """ + Test Class for MultiCloudScopePayload + """ + + def test_multi_cloud_scope_payload_serialization(self): + """ + Test serialization/deserialization for MultiCloudScopePayload + """ + + # Construct dict forms of any model objects needed in order to build this model. + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a json representation of a MultiCloudScopePayload model + multi_cloud_scope_payload_model_json = {} + multi_cloud_scope_payload_model_json['id'] = 'testString' + multi_cloud_scope_payload_model_json['environment'] = 'testString' + multi_cloud_scope_payload_model_json['properties'] = [scope_property_model] + + # Construct a model instance of MultiCloudScopePayload by calling from_dict on the json representation + multi_cloud_scope_payload_model = MultiCloudScopePayload.from_dict(multi_cloud_scope_payload_model_json) + assert multi_cloud_scope_payload_model != False + + # Construct a model instance of MultiCloudScopePayload by calling from_dict on the json representation + multi_cloud_scope_payload_model_dict = MultiCloudScopePayload.from_dict(multi_cloud_scope_payload_model_json).__dict__ + multi_cloud_scope_payload_model2 = MultiCloudScopePayload(**multi_cloud_scope_payload_model_dict) + + # Verify the model instances are equivalent + assert multi_cloud_scope_payload_model == multi_cloud_scope_payload_model2 + + # Convert model instance back to dict and verify no loss of data + multi_cloud_scope_payload_model_json2 = multi_cloud_scope_payload_model.to_dict() + assert multi_cloud_scope_payload_model_json2 == multi_cloud_scope_payload_model_json + + +class TestModel_ObjectStorage: + """ + Test Class for ObjectStorage + """ + + def test_object_storage_serialization(self): + """ + Test serialization/deserialization for ObjectStorage + """ + + # Construct a json representation of a ObjectStorage model + object_storage_model_json = {} + object_storage_model_json['instance_crn'] = 'testString' + object_storage_model_json['bucket'] = 'testString' + object_storage_model_json['bucket_location'] = 'testString' + object_storage_model_json['bucket_endpoint'] = 'testString' + object_storage_model_json['updated_on'] = '2019-01-01T12:00:00Z' + + # Construct a model instance of ObjectStorage by calling from_dict on the json representation + object_storage_model = ObjectStorage.from_dict(object_storage_model_json) + assert object_storage_model != False + + # Construct a model instance of ObjectStorage by calling from_dict on the json representation + object_storage_model_dict = ObjectStorage.from_dict(object_storage_model_json).__dict__ + object_storage_model2 = ObjectStorage(**object_storage_model_dict) + + # Verify the model instances are equivalent + assert object_storage_model == object_storage_model2 + + # Convert model instance back to dict and verify no loss of data + object_storage_model_json2 = object_storage_model.to_dict() + assert object_storage_model_json2 == object_storage_model_json + + +class TestModel_ObjectStoragePrototype: + """ + Test Class for ObjectStoragePrototype + """ + + def test_object_storage_prototype_serialization(self): + """ + Test serialization/deserialization for ObjectStoragePrototype + """ + + # Construct a json representation of a ObjectStoragePrototype model + object_storage_prototype_model_json = {} + object_storage_prototype_model_json['bucket'] = 'testString' + object_storage_prototype_model_json['instance_crn'] = 'testString' + + # Construct a model instance of ObjectStoragePrototype by calling from_dict on the json representation + object_storage_prototype_model = ObjectStoragePrototype.from_dict(object_storage_prototype_model_json) + assert object_storage_prototype_model != False + + # Construct a model instance of ObjectStoragePrototype by calling from_dict on the json representation + object_storage_prototype_model_dict = ObjectStoragePrototype.from_dict(object_storage_prototype_model_json).__dict__ + object_storage_prototype_model2 = ObjectStoragePrototype(**object_storage_prototype_model_dict) + + # Verify the model instances are equivalent + assert object_storage_prototype_model == object_storage_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + object_storage_prototype_model_json2 = object_storage_prototype_model.to_dict() + assert object_storage_prototype_model_json2 == object_storage_prototype_model_json + + +class TestModel_PageHRefFirst: + """ + Test Class for PageHRefFirst + """ + + def test_page_h_ref_first_serialization(self): + """ + Test serialization/deserialization for PageHRefFirst + """ + + # Construct a json representation of a PageHRefFirst model + page_h_ref_first_model_json = {} + page_h_ref_first_model_json['href'] = 'testString' + + # Construct a model instance of PageHRefFirst by calling from_dict on the json representation + page_h_ref_first_model = PageHRefFirst.from_dict(page_h_ref_first_model_json) + assert page_h_ref_first_model != False + + # Construct a model instance of PageHRefFirst by calling from_dict on the json representation + page_h_ref_first_model_dict = PageHRefFirst.from_dict(page_h_ref_first_model_json).__dict__ + page_h_ref_first_model2 = PageHRefFirst(**page_h_ref_first_model_dict) + + # Verify the model instances are equivalent + assert page_h_ref_first_model == page_h_ref_first_model2 + + # Convert model instance back to dict and verify no loss of data + page_h_ref_first_model_json2 = page_h_ref_first_model.to_dict() + assert page_h_ref_first_model_json2 == page_h_ref_first_model_json + + +class TestModel_PageHRefNext: + """ + Test Class for PageHRefNext + """ + + def test_page_h_ref_next_serialization(self): + """ + Test serialization/deserialization for PageHRefNext + """ + + # Construct a json representation of a PageHRefNext model + page_h_ref_next_model_json = {} + page_h_ref_next_model_json['href'] = 'testString' + page_h_ref_next_model_json['start'] = 'testString' + + # Construct a model instance of PageHRefNext by calling from_dict on the json representation + page_h_ref_next_model = PageHRefNext.from_dict(page_h_ref_next_model_json) + assert page_h_ref_next_model != False + + # Construct a model instance of PageHRefNext by calling from_dict on the json representation + page_h_ref_next_model_dict = PageHRefNext.from_dict(page_h_ref_next_model_json).__dict__ + page_h_ref_next_model2 = PageHRefNext(**page_h_ref_next_model_dict) + + # Verify the model instances are equivalent + assert page_h_ref_next_model == page_h_ref_next_model2 + + # Convert model instance back to dict and verify no loss of data + page_h_ref_next_model_json2 = page_h_ref_next_model.to_dict() + assert page_h_ref_next_model_json2 == page_h_ref_next_model_json + + +class TestModel_Parameter: + """ + Test Class for Parameter + """ + + def test_parameter_serialization(self): + """ + Test serialization/deserialization for Parameter + """ + + # Construct a json representation of a Parameter model + parameter_model_json = {} + parameter_model_json['assessment_type'] = 'testString' + parameter_model_json['assessment_id'] = 'testString' + parameter_model_json['parameter_name'] = 'location' + parameter_model_json['parameter_display_name'] = 'Location' + parameter_model_json['parameter_type'] = 'string' + parameter_model_json['parameter_value'] = 'testString' + + # Construct a model instance of Parameter by calling from_dict on the json representation + parameter_model = Parameter.from_dict(parameter_model_json) + assert parameter_model != False + + # Construct a model instance of Parameter by calling from_dict on the json representation + parameter_model_dict = Parameter.from_dict(parameter_model_json).__dict__ + parameter_model2 = Parameter(**parameter_model_dict) + + # Verify the model instances are equivalent + assert parameter_model == parameter_model2 + + # Convert model instance back to dict and verify no loss of data + parameter_model_json2 = parameter_model.to_dict() + assert parameter_model_json2 == parameter_model_json + + +class TestModel_Profile: + """ + Test Class for Profile + """ + + def test_profile_serialization(self): + """ + Test serialization/deserialization for Profile + """ + + # Construct dict forms of any model objects needed in order to build this model. + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + profile_controls_in_response_model = {} # ProfileControlsInResponse + profile_controls_in_response_model['control_requirement'] = True + profile_controls_in_response_model['control_library_id'] = 'testString' + profile_controls_in_response_model['control_id'] = 'testString' + profile_controls_in_response_model['control_library_version'] = 'testString' + profile_controls_in_response_model['control_name'] = 'testString' + profile_controls_in_response_model['control_description'] = 'testString' + profile_controls_in_response_model['control_severity'] = 'testString' + profile_controls_in_response_model['control_category'] = 'testString' + profile_controls_in_response_model['control_parent'] = 'testString' + profile_controls_in_response_model['control_docs'] = control_doc_model + profile_controls_in_response_model['control_specifications'] = [control_specification_model] + + default_parameters_model = {} # DefaultParameters + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Construct a json representation of a Profile model + profile_model_json = {} + profile_model_json['id'] = 'testString' + profile_model_json['profile_name'] = 'testString' + profile_model_json['instance_id'] = 'testString' + profile_model_json['hierarchy_enabled'] = True + profile_model_json['profile_description'] = 'testString' + profile_model_json['profile_type'] = 'custom' + profile_model_json['profile_version'] = 'testString' + profile_model_json['version_group_label'] = 'testString' + profile_model_json['latest'] = True + profile_model_json['created_by'] = 'testString' + profile_model_json['created_on'] = '2019-01-01T12:00:00Z' + profile_model_json['updated_by'] = 'testString' + profile_model_json['updated_on'] = '2019-01-01T12:00:00Z' + profile_model_json['controls_count'] = 38 + profile_model_json['attachments_count'] = 38 + profile_model_json['controls'] = [profile_controls_in_response_model] + profile_model_json['default_parameters'] = [default_parameters_model] + + # Construct a model instance of Profile by calling from_dict on the json representation + profile_model = Profile.from_dict(profile_model_json) + assert profile_model != False + + # Construct a model instance of Profile by calling from_dict on the json representation + profile_model_dict = Profile.from_dict(profile_model_json).__dict__ + profile_model2 = Profile(**profile_model_dict) + + # Verify the model instances are equivalent + assert profile_model == profile_model2 + + # Convert model instance back to dict and verify no loss of data + profile_model_json2 = profile_model.to_dict() + assert profile_model_json2 == profile_model_json + + +class TestModel_ProfileAttachment: + """ + Test Class for ProfileAttachment + """ + + def test_profile_attachment_serialization(self): + """ + Test serialization/deserialization for ProfileAttachment + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + attachment_notifications_model = {} # AttachmentNotifications + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + multi_cloud_scope_payload_model = {} # MultiCloudScopePayload + multi_cloud_scope_payload_model['id'] = 'testString' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + date_range_model = {} # DateRange + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + last_scan_model = {} # LastScan + last_scan_model['id'] = 'testString' + last_scan_model['status'] = 'testString' + last_scan_model['time'] = '2019-01-01T12:00:00Z' + + # Construct a json representation of a ProfileAttachment model + profile_attachment_model_json = {} + profile_attachment_model_json['attachment_parameters'] = [parameter_model] + profile_attachment_model_json['description'] = 'testString' + profile_attachment_model_json['name'] = 'testString' + profile_attachment_model_json['notifications'] = attachment_notifications_model + profile_attachment_model_json['schedule'] = 'daily' + profile_attachment_model_json['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_model_json['status'] = 'enabled' + profile_attachment_model_json['data_selection_range'] = date_range_model + profile_attachment_model_json['account_id'] = 'testString' + profile_attachment_model_json['created_by'] = 'testString' + profile_attachment_model_json['created_on'] = '2019-01-01T12:00:00Z' + profile_attachment_model_json['id'] = 'testString' + profile_attachment_model_json['instance_id'] = 'testString' + profile_attachment_model_json['last_scan'] = last_scan_model + profile_attachment_model_json['next_scan_time'] = '2019-01-01T12:00:00Z' + profile_attachment_model_json['profile_id'] = 'testString' + profile_attachment_model_json['updated_by'] = 'testString' + profile_attachment_model_json['updated_on'] = '2019-01-01T12:00:00Z' + + # Construct a model instance of ProfileAttachment by calling from_dict on the json representation + profile_attachment_model = ProfileAttachment.from_dict(profile_attachment_model_json) + assert profile_attachment_model != False + + # Construct a model instance of ProfileAttachment by calling from_dict on the json representation + profile_attachment_model_dict = ProfileAttachment.from_dict(profile_attachment_model_json).__dict__ + profile_attachment_model2 = ProfileAttachment(**profile_attachment_model_dict) + + # Verify the model instances are equivalent + assert profile_attachment_model == profile_attachment_model2 + + # Convert model instance back to dict and verify no loss of data + profile_attachment_model_json2 = profile_attachment_model.to_dict() + assert profile_attachment_model_json2 == profile_attachment_model_json + + +class TestModel_ProfileAttachmentBase: + """ + Test Class for ProfileAttachmentBase + """ + + def test_profile_attachment_base_serialization(self): + """ + Test serialization/deserialization for ProfileAttachmentBase + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + attachment_notifications_model = {} # AttachmentNotifications + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + multi_cloud_scope_payload_model = {} # MultiCloudScopePayload + multi_cloud_scope_payload_model['id'] = 'testString' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + date_range_model = {} # DateRange + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + # Construct a json representation of a ProfileAttachmentBase model + profile_attachment_base_model_json = {} + profile_attachment_base_model_json['attachment_parameters'] = [parameter_model] + profile_attachment_base_model_json['description'] = 'testString' + profile_attachment_base_model_json['name'] = 'testString' + profile_attachment_base_model_json['notifications'] = attachment_notifications_model + profile_attachment_base_model_json['schedule'] = 'daily' + profile_attachment_base_model_json['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_base_model_json['status'] = 'enabled' + profile_attachment_base_model_json['data_selection_range'] = date_range_model + + # Construct a model instance of ProfileAttachmentBase by calling from_dict on the json representation + profile_attachment_base_model = ProfileAttachmentBase.from_dict(profile_attachment_base_model_json) + assert profile_attachment_base_model != False + + # Construct a model instance of ProfileAttachmentBase by calling from_dict on the json representation + profile_attachment_base_model_dict = ProfileAttachmentBase.from_dict(profile_attachment_base_model_json).__dict__ + profile_attachment_base_model2 = ProfileAttachmentBase(**profile_attachment_base_model_dict) + + # Verify the model instances are equivalent + assert profile_attachment_base_model == profile_attachment_base_model2 + + # Convert model instance back to dict and verify no loss of data + profile_attachment_base_model_json2 = profile_attachment_base_model.to_dict() + assert profile_attachment_base_model_json2 == profile_attachment_base_model_json + + +class TestModel_ProfileAttachmentCollection: + """ + Test Class for ProfileAttachmentCollection + """ + + def test_profile_attachment_collection_serialization(self): + """ + Test serialization/deserialization for ProfileAttachmentCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + attachment_notifications_model = {} # AttachmentNotifications + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + multi_cloud_scope_payload_model = {} # MultiCloudScopePayload + multi_cloud_scope_payload_model['id'] = 'testString' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + date_range_model = {} # DateRange + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + last_scan_model = {} # LastScan + last_scan_model['id'] = 'testString' + last_scan_model['status'] = 'testString' + last_scan_model['time'] = '2019-01-01T12:00:00Z' + + profile_attachment_model = {} # ProfileAttachment + profile_attachment_model['attachment_parameters'] = [parameter_model] + profile_attachment_model['description'] = 'testString' + profile_attachment_model['name'] = 'testString' + profile_attachment_model['notifications'] = attachment_notifications_model + profile_attachment_model['schedule'] = 'daily' + profile_attachment_model['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_model['status'] = 'enabled' + profile_attachment_model['data_selection_range'] = date_range_model + profile_attachment_model['account_id'] = 'testString' + profile_attachment_model['created_by'] = 'testString' + profile_attachment_model['created_on'] = '2019-01-01T12:00:00Z' + profile_attachment_model['id'] = 'testString' + profile_attachment_model['instance_id'] = 'testString' + profile_attachment_model['last_scan'] = last_scan_model + profile_attachment_model['next_scan_time'] = '2019-01-01T12:00:00Z' + profile_attachment_model['profile_id'] = 'testString' + profile_attachment_model['updated_by'] = 'testString' + profile_attachment_model['updated_on'] = '2019-01-01T12:00:00Z' + + # Construct a json representation of a ProfileAttachmentCollection model + profile_attachment_collection_model_json = {} + profile_attachment_collection_model_json['limit'] = 50 + profile_attachment_collection_model_json['total_count'] = 230 + profile_attachment_collection_model_json['first'] = page_h_ref_first_model + profile_attachment_collection_model_json['next'] = page_h_ref_next_model + profile_attachment_collection_model_json['attachments'] = [profile_attachment_model] + + # Construct a model instance of ProfileAttachmentCollection by calling from_dict on the json representation + profile_attachment_collection_model = ProfileAttachmentCollection.from_dict(profile_attachment_collection_model_json) + assert profile_attachment_collection_model != False + + # Construct a model instance of ProfileAttachmentCollection by calling from_dict on the json representation + profile_attachment_collection_model_dict = ProfileAttachmentCollection.from_dict(profile_attachment_collection_model_json).__dict__ + profile_attachment_collection_model2 = ProfileAttachmentCollection(**profile_attachment_collection_model_dict) + + # Verify the model instances are equivalent + assert profile_attachment_collection_model == profile_attachment_collection_model2 + + # Convert model instance back to dict and verify no loss of data + profile_attachment_collection_model_json2 = profile_attachment_collection_model.to_dict() + assert profile_attachment_collection_model_json2 == profile_attachment_collection_model_json + + +class TestModel_ProfileAttachmentResponse: + """ + Test Class for ProfileAttachmentResponse + """ + + def test_profile_attachment_response_serialization(self): + """ + Test serialization/deserialization for ProfileAttachmentResponse + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + attachment_notifications_model = {} # AttachmentNotifications + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + multi_cloud_scope_payload_model = {} # MultiCloudScopePayload + multi_cloud_scope_payload_model['id'] = 'testString' + multi_cloud_scope_payload_model['environment'] = 'testString' + multi_cloud_scope_payload_model['properties'] = [scope_property_model] + + date_range_model = {} # DateRange + date_range_model['start_date'] = '2025-02-28T05:42:58Z' + date_range_model['end_date'] = '2025-02-28T05:42:58Z' + + last_scan_model = {} # LastScan + last_scan_model['id'] = 'testString' + last_scan_model['status'] = 'testString' + last_scan_model['time'] = '2019-01-01T12:00:00Z' + + profile_attachment_model = {} # ProfileAttachment + profile_attachment_model['attachment_parameters'] = [parameter_model] + profile_attachment_model['description'] = 'testString' + profile_attachment_model['name'] = 'testString' + profile_attachment_model['notifications'] = attachment_notifications_model + profile_attachment_model['schedule'] = 'daily' + profile_attachment_model['scope'] = [multi_cloud_scope_payload_model] + profile_attachment_model['status'] = 'enabled' + profile_attachment_model['data_selection_range'] = date_range_model + profile_attachment_model['account_id'] = 'testString' + profile_attachment_model['created_by'] = 'testString' + profile_attachment_model['created_on'] = '2019-01-01T12:00:00Z' + profile_attachment_model['id'] = 'testString' + profile_attachment_model['instance_id'] = 'testString' + profile_attachment_model['last_scan'] = last_scan_model + profile_attachment_model['next_scan_time'] = '2019-01-01T12:00:00Z' + profile_attachment_model['profile_id'] = 'testString' + profile_attachment_model['updated_by'] = 'testString' + profile_attachment_model['updated_on'] = '2019-01-01T12:00:00Z' + + # Construct a json representation of a ProfileAttachmentResponse model + profile_attachment_response_model_json = {} + profile_attachment_response_model_json['profile_id'] = 'testString' + profile_attachment_response_model_json['attachments'] = [profile_attachment_model] + + # Construct a model instance of ProfileAttachmentResponse by calling from_dict on the json representation + profile_attachment_response_model = ProfileAttachmentResponse.from_dict(profile_attachment_response_model_json) + assert profile_attachment_response_model != False + + # Construct a model instance of ProfileAttachmentResponse by calling from_dict on the json representation + profile_attachment_response_model_dict = ProfileAttachmentResponse.from_dict(profile_attachment_response_model_json).__dict__ + profile_attachment_response_model2 = ProfileAttachmentResponse(**profile_attachment_response_model_dict) + + # Verify the model instances are equivalent + assert profile_attachment_response_model == profile_attachment_response_model2 + + # Convert model instance back to dict and verify no loss of data + profile_attachment_response_model_json2 = profile_attachment_response_model.to_dict() + assert profile_attachment_response_model_json2 == profile_attachment_response_model_json + + +class TestModel_ProfileCollection: + """ + Test Class for ProfileCollection + """ + + def test_profile_collection_serialization(self): + """ + Test serialization/deserialization for ProfileCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + profile_controls_in_response_model = {} # ProfileControlsInResponse + profile_controls_in_response_model['control_requirement'] = True + profile_controls_in_response_model['control_library_id'] = 'testString' + profile_controls_in_response_model['control_id'] = 'testString' + profile_controls_in_response_model['control_library_version'] = 'testString' + profile_controls_in_response_model['control_name'] = 'testString' + profile_controls_in_response_model['control_description'] = 'testString' + profile_controls_in_response_model['control_severity'] = 'testString' + profile_controls_in_response_model['control_category'] = 'testString' + profile_controls_in_response_model['control_parent'] = 'testString' + profile_controls_in_response_model['control_docs'] = control_doc_model + profile_controls_in_response_model['control_specifications'] = [control_specification_model] + + default_parameters_model = {} # DefaultParameters + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + profile_model = {} # Profile + profile_model['id'] = 'testString' + profile_model['profile_name'] = 'testString' + profile_model['instance_id'] = 'testString' + profile_model['hierarchy_enabled'] = True + profile_model['profile_description'] = 'testString' + profile_model['profile_type'] = 'custom' + profile_model['profile_version'] = 'testString' + profile_model['version_group_label'] = 'testString' + profile_model['latest'] = True + profile_model['created_by'] = 'testString' + profile_model['created_on'] = '2019-01-01T12:00:00Z' + profile_model['updated_by'] = 'testString' + profile_model['updated_on'] = '2019-01-01T12:00:00Z' + profile_model['controls_count'] = 38 + profile_model['attachments_count'] = 38 + profile_model['controls'] = [profile_controls_in_response_model] + profile_model['default_parameters'] = [default_parameters_model] + + # Construct a json representation of a ProfileCollection model + profile_collection_model_json = {} + profile_collection_model_json['limit'] = 50 + profile_collection_model_json['total_count'] = 230 + profile_collection_model_json['first'] = page_h_ref_first_model + profile_collection_model_json['next'] = page_h_ref_next_model + profile_collection_model_json['profiles'] = [profile_model] + + # Construct a model instance of ProfileCollection by calling from_dict on the json representation + profile_collection_model = ProfileCollection.from_dict(profile_collection_model_json) + assert profile_collection_model != False + + # Construct a model instance of ProfileCollection by calling from_dict on the json representation + profile_collection_model_dict = ProfileCollection.from_dict(profile_collection_model_json).__dict__ + profile_collection_model2 = ProfileCollection(**profile_collection_model_dict) + + # Verify the model instances are equivalent + assert profile_collection_model == profile_collection_model2 + + # Convert model instance back to dict and verify no loss of data + profile_collection_model_json2 = profile_collection_model.to_dict() + assert profile_collection_model_json2 == profile_collection_model_json + + +class TestModel_ProfileControlsInResponse: + """ + Test Class for ProfileControlsInResponse + """ + + def test_profile_controls_in_response_serialization(self): + """ + Test serialization/deserialization for ProfileControlsInResponse + """ + + # Construct dict forms of any model objects needed in order to build this model. + + control_doc_model = {} # ControlDoc + control_doc_model['control_docs_id'] = 'testString' + control_doc_model['control_docs_type'] = 'testString' + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_model = {} # Assessment + assessment_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_model['assessment_type'] = 'ibm-cloud-rule' + assessment_model['assessment_method'] = 'ibm-cloud-rule' + assessment_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_model['parameter_count'] = 1 + assessment_model['parameters'] = [parameter_model] + + control_specification_model = {} # ControlSpecification + control_specification_model['id'] = 'testString' + control_specification_model['responsibility'] = 'testString' + control_specification_model['component_id'] = 'testString' + control_specification_model['component_name'] = 'testString' + control_specification_model['component_type'] = 'testString' + control_specification_model['environment'] = 'testString' + control_specification_model['description'] = 'testString' + control_specification_model['assessments_count'] = 38 + control_specification_model['assessments'] = [assessment_model] + + # Construct a json representation of a ProfileControlsInResponse model + profile_controls_in_response_model_json = {} + profile_controls_in_response_model_json['control_requirement'] = True + profile_controls_in_response_model_json['control_library_id'] = 'testString' + profile_controls_in_response_model_json['control_id'] = 'testString' + profile_controls_in_response_model_json['control_library_version'] = 'testString' + profile_controls_in_response_model_json['control_name'] = 'testString' + profile_controls_in_response_model_json['control_description'] = 'testString' + profile_controls_in_response_model_json['control_severity'] = 'testString' + profile_controls_in_response_model_json['control_category'] = 'testString' + profile_controls_in_response_model_json['control_parent'] = 'testString' + profile_controls_in_response_model_json['control_docs'] = control_doc_model + profile_controls_in_response_model_json['control_specifications'] = [control_specification_model] + + # Construct a model instance of ProfileControlsInResponse by calling from_dict on the json representation + profile_controls_in_response_model = ProfileControlsInResponse.from_dict(profile_controls_in_response_model_json) + assert profile_controls_in_response_model != False + + # Construct a model instance of ProfileControlsInResponse by calling from_dict on the json representation + profile_controls_in_response_model_dict = ProfileControlsInResponse.from_dict(profile_controls_in_response_model_json).__dict__ + profile_controls_in_response_model2 = ProfileControlsInResponse(**profile_controls_in_response_model_dict) + + # Verify the model instances are equivalent + assert profile_controls_in_response_model == profile_controls_in_response_model2 + + # Convert model instance back to dict and verify no loss of data + profile_controls_in_response_model_json2 = profile_controls_in_response_model.to_dict() + assert profile_controls_in_response_model_json2 == profile_controls_in_response_model_json + + +class TestModel_ProfileControlsPrototype: + """ + Test Class for ProfileControlsPrototype + """ + + def test_profile_controls_prototype_serialization(self): + """ + Test serialization/deserialization for ProfileControlsPrototype + """ + + # Construct a json representation of a ProfileControlsPrototype model + profile_controls_prototype_model_json = {} + profile_controls_prototype_model_json['control_library_id'] = 'testString' + profile_controls_prototype_model_json['control_id'] = 'testString' + + # Construct a model instance of ProfileControlsPrototype by calling from_dict on the json representation + profile_controls_prototype_model = ProfileControlsPrototype.from_dict(profile_controls_prototype_model_json) + assert profile_controls_prototype_model != False + + # Construct a model instance of ProfileControlsPrototype by calling from_dict on the json representation + profile_controls_prototype_model_dict = ProfileControlsPrototype.from_dict(profile_controls_prototype_model_json).__dict__ + profile_controls_prototype_model2 = ProfileControlsPrototype(**profile_controls_prototype_model_dict) + + # Verify the model instances are equivalent + assert profile_controls_prototype_model == profile_controls_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + profile_controls_prototype_model_json2 = profile_controls_prototype_model.to_dict() + assert profile_controls_prototype_model_json2 == profile_controls_prototype_model_json + + +class TestModel_ProfileDefaultParametersResponse: + """ + Test Class for ProfileDefaultParametersResponse + """ + + def test_profile_default_parameters_response_serialization(self): + """ + Test serialization/deserialization for ProfileDefaultParametersResponse + """ + + # Construct dict forms of any model objects needed in order to build this model. + + default_parameters_model = {} # DefaultParameters + default_parameters_model['assessment_type'] = 'testString' + default_parameters_model['assessment_id'] = 'testString' + default_parameters_model['parameter_name'] = 'testString' + default_parameters_model['parameter_default_value'] = 'testString' + default_parameters_model['parameter_display_name'] = 'testString' + default_parameters_model['parameter_type'] = 'testString' + + # Construct a json representation of a ProfileDefaultParametersResponse model + profile_default_parameters_response_model_json = {} + profile_default_parameters_response_model_json['id'] = 'testString' + profile_default_parameters_response_model_json['default_parameters'] = [default_parameters_model] + + # Construct a model instance of ProfileDefaultParametersResponse by calling from_dict on the json representation + profile_default_parameters_response_model = ProfileDefaultParametersResponse.from_dict(profile_default_parameters_response_model_json) + assert profile_default_parameters_response_model != False + + # Construct a model instance of ProfileDefaultParametersResponse by calling from_dict on the json representation + profile_default_parameters_response_model_dict = ProfileDefaultParametersResponse.from_dict(profile_default_parameters_response_model_json).__dict__ + profile_default_parameters_response_model2 = ProfileDefaultParametersResponse(**profile_default_parameters_response_model_dict) + + # Verify the model instances are equivalent + assert profile_default_parameters_response_model == profile_default_parameters_response_model2 + + # Convert model instance back to dict and verify no loss of data + profile_default_parameters_response_model_json2 = profile_default_parameters_response_model.to_dict() + assert profile_default_parameters_response_model_json2 == profile_default_parameters_response_model_json + + +class TestModel_ProfileInfo: + """ + Test Class for ProfileInfo + """ + + def test_profile_info_serialization(self): + """ + Test serialization/deserialization for ProfileInfo + """ + + # Construct a json representation of a ProfileInfo model + profile_info_model_json = {} + profile_info_model_json['id'] = '44a5-a292-32114fa73558' + profile_info_model_json['name'] = 'IBM FS Cloud' + profile_info_model_json['version'] = '0.1' + + # Construct a model instance of ProfileInfo by calling from_dict on the json representation + profile_info_model = ProfileInfo.from_dict(profile_info_model_json) + assert profile_info_model != False + + # Construct a model instance of ProfileInfo by calling from_dict on the json representation + profile_info_model_dict = ProfileInfo.from_dict(profile_info_model_json).__dict__ + profile_info_model2 = ProfileInfo(**profile_info_model_dict) + + # Verify the model instances are equivalent + assert profile_info_model == profile_info_model2 + + # Convert model instance back to dict and verify no loss of data + profile_info_model_json2 = profile_info_model.to_dict() + assert profile_info_model_json2 == profile_info_model_json + + +class TestModel_ProviderType: + """ + Test Class for ProviderType + """ + + def test_provider_type_serialization(self): + """ + Test serialization/deserialization for ProviderType + """ + + # Construct dict forms of any model objects needed in order to build this model. + + label_type_model = {} # LabelType + label_type_model['text'] = '1 per instance' + label_type_model['tip'] = 'Only 1 per instance' + + additional_property_model = {} # AdditionalProperty + additional_property_model['type'] = 'text' + additional_property_model['display_name'] = 'Workload Protection Instance CRN' + + # Construct a json representation of a ProviderType model + provider_type_model_json = {} + provider_type_model_json['id'] = '7588190cce3c05ac8f7942ea597dafce' + provider_type_model_json['type'] = 'workload-protection' + provider_type_model_json['name'] = 'workload-protection' + provider_type_model_json['description'] = 'Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.' + provider_type_model_json['s2s_enabled'] = True + provider_type_model_json['instance_limit'] = 1 + provider_type_model_json['mode'] = 'PULL' + provider_type_model_json['data_type'] = 'com.sysdig.secure.results' + provider_type_model_json['icon'] = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+' + provider_type_model_json['label'] = label_type_model + provider_type_model_json['attributes'] = {'key1': additional_property_model} + provider_type_model_json['created_at'] = '2023-07-24T13:14:18.884000Z' + provider_type_model_json['updated_at'] = '2023-07-24T13:14:18.884000Z' + + # Construct a model instance of ProviderType by calling from_dict on the json representation + provider_type_model = ProviderType.from_dict(provider_type_model_json) + assert provider_type_model != False + + # Construct a model instance of ProviderType by calling from_dict on the json representation + provider_type_model_dict = ProviderType.from_dict(provider_type_model_json).__dict__ + provider_type_model2 = ProviderType(**provider_type_model_dict) + + # Verify the model instances are equivalent + assert provider_type_model == provider_type_model2 + + # Convert model instance back to dict and verify no loss of data + provider_type_model_json2 = provider_type_model.to_dict() + assert provider_type_model_json2 == provider_type_model_json + + +class TestModel_ProviderTypeCollection: + """ + Test Class for ProviderTypeCollection + """ + + def test_provider_type_collection_serialization(self): + """ + Test serialization/deserialization for ProviderTypeCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + label_type_model = {} # LabelType + label_type_model['text'] = '1 per instance' + label_type_model['tip'] = 'Only 1 per instance' + + additional_property_model = {} # AdditionalProperty + additional_property_model['type'] = 'text' + additional_property_model['display_name'] = 'Workload Protection Instance CRN' + + provider_type_model = {} # ProviderType + provider_type_model['id'] = '7588190cce3c05ac8f7942ea597dafce' + provider_type_model['type'] = 'workload-protection' + provider_type_model['name'] = 'workload-protection' + provider_type_model['description'] = 'Security and Compliance Center Workload Protection helps you accelerate your Kubernetes and cloud adoption by addressing security and regulatory compliance. Easily identify vulnerabilities, check compliance, block threats and respond faster at every stage of the container and Kubernetes lifecycle.' + provider_type_model['s2s_enabled'] = True + provider_type_model['instance_limit'] = 1 + provider_type_model['mode'] = 'PULL' + provider_type_model['data_type'] = 'com.sysdig.secure.results' + provider_type_model['icon'] = 'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiBkYXRhLW5hbWU9IkJ1aWxkIGljb24gaGVyZSIgdmlld0JveD0iMCAwIDMyIDMyIj48ZGVmcz48bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSItMjgxMS4xOTgiIHgyPSItMjgxNC4xOTgiIHkxPSI1NTcuNTE3IiB5Mj0iNTU3LjUxNyIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSgyODMxLjE5OCAtNTQyLjAxNykiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLW9wYWNpdHk9IjAiLz48c3RvcCBvZmZzZXQ9Ii44Ii8+PC9saW5lYXJHcmFkaWVudD48bGluZWFyR3JhZGllbnQgeGxpbms6aHJlZj0iI2EiIGlkPSJiIiB4MT0iLTgwNi4xOTgiIHgyPSItNzk5LjE5OCIgeTE9Ii0yNDE0LjQ4MSIgeTI9Ii0yNDE0LjQ4MSIgZ3JhZGllbnRUcmFuc2Zvcm09InRyYW5zbGF0ZSg4MjUuMTk4IDI0MjguOTgxKSIvPjxsaW5lYXJHcmFkaWVudCB4bGluazpocmVmPSIjYSIgaWQ9ImMiIHgxPSItODEwLjE5OCIgeDI9Ii03OTguMTk4IiB5MT0iLTI0MTkuOTgxIiB5Mj0iLTI0MTkuOTgxIiBncmFkaWVudFRyYW5zZm9ybT0idHJhbnNsYXRlKDgzMi4xOTggMjQzMi45ODEpIi8+PGxpbmVhckdyYWRpZW50IGlkPSJlIiB4MT0iLTI1MTQiIHgyPSItMjQ4MiIgeTE9Ii0yNDgyIiB5Mj0iLTI1MTQiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMjUxNCAtMjQ4MikiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj48c3RvcCBvZmZzZXQ9Ii4xIiBzdG9wLWNvbG9yPSIjMDhiZGJhIi8+PHN0b3Agb2Zmc2V0PSIuOSIgc3RvcC1jb2xvcj0iIzBmNjJmZSIvPjwvbGluZWFyR3JhZGllbnQ+PG1hc2sgaWQ9ImQiIHdpZHRoPSIyOS4wMTciIGhlaWdodD0iMjcuOTk2IiB4PSIxLjk4MyIgeT0iMiIgZGF0YS1uYW1lPSJtYXNrIiBtYXNrVW5pdHM9InVzZXJTcGFjZU9uVXNlIj48ZyBmaWxsPSIjZmZmIj48cGF0aCBkPSJNMjkuOTc2IDE2YzAtMy43MzktMS40NTYtNy4yNTUtNC4xMDEtOS44OTlTMTkuNzE1IDIgMTUuOTc2IDIgOC43MjEgMy40NTYgNi4wNzcgNi4xMDFjLTUuNDU5IDUuNDU5LTUuNDU5IDE0LjM0IDAgMTkuNzk4QTE0LjA0NCAxNC4wNDQgMCAwIDAgMTYgMjkuOTk1di0yLjAwMWExMi4wNCAxMi4wNCAwIDAgMS04LjUwOS0zLjUxYy00LjY3OS00LjY3OS00LjY3OS0xMi4yOTIgMC0xNi45NzEgMi4yNjctMi4yNjcgNS4yOC0zLjUxNSA4LjQ4NS0zLjUxNXM2LjIxOSAxLjI0OCA4LjQ4NSAzLjUxNSAzLjUxNSA1LjI4IDMuNTE1IDguNDg1YzAgMS4zMDgtLjIxOCAyLjU4LS42MTggMy43ODZsMS44OTcuNjMyYy40NjctMS40MDguNzIyLTIuODkyLjcyMi00LjQxOFoiLz48cGF0aCBkPSJNMjQuNyAxMy42NzVhOC45NCA4Ljk0IDAgMCAwLTQuMTkzLTUuNDY1IDguOTQyIDguOTQyIDAgMCAwLTYuODMtLjg5OSA4Ljk3MSA4Ljk3MSAwIDAgMC01LjQ2MSA0LjE5NSA4Ljk4IDguOTggMCAwIDAtLjkwMyA2LjgyOGMxLjA3NyA0LjAxNiA0LjcyMiA2LjY2IDguNjk1IDYuNjYxdi0xLjk5OGMtMy4wOS0uMDAxLTUuOTI2LTIuMDU4LTYuNzYzLTUuMTgxYTcuMDEgNy4wMSAwIDAgMSA0Ljk1LTguNTc0IDYuOTU4IDYuOTU4IDAgMCAxIDUuMzEyLjY5OSA2Ljk1NCA2Ljk1NCAwIDAgMSAzLjI2MSA0LjI1Yy4zNTkgMS4zNDIuMjc1IDIuNzMyLS4xNTQgNC4wMTNsMS45MDkuNjM2YTguOTU5IDguOTU5IDAgMCAwIC4xNzYtNS4xNjdaIi8+PC9nPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xNCAxNmMwLTEuMTAzLjg5Ny0yIDItMnMyIC44OTcgMiAyYTIgMiAwIDAgMS0uMTExLjYzbDEuODg5LjYzYy4xMzMtLjM5OC4yMjItLjgxNy4yMjItMS4yNTlhNCA0IDAgMSAwLTQgNHYtMmMtMS4xMDMgMC0yLS44OTctMi0yWiIvPjxwYXRoIGZpbGw9InVybCgjYSkiIGQ9Ik0xNyAxNGgzdjNoLTN6IiB0cmFuc2Zvcm09InJvdGF0ZSgtOTAgMTguNSAxNS41KSIvPjxwYXRoIGZpbGw9InVybCgjYikiIGQ9Ik0xOSAxMmg3djVoLTd6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyMi41IDE0LjUpIi8+PHBhdGggZmlsbD0idXJsKCNjKSIgZD0iTTIyIDEwaDEydjZIMjJ6IiB0cmFuc2Zvcm09InJvdGF0ZSg5MCAyOCAxMykiLz48cGF0aCBkPSJNMjUgMTloNnY0aC02ek0yMCAxOGg1djVoLTV6TTE3IDE3aDN2NmgtM3oiLz48L21hc2s+PC9kZWZzPjxwYXRoIGZpbGw9IiMwMDFkNmMiIGQ9Im0yNSAzMS4wMDEtMi4xMzktMS4wMTNBNS4wMjIgNS4wMjIgMCAwIDEgMjAgMjUuNDY4VjE5aDEwdjYuNDY4YTUuMDIzIDUuMDIzIDAgMCAxLTIuODYxIDQuNTJMMjUgMzEuMDAxWm0tMy0xMHY0LjQ2OGMwIDEuMTUzLjY3NCAyLjIxOCAxLjcxNyAyLjcxMWwxLjI4My42MDcgMS4yODMtLjYwN0EzLjAxMiAzLjAxMiAwIDAgMCAyOCAyNS40Njl2LTQuNDY4aC02WiIgZGF0YS1uYW1lPSJ1dWlkLTU1ODMwNDRiLWZmMjQtNGUyNy05MDU0LTI0MDQzYWRkZmMwNiIvPjxnIG1hc2s9InVybCgjZCkiPjxwYXRoIGZpbGw9InVybCgjZSkiIGQ9Ik0wIDBoMzJ2MzJIMHoiIHRyYW5zZm9ybT0icm90YXRlKC05MCAxNiAxNikiLz48L2c+PC9zdmc+' + provider_type_model['label'] = label_type_model + provider_type_model['attributes'] = {'key1': additional_property_model} + provider_type_model['created_at'] = '2023-07-24T13:14:18.884000Z' + provider_type_model['updated_at'] = '2023-07-24T13:14:18.884000Z' + + # Construct a json representation of a ProviderTypeCollection model + provider_type_collection_model_json = {} + provider_type_collection_model_json['provider_types'] = [provider_type_model] + + # Construct a model instance of ProviderTypeCollection by calling from_dict on the json representation + provider_type_collection_model = ProviderTypeCollection.from_dict(provider_type_collection_model_json) + assert provider_type_collection_model != False + + # Construct a model instance of ProviderTypeCollection by calling from_dict on the json representation + provider_type_collection_model_dict = ProviderTypeCollection.from_dict(provider_type_collection_model_json).__dict__ + provider_type_collection_model2 = ProviderTypeCollection(**provider_type_collection_model_dict) + + # Verify the model instances are equivalent + assert provider_type_collection_model == provider_type_collection_model2 + + # Convert model instance back to dict and verify no loss of data + provider_type_collection_model_json2 = provider_type_collection_model.to_dict() + assert provider_type_collection_model_json2 == provider_type_collection_model_json + + +class TestModel_ProviderTypeInstance: + """ + Test Class for ProviderTypeInstance + """ + + def test_provider_type_instance_serialization(self): + """ + Test serialization/deserialization for ProviderTypeInstance + """ + + # Construct a json representation of a ProviderTypeInstance model + provider_type_instance_model_json = {} + provider_type_instance_model_json['id'] = '7588190cce3c05ac8f7942ea597dafce' + provider_type_instance_model_json['type'] = 'workload-protection' + provider_type_instance_model_json['name'] = 'workload-protection-instance-1' + provider_type_instance_model_json['attributes'] = {'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'} + provider_type_instance_model_json['created_at'] = '2023-07-24T13:14:18.884000Z' + provider_type_instance_model_json['updated_at'] = '2023-07-24T13:14:18.884000Z' + + # Construct a model instance of ProviderTypeInstance by calling from_dict on the json representation + provider_type_instance_model = ProviderTypeInstance.from_dict(provider_type_instance_model_json) + assert provider_type_instance_model != False + + # Construct a model instance of ProviderTypeInstance by calling from_dict on the json representation + provider_type_instance_model_dict = ProviderTypeInstance.from_dict(provider_type_instance_model_json).__dict__ + provider_type_instance_model2 = ProviderTypeInstance(**provider_type_instance_model_dict) + + # Verify the model instances are equivalent + assert provider_type_instance_model == provider_type_instance_model2 + + # Convert model instance back to dict and verify no loss of data + provider_type_instance_model_json2 = provider_type_instance_model.to_dict() + assert provider_type_instance_model_json2 == provider_type_instance_model_json + + +class TestModel_ProviderTypeInstanceCollection: + """ + Test Class for ProviderTypeInstanceCollection + """ + + def test_provider_type_instance_collection_serialization(self): + """ + Test serialization/deserialization for ProviderTypeInstanceCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + provider_type_instance_model = {} # ProviderTypeInstance + provider_type_instance_model['id'] = '7588190cce3c05ac8f7942ea597dafce' + provider_type_instance_model['type'] = 'workload-protection' + provider_type_instance_model['name'] = 'workload-protection-instance-1' + provider_type_instance_model['attributes'] = {'wp_crn': 'crn:v1:staging:public:sysdig-secure:eu-gb:a/14q5SEnVIbwxzvP4AWPCjr2dJg5BAvPb:d1461d1ae-df1eee12fa81812e0-12-aa259::'} + provider_type_instance_model['created_at'] = '2023-07-24T13:14:18.884000Z' + provider_type_instance_model['updated_at'] = '2023-07-24T13:14:18.884000Z' + + # Construct a json representation of a ProviderTypeInstanceCollection model + provider_type_instance_collection_model_json = {} + provider_type_instance_collection_model_json['provider_type_instances'] = [provider_type_instance_model] + + # Construct a model instance of ProviderTypeInstanceCollection by calling from_dict on the json representation + provider_type_instance_collection_model = ProviderTypeInstanceCollection.from_dict(provider_type_instance_collection_model_json) + assert provider_type_instance_collection_model != False + + # Construct a model instance of ProviderTypeInstanceCollection by calling from_dict on the json representation + provider_type_instance_collection_model_dict = ProviderTypeInstanceCollection.from_dict(provider_type_instance_collection_model_json).__dict__ + provider_type_instance_collection_model2 = ProviderTypeInstanceCollection(**provider_type_instance_collection_model_dict) + + # Verify the model instances are equivalent + assert provider_type_instance_collection_model == provider_type_instance_collection_model2 + + # Convert model instance back to dict and verify no loss of data + provider_type_instance_collection_model_json2 = provider_type_instance_collection_model.to_dict() + assert provider_type_instance_collection_model_json2 == provider_type_instance_collection_model_json + + +class TestModel_Report: + """ + Test Class for Report + """ + + def test_report_serialization(self): + """ + Test serialization/deserialization for Report + """ + + # Construct dict forms of any model objects needed in order to build this model. + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + profile_info_model = {} # ProfileInfo + profile_info_model['id'] = '44a5-a292-32114fa73558' + profile_info_model['name'] = 'IBM FS Cloud' + profile_info_model['version'] = '0.1' + + scope_id_model = {} # ScopeID + scope_id_model['id'] = '2411ffdc16844b07b42521c3443f456d' + scope_id_model['type'] = 'account' + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + scope_model = {} # Scope + scope_model['id'] = 'testString' + scope_model['name'] = 'testString' + scope_model['description'] = 'testString' + scope_model['environment'] = 'testString' + scope_model['properties'] = [scope_property_model] + scope_model['account_id'] = 'testString' + scope_model['instance_id'] = 'testString' + scope_model['created_by'] = 'testString' + scope_model['created_on'] = '2019-01-01T12:00:00Z' + scope_model['updated_by'] = 'testString' + scope_model['updated_on'] = '2019-01-01T12:00:00Z' + scope_model['attachment_count'] = 72.5 + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + attachment_notifications_model = {} # AttachmentNotifications + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + attachment_model = {} # Attachment + attachment_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + attachment_model['name'] = 'resource group - Default' + attachment_model['description'] = 'Scoped to the Default resource group' + attachment_model['schedule'] = 'daily' + attachment_model['scope'] = 'testString' + attachment_model['scopes'] = [scope_model] + attachment_model['notifications'] = attachment_notifications_model + + control_summary_model = {} # ControlSummary + control_summary_model['id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + control_summary_model['control_name'] = 'ibm-cloud-rule' + control_summary_model['control_description'] = 'Ensure security questions are registered by the account owner' + + compliance_stats_with_non_compliant_model = {} # ComplianceStatsWithNonCompliant + compliance_stats_with_non_compliant_model['status'] = 'compliant' + compliance_stats_with_non_compliant_model['total_count'] = 150 + compliance_stats_with_non_compliant_model['compliant_count'] = 130 + compliance_stats_with_non_compliant_model['not_compliant_count'] = 5 + compliance_stats_with_non_compliant_model['unable_to_perform_count'] = 5 + compliance_stats_with_non_compliant_model['user_evaluation_required_count'] = 10 + compliance_stats_with_non_compliant_model['not_applicable_count'] = 7 + compliance_stats_with_non_compliant_model['not_compliant_controls'] = [control_summary_model] + + eval_stats_model = {} # EvalStats + eval_stats_model['status'] = 'compliant' + eval_stats_model['total_count'] = 140 + eval_stats_model['pass_count'] = 123 + eval_stats_model['failure_count'] = 12 + eval_stats_model['error_count'] = 5 + eval_stats_model['skipped_count'] = 7 + eval_stats_model['completed_count'] = 135 + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + report_scope_model = {} # ReportScope + report_scope_model['id'] = 'testString' + report_scope_model['name'] = 'testString' + report_scope_model['href'] = 'testString' + + link_model = {} # Link + link_model['description'] = 'testString' + link_model['href'] = 'testString' + + additional_details_model = {} # AdditionalDetails + additional_details_model['created_by'] = 'Security and Compliance Center' + additional_details_model['labels'] = ['testString'] + additional_details_model['links'] = [link_model] + + # Construct a json representation of a Report model + report_model_json = {} + report_model_json['id'] = '44a5-a292-32114fa73558' + report_model_json['type'] = 'scheduled' + report_model_json['group_id'] = '55b6-b3A4-432250b84669' + report_model_json['created_on'] = '2022-08-15T12:30:01Z' + report_model_json['scan_time'] = '2022-08-15T12:30:01Z' + report_model_json['cos_object'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7' + report_model_json['instance_id'] = 'testString' + report_model_json['account'] = account_model + report_model_json['profile'] = profile_info_model + report_model_json['scope'] = scope_id_model + report_model_json['attachment'] = attachment_model + report_model_json['controls_summary'] = compliance_stats_with_non_compliant_model + report_model_json['evaluations_summary'] = eval_stats_model + report_model_json['tags'] = tags_model + report_model_json['scopes'] = [report_scope_model] + report_model_json['additional_details'] = additional_details_model + + # Construct a model instance of Report by calling from_dict on the json representation + report_model = Report.from_dict(report_model_json) + assert report_model != False + + # Construct a model instance of Report by calling from_dict on the json representation + report_model_dict = Report.from_dict(report_model_json).__dict__ + report_model2 = Report(**report_model_dict) + + # Verify the model instances are equivalent + assert report_model == report_model2 + + # Convert model instance back to dict and verify no loss of data + report_model_json2 = report_model.to_dict() + assert report_model_json2 == report_model_json + + +class TestModel_ReportCollection: + """ + Test Class for ReportCollection + """ + + def test_report_collection_serialization(self): + """ + Test serialization/deserialization for ReportCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + profile_info_model = {} # ProfileInfo + profile_info_model['id'] = '44a5-a292-32114fa73558' + profile_info_model['name'] = 'IBM FS Cloud' + profile_info_model['version'] = '0.1' + + scope_id_model = {} # ScopeID + scope_id_model['id'] = '2411ffdc16844b07b42521c3443f456d' + scope_id_model['type'] = 'account' + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + scope_model = {} # Scope + scope_model['id'] = 'testString' + scope_model['name'] = 'testString' + scope_model['description'] = 'testString' + scope_model['environment'] = 'testString' + scope_model['properties'] = [scope_property_model] + scope_model['account_id'] = 'testString' + scope_model['instance_id'] = 'testString' + scope_model['created_by'] = 'testString' + scope_model['created_on'] = '2019-01-01T12:00:00Z' + scope_model['updated_by'] = 'testString' + scope_model['updated_on'] = '2019-01-01T12:00:00Z' + scope_model['attachment_count'] = 72.5 + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + attachment_notifications_model = {} # AttachmentNotifications + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + attachment_model = {} # Attachment + attachment_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + attachment_model['name'] = 'resource group - Default' + attachment_model['description'] = 'Scoped to the Default resource group' + attachment_model['schedule'] = 'daily' + attachment_model['scope'] = 'testString' + attachment_model['scopes'] = [scope_model] + attachment_model['notifications'] = attachment_notifications_model + + control_summary_model = {} # ControlSummary + control_summary_model['id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + control_summary_model['control_name'] = 'ibm-cloud-rule' + control_summary_model['control_description'] = 'Ensure security questions are registered by the account owner' + + compliance_stats_with_non_compliant_model = {} # ComplianceStatsWithNonCompliant + compliance_stats_with_non_compliant_model['status'] = 'compliant' + compliance_stats_with_non_compliant_model['total_count'] = 150 + compliance_stats_with_non_compliant_model['compliant_count'] = 130 + compliance_stats_with_non_compliant_model['not_compliant_count'] = 5 + compliance_stats_with_non_compliant_model['unable_to_perform_count'] = 5 + compliance_stats_with_non_compliant_model['user_evaluation_required_count'] = 10 + compliance_stats_with_non_compliant_model['not_applicable_count'] = 7 + compliance_stats_with_non_compliant_model['not_compliant_controls'] = [control_summary_model] + + eval_stats_model = {} # EvalStats + eval_stats_model['status'] = 'compliant' + eval_stats_model['total_count'] = 140 + eval_stats_model['pass_count'] = 123 + eval_stats_model['failure_count'] = 12 + eval_stats_model['error_count'] = 5 + eval_stats_model['skipped_count'] = 7 + eval_stats_model['completed_count'] = 135 + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + report_scope_model = {} # ReportScope + report_scope_model['id'] = 'testString' + report_scope_model['name'] = 'testString' + report_scope_model['href'] = 'testString' + + link_model = {} # Link + link_model['description'] = 'testString' + link_model['href'] = 'testString' + + additional_details_model = {} # AdditionalDetails + additional_details_model['created_by'] = 'Security and Compliance Center' + additional_details_model['labels'] = ['testString'] + additional_details_model['links'] = [link_model] + + report_model = {} # Report + report_model['id'] = '44a5-a292-32114fa73558' + report_model['type'] = 'scheduled' + report_model['group_id'] = '55b6-b3A4-432250b84669' + report_model['created_on'] = '2022-08-15T12:30:01Z' + report_model['scan_time'] = '2022-08-15T12:30:01Z' + report_model['cos_object'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7' + report_model['instance_id'] = 'testString' + report_model['account'] = account_model + report_model['profile'] = profile_info_model + report_model['scope'] = scope_id_model + report_model['attachment'] = attachment_model + report_model['controls_summary'] = compliance_stats_with_non_compliant_model + report_model['evaluations_summary'] = eval_stats_model + report_model['tags'] = tags_model + report_model['scopes'] = [report_scope_model] + report_model['additional_details'] = additional_details_model + + # Construct a json representation of a ReportCollection model + report_collection_model_json = {} + report_collection_model_json['limit'] = 50 + report_collection_model_json['total_count'] = 230 + report_collection_model_json['first'] = page_h_ref_first_model + report_collection_model_json['next'] = page_h_ref_next_model + report_collection_model_json['home_account_id'] = 'testString' + report_collection_model_json['reports'] = [report_model] + + # Construct a model instance of ReportCollection by calling from_dict on the json representation + report_collection_model = ReportCollection.from_dict(report_collection_model_json) + assert report_collection_model != False + + # Construct a model instance of ReportCollection by calling from_dict on the json representation + report_collection_model_dict = ReportCollection.from_dict(report_collection_model_json).__dict__ + report_collection_model2 = ReportCollection(**report_collection_model_dict) + + # Verify the model instances are equivalent + assert report_collection_model == report_collection_model2 + + # Convert model instance back to dict and verify no loss of data + report_collection_model_json2 = report_collection_model.to_dict() + assert report_collection_model_json2 == report_collection_model_json + + +class TestModel_ReportControls: + """ + Test Class for ReportControls + """ + + def test_report_controls_serialization(self): + """ + Test serialization/deserialization for ReportControls + """ + + # Construct dict forms of any model objects needed in order to build this model. + + parameter_model = {} # Parameter + parameter_model['assessment_type'] = 'testString' + parameter_model['assessment_id'] = 'testString' + parameter_model['parameter_name'] = 'location' + parameter_model['parameter_display_name'] = 'Location' + parameter_model['parameter_type'] = 'string' + parameter_model['parameter_value'] = 'testString' + + assessment_with_stats_model = {} # AssessmentWithStats + assessment_with_stats_model['assessment_id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + assessment_with_stats_model['assessment_type'] = 'ibm-cloud-rule' + assessment_with_stats_model['assessment_method'] = 'ibm-cloud-rule' + assessment_with_stats_model['assessment_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + assessment_with_stats_model['parameter_count'] = 1 + assessment_with_stats_model['parameters'] = [parameter_model] + assessment_with_stats_model['total_count'] = 140 + assessment_with_stats_model['pass_count'] = 123 + assessment_with_stats_model['failure_count'] = 12 + assessment_with_stats_model['error_count'] = 5 + assessment_with_stats_model['completed_count'] = 135 + + control_specification_with_stats_model = {} # ControlSpecificationWithStats + control_specification_with_stats_model['control_specification_id'] = '18d32a4430e54c81a6668952609763b2' + control_specification_with_stats_model['control_specification_description'] = 'Check whether Cloud Object Storage is accessible only by using private endpoints' + control_specification_with_stats_model['component_id'] = 'cloud-object_storage' + control_specification_with_stats_model['component_name'] = 'cloud-object_storage' + control_specification_with_stats_model['environment'] = 'ibm cloud' + control_specification_with_stats_model['responsibility'] = 'user' + control_specification_with_stats_model['assessments'] = [assessment_with_stats_model] + control_specification_with_stats_model['status'] = 'compliant' + control_specification_with_stats_model['total_count'] = 150 + control_specification_with_stats_model['compliant_count'] = 130 + control_specification_with_stats_model['not_compliant_count'] = 5 + control_specification_with_stats_model['unable_to_perform_count'] = 5 + control_specification_with_stats_model['user_evaluation_required_count'] = 10 + control_specification_with_stats_model['not_applicable_count'] = 7 + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + control_with_stats_model = {} # ControlWithStats + control_with_stats_model['report_id'] = '6f1fdb98-c08b-41a8-a2f9-df10b51ff34a' + control_with_stats_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + control_with_stats_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + control_with_stats_model['control_library_id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + control_with_stats_model['control_library_version'] = 'v1.2.3' + control_with_stats_model['control_name'] = 'Password Management' + control_with_stats_model['control_description'] = 'Password Management' + control_with_stats_model['control_category'] = 'Access Control' + control_with_stats_model['control_specifications'] = [control_specification_with_stats_model] + control_with_stats_model['resource_tags'] = tags_model + control_with_stats_model['status'] = 'compliant' + control_with_stats_model['total_count'] = 150 + control_with_stats_model['compliant_count'] = 130 + control_with_stats_model['not_compliant_count'] = 5 + control_with_stats_model['unable_to_perform_count'] = 5 + control_with_stats_model['user_evaluation_required_count'] = 10 + control_with_stats_model['not_applicable_count'] = 7 + + # Construct a json representation of a ReportControls model + report_controls_model_json = {} + report_controls_model_json['report_id'] = 'testString' + report_controls_model_json['home_account_id'] = 'testString' + report_controls_model_json['controls'] = [control_with_stats_model] + + # Construct a model instance of ReportControls by calling from_dict on the json representation + report_controls_model = ReportControls.from_dict(report_controls_model_json) + assert report_controls_model != False + + # Construct a model instance of ReportControls by calling from_dict on the json representation + report_controls_model_dict = ReportControls.from_dict(report_controls_model_json).__dict__ + report_controls_model2 = ReportControls(**report_controls_model_dict) + + # Verify the model instances are equivalent + assert report_controls_model == report_controls_model2 + + # Convert model instance back to dict and verify no loss of data + report_controls_model_json2 = report_controls_model.to_dict() + assert report_controls_model_json2 == report_controls_model_json + + +class TestModel_ReportLatest: + """ + Test Class for ReportLatest + """ + + def test_report_latest_serialization(self): + """ + Test serialization/deserialization for ReportLatest + """ + + # Construct dict forms of any model objects needed in order to build this model. + + compliance_stats_model = {} # ComplianceStats + compliance_stats_model['status'] = 'compliant' + compliance_stats_model['total_count'] = 150 + compliance_stats_model['compliant_count'] = 130 + compliance_stats_model['not_compliant_count'] = 5 + compliance_stats_model['unable_to_perform_count'] = 5 + compliance_stats_model['user_evaluation_required_count'] = 10 + compliance_stats_model['not_applicable_count'] = 7 + + eval_stats_model = {} # EvalStats + eval_stats_model['status'] = 'compliant' + eval_stats_model['total_count'] = 140 + eval_stats_model['pass_count'] = 123 + eval_stats_model['failure_count'] = 12 + eval_stats_model['error_count'] = 5 + eval_stats_model['skipped_count'] = 7 + eval_stats_model['completed_count'] = 135 + + compliance_score_model = {} # ComplianceScore + compliance_score_model['passed'] = 1 + compliance_score_model['total_count'] = 4 + compliance_score_model['percent'] = 25 + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + profile_info_model = {} # ProfileInfo + profile_info_model['id'] = '44a5-a292-32114fa73558' + profile_info_model['name'] = 'IBM FS Cloud' + profile_info_model['version'] = '0.1' + + scope_id_model = {} # ScopeID + scope_id_model['id'] = '2411ffdc16844b07b42521c3443f456d' + scope_id_model['type'] = 'account' + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + scope_model = {} # Scope + scope_model['id'] = 'testString' + scope_model['name'] = 'testString' + scope_model['description'] = 'testString' + scope_model['environment'] = 'testString' + scope_model['properties'] = [scope_property_model] + scope_model['account_id'] = 'testString' + scope_model['instance_id'] = 'testString' + scope_model['created_by'] = 'testString' + scope_model['created_on'] = '2019-01-01T12:00:00Z' + scope_model['updated_by'] = 'testString' + scope_model['updated_on'] = '2019-01-01T12:00:00Z' + scope_model['attachment_count'] = 72.5 + + attachment_notifications_controls_model = {} # AttachmentNotificationsControls + attachment_notifications_controls_model['threshold_limit'] = 15 + attachment_notifications_controls_model['failed_control_ids'] = ['testString'] + + attachment_notifications_model = {} # AttachmentNotifications + attachment_notifications_model['enabled'] = True + attachment_notifications_model['controls'] = attachment_notifications_controls_model + + attachment_model = {} # Attachment + attachment_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + attachment_model['name'] = 'resource group - Default' + attachment_model['description'] = 'Scoped to the Default resource group' + attachment_model['schedule'] = 'daily' + attachment_model['scope'] = 'testString' + attachment_model['scopes'] = [scope_model] + attachment_model['notifications'] = attachment_notifications_model + + control_summary_model = {} # ControlSummary + control_summary_model['id'] = '382c2b06-e6b2-43ee-b189-c1c7743b67ee' + control_summary_model['control_name'] = 'ibm-cloud-rule' + control_summary_model['control_description'] = 'Ensure security questions are registered by the account owner' + + compliance_stats_with_non_compliant_model = {} # ComplianceStatsWithNonCompliant + compliance_stats_with_non_compliant_model['status'] = 'compliant' + compliance_stats_with_non_compliant_model['total_count'] = 150 + compliance_stats_with_non_compliant_model['compliant_count'] = 130 + compliance_stats_with_non_compliant_model['not_compliant_count'] = 5 + compliance_stats_with_non_compliant_model['unable_to_perform_count'] = 5 + compliance_stats_with_non_compliant_model['user_evaluation_required_count'] = 10 + compliance_stats_with_non_compliant_model['not_applicable_count'] = 7 + compliance_stats_with_non_compliant_model['not_compliant_controls'] = [control_summary_model] + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + report_scope_model = {} # ReportScope + report_scope_model['id'] = 'testString' + report_scope_model['name'] = 'testString' + report_scope_model['href'] = 'testString' + + link_model = {} # Link + link_model['description'] = 'testString' + link_model['href'] = 'testString' + + additional_details_model = {} # AdditionalDetails + additional_details_model['created_by'] = 'Security and Compliance Center' + additional_details_model['labels'] = ['testString'] + additional_details_model['links'] = [link_model] + + report_model = {} # Report + report_model['id'] = '44a5-a292-32114fa73558' + report_model['type'] = 'scheduled' + report_model['group_id'] = '55b6-b3A4-432250b84669' + report_model['created_on'] = '2022-08-15T12:30:01Z' + report_model['scan_time'] = '2022-08-15T12:30:01Z' + report_model['cos_object'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/531fc3e28bfc43c5a2cea07786d93f5c:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:b1a8f3da-49d2-4966-ae83-a8d02bc2aac7' + report_model['instance_id'] = 'testString' + report_model['account'] = account_model + report_model['profile'] = profile_info_model + report_model['scope'] = scope_id_model + report_model['attachment'] = attachment_model + report_model['controls_summary'] = compliance_stats_with_non_compliant_model + report_model['evaluations_summary'] = eval_stats_model + report_model['tags'] = tags_model + report_model['scopes'] = [report_scope_model] + report_model['additional_details'] = additional_details_model + + # Construct a json representation of a ReportLatest model + report_latest_model_json = {} + report_latest_model_json['home_account_id'] = 'testString' + report_latest_model_json['controls_summary'] = compliance_stats_model + report_latest_model_json['evaluations_summary'] = eval_stats_model + report_latest_model_json['score'] = compliance_score_model + report_latest_model_json['reports'] = [report_model] + + # Construct a model instance of ReportLatest by calling from_dict on the json representation + report_latest_model = ReportLatest.from_dict(report_latest_model_json) + assert report_latest_model != False + + # Construct a model instance of ReportLatest by calling from_dict on the json representation + report_latest_model_dict = ReportLatest.from_dict(report_latest_model_json).__dict__ + report_latest_model2 = ReportLatest(**report_latest_model_dict) + + # Verify the model instances are equivalent + assert report_latest_model == report_latest_model2 + + # Convert model instance back to dict and verify no loss of data + report_latest_model_json2 = report_latest_model.to_dict() + assert report_latest_model_json2 == report_latest_model_json + + +class TestModel_ReportScope: + """ + Test Class for ReportScope + """ + + def test_report_scope_serialization(self): + """ + Test serialization/deserialization for ReportScope + """ + + # Construct a json representation of a ReportScope model + report_scope_model_json = {} + report_scope_model_json['id'] = 'testString' + report_scope_model_json['name'] = 'testString' + report_scope_model_json['href'] = 'testString' + + # Construct a model instance of ReportScope by calling from_dict on the json representation + report_scope_model = ReportScope.from_dict(report_scope_model_json) + assert report_scope_model != False + + # Construct a model instance of ReportScope by calling from_dict on the json representation + report_scope_model_dict = ReportScope.from_dict(report_scope_model_json).__dict__ + report_scope_model2 = ReportScope(**report_scope_model_dict) + + # Verify the model instances are equivalent + assert report_scope_model == report_scope_model2 + + # Convert model instance back to dict and verify no loss of data + report_scope_model_json2 = report_scope_model.to_dict() + assert report_scope_model_json2 == report_scope_model_json + + +class TestModel_ReportSummary: + """ + Test Class for ReportSummary + """ + + def test_report_summary_serialization(self): + """ + Test serialization/deserialization for ReportSummary + """ + + # Construct dict forms of any model objects needed in order to build this model. + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + compliance_score_model = {} # ComplianceScore + compliance_score_model['passed'] = 1 + compliance_score_model['total_count'] = 4 + compliance_score_model['percent'] = 25 + + eval_stats_model = {} # EvalStats + eval_stats_model['status'] = 'compliant' + eval_stats_model['total_count'] = 140 + eval_stats_model['pass_count'] = 123 + eval_stats_model['failure_count'] = 12 + eval_stats_model['error_count'] = 5 + eval_stats_model['skipped_count'] = 7 + eval_stats_model['completed_count'] = 135 + + compliance_stats_model = {} # ComplianceStats + compliance_stats_model['status'] = 'compliant' + compliance_stats_model['total_count'] = 150 + compliance_stats_model['compliant_count'] = 130 + compliance_stats_model['not_compliant_count'] = 5 + compliance_stats_model['unable_to_perform_count'] = 5 + compliance_stats_model['user_evaluation_required_count'] = 10 + compliance_stats_model['not_applicable_count'] = 7 + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + resource_summary_item_model = {} # ResourceSummaryItem + resource_summary_item_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + resource_summary_item_model['name'] = 'my-bucket' + resource_summary_item_model['account'] = '59bcbfa6ea2f006b4ed7094c1a08dcdd' + resource_summary_item_model['service'] = 'cloud-object-storage' + resource_summary_item_model['service_display_name'] = 'cloud-object-storage' + resource_summary_item_model['tags'] = tags_model + resource_summary_item_model['status'] = 'compliant' + resource_summary_item_model['total_count'] = 140 + resource_summary_item_model['pass_count'] = 123 + resource_summary_item_model['failure_count'] = 12 + resource_summary_item_model['error_count'] = 5 + resource_summary_item_model['skipped_count'] = 7 + resource_summary_item_model['completed_count'] = 135 + + resource_summary_model = {} # ResourceSummary + resource_summary_model['status'] = 'compliant' + resource_summary_model['total_count'] = 150 + resource_summary_model['compliant_count'] = 130 + resource_summary_model['not_compliant_count'] = 5 + resource_summary_model['unable_to_perform_count'] = 5 + resource_summary_model['user_evaluation_required_count'] = 10 + resource_summary_model['not_applicable_count'] = 7 + resource_summary_model['top_failed'] = [resource_summary_item_model] + + # Construct a json representation of a ReportSummary model + report_summary_model_json = {} + report_summary_model_json['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + report_summary_model_json['isntance_id'] = '84644a08-31b6-4988-b504-49a46ca69ccd' + report_summary_model_json['account'] = account_model + report_summary_model_json['score'] = compliance_score_model + report_summary_model_json['evaluations'] = eval_stats_model + report_summary_model_json['controls'] = compliance_stats_model + report_summary_model_json['resources'] = resource_summary_model + + # Construct a model instance of ReportSummary by calling from_dict on the json representation + report_summary_model = ReportSummary.from_dict(report_summary_model_json) + assert report_summary_model != False + + # Construct a model instance of ReportSummary by calling from_dict on the json representation + report_summary_model_dict = ReportSummary.from_dict(report_summary_model_json).__dict__ + report_summary_model2 = ReportSummary(**report_summary_model_dict) + + # Verify the model instances are equivalent + assert report_summary_model == report_summary_model2 + + # Convert model instance back to dict and verify no loss of data + report_summary_model_json2 = report_summary_model.to_dict() + assert report_summary_model_json2 == report_summary_model_json + + +class TestModel_ReportTags: + """ + Test Class for ReportTags + """ + + def test_report_tags_serialization(self): + """ + Test serialization/deserialization for ReportTags + """ + + # Construct dict forms of any model objects needed in order to build this model. + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a json representation of a ReportTags model + report_tags_model_json = {} + report_tags_model_json['report_id'] = 'testString' + report_tags_model_json['tags'] = tags_model + + # Construct a model instance of ReportTags by calling from_dict on the json representation + report_tags_model = ReportTags.from_dict(report_tags_model_json) + assert report_tags_model != False + + # Construct a model instance of ReportTags by calling from_dict on the json representation + report_tags_model_dict = ReportTags.from_dict(report_tags_model_json).__dict__ + report_tags_model2 = ReportTags(**report_tags_model_dict) + + # Verify the model instances are equivalent + assert report_tags_model == report_tags_model2 + + # Convert model instance back to dict and verify no loss of data + report_tags_model_json2 = report_tags_model.to_dict() + assert report_tags_model_json2 == report_tags_model_json + + +class TestModel_ReportViolationDataPoint: + """ + Test Class for ReportViolationDataPoint + """ + + def test_report_violation_data_point_serialization(self): + """ + Test serialization/deserialization for ReportViolationDataPoint + """ + + # Construct dict forms of any model objects needed in order to build this model. + + compliance_stats_model = {} # ComplianceStats + compliance_stats_model['status'] = 'compliant' + compliance_stats_model['total_count'] = 150 + compliance_stats_model['compliant_count'] = 130 + compliance_stats_model['not_compliant_count'] = 5 + compliance_stats_model['unable_to_perform_count'] = 5 + compliance_stats_model['user_evaluation_required_count'] = 10 + compliance_stats_model['not_applicable_count'] = 7 + + # Construct a json representation of a ReportViolationDataPoint model + report_violation_data_point_model_json = {} + report_violation_data_point_model_json['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + report_violation_data_point_model_json['report_group_id'] = '55b6-b3A4-432250b84669' + report_violation_data_point_model_json['scan_time'] = '2022-08-15T12:30:01Z' + report_violation_data_point_model_json['controls_summary'] = compliance_stats_model + + # Construct a model instance of ReportViolationDataPoint by calling from_dict on the json representation + report_violation_data_point_model = ReportViolationDataPoint.from_dict(report_violation_data_point_model_json) + assert report_violation_data_point_model != False + + # Construct a model instance of ReportViolationDataPoint by calling from_dict on the json representation + report_violation_data_point_model_dict = ReportViolationDataPoint.from_dict(report_violation_data_point_model_json).__dict__ + report_violation_data_point_model2 = ReportViolationDataPoint(**report_violation_data_point_model_dict) + + # Verify the model instances are equivalent + assert report_violation_data_point_model == report_violation_data_point_model2 + + # Convert model instance back to dict and verify no loss of data + report_violation_data_point_model_json2 = report_violation_data_point_model.to_dict() + assert report_violation_data_point_model_json2 == report_violation_data_point_model_json + + +class TestModel_ReportViolationsDrift: + """ + Test Class for ReportViolationsDrift + """ + + def test_report_violations_drift_serialization(self): + """ + Test serialization/deserialization for ReportViolationsDrift + """ + + # Construct dict forms of any model objects needed in order to build this model. + + compliance_stats_model = {} # ComplianceStats + compliance_stats_model['status'] = 'compliant' + compliance_stats_model['total_count'] = 150 + compliance_stats_model['compliant_count'] = 130 + compliance_stats_model['not_compliant_count'] = 5 + compliance_stats_model['unable_to_perform_count'] = 5 + compliance_stats_model['user_evaluation_required_count'] = 10 + compliance_stats_model['not_applicable_count'] = 7 + + report_violation_data_point_model = {} # ReportViolationDataPoint + report_violation_data_point_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + report_violation_data_point_model['report_group_id'] = '55b6-b3A4-432250b84669' + report_violation_data_point_model['scan_time'] = '2022-08-15T12:30:01Z' + report_violation_data_point_model['controls_summary'] = compliance_stats_model + + # Construct a json representation of a ReportViolationsDrift model + report_violations_drift_model_json = {} + report_violations_drift_model_json['home_account_id'] = 'testString' + report_violations_drift_model_json['report_group_id'] = 'testString' + report_violations_drift_model_json['data_points'] = [report_violation_data_point_model] + + # Construct a model instance of ReportViolationsDrift by calling from_dict on the json representation + report_violations_drift_model = ReportViolationsDrift.from_dict(report_violations_drift_model_json) + assert report_violations_drift_model != False + + # Construct a model instance of ReportViolationsDrift by calling from_dict on the json representation + report_violations_drift_model_dict = ReportViolationsDrift.from_dict(report_violations_drift_model_json).__dict__ + report_violations_drift_model2 = ReportViolationsDrift(**report_violations_drift_model_dict) + + # Verify the model instances are equivalent + assert report_violations_drift_model == report_violations_drift_model2 + + # Convert model instance back to dict and verify no loss of data + report_violations_drift_model_json2 = report_violations_drift_model.to_dict() + assert report_violations_drift_model_json2 == report_violations_drift_model_json + + +class TestModel_Resource: + """ + Test Class for Resource + """ + + def test_resource_serialization(self): + """ + Test serialization/deserialization for Resource + """ + + # Construct dict forms of any model objects needed in order to build this model. + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a json representation of a Resource model + resource_model_json = {} + resource_model_json['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model_json['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model_json['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model_json['resource_name'] = 'jeff\'s key' + resource_model_json['account'] = account_model + resource_model_json['component_id'] = 'cloud-object_storage' + resource_model_json['component_name'] = 'cloud-object_storage' + resource_model_json['environment'] = 'ibm cloud' + resource_model_json['tags'] = tags_model + resource_model_json['status'] = 'compliant' + resource_model_json['total_count'] = 140 + resource_model_json['pass_count'] = 123 + resource_model_json['failure_count'] = 12 + resource_model_json['error_count'] = 5 + resource_model_json['skipped_count'] = 7 + resource_model_json['completed_count'] = 135 + resource_model_json['service_name'] = 'pm-20' + resource_model_json['instance_crn'] = 'testString' + + # Construct a model instance of Resource by calling from_dict on the json representation + resource_model = Resource.from_dict(resource_model_json) + assert resource_model != False + + # Construct a model instance of Resource by calling from_dict on the json representation + resource_model_dict = Resource.from_dict(resource_model_json).__dict__ + resource_model2 = Resource(**resource_model_dict) + + # Verify the model instances are equivalent + assert resource_model == resource_model2 + + # Convert model instance back to dict and verify no loss of data + resource_model_json2 = resource_model.to_dict() + assert resource_model_json2 == resource_model_json + + +class TestModel_ResourcePage: + """ + Test Class for ResourcePage + """ + + def test_resource_page_serialization(self): + """ + Test serialization/deserialization for ResourcePage + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + resource_model = {} # Resource + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + # Construct a json representation of a ResourcePage model + resource_page_model_json = {} + resource_page_model_json['limit'] = 50 + resource_page_model_json['total_count'] = 230 + resource_page_model_json['first'] = page_h_ref_first_model + resource_page_model_json['next'] = page_h_ref_next_model + resource_page_model_json['report_id'] = 'testString' + resource_page_model_json['home_account_id'] = 'testString' + resource_page_model_json['resources'] = [resource_model] + + # Construct a model instance of ResourcePage by calling from_dict on the json representation + resource_page_model = ResourcePage.from_dict(resource_page_model_json) + assert resource_page_model != False + + # Construct a model instance of ResourcePage by calling from_dict on the json representation + resource_page_model_dict = ResourcePage.from_dict(resource_page_model_json).__dict__ + resource_page_model2 = ResourcePage(**resource_page_model_dict) + + # Verify the model instances are equivalent + assert resource_page_model == resource_page_model2 + + # Convert model instance back to dict and verify no loss of data + resource_page_model_json2 = resource_page_model.to_dict() + assert resource_page_model_json2 == resource_page_model_json + + +class TestModel_ResourceSummary: + """ + Test Class for ResourceSummary + """ + + def test_resource_summary_serialization(self): + """ + Test serialization/deserialization for ResourceSummary + """ + + # Construct dict forms of any model objects needed in order to build this model. + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + resource_summary_item_model = {} # ResourceSummaryItem + resource_summary_item_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + resource_summary_item_model['name'] = 'my-bucket' + resource_summary_item_model['account'] = '59bcbfa6ea2f006b4ed7094c1a08dcdd' + resource_summary_item_model['service'] = 'cloud-object-storage' + resource_summary_item_model['service_display_name'] = 'cloud-object-storage' + resource_summary_item_model['tags'] = tags_model + resource_summary_item_model['status'] = 'compliant' + resource_summary_item_model['total_count'] = 140 + resource_summary_item_model['pass_count'] = 123 + resource_summary_item_model['failure_count'] = 12 + resource_summary_item_model['error_count'] = 5 + resource_summary_item_model['skipped_count'] = 7 + resource_summary_item_model['completed_count'] = 135 + + # Construct a json representation of a ResourceSummary model + resource_summary_model_json = {} + resource_summary_model_json['status'] = 'compliant' + resource_summary_model_json['total_count'] = 150 + resource_summary_model_json['compliant_count'] = 130 + resource_summary_model_json['not_compliant_count'] = 5 + resource_summary_model_json['unable_to_perform_count'] = 5 + resource_summary_model_json['user_evaluation_required_count'] = 10 + resource_summary_model_json['not_applicable_count'] = 7 + resource_summary_model_json['top_failed'] = [resource_summary_item_model] + + # Construct a model instance of ResourceSummary by calling from_dict on the json representation + resource_summary_model = ResourceSummary.from_dict(resource_summary_model_json) + assert resource_summary_model != False + + # Construct a model instance of ResourceSummary by calling from_dict on the json representation + resource_summary_model_dict = ResourceSummary.from_dict(resource_summary_model_json).__dict__ + resource_summary_model2 = ResourceSummary(**resource_summary_model_dict) + + # Verify the model instances are equivalent + assert resource_summary_model == resource_summary_model2 + + # Convert model instance back to dict and verify no loss of data + resource_summary_model_json2 = resource_summary_model.to_dict() + assert resource_summary_model_json2 == resource_summary_model_json + + +class TestModel_ResourceSummaryItem: + """ + Test Class for ResourceSummaryItem + """ + + def test_resource_summary_item_serialization(self): + """ + Test serialization/deserialization for ResourceSummaryItem + """ + + # Construct dict forms of any model objects needed in order to build this model. + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a json representation of a ResourceSummaryItem model + resource_summary_item_model_json = {} + resource_summary_item_model_json['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + resource_summary_item_model_json['name'] = 'my-bucket' + resource_summary_item_model_json['account'] = '59bcbfa6ea2f006b4ed7094c1a08dcdd' + resource_summary_item_model_json['service'] = 'cloud-object-storage' + resource_summary_item_model_json['service_display_name'] = 'cloud-object-storage' + resource_summary_item_model_json['tags'] = tags_model + resource_summary_item_model_json['status'] = 'compliant' + resource_summary_item_model_json['total_count'] = 140 + resource_summary_item_model_json['pass_count'] = 123 + resource_summary_item_model_json['failure_count'] = 12 + resource_summary_item_model_json['error_count'] = 5 + resource_summary_item_model_json['skipped_count'] = 7 + resource_summary_item_model_json['completed_count'] = 135 + + # Construct a model instance of ResourceSummaryItem by calling from_dict on the json representation + resource_summary_item_model = ResourceSummaryItem.from_dict(resource_summary_item_model_json) + assert resource_summary_item_model != False + + # Construct a model instance of ResourceSummaryItem by calling from_dict on the json representation + resource_summary_item_model_dict = ResourceSummaryItem.from_dict(resource_summary_item_model_json).__dict__ + resource_summary_item_model2 = ResourceSummaryItem(**resource_summary_item_model_dict) + + # Verify the model instances are equivalent + assert resource_summary_item_model == resource_summary_item_model2 + + # Convert model instance back to dict and verify no loss of data + resource_summary_item_model_json2 = resource_summary_item_model.to_dict() + assert resource_summary_item_model_json2 == resource_summary_item_model_json + + +class TestModel_Rule: + """ + Test Class for Rule + """ + + def test_rule_serialization(self): + """ + Test serialization/deserialization for Rule + """ + + # Construct dict forms of any model objects needed in order to build this model. + + rule_parameter_model = {} # RuleParameter + rule_parameter_model['name'] = 'testString' + rule_parameter_model['display_name'] = 'testString' + rule_parameter_model['description'] = 'testString' + rule_parameter_model['type'] = 'string' + + import_model = {} # Import + import_model['parameters'] = [rule_parameter_model] + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + # Construct a json representation of a Rule model + rule_model_json = {} + rule_model_json['created_on'] = '2019-01-01T12:00:00Z' + rule_model_json['created_by'] = 'testString' + rule_model_json['updated_on'] = '2019-01-01T12:00:00Z' + rule_model_json['updated_by'] = 'testString' + rule_model_json['id'] = 'testString' + rule_model_json['account_id'] = 'testString' + rule_model_json['description'] = 'testString' + rule_model_json['type'] = 'user_defined' + rule_model_json['version'] = 'testString' + rule_model_json['import'] = import_model + rule_model_json['target'] = rule_target_model + rule_model_json['required_config'] = required_config_model + rule_model_json['labels'] = ['testString'] + + # Construct a model instance of Rule by calling from_dict on the json representation + rule_model = Rule.from_dict(rule_model_json) + assert rule_model != False + + # Construct a model instance of Rule by calling from_dict on the json representation + rule_model_dict = Rule.from_dict(rule_model_json).__dict__ + rule_model2 = Rule(**rule_model_dict) + + # Verify the model instances are equivalent + assert rule_model == rule_model2 + + # Convert model instance back to dict and verify no loss of data + rule_model_json2 = rule_model.to_dict() + assert rule_model_json2 == rule_model_json + + +class TestModel_RuleCollection: + """ + Test Class for RuleCollection + """ + + def test_rule_collection_serialization(self): + """ + Test serialization/deserialization for RuleCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + rule_parameter_model = {} # RuleParameter + rule_parameter_model['name'] = 'testString' + rule_parameter_model['display_name'] = 'testString' + rule_parameter_model['description'] = 'testString' + rule_parameter_model['type'] = 'string' + + import_model = {} # Import + import_model['parameters'] = [rule_parameter_model] + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + rule_model = {} # Rule + rule_model['created_on'] = '2019-01-01T12:00:00Z' + rule_model['created_by'] = 'testString' + rule_model['updated_on'] = '2019-01-01T12:00:00Z' + rule_model['updated_by'] = 'testString' + rule_model['id'] = 'testString' + rule_model['account_id'] = 'testString' + rule_model['description'] = 'testString' + rule_model['type'] = 'user_defined' + rule_model['version'] = 'testString' + rule_model['import'] = import_model + rule_model['target'] = rule_target_model + rule_model['required_config'] = required_config_model + rule_model['labels'] = ['testString'] + + # Construct a json representation of a RuleCollection model + rule_collection_model_json = {} + rule_collection_model_json['limit'] = 50 + rule_collection_model_json['total_count'] = 230 + rule_collection_model_json['first'] = page_h_ref_first_model + rule_collection_model_json['next'] = page_h_ref_next_model + rule_collection_model_json['rules'] = [rule_model] + + # Construct a model instance of RuleCollection by calling from_dict on the json representation + rule_collection_model = RuleCollection.from_dict(rule_collection_model_json) + assert rule_collection_model != False + + # Construct a model instance of RuleCollection by calling from_dict on the json representation + rule_collection_model_dict = RuleCollection.from_dict(rule_collection_model_json).__dict__ + rule_collection_model2 = RuleCollection(**rule_collection_model_dict) + + # Verify the model instances are equivalent + assert rule_collection_model == rule_collection_model2 + + # Convert model instance back to dict and verify no loss of data + rule_collection_model_json2 = rule_collection_model.to_dict() + assert rule_collection_model_json2 == rule_collection_model_json + + +class TestModel_RuleInfo: + """ + Test Class for RuleInfo + """ + + def test_rule_info_serialization(self): + """ + Test serialization/deserialization for RuleInfo + """ + + # Construct a json representation of a RuleInfo model + rule_info_model_json = {} + rule_info_model_json['id'] = 'rule-7b0560a4-df94-4629-bb76-680f3155ddda' + rule_info_model_json['type'] = 'user_defined/system_defined' + rule_info_model_json['description'] = 'rule' + rule_info_model_json['version'] = '1.2.3' + rule_info_model_json['account_id'] = '59bcbfa6ea2f006b4ed7094c1a08dcdd' + rule_info_model_json['created_on'] = '2022-08-15T12:30:01Z' + rule_info_model_json['created_by'] = 'IBMid-12345' + rule_info_model_json['updated_on'] = '2022-08-15T12:30:01Z' + rule_info_model_json['updated_by'] = 'IBMid-12345' + rule_info_model_json['labels'] = ['testString'] + + # Construct a model instance of RuleInfo by calling from_dict on the json representation + rule_info_model = RuleInfo.from_dict(rule_info_model_json) + assert rule_info_model != False + + # Construct a model instance of RuleInfo by calling from_dict on the json representation + rule_info_model_dict = RuleInfo.from_dict(rule_info_model_json).__dict__ + rule_info_model2 = RuleInfo(**rule_info_model_dict) + + # Verify the model instances are equivalent + assert rule_info_model == rule_info_model2 + + # Convert model instance back to dict and verify no loss of data + rule_info_model_json2 = rule_info_model.to_dict() + assert rule_info_model_json2 == rule_info_model_json + + +class TestModel_RuleParameter: + """ + Test Class for RuleParameter + """ + + def test_rule_parameter_serialization(self): + """ + Test serialization/deserialization for RuleParameter + """ + + # Construct a json representation of a RuleParameter model + rule_parameter_model_json = {} + rule_parameter_model_json['name'] = 'testString' + rule_parameter_model_json['display_name'] = 'testString' + rule_parameter_model_json['description'] = 'testString' + rule_parameter_model_json['type'] = 'string' + + # Construct a model instance of RuleParameter by calling from_dict on the json representation + rule_parameter_model = RuleParameter.from_dict(rule_parameter_model_json) + assert rule_parameter_model != False + + # Construct a model instance of RuleParameter by calling from_dict on the json representation + rule_parameter_model_dict = RuleParameter.from_dict(rule_parameter_model_json).__dict__ + rule_parameter_model2 = RuleParameter(**rule_parameter_model_dict) + + # Verify the model instances are equivalent + assert rule_parameter_model == rule_parameter_model2 + + # Convert model instance back to dict and verify no loss of data + rule_parameter_model_json2 = rule_parameter_model.to_dict() + assert rule_parameter_model_json2 == rule_parameter_model_json + + +class TestModel_RuleProperty: + """ + Test Class for RuleProperty + """ + + def test_rule_property_serialization(self): + """ + Test serialization/deserialization for RuleProperty + """ + + # Construct a json representation of a RuleProperty model + rule_property_model_json = {} + rule_property_model_json['name'] = 'testString' + rule_property_model_json['description'] = 'testString' + rule_property_model_json['type'] = 'string' + + # Construct a model instance of RuleProperty by calling from_dict on the json representation + rule_property_model = RuleProperty.from_dict(rule_property_model_json) + assert rule_property_model != False + + # Construct a model instance of RuleProperty by calling from_dict on the json representation + rule_property_model_dict = RuleProperty.from_dict(rule_property_model_json).__dict__ + rule_property_model2 = RuleProperty(**rule_property_model_dict) + + # Verify the model instances are equivalent + assert rule_property_model == rule_property_model2 + + # Convert model instance back to dict and verify no loss of data + rule_property_model_json2 = rule_property_model.to_dict() + assert rule_property_model_json2 == rule_property_model_json + + +class TestModel_RuleTarget: + """ + Test Class for RuleTarget + """ + + def test_rule_target_serialization(self): + """ + Test serialization/deserialization for RuleTarget + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + # Construct a json representation of a RuleTarget model + rule_target_model_json = {} + rule_target_model_json['service_name'] = 'testString' + rule_target_model_json['service_display_name'] = 'testString' + rule_target_model_json['resource_kind'] = 'testString' + rule_target_model_json['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model_json['ref'] = 'testString' + + # Construct a model instance of RuleTarget by calling from_dict on the json representation + rule_target_model = RuleTarget.from_dict(rule_target_model_json) + assert rule_target_model != False + + # Construct a model instance of RuleTarget by calling from_dict on the json representation + rule_target_model_dict = RuleTarget.from_dict(rule_target_model_json).__dict__ + rule_target_model2 = RuleTarget(**rule_target_model_dict) + + # Verify the model instances are equivalent + assert rule_target_model == rule_target_model2 + + # Convert model instance back to dict and verify no loss of data + rule_target_model_json2 = rule_target_model.to_dict() + assert rule_target_model_json2 == rule_target_model_json + + +class TestModel_RuleTargetPrototype: + """ + Test Class for RuleTargetPrototype + """ + + def test_rule_target_prototype_serialization(self): + """ + Test serialization/deserialization for RuleTargetPrototype + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + # Construct a json representation of a RuleTargetPrototype model + rule_target_prototype_model_json = {} + rule_target_prototype_model_json['service_name'] = 'testString' + rule_target_prototype_model_json['resource_kind'] = 'testString' + rule_target_prototype_model_json['additional_target_attributes'] = [additional_target_attribute_model] + + # Construct a model instance of RuleTargetPrototype by calling from_dict on the json representation + rule_target_prototype_model = RuleTargetPrototype.from_dict(rule_target_prototype_model_json) + assert rule_target_prototype_model != False + + # Construct a model instance of RuleTargetPrototype by calling from_dict on the json representation + rule_target_prototype_model_dict = RuleTargetPrototype.from_dict(rule_target_prototype_model_json).__dict__ + rule_target_prototype_model2 = RuleTargetPrototype(**rule_target_prototype_model_dict) + + # Verify the model instances are equivalent + assert rule_target_prototype_model == rule_target_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + rule_target_prototype_model_json2 = rule_target_prototype_model.to_dict() + assert rule_target_prototype_model_json2 == rule_target_prototype_model_json + + +class TestModel_ScanReport: + """ + Test Class for ScanReport + """ + + def test_scan_report_serialization(self): + """ + Test serialization/deserialization for ScanReport + """ + + # Construct a json representation of a ScanReport model + scan_report_model_json = {} + scan_report_model_json['id'] = 'e44316e3-53bc-449b-a808-c16df680d462' + scan_report_model_json['scan_id'] = '44a5-a292-32114fa73553' + scan_report_model_json['instance_id'] = 'testString' + scan_report_model_json['scope_id'] = '44a5-a292-32114fa73558' + scan_report_model_json['subscope_id'] = '44a5-a292-32114fa73555' + scan_report_model_json['status'] = 'completed' + scan_report_model_json['created_on'] = '2024-05-08T12:30:01Z' + scan_report_model_json['format'] = 'pdf' + scan_report_model_json['href'] = 'testString' + + # Construct a model instance of ScanReport by calling from_dict on the json representation + scan_report_model = ScanReport.from_dict(scan_report_model_json) + assert scan_report_model != False + + # Construct a model instance of ScanReport by calling from_dict on the json representation + scan_report_model_dict = ScanReport.from_dict(scan_report_model_json).__dict__ + scan_report_model2 = ScanReport(**scan_report_model_dict) + + # Verify the model instances are equivalent + assert scan_report_model == scan_report_model2 + + # Convert model instance back to dict and verify no loss of data + scan_report_model_json2 = scan_report_model.to_dict() + assert scan_report_model_json2 == scan_report_model_json + + +class TestModel_ScanReportCollection: + """ + Test Class for ScanReportCollection + """ + + def test_scan_report_collection_serialization(self): + """ + Test serialization/deserialization for ScanReportCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + scan_report_model = {} # ScanReport + scan_report_model['id'] = 'e44316e3-53bc-449b-a808-c16df680d462' + scan_report_model['scan_id'] = '44a5-a292-32114fa73553' + scan_report_model['instance_id'] = 'testString' + scan_report_model['scope_id'] = '44a5-a292-32114fa73558' + scan_report_model['subscope_id'] = '44a5-a292-32114fa73555' + scan_report_model['status'] = 'completed' + scan_report_model['created_on'] = '2024-05-08T12:30:01Z' + scan_report_model['format'] = 'pdf' + scan_report_model['href'] = 'testString' + + # Construct a json representation of a ScanReportCollection model + scan_report_collection_model_json = {} + scan_report_collection_model_json['limit'] = 50 + scan_report_collection_model_json['total_count'] = 230 + scan_report_collection_model_json['first'] = page_h_ref_first_model + scan_report_collection_model_json['next'] = page_h_ref_next_model + scan_report_collection_model_json['scope_id'] = '44a5-a292-32114fa73558' + scan_report_collection_model_json['subscope_id'] = '44a5-a292-32114fa73555' + scan_report_collection_model_json['scan_reports'] = [scan_report_model] + + # Construct a model instance of ScanReportCollection by calling from_dict on the json representation + scan_report_collection_model = ScanReportCollection.from_dict(scan_report_collection_model_json) + assert scan_report_collection_model != False + + # Construct a model instance of ScanReportCollection by calling from_dict on the json representation + scan_report_collection_model_dict = ScanReportCollection.from_dict(scan_report_collection_model_json).__dict__ + scan_report_collection_model2 = ScanReportCollection(**scan_report_collection_model_dict) + + # Verify the model instances are equivalent + assert scan_report_collection_model == scan_report_collection_model2 + + # Convert model instance back to dict and verify no loss of data + scan_report_collection_model_json2 = scan_report_collection_model.to_dict() + assert scan_report_collection_model_json2 == scan_report_collection_model_json + + +class TestModel_Scope: + """ + Test Class for Scope + """ + + def test_scope_serialization(self): + """ + Test serialization/deserialization for Scope + """ + + # Construct dict forms of any model objects needed in order to build this model. + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a json representation of a Scope model + scope_model_json = {} + scope_model_json['id'] = 'testString' + scope_model_json['name'] = 'testString' + scope_model_json['description'] = 'testString' + scope_model_json['environment'] = 'testString' + scope_model_json['properties'] = [scope_property_model] + scope_model_json['account_id'] = 'testString' + scope_model_json['instance_id'] = 'testString' + scope_model_json['created_by'] = 'testString' + scope_model_json['created_on'] = '2019-01-01T12:00:00Z' + scope_model_json['updated_by'] = 'testString' + scope_model_json['updated_on'] = '2019-01-01T12:00:00Z' + scope_model_json['attachment_count'] = 72.5 + + # Construct a model instance of Scope by calling from_dict on the json representation + scope_model = Scope.from_dict(scope_model_json) + assert scope_model != False + + # Construct a model instance of Scope by calling from_dict on the json representation + scope_model_dict = Scope.from_dict(scope_model_json).__dict__ + scope_model2 = Scope(**scope_model_dict) + + # Verify the model instances are equivalent + assert scope_model == scope_model2 + + # Convert model instance back to dict and verify no loss of data + scope_model_json2 = scope_model.to_dict() + assert scope_model_json2 == scope_model_json + + +class TestModel_ScopeCollection: + """ + Test Class for ScopeCollection + """ + + def test_scope_collection_serialization(self): + """ + Test serialization/deserialization for ScopeCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + scope_model = {} # Scope + scope_model['id'] = 'testString' + scope_model['name'] = 'testString' + scope_model['description'] = 'testString' + scope_model['environment'] = 'testString' + scope_model['properties'] = [scope_property_model] + scope_model['account_id'] = 'testString' + scope_model['instance_id'] = 'testString' + scope_model['created_by'] = 'testString' + scope_model['created_on'] = '2019-01-01T12:00:00Z' + scope_model['updated_by'] = 'testString' + scope_model['updated_on'] = '2019-01-01T12:00:00Z' + scope_model['attachment_count'] = 72.5 + + # Construct a json representation of a ScopeCollection model + scope_collection_model_json = {} + scope_collection_model_json['limit'] = 50 + scope_collection_model_json['total_count'] = 230 + scope_collection_model_json['first'] = page_h_ref_first_model + scope_collection_model_json['next'] = page_h_ref_next_model + scope_collection_model_json['scopes'] = [scope_model] + + # Construct a model instance of ScopeCollection by calling from_dict on the json representation + scope_collection_model = ScopeCollection.from_dict(scope_collection_model_json) + assert scope_collection_model != False + + # Construct a model instance of ScopeCollection by calling from_dict on the json representation + scope_collection_model_dict = ScopeCollection.from_dict(scope_collection_model_json).__dict__ + scope_collection_model2 = ScopeCollection(**scope_collection_model_dict) + + # Verify the model instances are equivalent + assert scope_collection_model == scope_collection_model2 + + # Convert model instance back to dict and verify no loss of data + scope_collection_model_json2 = scope_collection_model.to_dict() + assert scope_collection_model_json2 == scope_collection_model_json + + +class TestModel_ScopeID: + """ + Test Class for ScopeID + """ + + def test_scope_id_serialization(self): + """ + Test serialization/deserialization for ScopeID + """ + + # Construct a json representation of a ScopeID model + scope_id_model_json = {} + scope_id_model_json['id'] = '2411ffdc16844b07b42521c3443f456d' + scope_id_model_json['type'] = 'account' + + # Construct a model instance of ScopeID by calling from_dict on the json representation + scope_id_model = ScopeID.from_dict(scope_id_model_json) + assert scope_id_model != False + + # Construct a model instance of ScopeID by calling from_dict on the json representation + scope_id_model_dict = ScopeID.from_dict(scope_id_model_json).__dict__ + scope_id_model2 = ScopeID(**scope_id_model_dict) + + # Verify the model instances are equivalent + assert scope_id_model == scope_id_model2 + + # Convert model instance back to dict and verify no loss of data + scope_id_model_json2 = scope_id_model.to_dict() + assert scope_id_model_json2 == scope_id_model_json + + +class TestModel_ScopePropertyExclusionItem: + """ + Test Class for ScopePropertyExclusionItem + """ + + def test_scope_property_exclusion_item_serialization(self): + """ + Test serialization/deserialization for ScopePropertyExclusionItem + """ + + # Construct a json representation of a ScopePropertyExclusionItem model + scope_property_exclusion_item_model_json = {} + scope_property_exclusion_item_model_json['scope_id'] = 'testString' + scope_property_exclusion_item_model_json['scope_type'] = 'enterprise' + + # Construct a model instance of ScopePropertyExclusionItem by calling from_dict on the json representation + scope_property_exclusion_item_model = ScopePropertyExclusionItem.from_dict(scope_property_exclusion_item_model_json) + assert scope_property_exclusion_item_model != False + + # Construct a model instance of ScopePropertyExclusionItem by calling from_dict on the json representation + scope_property_exclusion_item_model_dict = ScopePropertyExclusionItem.from_dict(scope_property_exclusion_item_model_json).__dict__ + scope_property_exclusion_item_model2 = ScopePropertyExclusionItem(**scope_property_exclusion_item_model_dict) + + # Verify the model instances are equivalent + assert scope_property_exclusion_item_model == scope_property_exclusion_item_model2 + + # Convert model instance back to dict and verify no loss of data + scope_property_exclusion_item_model_json2 = scope_property_exclusion_item_model.to_dict() + assert scope_property_exclusion_item_model_json2 == scope_property_exclusion_item_model_json + + +class TestModel_ScopePrototype: + """ + Test Class for ScopePrototype + """ + + def test_scope_prototype_serialization(self): + """ + Test serialization/deserialization for ScopePrototype + """ + + # Construct dict forms of any model objects needed in order to build this model. + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a json representation of a ScopePrototype model + scope_prototype_model_json = {} + scope_prototype_model_json['name'] = 'testString' + scope_prototype_model_json['description'] = 'testString' + scope_prototype_model_json['environment'] = 'testString' + scope_prototype_model_json['properties'] = [scope_property_model] + + # Construct a model instance of ScopePrototype by calling from_dict on the json representation + scope_prototype_model = ScopePrototype.from_dict(scope_prototype_model_json) + assert scope_prototype_model != False + + # Construct a model instance of ScopePrototype by calling from_dict on the json representation + scope_prototype_model_dict = ScopePrototype.from_dict(scope_prototype_model_json).__dict__ + scope_prototype_model2 = ScopePrototype(**scope_prototype_model_dict) + + # Verify the model instances are equivalent + assert scope_prototype_model == scope_prototype_model2 + + # Convert model instance back to dict and verify no loss of data + scope_prototype_model_json2 = scope_prototype_model.to_dict() + assert scope_prototype_model_json2 == scope_prototype_model_json + + +class TestModel_Service: + """ + Test Class for Service + """ + + def test_service_serialization(self): + """ + Test serialization/deserialization for Service + """ + + # Construct dict forms of any model objects needed in order to build this model. + + endpoint_model = {} # Endpoint + endpoint_model['host'] = 'testString' + endpoint_model['path'] = 'testString' + endpoint_model['region'] = 'testString' + endpoint_model['advisory_call_limit'] = 38 + + configuration_information_points_model = {} # ConfigurationInformationPoints + configuration_information_points_model['type'] = 'testString' + configuration_information_points_model['endpoints'] = [endpoint_model] + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_property_model = {} # RuleProperty + rule_property_model['name'] = 'testString' + rule_property_model['description'] = 'testString' + rule_property_model['type'] = 'string' + + supported_configs_model = {} # SupportedConfigs + supported_configs_model['resource_kind'] = 'testString' + supported_configs_model['additional_target_attributes'] = [additional_target_attribute_model] + supported_configs_model['properties'] = [rule_property_model] + supported_configs_model['description'] = 'testString' + supported_configs_model['cip_requires_service_instance'] = True + supported_configs_model['resource_group_support'] = True + supported_configs_model['tagging_support'] = True + supported_configs_model['inherit_tags'] = True + + # Construct a json representation of a Service model + service_model_json = {} + service_model_json['created_on'] = '2019-01-01T12:00:00Z' + service_model_json['created_by'] = 'testString' + service_model_json['updated_on'] = '2019-01-01T12:00:00Z' + service_model_json['updated_by'] = 'testString' + service_model_json['service_name'] = 'testString' + service_model_json['service_display_name'] = 'testString' + service_model_json['description'] = 'testString' + service_model_json['monitoring_enabled'] = True + service_model_json['enforcement_enabled'] = True + service_model_json['service_listing_enabled'] = True + service_model_json['config_information_point'] = configuration_information_points_model + service_model_json['supported_configs'] = [supported_configs_model] + + # Construct a model instance of Service by calling from_dict on the json representation + service_model = Service.from_dict(service_model_json) + assert service_model != False + + # Construct a model instance of Service by calling from_dict on the json representation + service_model_dict = Service.from_dict(service_model_json).__dict__ + service_model2 = Service(**service_model_dict) + + # Verify the model instances are equivalent + assert service_model == service_model2 + + # Convert model instance back to dict and verify no loss of data + service_model_json2 = service_model.to_dict() + assert service_model_json2 == service_model_json + + +class TestModel_ServiceCollection: + """ + Test Class for ServiceCollection + """ + + def test_service_collection_serialization(self): + """ + Test serialization/deserialization for ServiceCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + endpoint_model = {} # Endpoint + endpoint_model['host'] = 'testString' + endpoint_model['path'] = 'testString' + endpoint_model['region'] = 'testString' + endpoint_model['advisory_call_limit'] = 38 + + configuration_information_points_model = {} # ConfigurationInformationPoints + configuration_information_points_model['type'] = 'testString' + configuration_information_points_model['endpoints'] = [endpoint_model] + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_property_model = {} # RuleProperty + rule_property_model['name'] = 'testString' + rule_property_model['description'] = 'testString' + rule_property_model['type'] = 'string' + + supported_configs_model = {} # SupportedConfigs + supported_configs_model['resource_kind'] = 'testString' + supported_configs_model['additional_target_attributes'] = [additional_target_attribute_model] + supported_configs_model['properties'] = [rule_property_model] + supported_configs_model['description'] = 'testString' + supported_configs_model['cip_requires_service_instance'] = True + supported_configs_model['resource_group_support'] = True + supported_configs_model['tagging_support'] = True + supported_configs_model['inherit_tags'] = True + + service_model = {} # Service + service_model['created_on'] = '2019-01-01T12:00:00Z' + service_model['created_by'] = 'testString' + service_model['updated_on'] = '2019-01-01T12:00:00Z' + service_model['updated_by'] = 'testString' + service_model['service_name'] = 'testString' + service_model['service_display_name'] = 'testString' + service_model['description'] = 'testString' + service_model['monitoring_enabled'] = True + service_model['enforcement_enabled'] = True + service_model['service_listing_enabled'] = True + service_model['config_information_point'] = configuration_information_points_model + service_model['supported_configs'] = [supported_configs_model] + + # Construct a json representation of a ServiceCollection model + service_collection_model_json = {} + service_collection_model_json['services'] = [service_model] + + # Construct a model instance of ServiceCollection by calling from_dict on the json representation + service_collection_model = ServiceCollection.from_dict(service_collection_model_json) + assert service_collection_model != False + + # Construct a model instance of ServiceCollection by calling from_dict on the json representation + service_collection_model_dict = ServiceCollection.from_dict(service_collection_model_json).__dict__ + service_collection_model2 = ServiceCollection(**service_collection_model_dict) + + # Verify the model instances are equivalent + assert service_collection_model == service_collection_model2 + + # Convert model instance back to dict and verify no loss of data + service_collection_model_json2 = service_collection_model.to_dict() + assert service_collection_model_json2 == service_collection_model_json + + +class TestModel_Settings: + """ + Test Class for Settings + """ + + def test_settings_serialization(self): + """ + Test serialization/deserialization for Settings + """ + + # Construct dict forms of any model objects needed in order to build this model. + + event_notifications_model = {} # EventNotifications + event_notifications_model['instance_crn'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/ff88f007f9ff4622aac4fbc0eda36255:7199ae60-a214-4dd8-9bf7-ce571de49d01::' + event_notifications_model['updated_on'] = '2019-01-01T12:00:00Z' + event_notifications_model['source_id'] = 'crn:v1:bluemix:public:event-notifications:us-south:a/ff88f007f9ff4622aac4fbc0eda36255:b8b07245-0bbe-4478-b11c-0dce523105fd::' + event_notifications_model['source_description'] = 'This source is used for integration with IBM Cloud Security and Compliance Center.' + event_notifications_model['source_name'] = 'compliance' + + object_storage_model = {} # ObjectStorage + object_storage_model['instance_crn'] = 'testString' + object_storage_model['bucket'] = 'testString' + object_storage_model['bucket_location'] = 'testString' + object_storage_model['bucket_endpoint'] = 'testString' + object_storage_model['updated_on'] = '2019-01-01T12:00:00Z' + + # Construct a json representation of a Settings model + settings_model_json = {} + settings_model_json['event_notifications'] = event_notifications_model + settings_model_json['object_storage'] = object_storage_model + + # Construct a model instance of Settings by calling from_dict on the json representation + settings_model = Settings.from_dict(settings_model_json) + assert settings_model != False + + # Construct a model instance of Settings by calling from_dict on the json representation + settings_model_dict = Settings.from_dict(settings_model_json).__dict__ + settings_model2 = Settings(**settings_model_dict) + + # Verify the model instances are equivalent + assert settings_model == settings_model2 + + # Convert model instance back to dict and verify no loss of data + settings_model_json2 = settings_model.to_dict() + assert settings_model_json2 == settings_model_json + + +class TestModel_SubRule: + """ + Test Class for SubRule + """ + + def test_sub_rule_serialization(self): + """ + Test serialization/deserialization for SubRule + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + # Construct a json representation of a SubRule model + sub_rule_model_json = {} + sub_rule_model_json['target'] = rule_target_model + sub_rule_model_json['required_config'] = required_config_model + + # Construct a model instance of SubRule by calling from_dict on the json representation + sub_rule_model = SubRule.from_dict(sub_rule_model_json) + assert sub_rule_model != False + + # Construct a model instance of SubRule by calling from_dict on the json representation + sub_rule_model_dict = SubRule.from_dict(sub_rule_model_json).__dict__ + sub_rule_model2 = SubRule(**sub_rule_model_dict) + + # Verify the model instances are equivalent + assert sub_rule_model == sub_rule_model2 + + # Convert model instance back to dict and verify no loss of data + sub_rule_model_json2 = sub_rule_model.to_dict() + assert sub_rule_model_json2 == sub_rule_model_json + + +class TestModel_SubScope: + """ + Test Class for SubScope + """ + + def test_sub_scope_serialization(self): + """ + Test serialization/deserialization for SubScope + """ + + # Construct dict forms of any model objects needed in order to build this model. + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + # Construct a json representation of a SubScope model + sub_scope_model_json = {} + sub_scope_model_json['id'] = 'testString' + sub_scope_model_json['name'] = 'testString' + sub_scope_model_json['description'] = 'testString' + sub_scope_model_json['environment'] = 'testString' + sub_scope_model_json['properties'] = [scope_property_model] + + # Construct a model instance of SubScope by calling from_dict on the json representation + sub_scope_model = SubScope.from_dict(sub_scope_model_json) + assert sub_scope_model != False + + # Construct a model instance of SubScope by calling from_dict on the json representation + sub_scope_model_dict = SubScope.from_dict(sub_scope_model_json).__dict__ + sub_scope_model2 = SubScope(**sub_scope_model_dict) + + # Verify the model instances are equivalent + assert sub_scope_model == sub_scope_model2 + + # Convert model instance back to dict and verify no loss of data + sub_scope_model_json2 = sub_scope_model.to_dict() + assert sub_scope_model_json2 == sub_scope_model_json + + +class TestModel_SubScopeCollection: + """ + Test Class for SubScopeCollection + """ + + def test_sub_scope_collection_serialization(self): + """ + Test serialization/deserialization for SubScopeCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + sub_scope_model = {} # SubScope + sub_scope_model['id'] = 'testString' + sub_scope_model['name'] = 'testString' + sub_scope_model['description'] = 'testString' + sub_scope_model['environment'] = 'testString' + sub_scope_model['properties'] = [scope_property_model] + + # Construct a json representation of a SubScopeCollection model + sub_scope_collection_model_json = {} + sub_scope_collection_model_json['limit'] = 50 + sub_scope_collection_model_json['total_count'] = 230 + sub_scope_collection_model_json['first'] = page_h_ref_first_model + sub_scope_collection_model_json['next'] = page_h_ref_next_model + sub_scope_collection_model_json['subscopes'] = [sub_scope_model] + + # Construct a model instance of SubScopeCollection by calling from_dict on the json representation + sub_scope_collection_model = SubScopeCollection.from_dict(sub_scope_collection_model_json) + assert sub_scope_collection_model != False + + # Construct a model instance of SubScopeCollection by calling from_dict on the json representation + sub_scope_collection_model_dict = SubScopeCollection.from_dict(sub_scope_collection_model_json).__dict__ + sub_scope_collection_model2 = SubScopeCollection(**sub_scope_collection_model_dict) + + # Verify the model instances are equivalent + assert sub_scope_collection_model == sub_scope_collection_model2 + + # Convert model instance back to dict and verify no loss of data + sub_scope_collection_model_json2 = sub_scope_collection_model.to_dict() + assert sub_scope_collection_model_json2 == sub_scope_collection_model_json + + +class TestModel_SubScopeResponse: + """ + Test Class for SubScopeResponse + """ + + def test_sub_scope_response_serialization(self): + """ + Test serialization/deserialization for SubScopeResponse + """ + + # Construct dict forms of any model objects needed in order to build this model. + + scope_property_model = {} # ScopePropertyScopeType + scope_property_model['name'] = 'scope_type' + scope_property_model['value'] = 'account' + + sub_scope_model = {} # SubScope + sub_scope_model['id'] = 'testString' + sub_scope_model['name'] = 'testString' + sub_scope_model['description'] = 'testString' + sub_scope_model['environment'] = 'testString' + sub_scope_model['properties'] = [scope_property_model] + + # Construct a json representation of a SubScopeResponse model + sub_scope_response_model_json = {} + sub_scope_response_model_json['subscopes'] = [sub_scope_model] + + # Construct a model instance of SubScopeResponse by calling from_dict on the json representation + sub_scope_response_model = SubScopeResponse.from_dict(sub_scope_response_model_json) + assert sub_scope_response_model != False + + # Construct a model instance of SubScopeResponse by calling from_dict on the json representation + sub_scope_response_model_dict = SubScopeResponse.from_dict(sub_scope_response_model_json).__dict__ + sub_scope_response_model2 = SubScopeResponse(**sub_scope_response_model_dict) + + # Verify the model instances are equivalent + assert sub_scope_response_model == sub_scope_response_model2 + + # Convert model instance back to dict and verify no loss of data + sub_scope_response_model_json2 = sub_scope_response_model.to_dict() + assert sub_scope_response_model_json2 == sub_scope_response_model_json + + +class TestModel_SupportedConfigs: + """ + Test Class for SupportedConfigs + """ + + def test_supported_configs_serialization(self): + """ + Test serialization/deserialization for SupportedConfigs + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_property_model = {} # RuleProperty + rule_property_model['name'] = 'testString' + rule_property_model['description'] = 'testString' + rule_property_model['type'] = 'string' + + # Construct a json representation of a SupportedConfigs model + supported_configs_model_json = {} + supported_configs_model_json['resource_kind'] = 'testString' + supported_configs_model_json['additional_target_attributes'] = [additional_target_attribute_model] + supported_configs_model_json['properties'] = [rule_property_model] + supported_configs_model_json['description'] = 'testString' + supported_configs_model_json['cip_requires_service_instance'] = True + supported_configs_model_json['resource_group_support'] = True + supported_configs_model_json['tagging_support'] = True + supported_configs_model_json['inherit_tags'] = True + + # Construct a model instance of SupportedConfigs by calling from_dict on the json representation + supported_configs_model = SupportedConfigs.from_dict(supported_configs_model_json) + assert supported_configs_model != False + + # Construct a model instance of SupportedConfigs by calling from_dict on the json representation + supported_configs_model_dict = SupportedConfigs.from_dict(supported_configs_model_json).__dict__ + supported_configs_model2 = SupportedConfigs(**supported_configs_model_dict) + + # Verify the model instances are equivalent + assert supported_configs_model == supported_configs_model2 + + # Convert model instance back to dict and verify no loss of data + supported_configs_model_json2 = supported_configs_model.to_dict() + assert supported_configs_model_json2 == supported_configs_model_json + + +class TestModel_Tags: + """ + Test Class for Tags + """ + + def test_tags_serialization(self): + """ + Test serialization/deserialization for Tags + """ + + # Construct a json representation of a Tags model + tags_model_json = {} + tags_model_json['user'] = ['testString'] + tags_model_json['access'] = ['testString'] + tags_model_json['service'] = ['testString'] + + # Construct a model instance of Tags by calling from_dict on the json representation + tags_model = Tags.from_dict(tags_model_json) + assert tags_model != False + + # Construct a model instance of Tags by calling from_dict on the json representation + tags_model_dict = Tags.from_dict(tags_model_json).__dict__ + tags_model2 = Tags(**tags_model_dict) + + # Verify the model instances are equivalent + assert tags_model == tags_model2 + + # Convert model instance back to dict and verify no loss of data + tags_model_json2 = tags_model.to_dict() + assert tags_model_json2 == tags_model_json + + +class TestModel_Target: + """ + Test Class for Target + """ + + def test_target_serialization(self): + """ + Test serialization/deserialization for Target + """ + + # Construct dict forms of any model objects needed in order to build this model. + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + resource_model = {} # Resource + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + credential_response_model = {} # CredentialResponse + credential_response_model['type'] = 'iam_credentials' + credential_response_model['secret_crn'] = 'testString' + credential_response_model['secret_name'] = 'my secret' + credential_response_model['resources'] = [resource_model] + + # Construct a json representation of a Target model + target_model_json = {} + target_model_json['id'] = 'a2366444-ad87-40b1-81d0-476df1cc1f18' + target_model_json['account_id'] = 'be200c80cabc456e91139e4152327823' + target_model_json['trusted_profile_id'] = 'Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3' + target_model_json['name'] = 'Target Account-A' + target_model_json['credentials'] = [credential_response_model] + target_model_json['created_by'] = 'IBMid-270007EPPC' + target_model_json['created_on'] = '2024-02-07T05:42:58Z' + target_model_json['updated_by'] = 'IBMid-270007EPPC' + target_model_json['updated_on'] = '2024-02-07T05:42:58Z' + + # Construct a model instance of Target by calling from_dict on the json representation + target_model = Target.from_dict(target_model_json) + assert target_model != False + + # Construct a model instance of Target by calling from_dict on the json representation + target_model_dict = Target.from_dict(target_model_json).__dict__ + target_model2 = Target(**target_model_dict) + + # Verify the model instances are equivalent + assert target_model == target_model2 + + # Convert model instance back to dict and verify no loss of data + target_model_json2 = target_model.to_dict() + assert target_model_json2 == target_model_json + + +class TestModel_TargetCollection: + """ + Test Class for TargetCollection + """ + + def test_target_collection_serialization(self): + """ + Test serialization/deserialization for TargetCollection + """ + + # Construct dict forms of any model objects needed in order to build this model. + + page_h_ref_first_model = {} # PageHRefFirst + page_h_ref_first_model['href'] = 'testString' + + page_h_ref_next_model = {} # PageHRefNext + page_h_ref_next_model['href'] = 'testString' + page_h_ref_next_model['start'] = 'testString' + + account_model = {} # Account + account_model['id'] = '531fc3e28bfc43c5a2cea07786d93f5c' + account_model['name'] = 'NIST' + account_model['type'] = 'account_type' + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + resource_model = {} # Resource + resource_model['report_id'] = '30b434b3-cb08-4845-af10-7a8fc682b6a8' + resource_model['home_account_id'] = '2411ffdc16844b07b42521c3443f456d' + resource_model['id'] = 'crn:v1:bluemix:public:kms:us-south:a/5af747ca19a8a278b1b6e4eec20df507:03502a50-4ea9-463c-80e5-e27ed838cdb6::' + resource_model['resource_name'] = 'jeff\'s key' + resource_model['account'] = account_model + resource_model['component_id'] = 'cloud-object_storage' + resource_model['component_name'] = 'cloud-object_storage' + resource_model['environment'] = 'ibm cloud' + resource_model['tags'] = tags_model + resource_model['status'] = 'compliant' + resource_model['total_count'] = 140 + resource_model['pass_count'] = 123 + resource_model['failure_count'] = 12 + resource_model['error_count'] = 5 + resource_model['skipped_count'] = 7 + resource_model['completed_count'] = 135 + resource_model['service_name'] = 'pm-20' + resource_model['instance_crn'] = 'testString' + + credential_response_model = {} # CredentialResponse + credential_response_model['type'] = 'iam_credentials' + credential_response_model['secret_crn'] = 'testString' + credential_response_model['secret_name'] = 'my secret' + credential_response_model['resources'] = [resource_model] + + target_model = {} # Target + target_model['id'] = 'a2366444-ad87-40b1-81d0-476df1cc1f18' + target_model['account_id'] = 'be200c80cabc456e91139e4152327823' + target_model['trusted_profile_id'] = 'Profile-a0a4c149-4fed-47ff-bfb2-680bcfaa64d3' + target_model['name'] = 'Target Account-A' + target_model['credentials'] = [credential_response_model] + target_model['created_by'] = 'IBMid-270007EPPC' + target_model['created_on'] = '2024-02-07T05:42:58Z' + target_model['updated_by'] = 'IBMid-270007EPPC' + target_model['updated_on'] = '2024-02-07T05:42:58Z' + + # Construct a json representation of a TargetCollection model + target_collection_model_json = {} + target_collection_model_json['limit'] = 50 + target_collection_model_json['total_count'] = 230 + target_collection_model_json['first'] = page_h_ref_first_model + target_collection_model_json['next'] = page_h_ref_next_model + target_collection_model_json['targets'] = [target_model] + + # Construct a model instance of TargetCollection by calling from_dict on the json representation + target_collection_model = TargetCollection.from_dict(target_collection_model_json) + assert target_collection_model != False + + # Construct a model instance of TargetCollection by calling from_dict on the json representation + target_collection_model_dict = TargetCollection.from_dict(target_collection_model_json).__dict__ + target_collection_model2 = TargetCollection(**target_collection_model_dict) + + # Verify the model instances are equivalent + assert target_collection_model == target_collection_model2 + + # Convert model instance back to dict and verify no loss of data + target_collection_model_json2 = target_collection_model.to_dict() + assert target_collection_model_json2 == target_collection_model_json + + +class TestModel_TargetInfo: + """ + Test Class for TargetInfo + """ + + def test_target_info_serialization(self): + """ + Test serialization/deserialization for TargetInfo + """ + + # Construct dict forms of any model objects needed in order to build this model. + + tags_model = {} # Tags + tags_model['user'] = ['testString'] + tags_model['access'] = ['testString'] + tags_model['service'] = ['testString'] + + # Construct a json representation of a TargetInfo model + target_info_model_json = {} + target_info_model_json['id'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket' + target_info_model_json['account_id'] = '59bcbfa6ea2f006b4ed7094c1a08dcdd' + target_info_model_json['service_name'] = 'cloud-object-storage' + target_info_model_json['service_display_name'] = 'cloud-object-storage' + target_info_model_json['resource_crn'] = 'crn:v1:bluemix:public:cloud-object-storage:global:a/59bcbfa6ea2f006b4ed7094c1a08dcdd:1a0ec336-f391-4091-a6fb-5e084a4c56f4:bucket:mybucket' + target_info_model_json['resource_name'] = 'mybucket' + target_info_model_json['tags'] = tags_model + + # Construct a model instance of TargetInfo by calling from_dict on the json representation + target_info_model = TargetInfo.from_dict(target_info_model_json) + assert target_info_model != False + + # Construct a model instance of TargetInfo by calling from_dict on the json representation + target_info_model_dict = TargetInfo.from_dict(target_info_model_json).__dict__ + target_info_model2 = TargetInfo(**target_info_model_dict) + + # Verify the model instances are equivalent + assert target_info_model == target_info_model2 + + # Convert model instance back to dict and verify no loss of data + target_info_model_json2 = target_info_model.to_dict() + assert target_info_model_json2 == target_info_model_json + + +class TestModel_TestEvent: + """ + Test Class for TestEvent + """ + + def test_test_event_serialization(self): + """ + Test serialization/deserialization for TestEvent + """ + + # Construct a json representation of a TestEvent model + test_event_model_json = {} + test_event_model_json['success'] = True + + # Construct a model instance of TestEvent by calling from_dict on the json representation + test_event_model = TestEvent.from_dict(test_event_model_json) + assert test_event_model != False + + # Construct a model instance of TestEvent by calling from_dict on the json representation + test_event_model_dict = TestEvent.from_dict(test_event_model_json).__dict__ + test_event_model2 = TestEvent(**test_event_model_dict) + + # Verify the model instances are equivalent + assert test_event_model == test_event_model2 + + # Convert model instance back to dict and verify no loss of data + test_event_model_json2 = test_event_model.to_dict() + assert test_event_model_json2 == test_event_model_json + + +class TestModel_ConditionItemConditionBase: + """ + Test Class for ConditionItemConditionBase + """ + + def test_condition_item_condition_base_serialization(self): + """ + Test serialization/deserialization for ConditionItemConditionBase + """ + + # Construct a json representation of a ConditionItemConditionBase model + condition_item_condition_base_model_json = {} + condition_item_condition_base_model_json['description'] = 'testString' + condition_item_condition_base_model_json['property'] = 'testString' + condition_item_condition_base_model_json['operator'] = 'string_equals' + condition_item_condition_base_model_json['value'] = 'testString' + + # Construct a model instance of ConditionItemConditionBase by calling from_dict on the json representation + condition_item_condition_base_model = ConditionItemConditionBase.from_dict(condition_item_condition_base_model_json) + assert condition_item_condition_base_model != False + + # Construct a model instance of ConditionItemConditionBase by calling from_dict on the json representation + condition_item_condition_base_model_dict = ConditionItemConditionBase.from_dict(condition_item_condition_base_model_json).__dict__ + condition_item_condition_base_model2 = ConditionItemConditionBase(**condition_item_condition_base_model_dict) + + # Verify the model instances are equivalent + assert condition_item_condition_base_model == condition_item_condition_base_model2 + + # Convert model instance back to dict and verify no loss of data + condition_item_condition_base_model_json2 = condition_item_condition_base_model.to_dict() + assert condition_item_condition_base_model_json2 == condition_item_condition_base_model_json + + +class TestModel_RequiredConfigConditionBase: + """ + Test Class for RequiredConfigConditionBase + """ + + def test_required_config_condition_base_serialization(self): + """ + Test serialization/deserialization for RequiredConfigConditionBase + """ + + # Construct a json representation of a RequiredConfigConditionBase model + required_config_condition_base_model_json = {} + required_config_condition_base_model_json['description'] = 'testString' + required_config_condition_base_model_json['property'] = 'testString' + required_config_condition_base_model_json['operator'] = 'string_equals' + required_config_condition_base_model_json['value'] = 'testString' + + # Construct a model instance of RequiredConfigConditionBase by calling from_dict on the json representation + required_config_condition_base_model = RequiredConfigConditionBase.from_dict(required_config_condition_base_model_json) + assert required_config_condition_base_model != False + + # Construct a model instance of RequiredConfigConditionBase by calling from_dict on the json representation + required_config_condition_base_model_dict = RequiredConfigConditionBase.from_dict(required_config_condition_base_model_json).__dict__ + required_config_condition_base_model2 = RequiredConfigConditionBase(**required_config_condition_base_model_dict) + + # Verify the model instances are equivalent + assert required_config_condition_base_model == required_config_condition_base_model2 + + # Convert model instance back to dict and verify no loss of data + required_config_condition_base_model_json2 = required_config_condition_base_model.to_dict() + assert required_config_condition_base_model_json2 == required_config_condition_base_model_json + + +class TestModel_ScopePropertyExclusions: + """ + Test Class for ScopePropertyExclusions + """ + + def test_scope_property_exclusions_serialization(self): + """ + Test serialization/deserialization for ScopePropertyExclusions + """ + + # Construct dict forms of any model objects needed in order to build this model. + + scope_property_exclusion_item_model = {} # ScopePropertyExclusionItem + scope_property_exclusion_item_model['scope_id'] = 'testString' + scope_property_exclusion_item_model['scope_type'] = 'enterprise' + + # Construct a json representation of a ScopePropertyExclusions model + scope_property_exclusions_model_json = {} + scope_property_exclusions_model_json['name'] = 'exclusions' + scope_property_exclusions_model_json['value'] = [scope_property_exclusion_item_model] + + # Construct a model instance of ScopePropertyExclusions by calling from_dict on the json representation + scope_property_exclusions_model = ScopePropertyExclusions.from_dict(scope_property_exclusions_model_json) + assert scope_property_exclusions_model != False + + # Construct a model instance of ScopePropertyExclusions by calling from_dict on the json representation + scope_property_exclusions_model_dict = ScopePropertyExclusions.from_dict(scope_property_exclusions_model_json).__dict__ + scope_property_exclusions_model2 = ScopePropertyExclusions(**scope_property_exclusions_model_dict) + + # Verify the model instances are equivalent + assert scope_property_exclusions_model == scope_property_exclusions_model2 + + # Convert model instance back to dict and verify no loss of data + scope_property_exclusions_model_json2 = scope_property_exclusions_model.to_dict() + assert scope_property_exclusions_model_json2 == scope_property_exclusions_model_json + + +class TestModel_ScopePropertyScopeId: + """ + Test Class for ScopePropertyScopeId + """ + + def test_scope_property_scope_id_serialization(self): + """ + Test serialization/deserialization for ScopePropertyScopeId + """ + + # Construct a json representation of a ScopePropertyScopeId model + scope_property_scope_id_model_json = {} + scope_property_scope_id_model_json['name'] = 'scope_id' + scope_property_scope_id_model_json['value'] = 'testString' + + # Construct a model instance of ScopePropertyScopeId by calling from_dict on the json representation + scope_property_scope_id_model = ScopePropertyScopeId.from_dict(scope_property_scope_id_model_json) + assert scope_property_scope_id_model != False + + # Construct a model instance of ScopePropertyScopeId by calling from_dict on the json representation + scope_property_scope_id_model_dict = ScopePropertyScopeId.from_dict(scope_property_scope_id_model_json).__dict__ + scope_property_scope_id_model2 = ScopePropertyScopeId(**scope_property_scope_id_model_dict) + + # Verify the model instances are equivalent + assert scope_property_scope_id_model == scope_property_scope_id_model2 + + # Convert model instance back to dict and verify no loss of data + scope_property_scope_id_model_json2 = scope_property_scope_id_model.to_dict() + assert scope_property_scope_id_model_json2 == scope_property_scope_id_model_json + + +class TestModel_ScopePropertyScopeType: + """ + Test Class for ScopePropertyScopeType + """ + + def test_scope_property_scope_type_serialization(self): + """ + Test serialization/deserialization for ScopePropertyScopeType + """ + + # Construct a json representation of a ScopePropertyScopeType model + scope_property_scope_type_model_json = {} + scope_property_scope_type_model_json['name'] = 'scope_type' + scope_property_scope_type_model_json['value'] = 'account' + + # Construct a model instance of ScopePropertyScopeType by calling from_dict on the json representation + scope_property_scope_type_model = ScopePropertyScopeType.from_dict(scope_property_scope_type_model_json) + assert scope_property_scope_type_model != False + + # Construct a model instance of ScopePropertyScopeType by calling from_dict on the json representation + scope_property_scope_type_model_dict = ScopePropertyScopeType.from_dict(scope_property_scope_type_model_json).__dict__ + scope_property_scope_type_model2 = ScopePropertyScopeType(**scope_property_scope_type_model_dict) + + # Verify the model instances are equivalent + assert scope_property_scope_type_model == scope_property_scope_type_model2 + + # Convert model instance back to dict and verify no loss of data + scope_property_scope_type_model_json2 = scope_property_scope_type_model.to_dict() + assert scope_property_scope_type_model_json2 == scope_property_scope_type_model_json + + +class TestModel_ConditionItemConditionListConditionListConditionAnd: + """ + Test Class for ConditionItemConditionListConditionListConditionAnd + """ + + def test_condition_item_condition_list_condition_list_condition_and_serialization(self): + """ + Test serialization/deserialization for ConditionItemConditionListConditionListConditionAnd + """ + + # Construct dict forms of any model objects needed in order to build this model. + + condition_item_model = {} # ConditionItemConditionBase + condition_item_model['description'] = 'testString' + condition_item_model['property'] = 'testString' + condition_item_model['operator'] = 'string_equals' + condition_item_model['value'] = 'testString' + + # Construct a json representation of a ConditionItemConditionListConditionListConditionAnd model + condition_item_condition_list_condition_list_condition_and_model_json = {} + condition_item_condition_list_condition_list_condition_and_model_json['description'] = 'testString' + condition_item_condition_list_condition_list_condition_and_model_json['and'] = [condition_item_model] + + # Construct a model instance of ConditionItemConditionListConditionListConditionAnd by calling from_dict on the json representation + condition_item_condition_list_condition_list_condition_and_model = ConditionItemConditionListConditionListConditionAnd.from_dict(condition_item_condition_list_condition_list_condition_and_model_json) + assert condition_item_condition_list_condition_list_condition_and_model != False + + # Construct a model instance of ConditionItemConditionListConditionListConditionAnd by calling from_dict on the json representation + condition_item_condition_list_condition_list_condition_and_model_dict = ConditionItemConditionListConditionListConditionAnd.from_dict(condition_item_condition_list_condition_list_condition_and_model_json).__dict__ + condition_item_condition_list_condition_list_condition_and_model2 = ConditionItemConditionListConditionListConditionAnd(**condition_item_condition_list_condition_list_condition_and_model_dict) + + # Verify the model instances are equivalent + assert condition_item_condition_list_condition_list_condition_and_model == condition_item_condition_list_condition_list_condition_and_model2 + + # Convert model instance back to dict and verify no loss of data + condition_item_condition_list_condition_list_condition_and_model_json2 = condition_item_condition_list_condition_list_condition_and_model.to_dict() + assert condition_item_condition_list_condition_list_condition_and_model_json2 == condition_item_condition_list_condition_list_condition_and_model_json + + +class TestModel_ConditionItemConditionListConditionListConditionOr: + """ + Test Class for ConditionItemConditionListConditionListConditionOr + """ + + def test_condition_item_condition_list_condition_list_condition_or_serialization(self): + """ + Test serialization/deserialization for ConditionItemConditionListConditionListConditionOr + """ + + # Construct dict forms of any model objects needed in order to build this model. + + condition_item_model = {} # ConditionItemConditionBase + condition_item_model['description'] = 'testString' + condition_item_model['property'] = 'testString' + condition_item_model['operator'] = 'string_equals' + condition_item_model['value'] = 'testString' + + # Construct a json representation of a ConditionItemConditionListConditionListConditionOr model + condition_item_condition_list_condition_list_condition_or_model_json = {} + condition_item_condition_list_condition_list_condition_or_model_json['description'] = 'testString' + condition_item_condition_list_condition_list_condition_or_model_json['or'] = [condition_item_model] + + # Construct a model instance of ConditionItemConditionListConditionListConditionOr by calling from_dict on the json representation + condition_item_condition_list_condition_list_condition_or_model = ConditionItemConditionListConditionListConditionOr.from_dict(condition_item_condition_list_condition_list_condition_or_model_json) + assert condition_item_condition_list_condition_list_condition_or_model != False + + # Construct a model instance of ConditionItemConditionListConditionListConditionOr by calling from_dict on the json representation + condition_item_condition_list_condition_list_condition_or_model_dict = ConditionItemConditionListConditionListConditionOr.from_dict(condition_item_condition_list_condition_list_condition_or_model_json).__dict__ + condition_item_condition_list_condition_list_condition_or_model2 = ConditionItemConditionListConditionListConditionOr(**condition_item_condition_list_condition_list_condition_or_model_dict) + + # Verify the model instances are equivalent + assert condition_item_condition_list_condition_list_condition_or_model == condition_item_condition_list_condition_list_condition_or_model2 + + # Convert model instance back to dict and verify no loss of data + condition_item_condition_list_condition_list_condition_or_model_json2 = condition_item_condition_list_condition_list_condition_or_model.to_dict() + assert condition_item_condition_list_condition_list_condition_or_model_json2 == condition_item_condition_list_condition_list_condition_or_model_json + + +class TestModel_ConditionItemConditionSubRuleConditionSubRuleConditionAll: + """ + Test Class for ConditionItemConditionSubRuleConditionSubRuleConditionAll + """ + + def test_condition_item_condition_sub_rule_condition_sub_rule_condition_all_serialization(self): + """ + Test serialization/deserialization for ConditionItemConditionSubRuleConditionSubRuleConditionAll + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + sub_rule_model = {} # SubRule + sub_rule_model['target'] = rule_target_model + sub_rule_model['required_config'] = required_config_model + + # Construct a json representation of a ConditionItemConditionSubRuleConditionSubRuleConditionAll model + condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_json = {} + condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_json['all'] = sub_rule_model + + # Construct a model instance of ConditionItemConditionSubRuleConditionSubRuleConditionAll by calling from_dict on the json representation + condition_item_condition_sub_rule_condition_sub_rule_condition_all_model = ConditionItemConditionSubRuleConditionSubRuleConditionAll.from_dict(condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_json) + assert condition_item_condition_sub_rule_condition_sub_rule_condition_all_model != False + + # Construct a model instance of ConditionItemConditionSubRuleConditionSubRuleConditionAll by calling from_dict on the json representation + condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_dict = ConditionItemConditionSubRuleConditionSubRuleConditionAll.from_dict(condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_json).__dict__ + condition_item_condition_sub_rule_condition_sub_rule_condition_all_model2 = ConditionItemConditionSubRuleConditionSubRuleConditionAll(**condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_dict) + + # Verify the model instances are equivalent + assert condition_item_condition_sub_rule_condition_sub_rule_condition_all_model == condition_item_condition_sub_rule_condition_sub_rule_condition_all_model2 + + # Convert model instance back to dict and verify no loss of data + condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_json2 = condition_item_condition_sub_rule_condition_sub_rule_condition_all_model.to_dict() + assert condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_json2 == condition_item_condition_sub_rule_condition_sub_rule_condition_all_model_json + + +class TestModel_ConditionItemConditionSubRuleConditionSubRuleConditionAllIf: + """ + Test Class for ConditionItemConditionSubRuleConditionSubRuleConditionAllIf + """ + + def test_condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_serialization(self): + """ + Test serialization/deserialization for ConditionItemConditionSubRuleConditionSubRuleConditionAllIf + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + sub_rule_model = {} # SubRule + sub_rule_model['target'] = rule_target_model + sub_rule_model['required_config'] = required_config_model + + # Construct a json representation of a ConditionItemConditionSubRuleConditionSubRuleConditionAllIf model + condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_json = {} + condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_json['all_ifexists'] = sub_rule_model + + # Construct a model instance of ConditionItemConditionSubRuleConditionSubRuleConditionAllIf by calling from_dict on the json representation + condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model = ConditionItemConditionSubRuleConditionSubRuleConditionAllIf.from_dict(condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_json) + assert condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model != False + + # Construct a model instance of ConditionItemConditionSubRuleConditionSubRuleConditionAllIf by calling from_dict on the json representation + condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_dict = ConditionItemConditionSubRuleConditionSubRuleConditionAllIf.from_dict(condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_json).__dict__ + condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model2 = ConditionItemConditionSubRuleConditionSubRuleConditionAllIf(**condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_dict) + + # Verify the model instances are equivalent + assert condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model == condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model2 + + # Convert model instance back to dict and verify no loss of data + condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_json2 = condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model.to_dict() + assert condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_json2 == condition_item_condition_sub_rule_condition_sub_rule_condition_all_if_model_json + + +class TestModel_ConditionItemConditionSubRuleConditionSubRuleConditionAny: + """ + Test Class for ConditionItemConditionSubRuleConditionSubRuleConditionAny + """ + + def test_condition_item_condition_sub_rule_condition_sub_rule_condition_any_serialization(self): + """ + Test serialization/deserialization for ConditionItemConditionSubRuleConditionSubRuleConditionAny + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + sub_rule_model = {} # SubRule + sub_rule_model['target'] = rule_target_model + sub_rule_model['required_config'] = required_config_model + + # Construct a json representation of a ConditionItemConditionSubRuleConditionSubRuleConditionAny model + condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_json = {} + condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_json['any'] = sub_rule_model + + # Construct a model instance of ConditionItemConditionSubRuleConditionSubRuleConditionAny by calling from_dict on the json representation + condition_item_condition_sub_rule_condition_sub_rule_condition_any_model = ConditionItemConditionSubRuleConditionSubRuleConditionAny.from_dict(condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_json) + assert condition_item_condition_sub_rule_condition_sub_rule_condition_any_model != False + + # Construct a model instance of ConditionItemConditionSubRuleConditionSubRuleConditionAny by calling from_dict on the json representation + condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_dict = ConditionItemConditionSubRuleConditionSubRuleConditionAny.from_dict(condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_json).__dict__ + condition_item_condition_sub_rule_condition_sub_rule_condition_any_model2 = ConditionItemConditionSubRuleConditionSubRuleConditionAny(**condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_dict) + + # Verify the model instances are equivalent + assert condition_item_condition_sub_rule_condition_sub_rule_condition_any_model == condition_item_condition_sub_rule_condition_sub_rule_condition_any_model2 + + # Convert model instance back to dict and verify no loss of data + condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_json2 = condition_item_condition_sub_rule_condition_sub_rule_condition_any_model.to_dict() + assert condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_json2 == condition_item_condition_sub_rule_condition_sub_rule_condition_any_model_json + + +class TestModel_ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf: + """ + Test Class for ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf + """ + + def test_condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_serialization(self): + """ + Test serialization/deserialization for ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + sub_rule_model = {} # SubRule + sub_rule_model['target'] = rule_target_model + sub_rule_model['required_config'] = required_config_model + + # Construct a json representation of a ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf model + condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_json = {} + condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_json['any_ifexists'] = sub_rule_model + + # Construct a model instance of ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf by calling from_dict on the json representation + condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model = ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf.from_dict(condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_json) + assert condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model != False + + # Construct a model instance of ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf by calling from_dict on the json representation + condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_dict = ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf.from_dict(condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_json).__dict__ + condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model2 = ConditionItemConditionSubRuleConditionSubRuleConditionAnyIf(**condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_dict) + + # Verify the model instances are equivalent + assert condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model == condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model2 + + # Convert model instance back to dict and verify no loss of data + condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_json2 = condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model.to_dict() + assert condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_json2 == condition_item_condition_sub_rule_condition_sub_rule_condition_any_if_model_json + + +class TestModel_RequiredConfigConditionListConditionListConditionAnd: + """ + Test Class for RequiredConfigConditionListConditionListConditionAnd + """ + + def test_required_config_condition_list_condition_list_condition_and_serialization(self): + """ + Test serialization/deserialization for RequiredConfigConditionListConditionListConditionAnd + """ + + # Construct dict forms of any model objects needed in order to build this model. + + condition_item_model = {} # ConditionItemConditionBase + condition_item_model['description'] = 'testString' + condition_item_model['property'] = 'testString' + condition_item_model['operator'] = 'string_equals' + condition_item_model['value'] = 'testString' + + # Construct a json representation of a RequiredConfigConditionListConditionListConditionAnd model + required_config_condition_list_condition_list_condition_and_model_json = {} + required_config_condition_list_condition_list_condition_and_model_json['description'] = 'testString' + required_config_condition_list_condition_list_condition_and_model_json['and'] = [condition_item_model] + + # Construct a model instance of RequiredConfigConditionListConditionListConditionAnd by calling from_dict on the json representation + required_config_condition_list_condition_list_condition_and_model = RequiredConfigConditionListConditionListConditionAnd.from_dict(required_config_condition_list_condition_list_condition_and_model_json) + assert required_config_condition_list_condition_list_condition_and_model != False + + # Construct a model instance of RequiredConfigConditionListConditionListConditionAnd by calling from_dict on the json representation + required_config_condition_list_condition_list_condition_and_model_dict = RequiredConfigConditionListConditionListConditionAnd.from_dict(required_config_condition_list_condition_list_condition_and_model_json).__dict__ + required_config_condition_list_condition_list_condition_and_model2 = RequiredConfigConditionListConditionListConditionAnd(**required_config_condition_list_condition_list_condition_and_model_dict) + + # Verify the model instances are equivalent + assert required_config_condition_list_condition_list_condition_and_model == required_config_condition_list_condition_list_condition_and_model2 + + # Convert model instance back to dict and verify no loss of data + required_config_condition_list_condition_list_condition_and_model_json2 = required_config_condition_list_condition_list_condition_and_model.to_dict() + assert required_config_condition_list_condition_list_condition_and_model_json2 == required_config_condition_list_condition_list_condition_and_model_json + + +class TestModel_RequiredConfigConditionListConditionListConditionOr: + """ + Test Class for RequiredConfigConditionListConditionListConditionOr + """ + + def test_required_config_condition_list_condition_list_condition_or_serialization(self): + """ + Test serialization/deserialization for RequiredConfigConditionListConditionListConditionOr + """ + + # Construct dict forms of any model objects needed in order to build this model. + + condition_item_model = {} # ConditionItemConditionBase + condition_item_model['description'] = 'testString' + condition_item_model['property'] = 'testString' + condition_item_model['operator'] = 'string_equals' + condition_item_model['value'] = 'testString' + + # Construct a json representation of a RequiredConfigConditionListConditionListConditionOr model + required_config_condition_list_condition_list_condition_or_model_json = {} + required_config_condition_list_condition_list_condition_or_model_json['description'] = 'testString' + required_config_condition_list_condition_list_condition_or_model_json['or'] = [condition_item_model] + + # Construct a model instance of RequiredConfigConditionListConditionListConditionOr by calling from_dict on the json representation + required_config_condition_list_condition_list_condition_or_model = RequiredConfigConditionListConditionListConditionOr.from_dict(required_config_condition_list_condition_list_condition_or_model_json) + assert required_config_condition_list_condition_list_condition_or_model != False + + # Construct a model instance of RequiredConfigConditionListConditionListConditionOr by calling from_dict on the json representation + required_config_condition_list_condition_list_condition_or_model_dict = RequiredConfigConditionListConditionListConditionOr.from_dict(required_config_condition_list_condition_list_condition_or_model_json).__dict__ + required_config_condition_list_condition_list_condition_or_model2 = RequiredConfigConditionListConditionListConditionOr(**required_config_condition_list_condition_list_condition_or_model_dict) + + # Verify the model instances are equivalent + assert required_config_condition_list_condition_list_condition_or_model == required_config_condition_list_condition_list_condition_or_model2 + + # Convert model instance back to dict and verify no loss of data + required_config_condition_list_condition_list_condition_or_model_json2 = required_config_condition_list_condition_list_condition_or_model.to_dict() + assert required_config_condition_list_condition_list_condition_or_model_json2 == required_config_condition_list_condition_list_condition_or_model_json + + +class TestModel_RequiredConfigConditionSubRuleConditionSubRuleConditionAll: + """ + Test Class for RequiredConfigConditionSubRuleConditionSubRuleConditionAll + """ + + def test_required_config_condition_sub_rule_condition_sub_rule_condition_all_serialization(self): + """ + Test serialization/deserialization for RequiredConfigConditionSubRuleConditionSubRuleConditionAll + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + sub_rule_model = {} # SubRule + sub_rule_model['target'] = rule_target_model + sub_rule_model['required_config'] = required_config_model + + # Construct a json representation of a RequiredConfigConditionSubRuleConditionSubRuleConditionAll model + required_config_condition_sub_rule_condition_sub_rule_condition_all_model_json = {} + required_config_condition_sub_rule_condition_sub_rule_condition_all_model_json['all'] = sub_rule_model + + # Construct a model instance of RequiredConfigConditionSubRuleConditionSubRuleConditionAll by calling from_dict on the json representation + required_config_condition_sub_rule_condition_sub_rule_condition_all_model = RequiredConfigConditionSubRuleConditionSubRuleConditionAll.from_dict(required_config_condition_sub_rule_condition_sub_rule_condition_all_model_json) + assert required_config_condition_sub_rule_condition_sub_rule_condition_all_model != False + + # Construct a model instance of RequiredConfigConditionSubRuleConditionSubRuleConditionAll by calling from_dict on the json representation + required_config_condition_sub_rule_condition_sub_rule_condition_all_model_dict = RequiredConfigConditionSubRuleConditionSubRuleConditionAll.from_dict(required_config_condition_sub_rule_condition_sub_rule_condition_all_model_json).__dict__ + required_config_condition_sub_rule_condition_sub_rule_condition_all_model2 = RequiredConfigConditionSubRuleConditionSubRuleConditionAll(**required_config_condition_sub_rule_condition_sub_rule_condition_all_model_dict) + + # Verify the model instances are equivalent + assert required_config_condition_sub_rule_condition_sub_rule_condition_all_model == required_config_condition_sub_rule_condition_sub_rule_condition_all_model2 + + # Convert model instance back to dict and verify no loss of data + required_config_condition_sub_rule_condition_sub_rule_condition_all_model_json2 = required_config_condition_sub_rule_condition_sub_rule_condition_all_model.to_dict() + assert required_config_condition_sub_rule_condition_sub_rule_condition_all_model_json2 == required_config_condition_sub_rule_condition_sub_rule_condition_all_model_json + + +class TestModel_RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf: + """ + Test Class for RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf + """ + + def test_required_config_condition_sub_rule_condition_sub_rule_condition_all_if_serialization(self): + """ + Test serialization/deserialization for RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + sub_rule_model = {} # SubRule + sub_rule_model['target'] = rule_target_model + sub_rule_model['required_config'] = required_config_model + + # Construct a json representation of a RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf model + required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_json = {} + required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_json['all_ifexists'] = sub_rule_model + + # Construct a model instance of RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf by calling from_dict on the json representation + required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model = RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf.from_dict(required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_json) + assert required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model != False + + # Construct a model instance of RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf by calling from_dict on the json representation + required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_dict = RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf.from_dict(required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_json).__dict__ + required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model2 = RequiredConfigConditionSubRuleConditionSubRuleConditionAllIf(**required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_dict) + + # Verify the model instances are equivalent + assert required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model == required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model2 + + # Convert model instance back to dict and verify no loss of data + required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_json2 = required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model.to_dict() + assert required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_json2 == required_config_condition_sub_rule_condition_sub_rule_condition_all_if_model_json + + +class TestModel_RequiredConfigConditionSubRuleConditionSubRuleConditionAny: + """ + Test Class for RequiredConfigConditionSubRuleConditionSubRuleConditionAny + """ + + def test_required_config_condition_sub_rule_condition_sub_rule_condition_any_serialization(self): + """ + Test serialization/deserialization for RequiredConfigConditionSubRuleConditionSubRuleConditionAny + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + sub_rule_model = {} # SubRule + sub_rule_model['target'] = rule_target_model + sub_rule_model['required_config'] = required_config_model + + # Construct a json representation of a RequiredConfigConditionSubRuleConditionSubRuleConditionAny model + required_config_condition_sub_rule_condition_sub_rule_condition_any_model_json = {} + required_config_condition_sub_rule_condition_sub_rule_condition_any_model_json['any'] = sub_rule_model + + # Construct a model instance of RequiredConfigConditionSubRuleConditionSubRuleConditionAny by calling from_dict on the json representation + required_config_condition_sub_rule_condition_sub_rule_condition_any_model = RequiredConfigConditionSubRuleConditionSubRuleConditionAny.from_dict(required_config_condition_sub_rule_condition_sub_rule_condition_any_model_json) + assert required_config_condition_sub_rule_condition_sub_rule_condition_any_model != False + + # Construct a model instance of RequiredConfigConditionSubRuleConditionSubRuleConditionAny by calling from_dict on the json representation + required_config_condition_sub_rule_condition_sub_rule_condition_any_model_dict = RequiredConfigConditionSubRuleConditionSubRuleConditionAny.from_dict(required_config_condition_sub_rule_condition_sub_rule_condition_any_model_json).__dict__ + required_config_condition_sub_rule_condition_sub_rule_condition_any_model2 = RequiredConfigConditionSubRuleConditionSubRuleConditionAny(**required_config_condition_sub_rule_condition_sub_rule_condition_any_model_dict) + + # Verify the model instances are equivalent + assert required_config_condition_sub_rule_condition_sub_rule_condition_any_model == required_config_condition_sub_rule_condition_sub_rule_condition_any_model2 + + # Convert model instance back to dict and verify no loss of data + required_config_condition_sub_rule_condition_sub_rule_condition_any_model_json2 = required_config_condition_sub_rule_condition_sub_rule_condition_any_model.to_dict() + assert required_config_condition_sub_rule_condition_sub_rule_condition_any_model_json2 == required_config_condition_sub_rule_condition_sub_rule_condition_any_model_json + + +class TestModel_RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf: + """ + Test Class for RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf + """ + + def test_required_config_condition_sub_rule_condition_sub_rule_condition_any_if_serialization(self): + """ + Test serialization/deserialization for RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf + """ + + # Construct dict forms of any model objects needed in order to build this model. + + additional_target_attribute_model = {} # AdditionalTargetAttribute + additional_target_attribute_model['name'] = 'testString' + additional_target_attribute_model['operator'] = 'string_equals' + additional_target_attribute_model['value'] = 'testString' + + rule_target_model = {} # RuleTarget + rule_target_model['service_name'] = 'testString' + rule_target_model['service_display_name'] = 'testString' + rule_target_model['resource_kind'] = 'testString' + rule_target_model['additional_target_attributes'] = [additional_target_attribute_model] + rule_target_model['ref'] = 'testString' + + required_config_model = {} # RequiredConfigConditionBase + required_config_model['description'] = 'testString' + required_config_model['property'] = 'testString' + required_config_model['operator'] = 'string_equals' + required_config_model['value'] = 'testString' + + sub_rule_model = {} # SubRule + sub_rule_model['target'] = rule_target_model + sub_rule_model['required_config'] = required_config_model + + # Construct a json representation of a RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf model + required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_json = {} + required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_json['any_ifexists'] = sub_rule_model + + # Construct a model instance of RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf by calling from_dict on the json representation + required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model = RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.from_dict(required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_json) + assert required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model != False + + # Construct a model instance of RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf by calling from_dict on the json representation + required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_dict = RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf.from_dict(required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_json).__dict__ + required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model2 = RequiredConfigConditionSubRuleConditionSubRuleConditionAnyIf(**required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_dict) + + # Verify the model instances are equivalent + assert required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model == required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model2 + + # Convert model instance back to dict and verify no loss of data + required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_json2 = required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model.to_dict() + assert required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_json2 == required_config_condition_sub_rule_condition_sub_rule_condition_any_if_model_json + + +# endregion +############################################################################## +# End of Model Tests +##############################################################################