index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
1.07M
signature
stringlengths
2
42.8k
719,774
ibm_platform_services.iam_policy_management_v1
delete_policy_assignment
Remove a policy assignment. Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if the status is "in_progress". :param str assignment_id: The policy template assignment ID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_policy_assignment( self, assignment_id: str, **kwargs, ) -> DetailedResponse: """ Remove a policy assignment. Remove a policy template assignment by providing a policy assignment ID. You can't delete a policy assignment if the status is "in_progress". :param str assignment_id: The policy template assignment 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 assignment_id: raise ValueError('assignment_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_policy_assignment', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['assignment_id'] path_param_values = self.encode_path_vars(assignment_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_assignments/{assignment_id}'.format(**path_param_dict) request = self.prepare_request( method='DELETE', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, assignment_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,775
ibm_platform_services.iam_policy_management_v1
delete_policy_template
Delete a policy template. Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove the policy assignments first. :param str policy_template_id: The policy template ID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_policy_template( self, policy_template_id: str, **kwargs, ) -> DetailedResponse: """ Delete a policy template. Delete a policy template by providing the policy template ID. This deletes all versions of this template. A policy template can't be deleted if any version of the template is assigned to one or more child accounts. You must remove the policy assignments first. :param str policy_template_id: The policy template 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 policy_template_id: raise ValueError('policy_template_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_policy_template', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['policy_template_id'] path_param_values = self.encode_path_vars(policy_template_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_templates/{policy_template_id}'.format(**path_param_dict) request = self.prepare_request( method='DELETE', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, policy_template_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,776
ibm_platform_services.iam_policy_management_v1
delete_policy_template_version
Delete a policy template version. Delete a specific version of a policy template by providing a policy template ID and version number. You can't delete a policy template version that is assigned to one or more child accounts. You must remove the policy assignments first. :param str policy_template_id: The policy template ID. :param str version: The policy template version. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_policy_template_version( self, policy_template_id: str, version: str, **kwargs, ) -> DetailedResponse: """ Delete a policy template version. Delete a specific version of a policy template by providing a policy template ID and version number. You can't delete a policy template version that is assigned to one or more child accounts. You must remove the policy assignments first. :param str policy_template_id: The policy template ID. :param str version: The policy template version. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not policy_template_id: raise ValueError('policy_template_id must be provided') if not version: raise ValueError('version must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_policy_template_version', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['policy_template_id', 'version'] path_param_values = self.encode_path_vars(policy_template_id, version) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_templates/{policy_template_id}/versions/{version}'.format(**path_param_dict) request = self.prepare_request( method='DELETE', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, policy_template_id: str, version: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,777
ibm_platform_services.iam_policy_management_v1
delete_role
Delete a role by ID. Delete a role by providing a role ID. :param str role_id: The role ID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_role( self, role_id: str, **kwargs, ) -> DetailedResponse: """ Delete a role by ID. Delete a role by providing a role ID. :param str role_id: The role 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 role_id: raise ValueError('role_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_role', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['role_id'] path_param_values = self.encode_path_vars(role_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/roles/{role_id}'.format(**path_param_dict) request = self.prepare_request( method='DELETE', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, role_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,778
ibm_platform_services.iam_policy_management_v1
delete_v2_policy
Delete a policy by ID. Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service ID. If the subject of the policy is a locked service-id, the request will fail. :param str id: The policy ID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_v2_policy( self, id: str, **kwargs, ) -> DetailedResponse: """ Delete a policy by ID. Delete a policy by providing a policy ID. A policy cannot be deleted if the subject ID contains a locked service ID. If the subject of the policy is a locked service-id, the request will fail. :param str id: The policy 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 id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_v2_policy', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/policies/{id}'.format(**path_param_dict) request = self.prepare_request( method='DELETE', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,785
ibm_platform_services.iam_policy_management_v1
get_policy
Retrieve a policy by ID. Retrieve a policy by providing a policy ID. :param str policy_id: The policy 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 `PolicyTemplateMetaData` object
def get_policy( self, policy_id: str, **kwargs, ) -> DetailedResponse: """ Retrieve a policy by ID. Retrieve a policy by providing a policy ID. :param str policy_id: The policy 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 `PolicyTemplateMetaData` object """ if not policy_id: raise ValueError('policy_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_policy', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['policy_id'] path_param_values = self.encode_path_vars(policy_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policies/{policy_id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, policy_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,786
ibm_platform_services.iam_policy_management_v1
get_policy_assignment
Retrieve a policy assignment. Retrieve a policy template assignment by providing a policy assignment ID. :param str assignment_id: The policy template assignment ID. :param str version: specify version of response body format. :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 `GetPolicyAssignmentResponse` object
def get_policy_assignment( self, assignment_id: str, version: str, **kwargs, ) -> DetailedResponse: """ Retrieve a policy assignment. Retrieve a policy template assignment by providing a policy assignment ID. :param str assignment_id: The policy template assignment ID. :param str version: specify version of response body format. :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 `GetPolicyAssignmentResponse` object """ if not assignment_id: raise ValueError('assignment_id must be provided') if not version: raise ValueError('version must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_policy_assignment', ) headers.update(sdk_headers) params = { 'version': version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['assignment_id'] path_param_values = self.encode_path_vars(assignment_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_assignments/{assignment_id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, assignment_id: str, version: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,787
ibm_platform_services.iam_policy_management_v1
get_policy_template
Retrieve latest version of a policy template. Retrieve the latest version of a policy template by providing a policy template ID. :param str policy_template_id: The policy template ID. :param str state: (optional) The policy template state. :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 `PolicyTemplate` object
def get_policy_template( self, policy_template_id: str, *, state: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Retrieve latest version of a policy template. Retrieve the latest version of a policy template by providing a policy template ID. :param str policy_template_id: The policy template ID. :param str state: (optional) The policy template state. :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 `PolicyTemplate` object """ if not policy_template_id: raise ValueError('policy_template_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_policy_template', ) headers.update(sdk_headers) params = { 'state': state, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['policy_template_id'] path_param_values = self.encode_path_vars(policy_template_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_templates/{policy_template_id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, policy_template_id: str, *, state: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,788
ibm_platform_services.iam_policy_management_v1
get_policy_template_version
Retrieve a policy template version. Retrieve a policy template by providing a policy template ID and version number. :param str policy_template_id: The policy template ID. :param str version: The policy template version. :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 `PolicyTemplate` object
def get_policy_template_version( self, policy_template_id: str, version: str, **kwargs, ) -> DetailedResponse: """ Retrieve a policy template version. Retrieve a policy template by providing a policy template ID and version number. :param str policy_template_id: The policy template ID. :param str version: The policy template version. :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 `PolicyTemplate` object """ if not policy_template_id: raise ValueError('policy_template_id must be provided') if not version: raise ValueError('version must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_policy_template_version', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['policy_template_id', 'version'] path_param_values = self.encode_path_vars(policy_template_id, version) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_templates/{policy_template_id}/versions/{version}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, policy_template_id: str, version: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,789
ibm_platform_services.iam_policy_management_v1
get_role
Retrieve a role by ID. Retrieve a role by providing a role ID. :param str role_id: The role 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 `CustomRole` object
def get_role( self, role_id: str, **kwargs, ) -> DetailedResponse: """ Retrieve a role by ID. Retrieve a role by providing a role ID. :param str role_id: The role 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 `CustomRole` object """ if not role_id: raise ValueError('role_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_role', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['role_id'] path_param_values = self.encode_path_vars(role_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/roles/{role_id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, role_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,790
ibm_platform_services.iam_policy_management_v1
get_v2_policy
Retrieve a policy by ID. Retrieve a policy by providing a policy ID. :param str id: The policy ID. :param str format: (optional) Include additional data for policy returned * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times it has done so * `display` - returns the list of all actions included in each of the policy roles and translations for all relevant fields. :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 `V2PolicyTemplateMetaData` object
def get_v2_policy( self, id: str, *, format: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Retrieve a policy by ID. Retrieve a policy by providing a policy ID. :param str id: The policy ID. :param str format: (optional) Include additional data for policy returned * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times it has done so * `display` - returns the list of all actions included in each of the policy roles and translations for all relevant fields. :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 `V2PolicyTemplateMetaData` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_v2_policy', ) headers.update(sdk_headers) params = { 'format': format, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/policies/{id}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, id: str, *, format: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,791
ibm_platform_services.iam_policy_management_v1
list_policies
Get policies by attributes. Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account and filter by attribute values. This can be done through query parameters. The following attributes are supported: account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policies an empty array is returned. :param str account_id: The account GUID that the policies belong to. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str iam_id: (optional) Optional IAM ID used to identify the subject. :param str access_group_id: (optional) Optional access group id. :param str type: (optional) Optional type of policy. :param str service_type: (optional) Optional type of service. :param str tag_name: (optional) Optional name of the access tag in the policy. :param str tag_value: (optional) Optional value of the access tag in the policy. :param str sort: (optional) Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending '-' to field. Example '-last_modified_at'. :param str format: (optional) Include additional data per policy returned * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times it has done so * `display` - returns the list of all actions included in each of the policy roles. :param str state: (optional) The state of the policy. * `active` - returns active policies * `deleted` - returns non-active policies. :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 `PolicyCollection` object
def list_policies( self, account_id: str, *, accept_language: Optional[str] = None, iam_id: Optional[str] = None, access_group_id: Optional[str] = None, type: Optional[str] = None, service_type: Optional[str] = None, tag_name: Optional[str] = None, tag_value: Optional[str] = None, sort: Optional[str] = None, format: Optional[str] = None, state: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get policies by attributes. Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account and filter by attribute values. This can be done through query parameters. The following attributes are supported: account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policies an empty array is returned. :param str account_id: The account GUID that the policies belong to. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str iam_id: (optional) Optional IAM ID used to identify the subject. :param str access_group_id: (optional) Optional access group id. :param str type: (optional) Optional type of policy. :param str service_type: (optional) Optional type of service. :param str tag_name: (optional) Optional name of the access tag in the policy. :param str tag_value: (optional) Optional value of the access tag in the policy. :param str sort: (optional) Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending '-' to field. Example '-last_modified_at'. :param str format: (optional) Include additional data per policy returned * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times it has done so * `display` - returns the list of all actions included in each of the policy roles. :param str state: (optional) The state of the policy. * `active` - returns active policies * `deleted` - returns non-active policies. :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 `PolicyCollection` object """ if not account_id: raise ValueError('account_id must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_policies', ) headers.update(sdk_headers) params = { 'account_id': account_id, 'iam_id': iam_id, 'access_group_id': access_group_id, 'type': type, 'service_type': service_type, 'tag_name': tag_name, 'tag_value': tag_value, 'sort': sort, 'format': format, 'state': state, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/policies' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, *, accept_language: Optional[str] = None, iam_id: Optional[str] = None, access_group_id: Optional[str] = None, type: Optional[str] = None, service_type: Optional[str] = None, tag_name: Optional[str] = None, tag_value: Optional[str] = None, sort: Optional[str] = None, format: Optional[str] = None, state: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,792
ibm_platform_services.iam_policy_management_v1
list_policy_assignments
Get policy template assignments. Get policy template assignments by attributes. The following attributes are supported: `account_id`, `template_id`, `template_version`, `sort`. `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policy template assignments an empty array is returned. :param str version: specify version of response body format. :param str account_id: The account GUID in which the policies belong to. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str template_id: (optional) Optional template id. :param str template_version: (optional) Optional policy template version. :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 `PolicyTemplateAssignmentCollection` object
def list_policy_assignments( self, version: str, account_id: str, *, accept_language: Optional[str] = None, template_id: Optional[str] = None, template_version: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get policy template assignments. Get policy template assignments by attributes. The following attributes are supported: `account_id`, `template_id`, `template_version`, `sort`. `account_id` is a required query parameter. Only policy template assignments that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policy template assignments an empty array is returned. :param str version: specify version of response body format. :param str account_id: The account GUID in which the policies belong to. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str template_id: (optional) Optional template id. :param str template_version: (optional) Optional policy template version. :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 `PolicyTemplateAssignmentCollection` object """ if not version: raise ValueError('version must be provided') if not account_id: raise ValueError('account_id must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_policy_assignments', ) headers.update(sdk_headers) params = { 'version': version, 'account_id': account_id, 'template_id': template_id, 'template_version': template_version, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/policy_assignments' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, version: str, account_id: str, *, accept_language: Optional[str] = None, template_id: Optional[str] = None, template_version: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,793
ibm_platform_services.iam_policy_management_v1
list_policy_template_versions
Retrieve policy template versions. Retrieve the versions of a policy template by providing a policy template ID. :param str policy_template_id: The policy template ID. :param str state: (optional) The policy template state. :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 `PolicyTemplateVersionsCollection` object
def list_policy_template_versions( self, policy_template_id: str, *, state: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Retrieve policy template versions. Retrieve the versions of a policy template by providing a policy template ID. :param str policy_template_id: The policy template ID. :param str state: (optional) The policy template state. :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 `PolicyTemplateVersionsCollection` object """ if not policy_template_id: raise ValueError('policy_template_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_policy_template_versions', ) headers.update(sdk_headers) params = { 'state': state, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['policy_template_id'] path_param_values = self.encode_path_vars(policy_template_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_templates/{policy_template_id}/versions'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, policy_template_id: str, *, state: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,794
ibm_platform_services.iam_policy_management_v1
list_policy_templates
List policy templates by attributes. List policy templates and filter by attributes by using query parameters. The following attributes are supported: `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policy templates an empty array is returned. :param str account_id: The account GUID that the policy templates belong to. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str state: (optional) The policy template state. :param str name: (optional) The policy template name. :param str policy_service_type: (optional) Service type, Optional. :param str policy_service_name: (optional) Service name, Optional. :param str policy_service_group_id: (optional) Service group id, Optional. :param str policy_type: (optional) Policy type, Optional. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `PolicyTemplateCollection` object
def list_policy_templates( self, account_id: str, *, accept_language: Optional[str] = None, state: Optional[str] = None, name: Optional[str] = None, policy_service_type: Optional[str] = None, policy_service_name: Optional[str] = None, policy_service_group_id: Optional[str] = None, policy_type: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ List policy templates by attributes. List policy templates and filter by attributes by using query parameters. The following attributes are supported: `account_id`, `policy_service_name`, `policy_service_type`, `policy_service_group_id` and `policy_type`. `account_id` is a required query parameter. These attributes `policy_service_name`, `policy_service_type` and `policy_service_group_id` are mutually exclusive. Only policy templates that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policy templates an empty array is returned. :param str account_id: The account GUID that the policy templates belong to. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str state: (optional) The policy template state. :param str name: (optional) The policy template name. :param str policy_service_type: (optional) Service type, Optional. :param str policy_service_name: (optional) Service name, Optional. :param str policy_service_group_id: (optional) Service group id, Optional. :param str policy_type: (optional) Policy type, Optional. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `PolicyTemplateCollection` object """ if not account_id: raise ValueError('account_id must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_policy_templates', ) headers.update(sdk_headers) params = { 'account_id': account_id, 'state': state, 'name': name, 'policy_service_type': policy_service_type, 'policy_service_name': policy_service_name, 'policy_service_group_id': policy_service_group_id, 'policy_type': policy_type, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/policy_templates' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, *, accept_language: Optional[str] = None, state: Optional[str] = None, name: Optional[str] = None, policy_service_type: Optional[str] = None, policy_service_name: Optional[str] = None, policy_service_group_id: Optional[str] = None, policy_type: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,795
ibm_platform_services.iam_policy_management_v1
list_roles
Get roles by filters. Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can be done through query parameters. Currently, we only support the following attributes: account_id, service_name, service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the caller does not have read access to any roles an empty array is returned. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str account_id: (optional) Optional account GUID in which the roles belong to. :param str service_name: (optional) Optional name of IAM enabled service. :param str source_service_name: (optional) Optional name of source IAM enabled service. :param str policy_type: (optional) Optional Policy Type. :param str service_group_id: (optional) Optional id of service group. :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 `RoleCollection` object
def list_roles( self, *, accept_language: Optional[str] = None, account_id: Optional[str] = None, service_name: Optional[str] = None, source_service_name: Optional[str] = None, policy_type: Optional[str] = None, service_group_id: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get roles by filters. Get roles based on the filters. While managing roles, you may want to retrieve roles and filter by usages. This can be done through query parameters. Currently, we only support the following attributes: account_id, service_name, service_group_id, source_service_name and policy_type. Both service_name and service_group_id attributes are mutually exclusive. Only roles that match the filter and that the caller has read access to are returned. If the caller does not have read access to any roles an empty array is returned. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str account_id: (optional) Optional account GUID in which the roles belong to. :param str service_name: (optional) Optional name of IAM enabled service. :param str source_service_name: (optional) Optional name of source IAM enabled service. :param str policy_type: (optional) Optional Policy Type. :param str service_group_id: (optional) Optional id of service group. :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 `RoleCollection` object """ headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_roles', ) headers.update(sdk_headers) params = { 'account_id': account_id, 'service_name': service_name, 'source_service_name': source_service_name, 'policy_type': policy_type, 'service_group_id': service_group_id, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/roles' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, *, accept_language: Optional[str] = None, account_id: Optional[str] = None, service_name: Optional[str] = None, source_service_name: Optional[str] = None, policy_type: Optional[str] = None, service_group_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,796
ibm_platform_services.iam_policy_management_v1
list_v2_policies
Get policies by attributes. Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account and filter by attribute values. This can be done through query parameters. The following attributes are supported: account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policies an empty array is returned. :param str account_id: The account GUID in which the policies belong to. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str iam_id: (optional) Optional IAM ID used to identify the subject. :param str access_group_id: (optional) Optional access group id. :param str type: (optional) Optional type of policy. :param str service_type: (optional) Optional type of service. :param str service_name: (optional) Optional name of service. :param str service_group_id: (optional) Optional ID of service group. :param str sort: (optional) Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that can be sorted on: - 'id' - 'type' - 'href' - 'created_at' - 'created_by_id' - 'last_modified_at' - 'last_modified_by_id' - 'state' - 'last_permit_at' - 'last_permit_frequency'. :param str format: (optional) Include additional data per policy returned * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times it has done so * `display` - returns the list of all actions included in each of the policy roles and translations for all relevant fields. :param str state: (optional) The state of the policy. * `active` - returns active policies * `deleted` - returns non-active policies. :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 `V2PolicyCollection` object
def list_v2_policies( self, account_id: str, *, accept_language: Optional[str] = None, iam_id: Optional[str] = None, access_group_id: Optional[str] = None, type: Optional[str] = None, service_type: Optional[str] = None, service_name: Optional[str] = None, service_group_id: Optional[str] = None, sort: Optional[str] = None, format: Optional[str] = None, state: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get policies by attributes. Get policies and filter by attributes. While managing policies, you might want to retrieve policies in the account and filter by attribute values. This can be done through query parameters. The following attributes are supported: account_id, iam_id, access_group_id, type, service_type, sort, format and state. account_id is a required query parameter. Only policies that have the specified attributes and that the caller has read access to are returned. If the caller does not have read access to any policies an empty array is returned. :param str account_id: The account GUID in which the policies belong to. :param str accept_language: (optional) Language code for translations * `default` - English * `de` - German (Standard) * `en` - English * `es` - Spanish (Spain) * `fr` - French (Standard) * `it` - Italian (Standard) * `ja` - Japanese * `ko` - Korean * `pt-br` - Portuguese (Brazil) * `zh-cn` - Chinese (Simplified, PRC) * `zh-tw` - (Chinese, Taiwan). :param str iam_id: (optional) Optional IAM ID used to identify the subject. :param str access_group_id: (optional) Optional access group id. :param str type: (optional) Optional type of policy. :param str service_type: (optional) Optional type of service. :param str service_name: (optional) Optional name of service. :param str service_group_id: (optional) Optional ID of service group. :param str sort: (optional) Optional top level policy field to sort results. Ascending sort is default. Descending sort available by prepending '-' to field, for example, '-last_modified_at'. Note that last permit information is only included when 'format=include_last_permit', for example, "format=include_last_permit&sort=last_permit_at" Example fields that can be sorted on: - 'id' - 'type' - 'href' - 'created_at' - 'created_by_id' - 'last_modified_at' - 'last_modified_by_id' - 'state' - 'last_permit_at' - 'last_permit_frequency'. :param str format: (optional) Include additional data per policy returned * `include_last_permit` - returns details of when the policy last granted a permit decision and the number of times it has done so * `display` - returns the list of all actions included in each of the policy roles and translations for all relevant fields. :param str state: (optional) The state of the policy. * `active` - returns active policies * `deleted` - returns non-active policies. :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 `V2PolicyCollection` object """ if not account_id: raise ValueError('account_id must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_v2_policies', ) headers.update(sdk_headers) params = { 'account_id': account_id, 'iam_id': iam_id, 'access_group_id': access_group_id, 'type': type, 'service_type': service_type, 'service_name': service_name, 'service_group_id': service_group_id, 'sort': sort, 'format': format, 'state': state, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/policies' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, *, accept_language: Optional[str] = None, iam_id: Optional[str] = None, access_group_id: Optional[str] = None, type: Optional[str] = None, service_type: Optional[str] = None, service_name: Optional[str] = None, service_group_id: Optional[str] = None, sort: Optional[str] = None, format: Optional[str] = None, state: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,798
ibm_platform_services.iam_policy_management_v1
replace_policy
Update a policy. Update a policy to grant access between a subject and a resource. A policy administrator might want to update an existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). ### Access To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles that are supported by the service or platform roles. For more information, see [IAM roles and actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. ### Authorization To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following attributes are supported: serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are supported by the service or platform roles. For more information, see [IAM roles and actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access or greater to the target resource in order to grant the role. Use only the resource attributes supported by the service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. ### Attribute Operators Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support one or both operators. For more information, see [Assigning access by using wildcard policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). ### Attribute Validations Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated against Global Catalog locations. :param str policy_id: The policy ID. :param str if_match: The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. :param str type: The policy type; either 'access' or 'authorization'. :param List[PolicySubject] subjects: The subjects associated with a policy. :param List[PolicyRole] roles: A set of role cloud resource names (CRNs) granted by the policy. :param List[PolicyResource] resources: The resources associated with a policy. :param str description: (optional) Customer-defined 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 `Policy` object
def replace_policy( self, policy_id: str, if_match: str, type: str, subjects: List['PolicySubject'], roles: List['PolicyRole'], resources: List['PolicyResource'], *, description: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Update a policy. Update a policy to grant access between a subject and a resource. A policy administrator might want to update an existing policy. The policy type cannot be changed (You cannot change an access policy to an authorization policy). ### Access To update an access policy, use **`"type": "access"`** in the body. The possible subject attributes are **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute for assigning access for a user or service-id. Use the **`access_group_id`** subject attribute for assigning access for an access group. Assign roles that are supported by the service or platform roles. For more information, see [IAM roles and actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). The policy resource must include either the **`serviceType`**, **`serviceName`**, or **`resourceGroupId`** attribute and the **`accountId`** attribute.` If the subject is a locked service-id, the request will fail. ### Authorization To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following attributes are supported: serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are supported by the service or platform roles. For more information, see [IAM roles and actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access or greater to the target resource in order to grant the role. Use only the resource attributes supported by the service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. ### Attribute Operators Currently, only the `stringEquals` and the `stringMatch` operators are available. Resource attributes might support one or both operators. For more information, see [Assigning access by using wildcard policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). ### Attribute Validations Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated against Global Catalog locations. :param str policy_id: The policy ID. :param str if_match: The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. :param str type: The policy type; either 'access' or 'authorization'. :param List[PolicySubject] subjects: The subjects associated with a policy. :param List[PolicyRole] roles: A set of role cloud resource names (CRNs) granted by the policy. :param List[PolicyResource] resources: The resources associated with a policy. :param str description: (optional) Customer-defined 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 `Policy` object """ if not policy_id: raise ValueError('policy_id must be provided') if not if_match: raise ValueError('if_match must be provided') if type is None: raise ValueError('type must be provided') if subjects is None: raise ValueError('subjects must be provided') if roles is None: raise ValueError('roles must be provided') if resources is None: raise ValueError('resources must be provided') subjects = [convert_model(x) for x in subjects] roles = [convert_model(x) for x in roles] resources = [convert_model(x) for x in resources] headers = { 'If-Match': if_match, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_policy', ) headers.update(sdk_headers) data = { 'type': type, 'subjects': subjects, 'roles': roles, 'resources': resources, '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 = ['policy_id'] path_param_values = self.encode_path_vars(policy_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policies/{policy_id}'.format(**path_param_dict) request = self.prepare_request( method='PUT', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response
(self, policy_id: str, if_match: str, type: str, subjects: List[ibm_platform_services.iam_policy_management_v1.PolicySubject], roles: List[ibm_platform_services.iam_policy_management_v1.PolicyRole], resources: List[ibm_platform_services.iam_policy_management_v1.PolicyResource], *, description: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,799
ibm_platform_services.iam_policy_management_v1
replace_policy_template
Update a policy template version. Update a specific version of a policy template. You can use this only if the version isn't committed. :param str policy_template_id: The policy template ID. :param str version: The policy template version. :param str if_match: The revision number for updating a policy template version and must match the ETag value of the existing policy template version. The Etag can be retrieved using the GET /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the ETag response header. :param TemplatePolicy policy: The core set of properties associated with the template's policy objet. :param str name: (optional) Required field when creating a new template. Otherwise this field is optional. If the field is included it will change the name value for all existing versions of the template. :param str description: (optional) Description of the policy template. This is shown to users in the enterprise account. Use this to describe the purpose or context of the policy for enterprise users managing IAM templates. :param bool committed: (optional) Committed status of the template version. :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 `PolicyTemplate` object
def replace_policy_template( self, policy_template_id: str, version: str, if_match: str, policy: 'TemplatePolicy', *, name: Optional[str] = None, description: Optional[str] = None, committed: Optional[bool] = None, **kwargs, ) -> DetailedResponse: """ Update a policy template version. Update a specific version of a policy template. You can use this only if the version isn't committed. :param str policy_template_id: The policy template ID. :param str version: The policy template version. :param str if_match: The revision number for updating a policy template version and must match the ETag value of the existing policy template version. The Etag can be retrieved using the GET /v1/policy_templates/{policy_template_id}/versions/{version} API and looking at the ETag response header. :param TemplatePolicy policy: The core set of properties associated with the template's policy objet. :param str name: (optional) Required field when creating a new template. Otherwise this field is optional. If the field is included it will change the name value for all existing versions of the template. :param str description: (optional) Description of the policy template. This is shown to users in the enterprise account. Use this to describe the purpose or context of the policy for enterprise users managing IAM templates. :param bool committed: (optional) Committed status of the template version. :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 `PolicyTemplate` object """ if not policy_template_id: raise ValueError('policy_template_id must be provided') if not version: raise ValueError('version must be provided') if not if_match: raise ValueError('if_match must be provided') if policy is None: raise ValueError('policy must be provided') policy = convert_model(policy) headers = { 'If-Match': if_match, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_policy_template', ) headers.update(sdk_headers) data = { 'policy': policy, 'name': name, 'description': description, 'committed': committed, } 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 = ['policy_template_id', 'version'] path_param_values = self.encode_path_vars(policy_template_id, version) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_templates/{policy_template_id}/versions/{version}'.format(**path_param_dict) request = self.prepare_request( method='PUT', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response
(self, policy_template_id: str, version: str, if_match: str, policy: ibm_platform_services.iam_policy_management_v1.TemplatePolicy, *, name: Optional[str] = None, description: Optional[str] = None, committed: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,800
ibm_platform_services.iam_policy_management_v1
replace_role
Update a role. Update a custom role. A role administrator might want to update an existing role by updating the display name, description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. :param str role_id: The role ID. :param str if_match: The revision number for updating a role and must match the ETag value of the existing role. The Etag can be retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. :param str display_name: The display name of the role that is shown in the console. :param List[str] actions: The actions of the role. For more information, see [IAM roles and actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). :param str description: (optional) The description of the role. :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 `CustomRole` object
def replace_role( self, role_id: str, if_match: str, display_name: str, actions: List[str], *, description: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Update a role. Update a custom role. A role administrator might want to update an existing role by updating the display name, description, or the actions that are mapped to the role. The name, account_id, and service_name can't be changed. :param str role_id: The role ID. :param str if_match: The revision number for updating a role and must match the ETag value of the existing role. The Etag can be retrieved using the GET /v2/roles/{role_id} API and looking at the ETag response header. :param str display_name: The display name of the role that is shown in the console. :param List[str] actions: The actions of the role. For more information, see [IAM roles and actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions). :param str description: (optional) The description of the role. :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 `CustomRole` object """ if not role_id: raise ValueError('role_id must be provided') if not if_match: raise ValueError('if_match must be provided') if display_name is None: raise ValueError('display_name must be provided') if actions is None: raise ValueError('actions must be provided') headers = { 'If-Match': if_match, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_role', ) headers.update(sdk_headers) data = { 'display_name': display_name, 'actions': actions, '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 = ['role_id'] path_param_values = self.encode_path_vars(role_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/roles/{role_id}'.format(**path_param_dict) request = self.prepare_request( method='PUT', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response
(self, role_id: str, if_match: str, display_name: str, actions: List[str], *, description: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,801
ibm_platform_services.iam_policy_management_v1
replace_v2_policy
Update a policy. Update a policy to grant access between a subject and a resource. A policy administrator might want to update an existing policy. ### Access To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that are supported by the service or platform roles. For more information, see [IAM roles and actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a combination **`operator`**. The possible combination operators are **`and`** and **`or`**. Currently, we support two types of patterns: 1. `time-based`: Used to specify a time-based restriction Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following rule: ```json "rule": { "operator": "and", "conditions": [{ "key": "{{environment.attributes.day_of_week}}", "operator": "dayOfWeekAnyOf", "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] }, "key": "{{environment.attributes.current_time}}", "operator": "timeGreaterThanOrEquals", "value": "09:00:00+00:00" }, "key": "{{environment.attributes.current_time}}", "operator": "timeLessThanOrEquals", "value": "17:00:00+00:00" }] } ``` You can use the following operators in the **`key`** and **`value`** pair: ``` 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', 'dayOfWeekEquals', 'dayOfWeekAnyOf' ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the subject is a locked service-id, the request will fail. 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. Combine conditions to specify an attribute-based condition using AND/OR-based operators. For example, a policy can grant access based on multiple conditions applied on the resource attributes below: ```json "pattern": "attribute-based-condition:resource:literal-and-wildcard" "rule": { "operator": "or", "conditions": [ { "operator": "and", "conditions": [ { "key": "{{resource.attributes.prefix}}", "operator": "stringEquals", "value": "home/test" }, { "key": "{{environment.attributes.delimiter}}", "operator": "stringEquals", "value": "/" } ] }, { "key": "{{resource.attributes.path}}", "operator": "stringMatch", "value": "home/David/*" } ] } ``` In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you consolidate multiple policies in to a single policy, making policies easier to administer and stay within the policy limit for an account. View the list of operators that can be used in the condition [here](/docs/account?topic=account-wildcard#string-comparisons). ### Authorization To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following attributes are supported: serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are supported by the service or platform roles. For more information, see [IAM roles and actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access or greater to the target resource in order to grant the role. Use only the resource attributes supported by the service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. ### Attribute Operators Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more information, see [Assigning access by using wildcard policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). ### Attribute Validations Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated against Global Catalog locations. :param str id: The policy ID. :param str if_match: The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. :param Control control: Specifies the type of access granted by the policy. :param str type: The policy type; either 'access' or 'authorization'. :param str description: (optional) Description of the policy. :param V2PolicySubject subject: (optional) The subject attributes for whom the policy grants access. :param V2PolicyResource resource: (optional) The resource attributes to which the policy grants access. :param str pattern: (optional) Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or 'time-based-conditions:weekly:custom-hours'. :param V2PolicyRule rule: (optional) Additional access conditions associated with the policy. :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 `V2Policy` object
def replace_v2_policy( self, id: str, if_match: str, control: 'Control', type: str, *, description: Optional[str] = None, subject: Optional['V2PolicySubject'] = None, resource: Optional['V2PolicyResource'] = None, pattern: Optional[str] = None, rule: Optional['V2PolicyRule'] = None, **kwargs, ) -> DetailedResponse: """ Update a policy. Update a policy to grant access between a subject and a resource. A policy administrator might want to update an existing policy. ### Access To update an access policy, use **`"type": "access"`** in the body. The supported subject attributes are **`iam_id`** and **`access_group_id`**. Use the **`iam_id`** subject attribute to assign access to a user or service-id. Use the **`access_group_id`** subject attribute to assign access to an access group. Assign roles that are supported by the service or platform roles. For more information, see [IAM roles and actions](/docs/account?topic=account-iam-service-roles-actions). Use only the resource attributes supported by the service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). The policy resource must include either the **`serviceType`**, **`serviceName`**, **`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`** attribute. In the rule field, you can specify a single condition by using **`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`** with a combination **`operator`**. The possible combination operators are **`and`** and **`or`**. Currently, we support two types of patterns: 1. `time-based`: Used to specify a time-based restriction Combine conditions to specify a time-based restriction (e.g., access only during business hours, during the Monday-Friday work week). For example, a policy can grant access Monday-Friday, 9:00am-5:00pm using the following rule: ```json "rule": { "operator": "and", "conditions": [{ "key": "{{environment.attributes.day_of_week}}", "operator": "dayOfWeekAnyOf", "value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"] }, "key": "{{environment.attributes.current_time}}", "operator": "timeGreaterThanOrEquals", "value": "09:00:00+00:00" }, "key": "{{environment.attributes.current_time}}", "operator": "timeLessThanOrEquals", "value": "17:00:00+00:00" }] } ``` You can use the following operators in the **`key`** and **`value`** pair: ``` 'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan', 'timeGreaterThanOrEquals', 'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan', 'dateGreaterThanOrEquals', 'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan', 'dateTimeGreaterThanOrEquals', 'dayOfWeekEquals', 'dayOfWeekAnyOf' ``` The pattern field that matches the rule is required when rule is provided. For the business hour rule example above, the **`pattern`** is **`"time-based-conditions:weekly"`**. For more information, see [Time-based conditions operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties) and [Limiting access with time-based conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the subject is a locked service-id, the request will fail. 2. `attribute-based`: Used to specify a combination of OR/AND based conditions applied on resource attributes. Combine conditions to specify an attribute-based condition using AND/OR-based operators. For example, a policy can grant access based on multiple conditions applied on the resource attributes below: ```json "pattern": "attribute-based-condition:resource:literal-and-wildcard" "rule": { "operator": "or", "conditions": [ { "operator": "and", "conditions": [ { "key": "{{resource.attributes.prefix}}", "operator": "stringEquals", "value": "home/test" }, { "key": "{{environment.attributes.delimiter}}", "operator": "stringEquals", "value": "/" } ] }, { "key": "{{resource.attributes.path}}", "operator": "stringMatch", "value": "home/David/*" } ] } ``` In addition to satisfying the `resources` section, the policy grants permission only if either the `path` begins with `home/David/` **OR** the `prefix` is `home/test` and the `delimiter` is `/`. This mechanism helps you consolidate multiple policies in to a single policy, making policies easier to administer and stay within the policy limit for an account. View the list of operators that can be used in the condition [here](/docs/account?topic=account-wildcard#string-comparisons). ### Authorization To update an authorization policy, use **`"type": "authorization"`** in the body. The subject attributes must match the supported authorization subjects of the resource. Multiple subject attributes might be provided. The following attributes are supported: serviceName, serviceInstance, region, resourceType, resource, accountId, resourceGroupId Assign roles that are supported by the service or platform roles. For more information, see [IAM roles and actions](/docs/account?topic=account-iam-service-roles-actions). The user must also have the same level of access or greater to the target resource in order to grant the role. Use only the resource attributes supported by the service. To view a service's or the platform's supported attributes, check the [documentation](/docs?tab=all-docs). Both the policy subject and the policy resource must include the **`accountId`** attributes. The policy subject must include either **`serviceName`** or **`resourceGroupId`** (or both) attributes. ### Attribute Operators Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators are available. For more information, see [Assigning access by using wildcard policies](https://cloud.ibm.com/docs/account?topic=account-wildcard). ### Attribute Validations Policy attribute values must be between 1 and 1,000 characters in length. If location related attributes like geography, country, metro, region, satellite, and locationvalues are supported by the service, they are validated against Global Catalog locations. :param str id: The policy ID. :param str if_match: The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be retrieved using the GET /v2/policies/{id} API and looking at the ETag response header. :param Control control: Specifies the type of access granted by the policy. :param str type: The policy type; either 'access' or 'authorization'. :param str description: (optional) Description of the policy. :param V2PolicySubject subject: (optional) The subject attributes for whom the policy grants access. :param V2PolicyResource resource: (optional) The resource attributes to which the policy grants access. :param str pattern: (optional) Indicates pattern of rule, either 'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or 'time-based-conditions:weekly:custom-hours'. :param V2PolicyRule rule: (optional) Additional access conditions associated with the policy. :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 `V2Policy` object """ if not id: raise ValueError('id must be provided') if not if_match: raise ValueError('if_match must be provided') if control is None: raise ValueError('control must be provided') if type is None: raise ValueError('type must be provided') control = convert_model(control) if subject is not None: subject = convert_model(subject) if resource is not None: resource = convert_model(resource) if rule is not None: rule = convert_model(rule) headers = { 'If-Match': if_match, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_v2_policy', ) headers.update(sdk_headers) data = { 'control': control, 'type': type, 'description': description, 'subject': subject, 'resource': resource, 'pattern': pattern, 'rule': rule, } 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/policies/{id}'.format(**path_param_dict) request = self.prepare_request( method='PUT', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response
(self, id: str, if_match: str, control: ibm_platform_services.iam_policy_management_v1.Control, type: str, *, description: Optional[str] = None, subject: Optional[ibm_platform_services.iam_policy_management_v1.V2PolicySubject] = None, resource: Optional[ibm_platform_services.iam_policy_management_v1.V2PolicyResource] = None, pattern: Optional[str] = None, rule: Optional[ibm_platform_services.iam_policy_management_v1.V2PolicyRule] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,809
ibm_platform_services.iam_policy_management_v1
update_policy_assignment
Update a policy authorization type assignment. Update a policy assignment by providing a policy assignment ID. :param str assignment_id: The policy template assignment ID. :param str version: specify version of response body format. :param str if_match: The revision number for updating a policy assignment and must match the ETag value of the existing policy assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the ETag response header. :param str template_version: The policy template version to update to. :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 `PolicyAssignmentV1` object
def update_policy_assignment( self, assignment_id: str, version: str, if_match: str, template_version: str, **kwargs, ) -> DetailedResponse: """ Update a policy authorization type assignment. Update a policy assignment by providing a policy assignment ID. :param str assignment_id: The policy template assignment ID. :param str version: specify version of response body format. :param str if_match: The revision number for updating a policy assignment and must match the ETag value of the existing policy assignment. The Etag can be retrieved using the GET /v1/policy_assignments/{assignment_id} API and looking at the ETag response header. :param str template_version: The policy template version to update to. :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 `PolicyAssignmentV1` object """ if not assignment_id: raise ValueError('assignment_id must be provided') if not version: raise ValueError('version must be provided') if not if_match: raise ValueError('if_match must be provided') if template_version is None: raise ValueError('template_version must be provided') headers = { 'If-Match': if_match, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_policy_assignment', ) headers.update(sdk_headers) params = { 'version': version, } data = { 'template_version': template_version, } 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 = ['assignment_id'] path_param_values = self.encode_path_vars(assignment_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policy_assignments/{assignment_id}'.format(**path_param_dict) request = self.prepare_request( method='PATCH', url=url, headers=headers, params=params, data=data, ) response = self.send(request, **kwargs) return response
(self, assignment_id: str, version: str, if_match: str, template_version: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,810
ibm_platform_services.iam_policy_management_v1
update_policy_state
Restore a deleted policy by ID. Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To restore a policy, use **`"state": "active"`** in the body. :param str policy_id: The policy ID. :param str if_match: The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. :param str state: (optional) The policy state. :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 `Policy` object
def update_policy_state( self, policy_id: str, if_match: str, *, state: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Restore a deleted policy by ID. Restore a policy that has recently been deleted. A policy administrator might want to restore a deleted policy. To restore a policy, use **`"state": "active"`** in the body. :param str policy_id: The policy ID. :param str if_match: The revision number for updating a policy and must match the ETag value of the existing policy. The Etag can be retrieved using the GET /v1/policies/{policy_id} API and looking at the ETag response header. :param str state: (optional) The policy state. :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 `Policy` object """ if not policy_id: raise ValueError('policy_id must be provided') if not if_match: raise ValueError('if_match must be provided') headers = { 'If-Match': if_match, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_policy_state', ) headers.update(sdk_headers) data = { 'state': state, } 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 = ['policy_id'] path_param_values = self.encode_path_vars(policy_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/policies/{policy_id}'.format(**path_param_dict) request = self.prepare_request( method='PATCH', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response
(self, policy_id: str, if_match: str, *, state: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,811
ibm_platform_services.ibm_cloud_shell_v1
IbmCloudShellV1
The IBM Cloud Shell V1 service.
class IbmCloudShellV1(BaseService): """The IBM Cloud Shell V1 service.""" DEFAULT_SERVICE_URL = 'https://api.shell.cloud.ibm.com' DEFAULT_SERVICE_NAME = 'ibm_cloud_shell' @classmethod def new_instance( cls, service_name: str = DEFAULT_SERVICE_NAME, ) -> 'IbmCloudShellV1': """ Return a new client for the IBM Cloud Shell service using the specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) service = cls(authenticator) service.configure_service(service_name) return service def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the IBM Cloud Shell service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### # account_settings ######################### def get_account_settings(self, account_id: str, **kwargs) -> DetailedResponse: """ Get account settings. Retrieve account settings for the given account ID. Call this method to get details about a particular account setting, whether Cloud Shell is enabled, the list of enabled regions and the list of enabled features. Users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service. :param str account_id: The account ID in which the account settings belong to. :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 `AccountSettings` object """ if account_id is None: raise ValueError('account_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_account_settings' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['account_id'] path_param_values = self.encode_path_vars(account_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/api/v1/user/accounts/{account_id}/settings'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request) return response def update_account_settings( self, account_id: str, *, rev: str = None, default_enable_new_features: bool = None, default_enable_new_regions: bool = None, enabled: bool = None, features: List['Feature'] = None, regions: List['RegionSetting'] = None, **kwargs ) -> DetailedResponse: """ Update account settings. Update account settings for the given account ID. Call this method to update account settings configuration, you can enable or disable Cloud Shell, enable or disable available regions and enable and disable features. To update account settings, users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service. :param str account_id: The account ID in which the account settings belong to. :param str rev: (optional) Unique revision number for the settings object. :param bool default_enable_new_features: (optional) You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations. :param bool default_enable_new_regions: (optional) Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location. :param bool enabled: (optional) When enabled, Cloud Shell is available to all users in the account. :param List[Feature] features: (optional) List of Cloud Shell features. :param List[RegionSetting] regions: (optional) List of Cloud Shell region settings. :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 `AccountSettings` object """ if account_id is None: raise ValueError('account_id must be provided') if features is not None: features = [convert_model(x) for x in features] if regions is not None: regions = [convert_model(x) for x in regions] headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_account_settings' ) headers.update(sdk_headers) data = { '_rev': rev, 'default_enable_new_features': default_enable_new_features, 'default_enable_new_regions': default_enable_new_regions, 'enabled': enabled, 'features': features, 'regions': regions, } 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')) headers['Accept'] = 'application/json' path_param_keys = ['account_id'] path_param_values = self.encode_path_vars(account_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/api/v1/user/accounts/{account_id}/settings'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request) return response
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
719,812
ibm_platform_services.ibm_cloud_shell_v1
__init__
Construct a new client for the IBM Cloud Shell service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice.
def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the IBM Cloud Shell service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
(self, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None) -> NoneType
719,821
ibm_platform_services.ibm_cloud_shell_v1
get_account_settings
Get account settings. Retrieve account settings for the given account ID. Call this method to get details about a particular account setting, whether Cloud Shell is enabled, the list of enabled regions and the list of enabled features. Users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service. :param str account_id: The account ID in which the account settings belong to. :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 `AccountSettings` object
def get_account_settings(self, account_id: str, **kwargs) -> DetailedResponse: """ Get account settings. Retrieve account settings for the given account ID. Call this method to get details about a particular account setting, whether Cloud Shell is enabled, the list of enabled regions and the list of enabled features. Users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service. :param str account_id: The account ID in which the account settings belong to. :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 `AccountSettings` object """ if account_id is None: raise ValueError('account_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_account_settings' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['account_id'] path_param_values = self.encode_path_vars(account_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/api/v1/user/accounts/{account_id}/settings'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request) return response
(self, account_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,833
ibm_platform_services.ibm_cloud_shell_v1
update_account_settings
Update account settings. Update account settings for the given account ID. Call this method to update account settings configuration, you can enable or disable Cloud Shell, enable or disable available regions and enable and disable features. To update account settings, users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service. :param str account_id: The account ID in which the account settings belong to. :param str rev: (optional) Unique revision number for the settings object. :param bool default_enable_new_features: (optional) You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations. :param bool default_enable_new_regions: (optional) Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location. :param bool enabled: (optional) When enabled, Cloud Shell is available to all users in the account. :param List[Feature] features: (optional) List of Cloud Shell features. :param List[RegionSetting] regions: (optional) List of Cloud Shell region settings. :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 `AccountSettings` object
def update_account_settings( self, account_id: str, *, rev: str = None, default_enable_new_features: bool = None, default_enable_new_regions: bool = None, enabled: bool = None, features: List['Feature'] = None, regions: List['RegionSetting'] = None, **kwargs ) -> DetailedResponse: """ Update account settings. Update account settings for the given account ID. Call this method to update account settings configuration, you can enable or disable Cloud Shell, enable or disable available regions and enable and disable features. To update account settings, users need to be an account owner or users need to be assigned an IAM policy with the Administrator role for the Cloud Shell account management service. :param str account_id: The account ID in which the account settings belong to. :param str rev: (optional) Unique revision number for the settings object. :param bool default_enable_new_features: (optional) You can choose which Cloud Shell features are available in the account and whether any new features are enabled as they become available. The feature settings apply only to the enabled Cloud Shell locations. :param bool default_enable_new_regions: (optional) Set whether Cloud Shell is enabled in a specific location for the account. The location determines where user and session data are stored. By default, users are routed to the nearest available location. :param bool enabled: (optional) When enabled, Cloud Shell is available to all users in the account. :param List[Feature] features: (optional) List of Cloud Shell features. :param List[RegionSetting] regions: (optional) List of Cloud Shell region settings. :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 `AccountSettings` object """ if account_id is None: raise ValueError('account_id must be provided') if features is not None: features = [convert_model(x) for x in features] if regions is not None: regions = [convert_model(x) for x in regions] headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_account_settings' ) headers.update(sdk_headers) data = { '_rev': rev, 'default_enable_new_features': default_enable_new_features, 'default_enable_new_regions': default_enable_new_regions, 'enabled': enabled, 'features': features, 'regions': regions, } 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')) headers['Accept'] = 'application/json' path_param_keys = ['account_id'] path_param_values = self.encode_path_vars(account_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/api/v1/user/accounts/{account_id}/settings'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request) return response
(self, account_id: str, *, rev: Optional[str] = None, default_enable_new_features: Optional[bool] = None, default_enable_new_regions: Optional[bool] = None, enabled: Optional[bool] = None, features: Optional[List[ibm_platform_services.ibm_cloud_shell_v1.Feature]] = None, regions: Optional[List[ibm_platform_services.ibm_cloud_shell_v1.RegionSetting]] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,834
ibm_platform_services.open_service_broker_v1
OpenServiceBrokerV1
The Open Service Broker V1 service.
class OpenServiceBrokerV1(BaseService): """The Open Service Broker V1 service.""" DEFAULT_SERVICE_URL = None DEFAULT_SERVICE_NAME = 'open_service_broker' @classmethod def new_instance( cls, service_name: str = DEFAULT_SERVICE_NAME, ) -> 'OpenServiceBrokerV1': """ Return a new client for the Open Service Broker service using the specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) service = cls(authenticator) service.configure_service(service_name) return service def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Open Service Broker service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### # Enable and Disable Instances ######################### def get_service_instance_state(self, instance_id: str, **kwargs) -> DetailedResponse: """ Get the current state of the service instance. Get the current state information associated with the service instance. As a service provider you need a way to manage provisioned service instances. If an account comes past due, you may need a to disable the service (without deleting it), and when the account is settled re-enable the service. This endpoint allows both the provider and IBM Cloud to query for the state of a provisioned service instance. For example, IBM Cloud may query the provider to figure out if a given service is disabled or not and present that state to the user. :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :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 `Resp1874644Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_service_instance_state' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('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 = '/bluemix_v1/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request) return response def replace_service_instance_state( self, instance_id: str, *, enabled: bool = None, initiator_id: str = None, reason_code: str = None, **kwargs ) -> DetailedResponse: """ Update the state of a provisioned service instance. Update (disable or enable) the state of a provisioned service instance. As a service provider you need a way to manage provisioned service instances. If an account comes past due, you may need a to disable the service (without deleting it), and when the account is settled re-enable the service. This endpoint allows the provider to enable or disable the state of a provisioned service instance. It is the service provider's responsibility to disable access to the service instance when the disable endpoint is invoked and to re-enable that access when the enable endpoint is invoked. When your service broker receives an enable / disable request, it should take whatever action is necessary to enable / disable (respectively) the service. Additionally, If a bind request comes in for a disabled service, the broker should reject that request with any code other than `204`, and provide a user-facing message in the description. :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :param bool enabled: (optional) Indicates the current state of the service instance. :param str initiator_id: (optional) Optional string that shows the user ID that is initiating the call. :param str reason_code: (optional) Optional string that states the reason code for the service instance state change. Valid values are `IBMCLOUD_ACCT_ACTIVATE`, `IBMCLOUD_RECLAMATION_RESTORE`, or `IBMCLOUD_SERVICE_INSTANCE_BELOW_CAP` for enable calls; `IBMCLOUD_ACCT_SUSPEND`, `IBMCLOUD_RECLAMATION_SCHEDULE`, or `IBMCLOUD_SERVICE_INSTANCE_ABOVE_CAP` for disable calls; and `IBMCLOUD_ADMIN_REQUEST` for enable and disable calls.<br/><br/>Previously accepted values had a `BMX_` prefix, such as `BMX_ACCT_ACTIVATE`. These values are deprecated. :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 `Resp2448145Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_service_instance_state' ) headers.update(sdk_headers) data = {'enabled': enabled, 'initiator_id': initiator_id, 'reason_code': reason_code} 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')) 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 = '/bluemix_v1/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='PUT', url=url, headers=headers, data=data) response = self.send(request) return response ######################### # Resource Instances ######################### def replace_service_instance( self, instance_id: str, *, organization_guid: str = None, plan_id: str = None, service_id: str = None, space_guid: str = None, context: 'Context' = None, parameters: dict = None, accepts_incomplete: bool = None, **kwargs ) -> DetailedResponse: """ Create (provision) a service instance. Create a service instance with GUID. When your service broker receives a provision request from the IBM Cloud platform, it MUST take whatever action is necessary to create a new resource. When a user creates a service instance from the IBM Cloud console or the IBM Cloud CLI, the IBM Cloud platform validates that the user has permission to create the service instance using IBM Cloud IAM. After this validation occurs, your service broker's provision endpoint (PUT /v2/resource_instances/:instance_id) will be invoked. When provisioning occurs, the IBM Cloud platform provides the following values: - The IBM Cloud context is included in the context variable - The X-Broker-API-Originating-Identity will have the IBM IAM ID of the user that initiated the request - The parameters section will include the requested location (and additional parameters required by your service). :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :param str organization_guid: (optional) Deprecated in favor of `context`. The IBM Cloud platform GUID for the organization under which the service instance is to be provisioned. Although most brokers will not use this field, it might be helpful for executing operations on a user's behalf. It MUST be a non-empty string. :param str plan_id: (optional) The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID and it MUST be unique to a service. :param str service_id: (optional) The ID of the service stored in the catalog.json of your broker. This value should be a GUID and it MUST be a non-empty string. :param str space_guid: (optional) Deprecated in favor of `context`. The identifier for the project space within the IBM Cloud platform organization. Although most brokers will not use this field, it might be helpful for executing operations on a user's behalf. It MUST be a non-empty string. :param Context context: (optional) Platform specific contextual information under which the service instance is to be provisioned. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079872Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') if context is not None: context = convert_model(context) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_service_instance' ) headers.update(sdk_headers) params = {'accepts_incomplete': accepts_incomplete} data = { 'organization_guid': organization_guid, 'plan_id': plan_id, 'service_id': service_id, 'space_guid': space_guid, 'context': context, 'parameters': 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')) 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 = '/v2/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='PUT', url=url, headers=headers, params=params, data=data) response = self.send(request) return response def update_service_instance( self, instance_id: str, *, service_id: str = None, context: 'Context' = None, parameters: dict = None, plan_id: str = None, previous_values: dict = None, accepts_incomplete: bool = None, **kwargs ) -> DetailedResponse: """ Update a service instance. Patch an instance by GUID. Enabling this endpoint allows your user to change plans and service parameters in a provisioned service instance. If your offering supports multiple plans, and you want users to be able to change plans for a provisioned instance, you will need to enable the ability for users to update their service instance. To enable support for the update of the plan, a broker MUST declare support per service by specifying `"plan_updateable": true` in your brokers' catalog.json. :param str instance_id: The ID of a previously provisioned service instance. :param str service_id: (optional) The ID of the service stored in the catalog.json of your broker. This value should be a GUID. It MUST be a non-empty string. :param Context context: (optional) Platform specific contextual information under which the service instance is to be provisioned. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param str plan_id: (optional) The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID. MUST be unique to a service. If present, MUST be a non-empty string. If this field is not present in the request message, then the broker MUST NOT change the plan of the instance as a result of this request. :param dict previous_values: (optional) Information about the service instance prior to the update. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079874Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') if context is not None: context = convert_model(context) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_service_instance' ) headers.update(sdk_headers) params = {'accepts_incomplete': accepts_incomplete} data = { 'service_id': service_id, 'context': context, 'parameters': parameters, 'plan_id': plan_id, 'previous_values': previous_values, } 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')) 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 = '/v2/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, params=params, data=data) response = self.send(request) return response def delete_service_instance( self, service_id: str, plan_id: str, instance_id: str, *, accepts_incomplete: bool = None, **kwargs ) -> DetailedResponse: """ Delete (deprovision) a service instance. Delete (deprovision) a service instance by GUID. When a service broker receives a deprovision request from the IBM Cloud platform, it MUST delete any resources it created during the provision. Usually this means that all resources are immediately reclaimed for future provisions. :param str service_id: The ID of the service stored in the catalog.json of your broker. This value should be a GUID. MUST be a non-empty string. :param str plan_id: The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID. MUST be a non-empty string. :param str instance_id: The ID of a previously provisioned service instance. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079874Root` object """ if service_id is None: raise ValueError('service_id must be provided') if plan_id is None: raise ValueError('plan_id must be provided') if instance_id is None: raise ValueError('instance_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_service_instance' ) headers.update(sdk_headers) params = {'service_id': service_id, 'plan_id': plan_id, 'accepts_incomplete': accepts_incomplete} if 'headers' in kwargs: headers.update(kwargs.get('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 = '/v2/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params) response = self.send(request) return response ######################### # Catalog ######################### def list_catalog(self, **kwargs) -> DetailedResponse: """ Get the catalog metadata stored within the broker. This endpoints defines the contract between the broker and the IBM Cloud platform for the services and plans that the broker supports. This endpoint returns the catalog metadata stored within your broker. These values define the minimal provisioning contract between your service and the IBM Cloud platform. All additional catalog metadata that is not required for provisioning is stored within the IBM Cloud catalog, and any updates to catalog display values that are used to render your dashboard like links, icons, and i18n translated metadata should be updated in the Resource Management Console (RMC), and not housed in your broker. None of metadata stored in your broker is displayed in the IBM Cloud console or the IBM Cloud CLI; the console and CLI will return what was set withn RMC and stored in the IBM Cloud catalog. :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 `Resp1874650Root` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_catalog' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' url = '/v2/catalog' request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request) return response ######################### # Last Operation (Async) ######################### def get_last_operation( self, instance_id: str, *, operation: str = None, plan_id: str = None, service_id: str = None, **kwargs ) -> DetailedResponse: """ Get the current status of a provision in-progress for a service instance. Get `last_operation` for instance by GUID (for asynchronous provision calls). When a broker returns status code `202 Accepted` during a provision, update, or deprovision call, the IBM Cloud platform will begin polling the `last_operation` endpoint to obtain the state of the last requested operation. The broker response MUST contain the field `state` and MAY contain the field `description`. Valid values for `state` are `in progress`, `succeeded`, and `failed`. The platform will poll the `last_operation `endpoint as long as the broker returns "state": "in progress". Returning "state": "succeeded" or "state": "failed" will cause the platform to cease polling. The value provided for description will be passed through to the platform API client and can be used to provide additional detail for users about the progress of the operation. :param str instance_id: The unique instance ID generated during provisioning by the IBM Cloud platform. :param str operation: (optional) A broker-provided identifier for the operation. When a value for operation is included with asynchronous responses for provision and update, and deprovision requests, the IBM Cloud platform will provide the same value using this query parameter as a URL-encoded string. If present, MUST be a non-empty string. :param str plan_id: (optional) ID of the plan from the catalog.json in your broker. If present, MUST be a non-empty string. :param str service_id: (optional) ID of the service from the catalog.json in your service broker. If present, MUST be a non-empty string. :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 `Resp2079894Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_last_operation' ) headers.update(sdk_headers) params = {'operation': operation, 'plan_id': plan_id, 'service_id': service_id} if 'headers' in kwargs: headers.update(kwargs.get('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 = '/v2/service_instances/{instance_id}/last_operation'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request) return response ######################### # Bindings and Credentials ######################### def replace_service_binding( self, binding_id: str, instance_id: str, *, plan_id: str = None, service_id: str = None, bind_resource: 'BindResource' = None, parameters: dict = None, **kwargs ) -> DetailedResponse: """ Bind a service instance to another resource. Create binding by GUID on service instance. If your service can be bound to applications in IBM Cloud, `bindable:true` must be specified in the catalog.json of your service broker. If bindable, it must be able to return API endpoints and credentials to your service consumers. **Note:** Brokers that do not offer any bindable services do not need to implement the endpoint for bind requests. See the OSB 2.12 spec for more details on [binding](https://github.com/openservicebrokerapi/servicebroker/blob/v2.12/spec.md#binding). :param str binding_id: The `binding_id` is provided by the IBM Cloud platform. This ID will be used for future unbind requests, so the broker can use it to correlate the resource it creates. :param str instance_id: The :`instance_id` is the ID of a previously provisioned service instance. :param str plan_id: (optional) The ID of the plan from the catalog.json in your broker. If present, it MUST be a non-empty string. :param str service_id: (optional) The ID of the service from the catalog.json in your broker. If present, it MUST be a non-empty string. :param BindResource bind_resource: (optional) A JSON object that contains data for platform resources associated with the binding to be created. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `Resp2079876Root` object """ if binding_id is None: raise ValueError('binding_id must be provided') if instance_id is None: raise ValueError('instance_id must be provided') if bind_resource is not None: bind_resource = convert_model(bind_resource) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_service_binding' ) headers.update(sdk_headers) data = {'plan_id': plan_id, 'service_id': service_id, 'bind_resource': bind_resource, 'parameters': 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')) headers['Accept'] = 'application/json' path_param_keys = ['binding_id', 'instance_id'] path_param_values = self.encode_path_vars(binding_id, instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/service_instances/{instance_id}/service_bindings/{binding_id}'.format(**path_param_dict) request = self.prepare_request(method='PUT', url=url, headers=headers, data=data) response = self.send(request) return response def delete_service_binding( self, binding_id: str, instance_id: str, plan_id: str, service_id: str, **kwargs ) -> DetailedResponse: """ Delete (unbind) the credentials bound to a resource. Delete instance binding by GUID. When a broker receives an unbind request from the IBM Cloud platform, it MUST delete any resources associated with the binding. In the case where credentials were generated, this might result in requests to the service instance failing to authenticate. **Note**: Brokers that do not provide any bindable services or plans do not need to implement this endpoint. :param str binding_id: The `binding_id` is the ID of a previously provisioned binding for that service instance. :param str instance_id: The `instance_id` is the ID of a previously provisioned service instance. :param str plan_id: The ID of the plan from the catalog.json in the broker. It MUST be a non-empty string and should be a GUID. :param str service_id: The ID of the service from the catalog.json in the broker. It MUST be a non-empty string and should be a GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if binding_id is None: raise ValueError('binding_id must be provided') if instance_id is None: raise ValueError('instance_id must be provided') if plan_id is None: raise ValueError('plan_id must be provided') if service_id is None: raise ValueError('service_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_service_binding' ) headers.update(sdk_headers) params = {'plan_id': plan_id, 'service_id': service_id} if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['binding_id', 'instance_id'] path_param_values = self.encode_path_vars(binding_id, instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/service_instances/{instance_id}/service_bindings/{binding_id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params) response = self.send(request) return response
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
719,835
ibm_platform_services.open_service_broker_v1
__init__
Construct a new client for the Open Service Broker service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice.
def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Open Service Broker service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
(self, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None) -> NoneType
719,841
ibm_platform_services.open_service_broker_v1
delete_service_binding
Delete (unbind) the credentials bound to a resource. Delete instance binding by GUID. When a broker receives an unbind request from the IBM Cloud platform, it MUST delete any resources associated with the binding. In the case where credentials were generated, this might result in requests to the service instance failing to authenticate. **Note**: Brokers that do not provide any bindable services or plans do not need to implement this endpoint. :param str binding_id: The `binding_id` is the ID of a previously provisioned binding for that service instance. :param str instance_id: The `instance_id` is the ID of a previously provisioned service instance. :param str plan_id: The ID of the plan from the catalog.json in the broker. It MUST be a non-empty string and should be a GUID. :param str service_id: The ID of the service from the catalog.json in the broker. It MUST be a non-empty string and should be a GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_service_binding( self, binding_id: str, instance_id: str, plan_id: str, service_id: str, **kwargs ) -> DetailedResponse: """ Delete (unbind) the credentials bound to a resource. Delete instance binding by GUID. When a broker receives an unbind request from the IBM Cloud platform, it MUST delete any resources associated with the binding. In the case where credentials were generated, this might result in requests to the service instance failing to authenticate. **Note**: Brokers that do not provide any bindable services or plans do not need to implement this endpoint. :param str binding_id: The `binding_id` is the ID of a previously provisioned binding for that service instance. :param str instance_id: The `instance_id` is the ID of a previously provisioned service instance. :param str plan_id: The ID of the plan from the catalog.json in the broker. It MUST be a non-empty string and should be a GUID. :param str service_id: The ID of the service from the catalog.json in the broker. It MUST be a non-empty string and should be a GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if binding_id is None: raise ValueError('binding_id must be provided') if instance_id is None: raise ValueError('instance_id must be provided') if plan_id is None: raise ValueError('plan_id must be provided') if service_id is None: raise ValueError('service_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_service_binding' ) headers.update(sdk_headers) params = {'plan_id': plan_id, 'service_id': service_id} if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['binding_id', 'instance_id'] path_param_values = self.encode_path_vars(binding_id, instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/service_instances/{instance_id}/service_bindings/{binding_id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params) response = self.send(request) return response
(self, binding_id: str, instance_id: str, plan_id: str, service_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,842
ibm_platform_services.open_service_broker_v1
delete_service_instance
Delete (deprovision) a service instance. Delete (deprovision) a service instance by GUID. When a service broker receives a deprovision request from the IBM Cloud platform, it MUST delete any resources it created during the provision. Usually this means that all resources are immediately reclaimed for future provisions. :param str service_id: The ID of the service stored in the catalog.json of your broker. This value should be a GUID. MUST be a non-empty string. :param str plan_id: The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID. MUST be a non-empty string. :param str instance_id: The ID of a previously provisioned service instance. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079874Root` object
def delete_service_instance( self, service_id: str, plan_id: str, instance_id: str, *, accepts_incomplete: bool = None, **kwargs ) -> DetailedResponse: """ Delete (deprovision) a service instance. Delete (deprovision) a service instance by GUID. When a service broker receives a deprovision request from the IBM Cloud platform, it MUST delete any resources it created during the provision. Usually this means that all resources are immediately reclaimed for future provisions. :param str service_id: The ID of the service stored in the catalog.json of your broker. This value should be a GUID. MUST be a non-empty string. :param str plan_id: The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID. MUST be a non-empty string. :param str instance_id: The ID of a previously provisioned service instance. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079874Root` object """ if service_id is None: raise ValueError('service_id must be provided') if plan_id is None: raise ValueError('plan_id must be provided') if instance_id is None: raise ValueError('instance_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_service_instance' ) headers.update(sdk_headers) params = {'service_id': service_id, 'plan_id': plan_id, 'accepts_incomplete': accepts_incomplete} if 'headers' in kwargs: headers.update(kwargs.get('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 = '/v2/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params) response = self.send(request) return response
(self, service_id: str, plan_id: str, instance_id: str, *, accepts_incomplete: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,849
ibm_platform_services.open_service_broker_v1
get_last_operation
Get the current status of a provision in-progress for a service instance. Get `last_operation` for instance by GUID (for asynchronous provision calls). When a broker returns status code `202 Accepted` during a provision, update, or deprovision call, the IBM Cloud platform will begin polling the `last_operation` endpoint to obtain the state of the last requested operation. The broker response MUST contain the field `state` and MAY contain the field `description`. Valid values for `state` are `in progress`, `succeeded`, and `failed`. The platform will poll the `last_operation `endpoint as long as the broker returns "state": "in progress". Returning "state": "succeeded" or "state": "failed" will cause the platform to cease polling. The value provided for description will be passed through to the platform API client and can be used to provide additional detail for users about the progress of the operation. :param str instance_id: The unique instance ID generated during provisioning by the IBM Cloud platform. :param str operation: (optional) A broker-provided identifier for the operation. When a value for operation is included with asynchronous responses for provision and update, and deprovision requests, the IBM Cloud platform will provide the same value using this query parameter as a URL-encoded string. If present, MUST be a non-empty string. :param str plan_id: (optional) ID of the plan from the catalog.json in your broker. If present, MUST be a non-empty string. :param str service_id: (optional) ID of the service from the catalog.json in your service broker. If present, MUST be a non-empty string. :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 `Resp2079894Root` object
def get_last_operation( self, instance_id: str, *, operation: str = None, plan_id: str = None, service_id: str = None, **kwargs ) -> DetailedResponse: """ Get the current status of a provision in-progress for a service instance. Get `last_operation` for instance by GUID (for asynchronous provision calls). When a broker returns status code `202 Accepted` during a provision, update, or deprovision call, the IBM Cloud platform will begin polling the `last_operation` endpoint to obtain the state of the last requested operation. The broker response MUST contain the field `state` and MAY contain the field `description`. Valid values for `state` are `in progress`, `succeeded`, and `failed`. The platform will poll the `last_operation `endpoint as long as the broker returns "state": "in progress". Returning "state": "succeeded" or "state": "failed" will cause the platform to cease polling. The value provided for description will be passed through to the platform API client and can be used to provide additional detail for users about the progress of the operation. :param str instance_id: The unique instance ID generated during provisioning by the IBM Cloud platform. :param str operation: (optional) A broker-provided identifier for the operation. When a value for operation is included with asynchronous responses for provision and update, and deprovision requests, the IBM Cloud platform will provide the same value using this query parameter as a URL-encoded string. If present, MUST be a non-empty string. :param str plan_id: (optional) ID of the plan from the catalog.json in your broker. If present, MUST be a non-empty string. :param str service_id: (optional) ID of the service from the catalog.json in your service broker. If present, MUST be a non-empty string. :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 `Resp2079894Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_last_operation' ) headers.update(sdk_headers) params = {'operation': operation, 'plan_id': plan_id, 'service_id': service_id} if 'headers' in kwargs: headers.update(kwargs.get('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 = '/v2/service_instances/{instance_id}/last_operation'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request) return response
(self, instance_id: str, *, operation: Optional[str] = None, plan_id: Optional[str] = None, service_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,850
ibm_platform_services.open_service_broker_v1
get_service_instance_state
Get the current state of the service instance. Get the current state information associated with the service instance. As a service provider you need a way to manage provisioned service instances. If an account comes past due, you may need a to disable the service (without deleting it), and when the account is settled re-enable the service. This endpoint allows both the provider and IBM Cloud to query for the state of a provisioned service instance. For example, IBM Cloud may query the provider to figure out if a given service is disabled or not and present that state to the user. :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :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 `Resp1874644Root` object
def get_service_instance_state(self, instance_id: str, **kwargs) -> DetailedResponse: """ Get the current state of the service instance. Get the current state information associated with the service instance. As a service provider you need a way to manage provisioned service instances. If an account comes past due, you may need a to disable the service (without deleting it), and when the account is settled re-enable the service. This endpoint allows both the provider and IBM Cloud to query for the state of a provisioned service instance. For example, IBM Cloud may query the provider to figure out if a given service is disabled or not and present that state to the user. :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :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 `Resp1874644Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_service_instance_state' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('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 = '/bluemix_v1/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request) return response
(self, instance_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,851
ibm_platform_services.open_service_broker_v1
list_catalog
Get the catalog metadata stored within the broker. This endpoints defines the contract between the broker and the IBM Cloud platform for the services and plans that the broker supports. This endpoint returns the catalog metadata stored within your broker. These values define the minimal provisioning contract between your service and the IBM Cloud platform. All additional catalog metadata that is not required for provisioning is stored within the IBM Cloud catalog, and any updates to catalog display values that are used to render your dashboard like links, icons, and i18n translated metadata should be updated in the Resource Management Console (RMC), and not housed in your broker. None of metadata stored in your broker is displayed in the IBM Cloud console or the IBM Cloud CLI; the console and CLI will return what was set withn RMC and stored in the IBM Cloud catalog. :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 `Resp1874650Root` object
def list_catalog(self, **kwargs) -> DetailedResponse: """ Get the catalog metadata stored within the broker. This endpoints defines the contract between the broker and the IBM Cloud platform for the services and plans that the broker supports. This endpoint returns the catalog metadata stored within your broker. These values define the minimal provisioning contract between your service and the IBM Cloud platform. All additional catalog metadata that is not required for provisioning is stored within the IBM Cloud catalog, and any updates to catalog display values that are used to render your dashboard like links, icons, and i18n translated metadata should be updated in the Resource Management Console (RMC), and not housed in your broker. None of metadata stored in your broker is displayed in the IBM Cloud console or the IBM Cloud CLI; the console and CLI will return what was set withn RMC and stored in the IBM Cloud catalog. :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 `Resp1874650Root` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_catalog' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' url = '/v2/catalog' request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request) return response
(self, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,853
ibm_platform_services.open_service_broker_v1
replace_service_binding
Bind a service instance to another resource. Create binding by GUID on service instance. If your service can be bound to applications in IBM Cloud, `bindable:true` must be specified in the catalog.json of your service broker. If bindable, it must be able to return API endpoints and credentials to your service consumers. **Note:** Brokers that do not offer any bindable services do not need to implement the endpoint for bind requests. See the OSB 2.12 spec for more details on [binding](https://github.com/openservicebrokerapi/servicebroker/blob/v2.12/spec.md#binding). :param str binding_id: The `binding_id` is provided by the IBM Cloud platform. This ID will be used for future unbind requests, so the broker can use it to correlate the resource it creates. :param str instance_id: The :`instance_id` is the ID of a previously provisioned service instance. :param str plan_id: (optional) The ID of the plan from the catalog.json in your broker. If present, it MUST be a non-empty string. :param str service_id: (optional) The ID of the service from the catalog.json in your broker. If present, it MUST be a non-empty string. :param BindResource bind_resource: (optional) A JSON object that contains data for platform resources associated with the binding to be created. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `Resp2079876Root` object
def replace_service_binding( self, binding_id: str, instance_id: str, *, plan_id: str = None, service_id: str = None, bind_resource: 'BindResource' = None, parameters: dict = None, **kwargs ) -> DetailedResponse: """ Bind a service instance to another resource. Create binding by GUID on service instance. If your service can be bound to applications in IBM Cloud, `bindable:true` must be specified in the catalog.json of your service broker. If bindable, it must be able to return API endpoints and credentials to your service consumers. **Note:** Brokers that do not offer any bindable services do not need to implement the endpoint for bind requests. See the OSB 2.12 spec for more details on [binding](https://github.com/openservicebrokerapi/servicebroker/blob/v2.12/spec.md#binding). :param str binding_id: The `binding_id` is provided by the IBM Cloud platform. This ID will be used for future unbind requests, so the broker can use it to correlate the resource it creates. :param str instance_id: The :`instance_id` is the ID of a previously provisioned service instance. :param str plan_id: (optional) The ID of the plan from the catalog.json in your broker. If present, it MUST be a non-empty string. :param str service_id: (optional) The ID of the service from the catalog.json in your broker. If present, it MUST be a non-empty string. :param BindResource bind_resource: (optional) A JSON object that contains data for platform resources associated with the binding to be created. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse with `dict` result representing a `Resp2079876Root` object """ if binding_id is None: raise ValueError('binding_id must be provided') if instance_id is None: raise ValueError('instance_id must be provided') if bind_resource is not None: bind_resource = convert_model(bind_resource) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_service_binding' ) headers.update(sdk_headers) data = {'plan_id': plan_id, 'service_id': service_id, 'bind_resource': bind_resource, 'parameters': 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')) headers['Accept'] = 'application/json' path_param_keys = ['binding_id', 'instance_id'] path_param_values = self.encode_path_vars(binding_id, instance_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/service_instances/{instance_id}/service_bindings/{binding_id}'.format(**path_param_dict) request = self.prepare_request(method='PUT', url=url, headers=headers, data=data) response = self.send(request) return response
(self, binding_id: str, instance_id: str, *, plan_id: Optional[str] = None, service_id: Optional[str] = None, bind_resource: Optional[ibm_platform_services.open_service_broker_v1.BindResource] = None, parameters: Optional[dict] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,854
ibm_platform_services.open_service_broker_v1
replace_service_instance
Create (provision) a service instance. Create a service instance with GUID. When your service broker receives a provision request from the IBM Cloud platform, it MUST take whatever action is necessary to create a new resource. When a user creates a service instance from the IBM Cloud console or the IBM Cloud CLI, the IBM Cloud platform validates that the user has permission to create the service instance using IBM Cloud IAM. After this validation occurs, your service broker's provision endpoint (PUT /v2/resource_instances/:instance_id) will be invoked. When provisioning occurs, the IBM Cloud platform provides the following values: - The IBM Cloud context is included in the context variable - The X-Broker-API-Originating-Identity will have the IBM IAM ID of the user that initiated the request - The parameters section will include the requested location (and additional parameters required by your service). :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :param str organization_guid: (optional) Deprecated in favor of `context`. The IBM Cloud platform GUID for the organization under which the service instance is to be provisioned. Although most brokers will not use this field, it might be helpful for executing operations on a user's behalf. It MUST be a non-empty string. :param str plan_id: (optional) The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID and it MUST be unique to a service. :param str service_id: (optional) The ID of the service stored in the catalog.json of your broker. This value should be a GUID and it MUST be a non-empty string. :param str space_guid: (optional) Deprecated in favor of `context`. The identifier for the project space within the IBM Cloud platform organization. Although most brokers will not use this field, it might be helpful for executing operations on a user's behalf. It MUST be a non-empty string. :param Context context: (optional) Platform specific contextual information under which the service instance is to be provisioned. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079872Root` object
def replace_service_instance( self, instance_id: str, *, organization_guid: str = None, plan_id: str = None, service_id: str = None, space_guid: str = None, context: 'Context' = None, parameters: dict = None, accepts_incomplete: bool = None, **kwargs ) -> DetailedResponse: """ Create (provision) a service instance. Create a service instance with GUID. When your service broker receives a provision request from the IBM Cloud platform, it MUST take whatever action is necessary to create a new resource. When a user creates a service instance from the IBM Cloud console or the IBM Cloud CLI, the IBM Cloud platform validates that the user has permission to create the service instance using IBM Cloud IAM. After this validation occurs, your service broker's provision endpoint (PUT /v2/resource_instances/:instance_id) will be invoked. When provisioning occurs, the IBM Cloud platform provides the following values: - The IBM Cloud context is included in the context variable - The X-Broker-API-Originating-Identity will have the IBM IAM ID of the user that initiated the request - The parameters section will include the requested location (and additional parameters required by your service). :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :param str organization_guid: (optional) Deprecated in favor of `context`. The IBM Cloud platform GUID for the organization under which the service instance is to be provisioned. Although most brokers will not use this field, it might be helpful for executing operations on a user's behalf. It MUST be a non-empty string. :param str plan_id: (optional) The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID and it MUST be unique to a service. :param str service_id: (optional) The ID of the service stored in the catalog.json of your broker. This value should be a GUID and it MUST be a non-empty string. :param str space_guid: (optional) Deprecated in favor of `context`. The identifier for the project space within the IBM Cloud platform organization. Although most brokers will not use this field, it might be helpful for executing operations on a user's behalf. It MUST be a non-empty string. :param Context context: (optional) Platform specific contextual information under which the service instance is to be provisioned. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079872Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') if context is not None: context = convert_model(context) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_service_instance' ) headers.update(sdk_headers) params = {'accepts_incomplete': accepts_incomplete} data = { 'organization_guid': organization_guid, 'plan_id': plan_id, 'service_id': service_id, 'space_guid': space_guid, 'context': context, 'parameters': 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')) 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 = '/v2/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='PUT', url=url, headers=headers, params=params, data=data) response = self.send(request) return response
(self, instance_id: str, *, organization_guid: Optional[str] = None, plan_id: Optional[str] = None, service_id: Optional[str] = None, space_guid: Optional[str] = None, context: Optional[ibm_platform_services.open_service_broker_v1.Context] = None, parameters: Optional[dict] = None, accepts_incomplete: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,855
ibm_platform_services.open_service_broker_v1
replace_service_instance_state
Update the state of a provisioned service instance. Update (disable or enable) the state of a provisioned service instance. As a service provider you need a way to manage provisioned service instances. If an account comes past due, you may need a to disable the service (without deleting it), and when the account is settled re-enable the service. This endpoint allows the provider to enable or disable the state of a provisioned service instance. It is the service provider's responsibility to disable access to the service instance when the disable endpoint is invoked and to re-enable that access when the enable endpoint is invoked. When your service broker receives an enable / disable request, it should take whatever action is necessary to enable / disable (respectively) the service. Additionally, If a bind request comes in for a disabled service, the broker should reject that request with any code other than `204`, and provide a user-facing message in the description. :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :param bool enabled: (optional) Indicates the current state of the service instance. :param str initiator_id: (optional) Optional string that shows the user ID that is initiating the call. :param str reason_code: (optional) Optional string that states the reason code for the service instance state change. Valid values are `IBMCLOUD_ACCT_ACTIVATE`, `IBMCLOUD_RECLAMATION_RESTORE`, or `IBMCLOUD_SERVICE_INSTANCE_BELOW_CAP` for enable calls; `IBMCLOUD_ACCT_SUSPEND`, `IBMCLOUD_RECLAMATION_SCHEDULE`, or `IBMCLOUD_SERVICE_INSTANCE_ABOVE_CAP` for disable calls; and `IBMCLOUD_ADMIN_REQUEST` for enable and disable calls.<br/><br/>Previously accepted values had a `BMX_` prefix, such as `BMX_ACCT_ACTIVATE`. These values are deprecated. :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 `Resp2448145Root` object
def replace_service_instance_state( self, instance_id: str, *, enabled: bool = None, initiator_id: str = None, reason_code: str = None, **kwargs ) -> DetailedResponse: """ Update the state of a provisioned service instance. Update (disable or enable) the state of a provisioned service instance. As a service provider you need a way to manage provisioned service instances. If an account comes past due, you may need a to disable the service (without deleting it), and when the account is settled re-enable the service. This endpoint allows the provider to enable or disable the state of a provisioned service instance. It is the service provider's responsibility to disable access to the service instance when the disable endpoint is invoked and to re-enable that access when the enable endpoint is invoked. When your service broker receives an enable / disable request, it should take whatever action is necessary to enable / disable (respectively) the service. Additionally, If a bind request comes in for a disabled service, the broker should reject that request with any code other than `204`, and provide a user-facing message in the description. :param str instance_id: The `instance_id` of a service instance is provided by the IBM Cloud platform. This ID will be used for future requests to bind and deprovision, so the broker can use it to correlate the resource it creates. :param bool enabled: (optional) Indicates the current state of the service instance. :param str initiator_id: (optional) Optional string that shows the user ID that is initiating the call. :param str reason_code: (optional) Optional string that states the reason code for the service instance state change. Valid values are `IBMCLOUD_ACCT_ACTIVATE`, `IBMCLOUD_RECLAMATION_RESTORE`, or `IBMCLOUD_SERVICE_INSTANCE_BELOW_CAP` for enable calls; `IBMCLOUD_ACCT_SUSPEND`, `IBMCLOUD_RECLAMATION_SCHEDULE`, or `IBMCLOUD_SERVICE_INSTANCE_ABOVE_CAP` for disable calls; and `IBMCLOUD_ADMIN_REQUEST` for enable and disable calls.<br/><br/>Previously accepted values had a `BMX_` prefix, such as `BMX_ACCT_ACTIVATE`. These values are deprecated. :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 `Resp2448145Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_service_instance_state' ) headers.update(sdk_headers) data = {'enabled': enabled, 'initiator_id': initiator_id, 'reason_code': reason_code} 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')) 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 = '/bluemix_v1/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='PUT', url=url, headers=headers, data=data) response = self.send(request) return response
(self, instance_id: str, *, enabled: Optional[bool] = None, initiator_id: Optional[str] = None, reason_code: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,863
ibm_platform_services.open_service_broker_v1
update_service_instance
Update a service instance. Patch an instance by GUID. Enabling this endpoint allows your user to change plans and service parameters in a provisioned service instance. If your offering supports multiple plans, and you want users to be able to change plans for a provisioned instance, you will need to enable the ability for users to update their service instance. To enable support for the update of the plan, a broker MUST declare support per service by specifying `"plan_updateable": true` in your brokers' catalog.json. :param str instance_id: The ID of a previously provisioned service instance. :param str service_id: (optional) The ID of the service stored in the catalog.json of your broker. This value should be a GUID. It MUST be a non-empty string. :param Context context: (optional) Platform specific contextual information under which the service instance is to be provisioned. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param str plan_id: (optional) The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID. MUST be unique to a service. If present, MUST be a non-empty string. If this field is not present in the request message, then the broker MUST NOT change the plan of the instance as a result of this request. :param dict previous_values: (optional) Information about the service instance prior to the update. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079874Root` object
def update_service_instance( self, instance_id: str, *, service_id: str = None, context: 'Context' = None, parameters: dict = None, plan_id: str = None, previous_values: dict = None, accepts_incomplete: bool = None, **kwargs ) -> DetailedResponse: """ Update a service instance. Patch an instance by GUID. Enabling this endpoint allows your user to change plans and service parameters in a provisioned service instance. If your offering supports multiple plans, and you want users to be able to change plans for a provisioned instance, you will need to enable the ability for users to update their service instance. To enable support for the update of the plan, a broker MUST declare support per service by specifying `"plan_updateable": true` in your brokers' catalog.json. :param str instance_id: The ID of a previously provisioned service instance. :param str service_id: (optional) The ID of the service stored in the catalog.json of your broker. This value should be a GUID. It MUST be a non-empty string. :param Context context: (optional) Platform specific contextual information under which the service instance is to be provisioned. :param dict parameters: (optional) Configuration options for the service instance. An opaque object, controller treats this as a blob. Brokers should ensure that the client has provided valid configuration parameters and values for the operation. If this field is not present in the request message, then the broker MUST NOT change the parameters of the instance as a result of this request. :param str plan_id: (optional) The ID of the plan for which the service instance has been requested, which is stored in the catalog.json of your broker. This value should be a GUID. MUST be unique to a service. If present, MUST be a non-empty string. If this field is not present in the request message, then the broker MUST NOT change the plan of the instance as a result of this request. :param dict previous_values: (optional) Information about the service instance prior to the update. :param bool accepts_incomplete: (optional) A value of true indicates that both the IBM Cloud platform and the requesting client support asynchronous deprovisioning. If this parameter is not included in the request, and the broker can only deprovision a service instance of the requested plan asynchronously, the broker MUST reject the request with a `422` Unprocessable Entity. :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 `Resp2079874Root` object """ if instance_id is None: raise ValueError('instance_id must be provided') if context is not None: context = convert_model(context) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_service_instance' ) headers.update(sdk_headers) params = {'accepts_incomplete': accepts_incomplete} data = { 'service_id': service_id, 'context': context, 'parameters': parameters, 'plan_id': plan_id, 'previous_values': previous_values, } 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')) 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 = '/v2/service_instances/{instance_id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, params=params, data=data) response = self.send(request) return response
(self, instance_id: str, *, service_id: Optional[str] = None, context: Optional[ibm_platform_services.open_service_broker_v1.Context] = None, parameters: Optional[dict] = None, plan_id: Optional[str] = None, previous_values: Optional[dict] = None, accepts_incomplete: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,864
ibm_platform_services.partner_billing_units_v1
PartnerBillingUnitsV1
The Partner Billing Units V1 service.
class PartnerBillingUnitsV1(BaseService): """The Partner Billing Units V1 service.""" DEFAULT_SERVICE_URL = 'https://partner.cloud.ibm.com' DEFAULT_SERVICE_NAME = 'partner_billing_units' @classmethod def new_instance( cls, service_name: str = DEFAULT_SERVICE_NAME, ) -> 'PartnerBillingUnitsV1': """ Return a new client for the Partner Billing Units service using the specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) service = cls(authenticator) service.configure_service(service_name) return service def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Partner Billing Units service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### # Billing Options ######################### def get_billing_options( self, partner_id: str, *, customer_id: Optional[str] = None, reseller_id: Optional[str] = None, date: Optional[str] = None, limit: Optional[int] = None, **kwargs, ) -> DetailedResponse: """ Get customers billing options. Returns the billing options for the requested customer for a given month. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str customer_id: (optional) Enterprise ID of the customer for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. :param str date: (optional) The billing month for which the usage report is requested. Format is yyyy-mm. Defaults to current month. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :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 `BillingOptionsSummary` object """ if not partner_id: raise ValueError('partner_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_billing_options', ) headers.update(sdk_headers) params = { 'partner_id': partner_id, 'customer_id': customer_id, 'reseller_id': reseller_id, 'date': date, '_limit': limit, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/billing-options' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response ######################### # Credit Pools ######################### def get_credit_pools_report( self, partner_id: str, *, customer_id: Optional[str] = None, reseller_id: Optional[str] = None, date: Optional[str] = None, limit: Optional[int] = None, **kwargs, ) -> DetailedResponse: """ Get subscription burn-down report. Returns the subscription or commitment burn-down reports for the end customers for a given month. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str customer_id: (optional) Enterprise ID of the customer for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. :param str date: (optional) The billing month for which the usage report is requested. Format is yyyy-mm. Defaults to current month. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :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 `CreditPoolsReportSummary` object """ if not partner_id: raise ValueError('partner_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_credit_pools_report', ) headers.update(sdk_headers) params = { 'partner_id': partner_id, 'customer_id': customer_id, 'reseller_id': reseller_id, 'date': date, '_limit': limit, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/credit-pools' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
719,865
ibm_platform_services.partner_billing_units_v1
__init__
Construct a new client for the Partner Billing Units service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice.
def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Partner Billing Units service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
(self, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None) -> NoneType
719,875
ibm_platform_services.partner_billing_units_v1
get_billing_options
Get customers billing options. Returns the billing options for the requested customer for a given month. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str customer_id: (optional) Enterprise ID of the customer for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. :param str date: (optional) The billing month for which the usage report is requested. Format is yyyy-mm. Defaults to current month. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :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 `BillingOptionsSummary` object
def get_billing_options( self, partner_id: str, *, customer_id: Optional[str] = None, reseller_id: Optional[str] = None, date: Optional[str] = None, limit: Optional[int] = None, **kwargs, ) -> DetailedResponse: """ Get customers billing options. Returns the billing options for the requested customer for a given month. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str customer_id: (optional) Enterprise ID of the customer for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. :param str date: (optional) The billing month for which the usage report is requested. Format is yyyy-mm. Defaults to current month. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :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 `BillingOptionsSummary` object """ if not partner_id: raise ValueError('partner_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_billing_options', ) headers.update(sdk_headers) params = { 'partner_id': partner_id, 'customer_id': customer_id, 'reseller_id': reseller_id, 'date': date, '_limit': limit, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/billing-options' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, partner_id: str, *, customer_id: Optional[str] = None, reseller_id: Optional[str] = None, date: Optional[str] = None, limit: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,876
ibm_platform_services.partner_billing_units_v1
get_credit_pools_report
Get subscription burn-down report. Returns the subscription or commitment burn-down reports for the end customers for a given month. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str customer_id: (optional) Enterprise ID of the customer for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. :param str date: (optional) The billing month for which the usage report is requested. Format is yyyy-mm. Defaults to current month. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :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 `CreditPoolsReportSummary` object
def get_credit_pools_report( self, partner_id: str, *, customer_id: Optional[str] = None, reseller_id: Optional[str] = None, date: Optional[str] = None, limit: Optional[int] = None, **kwargs, ) -> DetailedResponse: """ Get subscription burn-down report. Returns the subscription or commitment burn-down reports for the end customers for a given month. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str customer_id: (optional) Enterprise ID of the customer for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. :param str date: (optional) The billing month for which the usage report is requested. Format is yyyy-mm. Defaults to current month. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :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 `CreditPoolsReportSummary` object """ if not partner_id: raise ValueError('partner_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_credit_pools_report', ) headers.update(sdk_headers) params = { 'partner_id': partner_id, 'customer_id': customer_id, 'reseller_id': reseller_id, 'date': date, '_limit': limit, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/credit-pools' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, partner_id: str, *, customer_id: Optional[str] = None, reseller_id: Optional[str] = None, date: Optional[str] = None, limit: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,887
ibm_platform_services.partner_usage_reports_v1
PartnerUsageReportsV1
The Partner Usage Reports V1 service.
class PartnerUsageReportsV1(BaseService): """The Partner Usage Reports V1 service.""" DEFAULT_SERVICE_URL = 'https://partner.cloud.ibm.com' DEFAULT_SERVICE_NAME = 'partner_usage_reports' @classmethod def new_instance( cls, service_name: str = DEFAULT_SERVICE_NAME, ) -> 'PartnerUsageReportsV1': """ Return a new client for the Partner Usage Reports service using the specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) service = cls(authenticator) service.configure_service(service_name) return service def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Partner Usage Reports service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### # Partner Usage Reports ######################### def get_resource_usage_report( self, partner_id: str, *, reseller_id: Optional[str] = None, customer_id: Optional[str] = None, children: Optional[bool] = None, month: Optional[str] = None, viewpoint: Optional[str] = None, recurse: Optional[bool] = None, limit: Optional[int] = None, offset: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get partner resource usage report. Returns the summary for the partner for a given month. Partner billing managers are authorized to access this report. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. This parameter cannot be used along with `customer_id` query parameter. :param str customer_id: (optional) Enterprise ID of the child customer for which the report is requested. This parameter cannot be used along with `reseller_id` query parameter. :param bool children: (optional) Get report rolled-up to the direct children of the requested entity. Defaults to false. This parameter cannot be used along with `customer_id` query parameter. :param str month: (optional) The billing month for which the usage report is requested. Format is `yyyy-mm`. Defaults to current month. :param str viewpoint: (optional) Enables partner to view the cost of provisioned services as applicable at each level of the hierarchy. Defaults to the type of the calling partner. The valid values are `DISTRIBUTOR`, `RESELLER` and `END_CUSTOMER`. :param bool recurse: (optional) Get usage report rolled-up to the end customers of the requested entity. Defaults to false. This parameter cannot be used along with `reseller_id` query parameter or `customer_id` query parameter. :param int limit: (optional) Number of usage records to be returned. The default value is 30. Maximum value is 200. :param str offset: (optional) An opaque value representing the offset of the first item to be returned by a search query. If not specified, then the first page of results is returned. To retrieve the next page of search results, use the 'offset' query parameter value within the 'next.href' URL found within a prior search query 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 `PartnerUsageReportSummary` object """ if not partner_id: raise ValueError('partner_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_resource_usage_report', ) headers.update(sdk_headers) params = { 'partner_id': partner_id, 'reseller_id': reseller_id, 'customer_id': customer_id, 'children': children, 'month': month, 'viewpoint': viewpoint, 'recurse': recurse, 'limit': limit, 'offset': offset, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/resource-usage-reports' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
719,888
ibm_platform_services.partner_usage_reports_v1
__init__
Construct a new client for the Partner Usage Reports service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice.
def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Partner Usage Reports service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
(self, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None) -> NoneType
719,900
ibm_platform_services.partner_usage_reports_v1
get_resource_usage_report
Get partner resource usage report. Returns the summary for the partner for a given month. Partner billing managers are authorized to access this report. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. This parameter cannot be used along with `customer_id` query parameter. :param str customer_id: (optional) Enterprise ID of the child customer for which the report is requested. This parameter cannot be used along with `reseller_id` query parameter. :param bool children: (optional) Get report rolled-up to the direct children of the requested entity. Defaults to false. This parameter cannot be used along with `customer_id` query parameter. :param str month: (optional) The billing month for which the usage report is requested. Format is `yyyy-mm`. Defaults to current month. :param str viewpoint: (optional) Enables partner to view the cost of provisioned services as applicable at each level of the hierarchy. Defaults to the type of the calling partner. The valid values are `DISTRIBUTOR`, `RESELLER` and `END_CUSTOMER`. :param bool recurse: (optional) Get usage report rolled-up to the end customers of the requested entity. Defaults to false. This parameter cannot be used along with `reseller_id` query parameter or `customer_id` query parameter. :param int limit: (optional) Number of usage records to be returned. The default value is 30. Maximum value is 200. :param str offset: (optional) An opaque value representing the offset of the first item to be returned by a search query. If not specified, then the first page of results is returned. To retrieve the next page of search results, use the 'offset' query parameter value within the 'next.href' URL found within a prior search query 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 `PartnerUsageReportSummary` object
def get_resource_usage_report( self, partner_id: str, *, reseller_id: Optional[str] = None, customer_id: Optional[str] = None, children: Optional[bool] = None, month: Optional[str] = None, viewpoint: Optional[str] = None, recurse: Optional[bool] = None, limit: Optional[int] = None, offset: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get partner resource usage report. Returns the summary for the partner for a given month. Partner billing managers are authorized to access this report. :param str partner_id: Enterprise ID of the distributor or reseller for which the report is requested. :param str reseller_id: (optional) Enterprise ID of the reseller for which the report is requested. This parameter cannot be used along with `customer_id` query parameter. :param str customer_id: (optional) Enterprise ID of the child customer for which the report is requested. This parameter cannot be used along with `reseller_id` query parameter. :param bool children: (optional) Get report rolled-up to the direct children of the requested entity. Defaults to false. This parameter cannot be used along with `customer_id` query parameter. :param str month: (optional) The billing month for which the usage report is requested. Format is `yyyy-mm`. Defaults to current month. :param str viewpoint: (optional) Enables partner to view the cost of provisioned services as applicable at each level of the hierarchy. Defaults to the type of the calling partner. The valid values are `DISTRIBUTOR`, `RESELLER` and `END_CUSTOMER`. :param bool recurse: (optional) Get usage report rolled-up to the end customers of the requested entity. Defaults to false. This parameter cannot be used along with `reseller_id` query parameter or `customer_id` query parameter. :param int limit: (optional) Number of usage records to be returned. The default value is 30. Maximum value is 200. :param str offset: (optional) An opaque value representing the offset of the first item to be returned by a search query. If not specified, then the first page of results is returned. To retrieve the next page of search results, use the 'offset' query parameter value within the 'next.href' URL found within a prior search query 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 `PartnerUsageReportSummary` object """ if not partner_id: raise ValueError('partner_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_resource_usage_report', ) headers.update(sdk_headers) params = { 'partner_id': partner_id, 'reseller_id': reseller_id, 'customer_id': customer_id, 'children': children, 'month': month, 'viewpoint': viewpoint, 'recurse': recurse, 'limit': limit, 'offset': offset, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/resource-usage-reports' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, partner_id: str, *, reseller_id: Optional[str] = None, customer_id: Optional[str] = None, children: Optional[bool] = None, month: Optional[str] = None, viewpoint: Optional[str] = None, recurse: Optional[bool] = None, limit: Optional[int] = None, offset: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,909
ibm_platform_services.resource_controller_v2
ResourceControllerV2
The resource_controller V2 service.
class ResourceControllerV2(BaseService): """The resource_controller V2 service.""" DEFAULT_SERVICE_URL = 'https://resource-controller.cloud.ibm.com' DEFAULT_SERVICE_NAME = 'resource_controller' @classmethod def new_instance( cls, service_name: str = DEFAULT_SERVICE_NAME, ) -> 'ResourceControllerV2': """ Return a new client for the resource_controller service using the specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) service = cls(authenticator) service.configure_service(service_name) return service def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the resource_controller service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### # Resource Instances ######################### def list_resource_instances( self, *, guid: str = None, name: str = None, resource_group_id: str = None, resource_id: str = None, resource_plan_id: str = None, type: str = None, sub_type: str = None, limit: int = None, start: str = None, state: str = None, updated_from: str = None, updated_to: str = None, **kwargs, ) -> DetailedResponse: """ Get a list of all resource instances. View a list of all available resource instances. Resources is a broad term that could mean anything from a service instance to a virtual machine associated with the customer account. :param str guid: (optional) The GUID of the instance. :param str name: (optional) The human-readable name of the instance. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering. This value is provided by and stored in the global catalog. :param str resource_plan_id: (optional) The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param str type: (optional) The type of the instance, for example, `service_instance`. :param str sub_type: (optional) The sub-type of instance, for example, `kms`. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str state: (optional) The state of the instance. If not specified, instances in state `active` and `provisioning` are returned. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceInstancesList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_instances' ) headers.update(sdk_headers) params = { 'guid': guid, 'name': name, 'resource_group_id': resource_group_id, 'resource_id': resource_id, 'resource_plan_id': resource_plan_id, 'type': type, 'sub_type': sub_type, 'limit': limit, 'start': start, 'state': state, 'updated_from': updated_from, 'updated_to': updated_to, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/resource_instances' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def create_resource_instance( self, name: str, target: str, resource_group: str, resource_plan_id: str, *, tags: List[str] = None, allow_cleanup: bool = None, parameters: dict = None, entity_lock: bool = None, **kwargs, ) -> DetailedResponse: """ Create (provision) a new resource instance. When you provision a service you get an instance of that service. An instance represents the resource with which you create, and additionally, represents a chargeable record of which billing can occur. :param str name: The name of the instance. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param str target: The deployment location where the instance should be hosted. :param str resource_group: The ID of the resource group. :param str resource_plan_id: The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param List[str] tags: (optional) Tags that are attached to the instance after provisioning. These tags can be searched and managed through the Tagging API in IBM Cloud. :param bool allow_cleanup: (optional) A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call. :param dict parameters: (optional) Configuration options represented as key-value pairs that are passed through to the target resource brokers. :param bool entity_lock: (optional) Indicates if the resource instance is locked for further update or delete operations. It does not affect actions performed on child resources like aliases, bindings or keys. False by default. :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 `ResourceInstance` object """ if name is None: raise ValueError('name must be provided') if target is None: raise ValueError('target must be provided') if resource_group is None: raise ValueError('resource_group must be provided') if resource_plan_id is None: raise ValueError('resource_plan_id must be provided') headers = {'Entity-Lock': entity_lock} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_instance' ) headers.update(sdk_headers) data = { 'name': name, 'target': target, 'resource_group': resource_group, 'resource_plan_id': resource_plan_id, 'tags': tags, 'allow_cleanup': allow_cleanup, 'parameters': 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' url = '/v2/resource_instances' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response def get_resource_instance(self, id: str, **kwargs) -> DetailedResponse: """ Get a resource instance. Retrieve a resource instance by URL-encoded CRN or GUID. Find more details on a particular instance, like when it was provisioned and who provisioned it. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_instance' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response def delete_resource_instance(self, id: str, *, recursive: bool = None, **kwargs) -> DetailedResponse: """ Delete a resource instance. Delete a resource instance by URL-encoded CRN or GUID. If the resource instance has any resource keys or aliases associated with it, use the `recursive=true` parameter to delete it. :param str id: The resource instance URL-encoded CRN or GUID. :param bool recursive: (optional) Will delete resource bindings, keys and aliases associated with the instance. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_instance' ) headers.update(sdk_headers) params = {'recursive': recursive} if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def update_resource_instance( self, id: str, *, name: str = None, parameters: dict = None, resource_plan_id: str = None, allow_cleanup: bool = None, **kwargs, ) -> DetailedResponse: """ Update a resource instance. Use the resource instance URL-encoded CRN or GUID to make updates to the resource instance, like changing the name or plan. :param str id: The resource instance URL-encoded CRN or GUID. :param str name: (optional) The new name of the instance. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param dict parameters: (optional) The new configuration options for the instance. :param str resource_plan_id: (optional) The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param bool allow_cleanup: (optional) A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_instance' ) headers.update(sdk_headers) data = { 'name': name, 'parameters': parameters, 'resource_plan_id': resource_plan_id, 'allow_cleanup': allow_cleanup, } 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{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 list_resource_aliases_for_instance( self, id: str, *, limit: int = None, start: str = None, **kwargs ) -> DetailedResponse: """ Get a list of all resource aliases for the instance. Retrieving a list of all resource aliases can help you find out who's using the resource instance. :param str id: The resource instance URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceAliasesList` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_aliases_for_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' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/resource_aliases'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def list_resource_keys_for_instance( self, id: str, *, limit: int = None, start: str = None, **kwargs ) -> DetailedResponse: """ Get a list of all the resource keys for the instance. You may have many resource keys for one resource instance. For example, you may have a different resource key for each user or each role. :param str id: The resource instance URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceKeysList` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_keys_for_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' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/resource_keys'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def lock_resource_instance(self, id: str, **kwargs) -> DetailedResponse: """ Lock a resource instance. Locks a resource instance. A locked instance can not be updated or deleted. It does not affect actions performed on child resources like aliases, bindings, or keys. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='lock_resource_instance' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/lock'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers) response = self.send(request, **kwargs) return response def unlock_resource_instance(self, id: str, **kwargs) -> DetailedResponse: """ Unlock a resource instance. Unlock a resource instance to update or delete it. Unlocking a resource instance does not affect child resources like aliases, bindings or keys. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='unlock_resource_instance' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/lock'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response def cancel_lastop_resource_instance(self, id: str, **kwargs) -> DetailedResponse: """ Cancel the in progress last operation of the resource instance. Cancel the in progress last operation of the resource instance. After successful cancellation, the resource instance is removed. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='cancel_lastop_resource_instance' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/last_operation'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response ######################### # Resource Keys ######################### def list_resource_keys( self, *, guid: str = None, name: str = None, resource_group_id: str = None, resource_id: str = None, limit: int = None, start: str = None, updated_from: str = None, updated_to: str = None, **kwargs, ) -> DetailedResponse: """ Get a list of all of the resource keys. View all of the resource keys that exist for all of your resource instances. :param str guid: (optional) The GUID of the key. :param str name: (optional) The human-readable name of the key. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering. This value is provided by and stored in the global catalog. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceKeysList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_keys' ) headers.update(sdk_headers) params = { 'guid': guid, 'name': name, 'resource_group_id': resource_group_id, 'resource_id': resource_id, 'limit': limit, 'start': start, 'updated_from': updated_from, 'updated_to': updated_to, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/resource_keys' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def create_resource_key( self, name: str, source: str, *, parameters: 'ResourceKeyPostParameters' = None, role: str = None, **kwargs ) -> DetailedResponse: """ Create a new resource key. A resource key is a saved credential you can use to authenticate with a resource instance. :param str name: The name of the key. :param str source: The ID of resource instance or alias. :param ResourceKeyPostParameters parameters: (optional) Configuration options represented as key-value pairs. Service defined options are passed through to the target resource brokers, whereas platform defined options are not. :param str role: (optional) The base IAM service role name (Reader, Writer, or Manager), or the service or custom role CRN. Refer to service’s documentation for supported roles. :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 `ResourceKey` object """ if name is None: raise ValueError('name must be provided') if source is None: raise ValueError('source must be provided') if parameters is not None: parameters = convert_model(parameters) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_key' ) headers.update(sdk_headers) data = {'name': name, 'source': source, 'parameters': parameters, 'role': role} 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 = '/v2/resource_keys' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response def get_resource_key(self, id: str, **kwargs) -> DetailedResponse: """ Get resource key. View the details of a resource key by URL-encoded CRN or GUID, like the credentials for the key and who created it. :param str id: The resource key URL-encoded CRN or GUID. :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 `ResourceKey` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_key' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_keys/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response def delete_resource_key(self, id: str, **kwargs) -> DetailedResponse: """ Delete a resource key. Deleting a resource key does not affect any resource instance or resource alias associated with the key. :param str id: The resource key URL-encoded CRN or GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_key' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_keys/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response def update_resource_key(self, id: str, name: str, **kwargs) -> DetailedResponse: """ Update a resource key. Use the resource key URL-encoded CRN or GUID to update the resource key. :param str id: The resource key URL-encoded CRN or GUID. :param str name: The new name of the key. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceKey` object """ if not id: raise ValueError('id must be provided') if name is None: raise ValueError('name must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_key' ) headers.update(sdk_headers) data = {'name': name} 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_keys/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response ######################### # Resource Bindings ######################### def list_resource_bindings( self, *, guid: str = None, name: str = None, resource_group_id: str = None, resource_id: str = None, region_binding_id: str = None, limit: int = None, start: str = None, updated_from: str = None, updated_to: str = None, **kwargs, ) -> DetailedResponse: """ Get a list of all resource bindings. View all of the resource bindings that exist for all of your resource aliases. :param str guid: (optional) The GUID of the binding. :param str name: (optional) The human-readable name of the binding. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering (service name). This value is provided by and stored in the global catalog. :param str region_binding_id: (optional) The ID of the binding in the target environment. For example, `service_binding_id` in a given IBM Cloud environment. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceBindingsList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_bindings' ) headers.update(sdk_headers) params = { 'guid': guid, 'name': name, 'resource_group_id': resource_group_id, 'resource_id': resource_id, 'region_binding_id': region_binding_id, 'limit': limit, 'start': start, 'updated_from': updated_from, 'updated_to': updated_to, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/resource_bindings' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def create_resource_binding( self, source: str, target: str, *, name: str = None, parameters: 'ResourceBindingPostParameters' = None, role: str = None, **kwargs, ) -> DetailedResponse: """ Create a new resource binding. A resource binding connects credentials to a resource alias. The credentials are in the form of a resource key. :param str source: The ID of resource alias. :param str target: The CRN of application to bind to in a specific environment, for example, Dallas YP, CFEE instance. :param str name: (optional) The name of the binding. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param ResourceBindingPostParameters parameters: (optional) Configuration options represented as key-value pairs. Service defined options are passed through to the target resource brokers, whereas platform defined options are not. :param str role: (optional) The base IAM service role name (Reader, Writer, or Manager), or the service or custom role CRN. Refer to service’s documentation for supported roles. :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 `ResourceBinding` object """ if source is None: raise ValueError('source must be provided') if target is None: raise ValueError('target must be provided') if parameters is not None: parameters = convert_model(parameters) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_binding' ) headers.update(sdk_headers) data = {'source': source, 'target': target, 'name': name, 'parameters': parameters, 'role': role} 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 = '/v2/resource_bindings' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response def get_resource_binding(self, id: str, **kwargs) -> DetailedResponse: """ Get a resource binding. View a resource binding and all of its details, like who created it, the credential, and the resource alias that the binding is associated with. :param str id: The resource binding URL-encoded CRN or GUID. :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 `ResourceBinding` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_binding' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_bindings/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response def delete_resource_binding(self, id: str, **kwargs) -> DetailedResponse: """ Delete a resource binding. Deleting a resource binding does not affect the resource alias that the binding is associated with. :param str id: The resource binding URL-encoded CRN or GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_binding' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_bindings/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response def update_resource_binding(self, id: str, name: str, **kwargs) -> DetailedResponse: """ Update a resource binding. Use the resource binding URL-encoded CRN or GUID to update the resource binding. :param str id: The resource binding URL-encoded CRN or GUID. :param str name: The new name of the binding. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceBinding` object """ if not id: raise ValueError('id must be provided') if name is None: raise ValueError('name must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_binding' ) headers.update(sdk_headers) data = {'name': name} 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_bindings/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response ######################### # Resource Aliases ######################### def list_resource_aliases( self, *, guid: str = None, name: str = None, resource_instance_id: str = None, region_instance_id: str = None, resource_id: str = None, resource_group_id: str = None, limit: int = None, start: str = None, updated_from: str = None, updated_to: str = None, **kwargs, ) -> DetailedResponse: """ Get a list of all resource aliases. View all of the resource aliases that exist for every resource instance. :param str guid: (optional) The GUID of the alias. :param str name: (optional) The human-readable name of the alias. :param str resource_instance_id: (optional) The ID of the resource instance. :param str region_instance_id: (optional) The ID of the instance in the target environment. For example, `service_instance_id` in a given IBM Cloud environment. :param str resource_id: (optional) The unique ID of the offering (service name). This value is provided by and stored in the global catalog. :param str resource_group_id: (optional) The ID of the resource group. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceAliasesList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_aliases' ) headers.update(sdk_headers) params = { 'guid': guid, 'name': name, 'resource_instance_id': resource_instance_id, 'region_instance_id': region_instance_id, 'resource_id': resource_id, 'resource_group_id': resource_group_id, 'limit': limit, 'start': start, 'updated_from': updated_from, 'updated_to': updated_to, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/resource_aliases' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def create_resource_alias(self, name: str, source: str, target: str, **kwargs) -> DetailedResponse: """ Create a new resource alias. Alias a resource instance into a targeted environment's (name)space. :param str name: The name of the alias. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param str source: The ID of resource instance. :param str target: The CRN of target name(space) in a specific environment, for example, space in Dallas YP, CFEE instance etc. :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 `ResourceAlias` object """ if name is None: raise ValueError('name must be provided') if source is None: raise ValueError('source must be provided') if target is None: raise ValueError('target must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_alias' ) headers.update(sdk_headers) data = {'name': name, 'source': source, 'target': target} 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 = '/v2/resource_aliases' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response def get_resource_alias(self, id: str, **kwargs) -> DetailedResponse: """ Get a resource alias. View a resource alias and all of its details, like who created it and the resource instance that it's associated with. :param str id: The resource alias URL-encoded CRN or GUID. :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 `ResourceAlias` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_alias' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_aliases/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response def delete_resource_alias(self, id: str, *, recursive: bool = None, **kwargs) -> DetailedResponse: """ Delete a resource alias. Delete a resource alias by URL-encoded CRN or GUID. If the resource alias has any resource keys or bindings associated with it, use the `recursive=true` parameter to delete it. :param str id: The resource alias URL-encoded CRN or GUID. :param bool recursive: (optional) Deletes the resource bindings and keys associated with the alias. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_alias' ) headers.update(sdk_headers) params = {'recursive': recursive} if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_aliases/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def update_resource_alias(self, id: str, name: str, **kwargs) -> DetailedResponse: """ Update a resource alias. Use the resource alias URL-encoded CRN or GUID to update the resource alias. :param str id: The resource alias URL-encoded CRN or GUID. :param str name: The new name of the alias. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceAlias` object """ if not id: raise ValueError('id must be provided') if name is None: raise ValueError('name must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_alias' ) headers.update(sdk_headers) data = {'name': name} 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_aliases/{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 list_resource_bindings_for_alias( self, id: str, *, limit: int = None, start: str = None, **kwargs ) -> DetailedResponse: """ Get a list of all resource bindings for the alias. View all of the resource bindings associated with a specific resource alias. :param str id: The resource alias URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceBindingsList` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_bindings_for_alias', ) 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_aliases/{id}/resource_bindings'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response ######################### # Resource Reclamations ######################### def list_reclamations( self, *, account_id: str = None, resource_instance_id: str = None, **kwargs ) -> DetailedResponse: """ Get a list of all reclamations. View all of the resource reclamations that exist for every resource instance. :param str account_id: (optional) An alpha-numeric value identifying the account ID. :param str resource_instance_id: (optional) The GUID of the resource 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 `ReclamationsList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_reclamations' ) headers.update(sdk_headers) params = {'account_id': account_id, 'resource_instance_id': resource_instance_id} if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/reclamations' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def run_reclamation_action( self, id: str, action_name: str, *, request_by: str = None, comment: str = None, **kwargs ) -> DetailedResponse: """ Perform a reclamation action. Reclaim a resource instance so that it can no longer be used, or restore the resource instance so that it's usable again. :param str id: The ID associated with the reclamation. :param str action_name: The reclamation action name. Specify `reclaim` to delete a resource, or `restore` to restore a resource. :param str request_by: (optional) The request initiator, if different from the request token. :param str comment: (optional) A comment to describe the action. :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 `Reclamation` object """ if not id: raise ValueError('id must be provided') if not action_name: raise ValueError('action_name must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='run_reclamation_action' ) headers.update(sdk_headers) data = {'request_by': request_by, 'comment': comment} 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 = ['id', 'action_name'] path_param_values = self.encode_path_vars(id, action_name) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/reclamations/{id}/actions/{action_name}'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
719,910
ibm_platform_services.resource_controller_v2
__init__
Construct a new client for the resource_controller service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice.
def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the resource_controller service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
(self, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None) -> NoneType
719,915
ibm_platform_services.resource_controller_v2
cancel_lastop_resource_instance
Cancel the in progress last operation of the resource instance. Cancel the in progress last operation of the resource instance. After successful cancellation, the resource instance is removed. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object
def cancel_lastop_resource_instance(self, id: str, **kwargs) -> DetailedResponse: """ Cancel the in progress last operation of the resource instance. Cancel the in progress last operation of the resource instance. After successful cancellation, the resource instance is removed. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='cancel_lastop_resource_instance' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/last_operation'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,917
ibm_platform_services.resource_controller_v2
create_resource_alias
Create a new resource alias. Alias a resource instance into a targeted environment's (name)space. :param str name: The name of the alias. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param str source: The ID of resource instance. :param str target: The CRN of target name(space) in a specific environment, for example, space in Dallas YP, CFEE instance etc. :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 `ResourceAlias` object
def create_resource_alias(self, name: str, source: str, target: str, **kwargs) -> DetailedResponse: """ Create a new resource alias. Alias a resource instance into a targeted environment's (name)space. :param str name: The name of the alias. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param str source: The ID of resource instance. :param str target: The CRN of target name(space) in a specific environment, for example, space in Dallas YP, CFEE instance etc. :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 `ResourceAlias` object """ if name is None: raise ValueError('name must be provided') if source is None: raise ValueError('source must be provided') if target is None: raise ValueError('target must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_alias' ) headers.update(sdk_headers) data = {'name': name, 'source': source, 'target': target} 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 = '/v2/resource_aliases' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, name: str, source: str, target: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,918
ibm_platform_services.resource_controller_v2
create_resource_binding
Create a new resource binding. A resource binding connects credentials to a resource alias. The credentials are in the form of a resource key. :param str source: The ID of resource alias. :param str target: The CRN of application to bind to in a specific environment, for example, Dallas YP, CFEE instance. :param str name: (optional) The name of the binding. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param ResourceBindingPostParameters parameters: (optional) Configuration options represented as key-value pairs. Service defined options are passed through to the target resource brokers, whereas platform defined options are not. :param str role: (optional) The base IAM service role name (Reader, Writer, or Manager), or the service or custom role CRN. Refer to service’s documentation for supported roles. :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 `ResourceBinding` object
def create_resource_binding( self, source: str, target: str, *, name: str = None, parameters: 'ResourceBindingPostParameters' = None, role: str = None, **kwargs, ) -> DetailedResponse: """ Create a new resource binding. A resource binding connects credentials to a resource alias. The credentials are in the form of a resource key. :param str source: The ID of resource alias. :param str target: The CRN of application to bind to in a specific environment, for example, Dallas YP, CFEE instance. :param str name: (optional) The name of the binding. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param ResourceBindingPostParameters parameters: (optional) Configuration options represented as key-value pairs. Service defined options are passed through to the target resource brokers, whereas platform defined options are not. :param str role: (optional) The base IAM service role name (Reader, Writer, or Manager), or the service or custom role CRN. Refer to service’s documentation for supported roles. :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 `ResourceBinding` object """ if source is None: raise ValueError('source must be provided') if target is None: raise ValueError('target must be provided') if parameters is not None: parameters = convert_model(parameters) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_binding' ) headers.update(sdk_headers) data = {'source': source, 'target': target, 'name': name, 'parameters': parameters, 'role': role} 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 = '/v2/resource_bindings' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, source: str, target: str, *, name: Optional[str] = None, parameters: Optional[ibm_platform_services.resource_controller_v2.ResourceBindingPostParameters] = None, role: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,919
ibm_platform_services.resource_controller_v2
create_resource_instance
Create (provision) a new resource instance. When you provision a service you get an instance of that service. An instance represents the resource with which you create, and additionally, represents a chargeable record of which billing can occur. :param str name: The name of the instance. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param str target: The deployment location where the instance should be hosted. :param str resource_group: The ID of the resource group. :param str resource_plan_id: The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param List[str] tags: (optional) Tags that are attached to the instance after provisioning. These tags can be searched and managed through the Tagging API in IBM Cloud. :param bool allow_cleanup: (optional) A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call. :param dict parameters: (optional) Configuration options represented as key-value pairs that are passed through to the target resource brokers. :param bool entity_lock: (optional) Indicates if the resource instance is locked for further update or delete operations. It does not affect actions performed on child resources like aliases, bindings or keys. False by default. :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 `ResourceInstance` object
def create_resource_instance( self, name: str, target: str, resource_group: str, resource_plan_id: str, *, tags: List[str] = None, allow_cleanup: bool = None, parameters: dict = None, entity_lock: bool = None, **kwargs, ) -> DetailedResponse: """ Create (provision) a new resource instance. When you provision a service you get an instance of that service. An instance represents the resource with which you create, and additionally, represents a chargeable record of which billing can occur. :param str name: The name of the instance. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param str target: The deployment location where the instance should be hosted. :param str resource_group: The ID of the resource group. :param str resource_plan_id: The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param List[str] tags: (optional) Tags that are attached to the instance after provisioning. These tags can be searched and managed through the Tagging API in IBM Cloud. :param bool allow_cleanup: (optional) A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call. :param dict parameters: (optional) Configuration options represented as key-value pairs that are passed through to the target resource brokers. :param bool entity_lock: (optional) Indicates if the resource instance is locked for further update or delete operations. It does not affect actions performed on child resources like aliases, bindings or keys. False by default. :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 `ResourceInstance` object """ if name is None: raise ValueError('name must be provided') if target is None: raise ValueError('target must be provided') if resource_group is None: raise ValueError('resource_group must be provided') if resource_plan_id is None: raise ValueError('resource_plan_id must be provided') headers = {'Entity-Lock': entity_lock} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_instance' ) headers.update(sdk_headers) data = { 'name': name, 'target': target, 'resource_group': resource_group, 'resource_plan_id': resource_plan_id, 'tags': tags, 'allow_cleanup': allow_cleanup, 'parameters': 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' url = '/v2/resource_instances' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, name: str, target: str, resource_group: str, resource_plan_id: str, *, tags: Optional[List[str]] = None, allow_cleanup: Optional[bool] = None, parameters: Optional[dict] = None, entity_lock: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,920
ibm_platform_services.resource_controller_v2
create_resource_key
Create a new resource key. A resource key is a saved credential you can use to authenticate with a resource instance. :param str name: The name of the key. :param str source: The ID of resource instance or alias. :param ResourceKeyPostParameters parameters: (optional) Configuration options represented as key-value pairs. Service defined options are passed through to the target resource brokers, whereas platform defined options are not. :param str role: (optional) The base IAM service role name (Reader, Writer, or Manager), or the service or custom role CRN. Refer to service’s documentation for supported roles. :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 `ResourceKey` object
def create_resource_key( self, name: str, source: str, *, parameters: 'ResourceKeyPostParameters' = None, role: str = None, **kwargs ) -> DetailedResponse: """ Create a new resource key. A resource key is a saved credential you can use to authenticate with a resource instance. :param str name: The name of the key. :param str source: The ID of resource instance or alias. :param ResourceKeyPostParameters parameters: (optional) Configuration options represented as key-value pairs. Service defined options are passed through to the target resource brokers, whereas platform defined options are not. :param str role: (optional) The base IAM service role name (Reader, Writer, or Manager), or the service or custom role CRN. Refer to service’s documentation for supported roles. :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 `ResourceKey` object """ if name is None: raise ValueError('name must be provided') if source is None: raise ValueError('source must be provided') if parameters is not None: parameters = convert_model(parameters) headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_key' ) headers.update(sdk_headers) data = {'name': name, 'source': source, 'parameters': parameters, 'role': role} 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 = '/v2/resource_keys' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, name: str, source: str, *, parameters: Optional[ibm_platform_services.resource_controller_v2.ResourceKeyPostParameters] = None, role: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,921
ibm_platform_services.resource_controller_v2
delete_resource_alias
Delete a resource alias. Delete a resource alias by URL-encoded CRN or GUID. If the resource alias has any resource keys or bindings associated with it, use the `recursive=true` parameter to delete it. :param str id: The resource alias URL-encoded CRN or GUID. :param bool recursive: (optional) Deletes the resource bindings and keys associated with the alias. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_resource_alias(self, id: str, *, recursive: bool = None, **kwargs) -> DetailedResponse: """ Delete a resource alias. Delete a resource alias by URL-encoded CRN or GUID. If the resource alias has any resource keys or bindings associated with it, use the `recursive=true` parameter to delete it. :param str id: The resource alias URL-encoded CRN or GUID. :param bool recursive: (optional) Deletes the resource bindings and keys associated with the alias. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_alias' ) headers.update(sdk_headers) params = {'recursive': recursive} if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_aliases/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, id: str, *, recursive: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,922
ibm_platform_services.resource_controller_v2
delete_resource_binding
Delete a resource binding. Deleting a resource binding does not affect the resource alias that the binding is associated with. :param str id: The resource binding URL-encoded CRN or GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_resource_binding(self, id: str, **kwargs) -> DetailedResponse: """ Delete a resource binding. Deleting a resource binding does not affect the resource alias that the binding is associated with. :param str id: The resource binding URL-encoded CRN or GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_binding' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_bindings/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,923
ibm_platform_services.resource_controller_v2
delete_resource_instance
Delete a resource instance. Delete a resource instance by URL-encoded CRN or GUID. If the resource instance has any resource keys or aliases associated with it, use the `recursive=true` parameter to delete it. :param str id: The resource instance URL-encoded CRN or GUID. :param bool recursive: (optional) Will delete resource bindings, keys and aliases associated with the instance. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_resource_instance(self, id: str, *, recursive: bool = None, **kwargs) -> DetailedResponse: """ Delete a resource instance. Delete a resource instance by URL-encoded CRN or GUID. If the resource instance has any resource keys or aliases associated with it, use the `recursive=true` parameter to delete it. :param str id: The resource instance URL-encoded CRN or GUID. :param bool recursive: (optional) Will delete resource bindings, keys and aliases associated with the instance. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_instance' ) headers.update(sdk_headers) params = {'recursive': recursive} if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, id: str, *, recursive: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,924
ibm_platform_services.resource_controller_v2
delete_resource_key
Delete a resource key. Deleting a resource key does not affect any resource instance or resource alias associated with the key. :param str id: The resource key URL-encoded CRN or GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_resource_key(self, id: str, **kwargs) -> DetailedResponse: """ Delete a resource key. Deleting a resource key does not affect any resource instance or resource alias associated with the key. :param str id: The resource key URL-encoded CRN or GUID. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_key' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_keys/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,931
ibm_platform_services.resource_controller_v2
get_resource_alias
Get a resource alias. View a resource alias and all of its details, like who created it and the resource instance that it's associated with. :param str id: The resource alias URL-encoded CRN or GUID. :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 `ResourceAlias` object
def get_resource_alias(self, id: str, **kwargs) -> DetailedResponse: """ Get a resource alias. View a resource alias and all of its details, like who created it and the resource instance that it's associated with. :param str id: The resource alias URL-encoded CRN or GUID. :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 `ResourceAlias` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_alias' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_aliases/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,932
ibm_platform_services.resource_controller_v2
get_resource_binding
Get a resource binding. View a resource binding and all of its details, like who created it, the credential, and the resource alias that the binding is associated with. :param str id: The resource binding URL-encoded CRN or GUID. :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 `ResourceBinding` object
def get_resource_binding(self, id: str, **kwargs) -> DetailedResponse: """ Get a resource binding. View a resource binding and all of its details, like who created it, the credential, and the resource alias that the binding is associated with. :param str id: The resource binding URL-encoded CRN or GUID. :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 `ResourceBinding` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_binding' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_bindings/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,933
ibm_platform_services.resource_controller_v2
get_resource_instance
Get a resource instance. Retrieve a resource instance by URL-encoded CRN or GUID. Find more details on a particular instance, like when it was provisioned and who provisioned it. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object
def get_resource_instance(self, id: str, **kwargs) -> DetailedResponse: """ Get a resource instance. Retrieve a resource instance by URL-encoded CRN or GUID. Find more details on a particular instance, like when it was provisioned and who provisioned it. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_instance' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,934
ibm_platform_services.resource_controller_v2
get_resource_key
Get resource key. View the details of a resource key by URL-encoded CRN or GUID, like the credentials for the key and who created it. :param str id: The resource key URL-encoded CRN or GUID. :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 `ResourceKey` object
def get_resource_key(self, id: str, **kwargs) -> DetailedResponse: """ Get resource key. View the details of a resource key by URL-encoded CRN or GUID, like the credentials for the key and who created it. :param str id: The resource key URL-encoded CRN or GUID. :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 `ResourceKey` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_key' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_keys/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,935
ibm_platform_services.resource_controller_v2
list_reclamations
Get a list of all reclamations. View all of the resource reclamations that exist for every resource instance. :param str account_id: (optional) An alpha-numeric value identifying the account ID. :param str resource_instance_id: (optional) The GUID of the resource 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 `ReclamationsList` object
def list_reclamations( self, *, account_id: str = None, resource_instance_id: str = None, **kwargs ) -> DetailedResponse: """ Get a list of all reclamations. View all of the resource reclamations that exist for every resource instance. :param str account_id: (optional) An alpha-numeric value identifying the account ID. :param str resource_instance_id: (optional) The GUID of the resource 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 `ReclamationsList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_reclamations' ) headers.update(sdk_headers) params = {'account_id': account_id, 'resource_instance_id': resource_instance_id} if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/reclamations' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, *, account_id: Optional[str] = None, resource_instance_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,936
ibm_platform_services.resource_controller_v2
list_resource_aliases
Get a list of all resource aliases. View all of the resource aliases that exist for every resource instance. :param str guid: (optional) The GUID of the alias. :param str name: (optional) The human-readable name of the alias. :param str resource_instance_id: (optional) The ID of the resource instance. :param str region_instance_id: (optional) The ID of the instance in the target environment. For example, `service_instance_id` in a given IBM Cloud environment. :param str resource_id: (optional) The unique ID of the offering (service name). This value is provided by and stored in the global catalog. :param str resource_group_id: (optional) The ID of the resource group. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceAliasesList` object
def list_resource_aliases( self, *, guid: str = None, name: str = None, resource_instance_id: str = None, region_instance_id: str = None, resource_id: str = None, resource_group_id: str = None, limit: int = None, start: str = None, updated_from: str = None, updated_to: str = None, **kwargs, ) -> DetailedResponse: """ Get a list of all resource aliases. View all of the resource aliases that exist for every resource instance. :param str guid: (optional) The GUID of the alias. :param str name: (optional) The human-readable name of the alias. :param str resource_instance_id: (optional) The ID of the resource instance. :param str region_instance_id: (optional) The ID of the instance in the target environment. For example, `service_instance_id` in a given IBM Cloud environment. :param str resource_id: (optional) The unique ID of the offering (service name). This value is provided by and stored in the global catalog. :param str resource_group_id: (optional) The ID of the resource group. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceAliasesList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_aliases' ) headers.update(sdk_headers) params = { 'guid': guid, 'name': name, 'resource_instance_id': resource_instance_id, 'region_instance_id': region_instance_id, 'resource_id': resource_id, 'resource_group_id': resource_group_id, 'limit': limit, 'start': start, 'updated_from': updated_from, 'updated_to': updated_to, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/resource_aliases' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, *, guid: Optional[str] = None, name: Optional[str] = None, resource_instance_id: Optional[str] = None, region_instance_id: Optional[str] = None, resource_id: Optional[str] = None, resource_group_id: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, updated_from: Optional[str] = None, updated_to: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,937
ibm_platform_services.resource_controller_v2
list_resource_aliases_for_instance
Get a list of all resource aliases for the instance. Retrieving a list of all resource aliases can help you find out who's using the resource instance. :param str id: The resource instance URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceAliasesList` object
def list_resource_aliases_for_instance( self, id: str, *, limit: int = None, start: str = None, **kwargs ) -> DetailedResponse: """ Get a list of all resource aliases for the instance. Retrieving a list of all resource aliases can help you find out who's using the resource instance. :param str id: The resource instance URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceAliasesList` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_aliases_for_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' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/resource_aliases'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, id: str, *, limit: Optional[int] = None, start: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,938
ibm_platform_services.resource_controller_v2
list_resource_bindings
Get a list of all resource bindings. View all of the resource bindings that exist for all of your resource aliases. :param str guid: (optional) The GUID of the binding. :param str name: (optional) The human-readable name of the binding. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering (service name). This value is provided by and stored in the global catalog. :param str region_binding_id: (optional) The ID of the binding in the target environment. For example, `service_binding_id` in a given IBM Cloud environment. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceBindingsList` object
def list_resource_bindings( self, *, guid: str = None, name: str = None, resource_group_id: str = None, resource_id: str = None, region_binding_id: str = None, limit: int = None, start: str = None, updated_from: str = None, updated_to: str = None, **kwargs, ) -> DetailedResponse: """ Get a list of all resource bindings. View all of the resource bindings that exist for all of your resource aliases. :param str guid: (optional) The GUID of the binding. :param str name: (optional) The human-readable name of the binding. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering (service name). This value is provided by and stored in the global catalog. :param str region_binding_id: (optional) The ID of the binding in the target environment. For example, `service_binding_id` in a given IBM Cloud environment. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceBindingsList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_bindings' ) headers.update(sdk_headers) params = { 'guid': guid, 'name': name, 'resource_group_id': resource_group_id, 'resource_id': resource_id, 'region_binding_id': region_binding_id, 'limit': limit, 'start': start, 'updated_from': updated_from, 'updated_to': updated_to, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/resource_bindings' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, *, guid: Optional[str] = None, name: Optional[str] = None, resource_group_id: Optional[str] = None, resource_id: Optional[str] = None, region_binding_id: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, updated_from: Optional[str] = None, updated_to: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,939
ibm_platform_services.resource_controller_v2
list_resource_bindings_for_alias
Get a list of all resource bindings for the alias. View all of the resource bindings associated with a specific resource alias. :param str id: The resource alias URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceBindingsList` object
def list_resource_bindings_for_alias( self, id: str, *, limit: int = None, start: str = None, **kwargs ) -> DetailedResponse: """ Get a list of all resource bindings for the alias. View all of the resource bindings associated with a specific resource alias. :param str id: The resource alias URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceBindingsList` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_bindings_for_alias', ) 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_aliases/{id}/resource_bindings'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, id: str, *, limit: Optional[int] = None, start: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,940
ibm_platform_services.resource_controller_v2
list_resource_instances
Get a list of all resource instances. View a list of all available resource instances. Resources is a broad term that could mean anything from a service instance to a virtual machine associated with the customer account. :param str guid: (optional) The GUID of the instance. :param str name: (optional) The human-readable name of the instance. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering. This value is provided by and stored in the global catalog. :param str resource_plan_id: (optional) The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param str type: (optional) The type of the instance, for example, `service_instance`. :param str sub_type: (optional) The sub-type of instance, for example, `kms`. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str state: (optional) The state of the instance. If not specified, instances in state `active` and `provisioning` are returned. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceInstancesList` object
def list_resource_instances( self, *, guid: str = None, name: str = None, resource_group_id: str = None, resource_id: str = None, resource_plan_id: str = None, type: str = None, sub_type: str = None, limit: int = None, start: str = None, state: str = None, updated_from: str = None, updated_to: str = None, **kwargs, ) -> DetailedResponse: """ Get a list of all resource instances. View a list of all available resource instances. Resources is a broad term that could mean anything from a service instance to a virtual machine associated with the customer account. :param str guid: (optional) The GUID of the instance. :param str name: (optional) The human-readable name of the instance. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering. This value is provided by and stored in the global catalog. :param str resource_plan_id: (optional) The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param str type: (optional) The type of the instance, for example, `service_instance`. :param str sub_type: (optional) The sub-type of instance, for example, `kms`. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str state: (optional) The state of the instance. If not specified, instances in state `active` and `provisioning` are returned. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceInstancesList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_instances' ) headers.update(sdk_headers) params = { 'guid': guid, 'name': name, 'resource_group_id': resource_group_id, 'resource_id': resource_id, 'resource_plan_id': resource_plan_id, 'type': type, 'sub_type': sub_type, 'limit': limit, 'start': start, 'state': state, 'updated_from': updated_from, 'updated_to': updated_to, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/resource_instances' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, *, guid: Optional[str] = None, name: Optional[str] = None, resource_group_id: Optional[str] = None, resource_id: Optional[str] = None, resource_plan_id: Optional[str] = None, type: Optional[str] = None, sub_type: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, state: Optional[str] = None, updated_from: Optional[str] = None, updated_to: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,941
ibm_platform_services.resource_controller_v2
list_resource_keys
Get a list of all of the resource keys. View all of the resource keys that exist for all of your resource instances. :param str guid: (optional) The GUID of the key. :param str name: (optional) The human-readable name of the key. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering. This value is provided by and stored in the global catalog. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceKeysList` object
def list_resource_keys( self, *, guid: str = None, name: str = None, resource_group_id: str = None, resource_id: str = None, limit: int = None, start: str = None, updated_from: str = None, updated_to: str = None, **kwargs, ) -> DetailedResponse: """ Get a list of all of the resource keys. View all of the resource keys that exist for all of your resource instances. :param str guid: (optional) The GUID of the key. :param str name: (optional) The human-readable name of the key. :param str resource_group_id: (optional) The ID of the resource group. :param str resource_id: (optional) The unique ID of the offering. This value is provided by and stored in the global catalog. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation response. :param str updated_from: (optional) Start date inclusive filter. :param str updated_to: (optional) End date inclusive filter. :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 `ResourceKeysList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_keys' ) headers.update(sdk_headers) params = { 'guid': guid, 'name': name, 'resource_group_id': resource_group_id, 'resource_id': resource_id, 'limit': limit, 'start': start, 'updated_from': updated_from, 'updated_to': updated_to, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v2/resource_keys' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, *, guid: Optional[str] = None, name: Optional[str] = None, resource_group_id: Optional[str] = None, resource_id: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, updated_from: Optional[str] = None, updated_to: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,942
ibm_platform_services.resource_controller_v2
list_resource_keys_for_instance
Get a list of all the resource keys for the instance. You may have many resource keys for one resource instance. For example, you may have a different resource key for each user or each role. :param str id: The resource instance URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceKeysList` object
def list_resource_keys_for_instance( self, id: str, *, limit: int = None, start: str = None, **kwargs ) -> DetailedResponse: """ Get a list of all the resource keys for the instance. You may have many resource keys for one resource instance. For example, you may have a different resource key for each user or each role. :param str id: The resource instance URL-encoded CRN or GUID. :param int limit: (optional) Limit on how many items should be returned. :param str start: (optional) An optional token that indicates the beginning of the page of results to be returned. Any additional query parameters are ignored if a page token is present. If omitted, the first page of results is returned. This value is obtained from the 'start' query parameter in the 'next_url' field of the operation 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 `ResourceKeysList` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_keys_for_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' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/resource_keys'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, id: str, *, limit: Optional[int] = None, start: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,943
ibm_platform_services.resource_controller_v2
lock_resource_instance
Lock a resource instance. Locks a resource instance. A locked instance can not be updated or deleted. It does not affect actions performed on child resources like aliases, bindings, or keys. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object
def lock_resource_instance(self, id: str, **kwargs) -> DetailedResponse: """ Lock a resource instance. Locks a resource instance. A locked instance can not be updated or deleted. It does not affect actions performed on child resources like aliases, bindings, or keys. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='lock_resource_instance' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/lock'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,945
ibm_platform_services.resource_controller_v2
run_reclamation_action
Perform a reclamation action. Reclaim a resource instance so that it can no longer be used, or restore the resource instance so that it's usable again. :param str id: The ID associated with the reclamation. :param str action_name: The reclamation action name. Specify `reclaim` to delete a resource, or `restore` to restore a resource. :param str request_by: (optional) The request initiator, if different from the request token. :param str comment: (optional) A comment to describe the action. :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 `Reclamation` object
def run_reclamation_action( self, id: str, action_name: str, *, request_by: str = None, comment: str = None, **kwargs ) -> DetailedResponse: """ Perform a reclamation action. Reclaim a resource instance so that it can no longer be used, or restore the resource instance so that it's usable again. :param str id: The ID associated with the reclamation. :param str action_name: The reclamation action name. Specify `reclaim` to delete a resource, or `restore` to restore a resource. :param str request_by: (optional) The request initiator, if different from the request token. :param str comment: (optional) A comment to describe the action. :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 `Reclamation` object """ if not id: raise ValueError('id must be provided') if not action_name: raise ValueError('action_name must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='run_reclamation_action' ) headers.update(sdk_headers) data = {'request_by': request_by, 'comment': comment} 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 = ['id', 'action_name'] path_param_values = self.encode_path_vars(id, action_name) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v1/reclamations/{id}/actions/{action_name}'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, id: str, action_name: str, *, request_by: Optional[str] = None, comment: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,953
ibm_platform_services.resource_controller_v2
unlock_resource_instance
Unlock a resource instance. Unlock a resource instance to update or delete it. Unlocking a resource instance does not affect child resources like aliases, bindings or keys. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object
def unlock_resource_instance(self, id: str, **kwargs) -> DetailedResponse: """ Unlock a resource instance. Unlock a resource instance to update or delete it. Unlocking a resource instance does not affect child resources like aliases, bindings or keys. :param str id: The resource instance URL-encoded CRN or GUID. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='unlock_resource_instance' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}/lock'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,954
ibm_platform_services.resource_controller_v2
update_resource_alias
Update a resource alias. Use the resource alias URL-encoded CRN or GUID to update the resource alias. :param str id: The resource alias URL-encoded CRN or GUID. :param str name: The new name of the alias. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceAlias` object
def update_resource_alias(self, id: str, name: str, **kwargs) -> DetailedResponse: """ Update a resource alias. Use the resource alias URL-encoded CRN or GUID to update the resource alias. :param str id: The resource alias URL-encoded CRN or GUID. :param str name: The new name of the alias. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceAlias` object """ if not id: raise ValueError('id must be provided') if name is None: raise ValueError('name must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_alias' ) headers.update(sdk_headers) data = {'name': name} 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_aliases/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, id: str, name: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,955
ibm_platform_services.resource_controller_v2
update_resource_binding
Update a resource binding. Use the resource binding URL-encoded CRN or GUID to update the resource binding. :param str id: The resource binding URL-encoded CRN or GUID. :param str name: The new name of the binding. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceBinding` object
def update_resource_binding(self, id: str, name: str, **kwargs) -> DetailedResponse: """ Update a resource binding. Use the resource binding URL-encoded CRN or GUID to update the resource binding. :param str id: The resource binding URL-encoded CRN or GUID. :param str name: The new name of the binding. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceBinding` object """ if not id: raise ValueError('id must be provided') if name is None: raise ValueError('name must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_binding' ) headers.update(sdk_headers) data = {'name': name} 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_bindings/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, id: str, name: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,956
ibm_platform_services.resource_controller_v2
update_resource_instance
Update a resource instance. Use the resource instance URL-encoded CRN or GUID to make updates to the resource instance, like changing the name or plan. :param str id: The resource instance URL-encoded CRN or GUID. :param str name: (optional) The new name of the instance. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param dict parameters: (optional) The new configuration options for the instance. :param str resource_plan_id: (optional) The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param bool allow_cleanup: (optional) A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call. :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 `ResourceInstance` object
def update_resource_instance( self, id: str, *, name: str = None, parameters: dict = None, resource_plan_id: str = None, allow_cleanup: bool = None, **kwargs, ) -> DetailedResponse: """ Update a resource instance. Use the resource instance URL-encoded CRN or GUID to make updates to the resource instance, like changing the name or plan. :param str id: The resource instance URL-encoded CRN or GUID. :param str name: (optional) The new name of the instance. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :param dict parameters: (optional) The new configuration options for the instance. :param str resource_plan_id: (optional) The unique ID of the plan associated with the offering. This value is provided by and stored in the global catalog. :param bool allow_cleanup: (optional) A boolean that dictates if the resource instance should be deleted (cleaned up) during the processing of a region instance delete call. :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 `ResourceInstance` object """ if not id: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_instance' ) headers.update(sdk_headers) data = { 'name': name, 'parameters': parameters, 'resource_plan_id': resource_plan_id, 'allow_cleanup': allow_cleanup, } 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_instances/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, id: str, *, name: Optional[str] = None, parameters: Optional[dict] = None, resource_plan_id: Optional[str] = None, allow_cleanup: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,957
ibm_platform_services.resource_controller_v2
update_resource_key
Update a resource key. Use the resource key URL-encoded CRN or GUID to update the resource key. :param str id: The resource key URL-encoded CRN or GUID. :param str name: The new name of the key. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceKey` object
def update_resource_key(self, id: str, name: str, **kwargs) -> DetailedResponse: """ Update a resource key. Use the resource key URL-encoded CRN or GUID to update the resource key. :param str id: The resource key URL-encoded CRN or GUID. :param str name: The new name of the key. Must be 180 characters or less and cannot include any special characters other than `(space) - . _ :`. :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 `ResourceKey` object """ if not id: raise ValueError('id must be provided') if name is None: raise ValueError('name must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_key' ) headers.update(sdk_headers) data = {'name': name} 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 = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_keys/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, id: str, name: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,958
ibm_platform_services.resource_manager_v2
ResourceManagerV2
The Resource Manager V2 service.
class ResourceManagerV2(BaseService): """The Resource Manager V2 service.""" DEFAULT_SERVICE_URL = 'https://resource-controller.cloud.ibm.com' DEFAULT_SERVICE_NAME = 'resource_manager' @classmethod def new_instance( cls, service_name: str = DEFAULT_SERVICE_NAME, ) -> 'ResourceManagerV2': """ Return a new client for the Resource Manager service using the specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) service = cls(authenticator) service.configure_service(service_name) return service def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Resource Manager service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### # Resource Group ######################### def list_resource_groups( self, *, account_id: str = None, date: str = None, name: str = None, default: bool = None, include_deleted: bool = None, **kwargs ) -> DetailedResponse: """ Get a list of all resource groups. Call this method to retrieve information about all resource groups and associated quotas in an account. The `id` returned in the response can be used to [create a resource instance later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance). The response can be filtered based on queryParams such as `account_id`, `name`, `default`, and more to narrow your search.Users need to be assigned IAM policies with the Viewer role or higher on the targeted resource groups. :param str account_id: (optional) The ID of the account that contains the resource groups that you want to get. :param str date: (optional) The date in the format of YYYY-MM which returns resource groups. Deleted resource groups will be excluded before this month. :param str name: (optional) The name of the resource group. :param bool default: (optional) Boolean value to specify whether or not to list default resource groups. :param bool include_deleted: (optional) Boolean value to specify whether or not to list default resource groups. :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 `ResourceGroupList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_groups' ) headers.update(sdk_headers) params = { 'account_id': account_id, 'date': date, 'name': name, 'default': default, 'include_deleted': include_deleted, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' url = '/v2/resource_groups' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response def create_resource_group(self, *, name: str = None, account_id: str = None, **kwargs) -> DetailedResponse: """ Create a resource group. Create a resource group in an account to organize your account resources in customizable groupings so that you can quickly assign users access to more than one resource at a time. To learn what makes a good resource group strategy, see [Best practices for organizing resources](https://cloud.ibm.com/docs/account?topic=account-account_setup). A default resource group is created when an account is created. If you have a Lite account or 30-day trial, you cannot create extra resource groups, but you can rename your default resource group. If you have a Pay-As-You-Go or Subscription account, you can create multiple resource groups. You must be assigned an IAM policy with the Administrator role on All Account Management services to create extra resource groups. :param str name: (optional) The new name of the resource group. :param str account_id: (optional) The account id of the resource group. :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 `ResCreateResourceGroup` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_group' ) headers.update(sdk_headers) data = {'name': name, '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')) headers['Accept'] = 'application/json' url = '/v2/resource_groups' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response def get_resource_group(self, id: str, **kwargs) -> DetailedResponse: """ Get a resource group. Retrieve a resource group by alias ID. Call this method to get details about a particular resource group, like the name of the resource group, associated quotas, whether the state is active, the resource group ID and the CRN. The `id` returned in the response can be used to [create a resource instance later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance). Users need to be assigned an IAM policy with the Viewer role or higher on the targeted resource group. :param str id: The short or long ID of the alias. :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 `ResourceGroup` object """ if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_group' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_groups/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response def update_resource_group(self, id: str, *, name: str = None, state: str = None, **kwargs) -> DetailedResponse: """ Update a resource group. Update a resource group by the alias ID. Call this method to update information about an existing resource group. You can rename a resource group and activate or suspend a particular resource group. To update a resource group, users need to be assigned with IAM policies with the Editor role or higher. :param str id: The short or long ID of the alias. :param str name: (optional) The new name of the resource group. :param str state: (optional) The state of the resource group. :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 `ResourceGroup` object """ if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_group' ) headers.update(sdk_headers) data = {'name': name, 'state': state} 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')) headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_groups/{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_resource_group(self, id: str, **kwargs) -> DetailedResponse: """ Delete a resource group. Delete a resource group by the alias ID. You can delete a resource group only if the targeted resource group does not contain any resources or if it is not a default resource group. When a user creates an account, a default resource group is created in the account. If you want to delete a resource group that contains resources, first [delete the resource instances](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#delete-resource-instance). Then, delete the resource group when all resource instances in the group are deleted. Users need to be assigned an IAM policy with the Editor role or higher on the targeted resource group. :param str id: The short or long ID of the alias. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_group' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_groups/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response ######################### # Quota Definition ######################### def list_quota_definitions(self, **kwargs) -> DetailedResponse: """ List quota definitions. Get a list of all quota definitions. Quotas for a resource group limit the number of apps, instances, and memory allowed for that specific resource group. Each resource group that you have on your account has a specific set of quotas. Standard quotas are for resource groups that are created by users with a Lite account, and Pay-As-You-Go quotas are for resource groups that are created with a Pay-As-You-Go account. This method provides list of all available quota definitions. No specific IAM policy needed. :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 `QuotaDefinitionList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_quota_definitions' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' url = '/v2/quota_definitions' request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response def get_quota_definition(self, id: str, **kwargs) -> DetailedResponse: """ Get a quota definition. Call this method to retrieve information about a particular quota by passing the quota ID. The response can be used to identify the quota type, Standard or Paid. Information about available resources, such as number of apps, number of service instances, and memory, are returned in the response. Quotas for a resource group limit the number of apps, instances, and memory allowed for that specific resource group. Each resource group that you have on your account has a specific set of quotas. Standard quotas are for resource groups that are created by users with a Lite account, and Pay-As-You-Go quotas are for resource groups that are created with a Pay-As-You-Go account. No specific IAM policy needed. :param str id: The id of the quota. :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 `QuotaDefinition` object """ if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_quota_definition' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/quota_definitions/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
719,959
ibm_platform_services.resource_manager_v2
__init__
Construct a new client for the Resource Manager service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice.
def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Resource Manager service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
(self, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None) -> NoneType
719,965
ibm_platform_services.resource_manager_v2
create_resource_group
Create a resource group. Create a resource group in an account to organize your account resources in customizable groupings so that you can quickly assign users access to more than one resource at a time. To learn what makes a good resource group strategy, see [Best practices for organizing resources](https://cloud.ibm.com/docs/account?topic=account-account_setup). A default resource group is created when an account is created. If you have a Lite account or 30-day trial, you cannot create extra resource groups, but you can rename your default resource group. If you have a Pay-As-You-Go or Subscription account, you can create multiple resource groups. You must be assigned an IAM policy with the Administrator role on All Account Management services to create extra resource groups. :param str name: (optional) The new name of the resource group. :param str account_id: (optional) The account id of the resource group. :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 `ResCreateResourceGroup` object
def create_resource_group(self, *, name: str = None, account_id: str = None, **kwargs) -> DetailedResponse: """ Create a resource group. Create a resource group in an account to organize your account resources in customizable groupings so that you can quickly assign users access to more than one resource at a time. To learn what makes a good resource group strategy, see [Best practices for organizing resources](https://cloud.ibm.com/docs/account?topic=account-account_setup). A default resource group is created when an account is created. If you have a Lite account or 30-day trial, you cannot create extra resource groups, but you can rename your default resource group. If you have a Pay-As-You-Go or Subscription account, you can create multiple resource groups. You must be assigned an IAM policy with the Administrator role on All Account Management services to create extra resource groups. :param str name: (optional) The new name of the resource group. :param str account_id: (optional) The account id of the resource group. :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 `ResCreateResourceGroup` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='create_resource_group' ) headers.update(sdk_headers) data = {'name': name, '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')) headers['Accept'] = 'application/json' url = '/v2/resource_groups' request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, *, name: Optional[str] = None, account_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,966
ibm_platform_services.resource_manager_v2
delete_resource_group
Delete a resource group. Delete a resource group by the alias ID. You can delete a resource group only if the targeted resource group does not contain any resources or if it is not a default resource group. When a user creates an account, a default resource group is created in the account. If you want to delete a resource group that contains resources, first [delete the resource instances](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#delete-resource-instance). Then, delete the resource group when all resource instances in the group are deleted. Users need to be assigned an IAM policy with the Editor role or higher on the targeted resource group. :param str id: The short or long ID of the alias. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_resource_group(self, id: str, **kwargs) -> DetailedResponse: """ Delete a resource group. Delete a resource group by the alias ID. You can delete a resource group only if the targeted resource group does not contain any resources or if it is not a default resource group. When a user creates an account, a default resource group is created in the account. If you want to delete a resource group that contains resources, first [delete the resource instances](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#delete-resource-instance). Then, delete the resource group when all resource instances in the group are deleted. Users need to be assigned an IAM policy with the Editor role or higher on the targeted resource group. :param str id: The short or long ID of the alias. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='delete_resource_group' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_groups/{id}'.format(**path_param_dict) request = self.prepare_request(method='DELETE', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,973
ibm_platform_services.resource_manager_v2
get_quota_definition
Get a quota definition. Call this method to retrieve information about a particular quota by passing the quota ID. The response can be used to identify the quota type, Standard or Paid. Information about available resources, such as number of apps, number of service instances, and memory, are returned in the response. Quotas for a resource group limit the number of apps, instances, and memory allowed for that specific resource group. Each resource group that you have on your account has a specific set of quotas. Standard quotas are for resource groups that are created by users with a Lite account, and Pay-As-You-Go quotas are for resource groups that are created with a Pay-As-You-Go account. No specific IAM policy needed. :param str id: The id of the quota. :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 `QuotaDefinition` object
def get_quota_definition(self, id: str, **kwargs) -> DetailedResponse: """ Get a quota definition. Call this method to retrieve information about a particular quota by passing the quota ID. The response can be used to identify the quota type, Standard or Paid. Information about available resources, such as number of apps, number of service instances, and memory, are returned in the response. Quotas for a resource group limit the number of apps, instances, and memory allowed for that specific resource group. Each resource group that you have on your account has a specific set of quotas. Standard quotas are for resource groups that are created by users with a Lite account, and Pay-As-You-Go quotas are for resource groups that are created with a Pay-As-You-Go account. No specific IAM policy needed. :param str id: The id of the quota. :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 `QuotaDefinition` object """ if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_quota_definition' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/quota_definitions/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,974
ibm_platform_services.resource_manager_v2
get_resource_group
Get a resource group. Retrieve a resource group by alias ID. Call this method to get details about a particular resource group, like the name of the resource group, associated quotas, whether the state is active, the resource group ID and the CRN. The `id` returned in the response can be used to [create a resource instance later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance). Users need to be assigned an IAM policy with the Viewer role or higher on the targeted resource group. :param str id: The short or long ID of the alias. :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 `ResourceGroup` object
def get_resource_group(self, id: str, **kwargs) -> DetailedResponse: """ Get a resource group. Retrieve a resource group by alias ID. Call this method to get details about a particular resource group, like the name of the resource group, associated quotas, whether the state is active, the resource group ID and the CRN. The `id` returned in the response can be used to [create a resource instance later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance). Users need to be assigned an IAM policy with the Viewer role or higher on the targeted resource group. :param str id: The short or long ID of the alias. :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 `ResourceGroup` object """ if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='get_resource_group' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_groups/{id}'.format(**path_param_dict) request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,975
ibm_platform_services.resource_manager_v2
list_quota_definitions
List quota definitions. Get a list of all quota definitions. Quotas for a resource group limit the number of apps, instances, and memory allowed for that specific resource group. Each resource group that you have on your account has a specific set of quotas. Standard quotas are for resource groups that are created by users with a Lite account, and Pay-As-You-Go quotas are for resource groups that are created with a Pay-As-You-Go account. This method provides list of all available quota definitions. No specific IAM policy needed. :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 `QuotaDefinitionList` object
def list_quota_definitions(self, **kwargs) -> DetailedResponse: """ List quota definitions. Get a list of all quota definitions. Quotas for a resource group limit the number of apps, instances, and memory allowed for that specific resource group. Each resource group that you have on your account has a specific set of quotas. Standard quotas are for resource groups that are created by users with a Lite account, and Pay-As-You-Go quotas are for resource groups that are created with a Pay-As-You-Go account. This method provides list of all available quota definitions. No specific IAM policy needed. :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 `QuotaDefinitionList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_quota_definitions' ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' url = '/v2/quota_definitions' request = self.prepare_request(method='GET', url=url, headers=headers) response = self.send(request, **kwargs) return response
(self, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,976
ibm_platform_services.resource_manager_v2
list_resource_groups
Get a list of all resource groups. Call this method to retrieve information about all resource groups and associated quotas in an account. The `id` returned in the response can be used to [create a resource instance later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance). The response can be filtered based on queryParams such as `account_id`, `name`, `default`, and more to narrow your search.Users need to be assigned IAM policies with the Viewer role or higher on the targeted resource groups. :param str account_id: (optional) The ID of the account that contains the resource groups that you want to get. :param str date: (optional) The date in the format of YYYY-MM which returns resource groups. Deleted resource groups will be excluded before this month. :param str name: (optional) The name of the resource group. :param bool default: (optional) Boolean value to specify whether or not to list default resource groups. :param bool include_deleted: (optional) Boolean value to specify whether or not to list default resource groups. :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 `ResourceGroupList` object
def list_resource_groups( self, *, account_id: str = None, date: str = None, name: str = None, default: bool = None, include_deleted: bool = None, **kwargs ) -> DetailedResponse: """ Get a list of all resource groups. Call this method to retrieve information about all resource groups and associated quotas in an account. The `id` returned in the response can be used to [create a resource instance later](https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=java#create-resource-instance). The response can be filtered based on queryParams such as `account_id`, `name`, `default`, and more to narrow your search.Users need to be assigned IAM policies with the Viewer role or higher on the targeted resource groups. :param str account_id: (optional) The ID of the account that contains the resource groups that you want to get. :param str date: (optional) The date in the format of YYYY-MM which returns resource groups. Deleted resource groups will be excluded before this month. :param str name: (optional) The name of the resource group. :param bool default: (optional) Boolean value to specify whether or not to list default resource groups. :param bool include_deleted: (optional) Boolean value to specify whether or not to list default resource groups. :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 `ResourceGroupList` object """ headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='list_resource_groups' ) headers.update(sdk_headers) params = { 'account_id': account_id, 'date': date, 'name': name, 'default': default, 'include_deleted': include_deleted, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' url = '/v2/resource_groups' request = self.prepare_request(method='GET', url=url, headers=headers, params=params) response = self.send(request, **kwargs) return response
(self, *, account_id: Optional[str] = None, date: Optional[str] = None, name: Optional[str] = None, default: Optional[bool] = None, include_deleted: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,985
ibm_platform_services.resource_manager_v2
update_resource_group
Update a resource group. Update a resource group by the alias ID. Call this method to update information about an existing resource group. You can rename a resource group and activate or suspend a particular resource group. To update a resource group, users need to be assigned with IAM policies with the Editor role or higher. :param str id: The short or long ID of the alias. :param str name: (optional) The new name of the resource group. :param str state: (optional) The state of the resource group. :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 `ResourceGroup` object
def update_resource_group(self, id: str, *, name: str = None, state: str = None, **kwargs) -> DetailedResponse: """ Update a resource group. Update a resource group by the alias ID. Call this method to update information about an existing resource group. You can rename a resource group and activate or suspend a particular resource group. To update a resource group, users need to be assigned with IAM policies with the Editor role or higher. :param str id: The short or long ID of the alias. :param str name: (optional) The new name of the resource group. :param str state: (optional) The state of the resource group. :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 `ResourceGroup` object """ if id is None: raise ValueError('id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V2', operation_id='update_resource_group' ) headers.update(sdk_headers) data = {'name': name, 'state': state} 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')) headers['Accept'] = 'application/json' path_param_keys = ['id'] path_param_values = self.encode_path_vars(id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v2/resource_groups/{id}'.format(**path_param_dict) request = self.prepare_request(method='PATCH', url=url, headers=headers, data=data) response = self.send(request, **kwargs) return response
(self, id: str, *, name: Optional[str] = None, state: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
719,986
ibm_platform_services.usage_metering_v4
UsageMeteringV4
The usage_metering V4 service.
class UsageMeteringV4(BaseService): """The usage_metering V4 service.""" DEFAULT_SERVICE_URL = 'https://billing.cloud.ibm.com' DEFAULT_SERVICE_NAME = 'usage_metering' @classmethod def new_instance( cls, service_name: str = DEFAULT_SERVICE_NAME, ) -> 'UsageMeteringV4': """ Return a new client for the usage_metering service using the specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) service = cls(authenticator) service.configure_service(service_name) return service def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the usage_metering service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### # Resource Usage ######################### def report_resource_usage( self, resource_id: str, resource_usage: List['ResourceInstanceUsage'], **kwargs ) -> DetailedResponse: """ Report Resource Controller resource usage. Report usage for resource instances that were provisioned through the resource controller. :param str resource_id: The resource for which the usage is submitted. :param List[ResourceInstanceUsage] resource_usage: :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 `ResponseAccepted` object """ if resource_id is None: raise ValueError('resource_id must be provided') if resource_usage is None: raise ValueError('resource_usage must be provided') resource_usage = [convert_model(x) for x in resource_usage] headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='report_resource_usage' ) headers.update(sdk_headers) data = json.dumps(resource_usage) headers['content-type'] = 'application/json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['resource_id'] path_param_values = self.encode_path_vars(resource_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/metering/resources/{resource_id}/usage'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request) return response
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
719,987
ibm_platform_services.usage_metering_v4
__init__
Construct a new client for the usage_metering service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice.
def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the usage_metering service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/master/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
(self, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None) -> NoneType
720,000
ibm_platform_services.usage_metering_v4
report_resource_usage
Report Resource Controller resource usage. Report usage for resource instances that were provisioned through the resource controller. :param str resource_id: The resource for which the usage is submitted. :param List[ResourceInstanceUsage] resource_usage: :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 `ResponseAccepted` object
def report_resource_usage( self, resource_id: str, resource_usage: List['ResourceInstanceUsage'], **kwargs ) -> DetailedResponse: """ Report Resource Controller resource usage. Report usage for resource instances that were provisioned through the resource controller. :param str resource_id: The resource for which the usage is submitted. :param List[ResourceInstanceUsage] resource_usage: :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 `ResponseAccepted` object """ if resource_id is None: raise ValueError('resource_id must be provided') if resource_usage is None: raise ValueError('resource_usage must be provided') resource_usage = [convert_model(x) for x in resource_usage] headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='report_resource_usage' ) headers.update(sdk_headers) data = json.dumps(resource_usage) headers['content-type'] = 'application/json' if 'headers' in kwargs: headers.update(kwargs.get('headers')) headers['Accept'] = 'application/json' path_param_keys = ['resource_id'] path_param_values = self.encode_path_vars(resource_id) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/metering/resources/{resource_id}/usage'.format(**path_param_dict) request = self.prepare_request(method='POST', url=url, headers=headers, data=data) response = self.send(request) return response
(self, resource_id: str, resource_usage: List[ibm_platform_services.usage_metering_v4.ResourceInstanceUsage], **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,008
ibm_platform_services.usage_reports_v4
UsageReportsV4
The Usage Reports V4 service.
class UsageReportsV4(BaseService): """The Usage Reports V4 service.""" DEFAULT_SERVICE_URL = 'https://billing.cloud.ibm.com' DEFAULT_SERVICE_NAME = 'usage_reports' @classmethod def new_instance( cls, service_name: str = DEFAULT_SERVICE_NAME, ) -> 'UsageReportsV4': """ Return a new client for the Usage Reports service using the specified parameters and external configuration. """ authenticator = get_authenticator_from_environment(service_name) service = cls(authenticator) service.configure_service(service_name) return service def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Usage Reports service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator) ######################### # Account operations ######################### def get_account_summary( self, account_id: str, billingmonth: str, **kwargs, ) -> DetailedResponse: """ Get account summary. Returns the summary for the account for a given month. Account billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :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 `AccountSummary` object """ if not account_id: raise ValueError('account_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_account_summary', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/summary/{billingmonth}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, ) response = self.send(request, **kwargs) return response def get_account_usage( self, account_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get account usage. Usage for all the resources and plans in an account for a given month. Account billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `AccountUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_account_usage', ) headers.update(sdk_headers) params = { '_names': names, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/usage/{billingmonth}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response ######################### # Resource operations ######################### def get_resource_group_usage( self, account_id: str, resource_group_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get resource group usage. Usage for all the resources and plans in a resource group in a given month. Account billing managers or resource group billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str resource_group_id: Resource group for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `ResourceGroupUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not resource_group_id: raise ValueError('resource_group_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_resource_group_usage', ) headers.update(sdk_headers) params = { '_names': names, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'resource_group_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, resource_group_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/resource_groups/{resource_group_id}/usage/{billingmonth}'.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_resource_usage_account( self, account_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_group_id: Optional[str] = None, organization_id: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get resource instance usage in an account. Query for resource instance usage in an account. Filter the results with query parameters. Account billing administrator is authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_group_id: (optional) Filter by resource group. :param str organization_id: (optional) Filter by organization_id. :param str resource_instance_id: (optional) Filter by resource instance_id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_resource_usage_account', ) headers.update(sdk_headers) params = { '_names': names, '_tags': tags, '_limit': limit, '_start': start, 'resource_group_id': resource_group_id, 'organization_id': organization_id, 'resource_instance_id': resource_instance_id, 'resource_id': resource_id, 'plan_id': plan_id, 'region': region, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/resource_instances/usage/{billingmonth}'.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_resource_usage_resource_group( self, account_id: str, resource_group_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get resource instance usage in a resource group. Query for resource instance usage in a resource group. Filter the results with query parameters. Account billing administrator and resource group billing administrators are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str resource_group_id: Resource group for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_instance_id: (optional) Filter by resource instance id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not resource_group_id: raise ValueError('resource_group_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_resource_usage_resource_group', ) headers.update(sdk_headers) params = { '_names': names, '_tags': tags, '_limit': limit, '_start': start, 'resource_instance_id': resource_instance_id, 'resource_id': resource_id, 'plan_id': plan_id, 'region': region, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'resource_group_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, resource_group_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/resource_groups/{resource_group_id}/resource_instances/usage/{billingmonth}'.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_resource_usage_org( self, account_id: str, organization_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get resource instance usage in an organization. Query for resource instance usage in an organization. Filter the results with query parameters. Account billing administrator and organization billing administrators are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str organization_id: ID of the organization. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_instance_id: (optional) Filter by resource instance id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not organization_id: raise ValueError('organization_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_resource_usage_org', ) headers.update(sdk_headers) params = { '_names': names, '_tags': tags, '_limit': limit, '_start': start, 'resource_instance_id': resource_instance_id, 'resource_id': resource_id, 'plan_id': plan_id, 'region': region, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'organization_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, organization_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = ( '/v4/accounts/{account_id}/organizations/{organization_id}/resource_instances/usage/{billingmonth}'.format( **path_param_dict ) ) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response ######################### # Organization operations ######################### def get_org_usage( self, account_id: str, organization_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get organization usage. Usage for all the resources and plans in an organization in a given month. Account billing managers or organization billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str organization_id: ID of the organization. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `OrgUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not organization_id: raise ValueError('organization_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_org_usage', ) headers.update(sdk_headers) params = { '_names': names, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'organization_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, organization_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/organizations/{organization_id}/usage/{billingmonth}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response ######################### # Billing reports snapshot ######################### def create_reports_snapshot_config( self, account_id: str, interval: str, cos_bucket: str, cos_location: str, *, cos_reports_folder: Optional[str] = None, report_types: Optional[List[str]] = None, versioning: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Setup the snapshot configuration. Snapshots of the billing reports would be taken on a periodic interval and stored based on the configuration setup by the customer for the given Account Id. :param str account_id: Account ID for which billing report snapshot is configured. :param str interval: Frequency of taking the snapshot of the billing reports. :param str cos_bucket: The name of the COS bucket to store the snapshot of the billing reports. :param str cos_location: Region of the COS instance. :param str cos_reports_folder: (optional) The billing reports root folder to store the billing reports snapshots. Defaults to "IBMCloud-Billing-Reports". :param List[str] report_types: (optional) The type of billing reports to take snapshot of. Possible values are [account_summary, enterprise_summary, account_resource_instance_usage]. :param str versioning: (optional) A new version of report is created or the existing report version is overwritten with every update. Defaults to "new". :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 `SnapshotConfig` object """ if account_id is None: raise ValueError('account_id must be provided') if interval is None: raise ValueError('interval must be provided') if cos_bucket is None: raise ValueError('cos_bucket must be provided') if cos_location is None: raise ValueError('cos_location must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='create_reports_snapshot_config', ) headers.update(sdk_headers) data = { 'account_id': account_id, 'interval': interval, 'cos_bucket': cos_bucket, 'cos_location': cos_location, 'cos_reports_folder': cos_reports_folder, 'report_types': report_types, 'versioning': versioning, } 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 = '/v1/billing-reports-snapshot-config' request = self.prepare_request( method='POST', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response def get_reports_snapshot_config( self, account_id: str, **kwargs, ) -> DetailedResponse: """ Fetch the snapshot configuration. Returns the configuration of snapshot of the billing reports setup by the customer for the given Account Id. :param str account_id: Account ID for which the billing report snapshot is configured. :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 `SnapshotConfig` object """ if not account_id: raise ValueError('account_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_reports_snapshot_config', ) 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 = '/v1/billing-reports-snapshot-config' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response def update_reports_snapshot_config( self, account_id: str, *, interval: Optional[str] = None, cos_bucket: Optional[str] = None, cos_location: Optional[str] = None, cos_reports_folder: Optional[str] = None, report_types: Optional[List[str]] = None, versioning: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Update the snapshot configuration. Updates the configuration of snapshot of the billing reports setup by the customer for the given Account Id. :param str account_id: Account ID for which billing report snapshot is configured. :param str interval: (optional) Frequency of taking the snapshot of the billing reports. :param str cos_bucket: (optional) The name of the COS bucket to store the snapshot of the billing reports. :param str cos_location: (optional) Region of the COS instance. :param str cos_reports_folder: (optional) The billing reports root folder to store the billing reports snapshots. :param List[str] report_types: (optional) The type of billing reports to take snapshot of. Possible values are [account_summary, enterprise_summary, account_resource_instance_usage]. :param str versioning: (optional) A new version of report is created or the existing report version is overwritten with every update. :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 `SnapshotConfig` object """ if account_id is None: raise ValueError('account_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='update_reports_snapshot_config', ) headers.update(sdk_headers) data = { 'account_id': account_id, 'interval': interval, 'cos_bucket': cos_bucket, 'cos_location': cos_location, 'cos_reports_folder': cos_reports_folder, 'report_types': report_types, 'versioning': versioning, } 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 = '/v1/billing-reports-snapshot-config' request = self.prepare_request( method='PATCH', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response def delete_reports_snapshot_config( self, account_id: str, **kwargs, ) -> DetailedResponse: """ Delete the snapshot configuration. Delete the configuration of snapshot of the billing reports setup by the customer for the given Account Id. :param str account_id: Account ID for which the billing report snapshot is configured. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not account_id: raise ValueError('account_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='delete_reports_snapshot_config', ) headers.update(sdk_headers) params = { 'account_id': account_id, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] url = '/v1/billing-reports-snapshot-config' request = self.prepare_request( method='DELETE', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response def validate_reports_snapshot_config( self, account_id: str, *, interval: str = None, cos_bucket: str = None, cos_location: str = None, cos_reports_folder: str = None, report_types: List[str] = None, versioning: str = None, **kwargs, ) -> DetailedResponse: """ Verify billing to COS authorization. Verify billing service to COS bucket authorization for the given account_id. If COS bucket information is not provided, COS bucket information is retrieved from the configuration file. :param str account_id: Account ID for which billing report snapshot is configured. :param str interval: (optional) Frequency of taking the snapshot of the billing reports. :param str cos_bucket: (optional) The name of the COS bucket to store the snapshot of the billing reports. :param str cos_location: (optional) Region of the COS instance. :param str cos_reports_folder: (optional) The billing reports root folder to store the billing reports snapshots. Defaults to "IBMCloud-Billing-Reports". :param List[str] report_types: (optional) The type of billing reports to take snapshot of. Possible values are [account_summary, enterprise_summary, account_resource_instance_usage]. :param str versioning: (optional) A new version of report is created or the existing report version is overwritten with every update. Defaults to "new". :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 `SnapshotConfigValidateResponse` object """ if account_id is None: raise ValueError('account_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='validate_reports_snapshot_config', ) headers.update(sdk_headers) data = { 'account_id': account_id, 'interval': interval, 'cos_bucket': cos_bucket, 'cos_location': cos_location, 'cos_reports_folder': cos_reports_folder, 'report_types': report_types, 'versioning': versioning, } 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 = '/v1/billing-reports-snapshot-config/validate' request = self.prepare_request( method='POST', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response def get_reports_snapshot( self, account_id: str, month: str, *, date_from: int = None, date_to: int = None, limit: int = None, start: str = None, **kwargs, ) -> DetailedResponse: """ Fetch the current or past snapshots. Returns the billing reports snapshots captured for the given Account Id in the specific time period. :param str account_id: Account ID for which the billing report snapshot is requested. :param str month: The month for which billing report snapshot is requested. Format is yyyy-mm. :param int date_from: (optional) Timestamp in milliseconds for which billing report snapshot is requested. :param int date_to: (optional) Timestamp in milliseconds for which billing report snapshot is requested. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the 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 `SnapshotList` object """ if not account_id: raise ValueError('account_id must be provided') if not month: raise ValueError('month must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_reports_snapshot', ) headers.update(sdk_headers) params = { 'account_id': account_id, 'month': month, 'date_from': date_from, 'date_to': date_to, '_limit': limit, '_start': start, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/billing-reports-snapshots' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
720,009
ibm_platform_services.usage_reports_v4
__init__
Construct a new client for the Usage Reports service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice.
def __init__( self, authenticator: Authenticator = None, ) -> None: """ Construct a new client for the Usage Reports service. :param Authenticator authenticator: The authenticator specifies the authentication mechanism. Get up to date information from https://github.com/IBM/python-sdk-core/blob/main/README.md about initializing the authenticator of your choice. """ BaseService.__init__(self, service_url=self.DEFAULT_SERVICE_URL, authenticator=authenticator)
(self, authenticator: Optional[ibm_cloud_sdk_core.authenticators.authenticator.Authenticator] = None) -> NoneType
720,015
ibm_platform_services.usage_reports_v4
create_reports_snapshot_config
Setup the snapshot configuration. Snapshots of the billing reports would be taken on a periodic interval and stored based on the configuration setup by the customer for the given Account Id. :param str account_id: Account ID for which billing report snapshot is configured. :param str interval: Frequency of taking the snapshot of the billing reports. :param str cos_bucket: The name of the COS bucket to store the snapshot of the billing reports. :param str cos_location: Region of the COS instance. :param str cos_reports_folder: (optional) The billing reports root folder to store the billing reports snapshots. Defaults to "IBMCloud-Billing-Reports". :param List[str] report_types: (optional) The type of billing reports to take snapshot of. Possible values are [account_summary, enterprise_summary, account_resource_instance_usage]. :param str versioning: (optional) A new version of report is created or the existing report version is overwritten with every update. Defaults to "new". :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 `SnapshotConfig` object
def create_reports_snapshot_config( self, account_id: str, interval: str, cos_bucket: str, cos_location: str, *, cos_reports_folder: Optional[str] = None, report_types: Optional[List[str]] = None, versioning: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Setup the snapshot configuration. Snapshots of the billing reports would be taken on a periodic interval and stored based on the configuration setup by the customer for the given Account Id. :param str account_id: Account ID for which billing report snapshot is configured. :param str interval: Frequency of taking the snapshot of the billing reports. :param str cos_bucket: The name of the COS bucket to store the snapshot of the billing reports. :param str cos_location: Region of the COS instance. :param str cos_reports_folder: (optional) The billing reports root folder to store the billing reports snapshots. Defaults to "IBMCloud-Billing-Reports". :param List[str] report_types: (optional) The type of billing reports to take snapshot of. Possible values are [account_summary, enterprise_summary, account_resource_instance_usage]. :param str versioning: (optional) A new version of report is created or the existing report version is overwritten with every update. Defaults to "new". :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 `SnapshotConfig` object """ if account_id is None: raise ValueError('account_id must be provided') if interval is None: raise ValueError('interval must be provided') if cos_bucket is None: raise ValueError('cos_bucket must be provided') if cos_location is None: raise ValueError('cos_location must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='create_reports_snapshot_config', ) headers.update(sdk_headers) data = { 'account_id': account_id, 'interval': interval, 'cos_bucket': cos_bucket, 'cos_location': cos_location, 'cos_reports_folder': cos_reports_folder, 'report_types': report_types, 'versioning': versioning, } 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 = '/v1/billing-reports-snapshot-config' request = self.prepare_request( method='POST', url=url, headers=headers, data=data, ) response = self.send(request, **kwargs) return response
(self, account_id: str, interval: str, cos_bucket: str, cos_location: str, *, cos_reports_folder: Optional[str] = None, report_types: Optional[List[str]] = None, versioning: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,016
ibm_platform_services.usage_reports_v4
delete_reports_snapshot_config
Delete the snapshot configuration. Delete the configuration of snapshot of the billing reports setup by the customer for the given Account Id. :param str account_id: Account ID for which the billing report snapshot is configured. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse
def delete_reports_snapshot_config( self, account_id: str, **kwargs, ) -> DetailedResponse: """ Delete the snapshot configuration. Delete the configuration of snapshot of the billing reports setup by the customer for the given Account Id. :param str account_id: Account ID for which the billing report snapshot is configured. :param dict headers: A `dict` containing the request headers :return: A `DetailedResponse` containing the result, headers and HTTP status code. :rtype: DetailedResponse """ if not account_id: raise ValueError('account_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='delete_reports_snapshot_config', ) headers.update(sdk_headers) params = { 'account_id': account_id, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] url = '/v1/billing-reports-snapshot-config' request = self.prepare_request( method='DELETE', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,020
ibm_platform_services.usage_reports_v4
get_account_summary
Get account summary. Returns the summary for the account for a given month. Account billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :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 `AccountSummary` object
def get_account_summary( self, account_id: str, billingmonth: str, **kwargs, ) -> DetailedResponse: """ Get account summary. Returns the summary for the account for a given month. Account billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :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 `AccountSummary` object """ if not account_id: raise ValueError('account_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_account_summary', ) headers.update(sdk_headers) if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/summary/{billingmonth}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, ) response = self.send(request, **kwargs) return response
(self, account_id: str, billingmonth: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,021
ibm_platform_services.usage_reports_v4
get_account_usage
Get account usage. Usage for all the resources and plans in an account for a given month. Account billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `AccountUsage` object
def get_account_usage( self, account_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get account usage. Usage for all the resources and plans in an account for a given month. Account billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `AccountUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_account_usage', ) headers.update(sdk_headers) params = { '_names': names, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/usage/{billingmonth}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,025
ibm_platform_services.usage_reports_v4
get_org_usage
Get organization usage. Usage for all the resources and plans in an organization in a given month. Account billing managers or organization billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str organization_id: ID of the organization. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `OrgUsage` object
def get_org_usage( self, account_id: str, organization_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get organization usage. Usage for all the resources and plans in an organization in a given month. Account billing managers or organization billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str organization_id: ID of the organization. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `OrgUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not organization_id: raise ValueError('organization_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_org_usage', ) headers.update(sdk_headers) params = { '_names': names, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'organization_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, organization_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/organizations/{organization_id}/usage/{billingmonth}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, organization_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,026
ibm_platform_services.usage_reports_v4
get_reports_snapshot
Fetch the current or past snapshots. Returns the billing reports snapshots captured for the given Account Id in the specific time period. :param str account_id: Account ID for which the billing report snapshot is requested. :param str month: The month for which billing report snapshot is requested. Format is yyyy-mm. :param int date_from: (optional) Timestamp in milliseconds for which billing report snapshot is requested. :param int date_to: (optional) Timestamp in milliseconds for which billing report snapshot is requested. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the 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 `SnapshotList` object
def get_reports_snapshot( self, account_id: str, month: str, *, date_from: int = None, date_to: int = None, limit: int = None, start: str = None, **kwargs, ) -> DetailedResponse: """ Fetch the current or past snapshots. Returns the billing reports snapshots captured for the given Account Id in the specific time period. :param str account_id: Account ID for which the billing report snapshot is requested. :param str month: The month for which billing report snapshot is requested. Format is yyyy-mm. :param int date_from: (optional) Timestamp in milliseconds for which billing report snapshot is requested. :param int date_to: (optional) Timestamp in milliseconds for which billing report snapshot is requested. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the 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 `SnapshotList` object """ if not account_id: raise ValueError('account_id must be provided') if not month: raise ValueError('month must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_reports_snapshot', ) headers.update(sdk_headers) params = { 'account_id': account_id, 'month': month, 'date_from': date_from, 'date_to': date_to, '_limit': limit, '_start': start, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' url = '/v1/billing-reports-snapshots' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, month: str, *, date_from: Optional[int] = None, date_to: Optional[int] = None, limit: Optional[int] = None, start: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,027
ibm_platform_services.usage_reports_v4
get_reports_snapshot_config
Fetch the snapshot configuration. Returns the configuration of snapshot of the billing reports setup by the customer for the given Account Id. :param str account_id: Account ID for which the billing report snapshot is configured. :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 `SnapshotConfig` object
def get_reports_snapshot_config( self, account_id: str, **kwargs, ) -> DetailedResponse: """ Fetch the snapshot configuration. Returns the configuration of snapshot of the billing reports setup by the customer for the given Account Id. :param str account_id: Account ID for which the billing report snapshot is configured. :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 `SnapshotConfig` object """ if not account_id: raise ValueError('account_id must be provided') headers = {} sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_reports_snapshot_config', ) 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 = '/v1/billing-reports-snapshot-config' request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,028
ibm_platform_services.usage_reports_v4
get_resource_group_usage
Get resource group usage. Usage for all the resources and plans in a resource group in a given month. Account billing managers or resource group billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str resource_group_id: Resource group for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `ResourceGroupUsage` object
def get_resource_group_usage( self, account_id: str, resource_group_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get resource group usage. Usage for all the resources and plans in a resource group in a given month. Account billing managers or resource group billing managers are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str resource_group_id: Resource group for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :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 `ResourceGroupUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not resource_group_id: raise ValueError('resource_group_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_resource_group_usage', ) headers.update(sdk_headers) params = { '_names': names, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'resource_group_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, resource_group_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/resource_groups/{resource_group_id}/usage/{billingmonth}'.format( **path_param_dict ) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, resource_group_id: str, billingmonth: str, *, names: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,029
ibm_platform_services.usage_reports_v4
get_resource_usage_account
Get resource instance usage in an account. Query for resource instance usage in an account. Filter the results with query parameters. Account billing administrator is authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_group_id: (optional) Filter by resource group. :param str organization_id: (optional) Filter by organization_id. :param str resource_instance_id: (optional) Filter by resource instance_id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object
def get_resource_usage_account( self, account_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_group_id: Optional[str] = None, organization_id: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get resource instance usage in an account. Query for resource instance usage in an account. Filter the results with query parameters. Account billing administrator is authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_group_id: (optional) Filter by resource group. :param str organization_id: (optional) Filter by organization_id. :param str resource_instance_id: (optional) Filter by resource instance_id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_resource_usage_account', ) headers.update(sdk_headers) params = { '_names': names, '_tags': tags, '_limit': limit, '_start': start, 'resource_group_id': resource_group_id, 'organization_id': organization_id, 'resource_instance_id': resource_instance_id, 'resource_id': resource_id, 'plan_id': plan_id, 'region': region, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/resource_instances/usage/{billingmonth}'.format(**path_param_dict) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_group_id: Optional[str] = None, organization_id: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,030
ibm_platform_services.usage_reports_v4
get_resource_usage_org
Get resource instance usage in an organization. Query for resource instance usage in an organization. Filter the results with query parameters. Account billing administrator and organization billing administrators are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str organization_id: ID of the organization. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_instance_id: (optional) Filter by resource instance id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object
def get_resource_usage_org( self, account_id: str, organization_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get resource instance usage in an organization. Query for resource instance usage in an organization. Filter the results with query parameters. Account billing administrator and organization billing administrators are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str organization_id: ID of the organization. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_instance_id: (optional) Filter by resource instance id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not organization_id: raise ValueError('organization_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_resource_usage_org', ) headers.update(sdk_headers) params = { '_names': names, '_tags': tags, '_limit': limit, '_start': start, 'resource_instance_id': resource_instance_id, 'resource_id': resource_id, 'plan_id': plan_id, 'region': region, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'organization_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, organization_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = ( '/v4/accounts/{account_id}/organizations/{organization_id}/resource_instances/usage/{billingmonth}'.format( **path_param_dict ) ) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, organization_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
720,031
ibm_platform_services.usage_reports_v4
get_resource_usage_resource_group
Get resource instance usage in a resource group. Query for resource instance usage in a resource group. Filter the results with query parameters. Account billing administrator and resource group billing administrators are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str resource_group_id: Resource group for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_instance_id: (optional) Filter by resource instance id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object
def get_resource_usage_resource_group( self, account_id: str, resource_group_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs, ) -> DetailedResponse: """ Get resource instance usage in a resource group. Query for resource instance usage in a resource group. Filter the results with query parameters. Account billing administrator and resource group billing administrators are authorized to access this report. :param str account_id: Account ID for which the usage report is requested. :param str resource_group_id: Resource group for which the usage report is requested. :param str billingmonth: The billing month for which the usage report is requested. Format is yyyy-mm. :param bool names: (optional) Include the name of every resource, plan, resource instance, organization, and resource group. :param bool tags: (optional) Include the tags associated with every resource instance. By default it is always `true`. :param str accept_language: (optional) Prioritize the names returned in the order of the specified languages. Language will default to English. :param int limit: (optional) Number of usage records returned. The default value is 30. Maximum value is 200. :param str start: (optional) The offset from which the records must be fetched. Offset information is included in the response. :param str resource_instance_id: (optional) Filter by resource instance id. :param str resource_id: (optional) Filter by resource_id. :param str plan_id: (optional) Filter by plan_id. :param str region: (optional) Region in which the resource instance is provisioned. :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 `InstancesUsage` object """ if not account_id: raise ValueError('account_id must be provided') if not resource_group_id: raise ValueError('resource_group_id must be provided') if not billingmonth: raise ValueError('billingmonth must be provided') headers = { 'Accept-Language': accept_language, } sdk_headers = get_sdk_headers( service_name=self.DEFAULT_SERVICE_NAME, service_version='V4', operation_id='get_resource_usage_resource_group', ) headers.update(sdk_headers) params = { '_names': names, '_tags': tags, '_limit': limit, '_start': start, 'resource_instance_id': resource_instance_id, 'resource_id': resource_id, 'plan_id': plan_id, 'region': region, } if 'headers' in kwargs: headers.update(kwargs.get('headers')) del kwargs['headers'] headers['Accept'] = 'application/json' path_param_keys = ['account_id', 'resource_group_id', 'billingmonth'] path_param_values = self.encode_path_vars(account_id, resource_group_id, billingmonth) path_param_dict = dict(zip(path_param_keys, path_param_values)) url = '/v4/accounts/{account_id}/resource_groups/{resource_group_id}/resource_instances/usage/{billingmonth}'.format( **path_param_dict ) request = self.prepare_request( method='GET', url=url, headers=headers, params=params, ) response = self.send(request, **kwargs) return response
(self, account_id: str, resource_group_id: str, billingmonth: str, *, names: Optional[bool] = None, tags: Optional[bool] = None, accept_language: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, resource_instance_id: Optional[str] = None, resource_id: Optional[str] = None, plan_id: Optional[str] = None, region: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse