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,385
|
ibm_platform_services.catalog_management_v1
|
ibm_publish_version
|
Publish version to IBMers in public catalog.
Publish the specified version so that it is visible to IBMers in the public
catalog.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def ibm_publish_version(self, version_loc_id: str, **kwargs) -> DetailedResponse:
"""
Publish version to IBMers in public catalog.
Publish the specified version so that it is visible to IBMers in the public
catalog.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if version_loc_id is None:
raise ValueError('version_loc_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='ibm_publish_version'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
path_param_keys = ['version_loc_id']
path_param_values = self.encode_path_vars(version_loc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/versions/{version_loc_id}/ibm-publish'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers)
response = self.send(request, **kwargs)
return response
|
(self, version_loc_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,386
|
ibm_platform_services.catalog_management_v1
|
import_offering
|
Import offering.
Import a new offering from a tgz.
:param str catalog_identifier: Catalog identifier.
:param List[str] tags: (optional) Tags array.
:param List[str] target_kinds: (optional) Target kinds. Current valid
values are 'iks', 'roks', 'vcenter', and 'terraform'.
:param bytes content: (optional) byte array representing the content to be
imported. Only supported for OVA images at this time.
:param str zipurl: (optional) URL path to zip location. If not specified,
must provide content in this post body.
:param str offering_id: (optional) Re-use the specified offeringID during
import.
:param str target_version: (optional) The semver value for this new
version.
:param bool include_config: (optional) Add all possible configuration items
when creating this version.
:param bool is_vsi: (optional) Indicates that the current terraform
template is used to install a VSI Image.
:param str repo_type: (optional) The type of repository containing this
version. Valid values are 'public_git' or 'enterprise_git'.
:param str x_auth_token: (optional) Authentication token used to access the
specified zip file.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
|
def import_offering(
self,
catalog_identifier: str,
*,
tags: List[str] = None,
target_kinds: List[str] = None,
content: bytes = None,
zipurl: str = None,
offering_id: str = None,
target_version: str = None,
include_config: bool = None,
is_vsi: bool = None,
repo_type: str = None,
x_auth_token: str = None,
**kwargs
) -> DetailedResponse:
"""
Import offering.
Import a new offering from a tgz.
:param str catalog_identifier: Catalog identifier.
:param List[str] tags: (optional) Tags array.
:param List[str] target_kinds: (optional) Target kinds. Current valid
values are 'iks', 'roks', 'vcenter', and 'terraform'.
:param bytes content: (optional) byte array representing the content to be
imported. Only supported for OVA images at this time.
:param str zipurl: (optional) URL path to zip location. If not specified,
must provide content in this post body.
:param str offering_id: (optional) Re-use the specified offeringID during
import.
:param str target_version: (optional) The semver value for this new
version.
:param bool include_config: (optional) Add all possible configuration items
when creating this version.
:param bool is_vsi: (optional) Indicates that the current terraform
template is used to install a VSI Image.
:param str repo_type: (optional) The type of repository containing this
version. Valid values are 'public_git' or 'enterprise_git'.
:param str x_auth_token: (optional) Authentication token used to access the
specified zip file.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if content is not None:
content = str(base64.b64encode(content), 'utf-8')
headers = {'X-Auth-Token': x_auth_token}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='import_offering'
)
headers.update(sdk_headers)
params = {
'zipurl': zipurl,
'offeringID': offering_id,
'targetVersion': target_version,
'includeConfig': include_config,
'isVSI': is_vsi,
'repoType': repo_type,
}
data = {'tags': tags, 'target_kinds': target_kinds, 'content': content}
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 = ['catalog_identifier']
path_param_values = self.encode_path_vars(catalog_identifier)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/import/offerings'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers, params=params, data=data)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, *, tags: Optional[List[str]] = None, target_kinds: Optional[List[str]] = None, content: Optional[bytes] = None, zipurl: Optional[str] = None, offering_id: Optional[str] = None, target_version: Optional[str] = None, include_config: Optional[bool] = None, is_vsi: Optional[bool] = None, repo_type: Optional[str] = None, x_auth_token: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,387
|
ibm_platform_services.catalog_management_v1
|
import_offering_version
|
Import offering version.
Import new version to offering from a tgz.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param List[str] tags: (optional) Tags array.
:param List[str] target_kinds: (optional) Target kinds. Current valid
values are 'iks', 'roks', 'vcenter', and 'terraform'.
:param bytes content: (optional) byte array representing the content to be
imported. Only supported for OVA images at this time.
:param str zipurl: (optional) URL path to zip location. If not specified,
must provide content in the body of this call.
:param str target_version: (optional) The semver value for this new
version, if not found in the zip url package content.
:param bool include_config: (optional) Add all possible configuration
values to this version when importing.
:param bool is_vsi: (optional) Indicates that the current terraform
template is used to install a VSI Image.
:param str repo_type: (optional) The type of repository containing this
version. Valid values are 'public_git' or 'enterprise_git'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
|
def import_offering_version(
self,
catalog_identifier: str,
offering_id: str,
*,
tags: List[str] = None,
target_kinds: List[str] = None,
content: bytes = None,
zipurl: str = None,
target_version: str = None,
include_config: bool = None,
is_vsi: bool = None,
repo_type: str = None,
**kwargs
) -> DetailedResponse:
"""
Import offering version.
Import new version to offering from a tgz.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param List[str] tags: (optional) Tags array.
:param List[str] target_kinds: (optional) Target kinds. Current valid
values are 'iks', 'roks', 'vcenter', and 'terraform'.
:param bytes content: (optional) byte array representing the content to be
imported. Only supported for OVA images at this time.
:param str zipurl: (optional) URL path to zip location. If not specified,
must provide content in the body of this call.
:param str target_version: (optional) The semver value for this new
version, if not found in the zip url package content.
:param bool include_config: (optional) Add all possible configuration
values to this version when importing.
:param bool is_vsi: (optional) Indicates that the current terraform
template is used to install a VSI Image.
:param str repo_type: (optional) The type of repository containing this
version. Valid values are 'public_git' or 'enterprise_git'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if offering_id is None:
raise ValueError('offering_id must be provided')
if content is not None:
content = str(base64.b64encode(content), 'utf-8')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='import_offering_version'
)
headers.update(sdk_headers)
params = {
'zipurl': zipurl,
'targetVersion': target_version,
'includeConfig': include_config,
'isVSI': is_vsi,
'repoType': repo_type,
}
data = {'tags': tags, 'target_kinds': target_kinds, 'content': content}
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 = ['catalog_identifier', 'offering_id']
path_param_values = self.encode_path_vars(catalog_identifier, offering_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/offerings/{offering_id}/version'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers, params=params, data=data)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, offering_id: str, *, tags: Optional[List[str]] = None, target_kinds: Optional[List[str]] = None, content: Optional[bytes] = None, zipurl: Optional[str] = None, target_version: Optional[str] = None, include_config: Optional[bool] = None, is_vsi: Optional[bool] = None, repo_type: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,388
|
ibm_platform_services.catalog_management_v1
|
install_version
|
Install version.
Create an install for the specified version.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: (optional) Cluster ID.
:param str region: (optional) Cluster region.
:param str namespace: (optional) Kube namespace.
:param dict override_values: (optional) Object containing Helm chart
override values. To use a secret for items of type password, specify a
JSON encoded value of $ref:#/components/schemas/SecretInstance, prefixed
with `cmsm_v1:`.
:param str entitlement_apikey: (optional) Entitlement API Key for this
offering.
:param DeployRequestBodySchematics schematics: (optional) Schematics
workspace configuration.
:param str script: (optional) Script.
:param str script_id: (optional) Script ID.
:param str version_locator_id: (optional) A dotted value of
`catalogID`.`versionID`.
:param str vcenter_id: (optional) VCenter ID.
:param str vcenter_user: (optional) VCenter User.
:param str vcenter_password: (optional) VCenter Password.
:param str vcenter_location: (optional) VCenter Location.
:param str vcenter_datastore: (optional) VCenter Datastore.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def install_version(
self,
version_loc_id: str,
x_auth_refresh_token: str,
*,
cluster_id: str = None,
region: str = None,
namespace: str = None,
override_values: dict = None,
entitlement_apikey: str = None,
schematics: 'DeployRequestBodySchematics' = None,
script: str = None,
script_id: str = None,
version_locator_id: str = None,
vcenter_id: str = None,
vcenter_user: str = None,
vcenter_password: str = None,
vcenter_location: str = None,
vcenter_datastore: str = None,
**kwargs
) -> DetailedResponse:
"""
Install version.
Create an install for the specified version.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: (optional) Cluster ID.
:param str region: (optional) Cluster region.
:param str namespace: (optional) Kube namespace.
:param dict override_values: (optional) Object containing Helm chart
override values. To use a secret for items of type password, specify a
JSON encoded value of $ref:#/components/schemas/SecretInstance, prefixed
with `cmsm_v1:`.
:param str entitlement_apikey: (optional) Entitlement API Key for this
offering.
:param DeployRequestBodySchematics schematics: (optional) Schematics
workspace configuration.
:param str script: (optional) Script.
:param str script_id: (optional) Script ID.
:param str version_locator_id: (optional) A dotted value of
`catalogID`.`versionID`.
:param str vcenter_id: (optional) VCenter ID.
:param str vcenter_user: (optional) VCenter User.
:param str vcenter_password: (optional) VCenter Password.
:param str vcenter_location: (optional) VCenter Location.
:param str vcenter_datastore: (optional) VCenter Datastore.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if version_loc_id is None:
raise ValueError('version_loc_id must be provided')
if x_auth_refresh_token is None:
raise ValueError('x_auth_refresh_token must be provided')
if schematics is not None:
schematics = convert_model(schematics)
headers = {'X-Auth-Refresh-Token': x_auth_refresh_token}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='install_version'
)
headers.update(sdk_headers)
data = {
'cluster_id': cluster_id,
'region': region,
'namespace': namespace,
'override_values': override_values,
'entitlement_apikey': entitlement_apikey,
'schematics': schematics,
'script': script,
'script_id': script_id,
'version_locator_id': version_locator_id,
'vcenter_id': vcenter_id,
'vcenter_user': vcenter_user,
'vcenter_password': vcenter_password,
'vcenter_location': vcenter_location,
'vcenter_datastore': vcenter_datastore,
}
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'))
path_param_keys = ['version_loc_id']
path_param_values = self.encode_path_vars(version_loc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/versions/{version_loc_id}/install'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, version_loc_id: str, x_auth_refresh_token: str, *, cluster_id: Optional[str] = None, region: Optional[str] = None, namespace: Optional[str] = None, override_values: Optional[dict] = None, entitlement_apikey: Optional[str] = None, schematics: Optional[ibm_platform_services.catalog_management_v1.DeployRequestBodySchematics] = None, script: Optional[str] = None, script_id: Optional[str] = None, version_locator_id: Optional[str] = None, vcenter_id: Optional[str] = None, vcenter_user: Optional[str] = None, vcenter_password: Optional[str] = None, vcenter_location: Optional[str] = None, vcenter_datastore: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,389
|
ibm_platform_services.catalog_management_v1
|
list_catalogs
|
Get list of catalogs.
Retrieves the available catalogs for a given account. This can be used by an
unauthenticated user to retrieve the public 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 `CatalogSearchResult` object
|
def list_catalogs(self, **kwargs) -> DetailedResponse:
"""
Get list of catalogs.
Retrieves the available catalogs for a given account. This can be used by an
unauthenticated user to retrieve the public 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 `CatalogSearchResult` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_catalogs'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
url = '/catalogs'
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,390
|
ibm_platform_services.catalog_management_v1
|
list_objects
|
List objects within a catalog.
List the available objects within the specified catalog.
:param str catalog_identifier: Catalog identifier.
:param int limit: (optional) The number of results to return.
:param int offset: (optional) The number of results to skip before
returning values.
:param str name: (optional) Only return results that contain the specified
string.
:param str sort: (optional) The field on which the output is sorted. Sorts
by default by **label** property. Available fields are **name**, **label**,
**created**, and **updated**. By adding **-** (i.e. **-label**) in front of
the query string, you can specify descending order. Default is ascending
order.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ObjectListResult` object
|
def list_objects(
self,
catalog_identifier: str,
*,
limit: int = None,
offset: int = None,
name: str = None,
sort: str = None,
**kwargs
) -> DetailedResponse:
"""
List objects within a catalog.
List the available objects within the specified catalog.
:param str catalog_identifier: Catalog identifier.
:param int limit: (optional) The number of results to return.
:param int offset: (optional) The number of results to skip before
returning values.
:param str name: (optional) Only return results that contain the specified
string.
:param str sort: (optional) The field on which the output is sorted. Sorts
by default by **label** property. Available fields are **name**, **label**,
**created**, and **updated**. By adding **-** (i.e. **-label**) in front of
the query string, you can specify descending order. Default is ascending
order.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ObjectListResult` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_objects'
)
headers.update(sdk_headers)
params = {'limit': limit, 'offset': offset, 'name': name, 'sort': sort}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['catalog_identifier']
path_param_values = self.encode_path_vars(catalog_identifier)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/objects'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, *, limit: Optional[int] = None, offset: Optional[int] = None, name: Optional[str] = None, sort: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,391
|
ibm_platform_services.catalog_management_v1
|
list_offerings
|
Get list of offerings.
Retrieve the available offerings in the specified catalog. This can also be used
by an unauthenticated user to retreive publicly available offerings.
:param str catalog_identifier: Catalog identifier.
:param bool digest: (optional) true - Strip down the content of what is
returned. For example don't return the readme. Makes the result much
smaller. Defaults to false.
:param int limit: (optional) The maximum number of results to return.
:param int offset: (optional) The number of results to skip before
returning values.
:param str name: (optional) Only return results that contain the specified
string.
:param str sort: (optional) The field on which the output is sorted. Sorts
by default by **label** property. Available fields are **name**, **label**,
**created**, and **updated**. By adding **-** (i.e. **-label**) in front of
the query string, you can specify descending order. Default is ascending
order.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `OfferingSearchResult` object
|
def list_offerings(
self,
catalog_identifier: str,
*,
digest: bool = None,
limit: int = None,
offset: int = None,
name: str = None,
sort: str = None,
**kwargs
) -> DetailedResponse:
"""
Get list of offerings.
Retrieve the available offerings in the specified catalog. This can also be used
by an unauthenticated user to retreive publicly available offerings.
:param str catalog_identifier: Catalog identifier.
:param bool digest: (optional) true - Strip down the content of what is
returned. For example don't return the readme. Makes the result much
smaller. Defaults to false.
:param int limit: (optional) The maximum number of results to return.
:param int offset: (optional) The number of results to skip before
returning values.
:param str name: (optional) Only return results that contain the specified
string.
:param str sort: (optional) The field on which the output is sorted. Sorts
by default by **label** property. Available fields are **name**, **label**,
**created**, and **updated**. By adding **-** (i.e. **-label**) in front of
the query string, you can specify descending order. Default is ascending
order.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `OfferingSearchResult` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_offerings'
)
headers.update(sdk_headers)
params = {'digest': digest, 'limit': limit, 'offset': offset, 'name': name, 'sort': sort}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['catalog_identifier']
path_param_values = self.encode_path_vars(catalog_identifier)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/offerings'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, *, digest: Optional[bool] = None, limit: Optional[int] = None, offset: Optional[int] = None, name: Optional[str] = None, sort: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,392
|
ibm_platform_services.catalog_management_v1
|
list_operators
|
List operators.
List the operators from a kubernetes cluster.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: Cluster identification.
:param str region: Cluster region.
:param str version_locator_id: A dotted value of `catalogID`.`versionID`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `List[OperatorDeployResult]` result
|
def list_operators(
self, x_auth_refresh_token: str, cluster_id: str, region: str, version_locator_id: str, **kwargs
) -> DetailedResponse:
"""
List operators.
List the operators from a kubernetes cluster.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: Cluster identification.
:param str region: Cluster region.
:param str version_locator_id: A dotted value of `catalogID`.`versionID`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `List[OperatorDeployResult]` result
"""
if x_auth_refresh_token is None:
raise ValueError('x_auth_refresh_token must be provided')
if cluster_id is None:
raise ValueError('cluster_id must be provided')
if region is None:
raise ValueError('region must be provided')
if version_locator_id is None:
raise ValueError('version_locator_id must be provided')
headers = {'X-Auth-Refresh-Token': x_auth_refresh_token}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_operators'
)
headers.update(sdk_headers)
params = {'cluster_id': cluster_id, 'region': region, 'version_locator_id': version_locator_id}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
url = '/deploy/kubernetes/olm/operator'
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request, **kwargs)
return response
|
(self, x_auth_refresh_token: str, cluster_id: str, region: str, version_locator_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,393
|
ibm_platform_services.catalog_management_v1
|
preinstall_version
|
Pre-install version.
Create a pre-install for the specified version.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: (optional) Cluster ID.
:param str region: (optional) Cluster region.
:param str namespace: (optional) Kube namespace.
:param dict override_values: (optional) Object containing Helm chart
override values. To use a secret for items of type password, specify a
JSON encoded value of $ref:#/components/schemas/SecretInstance, prefixed
with `cmsm_v1:`.
:param str entitlement_apikey: (optional) Entitlement API Key for this
offering.
:param DeployRequestBodySchematics schematics: (optional) Schematics
workspace configuration.
:param str script: (optional) Script.
:param str script_id: (optional) Script ID.
:param str version_locator_id: (optional) A dotted value of
`catalogID`.`versionID`.
:param str vcenter_id: (optional) VCenter ID.
:param str vcenter_user: (optional) VCenter User.
:param str vcenter_password: (optional) VCenter Password.
:param str vcenter_location: (optional) VCenter Location.
:param str vcenter_datastore: (optional) VCenter Datastore.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def preinstall_version(
self,
version_loc_id: str,
x_auth_refresh_token: str,
*,
cluster_id: str = None,
region: str = None,
namespace: str = None,
override_values: dict = None,
entitlement_apikey: str = None,
schematics: 'DeployRequestBodySchematics' = None,
script: str = None,
script_id: str = None,
version_locator_id: str = None,
vcenter_id: str = None,
vcenter_user: str = None,
vcenter_password: str = None,
vcenter_location: str = None,
vcenter_datastore: str = None,
**kwargs
) -> DetailedResponse:
"""
Pre-install version.
Create a pre-install for the specified version.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: (optional) Cluster ID.
:param str region: (optional) Cluster region.
:param str namespace: (optional) Kube namespace.
:param dict override_values: (optional) Object containing Helm chart
override values. To use a secret for items of type password, specify a
JSON encoded value of $ref:#/components/schemas/SecretInstance, prefixed
with `cmsm_v1:`.
:param str entitlement_apikey: (optional) Entitlement API Key for this
offering.
:param DeployRequestBodySchematics schematics: (optional) Schematics
workspace configuration.
:param str script: (optional) Script.
:param str script_id: (optional) Script ID.
:param str version_locator_id: (optional) A dotted value of
`catalogID`.`versionID`.
:param str vcenter_id: (optional) VCenter ID.
:param str vcenter_user: (optional) VCenter User.
:param str vcenter_password: (optional) VCenter Password.
:param str vcenter_location: (optional) VCenter Location.
:param str vcenter_datastore: (optional) VCenter Datastore.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if version_loc_id is None:
raise ValueError('version_loc_id must be provided')
if x_auth_refresh_token is None:
raise ValueError('x_auth_refresh_token must be provided')
if schematics is not None:
schematics = convert_model(schematics)
headers = {'X-Auth-Refresh-Token': x_auth_refresh_token}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='preinstall_version'
)
headers.update(sdk_headers)
data = {
'cluster_id': cluster_id,
'region': region,
'namespace': namespace,
'override_values': override_values,
'entitlement_apikey': entitlement_apikey,
'schematics': schematics,
'script': script,
'script_id': script_id,
'version_locator_id': version_locator_id,
'vcenter_id': vcenter_id,
'vcenter_user': vcenter_user,
'vcenter_password': vcenter_password,
'vcenter_location': vcenter_location,
'vcenter_datastore': vcenter_datastore,
}
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'))
path_param_keys = ['version_loc_id']
path_param_values = self.encode_path_vars(version_loc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/versions/{version_loc_id}/preinstall'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, version_loc_id: str, x_auth_refresh_token: str, *, cluster_id: Optional[str] = None, region: Optional[str] = None, namespace: Optional[str] = None, override_values: Optional[dict] = None, entitlement_apikey: Optional[str] = None, schematics: Optional[ibm_platform_services.catalog_management_v1.DeployRequestBodySchematics] = None, script: Optional[str] = None, script_id: Optional[str] = None, version_locator_id: Optional[str] = None, vcenter_id: Optional[str] = None, vcenter_user: Optional[str] = None, vcenter_password: Optional[str] = None, vcenter_location: Optional[str] = None, vcenter_datastore: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,395
|
ibm_platform_services.catalog_management_v1
|
public_publish_object
|
Publish object to share with all users.
Publish the specified object so it is visible to all users in the public catalog.
:param str catalog_identifier: Catalog identifier.
:param str object_identifier: Object identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def public_publish_object(self, catalog_identifier: str, object_identifier: str, **kwargs) -> DetailedResponse:
"""
Publish object to share with all users.
Publish the specified object so it is visible to all users in the public catalog.
:param str catalog_identifier: Catalog identifier.
:param str object_identifier: Object identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if object_identifier is None:
raise ValueError('object_identifier must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='public_publish_object'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
path_param_keys = ['catalog_identifier', 'object_identifier']
path_param_values = self.encode_path_vars(catalog_identifier, object_identifier)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/objects/{object_identifier}/public-publish'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, object_identifier: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,396
|
ibm_platform_services.catalog_management_v1
|
public_publish_version
|
Publish version to all users in public catalog.
Publish the specified version so it is visible to all users in the public catalog.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def public_publish_version(self, version_loc_id: str, **kwargs) -> DetailedResponse:
"""
Publish version to all users in public catalog.
Publish the specified version so it is visible to all users in the public catalog.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if version_loc_id is None:
raise ValueError('version_loc_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='public_publish_version'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
path_param_keys = ['version_loc_id']
path_param_values = self.encode_path_vars(version_loc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/versions/{version_loc_id}/public-publish'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers)
response = self.send(request, **kwargs)
return response
|
(self, version_loc_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,397
|
ibm_platform_services.catalog_management_v1
|
put_offering_instance
|
Update Offering Instance.
Update an installed offering instance.
:param str instance_identifier: Version Instance identifier.
:param str x_auth_refresh_token: IAM Refresh token.
:param str id: (optional) provisioned instance ID (part of the CRN).
:param str rev: (optional) Cloudant revision.
:param str url: (optional) url reference to this object.
:param str crn: (optional) platform CRN for this instance.
:param str label: (optional) the label for this instance.
:param str catalog_id: (optional) Catalog ID this instance was created
from.
:param str offering_id: (optional) Offering ID this instance was created
from.
:param str kind_format: (optional) the format this instance has (helm,
operator, ova...).
:param str version: (optional) The version this instance was installed from
(not version id).
:param str cluster_id: (optional) Cluster ID.
:param str cluster_region: (optional) Cluster region (e.g., us-south).
:param List[str] cluster_namespaces: (optional) List of target namespaces
to install into.
:param bool cluster_all_namespaces: (optional) designate to install into
all namespaces.
:param str schematics_workspace_id: (optional) Id of the schematics
workspace, for offering instances provisioned through schematics.
:param str resource_group_id: (optional) Id of the resource group to
provision the offering instance into.
:param str install_plan: (optional) Type of install plan (also known as
approval strategy) for operator subscriptions. Can be either automatic,
which automatically upgrades operators to the latest in a channel, or
manual, which requires approval on the cluster.
:param str channel: (optional) Channel to pin the operator subscription to.
:param dict metadata: (optional) Map of metadata values for this offering
instance.
:param OfferingInstanceLastOperation last_operation: (optional) the last
operation performed and status.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `OfferingInstance` object
|
def put_offering_instance(
self,
instance_identifier: str,
x_auth_refresh_token: str,
*,
id: str = None,
rev: str = None,
url: str = None,
crn: str = None,
label: str = None,
catalog_id: str = None,
offering_id: str = None,
kind_format: str = None,
version: str = None,
cluster_id: str = None,
cluster_region: str = None,
cluster_namespaces: List[str] = None,
cluster_all_namespaces: bool = None,
schematics_workspace_id: str = None,
resource_group_id: str = None,
install_plan: str = None,
channel: str = None,
metadata: dict = None,
last_operation: 'OfferingInstanceLastOperation' = None,
**kwargs
) -> DetailedResponse:
"""
Update Offering Instance.
Update an installed offering instance.
:param str instance_identifier: Version Instance identifier.
:param str x_auth_refresh_token: IAM Refresh token.
:param str id: (optional) provisioned instance ID (part of the CRN).
:param str rev: (optional) Cloudant revision.
:param str url: (optional) url reference to this object.
:param str crn: (optional) platform CRN for this instance.
:param str label: (optional) the label for this instance.
:param str catalog_id: (optional) Catalog ID this instance was created
from.
:param str offering_id: (optional) Offering ID this instance was created
from.
:param str kind_format: (optional) the format this instance has (helm,
operator, ova...).
:param str version: (optional) The version this instance was installed from
(not version id).
:param str cluster_id: (optional) Cluster ID.
:param str cluster_region: (optional) Cluster region (e.g., us-south).
:param List[str] cluster_namespaces: (optional) List of target namespaces
to install into.
:param bool cluster_all_namespaces: (optional) designate to install into
all namespaces.
:param str schematics_workspace_id: (optional) Id of the schematics
workspace, for offering instances provisioned through schematics.
:param str resource_group_id: (optional) Id of the resource group to
provision the offering instance into.
:param str install_plan: (optional) Type of install plan (also known as
approval strategy) for operator subscriptions. Can be either automatic,
which automatically upgrades operators to the latest in a channel, or
manual, which requires approval on the cluster.
:param str channel: (optional) Channel to pin the operator subscription to.
:param dict metadata: (optional) Map of metadata values for this offering
instance.
:param OfferingInstanceLastOperation last_operation: (optional) the last
operation performed and status.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `OfferingInstance` object
"""
if instance_identifier is None:
raise ValueError('instance_identifier must be provided')
if x_auth_refresh_token is None:
raise ValueError('x_auth_refresh_token must be provided')
if last_operation is not None:
last_operation = convert_model(last_operation)
headers = {'X-Auth-Refresh-Token': x_auth_refresh_token}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='put_offering_instance'
)
headers.update(sdk_headers)
data = {
'id': id,
'_rev': rev,
'url': url,
'crn': crn,
'label': label,
'catalog_id': catalog_id,
'offering_id': offering_id,
'kind_format': kind_format,
'version': version,
'cluster_id': cluster_id,
'cluster_region': cluster_region,
'cluster_namespaces': cluster_namespaces,
'cluster_all_namespaces': cluster_all_namespaces,
'schematics_workspace_id': schematics_workspace_id,
'resource_group_id': resource_group_id,
'install_plan': install_plan,
'channel': channel,
'metadata': metadata,
'last_operation': last_operation,
}
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_identifier']
path_param_values = self.encode_path_vars(instance_identifier)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/instances/offerings/{instance_identifier}'.format(**path_param_dict)
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, instance_identifier: str, x_auth_refresh_token: str, *, id: Optional[str] = None, rev: Optional[str] = None, url: Optional[str] = None, crn: Optional[str] = None, label: Optional[str] = None, catalog_id: Optional[str] = None, offering_id: Optional[str] = None, kind_format: Optional[str] = None, version: Optional[str] = None, cluster_id: Optional[str] = None, cluster_region: Optional[str] = None, cluster_namespaces: Optional[List[str]] = None, cluster_all_namespaces: Optional[bool] = None, schematics_workspace_id: Optional[str] = None, resource_group_id: Optional[str] = None, install_plan: Optional[str] = None, channel: Optional[str] = None, metadata: Optional[dict] = None, last_operation: Optional[ibm_platform_services.catalog_management_v1.OfferingInstanceLastOperation] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,398
|
ibm_platform_services.catalog_management_v1
|
reload_offering
|
Reload offering.
Reload an existing version in offering from a tgz.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str target_version: The semver value for this new version.
:param List[str] tags: (optional) Tags array.
:param List[str] target_kinds: (optional) Target kinds. Current valid
values are 'iks', 'roks', 'vcenter', and 'terraform'.
:param bytes content: (optional) byte array representing the content to be
imported. Only supported for OVA images at this time.
:param str zipurl: (optional) URL path to zip location. If not specified,
must provide content in this post body.
:param str repo_type: (optional) The type of repository containing this
version. Valid values are 'public_git' or 'enterprise_git'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
|
def reload_offering(
self,
catalog_identifier: str,
offering_id: str,
target_version: str,
*,
tags: List[str] = None,
target_kinds: List[str] = None,
content: bytes = None,
zipurl: str = None,
repo_type: str = None,
**kwargs
) -> DetailedResponse:
"""
Reload offering.
Reload an existing version in offering from a tgz.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str target_version: The semver value for this new version.
:param List[str] tags: (optional) Tags array.
:param List[str] target_kinds: (optional) Target kinds. Current valid
values are 'iks', 'roks', 'vcenter', and 'terraform'.
:param bytes content: (optional) byte array representing the content to be
imported. Only supported for OVA images at this time.
:param str zipurl: (optional) URL path to zip location. If not specified,
must provide content in this post body.
:param str repo_type: (optional) The type of repository containing this
version. Valid values are 'public_git' or 'enterprise_git'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if offering_id is None:
raise ValueError('offering_id must be provided')
if target_version is None:
raise ValueError('target_version must be provided')
if content is not None:
content = str(base64.b64encode(content), 'utf-8')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='reload_offering'
)
headers.update(sdk_headers)
params = {'targetVersion': target_version, 'zipurl': zipurl, 'repoType': repo_type}
data = {'tags': tags, 'target_kinds': target_kinds, 'content': content}
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 = ['catalog_identifier', 'offering_id']
path_param_values = self.encode_path_vars(catalog_identifier, offering_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/offerings/{offering_id}/reload'.format(**path_param_dict)
request = self.prepare_request(method='PUT', url=url, headers=headers, params=params, data=data)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, offering_id: str, target_version: str, *, tags: Optional[List[str]] = None, target_kinds: Optional[List[str]] = None, content: Optional[bytes] = None, zipurl: Optional[str] = None, repo_type: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,399
|
ibm_platform_services.catalog_management_v1
|
replace_catalog
|
Update catalog.
Update a catalog.
:param str catalog_identifier: Catalog identifier.
:param str id: (optional) Unique ID.
:param str rev: (optional) Cloudant revision.
:param str label: (optional) Display Name in the requested language.
:param str short_description: (optional) Description in the requested
language.
:param str catalog_icon_url: (optional) URL for an icon associated with
this catalog.
:param List[str] tags: (optional) List of tags associated with this
catalog.
:param List[Feature] features: (optional) List of features associated with
this catalog.
:param bool disabled: (optional) Denotes whether a catalog is disabled.
:param str resource_group_id: (optional) Resource group id the catalog is
owned by.
:param str owning_account: (optional) Account that owns catalog.
:param Filters catalog_filters: (optional) Filters for account and catalog
filters.
:param SyndicationResource syndication_settings: (optional) Feature
information.
:param str kind: (optional) Kind of catalog. Supported kinds are offering
and vpe.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Catalog` object
|
def replace_catalog(
self,
catalog_identifier: str,
*,
id: str = None,
rev: str = None,
label: str = None,
short_description: str = None,
catalog_icon_url: str = None,
tags: List[str] = None,
features: List['Feature'] = None,
disabled: bool = None,
resource_group_id: str = None,
owning_account: str = None,
catalog_filters: 'Filters' = None,
syndication_settings: 'SyndicationResource' = None,
kind: str = None,
**kwargs
) -> DetailedResponse:
"""
Update catalog.
Update a catalog.
:param str catalog_identifier: Catalog identifier.
:param str id: (optional) Unique ID.
:param str rev: (optional) Cloudant revision.
:param str label: (optional) Display Name in the requested language.
:param str short_description: (optional) Description in the requested
language.
:param str catalog_icon_url: (optional) URL for an icon associated with
this catalog.
:param List[str] tags: (optional) List of tags associated with this
catalog.
:param List[Feature] features: (optional) List of features associated with
this catalog.
:param bool disabled: (optional) Denotes whether a catalog is disabled.
:param str resource_group_id: (optional) Resource group id the catalog is
owned by.
:param str owning_account: (optional) Account that owns catalog.
:param Filters catalog_filters: (optional) Filters for account and catalog
filters.
:param SyndicationResource syndication_settings: (optional) Feature
information.
:param str kind: (optional) Kind of catalog. Supported kinds are offering
and vpe.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Catalog` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if features is not None:
features = [convert_model(x) for x in features]
if catalog_filters is not None:
catalog_filters = convert_model(catalog_filters)
if syndication_settings is not None:
syndication_settings = convert_model(syndication_settings)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_catalog'
)
headers.update(sdk_headers)
data = {
'id': id,
'_rev': rev,
'label': label,
'short_description': short_description,
'catalog_icon_url': catalog_icon_url,
'tags': tags,
'features': features,
'disabled': disabled,
'resource_group_id': resource_group_id,
'owning_account': owning_account,
'catalog_filters': catalog_filters,
'syndication_settings': syndication_settings,
'kind': kind,
}
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 = ['catalog_identifier']
path_param_values = self.encode_path_vars(catalog_identifier)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}'.format(**path_param_dict)
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, *, id: Optional[str] = None, rev: Optional[str] = None, label: Optional[str] = None, short_description: Optional[str] = None, catalog_icon_url: Optional[str] = None, tags: Optional[List[str]] = None, features: Optional[List[ibm_platform_services.catalog_management_v1.Feature]] = None, disabled: Optional[bool] = None, resource_group_id: Optional[str] = None, owning_account: Optional[str] = None, catalog_filters: Optional[ibm_platform_services.catalog_management_v1.Filters] = None, syndication_settings: Optional[ibm_platform_services.catalog_management_v1.SyndicationResource] = None, kind: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,400
|
ibm_platform_services.catalog_management_v1
|
replace_object
|
Update catalog object.
Update an object within a specific catalog.
:param str catalog_identifier: Catalog identifier.
:param str object_identifier: Object identifier.
:param str id: (optional) unique id.
:param str name: (optional) The programmatic name of this offering.
:param str rev: (optional) Cloudant revision.
:param str crn: (optional) The crn for this specific object.
:param str url: (optional) The url for this specific object.
:param str parent_id: (optional) The parent for this specific object.
:param str label_i18n: (optional) Translated display name in the requested
language.
:param str label: (optional) Display name in the requested language.
:param List[str] tags: (optional) List of tags associated with this
catalog.
:param datetime created: (optional) The date and time this catalog was
created.
:param datetime updated: (optional) The date and time this catalog was last
updated.
:param str short_description: (optional) Short description in the requested
language.
:param str short_description_i18n: (optional) Short description
translation.
:param str kind: (optional) Kind of object.
:param PublishObject publish: (optional) Publish information.
:param State state: (optional) Offering state.
:param str catalog_id: (optional) The id of the catalog containing this
offering.
:param str catalog_name: (optional) The name of the catalog.
:param dict data: (optional) Map of data values for this object.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogObject` object
|
def replace_object(
self,
catalog_identifier: str,
object_identifier: str,
*,
id: str = None,
name: str = None,
rev: str = None,
crn: str = None,
url: str = None,
parent_id: str = None,
label_i18n: str = None,
label: str = None,
tags: List[str] = None,
created: datetime = None,
updated: datetime = None,
short_description: str = None,
short_description_i18n: str = None,
kind: str = None,
publish: 'PublishObject' = None,
state: 'State' = None,
catalog_id: str = None,
catalog_name: str = None,
data: dict = None,
**kwargs
) -> DetailedResponse:
"""
Update catalog object.
Update an object within a specific catalog.
:param str catalog_identifier: Catalog identifier.
:param str object_identifier: Object identifier.
:param str id: (optional) unique id.
:param str name: (optional) The programmatic name of this offering.
:param str rev: (optional) Cloudant revision.
:param str crn: (optional) The crn for this specific object.
:param str url: (optional) The url for this specific object.
:param str parent_id: (optional) The parent for this specific object.
:param str label_i18n: (optional) Translated display name in the requested
language.
:param str label: (optional) Display name in the requested language.
:param List[str] tags: (optional) List of tags associated with this
catalog.
:param datetime created: (optional) The date and time this catalog was
created.
:param datetime updated: (optional) The date and time this catalog was last
updated.
:param str short_description: (optional) Short description in the requested
language.
:param str short_description_i18n: (optional) Short description
translation.
:param str kind: (optional) Kind of object.
:param PublishObject publish: (optional) Publish information.
:param State state: (optional) Offering state.
:param str catalog_id: (optional) The id of the catalog containing this
offering.
:param str catalog_name: (optional) The name of the catalog.
:param dict data: (optional) Map of data values for this object.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogObject` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if object_identifier is None:
raise ValueError('object_identifier must be provided')
if created is not None:
created = datetime_to_string(created)
if updated is not None:
updated = datetime_to_string(updated)
if publish is not None:
publish = convert_model(publish)
if state is not None:
state = convert_model(state)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_object'
)
headers.update(sdk_headers)
data = {
'id': id,
'name': name,
'_rev': rev,
'crn': crn,
'url': url,
'parent_id': parent_id,
'label_i18n': label_i18n,
'label': label,
'tags': tags,
'created': created,
'updated': updated,
'short_description': short_description,
'short_description_i18n': short_description_i18n,
'kind': kind,
'publish': publish,
'state': state,
'catalog_id': catalog_id,
'catalog_name': catalog_name,
'data': data,
}
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 = ['catalog_identifier', 'object_identifier']
path_param_values = self.encode_path_vars(catalog_identifier, object_identifier)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/objects/{object_identifier}'.format(**path_param_dict)
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, object_identifier: str, *, id: Optional[str] = None, name: Optional[str] = None, rev: Optional[str] = None, crn: Optional[str] = None, url: Optional[str] = None, parent_id: Optional[str] = None, label_i18n: Optional[str] = None, label: Optional[str] = None, tags: Optional[List[str]] = None, created: Optional[datetime.datetime] = None, updated: Optional[datetime.datetime] = None, short_description: Optional[str] = None, short_description_i18n: Optional[str] = None, kind: Optional[str] = None, publish: Optional[ibm_platform_services.catalog_management_v1.PublishObject] = None, state: Optional[ibm_platform_services.catalog_management_v1.State] = None, catalog_id: Optional[str] = None, catalog_name: Optional[str] = None, data: Optional[dict] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,401
|
ibm_platform_services.catalog_management_v1
|
replace_offering
|
Update offering.
Update an offering.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str id: (optional) unique id.
:param str rev: (optional) Cloudant revision.
:param str url: (optional) The url for this specific offering.
:param str crn: (optional) The crn for this specific offering.
:param str label: (optional) Display Name in the requested language.
:param str name: (optional) The programmatic name of this offering.
:param str offering_icon_url: (optional) URL for an icon associated with
this offering.
:param str offering_docs_url: (optional) URL for an additional docs with
this offering.
:param str offering_support_url: (optional) [deprecated] - Use
offering.support instead. URL to be displayed in the Consumption UI for
getting support on this offering.
:param List[str] tags: (optional) List of tags associated with this
catalog.
:param List[str] keywords: (optional) List of keywords associated with
offering, typically used to search for it.
:param Rating rating: (optional) Repository info for offerings.
:param datetime created: (optional) The date and time this catalog was
created.
:param datetime updated: (optional) The date and time this catalog was last
updated.
:param str short_description: (optional) Short description in the requested
language.
:param str long_description: (optional) Long description in the requested
language.
:param List[Feature] features: (optional) list of features associated with
this offering.
:param List[Kind] kinds: (optional) Array of kind.
:param bool permit_request_ibm_public_publish: (optional) Is it permitted
to request publishing to IBM or Public.
:param bool ibm_publish_approved: (optional) Indicates if this offering has
been approved for use by all IBMers.
:param bool public_publish_approved: (optional) Indicates if this offering
has been approved for use by all IBM Cloud users.
:param str public_original_crn: (optional) The original offering CRN that
this publish entry came from.
:param str publish_public_crn: (optional) The crn of the public catalog
entry of this offering.
:param str portal_approval_record: (optional) The portal's approval record
ID.
:param str portal_ui_url: (optional) The portal UI URL.
:param str catalog_id: (optional) The id of the catalog containing this
offering.
:param str catalog_name: (optional) The name of the catalog.
:param dict metadata: (optional) Map of metadata values for this offering.
:param str disclaimer: (optional) A disclaimer for this offering.
:param bool hidden: (optional) Determine if this offering should be
displayed in the Consumption UI.
:param str provider: (optional) Deprecated - Provider of this offering.
:param ProviderInfo provider_info: (optional) Information on the provider
for this offering, or omitted if no provider information is given.
:param RepoInfo repo_info: (optional) Repository info for offerings.
:param Support support: (optional) Offering Support information.
:param List[MediaItem] media: (optional) A list of media items related to
this offering.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
|
def replace_offering(
self,
catalog_identifier: str,
offering_id: str,
*,
id: str = None,
rev: str = None,
url: str = None,
crn: str = None,
label: str = None,
name: str = None,
offering_icon_url: str = None,
offering_docs_url: str = None,
offering_support_url: str = None,
tags: List[str] = None,
keywords: List[str] = None,
rating: 'Rating' = None,
created: datetime = None,
updated: datetime = None,
short_description: str = None,
long_description: str = None,
features: List['Feature'] = None,
kinds: List['Kind'] = None,
permit_request_ibm_public_publish: bool = None,
ibm_publish_approved: bool = None,
public_publish_approved: bool = None,
public_original_crn: str = None,
publish_public_crn: str = None,
portal_approval_record: str = None,
portal_ui_url: str = None,
catalog_id: str = None,
catalog_name: str = None,
metadata: dict = None,
disclaimer: str = None,
hidden: bool = None,
provider: str = None,
provider_info: 'ProviderInfo' = None,
repo_info: 'RepoInfo' = None,
support: 'Support' = None,
media: List['MediaItem'] = None,
**kwargs
) -> DetailedResponse:
"""
Update offering.
Update an offering.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str id: (optional) unique id.
:param str rev: (optional) Cloudant revision.
:param str url: (optional) The url for this specific offering.
:param str crn: (optional) The crn for this specific offering.
:param str label: (optional) Display Name in the requested language.
:param str name: (optional) The programmatic name of this offering.
:param str offering_icon_url: (optional) URL for an icon associated with
this offering.
:param str offering_docs_url: (optional) URL for an additional docs with
this offering.
:param str offering_support_url: (optional) [deprecated] - Use
offering.support instead. URL to be displayed in the Consumption UI for
getting support on this offering.
:param List[str] tags: (optional) List of tags associated with this
catalog.
:param List[str] keywords: (optional) List of keywords associated with
offering, typically used to search for it.
:param Rating rating: (optional) Repository info for offerings.
:param datetime created: (optional) The date and time this catalog was
created.
:param datetime updated: (optional) The date and time this catalog was last
updated.
:param str short_description: (optional) Short description in the requested
language.
:param str long_description: (optional) Long description in the requested
language.
:param List[Feature] features: (optional) list of features associated with
this offering.
:param List[Kind] kinds: (optional) Array of kind.
:param bool permit_request_ibm_public_publish: (optional) Is it permitted
to request publishing to IBM or Public.
:param bool ibm_publish_approved: (optional) Indicates if this offering has
been approved for use by all IBMers.
:param bool public_publish_approved: (optional) Indicates if this offering
has been approved for use by all IBM Cloud users.
:param str public_original_crn: (optional) The original offering CRN that
this publish entry came from.
:param str publish_public_crn: (optional) The crn of the public catalog
entry of this offering.
:param str portal_approval_record: (optional) The portal's approval record
ID.
:param str portal_ui_url: (optional) The portal UI URL.
:param str catalog_id: (optional) The id of the catalog containing this
offering.
:param str catalog_name: (optional) The name of the catalog.
:param dict metadata: (optional) Map of metadata values for this offering.
:param str disclaimer: (optional) A disclaimer for this offering.
:param bool hidden: (optional) Determine if this offering should be
displayed in the Consumption UI.
:param str provider: (optional) Deprecated - Provider of this offering.
:param ProviderInfo provider_info: (optional) Information on the provider
for this offering, or omitted if no provider information is given.
:param RepoInfo repo_info: (optional) Repository info for offerings.
:param Support support: (optional) Offering Support information.
:param List[MediaItem] media: (optional) A list of media items related to
this offering.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if offering_id is None:
raise ValueError('offering_id must be provided')
if rating is not None:
rating = convert_model(rating)
if created is not None:
created = datetime_to_string(created)
if updated is not None:
updated = datetime_to_string(updated)
if features is not None:
features = [convert_model(x) for x in features]
if kinds is not None:
kinds = [convert_model(x) for x in kinds]
if provider_info is not None:
provider_info = convert_model(provider_info)
if repo_info is not None:
repo_info = convert_model(repo_info)
if support is not None:
support = convert_model(support)
if media is not None:
media = [convert_model(x) for x in media]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_offering'
)
headers.update(sdk_headers)
data = {
'id': id,
'_rev': rev,
'url': url,
'crn': crn,
'label': label,
'name': name,
'offering_icon_url': offering_icon_url,
'offering_docs_url': offering_docs_url,
'offering_support_url': offering_support_url,
'tags': tags,
'keywords': keywords,
'rating': rating,
'created': created,
'updated': updated,
'short_description': short_description,
'long_description': long_description,
'features': features,
'kinds': kinds,
'permit_request_ibm_public_publish': permit_request_ibm_public_publish,
'ibm_publish_approved': ibm_publish_approved,
'public_publish_approved': public_publish_approved,
'public_original_crn': public_original_crn,
'publish_public_crn': publish_public_crn,
'portal_approval_record': portal_approval_record,
'portal_ui_url': portal_ui_url,
'catalog_id': catalog_id,
'catalog_name': catalog_name,
'metadata': metadata,
'disclaimer': disclaimer,
'hidden': hidden,
'provider': provider,
'provider_info': provider_info,
'repo_info': repo_info,
'support': support,
'media': media,
}
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 = ['catalog_identifier', 'offering_id']
path_param_values = self.encode_path_vars(catalog_identifier, offering_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/offerings/{offering_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, catalog_identifier: str, offering_id: str, *, id: Optional[str] = None, rev: Optional[str] = None, url: Optional[str] = None, crn: Optional[str] = None, label: Optional[str] = None, name: Optional[str] = None, offering_icon_url: Optional[str] = None, offering_docs_url: Optional[str] = None, offering_support_url: Optional[str] = None, tags: Optional[List[str]] = None, keywords: Optional[List[str]] = None, rating: Optional[ibm_platform_services.catalog_management_v1.Rating] = None, created: Optional[datetime.datetime] = None, updated: Optional[datetime.datetime] = None, short_description: Optional[str] = None, long_description: Optional[str] = None, features: Optional[List[ibm_platform_services.catalog_management_v1.Feature]] = None, kinds: Optional[List[ibm_platform_services.catalog_management_v1.Kind]] = None, permit_request_ibm_public_publish: Optional[bool] = None, ibm_publish_approved: Optional[bool] = None, public_publish_approved: Optional[bool] = None, public_original_crn: Optional[str] = None, publish_public_crn: Optional[str] = None, portal_approval_record: Optional[str] = None, portal_ui_url: Optional[str] = None, catalog_id: Optional[str] = None, catalog_name: Optional[str] = None, metadata: Optional[dict] = None, disclaimer: Optional[str] = None, hidden: Optional[bool] = None, provider: Optional[str] = None, provider_info: Optional[ibm_platform_services.catalog_management_v1.ProviderInfo] = None, repo_info: Optional[ibm_platform_services.catalog_management_v1.RepoInfo] = None, support: Optional[ibm_platform_services.catalog_management_v1.Support] = None, media: Optional[List[ibm_platform_services.catalog_management_v1.MediaItem]] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,402
|
ibm_platform_services.catalog_management_v1
|
replace_offering_icon
|
Upload icon for offering.
Upload an icon file to be stored in GC. File is uploaded as a binary payload - not
as a form.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str file_name: Name of the file name that is being uploaded.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
|
def replace_offering_icon(
self, catalog_identifier: str, offering_id: str, file_name: str, **kwargs
) -> DetailedResponse:
"""
Upload icon for offering.
Upload an icon file to be stored in GC. File is uploaded as a binary payload - not
as a form.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str file_name: Name of the file name that is being uploaded.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Offering` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if offering_id is None:
raise ValueError('offering_id must be provided')
if file_name is None:
raise ValueError('file_name must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_offering_icon'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['catalog_identifier', 'offering_id', 'file_name']
path_param_values = self.encode_path_vars(catalog_identifier, offering_id, file_name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/offerings/{offering_id}/icon/{file_name}'.format(**path_param_dict)
request = self.prepare_request(method='PUT', url=url, headers=headers)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, offering_id: str, file_name: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,403
|
ibm_platform_services.catalog_management_v1
|
replace_operators
|
Update operators.
Update the operators on a kubernetes cluster.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: (optional) Cluster ID.
:param str region: (optional) Cluster region.
:param List[str] namespaces: (optional) Kube namespaces to deploy
Operator(s) to.
:param bool all_namespaces: (optional) Denotes whether to install
Operator(s) globally.
:param str version_locator_id: (optional) A dotted value of
`catalogID`.`versionID`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `List[OperatorDeployResult]` result
|
def replace_operators(
self,
x_auth_refresh_token: str,
*,
cluster_id: str = None,
region: str = None,
namespaces: List[str] = None,
all_namespaces: bool = None,
version_locator_id: str = None,
**kwargs
) -> DetailedResponse:
"""
Update operators.
Update the operators on a kubernetes cluster.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: (optional) Cluster ID.
:param str region: (optional) Cluster region.
:param List[str] namespaces: (optional) Kube namespaces to deploy
Operator(s) to.
:param bool all_namespaces: (optional) Denotes whether to install
Operator(s) globally.
:param str version_locator_id: (optional) A dotted value of
`catalogID`.`versionID`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `List[OperatorDeployResult]` result
"""
if x_auth_refresh_token is None:
raise ValueError('x_auth_refresh_token must be provided')
headers = {'X-Auth-Refresh-Token': x_auth_refresh_token}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='replace_operators'
)
headers.update(sdk_headers)
data = {
'cluster_id': cluster_id,
'region': region,
'namespaces': namespaces,
'all_namespaces': all_namespaces,
'version_locator_id': version_locator_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 = '/deploy/kubernetes/olm/operator'
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, x_auth_refresh_token: str, *, cluster_id: Optional[str] = None, region: Optional[str] = None, namespaces: Optional[List[str]] = None, all_namespaces: Optional[bool] = None, version_locator_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,404
|
ibm_platform_services.catalog_management_v1
|
search_objects
|
List objects across catalogs.
List the available objects from both public and private catalogs. These copies
cannot be used for updating. They are not complete and only return what is visible
to the caller.
:param str query: Lucene query string.
:param int limit: (optional) The maximum number of results to return.
:param int offset: (optional) The number of results to skip before
returning values.
:param bool collapse: (optional) When true, hide private objects that
correspond to public or IBM published objects.
:param bool digest: (optional) Display a digests of search results, has
default value of true.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ObjectSearchResult` object
|
def search_objects(
self, query: str, *, limit: int = None, offset: int = None, collapse: bool = None, digest: bool = None, **kwargs
) -> DetailedResponse:
"""
List objects across catalogs.
List the available objects from both public and private catalogs. These copies
cannot be used for updating. They are not complete and only return what is visible
to the caller.
:param str query: Lucene query string.
:param int limit: (optional) The maximum number of results to return.
:param int offset: (optional) The number of results to skip before
returning values.
:param bool collapse: (optional) When true, hide private objects that
correspond to public or IBM published objects.
:param bool digest: (optional) Display a digests of search results, has
default value of true.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ObjectSearchResult` object
"""
if query is None:
raise ValueError('query must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='search_objects'
)
headers.update(sdk_headers)
params = {'query': query, 'limit': limit, 'offset': offset, 'collapse': collapse, 'digest': digest}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
url = '/objects'
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request, **kwargs)
return response
|
(self, query: str, *, limit: Optional[int] = None, offset: Optional[int] = None, collapse: Optional[bool] = None, digest: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,407
|
ibm_platform_services.catalog_management_v1
|
set_deprecate_version
|
Sets version to be deprecated in a certain time period.
Set or cancel the version to be deprecated.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param str setting: Set deprecation (true) or cancel deprecation (false).
:param str description: (optional) Additional information that users can
provide to be displayed in deprecation notification.
:param int days_until_deprecate: (optional) Specifies the amount of days
until product is not available in catalog.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def set_deprecate_version(
self, version_loc_id: str, setting: str, *, description: str = None, days_until_deprecate: int = None, **kwargs
) -> DetailedResponse:
"""
Sets version to be deprecated in a certain time period.
Set or cancel the version to be deprecated.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param str setting: Set deprecation (true) or cancel deprecation (false).
:param str description: (optional) Additional information that users can
provide to be displayed in deprecation notification.
:param int days_until_deprecate: (optional) Specifies the amount of days
until product is not available in catalog.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if version_loc_id is None:
raise ValueError('version_loc_id must be provided')
if setting is None:
raise ValueError('setting must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='set_deprecate_version'
)
headers.update(sdk_headers)
data = {'description': description, 'days_until_deprecate': days_until_deprecate}
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'))
path_param_keys = ['version_loc_id', 'setting']
path_param_values = self.encode_path_vars(version_loc_id, setting)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/versions/{version_loc_id}/deprecate/{setting}'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, version_loc_id: str, setting: str, *, description: Optional[str] = None, days_until_deprecate: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,413
|
ibm_platform_services.catalog_management_v1
|
shared_publish_object
|
Publish object to share with allow list.
Publish the specified object so that it is visible to those in the allow list.
:param str catalog_identifier: Catalog identifier.
:param str object_identifier: Object identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def shared_publish_object(self, catalog_identifier: str, object_identifier: str, **kwargs) -> DetailedResponse:
"""
Publish object to share with allow list.
Publish the specified object so that it is visible to those in the allow list.
:param str catalog_identifier: Catalog identifier.
:param str object_identifier: Object identifier.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if object_identifier is None:
raise ValueError('object_identifier must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='shared_publish_object'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
path_param_keys = ['catalog_identifier', 'object_identifier']
path_param_values = self.encode_path_vars(catalog_identifier, object_identifier)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/objects/{object_identifier}/shared-publish'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, object_identifier: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,414
|
ibm_platform_services.catalog_management_v1
|
update_catalog_account
|
Update account settings.
Update the account level settings for the account for private catalog.
:param str id: (optional) Account identification.
:param bool hide_ibm_cloud_catalog: (optional) Hide the public catalog in
this account.
:param Filters account_filters: (optional) Filters for account and catalog
filters.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def update_catalog_account(
self, *, id: str = None, hide_ibm_cloud_catalog: bool = None, account_filters: 'Filters' = None, **kwargs
) -> DetailedResponse:
"""
Update account settings.
Update the account level settings for the account for private catalog.
:param str id: (optional) Account identification.
:param bool hide_ibm_cloud_catalog: (optional) Hide the public catalog in
this account.
:param Filters account_filters: (optional) Filters for account and catalog
filters.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if account_filters is not None:
account_filters = convert_model(account_filters)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_catalog_account'
)
headers.update(sdk_headers)
data = {'id': id, 'hide_IBM_cloud_catalog': hide_ibm_cloud_catalog, 'account_filters': account_filters}
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'))
url = '/catalogaccount'
request = self.prepare_request(method='PUT', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, *, id: Optional[str] = None, hide_ibm_cloud_catalog: Optional[bool] = None, account_filters: Optional[ibm_platform_services.catalog_management_v1.Filters] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,415
|
ibm_platform_services.catalog_management_v1
|
update_offering
|
Update offering.
Update an offering.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str if_match: Offering etag contained in quotes.
:param List[JsonPatchOperation] updates: (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 `Offering` object
|
def update_offering(
self,
catalog_identifier: str,
offering_id: str,
if_match: str,
*,
updates: List['JsonPatchOperation'] = None,
**kwargs
) -> DetailedResponse:
"""
Update offering.
Update an offering.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str if_match: Offering etag contained in quotes.
:param List[JsonPatchOperation] updates: (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 `Offering` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if offering_id is None:
raise ValueError('offering_id must be provided')
if if_match is None:
raise ValueError('if_match must be provided')
if updates is not None:
updates = [convert_model(x) for x in updates]
headers = {'If-Match': if_match}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_offering'
)
headers.update(sdk_headers)
data = json.dumps(updates)
headers['content-type'] = 'application/json-patch+json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['catalog_identifier', 'offering_id']
path_param_values = self.encode_path_vars(catalog_identifier, offering_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/offerings/{offering_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, catalog_identifier: str, offering_id: str, if_match: str, *, updates: Optional[List[ibm_platform_services.catalog_management_v1.JsonPatchOperation]] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,416
|
ibm_platform_services.catalog_management_v1
|
update_offering_ibm
|
Allow offering to be published.
Approve or disapprove the offering to be allowed to publish to the IBM Public
Catalog. Options:
* `allow_request` - (Allow requesting to publish to IBM)
* `ibm` - (Allow publishing to be visible to IBM only)
* `public` - (Allow publishing to be visible to everyone, including IBM)
If disapprove `public`, then `ibm` approval will not be changed. If disapprove
`ibm` then `public` will automatically be disapproved. if disapprove
`allow_request` then all rights to publish will be removed. This is because the
process steps always go first through `allow` to `ibm` and then to `public`. `ibm`
cannot be skipped. Only users with Approval IAM authority can use this. Approvers
should use the catalog and offering id from the public catalog since they wouldn't
have access to the private offering.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str approval_type: Type of approval, ibm or public.
:param str approved: Approve (true) or disapprove (false).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApprovalResult` object
|
def update_offering_ibm(
self, catalog_identifier: str, offering_id: str, approval_type: str, approved: str, **kwargs
) -> DetailedResponse:
"""
Allow offering to be published.
Approve or disapprove the offering to be allowed to publish to the IBM Public
Catalog. Options:
* `allow_request` - (Allow requesting to publish to IBM)
* `ibm` - (Allow publishing to be visible to IBM only)
* `public` - (Allow publishing to be visible to everyone, including IBM)
If disapprove `public`, then `ibm` approval will not be changed. If disapprove
`ibm` then `public` will automatically be disapproved. if disapprove
`allow_request` then all rights to publish will be removed. This is because the
process steps always go first through `allow` to `ibm` and then to `public`. `ibm`
cannot be skipped. Only users with Approval IAM authority can use this. Approvers
should use the catalog and offering id from the public catalog since they wouldn't
have access to the private offering.
:param str catalog_identifier: Catalog identifier.
:param str offering_id: Offering identification.
:param str approval_type: Type of approval, ibm or public.
:param str approved: Approve (true) or disapprove (false).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApprovalResult` object
"""
if catalog_identifier is None:
raise ValueError('catalog_identifier must be provided')
if offering_id is None:
raise ValueError('offering_id must be provided')
if approval_type is None:
raise ValueError('approval_type must be provided')
if approved is None:
raise ValueError('approved must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_offering_ibm'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['catalog_identifier', 'offering_id', 'approval_type', 'approved']
path_param_values = self.encode_path_vars(catalog_identifier, offering_id, approval_type, approved)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/catalogs/{catalog_identifier}/offerings/{offering_id}/publish/{approval_type}/{approved}'.format(
**path_param_dict
)
request = self.prepare_request(method='POST', url=url, headers=headers)
response = self.send(request, **kwargs)
return response
|
(self, catalog_identifier: str, offering_id: str, approval_type: str, approved: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,417
|
ibm_platform_services.catalog_management_v1
|
validate_install
|
Validate offering.
Validate the offering associated with the specified version.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: (optional) Cluster ID.
:param str region: (optional) Cluster region.
:param str namespace: (optional) Kube namespace.
:param dict override_values: (optional) Object containing Helm chart
override values. To use a secret for items of type password, specify a
JSON encoded value of $ref:#/components/schemas/SecretInstance, prefixed
with `cmsm_v1:`.
:param str entitlement_apikey: (optional) Entitlement API Key for this
offering.
:param DeployRequestBodySchematics schematics: (optional) Schematics
workspace configuration.
:param str script: (optional) Script.
:param str script_id: (optional) Script ID.
:param str version_locator_id: (optional) A dotted value of
`catalogID`.`versionID`.
:param str vcenter_id: (optional) VCenter ID.
:param str vcenter_user: (optional) VCenter User.
:param str vcenter_password: (optional) VCenter Password.
:param str vcenter_location: (optional) VCenter Location.
:param str vcenter_datastore: (optional) VCenter Datastore.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def validate_install(
self,
version_loc_id: str,
x_auth_refresh_token: str,
*,
cluster_id: str = None,
region: str = None,
namespace: str = None,
override_values: dict = None,
entitlement_apikey: str = None,
schematics: 'DeployRequestBodySchematics' = None,
script: str = None,
script_id: str = None,
version_locator_id: str = None,
vcenter_id: str = None,
vcenter_user: str = None,
vcenter_password: str = None,
vcenter_location: str = None,
vcenter_datastore: str = None,
**kwargs
) -> DetailedResponse:
"""
Validate offering.
Validate the offering associated with the specified version.
:param str version_loc_id: A dotted value of `catalogID`.`versionID`.
:param str x_auth_refresh_token: IAM Refresh token.
:param str cluster_id: (optional) Cluster ID.
:param str region: (optional) Cluster region.
:param str namespace: (optional) Kube namespace.
:param dict override_values: (optional) Object containing Helm chart
override values. To use a secret for items of type password, specify a
JSON encoded value of $ref:#/components/schemas/SecretInstance, prefixed
with `cmsm_v1:`.
:param str entitlement_apikey: (optional) Entitlement API Key for this
offering.
:param DeployRequestBodySchematics schematics: (optional) Schematics
workspace configuration.
:param str script: (optional) Script.
:param str script_id: (optional) Script ID.
:param str version_locator_id: (optional) A dotted value of
`catalogID`.`versionID`.
:param str vcenter_id: (optional) VCenter ID.
:param str vcenter_user: (optional) VCenter User.
:param str vcenter_password: (optional) VCenter Password.
:param str vcenter_location: (optional) VCenter Location.
:param str vcenter_datastore: (optional) VCenter Datastore.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if version_loc_id is None:
raise ValueError('version_loc_id must be provided')
if x_auth_refresh_token is None:
raise ValueError('x_auth_refresh_token must be provided')
if schematics is not None:
schematics = convert_model(schematics)
headers = {'X-Auth-Refresh-Token': x_auth_refresh_token}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='validate_install'
)
headers.update(sdk_headers)
data = {
'cluster_id': cluster_id,
'region': region,
'namespace': namespace,
'override_values': override_values,
'entitlement_apikey': entitlement_apikey,
'schematics': schematics,
'script': script,
'script_id': script_id,
'version_locator_id': version_locator_id,
'vcenter_id': vcenter_id,
'vcenter_user': vcenter_user,
'vcenter_password': vcenter_password,
'vcenter_location': vcenter_location,
'vcenter_datastore': vcenter_datastore,
}
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'))
path_param_keys = ['version_loc_id']
path_param_values = self.encode_path_vars(version_loc_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/versions/{version_loc_id}/validation/install'.format(**path_param_dict)
request = self.prepare_request(method='POST', url=url, headers=headers, data=data)
response = self.send(request, **kwargs)
return response
|
(self, version_loc_id: str, x_auth_refresh_token: str, *, cluster_id: Optional[str] = None, region: Optional[str] = None, namespace: Optional[str] = None, override_values: Optional[dict] = None, entitlement_apikey: Optional[str] = None, schematics: Optional[ibm_platform_services.catalog_management_v1.DeployRequestBodySchematics] = None, script: Optional[str] = None, script_id: Optional[str] = None, version_locator_id: Optional[str] = None, vcenter_id: Optional[str] = None, vcenter_user: Optional[str] = None, vcenter_password: Optional[str] = None, vcenter_location: Optional[str] = None, vcenter_datastore: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,425
|
ibm_platform_services.enterprise_billing_units_v1
|
EnterpriseBillingUnitsV1
|
The Enterprise Billing Units V1 service.
|
class EnterpriseBillingUnitsV1(BaseService):
"""The Enterprise Billing Units V1 service."""
DEFAULT_SERVICE_URL = 'https://billing.cloud.ibm.com'
DEFAULT_SERVICE_NAME = 'enterprise_billing_units'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'EnterpriseBillingUnitsV1':
"""
Return a new client for the Enterprise 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 Enterprise 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 Units
#########################
def get_billing_unit(self, billing_unit_id: str, **kwargs) -> DetailedResponse:
"""
Get billing unit by ID.
Return the billing unit information if it exists.
:param str billing_unit_id: The ID of the requested billing unit.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingUnit` object
"""
if not billing_unit_id:
raise ValueError('billing_unit_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_billing_unit'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['billing_unit_id']
path_param_values = self.encode_path_vars(billing_unit_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/billing-units/{billing_unit_id}'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers)
response = self.send(request, **kwargs)
return response
def list_billing_units(
self,
*,
account_id: str = None,
enterprise_id: str = None,
account_group_id: str = None,
limit: int = None,
start: str = None,
**kwargs,
) -> DetailedResponse:
"""
List billing units.
Return matching billing unit information if any exists. Omits internal properties
and enterprise account ID from the billing unit.
:param str account_id: (optional) The enterprise account ID.
:param str enterprise_id: (optional) The enterprise ID.
:param str account_group_id: (optional) The account group ID.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingUnitsList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_billing_units'
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'enterprise_id': enterprise_id,
'account_group_id': account_group_id,
'limit': limit,
'start': start,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/billing-units'
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request, **kwargs)
return response
#########################
# Billing Options
#########################
def list_billing_options(
self, billing_unit_id: str, *, limit: int = None, start: str = None, **kwargs
) -> DetailedResponse:
"""
List billing options.
Return matching billing options if any exist. Show subscriptions and promotional
offers that are available to a billing unit.
:param str billing_unit_id: The billing unit ID.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingOptionsList` object
"""
if not billing_unit_id:
raise ValueError('billing_unit_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_billing_options'
)
headers.update(sdk_headers)
params = {
'billing_unit_id': billing_unit_id,
'limit': limit,
'start': start,
}
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(
self,
billing_unit_id: str,
*,
date: str = None,
type: str = None,
limit: int = None,
start: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get credit pools.
Get credit pools for a billing unit. Credit pools can be either platform or
support credit pools. The platform credit pool contains credit from platform
subscriptions and promotional offers. The support credit pool contains credit from
support subscriptions.
:param str billing_unit_id: The ID of the billing unit.
:param str date: (optional) The date in the format of YYYY-MM.
:param str type: (optional) Filters the credit pool by type, either
`PLATFORM` or `SUPPORT`.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreditPoolsList` object
"""
if not billing_unit_id:
raise ValueError('billing_unit_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_credit_pools'
)
headers.update(sdk_headers)
params = {
'billing_unit_id': billing_unit_id,
'date': date,
'type': type,
'limit': limit,
'start': start,
}
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,426
|
ibm_platform_services.enterprise_billing_units_v1
|
__init__
|
Construct a new client for the Enterprise 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 Enterprise 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,436
|
ibm_platform_services.enterprise_billing_units_v1
|
get_billing_unit
|
Get billing unit by ID.
Return the billing unit information if it exists.
:param str billing_unit_id: The ID of the requested billing unit.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingUnit` object
|
def get_billing_unit(self, billing_unit_id: str, **kwargs) -> DetailedResponse:
"""
Get billing unit by ID.
Return the billing unit information if it exists.
:param str billing_unit_id: The ID of the requested billing unit.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingUnit` object
"""
if not billing_unit_id:
raise ValueError('billing_unit_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_billing_unit'
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['billing_unit_id']
path_param_values = self.encode_path_vars(billing_unit_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/billing-units/{billing_unit_id}'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers)
response = self.send(request, **kwargs)
return response
|
(self, billing_unit_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,437
|
ibm_platform_services.enterprise_billing_units_v1
|
get_credit_pools
|
Get credit pools.
Get credit pools for a billing unit. Credit pools can be either platform or
support credit pools. The platform credit pool contains credit from platform
subscriptions and promotional offers. The support credit pool contains credit from
support subscriptions.
:param str billing_unit_id: The ID of the billing unit.
:param str date: (optional) The date in the format of YYYY-MM.
:param str type: (optional) Filters the credit pool by type, either
`PLATFORM` or `SUPPORT`.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreditPoolsList` object
|
def get_credit_pools(
self,
billing_unit_id: str,
*,
date: str = None,
type: str = None,
limit: int = None,
start: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get credit pools.
Get credit pools for a billing unit. Credit pools can be either platform or
support credit pools. The platform credit pool contains credit from platform
subscriptions and promotional offers. The support credit pool contains credit from
support subscriptions.
:param str billing_unit_id: The ID of the billing unit.
:param str date: (optional) The date in the format of YYYY-MM.
:param str type: (optional) Filters the credit pool by type, either
`PLATFORM` or `SUPPORT`.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreditPoolsList` object
"""
if not billing_unit_id:
raise ValueError('billing_unit_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_credit_pools'
)
headers.update(sdk_headers)
params = {
'billing_unit_id': billing_unit_id,
'date': date,
'type': type,
'limit': limit,
'start': start,
}
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, billing_unit_id: str, *, date: Optional[str] = None, type: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,440
|
ibm_platform_services.enterprise_billing_units_v1
|
list_billing_options
|
List billing options.
Return matching billing options if any exist. Show subscriptions and promotional
offers that are available to a billing unit.
:param str billing_unit_id: The billing unit ID.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingOptionsList` object
|
def list_billing_options(
self, billing_unit_id: str, *, limit: int = None, start: str = None, **kwargs
) -> DetailedResponse:
"""
List billing options.
Return matching billing options if any exist. Show subscriptions and promotional
offers that are available to a billing unit.
:param str billing_unit_id: The billing unit ID.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingOptionsList` object
"""
if not billing_unit_id:
raise ValueError('billing_unit_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_billing_options'
)
headers.update(sdk_headers)
params = {
'billing_unit_id': billing_unit_id,
'limit': limit,
'start': start,
}
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, billing_unit_id: str, *, limit: Optional[int] = None, start: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,441
|
ibm_platform_services.enterprise_billing_units_v1
|
list_billing_units
|
List billing units.
Return matching billing unit information if any exists. Omits internal properties
and enterprise account ID from the billing unit.
:param str account_id: (optional) The enterprise account ID.
:param str enterprise_id: (optional) The enterprise ID.
:param str account_group_id: (optional) The account group ID.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingUnitsList` object
|
def list_billing_units(
self,
*,
account_id: str = None,
enterprise_id: str = None,
account_group_id: str = None,
limit: int = None,
start: str = None,
**kwargs,
) -> DetailedResponse:
"""
List billing units.
Return matching billing unit information if any exists. Omits internal properties
and enterprise account ID from the billing unit.
:param str account_id: (optional) The enterprise account ID.
:param str enterprise_id: (optional) The enterprise ID.
:param str account_group_id: (optional) The account group ID.
:param int limit: (optional) Return results up to this limit. Valid values
are between 0 and 100.
:param str start: (optional) The pagination offset. This represents the
index of the first returned result.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `BillingUnitsList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_billing_units'
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'enterprise_id': enterprise_id,
'account_group_id': account_group_id,
'limit': limit,
'start': start,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/billing-units'
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, enterprise_id: Optional[str] = None, account_group_id: Optional[str] = None, limit: Optional[int] = None, start: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,450
|
ibm_platform_services.enterprise_management_v1
|
EnterpriseManagementV1
|
The Enterprise Management V1 service.
|
class EnterpriseManagementV1(BaseService):
"""The Enterprise Management V1 service."""
DEFAULT_SERVICE_URL = 'https://enterprise.cloud.ibm.com/v1'
DEFAULT_SERVICE_NAME = 'enterprise_management'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'EnterpriseManagementV1':
"""
Return a new client for the Enterprise Management 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 Enterprise Management 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)
#########################
# Enterprise Operations
#########################
def create_enterprise(
self,
source_account_id: str,
name: str,
primary_contact_iam_id: str,
*,
domain: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create an enterprise.
Create a new enterprise, which you can use to centrally manage multiple accounts.
To create an enterprise, you must have an active Subscription account.
<br/><br/>The API creates an enterprise entity, which is the root of the
enterprise hierarchy. It also creates a new enterprise account that is used to
manage the enterprise. All subscriptions, support entitlements, credits, and
discounts from the source subscription account are migrated to the enterprise
account, and the source account becomes a child account in the hierarchy. The user
that you assign as the enterprise primary contact is also assigned as the owner of
the enterprise account.
:param str source_account_id: The ID of the account that is used to create
the enterprise.
:param str name: The name of the enterprise. This field must have 3 - 60
characters.
:param str primary_contact_iam_id: The IAM ID of the enterprise primary
contact, such as `IBMid-0123ABC`. The IAM ID must already exist.
:param str domain: (optional) A domain or subdomain for the enterprise,
such as `example.com` or `my.example.com`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateEnterpriseResponse` object
"""
if source_account_id is None:
raise ValueError('source_account_id must be provided')
if name is None:
raise ValueError('name must be provided')
if primary_contact_iam_id is None:
raise ValueError('primary_contact_iam_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_enterprise',
)
headers.update(sdk_headers)
data = {
'source_account_id': source_account_id,
'name': name,
'primary_contact_iam_id': primary_contact_iam_id,
'domain': domain,
}
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 = '/enterprises'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_enterprises(
self,
*,
enterprise_account_id: Optional[str] = None,
account_group_id: Optional[str] = None,
account_id: Optional[str] = None,
next_docid: Optional[str] = None,
limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
List enterprises.
Retrieve all enterprises for a given ID by passing the IDs on query parameters. If
no ID is passed, the enterprises for which the calling identity is the primary
contact are returned. You can use pagination parameters to filter the results.
<br/><br/>This method ensures that only the enterprises that the user has access
to are returned. Access can be controlled either through a policy on a specific
enterprise, or account-level platform services access roles, such as
Administrator, Editor, Operator, or Viewer. When you call the method with the
`enterprise_account_id` or `account_id` query parameter, the account ID in the
token is compared with that in the query parameter. If these account IDs match,
authentication isn't performed and the enterprise information is returned. If the
account IDs don't match, authentication is performed and only then is the
enterprise information returned in the response.
:param str enterprise_account_id: (optional) Get enterprises for a given
enterprise account ID.
:param str account_group_id: (optional) Get enterprises for a given account
group ID.
:param str account_id: (optional) Get enterprises for a given account ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListEnterprisesResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_enterprises',
)
headers.update(sdk_headers)
params = {
'enterprise_account_id': enterprise_account_id,
'account_group_id': account_group_id,
'account_id': account_id,
'next_docid': next_docid,
'limit': limit,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/enterprises'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_enterprise(
self,
enterprise_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get enterprise by ID.
Retrieve an enterprise by the `enterprise_id` parameter. All data related to the
enterprise is returned only if the caller has access to retrieve the enterprise.
:param str enterprise_id: The ID of the enterprise to retrieve.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Enterprise` object
"""
if not enterprise_id:
raise ValueError('enterprise_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_enterprise',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['enterprise_id']
path_param_values = self.encode_path_vars(enterprise_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/enterprises/{enterprise_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def update_enterprise(
self,
enterprise_id: str,
*,
name: Optional[str] = None,
domain: Optional[str] = None,
primary_contact_iam_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update an enterprise.
Update the name, domain, or IAM ID of the primary contact for an existing
enterprise. The new primary contact must already be a user in the enterprise
account.
:param str enterprise_id: The ID of the enterprise to retrieve.
:param str name: (optional) The new name of the enterprise. This field must
have 3 - 60 characters.
:param str domain: (optional) The new domain of the enterprise. This field
has a limit of 60 characters.
:param str primary_contact_iam_id: (optional) The IAM ID of the user to be
the new primary contact for the enterprise.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not enterprise_id:
raise ValueError('enterprise_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_enterprise',
)
headers.update(sdk_headers)
data = {
'name': name,
'domain': domain,
'primary_contact_iam_id': primary_contact_iam_id,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['enterprise_id']
path_param_values = self.encode_path_vars(enterprise_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/enterprises/{enterprise_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
#########################
# Account Operations
#########################
def import_account_to_enterprise(
self,
enterprise_id: str,
account_id: str,
*,
parent: Optional[str] = None,
billing_unit_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Import an account into an enterprise.
Import an existing stand-alone account into an enterprise. The existing account
can be any type: trial (`TRIAL`), Lite (`STANDARD`), Pay-As-You-Go (`PAYG`), or
Subscription (`SUBSCRIPTION`). In the case of a `SUBSCRIPTION` account, the
credits, promotional offers, and discounts are migrated to the billing unit of the
enterprise. For a billable account (`PAYG` or `SUBSCRIPTION`), the country and
currency code of the existing account and the billing unit of the enterprise must
match. The API returns a `202` response and performs asynchronous operations to
import the account into the enterprise. <br/></br>For more information about
impacts to the account, see [Adding accounts to an
enterprise](https://{DomainName}/docs/account?topic=account-enterprise-add).
:param str enterprise_id: The ID of the enterprise to import the
stand-alone account into.
:param str account_id: The ID of the existing stand-alone account to be
imported.
:param str parent: (optional) The CRN of the expected parent of the
imported account. The parent is the enterprise or account group that the
account is added to.
:param str billing_unit_id: (optional) The ID of the [billing
unit](/apidocs/enterprise-apis/billing-unit) to use for billing this
account in the enterprise.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not enterprise_id:
raise ValueError('enterprise_id must be provided')
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='V1',
operation_id='import_account_to_enterprise',
)
headers.update(sdk_headers)
data = {
'parent': parent,
'billing_unit_id': billing_unit_id,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['enterprise_id', 'account_id']
path_param_values = self.encode_path_vars(enterprise_id, account_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/enterprises/{enterprise_id}/import/accounts/{account_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def create_account(
self,
parent: str,
name: str,
owner_iam_id: str,
*,
traits: Optional['CreateAccountRequestTraits'] = None,
options: Optional['CreateAccountRequestOptions'] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a new account in an enterprise.
Create a new account as a part of an existing enterprise. The API creates an
account entity under the parent that is specified in the payload of the request.
The request also takes in the name and the owner of this new account. The owner
must have a valid IBMid that's registered with IBM Cloud, but they don't need to
be a user in the enterprise account.
:param str parent: The CRN of the parent under which the account will be
created. The parent can be an existing account group or the enterprise
itself.
:param str name: The name of the account. This field must have 3 - 60
characters.
:param str owner_iam_id: The IAM ID of the account owner, such as
`IBMid-0123ABC`. The IAM ID must already exist.
:param CreateAccountRequestTraits traits: (optional) The traits object can
be used to set properties on child accounts of an enterprise. You can pass
a field to opt-out of the default multi-factor authentication setting or
enable enterprise-managed IAM when creating a child account in the
enterprise. This is an optional field.
:param CreateAccountRequestOptions options: (optional) The options object
can be used to set properties on child accounts of an enterprise. You can
pass a field to to create IAM service id with IAM api keyg when creating a
child account in the enterprise. This is an optional field.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateAccountResponse` object
"""
if parent is None:
raise ValueError('parent must be provided')
if name is None:
raise ValueError('name must be provided')
if owner_iam_id is None:
raise ValueError('owner_iam_id must be provided')
if traits is not None:
traits = convert_model(traits)
if options is not None:
options = convert_model(options)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account',
)
headers.update(sdk_headers)
data = {
'parent': parent,
'name': name,
'owner_iam_id': owner_iam_id,
'traits': traits,
'options': options,
}
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 = '/accounts'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_accounts(
self,
*,
enterprise_id: Optional[str] = None,
account_group_id: Optional[str] = None,
next_docid: Optional[str] = None,
parent: Optional[str] = None,
limit: Optional[int] = None,
include_deleted: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List accounts.
Retrieve all accounts based on the values that are passed in the query parameters.
If no query parameter is passed, all of the accounts in the enterprise for which
the calling identity has access are returned. <br/><br/>You can use pagination
parameters to filter the results. The `limit` field can be used to limit the
number of results that are displayed for this method.<br/><br/>This method ensures
that only the accounts that the user has access to are returned. Access can be
controlled either through a policy on a specific account, or account-level
platform services access roles, such as Administrator, Editor, Operator, or
Viewer. When you call the method with the `enterprise_id`, `account_group_id` or
`parent` query parameter, all of the accounts that are immediate children of this
entity are returned. Authentication is performed on all the accounts before they
are returned to the user to ensure that only those accounts are returned to which
the calling identity has access to.
:param str enterprise_id: (optional) Get accounts that are either immediate
children or are a part of the hierarchy for a given enterprise ID.
:param str account_group_id: (optional) Get accounts that are either
immediate children or are a part of the hierarchy for a given account group
ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param str parent: (optional) Get accounts that are either immediate
children or are a part of the hierarchy for a given parent CRN.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param bool include_deleted: (optional) Include the deleted accounts from
an enterprise when used in conjunction with enterprise_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 `ListAccountsResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_accounts',
)
headers.update(sdk_headers)
params = {
'enterprise_id': enterprise_id,
'account_group_id': account_group_id,
'next_docid': next_docid,
'parent': parent,
'limit': limit,
'include_deleted': include_deleted,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/accounts'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_account(
self,
account_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get account by ID.
Retrieve an account by the `account_id` parameter. All data related to the account
is returned only if the caller has access to retrieve the account.
:param str account_id: The ID of the target account.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Account` 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='V1',
operation_id='get_account',
)
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']
path_param_values = self.encode_path_vars(account_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/accounts/{account_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def update_account(
self,
account_id: str,
parent: str,
**kwargs,
) -> DetailedResponse:
"""
Move an account within the enterprise.
Move an account to a different parent within the same enterprise.
:param str account_id: The ID of the target account.
:param str parent: The CRN of the new parent within the enterprise.
: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')
if parent is None:
raise ValueError('parent must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_account',
)
headers.update(sdk_headers)
data = {
'parent': parent,
}
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']
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 = '/accounts/{account_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_account(
self,
account_id: str,
**kwargs,
) -> DetailedResponse:
"""
Remove an account from its enterprise.
Remove an account from the enterprise its currently in. After an account is
removed, it will be canceled and cannot be reactivated.
:param str account_id: The ID of the target account.
: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='V1',
operation_id='delete_account',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
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 = '/accounts/{account_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# Account Group Operations
#########################
def create_account_group(
self,
parent: str,
name: str,
primary_contact_iam_id: str,
**kwargs,
) -> DetailedResponse:
"""
Create an account group.
Create a new account group, which can be used to group together multiple accounts.
To create an account group, you must have an existing enterprise. The API creates
an account group entity under the parent that is specified in the payload of the
request. The request also takes in the name and the primary contact of this new
account group.
:param str parent: The CRN of the parent under which the account group will
be created. The parent can be an existing account group or the enterprise
itself.
:param str name: The name of the account group. This field must have 3 - 60
characters.
:param str primary_contact_iam_id: The IAM ID of the primary contact for
this account group, such as `IBMid-0123ABC`. The IAM ID must already exist.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateAccountGroupResponse` object
"""
if parent is None:
raise ValueError('parent must be provided')
if name is None:
raise ValueError('name must be provided')
if primary_contact_iam_id is None:
raise ValueError('primary_contact_iam_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account_group',
)
headers.update(sdk_headers)
data = {
'parent': parent,
'name': name,
'primary_contact_iam_id': primary_contact_iam_id,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/account-groups'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_account_groups(
self,
*,
enterprise_id: Optional[str] = None,
parent_account_group_id: Optional[str] = None,
next_docid: Optional[str] = None,
parent: Optional[str] = None,
limit: Optional[int] = None,
include_deleted: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List account groups.
Retrieve all account groups based on the values that are passed in the query
parameters. If no query parameter is passed, all of the account groups in the
enterprise for which the calling identity has access are returned. <br/><br/>You
can use pagination parameters to filter the results. The `limit` field can be used
to limit the number of results that are displayed for this method.<br/><br/>This
method ensures that only the account groups that the user has access to are
returned. Access can be controlled either through a policy on a specific account
group, or account-level platform services access roles, such as Administrator,
Editor, Operator, or Viewer. When you call the method with the `enterprise_id`,
`parent_account_group_id` or `parent` query parameter, all of the account groups
that are immediate children of this entity are returned. Authentication is
performed on all account groups before they are returned to the user to ensure
that only those account groups are returned to which the calling identity has
access.
:param str enterprise_id: (optional) Get account groups that are either
immediate children or are a part of the hierarchy for a given enterprise
ID.
:param str parent_account_group_id: (optional) Get account groups that are
either immediate children or are a part of the hierarchy for a given
account group ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param str parent: (optional) Get account groups that are either immediate
children or are a part of the hierarchy for a given parent CRN.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param bool include_deleted: (optional) Include the deleted account groups
from an enterprise when used in conjunction with other query parameters.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListAccountGroupsResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_account_groups',
)
headers.update(sdk_headers)
params = {
'enterprise_id': enterprise_id,
'parent_account_group_id': parent_account_group_id,
'next_docid': next_docid,
'parent': parent,
'limit': limit,
'include_deleted': include_deleted,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/account-groups'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_account_group(
self,
account_group_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get account group by ID.
Retrieve an account by the `account_group_id` parameter. All data related to the
account group is returned only if the caller has access to retrieve the account
group.
:param str account_group_id: The ID of the account group to retrieve.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountGroup` object
"""
if not account_group_id:
raise ValueError('account_group_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_account_group',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['account_group_id']
path_param_values = self.encode_path_vars(account_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/account-groups/{account_group_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def update_account_group(
self,
account_group_id: str,
*,
name: Optional[str] = None,
primary_contact_iam_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update an account group.
Update the name or IAM ID of the primary contact for an existing account group.
The new primary contact must already be a user in the enterprise account.
:param str account_group_id: The ID of the account group to retrieve.
:param str name: (optional) The new name of the account group. This field
must have 3 - 60 characters.
:param str primary_contact_iam_id: (optional) The IAM ID of the user to be
the new primary contact for the account group.
: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_group_id:
raise ValueError('account_group_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_account_group',
)
headers.update(sdk_headers)
data = {
'name': name,
'primary_contact_iam_id': primary_contact_iam_id,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['account_group_id']
path_param_values = self.encode_path_vars(account_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/account-groups/{account_group_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_account_group(
self,
account_group_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete an account group from the enterprise.
Delete an existing account group from the enterprise. You can't delete an account
group that has child account groups, the delete request will fail. This API
doesn't perform a recursive delete on the child account groups, it only deletes
the current account group.
:param str account_group_id: The ID of the account group to retrieve.
: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_group_id:
raise ValueError('account_group_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_account_group',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['account_group_id']
path_param_values = self.encode_path_vars(account_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/account-groups/{account_group_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
|
719,451
|
ibm_platform_services.enterprise_management_v1
|
__init__
|
Construct a new client for the Enterprise Management 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 Enterprise Management 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,457
|
ibm_platform_services.enterprise_management_v1
|
create_account
|
Create a new account in an enterprise.
Create a new account as a part of an existing enterprise. The API creates an
account entity under the parent that is specified in the payload of the request.
The request also takes in the name and the owner of this new account. The owner
must have a valid IBMid that's registered with IBM Cloud, but they don't need to
be a user in the enterprise account.
:param str parent: The CRN of the parent under which the account will be
created. The parent can be an existing account group or the enterprise
itself.
:param str name: The name of the account. This field must have 3 - 60
characters.
:param str owner_iam_id: The IAM ID of the account owner, such as
`IBMid-0123ABC`. The IAM ID must already exist.
:param CreateAccountRequestTraits traits: (optional) The traits object can
be used to set properties on child accounts of an enterprise. You can pass
a field to opt-out of the default multi-factor authentication setting or
enable enterprise-managed IAM when creating a child account in the
enterprise. This is an optional field.
:param CreateAccountRequestOptions options: (optional) The options object
can be used to set properties on child accounts of an enterprise. You can
pass a field to to create IAM service id with IAM api keyg when creating a
child account in the enterprise. This is an optional field.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateAccountResponse` object
|
def create_account(
self,
parent: str,
name: str,
owner_iam_id: str,
*,
traits: Optional['CreateAccountRequestTraits'] = None,
options: Optional['CreateAccountRequestOptions'] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a new account in an enterprise.
Create a new account as a part of an existing enterprise. The API creates an
account entity under the parent that is specified in the payload of the request.
The request also takes in the name and the owner of this new account. The owner
must have a valid IBMid that's registered with IBM Cloud, but they don't need to
be a user in the enterprise account.
:param str parent: The CRN of the parent under which the account will be
created. The parent can be an existing account group or the enterprise
itself.
:param str name: The name of the account. This field must have 3 - 60
characters.
:param str owner_iam_id: The IAM ID of the account owner, such as
`IBMid-0123ABC`. The IAM ID must already exist.
:param CreateAccountRequestTraits traits: (optional) The traits object can
be used to set properties on child accounts of an enterprise. You can pass
a field to opt-out of the default multi-factor authentication setting or
enable enterprise-managed IAM when creating a child account in the
enterprise. This is an optional field.
:param CreateAccountRequestOptions options: (optional) The options object
can be used to set properties on child accounts of an enterprise. You can
pass a field to to create IAM service id with IAM api keyg when creating a
child account in the enterprise. This is an optional field.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateAccountResponse` object
"""
if parent is None:
raise ValueError('parent must be provided')
if name is None:
raise ValueError('name must be provided')
if owner_iam_id is None:
raise ValueError('owner_iam_id must be provided')
if traits is not None:
traits = convert_model(traits)
if options is not None:
options = convert_model(options)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account',
)
headers.update(sdk_headers)
data = {
'parent': parent,
'name': name,
'owner_iam_id': owner_iam_id,
'traits': traits,
'options': options,
}
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 = '/accounts'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, parent: str, name: str, owner_iam_id: str, *, traits: Optional[ibm_platform_services.enterprise_management_v1.CreateAccountRequestTraits] = None, options: Optional[ibm_platform_services.enterprise_management_v1.CreateAccountRequestOptions] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,458
|
ibm_platform_services.enterprise_management_v1
|
create_account_group
|
Create an account group.
Create a new account group, which can be used to group together multiple accounts.
To create an account group, you must have an existing enterprise. The API creates
an account group entity under the parent that is specified in the payload of the
request. The request also takes in the name and the primary contact of this new
account group.
:param str parent: The CRN of the parent under which the account group will
be created. The parent can be an existing account group or the enterprise
itself.
:param str name: The name of the account group. This field must have 3 - 60
characters.
:param str primary_contact_iam_id: The IAM ID of the primary contact for
this account group, such as `IBMid-0123ABC`. The IAM ID must already exist.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateAccountGroupResponse` object
|
def create_account_group(
self,
parent: str,
name: str,
primary_contact_iam_id: str,
**kwargs,
) -> DetailedResponse:
"""
Create an account group.
Create a new account group, which can be used to group together multiple accounts.
To create an account group, you must have an existing enterprise. The API creates
an account group entity under the parent that is specified in the payload of the
request. The request also takes in the name and the primary contact of this new
account group.
:param str parent: The CRN of the parent under which the account group will
be created. The parent can be an existing account group or the enterprise
itself.
:param str name: The name of the account group. This field must have 3 - 60
characters.
:param str primary_contact_iam_id: The IAM ID of the primary contact for
this account group, such as `IBMid-0123ABC`. The IAM ID must already exist.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateAccountGroupResponse` object
"""
if parent is None:
raise ValueError('parent must be provided')
if name is None:
raise ValueError('name must be provided')
if primary_contact_iam_id is None:
raise ValueError('primary_contact_iam_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account_group',
)
headers.update(sdk_headers)
data = {
'parent': parent,
'name': name,
'primary_contact_iam_id': primary_contact_iam_id,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/account-groups'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, parent: str, name: str, primary_contact_iam_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,459
|
ibm_platform_services.enterprise_management_v1
|
create_enterprise
|
Create an enterprise.
Create a new enterprise, which you can use to centrally manage multiple accounts.
To create an enterprise, you must have an active Subscription account.
<br/><br/>The API creates an enterprise entity, which is the root of the
enterprise hierarchy. It also creates a new enterprise account that is used to
manage the enterprise. All subscriptions, support entitlements, credits, and
discounts from the source subscription account are migrated to the enterprise
account, and the source account becomes a child account in the hierarchy. The user
that you assign as the enterprise primary contact is also assigned as the owner of
the enterprise account.
:param str source_account_id: The ID of the account that is used to create
the enterprise.
:param str name: The name of the enterprise. This field must have 3 - 60
characters.
:param str primary_contact_iam_id: The IAM ID of the enterprise primary
contact, such as `IBMid-0123ABC`. The IAM ID must already exist.
:param str domain: (optional) A domain or subdomain for the enterprise,
such as `example.com` or `my.example.com`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateEnterpriseResponse` object
|
def create_enterprise(
self,
source_account_id: str,
name: str,
primary_contact_iam_id: str,
*,
domain: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create an enterprise.
Create a new enterprise, which you can use to centrally manage multiple accounts.
To create an enterprise, you must have an active Subscription account.
<br/><br/>The API creates an enterprise entity, which is the root of the
enterprise hierarchy. It also creates a new enterprise account that is used to
manage the enterprise. All subscriptions, support entitlements, credits, and
discounts from the source subscription account are migrated to the enterprise
account, and the source account becomes a child account in the hierarchy. The user
that you assign as the enterprise primary contact is also assigned as the owner of
the enterprise account.
:param str source_account_id: The ID of the account that is used to create
the enterprise.
:param str name: The name of the enterprise. This field must have 3 - 60
characters.
:param str primary_contact_iam_id: The IAM ID of the enterprise primary
contact, such as `IBMid-0123ABC`. The IAM ID must already exist.
:param str domain: (optional) A domain or subdomain for the enterprise,
such as `example.com` or `my.example.com`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateEnterpriseResponse` object
"""
if source_account_id is None:
raise ValueError('source_account_id must be provided')
if name is None:
raise ValueError('name must be provided')
if primary_contact_iam_id is None:
raise ValueError('primary_contact_iam_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_enterprise',
)
headers.update(sdk_headers)
data = {
'source_account_id': source_account_id,
'name': name,
'primary_contact_iam_id': primary_contact_iam_id,
'domain': domain,
}
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 = '/enterprises'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, source_account_id: str, name: str, primary_contact_iam_id: str, *, domain: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,460
|
ibm_platform_services.enterprise_management_v1
|
delete_account
|
Remove an account from its enterprise.
Remove an account from the enterprise its currently in. After an account is
removed, it will be canceled and cannot be reactivated.
:param str account_id: The ID of the target account.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_account(
self,
account_id: str,
**kwargs,
) -> DetailedResponse:
"""
Remove an account from its enterprise.
Remove an account from the enterprise its currently in. After an account is
removed, it will be canceled and cannot be reactivated.
:param str account_id: The ID of the target account.
: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='V1',
operation_id='delete_account',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
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 = '/accounts/{account_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,461
|
ibm_platform_services.enterprise_management_v1
|
delete_account_group
|
Delete an account group from the enterprise.
Delete an existing account group from the enterprise. You can't delete an account
group that has child account groups, the delete request will fail. This API
doesn't perform a recursive delete on the child account groups, it only deletes
the current account group.
:param str account_group_id: The ID of the account group to retrieve.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_account_group(
self,
account_group_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete an account group from the enterprise.
Delete an existing account group from the enterprise. You can't delete an account
group that has child account groups, the delete request will fail. This API
doesn't perform a recursive delete on the child account groups, it only deletes
the current account group.
:param str account_group_id: The ID of the account group to retrieve.
: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_group_id:
raise ValueError('account_group_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_account_group',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['account_group_id']
path_param_values = self.encode_path_vars(account_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/account-groups/{account_group_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, account_group_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,465
|
ibm_platform_services.enterprise_management_v1
|
get_account
|
Get account by ID.
Retrieve an account by the `account_id` parameter. All data related to the account
is returned only if the caller has access to retrieve the account.
:param str account_id: The ID of the target account.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Account` object
|
def get_account(
self,
account_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get account by ID.
Retrieve an account by the `account_id` parameter. All data related to the account
is returned only if the caller has access to retrieve the account.
:param str account_id: The ID of the target account.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Account` 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='V1',
operation_id='get_account',
)
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']
path_param_values = self.encode_path_vars(account_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/accounts/{account_id}'.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, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,466
|
ibm_platform_services.enterprise_management_v1
|
get_account_group
|
Get account group by ID.
Retrieve an account by the `account_group_id` parameter. All data related to the
account group is returned only if the caller has access to retrieve the account
group.
:param str account_group_id: The ID of the account group to retrieve.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountGroup` object
|
def get_account_group(
self,
account_group_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get account group by ID.
Retrieve an account by the `account_group_id` parameter. All data related to the
account group is returned only if the caller has access to retrieve the account
group.
:param str account_group_id: The ID of the account group to retrieve.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountGroup` object
"""
if not account_group_id:
raise ValueError('account_group_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_account_group',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['account_group_id']
path_param_values = self.encode_path_vars(account_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/account-groups/{account_group_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, account_group_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,469
|
ibm_platform_services.enterprise_management_v1
|
get_enterprise
|
Get enterprise by ID.
Retrieve an enterprise by the `enterprise_id` parameter. All data related to the
enterprise is returned only if the caller has access to retrieve the enterprise.
:param str enterprise_id: The ID of the enterprise to retrieve.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Enterprise` object
|
def get_enterprise(
self,
enterprise_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get enterprise by ID.
Retrieve an enterprise by the `enterprise_id` parameter. All data related to the
enterprise is returned only if the caller has access to retrieve the enterprise.
:param str enterprise_id: The ID of the enterprise to retrieve.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Enterprise` object
"""
if not enterprise_id:
raise ValueError('enterprise_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_enterprise',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['enterprise_id']
path_param_values = self.encode_path_vars(enterprise_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/enterprises/{enterprise_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, enterprise_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,471
|
ibm_platform_services.enterprise_management_v1
|
import_account_to_enterprise
|
Import an account into an enterprise.
Import an existing stand-alone account into an enterprise. The existing account
can be any type: trial (`TRIAL`), Lite (`STANDARD`), Pay-As-You-Go (`PAYG`), or
Subscription (`SUBSCRIPTION`). In the case of a `SUBSCRIPTION` account, the
credits, promotional offers, and discounts are migrated to the billing unit of the
enterprise. For a billable account (`PAYG` or `SUBSCRIPTION`), the country and
currency code of the existing account and the billing unit of the enterprise must
match. The API returns a `202` response and performs asynchronous operations to
import the account into the enterprise. <br/></br>For more information about
impacts to the account, see [Adding accounts to an
enterprise](https://{DomainName}/docs/account?topic=account-enterprise-add).
:param str enterprise_id: The ID of the enterprise to import the
stand-alone account into.
:param str account_id: The ID of the existing stand-alone account to be
imported.
:param str parent: (optional) The CRN of the expected parent of the
imported account. The parent is the enterprise or account group that the
account is added to.
:param str billing_unit_id: (optional) The ID of the [billing
unit](/apidocs/enterprise-apis/billing-unit) to use for billing this
account in the enterprise.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def import_account_to_enterprise(
self,
enterprise_id: str,
account_id: str,
*,
parent: Optional[str] = None,
billing_unit_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Import an account into an enterprise.
Import an existing stand-alone account into an enterprise. The existing account
can be any type: trial (`TRIAL`), Lite (`STANDARD`), Pay-As-You-Go (`PAYG`), or
Subscription (`SUBSCRIPTION`). In the case of a `SUBSCRIPTION` account, the
credits, promotional offers, and discounts are migrated to the billing unit of the
enterprise. For a billable account (`PAYG` or `SUBSCRIPTION`), the country and
currency code of the existing account and the billing unit of the enterprise must
match. The API returns a `202` response and performs asynchronous operations to
import the account into the enterprise. <br/></br>For more information about
impacts to the account, see [Adding accounts to an
enterprise](https://{DomainName}/docs/account?topic=account-enterprise-add).
:param str enterprise_id: The ID of the enterprise to import the
stand-alone account into.
:param str account_id: The ID of the existing stand-alone account to be
imported.
:param str parent: (optional) The CRN of the expected parent of the
imported account. The parent is the enterprise or account group that the
account is added to.
:param str billing_unit_id: (optional) The ID of the [billing
unit](/apidocs/enterprise-apis/billing-unit) to use for billing this
account in the enterprise.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not enterprise_id:
raise ValueError('enterprise_id must be provided')
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='V1',
operation_id='import_account_to_enterprise',
)
headers.update(sdk_headers)
data = {
'parent': parent,
'billing_unit_id': billing_unit_id,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['enterprise_id', 'account_id']
path_param_values = self.encode_path_vars(enterprise_id, account_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/enterprises/{enterprise_id}/import/accounts/{account_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, enterprise_id: str, account_id: str, *, parent: Optional[str] = None, billing_unit_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,472
|
ibm_platform_services.enterprise_management_v1
|
list_account_groups
|
List account groups.
Retrieve all account groups based on the values that are passed in the query
parameters. If no query parameter is passed, all of the account groups in the
enterprise for which the calling identity has access are returned. <br/><br/>You
can use pagination parameters to filter the results. The `limit` field can be used
to limit the number of results that are displayed for this method.<br/><br/>This
method ensures that only the account groups that the user has access to are
returned. Access can be controlled either through a policy on a specific account
group, or account-level platform services access roles, such as Administrator,
Editor, Operator, or Viewer. When you call the method with the `enterprise_id`,
`parent_account_group_id` or `parent` query parameter, all of the account groups
that are immediate children of this entity are returned. Authentication is
performed on all account groups before they are returned to the user to ensure
that only those account groups are returned to which the calling identity has
access.
:param str enterprise_id: (optional) Get account groups that are either
immediate children or are a part of the hierarchy for a given enterprise
ID.
:param str parent_account_group_id: (optional) Get account groups that are
either immediate children or are a part of the hierarchy for a given
account group ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param str parent: (optional) Get account groups that are either immediate
children or are a part of the hierarchy for a given parent CRN.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param bool include_deleted: (optional) Include the deleted account groups
from an enterprise when used in conjunction with other query parameters.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListAccountGroupsResponse` object
|
def list_account_groups(
self,
*,
enterprise_id: Optional[str] = None,
parent_account_group_id: Optional[str] = None,
next_docid: Optional[str] = None,
parent: Optional[str] = None,
limit: Optional[int] = None,
include_deleted: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List account groups.
Retrieve all account groups based on the values that are passed in the query
parameters. If no query parameter is passed, all of the account groups in the
enterprise for which the calling identity has access are returned. <br/><br/>You
can use pagination parameters to filter the results. The `limit` field can be used
to limit the number of results that are displayed for this method.<br/><br/>This
method ensures that only the account groups that the user has access to are
returned. Access can be controlled either through a policy on a specific account
group, or account-level platform services access roles, such as Administrator,
Editor, Operator, or Viewer. When you call the method with the `enterprise_id`,
`parent_account_group_id` or `parent` query parameter, all of the account groups
that are immediate children of this entity are returned. Authentication is
performed on all account groups before they are returned to the user to ensure
that only those account groups are returned to which the calling identity has
access.
:param str enterprise_id: (optional) Get account groups that are either
immediate children or are a part of the hierarchy for a given enterprise
ID.
:param str parent_account_group_id: (optional) Get account groups that are
either immediate children or are a part of the hierarchy for a given
account group ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param str parent: (optional) Get account groups that are either immediate
children or are a part of the hierarchy for a given parent CRN.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param bool include_deleted: (optional) Include the deleted account groups
from an enterprise when used in conjunction with other query parameters.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListAccountGroupsResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_account_groups',
)
headers.update(sdk_headers)
params = {
'enterprise_id': enterprise_id,
'parent_account_group_id': parent_account_group_id,
'next_docid': next_docid,
'parent': parent,
'limit': limit,
'include_deleted': include_deleted,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/account-groups'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, *, enterprise_id: Optional[str] = None, parent_account_group_id: Optional[str] = None, next_docid: Optional[str] = None, parent: Optional[str] = None, limit: Optional[int] = None, include_deleted: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,473
|
ibm_platform_services.enterprise_management_v1
|
list_accounts
|
List accounts.
Retrieve all accounts based on the values that are passed in the query parameters.
If no query parameter is passed, all of the accounts in the enterprise for which
the calling identity has access are returned. <br/><br/>You can use pagination
parameters to filter the results. The `limit` field can be used to limit the
number of results that are displayed for this method.<br/><br/>This method ensures
that only the accounts that the user has access to are returned. Access can be
controlled either through a policy on a specific account, or account-level
platform services access roles, such as Administrator, Editor, Operator, or
Viewer. When you call the method with the `enterprise_id`, `account_group_id` or
`parent` query parameter, all of the accounts that are immediate children of this
entity are returned. Authentication is performed on all the accounts before they
are returned to the user to ensure that only those accounts are returned to which
the calling identity has access to.
:param str enterprise_id: (optional) Get accounts that are either immediate
children or are a part of the hierarchy for a given enterprise ID.
:param str account_group_id: (optional) Get accounts that are either
immediate children or are a part of the hierarchy for a given account group
ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param str parent: (optional) Get accounts that are either immediate
children or are a part of the hierarchy for a given parent CRN.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param bool include_deleted: (optional) Include the deleted accounts from
an enterprise when used in conjunction with enterprise_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 `ListAccountsResponse` object
|
def list_accounts(
self,
*,
enterprise_id: Optional[str] = None,
account_group_id: Optional[str] = None,
next_docid: Optional[str] = None,
parent: Optional[str] = None,
limit: Optional[int] = None,
include_deleted: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List accounts.
Retrieve all accounts based on the values that are passed in the query parameters.
If no query parameter is passed, all of the accounts in the enterprise for which
the calling identity has access are returned. <br/><br/>You can use pagination
parameters to filter the results. The `limit` field can be used to limit the
number of results that are displayed for this method.<br/><br/>This method ensures
that only the accounts that the user has access to are returned. Access can be
controlled either through a policy on a specific account, or account-level
platform services access roles, such as Administrator, Editor, Operator, or
Viewer. When you call the method with the `enterprise_id`, `account_group_id` or
`parent` query parameter, all of the accounts that are immediate children of this
entity are returned. Authentication is performed on all the accounts before they
are returned to the user to ensure that only those accounts are returned to which
the calling identity has access to.
:param str enterprise_id: (optional) Get accounts that are either immediate
children or are a part of the hierarchy for a given enterprise ID.
:param str account_group_id: (optional) Get accounts that are either
immediate children or are a part of the hierarchy for a given account group
ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param str parent: (optional) Get accounts that are either immediate
children or are a part of the hierarchy for a given parent CRN.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param bool include_deleted: (optional) Include the deleted accounts from
an enterprise when used in conjunction with enterprise_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 `ListAccountsResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_accounts',
)
headers.update(sdk_headers)
params = {
'enterprise_id': enterprise_id,
'account_group_id': account_group_id,
'next_docid': next_docid,
'parent': parent,
'limit': limit,
'include_deleted': include_deleted,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/accounts'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, *, enterprise_id: Optional[str] = None, account_group_id: Optional[str] = None, next_docid: Optional[str] = None, parent: Optional[str] = None, limit: Optional[int] = None, include_deleted: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,474
|
ibm_platform_services.enterprise_management_v1
|
list_enterprises
|
List enterprises.
Retrieve all enterprises for a given ID by passing the IDs on query parameters. If
no ID is passed, the enterprises for which the calling identity is the primary
contact are returned. You can use pagination parameters to filter the results.
<br/><br/>This method ensures that only the enterprises that the user has access
to are returned. Access can be controlled either through a policy on a specific
enterprise, or account-level platform services access roles, such as
Administrator, Editor, Operator, or Viewer. When you call the method with the
`enterprise_account_id` or `account_id` query parameter, the account ID in the
token is compared with that in the query parameter. If these account IDs match,
authentication isn't performed and the enterprise information is returned. If the
account IDs don't match, authentication is performed and only then is the
enterprise information returned in the response.
:param str enterprise_account_id: (optional) Get enterprises for a given
enterprise account ID.
:param str account_group_id: (optional) Get enterprises for a given account
group ID.
:param str account_id: (optional) Get enterprises for a given account ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListEnterprisesResponse` object
|
def list_enterprises(
self,
*,
enterprise_account_id: Optional[str] = None,
account_group_id: Optional[str] = None,
account_id: Optional[str] = None,
next_docid: Optional[str] = None,
limit: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
List enterprises.
Retrieve all enterprises for a given ID by passing the IDs on query parameters. If
no ID is passed, the enterprises for which the calling identity is the primary
contact are returned. You can use pagination parameters to filter the results.
<br/><br/>This method ensures that only the enterprises that the user has access
to are returned. Access can be controlled either through a policy on a specific
enterprise, or account-level platform services access roles, such as
Administrator, Editor, Operator, or Viewer. When you call the method with the
`enterprise_account_id` or `account_id` query parameter, the account ID in the
token is compared with that in the query parameter. If these account IDs match,
authentication isn't performed and the enterprise information is returned. If the
account IDs don't match, authentication is performed and only then is the
enterprise information returned in the response.
:param str enterprise_account_id: (optional) Get enterprises for a given
enterprise account ID.
:param str account_group_id: (optional) Get enterprises for a given account
group ID.
:param str account_id: (optional) Get enterprises for a given account ID.
:param str next_docid: (optional) The first item to be returned in the page
of results. This value can be obtained from the next_url property from the
previous call of the operation. If not specified, then the first page of
results is returned.
:param int limit: (optional) Return results up to this limit. Valid values
are between `0` and `100`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListEnterprisesResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_enterprises',
)
headers.update(sdk_headers)
params = {
'enterprise_account_id': enterprise_account_id,
'account_group_id': account_group_id,
'account_id': account_id,
'next_docid': next_docid,
'limit': limit,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/enterprises'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, *, enterprise_account_id: Optional[str] = None, account_group_id: Optional[str] = None, account_id: Optional[str] = None, next_docid: Optional[str] = None, limit: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,483
|
ibm_platform_services.enterprise_management_v1
|
update_account
|
Move an account within the enterprise.
Move an account to a different parent within the same enterprise.
:param str account_id: The ID of the target account.
:param str parent: The CRN of the new parent within the enterprise.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def update_account(
self,
account_id: str,
parent: str,
**kwargs,
) -> DetailedResponse:
"""
Move an account within the enterprise.
Move an account to a different parent within the same enterprise.
:param str account_id: The ID of the target account.
:param str parent: The CRN of the new parent within the enterprise.
: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')
if parent is None:
raise ValueError('parent must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_account',
)
headers.update(sdk_headers)
data = {
'parent': parent,
}
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']
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 = '/accounts/{account_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, account_id: str, parent: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,484
|
ibm_platform_services.enterprise_management_v1
|
update_account_group
|
Update an account group.
Update the name or IAM ID of the primary contact for an existing account group.
The new primary contact must already be a user in the enterprise account.
:param str account_group_id: The ID of the account group to retrieve.
:param str name: (optional) The new name of the account group. This field
must have 3 - 60 characters.
:param str primary_contact_iam_id: (optional) The IAM ID of the user to be
the new primary contact for the account group.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def update_account_group(
self,
account_group_id: str,
*,
name: Optional[str] = None,
primary_contact_iam_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update an account group.
Update the name or IAM ID of the primary contact for an existing account group.
The new primary contact must already be a user in the enterprise account.
:param str account_group_id: The ID of the account group to retrieve.
:param str name: (optional) The new name of the account group. This field
must have 3 - 60 characters.
:param str primary_contact_iam_id: (optional) The IAM ID of the user to be
the new primary contact for the account group.
: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_group_id:
raise ValueError('account_group_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_account_group',
)
headers.update(sdk_headers)
data = {
'name': name,
'primary_contact_iam_id': primary_contact_iam_id,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['account_group_id']
path_param_values = self.encode_path_vars(account_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/account-groups/{account_group_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, account_group_id: str, *, name: Optional[str] = None, primary_contact_iam_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,485
|
ibm_platform_services.enterprise_management_v1
|
update_enterprise
|
Update an enterprise.
Update the name, domain, or IAM ID of the primary contact for an existing
enterprise. The new primary contact must already be a user in the enterprise
account.
:param str enterprise_id: The ID of the enterprise to retrieve.
:param str name: (optional) The new name of the enterprise. This field must
have 3 - 60 characters.
:param str domain: (optional) The new domain of the enterprise. This field
has a limit of 60 characters.
:param str primary_contact_iam_id: (optional) The IAM ID of the user to be
the new primary contact for the enterprise.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def update_enterprise(
self,
enterprise_id: str,
*,
name: Optional[str] = None,
domain: Optional[str] = None,
primary_contact_iam_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update an enterprise.
Update the name, domain, or IAM ID of the primary contact for an existing
enterprise. The new primary contact must already be a user in the enterprise
account.
:param str enterprise_id: The ID of the enterprise to retrieve.
:param str name: (optional) The new name of the enterprise. This field must
have 3 - 60 characters.
:param str domain: (optional) The new domain of the enterprise. This field
has a limit of 60 characters.
:param str primary_contact_iam_id: (optional) The IAM ID of the user to be
the new primary contact for the enterprise.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not enterprise_id:
raise ValueError('enterprise_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_enterprise',
)
headers.update(sdk_headers)
data = {
'name': name,
'domain': domain,
'primary_contact_iam_id': primary_contact_iam_id,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['enterprise_id']
path_param_values = self.encode_path_vars(enterprise_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/enterprises/{enterprise_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, enterprise_id: str, *, name: Optional[str] = None, domain: Optional[str] = None, primary_contact_iam_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,486
|
ibm_platform_services.enterprise_usage_reports_v1
|
EnterpriseUsageReportsV1
|
The Enterprise Usage Reports V1 service.
|
class EnterpriseUsageReportsV1(BaseService):
"""The Enterprise Usage Reports V1 service."""
DEFAULT_SERVICE_URL = 'https://enterprise.cloud.ibm.com'
DEFAULT_SERVICE_NAME = 'enterprise_usage_reports'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'EnterpriseUsageReportsV1':
"""
Return a new client for the Enterprise 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 Enterprise 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)
#########################
# Enterprise Usage Reports
#########################
def get_resource_usage_report(
self,
*,
enterprise_id: str = None,
account_group_id: str = None,
account_id: str = None,
children: bool = None,
month: str = None,
billing_unit_id: str = None,
limit: int = None,
offset: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get usage reports for enterprise entities.
Usage reports for entities in the IBM Cloud enterprise. These entities can be the
enterprise, an account group, or an account.
:param str enterprise_id: (optional) The ID of the enterprise for which the
reports are queried. This parameter cannot be used with the `account_id` or
`account_group_id` query parameters.
:param str account_group_id: (optional) The ID of the account group for
which the reports are queried. This parameter cannot be used with the
`account_id` or `enterprise_id` query parameters.
:param str account_id: (optional) The ID of the account for which the
reports are queried. This parameter cannot be used with the
`account_group_id` or `enterprise_id` query parameters.
:param bool children: (optional) Returns the reports for the immediate
child entities under the current account group or enterprise. This
parameter cannot be used with the `account_id` query parameter.
:param str month: (optional) The billing month for which the usage report
is requested. The format is in yyyy-mm. Defaults to the month in which the
report is queried.
:param str billing_unit_id: (optional) The ID of the billing unit by which
to filter the reports.
:param int limit: (optional) The maximum number of search results to be
returned.
: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 `Reports` object
"""
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 = {
'enterprise_id': enterprise_id,
'account_group_id': account_group_id,
'account_id': account_id,
'children': children,
'month': month,
'billing_unit_id': billing_unit_id,
'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,487
|
ibm_platform_services.enterprise_usage_reports_v1
|
__init__
|
Construct a new client for the Enterprise 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 Enterprise 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,499
|
ibm_platform_services.enterprise_usage_reports_v1
|
get_resource_usage_report
|
Get usage reports for enterprise entities.
Usage reports for entities in the IBM Cloud enterprise. These entities can be the
enterprise, an account group, or an account.
:param str enterprise_id: (optional) The ID of the enterprise for which the
reports are queried. This parameter cannot be used with the `account_id` or
`account_group_id` query parameters.
:param str account_group_id: (optional) The ID of the account group for
which the reports are queried. This parameter cannot be used with the
`account_id` or `enterprise_id` query parameters.
:param str account_id: (optional) The ID of the account for which the
reports are queried. This parameter cannot be used with the
`account_group_id` or `enterprise_id` query parameters.
:param bool children: (optional) Returns the reports for the immediate
child entities under the current account group or enterprise. This
parameter cannot be used with the `account_id` query parameter.
:param str month: (optional) The billing month for which the usage report
is requested. The format is in yyyy-mm. Defaults to the month in which the
report is queried.
:param str billing_unit_id: (optional) The ID of the billing unit by which
to filter the reports.
:param int limit: (optional) The maximum number of search results to be
returned.
: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 `Reports` object
|
def get_resource_usage_report(
self,
*,
enterprise_id: str = None,
account_group_id: str = None,
account_id: str = None,
children: bool = None,
month: str = None,
billing_unit_id: str = None,
limit: int = None,
offset: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get usage reports for enterprise entities.
Usage reports for entities in the IBM Cloud enterprise. These entities can be the
enterprise, an account group, or an account.
:param str enterprise_id: (optional) The ID of the enterprise for which the
reports are queried. This parameter cannot be used with the `account_id` or
`account_group_id` query parameters.
:param str account_group_id: (optional) The ID of the account group for
which the reports are queried. This parameter cannot be used with the
`account_id` or `enterprise_id` query parameters.
:param str account_id: (optional) The ID of the account for which the
reports are queried. This parameter cannot be used with the
`account_group_id` or `enterprise_id` query parameters.
:param bool children: (optional) Returns the reports for the immediate
child entities under the current account group or enterprise. This
parameter cannot be used with the `account_id` query parameter.
:param str month: (optional) The billing month for which the usage report
is requested. The format is in yyyy-mm. Defaults to the month in which the
report is queried.
:param str billing_unit_id: (optional) The ID of the billing unit by which
to filter the reports.
:param int limit: (optional) The maximum number of search results to be
returned.
: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 `Reports` object
"""
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 = {
'enterprise_id': enterprise_id,
'account_group_id': account_group_id,
'account_id': account_id,
'children': children,
'month': month,
'billing_unit_id': billing_unit_id,
'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, *, enterprise_id: Optional[str] = None, account_group_id: Optional[str] = None, account_id: Optional[str] = None, children: Optional[bool] = None, month: Optional[str] = None, billing_unit_id: Optional[str] = None, limit: Optional[int] = None, offset: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,508
|
ibm_platform_services.global_catalog_v1
|
GlobalCatalogV1
|
The Global Catalog V1 service.
|
class GlobalCatalogV1(BaseService):
"""The Global Catalog V1 service."""
DEFAULT_SERVICE_URL = 'https://globalcatalog.cloud.ibm.com/api/v1'
DEFAULT_SERVICE_NAME = 'global_catalog'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'GlobalCatalogV1':
"""
Return a new client for the Global Catalog 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 Global Catalog 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)
#########################
# Object
#########################
def list_catalog_entries(
self,
*,
account: str = None,
include: str = None,
q: str = None,
sort_by: str = None,
descending: str = None,
languages: str = None,
catalog: bool = None,
complete: bool = None,
offset: int = None,
limit: int = None,
**kwargs
) -> DetailedResponse:
"""
Returns parent catalog entries.
Includes key information, such as ID, name, kind, CRN, tags, and provider. This
endpoint is ETag enabled.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A GET call by default returns a basic set of
properties. To include other properties, you must add this parameter. A
wildcard (`*`) includes all properties for an object, for example `GET
/?include=*`. To include specific metadata fields, separate each field with
a colon (:), for example `GET /?include=metadata.ui:metadata.pricing`.
:param str q: (optional) Searches the catalog entries for keywords. Add
filters to refine your search. A query filter, for example, `q=kind:iaas
service_name rc:true`, filters entries of kind iaas with
metadata.service.rc_compatible set to true and have a service name is in
their name, display name, or description. Valid tags are
**kind**:<string>, **tag**:<strging>, **rc**:[true|false],
**iam**:[true|false], **active**:[true|false], **geo**:<string>, and
**price**:<string>.
:param str sort_by: (optional) The field on which the output is sorted.
Sorts by default by **name** property. Available fields are **name**,
**displayname** (overview_ui.display_name), **kind**, **provider**
(provider.name), **sbsindex** (metadata.ui.side_by_side_index), and the
time **created**, and **updated**.
:param str descending: (optional) Sets the sort order. The default is
false, which is ascending.
:param str languages: (optional) Return the data strings in a specified
langauge. By default, the strings returned are of the language preferred by
your browser through the Accept-Langauge header, which allows an override
of the header. Languages are specified in standard form, such as `en-us`.
To include all languages use a wildcard (*).
:param bool catalog: (optional) Checks to see if a catalog's object is
visible, or if it's filtered by service, plan, deployment, or region. Use
the value `?catalog=true`. If a `200` code is returned, the object is
visible. If a `403` code is returned, the object is not visible for the
user.
:param bool complete: (optional) Returns all available fields for all
languages. Use the value `?complete=true` as shortcut for
?include=*&languages=*.
:param int offset: (optional) Useful for pagination, specifies index
(origin 0) of first item to return in response.
:param int limit: (optional) Useful for pagination, specifies the maximum
number of items to return 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 `EntrySearchResult` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_catalog_entries'
)
headers.update(sdk_headers)
params = {
'account': account,
'include': include,
'q': q,
'sort-by': sort_by,
'descending': descending,
'languages': languages,
'catalog': catalog,
'complete': complete,
'_offset': offset,
'_limit': limit,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
url = '/'
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
def create_catalog_entry(
self,
name: str,
kind: str,
overview_ui: dict,
images: 'Image',
disabled: bool,
tags: List[str],
provider: 'Provider',
id: str,
*,
parent_id: str = None,
group: bool = None,
active: bool = None,
metadata: 'ObjectMetadataSet' = None,
account: str = None,
**kwargs
) -> DetailedResponse:
"""
Create a catalog entry.
The created catalog entry is restricted by default. You must have an administrator
or editor role in the scope of the provided token. This API will return an ETag
that can be used for standard ETag processing, except when depth query is used.
:param str name: Programmatic name for this catalog entry, which must be
formatted like a CRN segment. See the display name in OverviewUI for a
user-readable name.
:param str kind: The type of catalog entry, **service**, **template**,
**dashboard**, which determines the type and shape of the object.
:param dict overview_ui: Overview is nested in the top level. The key value
pair is `[_language_]overview_ui`.
:param Image images: Image annotation for this catalog entry. The image is
a URL.
:param bool disabled: Boolean value that determines the global visibility
for the catalog entry, and its children. If it is not enabled, all plans
are disabled.
:param List[str] tags: A list of tags. For example, IBM, 3rd Party, Beta,
GA, and Single Tenant.
:param Provider provider: Information related to the provider associated
with a catalog entry.
:param str id: Catalog entry's unique ID. It's the same across all catalog
instances.
:param str parent_id: (optional) The ID of the parent catalog entry if it
exists.
:param bool group: (optional) Boolean value that determines whether the
catalog entry is a group.
:param bool active: (optional) Boolean value that describes whether the
service is active.
:param ObjectMetadataSet metadata: (optional) Model used to describe
metadata object that can be set.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` object
"""
if name is None:
raise ValueError('name must be provided')
if kind is None:
raise ValueError('kind must be provided')
if overview_ui is None:
raise ValueError('overview_ui must be provided')
if images is None:
raise ValueError('images must be provided')
if disabled is None:
raise ValueError('disabled must be provided')
if tags is None:
raise ValueError('tags must be provided')
if provider is None:
raise ValueError('provider must be provided')
if id is None:
raise ValueError('id must be provided')
images = convert_model(images)
provider = convert_model(provider)
if metadata is not None:
metadata = convert_model(metadata)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='create_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account}
data = {
'name': name,
'kind': kind,
'overview_ui': overview_ui,
'images': images,
'disabled': disabled,
'tags': tags,
'provider': provider,
'id': id,
'parent_id': parent_id,
'group': group,
'active': active,
'metadata': metadata,
}
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 = '/'
request = self.prepare_request(method='POST', url=url, headers=headers, params=params, data=data)
response = self.send(request)
return response
def get_catalog_entry(
self,
id: str,
*,
account: str = None,
include: str = None,
languages: str = None,
complete: bool = None,
depth: int = None,
**kwargs
) -> DetailedResponse:
"""
Get a specific catalog object.
This endpoint returns a specific catalog entry using the object's unique
identifier, for example `/*service_name*?complete=true`. This endpoint is ETag
enabled. This can be used by an unauthenticated user for publicly available
services.
:param str id: The catalog entry's unqiue ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A GET call by default returns a basic set of
properties. To include other properties, you must add this parameter. A
wildcard (`*`) includes all properties for an object, for example `GET
/id?include=*`. To include specific metadata fields, separate each field
with a colon (:), for example `GET
/id?include=metadata.ui:metadata.pricing`.
:param str languages: (optional) Return the data strings in the specified
langauge. By default the strings returned are of the language preferred by
your browser through the Accept-Langauge header, which allows an override
of the header. Languages are specified in standard form, such as `en-us`.
To include all languages use a wildcard (*).
:param bool complete: (optional) Returns all available fields for all
languages. Use the value `?complete=true` as shortcut for
?include=*&languages=*.
:param int depth: (optional) Return the children down to the requested
depth. Use * to include the entire children tree. If there are more
children than the maximum permitted an error will be returned. Be judicious
with this as it can cause a large number of database accesses and can
result in a large amount of data returned.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` 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='V1', operation_id='get_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account, 'include': include, 'languages': languages, 'complete': complete, 'depth': depth}
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 = '/{id}'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
def update_catalog_entry(
self,
id: str,
name: str,
kind: str,
overview_ui: dict,
images: 'Image',
disabled: bool,
tags: List[str],
provider: 'Provider',
*,
parent_id: str = None,
group: bool = None,
active: bool = None,
metadata: 'ObjectMetadataSet' = None,
account: str = None,
move: str = None,
**kwargs
) -> DetailedResponse:
"""
Update a catalog entry.
Update a catalog entry. The visibility of the catalog entry cannot be modified
with this endpoint. You must be an administrator or editor in the scope of the
provided token. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param str name: Programmatic name for this catalog entry, which must be
formatted like a CRN segment. See the display name in OverviewUI for a
user-readable name.
:param str kind: The type of catalog entry, **service**, **template**,
**dashboard**, which determines the type and shape of the object.
:param dict overview_ui: Overview is nested in the top level. The key value
pair is `[_language_]overview_ui`.
:param Image images: Image annotation for this catalog entry. The image is
a URL.
:param bool disabled: Boolean value that determines the global visibility
for the catalog entry, and its children. If it is not enabled, all plans
are disabled.
:param List[str] tags: A list of tags. For example, IBM, 3rd Party, Beta,
GA, and Single Tenant.
:param Provider provider: Information related to the provider associated
with a catalog entry.
:param str parent_id: (optional) The ID of the parent catalog entry if it
exists.
:param bool group: (optional) Boolean value that determines whether the
catalog entry is a group.
:param bool active: (optional) Boolean value that describes whether the
service is active.
:param ObjectMetadataSet metadata: (optional) Model used to describe
metadata object that can be set.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str move: (optional) Reparenting object. In the body set the
parent_id to a different parent. Or remove the parent_id field to reparent
to the root of the catalog. If this is not set to 'true' then changing the
parent_id in the body of the request will not be permitted. If this is
'true' and no change to parent_id then this is also error. This is to
prevent accidental changing of parent.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` object
"""
if id is None:
raise ValueError('id must be provided')
if name is None:
raise ValueError('name must be provided')
if kind is None:
raise ValueError('kind must be provided')
if overview_ui is None:
raise ValueError('overview_ui must be provided')
if images is None:
raise ValueError('images must be provided')
if disabled is None:
raise ValueError('disabled must be provided')
if tags is None:
raise ValueError('tags must be provided')
if provider is None:
raise ValueError('provider must be provided')
images = convert_model(images)
provider = convert_model(provider)
if metadata is not None:
metadata = convert_model(metadata)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account, 'move': move}
data = {
'name': name,
'kind': kind,
'overview_ui': overview_ui,
'images': images,
'disabled': disabled,
'tags': tags,
'provider': provider,
'parent_id': parent_id,
'group': group,
'active': active,
'metadata': metadata,
}
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 = '/{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 delete_catalog_entry(self, id: str, *, account: str = None, force: bool = None, **kwargs) -> DetailedResponse:
"""
Delete a catalog entry.
Delete a catalog entry. This will archive the catalog entry for a minimum of two
weeks. While archived, it can be restored using the PUT restore API. After two
weeks, it will be deleted and cannot be restored. You must have administrator role
in the scope of the provided token to modify it. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param bool force: (optional) This will cause entry to be deleted fully. By
default it is archived for two weeks, so that it can be restored if
necessary.
: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='V1', operation_id='delete_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account, 'force': force}
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 = '/{id}'.format(**path_param_dict)
request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params)
response = self.send(request)
return response
def get_child_objects(
self,
id: str,
kind: str,
*,
account: str = None,
include: str = None,
q: str = None,
sort_by: str = None,
descending: str = None,
languages: str = None,
complete: bool = None,
offset: int = None,
limit: int = None,
**kwargs
) -> DetailedResponse:
"""
Get child catalog entries of a specific kind.
Fetch child catalog entries for a catalog entry with a specific id. This endpoint
is ETag enabled. This can be used by an unauthenticated user for publicly
available services.
:param str id: The parent catalog entry's ID.
:param str kind: The **kind** of child catalog entries to search for. A
wildcard (*) includes all child catalog entries for all kinds, for example
`GET /service_name/*`.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A colon (:) separated list of properties to
include. A GET call by defaults return a limited set of properties. To
include other properties, you must add the include parameter. A wildcard
(*) includes all properties.
:param str q: (optional) A query filter, for example, `q=kind:iaas IBM`
will filter on entries of **kind** iaas that has `IBM` in their name,
display name, or description.
:param str sort_by: (optional) The field on which to sort the output. By
default by name. Available fields are **name**, **kind**, and **provider**.
:param str descending: (optional) The sort order. The default is false,
which is ascending.
:param str languages: (optional) Return the data strings in the specified
langauge. By default the strings returned are of the language preferred by
your browser through the Accept-Langauge header. This allows an override of
the header. Languages are specified in standard form, such as `en-us`. To
include all languages use the wildcard (*).
:param bool complete: (optional) Use the value `?complete=true` as shortcut
for ?include=*&languages=*.
:param int offset: (optional) Useful for pagination, specifies index
(origin 0) of first item to return in response.
:param int limit: (optional) Useful for pagination, specifies the maximum
number of items to return 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 `EntrySearchResult` object
"""
if id is None:
raise ValueError('id must be provided')
if kind is None:
raise ValueError('kind must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_child_objects'
)
headers.update(sdk_headers)
params = {
'account': account,
'include': include,
'q': q,
'sort-by': sort_by,
'descending': descending,
'languages': languages,
'complete': complete,
'_offset': offset,
'_limit': limit,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['id', 'kind']
path_param_values = self.encode_path_vars(id, kind)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{id}/{kind}'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
def restore_catalog_entry(self, id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Restore archived catalog entry.
Restore an archived catalog entry. You must have an administrator role in the
scope of the provided token.
:param str id: The catalog entry's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
: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='V1', operation_id='restore_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account}
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 = '/{id}/restore'.format(**path_param_dict)
request = self.prepare_request(method='PUT', url=url, headers=headers, params=params)
response = self.send(request)
return response
#########################
# Visibility
#########################
def get_visibility(self, id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Get the visibility constraints for an object.
This endpoint returns the visibility rules for this object. Overall visibility is
determined by the parent objects and any further restrictions on this object. You
must have an administrator role in the scope of the provided token. This endpoint
is ETag enabled.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Visibility` 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='V1', operation_id='get_visibility'
)
headers.update(sdk_headers)
params = {'account': account}
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 = '/{id}/visibility'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
def update_visibility(
self,
id: str,
*,
extendable: bool = None,
include: 'VisibilityDetail' = None,
exclude: 'VisibilityDetail' = None,
account: str = None,
**kwargs
) -> DetailedResponse:
"""
Update visibility.
Update an Object's Visibility. You must have an administrator role in the scope of
the provided token. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param bool extendable: (optional) Allows the visibility to be extenable.
:param VisibilityDetail include: (optional) Visibility details related to a
catalog entry.
:param VisibilityDetail exclude: (optional) Visibility details related to a
catalog entry.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
: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')
if include is not None:
include = convert_model(include)
if exclude is not None:
exclude = convert_model(exclude)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_visibility'
)
headers.update(sdk_headers)
params = {'account': account}
data = {'extendable': extendable, 'include': include, 'exclude': exclude}
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'))
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{id}/visibility'.format(**path_param_dict)
request = self.prepare_request(method='PUT', url=url, headers=headers, params=params, data=data)
response = self.send(request)
return response
#########################
# Pricing
#########################
def get_pricing(self, id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Get the pricing for an object.
This endpoint returns the pricing for an object. Static pricing is defined in the
catalog. Dynamic pricing is stored in IBM Cloud Pricing Catalog. This can be used
by an unauthenticated user for publicly available services.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PricingGet` 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='V1', operation_id='get_pricing'
)
headers.update(sdk_headers)
params = {'account': account}
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 = '/{id}/pricing'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
#########################
# Audit
#########################
def get_audit_logs(
self,
id: str,
*,
account: str = None,
ascending: str = None,
startat: str = None,
offset: int = None,
limit: int = None,
**kwargs
) -> DetailedResponse:
"""
Get the audit logs for an object.
This endpoint returns the audit logs for an object. Only administrators and
editors can get logs.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str ascending: (optional) Sets the sort order. False is descending.
:param str startat: (optional) Starting time for the logs. If it's
descending then the entries will be equal or earlier. The default is
latest. For ascending it will entries equal or later. The default is
earliest. It can be either a number or a string. If a number then it is in
the format of Unix timestamps. If it is a string then it is a date in the
format YYYY-MM-DDTHH:MM:SSZ and the time is UTC. The T and the Z are
required. For example: 2017-12-24T12:00:00Z for Noon UTC on Dec 24, 2017.
:param int offset: (optional) Count of number of log entries to skip before
returning logs. The default is zero.
:param int limit: (optional) Count of number of entries to return. The
default is fifty. The maximum value is two hundred.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AuditSearchResult` 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='V1', operation_id='get_audit_logs'
)
headers.update(sdk_headers)
params = {'account': account, 'ascending': ascending, 'startat': startat, '_offset': offset, '_limit': limit}
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 = '/{id}/logs'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
#########################
# Artifact
#########################
def list_artifacts(self, object_id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Get artifacts.
This endpoint returns a list of artifacts for an object.
:param str object_id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Artifacts` object
"""
if object_id is None:
raise ValueError('object_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_artifacts'
)
headers.update(sdk_headers)
params = {'account': account}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['object_id']
path_param_values = self.encode_path_vars(object_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{object_id}/artifacts'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
def get_artifact(self, object_id: str, artifact_id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Get artifact.
This endpoint returns the binary of an artifact.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `BinaryIO` result
"""
if object_id is None:
raise ValueError('object_id must be provided')
if artifact_id is None:
raise ValueError('artifact_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_artifact'
)
headers.update(sdk_headers)
params = {'account': account}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = '*/*'
path_param_keys = ['object_id', 'artifact_id']
path_param_values = self.encode_path_vars(object_id, artifact_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{object_id}/artifacts/{artifact_id}'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
def upload_artifact(
self,
object_id: str,
artifact_id: str,
*,
artifact: BinaryIO = None,
content_type: str = None,
account: str = None,
**kwargs
) -> DetailedResponse:
"""
Upload artifact.
This endpoint uploads the binary for an artifact. Only administrators and editors
can upload artifacts.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param BinaryIO artifact: (optional)
:param str content_type: (optional) The type of the input.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if object_id is None:
raise ValueError('object_id must be provided')
if artifact_id is None:
raise ValueError('artifact_id must be provided')
headers = {'Content-Type': content_type}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='upload_artifact'
)
headers.update(sdk_headers)
params = {'account': account}
data = artifact
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
path_param_keys = ['object_id', 'artifact_id']
path_param_values = self.encode_path_vars(object_id, artifact_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{object_id}/artifacts/{artifact_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 delete_artifact(self, object_id: str, artifact_id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Delete artifact.
This endpoint deletes an artifact. Only administrators and editors can delete
artifacts.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if object_id is None:
raise ValueError('object_id must be provided')
if artifact_id is None:
raise ValueError('artifact_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_artifact'
)
headers.update(sdk_headers)
params = {'account': account}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
path_param_keys = ['object_id', 'artifact_id']
path_param_values = self.encode_path_vars(object_id, artifact_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{object_id}/artifacts/{artifact_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,509
|
ibm_platform_services.global_catalog_v1
|
__init__
|
Construct a new client for the Global Catalog 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 Global Catalog 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,515
|
ibm_platform_services.global_catalog_v1
|
create_catalog_entry
|
Create a catalog entry.
The created catalog entry is restricted by default. You must have an administrator
or editor role in the scope of the provided token. This API will return an ETag
that can be used for standard ETag processing, except when depth query is used.
:param str name: Programmatic name for this catalog entry, which must be
formatted like a CRN segment. See the display name in OverviewUI for a
user-readable name.
:param str kind: The type of catalog entry, **service**, **template**,
**dashboard**, which determines the type and shape of the object.
:param dict overview_ui: Overview is nested in the top level. The key value
pair is `[_language_]overview_ui`.
:param Image images: Image annotation for this catalog entry. The image is
a URL.
:param bool disabled: Boolean value that determines the global visibility
for the catalog entry, and its children. If it is not enabled, all plans
are disabled.
:param List[str] tags: A list of tags. For example, IBM, 3rd Party, Beta,
GA, and Single Tenant.
:param Provider provider: Information related to the provider associated
with a catalog entry.
:param str id: Catalog entry's unique ID. It's the same across all catalog
instances.
:param str parent_id: (optional) The ID of the parent catalog entry if it
exists.
:param bool group: (optional) Boolean value that determines whether the
catalog entry is a group.
:param bool active: (optional) Boolean value that describes whether the
service is active.
:param ObjectMetadataSet metadata: (optional) Model used to describe
metadata object that can be set.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` object
|
def create_catalog_entry(
self,
name: str,
kind: str,
overview_ui: dict,
images: 'Image',
disabled: bool,
tags: List[str],
provider: 'Provider',
id: str,
*,
parent_id: str = None,
group: bool = None,
active: bool = None,
metadata: 'ObjectMetadataSet' = None,
account: str = None,
**kwargs
) -> DetailedResponse:
"""
Create a catalog entry.
The created catalog entry is restricted by default. You must have an administrator
or editor role in the scope of the provided token. This API will return an ETag
that can be used for standard ETag processing, except when depth query is used.
:param str name: Programmatic name for this catalog entry, which must be
formatted like a CRN segment. See the display name in OverviewUI for a
user-readable name.
:param str kind: The type of catalog entry, **service**, **template**,
**dashboard**, which determines the type and shape of the object.
:param dict overview_ui: Overview is nested in the top level. The key value
pair is `[_language_]overview_ui`.
:param Image images: Image annotation for this catalog entry. The image is
a URL.
:param bool disabled: Boolean value that determines the global visibility
for the catalog entry, and its children. If it is not enabled, all plans
are disabled.
:param List[str] tags: A list of tags. For example, IBM, 3rd Party, Beta,
GA, and Single Tenant.
:param Provider provider: Information related to the provider associated
with a catalog entry.
:param str id: Catalog entry's unique ID. It's the same across all catalog
instances.
:param str parent_id: (optional) The ID of the parent catalog entry if it
exists.
:param bool group: (optional) Boolean value that determines whether the
catalog entry is a group.
:param bool active: (optional) Boolean value that describes whether the
service is active.
:param ObjectMetadataSet metadata: (optional) Model used to describe
metadata object that can be set.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` object
"""
if name is None:
raise ValueError('name must be provided')
if kind is None:
raise ValueError('kind must be provided')
if overview_ui is None:
raise ValueError('overview_ui must be provided')
if images is None:
raise ValueError('images must be provided')
if disabled is None:
raise ValueError('disabled must be provided')
if tags is None:
raise ValueError('tags must be provided')
if provider is None:
raise ValueError('provider must be provided')
if id is None:
raise ValueError('id must be provided')
images = convert_model(images)
provider = convert_model(provider)
if metadata is not None:
metadata = convert_model(metadata)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='create_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account}
data = {
'name': name,
'kind': kind,
'overview_ui': overview_ui,
'images': images,
'disabled': disabled,
'tags': tags,
'provider': provider,
'id': id,
'parent_id': parent_id,
'group': group,
'active': active,
'metadata': metadata,
}
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 = '/'
request = self.prepare_request(method='POST', url=url, headers=headers, params=params, data=data)
response = self.send(request)
return response
|
(self, name: str, kind: str, overview_ui: dict, images: ibm_platform_services.global_catalog_v1.Image, disabled: bool, tags: List[str], provider: ibm_platform_services.global_catalog_v1.Provider, id: str, *, parent_id: Optional[str] = None, group: Optional[bool] = None, active: Optional[bool] = None, metadata: Optional[ibm_platform_services.global_catalog_v1.ObjectMetadataSet] = None, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,516
|
ibm_platform_services.global_catalog_v1
|
delete_artifact
|
Delete artifact.
This endpoint deletes an artifact. Only administrators and editors can delete
artifacts.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_artifact(self, object_id: str, artifact_id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Delete artifact.
This endpoint deletes an artifact. Only administrators and editors can delete
artifacts.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if object_id is None:
raise ValueError('object_id must be provided')
if artifact_id is None:
raise ValueError('artifact_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='delete_artifact'
)
headers.update(sdk_headers)
params = {'account': account}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
path_param_keys = ['object_id', 'artifact_id']
path_param_values = self.encode_path_vars(object_id, artifact_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{object_id}/artifacts/{artifact_id}'.format(**path_param_dict)
request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, object_id: str, artifact_id: str, *, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,517
|
ibm_platform_services.global_catalog_v1
|
delete_catalog_entry
|
Delete a catalog entry.
Delete a catalog entry. This will archive the catalog entry for a minimum of two
weeks. While archived, it can be restored using the PUT restore API. After two
weeks, it will be deleted and cannot be restored. You must have administrator role
in the scope of the provided token to modify it. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param bool force: (optional) This will cause entry to be deleted fully. By
default it is archived for two weeks, so that it can be restored if
necessary.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_catalog_entry(self, id: str, *, account: str = None, force: bool = None, **kwargs) -> DetailedResponse:
"""
Delete a catalog entry.
Delete a catalog entry. This will archive the catalog entry for a minimum of two
weeks. While archived, it can be restored using the PUT restore API. After two
weeks, it will be deleted and cannot be restored. You must have administrator role
in the scope of the provided token to modify it. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param bool force: (optional) This will cause entry to be deleted fully. By
default it is archived for two weeks, so that it can be restored if
necessary.
: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='V1', operation_id='delete_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account, 'force': force}
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 = '/{id}'.format(**path_param_dict)
request = self.prepare_request(method='DELETE', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, id: str, *, account: Optional[str] = None, force: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,521
|
ibm_platform_services.global_catalog_v1
|
get_artifact
|
Get artifact.
This endpoint returns the binary of an artifact.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `BinaryIO` result
|
def get_artifact(self, object_id: str, artifact_id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Get artifact.
This endpoint returns the binary of an artifact.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `BinaryIO` result
"""
if object_id is None:
raise ValueError('object_id must be provided')
if artifact_id is None:
raise ValueError('artifact_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_artifact'
)
headers.update(sdk_headers)
params = {'account': account}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = '*/*'
path_param_keys = ['object_id', 'artifact_id']
path_param_values = self.encode_path_vars(object_id, artifact_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{object_id}/artifacts/{artifact_id}'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, object_id: str, artifact_id: str, *, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,522
|
ibm_platform_services.global_catalog_v1
|
get_audit_logs
|
Get the audit logs for an object.
This endpoint returns the audit logs for an object. Only administrators and
editors can get logs.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str ascending: (optional) Sets the sort order. False is descending.
:param str startat: (optional) Starting time for the logs. If it's
descending then the entries will be equal or earlier. The default is
latest. For ascending it will entries equal or later. The default is
earliest. It can be either a number or a string. If a number then it is in
the format of Unix timestamps. If it is a string then it is a date in the
format YYYY-MM-DDTHH:MM:SSZ and the time is UTC. The T and the Z are
required. For example: 2017-12-24T12:00:00Z for Noon UTC on Dec 24, 2017.
:param int offset: (optional) Count of number of log entries to skip before
returning logs. The default is zero.
:param int limit: (optional) Count of number of entries to return. The
default is fifty. The maximum value is two hundred.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AuditSearchResult` object
|
def get_audit_logs(
self,
id: str,
*,
account: str = None,
ascending: str = None,
startat: str = None,
offset: int = None,
limit: int = None,
**kwargs
) -> DetailedResponse:
"""
Get the audit logs for an object.
This endpoint returns the audit logs for an object. Only administrators and
editors can get logs.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str ascending: (optional) Sets the sort order. False is descending.
:param str startat: (optional) Starting time for the logs. If it's
descending then the entries will be equal or earlier. The default is
latest. For ascending it will entries equal or later. The default is
earliest. It can be either a number or a string. If a number then it is in
the format of Unix timestamps. If it is a string then it is a date in the
format YYYY-MM-DDTHH:MM:SSZ and the time is UTC. The T and the Z are
required. For example: 2017-12-24T12:00:00Z for Noon UTC on Dec 24, 2017.
:param int offset: (optional) Count of number of log entries to skip before
returning logs. The default is zero.
:param int limit: (optional) Count of number of entries to return. The
default is fifty. The maximum value is two hundred.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AuditSearchResult` 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='V1', operation_id='get_audit_logs'
)
headers.update(sdk_headers)
params = {'account': account, 'ascending': ascending, 'startat': startat, '_offset': offset, '_limit': limit}
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 = '/{id}/logs'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, id: str, *, account: Optional[str] = None, ascending: Optional[str] = None, startat: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,524
|
ibm_platform_services.global_catalog_v1
|
get_catalog_entry
|
Get a specific catalog object.
This endpoint returns a specific catalog entry using the object's unique
identifier, for example `/*service_name*?complete=true`. This endpoint is ETag
enabled. This can be used by an unauthenticated user for publicly available
services.
:param str id: The catalog entry's unqiue ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A GET call by default returns a basic set of
properties. To include other properties, you must add this parameter. A
wildcard (`*`) includes all properties for an object, for example `GET
/id?include=*`. To include specific metadata fields, separate each field
with a colon (:), for example `GET
/id?include=metadata.ui:metadata.pricing`.
:param str languages: (optional) Return the data strings in the specified
langauge. By default the strings returned are of the language preferred by
your browser through the Accept-Langauge header, which allows an override
of the header. Languages are specified in standard form, such as `en-us`.
To include all languages use a wildcard (*).
:param bool complete: (optional) Returns all available fields for all
languages. Use the value `?complete=true` as shortcut for
?include=*&languages=*.
:param int depth: (optional) Return the children down to the requested
depth. Use * to include the entire children tree. If there are more
children than the maximum permitted an error will be returned. Be judicious
with this as it can cause a large number of database accesses and can
result in a large amount of data returned.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` object
|
def get_catalog_entry(
self,
id: str,
*,
account: str = None,
include: str = None,
languages: str = None,
complete: bool = None,
depth: int = None,
**kwargs
) -> DetailedResponse:
"""
Get a specific catalog object.
This endpoint returns a specific catalog entry using the object's unique
identifier, for example `/*service_name*?complete=true`. This endpoint is ETag
enabled. This can be used by an unauthenticated user for publicly available
services.
:param str id: The catalog entry's unqiue ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A GET call by default returns a basic set of
properties. To include other properties, you must add this parameter. A
wildcard (`*`) includes all properties for an object, for example `GET
/id?include=*`. To include specific metadata fields, separate each field
with a colon (:), for example `GET
/id?include=metadata.ui:metadata.pricing`.
:param str languages: (optional) Return the data strings in the specified
langauge. By default the strings returned are of the language preferred by
your browser through the Accept-Langauge header, which allows an override
of the header. Languages are specified in standard form, such as `en-us`.
To include all languages use a wildcard (*).
:param bool complete: (optional) Returns all available fields for all
languages. Use the value `?complete=true` as shortcut for
?include=*&languages=*.
:param int depth: (optional) Return the children down to the requested
depth. Use * to include the entire children tree. If there are more
children than the maximum permitted an error will be returned. Be judicious
with this as it can cause a large number of database accesses and can
result in a large amount of data returned.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` 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='V1', operation_id='get_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account, 'include': include, 'languages': languages, 'complete': complete, 'depth': depth}
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 = '/{id}'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, id: str, *, account: Optional[str] = None, include: Optional[str] = None, languages: Optional[str] = None, complete: Optional[bool] = None, depth: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,525
|
ibm_platform_services.global_catalog_v1
|
get_child_objects
|
Get child catalog entries of a specific kind.
Fetch child catalog entries for a catalog entry with a specific id. This endpoint
is ETag enabled. This can be used by an unauthenticated user for publicly
available services.
:param str id: The parent catalog entry's ID.
:param str kind: The **kind** of child catalog entries to search for. A
wildcard (*) includes all child catalog entries for all kinds, for example
`GET /service_name/*`.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A colon (:) separated list of properties to
include. A GET call by defaults return a limited set of properties. To
include other properties, you must add the include parameter. A wildcard
(*) includes all properties.
:param str q: (optional) A query filter, for example, `q=kind:iaas IBM`
will filter on entries of **kind** iaas that has `IBM` in their name,
display name, or description.
:param str sort_by: (optional) The field on which to sort the output. By
default by name. Available fields are **name**, **kind**, and **provider**.
:param str descending: (optional) The sort order. The default is false,
which is ascending.
:param str languages: (optional) Return the data strings in the specified
langauge. By default the strings returned are of the language preferred by
your browser through the Accept-Langauge header. This allows an override of
the header. Languages are specified in standard form, such as `en-us`. To
include all languages use the wildcard (*).
:param bool complete: (optional) Use the value `?complete=true` as shortcut
for ?include=*&languages=*.
:param int offset: (optional) Useful for pagination, specifies index
(origin 0) of first item to return in response.
:param int limit: (optional) Useful for pagination, specifies the maximum
number of items to return 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 `EntrySearchResult` object
|
def get_child_objects(
self,
id: str,
kind: str,
*,
account: str = None,
include: str = None,
q: str = None,
sort_by: str = None,
descending: str = None,
languages: str = None,
complete: bool = None,
offset: int = None,
limit: int = None,
**kwargs
) -> DetailedResponse:
"""
Get child catalog entries of a specific kind.
Fetch child catalog entries for a catalog entry with a specific id. This endpoint
is ETag enabled. This can be used by an unauthenticated user for publicly
available services.
:param str id: The parent catalog entry's ID.
:param str kind: The **kind** of child catalog entries to search for. A
wildcard (*) includes all child catalog entries for all kinds, for example
`GET /service_name/*`.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A colon (:) separated list of properties to
include. A GET call by defaults return a limited set of properties. To
include other properties, you must add the include parameter. A wildcard
(*) includes all properties.
:param str q: (optional) A query filter, for example, `q=kind:iaas IBM`
will filter on entries of **kind** iaas that has `IBM` in their name,
display name, or description.
:param str sort_by: (optional) The field on which to sort the output. By
default by name. Available fields are **name**, **kind**, and **provider**.
:param str descending: (optional) The sort order. The default is false,
which is ascending.
:param str languages: (optional) Return the data strings in the specified
langauge. By default the strings returned are of the language preferred by
your browser through the Accept-Langauge header. This allows an override of
the header. Languages are specified in standard form, such as `en-us`. To
include all languages use the wildcard (*).
:param bool complete: (optional) Use the value `?complete=true` as shortcut
for ?include=*&languages=*.
:param int offset: (optional) Useful for pagination, specifies index
(origin 0) of first item to return in response.
:param int limit: (optional) Useful for pagination, specifies the maximum
number of items to return 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 `EntrySearchResult` object
"""
if id is None:
raise ValueError('id must be provided')
if kind is None:
raise ValueError('kind must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='get_child_objects'
)
headers.update(sdk_headers)
params = {
'account': account,
'include': include,
'q': q,
'sort-by': sort_by,
'descending': descending,
'languages': languages,
'complete': complete,
'_offset': offset,
'_limit': limit,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['id', 'kind']
path_param_values = self.encode_path_vars(id, kind)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{id}/{kind}'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, id: str, kind: str, *, account: Optional[str] = None, include: Optional[str] = None, q: Optional[str] = None, sort_by: Optional[str] = None, descending: Optional[str] = None, languages: Optional[str] = None, complete: Optional[bool] = None, offset: Optional[int] = None, limit: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,528
|
ibm_platform_services.global_catalog_v1
|
get_pricing
|
Get the pricing for an object.
This endpoint returns the pricing for an object. Static pricing is defined in the
catalog. Dynamic pricing is stored in IBM Cloud Pricing Catalog. This can be used
by an unauthenticated user for publicly available services.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PricingGet` object
|
def get_pricing(self, id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Get the pricing for an object.
This endpoint returns the pricing for an object. Static pricing is defined in the
catalog. Dynamic pricing is stored in IBM Cloud Pricing Catalog. This can be used
by an unauthenticated user for publicly available services.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PricingGet` 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='V1', operation_id='get_pricing'
)
headers.update(sdk_headers)
params = {'account': account}
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 = '/{id}/pricing'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, id: str, *, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,529
|
ibm_platform_services.global_catalog_v1
|
get_visibility
|
Get the visibility constraints for an object.
This endpoint returns the visibility rules for this object. Overall visibility is
determined by the parent objects and any further restrictions on this object. You
must have an administrator role in the scope of the provided token. This endpoint
is ETag enabled.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Visibility` object
|
def get_visibility(self, id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Get the visibility constraints for an object.
This endpoint returns the visibility rules for this object. Overall visibility is
determined by the parent objects and any further restrictions on this object. You
must have an administrator role in the scope of the provided token. This endpoint
is ETag enabled.
:param str id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Visibility` 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='V1', operation_id='get_visibility'
)
headers.update(sdk_headers)
params = {'account': account}
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 = '/{id}/visibility'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, id: str, *, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,530
|
ibm_platform_services.global_catalog_v1
|
list_artifacts
|
Get artifacts.
This endpoint returns a list of artifacts for an object.
:param str object_id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Artifacts` object
|
def list_artifacts(self, object_id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Get artifacts.
This endpoint returns a list of artifacts for an object.
:param str object_id: The object's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Artifacts` object
"""
if object_id is None:
raise ValueError('object_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_artifacts'
)
headers.update(sdk_headers)
params = {'account': account}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
path_param_keys = ['object_id']
path_param_values = self.encode_path_vars(object_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{object_id}/artifacts'.format(**path_param_dict)
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, object_id: str, *, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,531
|
ibm_platform_services.global_catalog_v1
|
list_catalog_entries
|
Returns parent catalog entries.
Includes key information, such as ID, name, kind, CRN, tags, and provider. This
endpoint is ETag enabled.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A GET call by default returns a basic set of
properties. To include other properties, you must add this parameter. A
wildcard (`*`) includes all properties for an object, for example `GET
/?include=*`. To include specific metadata fields, separate each field with
a colon (:), for example `GET /?include=metadata.ui:metadata.pricing`.
:param str q: (optional) Searches the catalog entries for keywords. Add
filters to refine your search. A query filter, for example, `q=kind:iaas
service_name rc:true`, filters entries of kind iaas with
metadata.service.rc_compatible set to true and have a service name is in
their name, display name, or description. Valid tags are
**kind**:<string>, **tag**:<strging>, **rc**:[true|false],
**iam**:[true|false], **active**:[true|false], **geo**:<string>, and
**price**:<string>.
:param str sort_by: (optional) The field on which the output is sorted.
Sorts by default by **name** property. Available fields are **name**,
**displayname** (overview_ui.display_name), **kind**, **provider**
(provider.name), **sbsindex** (metadata.ui.side_by_side_index), and the
time **created**, and **updated**.
:param str descending: (optional) Sets the sort order. The default is
false, which is ascending.
:param str languages: (optional) Return the data strings in a specified
langauge. By default, the strings returned are of the language preferred by
your browser through the Accept-Langauge header, which allows an override
of the header. Languages are specified in standard form, such as `en-us`.
To include all languages use a wildcard (*).
:param bool catalog: (optional) Checks to see if a catalog's object is
visible, or if it's filtered by service, plan, deployment, or region. Use
the value `?catalog=true`. If a `200` code is returned, the object is
visible. If a `403` code is returned, the object is not visible for the
user.
:param bool complete: (optional) Returns all available fields for all
languages. Use the value `?complete=true` as shortcut for
?include=*&languages=*.
:param int offset: (optional) Useful for pagination, specifies index
(origin 0) of first item to return in response.
:param int limit: (optional) Useful for pagination, specifies the maximum
number of items to return 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 `EntrySearchResult` object
|
def list_catalog_entries(
self,
*,
account: str = None,
include: str = None,
q: str = None,
sort_by: str = None,
descending: str = None,
languages: str = None,
catalog: bool = None,
complete: bool = None,
offset: int = None,
limit: int = None,
**kwargs
) -> DetailedResponse:
"""
Returns parent catalog entries.
Includes key information, such as ID, name, kind, CRN, tags, and provider. This
endpoint is ETag enabled.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str include: (optional) A GET call by default returns a basic set of
properties. To include other properties, you must add this parameter. A
wildcard (`*`) includes all properties for an object, for example `GET
/?include=*`. To include specific metadata fields, separate each field with
a colon (:), for example `GET /?include=metadata.ui:metadata.pricing`.
:param str q: (optional) Searches the catalog entries for keywords. Add
filters to refine your search. A query filter, for example, `q=kind:iaas
service_name rc:true`, filters entries of kind iaas with
metadata.service.rc_compatible set to true and have a service name is in
their name, display name, or description. Valid tags are
**kind**:<string>, **tag**:<strging>, **rc**:[true|false],
**iam**:[true|false], **active**:[true|false], **geo**:<string>, and
**price**:<string>.
:param str sort_by: (optional) The field on which the output is sorted.
Sorts by default by **name** property. Available fields are **name**,
**displayname** (overview_ui.display_name), **kind**, **provider**
(provider.name), **sbsindex** (metadata.ui.side_by_side_index), and the
time **created**, and **updated**.
:param str descending: (optional) Sets the sort order. The default is
false, which is ascending.
:param str languages: (optional) Return the data strings in a specified
langauge. By default, the strings returned are of the language preferred by
your browser through the Accept-Langauge header, which allows an override
of the header. Languages are specified in standard form, such as `en-us`.
To include all languages use a wildcard (*).
:param bool catalog: (optional) Checks to see if a catalog's object is
visible, or if it's filtered by service, plan, deployment, or region. Use
the value `?catalog=true`. If a `200` code is returned, the object is
visible. If a `403` code is returned, the object is not visible for the
user.
:param bool complete: (optional) Returns all available fields for all
languages. Use the value `?complete=true` as shortcut for
?include=*&languages=*.
:param int offset: (optional) Useful for pagination, specifies index
(origin 0) of first item to return in response.
:param int limit: (optional) Useful for pagination, specifies the maximum
number of items to return 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 `EntrySearchResult` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='list_catalog_entries'
)
headers.update(sdk_headers)
params = {
'account': account,
'include': include,
'q': q,
'sort-by': sort_by,
'descending': descending,
'languages': languages,
'catalog': catalog,
'complete': complete,
'_offset': offset,
'_limit': limit,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
headers['Accept'] = 'application/json'
url = '/'
request = self.prepare_request(method='GET', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, *, account: Optional[str] = None, include: Optional[str] = None, q: Optional[str] = None, sort_by: Optional[str] = None, descending: Optional[str] = None, languages: Optional[str] = None, catalog: Optional[bool] = None, complete: Optional[bool] = None, offset: Optional[int] = None, limit: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,533
|
ibm_platform_services.global_catalog_v1
|
restore_catalog_entry
|
Restore archived catalog entry.
Restore an archived catalog entry. You must have an administrator role in the
scope of the provided token.
:param str id: The catalog entry's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def restore_catalog_entry(self, id: str, *, account: str = None, **kwargs) -> DetailedResponse:
"""
Restore archived catalog entry.
Restore an archived catalog entry. You must have an administrator role in the
scope of the provided token.
:param str id: The catalog entry's unique ID.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
: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='V1', operation_id='restore_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account}
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 = '/{id}/restore'.format(**path_param_dict)
request = self.prepare_request(method='PUT', url=url, headers=headers, params=params)
response = self.send(request)
return response
|
(self, id: str, *, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,541
|
ibm_platform_services.global_catalog_v1
|
update_catalog_entry
|
Update a catalog entry.
Update a catalog entry. The visibility of the catalog entry cannot be modified
with this endpoint. You must be an administrator or editor in the scope of the
provided token. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param str name: Programmatic name for this catalog entry, which must be
formatted like a CRN segment. See the display name in OverviewUI for a
user-readable name.
:param str kind: The type of catalog entry, **service**, **template**,
**dashboard**, which determines the type and shape of the object.
:param dict overview_ui: Overview is nested in the top level. The key value
pair is `[_language_]overview_ui`.
:param Image images: Image annotation for this catalog entry. The image is
a URL.
:param bool disabled: Boolean value that determines the global visibility
for the catalog entry, and its children. If it is not enabled, all plans
are disabled.
:param List[str] tags: A list of tags. For example, IBM, 3rd Party, Beta,
GA, and Single Tenant.
:param Provider provider: Information related to the provider associated
with a catalog entry.
:param str parent_id: (optional) The ID of the parent catalog entry if it
exists.
:param bool group: (optional) Boolean value that determines whether the
catalog entry is a group.
:param bool active: (optional) Boolean value that describes whether the
service is active.
:param ObjectMetadataSet metadata: (optional) Model used to describe
metadata object that can be set.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str move: (optional) Reparenting object. In the body set the
parent_id to a different parent. Or remove the parent_id field to reparent
to the root of the catalog. If this is not set to 'true' then changing the
parent_id in the body of the request will not be permitted. If this is
'true' and no change to parent_id then this is also error. This is to
prevent accidental changing of parent.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` object
|
def update_catalog_entry(
self,
id: str,
name: str,
kind: str,
overview_ui: dict,
images: 'Image',
disabled: bool,
tags: List[str],
provider: 'Provider',
*,
parent_id: str = None,
group: bool = None,
active: bool = None,
metadata: 'ObjectMetadataSet' = None,
account: str = None,
move: str = None,
**kwargs
) -> DetailedResponse:
"""
Update a catalog entry.
Update a catalog entry. The visibility of the catalog entry cannot be modified
with this endpoint. You must be an administrator or editor in the scope of the
provided token. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param str name: Programmatic name for this catalog entry, which must be
formatted like a CRN segment. See the display name in OverviewUI for a
user-readable name.
:param str kind: The type of catalog entry, **service**, **template**,
**dashboard**, which determines the type and shape of the object.
:param dict overview_ui: Overview is nested in the top level. The key value
pair is `[_language_]overview_ui`.
:param Image images: Image annotation for this catalog entry. The image is
a URL.
:param bool disabled: Boolean value that determines the global visibility
for the catalog entry, and its children. If it is not enabled, all plans
are disabled.
:param List[str] tags: A list of tags. For example, IBM, 3rd Party, Beta,
GA, and Single Tenant.
:param Provider provider: Information related to the provider associated
with a catalog entry.
:param str parent_id: (optional) The ID of the parent catalog entry if it
exists.
:param bool group: (optional) Boolean value that determines whether the
catalog entry is a group.
:param bool active: (optional) Boolean value that describes whether the
service is active.
:param ObjectMetadataSet metadata: (optional) Model used to describe
metadata object that can be set.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param str move: (optional) Reparenting object. In the body set the
parent_id to a different parent. Or remove the parent_id field to reparent
to the root of the catalog. If this is not set to 'true' then changing the
parent_id in the body of the request will not be permitted. If this is
'true' and no change to parent_id then this is also error. This is to
prevent accidental changing of parent.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CatalogEntry` object
"""
if id is None:
raise ValueError('id must be provided')
if name is None:
raise ValueError('name must be provided')
if kind is None:
raise ValueError('kind must be provided')
if overview_ui is None:
raise ValueError('overview_ui must be provided')
if images is None:
raise ValueError('images must be provided')
if disabled is None:
raise ValueError('disabled must be provided')
if tags is None:
raise ValueError('tags must be provided')
if provider is None:
raise ValueError('provider must be provided')
images = convert_model(images)
provider = convert_model(provider)
if metadata is not None:
metadata = convert_model(metadata)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_catalog_entry'
)
headers.update(sdk_headers)
params = {'account': account, 'move': move}
data = {
'name': name,
'kind': kind,
'overview_ui': overview_ui,
'images': images,
'disabled': disabled,
'tags': tags,
'provider': provider,
'parent_id': parent_id,
'group': group,
'active': active,
'metadata': metadata,
}
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 = '/{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, id: str, name: str, kind: str, overview_ui: dict, images: ibm_platform_services.global_catalog_v1.Image, disabled: bool, tags: List[str], provider: ibm_platform_services.global_catalog_v1.Provider, *, parent_id: Optional[str] = None, group: Optional[bool] = None, active: Optional[bool] = None, metadata: Optional[ibm_platform_services.global_catalog_v1.ObjectMetadataSet] = None, account: Optional[str] = None, move: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,542
|
ibm_platform_services.global_catalog_v1
|
update_visibility
|
Update visibility.
Update an Object's Visibility. You must have an administrator role in the scope of
the provided token. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param bool extendable: (optional) Allows the visibility to be extenable.
:param VisibilityDetail include: (optional) Visibility details related to a
catalog entry.
:param VisibilityDetail exclude: (optional) Visibility details related to a
catalog entry.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def update_visibility(
self,
id: str,
*,
extendable: bool = None,
include: 'VisibilityDetail' = None,
exclude: 'VisibilityDetail' = None,
account: str = None,
**kwargs
) -> DetailedResponse:
"""
Update visibility.
Update an Object's Visibility. You must have an administrator role in the scope of
the provided token. This endpoint is ETag enabled.
:param str id: The object's unique ID.
:param bool extendable: (optional) Allows the visibility to be extenable.
:param VisibilityDetail include: (optional) Visibility details related to a
catalog entry.
:param VisibilityDetail exclude: (optional) Visibility details related to a
catalog entry.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
: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')
if include is not None:
include = convert_model(include)
if exclude is not None:
exclude = convert_model(exclude)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='update_visibility'
)
headers.update(sdk_headers)
params = {'account': account}
data = {'extendable': extendable, 'include': include, 'exclude': exclude}
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'))
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{id}/visibility'.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, id: str, *, extendable: Optional[bool] = None, include: Optional[ibm_platform_services.global_catalog_v1.VisibilityDetail] = None, exclude: Optional[ibm_platform_services.global_catalog_v1.VisibilityDetail] = None, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,543
|
ibm_platform_services.global_catalog_v1
|
upload_artifact
|
Upload artifact.
This endpoint uploads the binary for an artifact. Only administrators and editors
can upload artifacts.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param BinaryIO artifact: (optional)
:param str content_type: (optional) The type of the input.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def upload_artifact(
self,
object_id: str,
artifact_id: str,
*,
artifact: BinaryIO = None,
content_type: str = None,
account: str = None,
**kwargs
) -> DetailedResponse:
"""
Upload artifact.
This endpoint uploads the binary for an artifact. Only administrators and editors
can upload artifacts.
:param str object_id: The object's unique ID.
:param str artifact_id: The artifact's ID.
:param BinaryIO artifact: (optional)
:param str content_type: (optional) The type of the input.
:param str account: (optional) This changes the scope of the request
regardless of the authorization header. Example scopes are `account` and
`global`. `account=global` is reqired if operating with a service ID that
has a global admin policy, for example `GET /?account=global`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if object_id is None:
raise ValueError('object_id must be provided')
if artifact_id is None:
raise ValueError('artifact_id must be provided')
headers = {'Content-Type': content_type}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME, service_version='V1', operation_id='upload_artifact'
)
headers.update(sdk_headers)
params = {'account': account}
data = artifact
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
path_param_keys = ['object_id', 'artifact_id']
path_param_values = self.encode_path_vars(object_id, artifact_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/{object_id}/artifacts/{artifact_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, object_id: str, artifact_id: str, *, artifact: Optional[BinaryIO] = None, content_type: Optional[str] = None, account: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,544
|
ibm_platform_services.global_search_v2
|
GlobalSearchV2
|
The global_search V2 service.
|
class GlobalSearchV2(BaseService):
"""The global_search V2 service."""
DEFAULT_SERVICE_URL = 'https://api.global-search-tagging.cloud.ibm.com'
DEFAULT_SERVICE_NAME = 'global_search'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'GlobalSearchV2':
"""
Return a new client for the global_search 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 global_search 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)
#########################
# Search
#########################
def search(
self,
*,
query: Optional[str] = None,
fields: Optional[List[str]] = None,
search_cursor: Optional[str] = None,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
limit: Optional[int] = None,
timeout: Optional[int] = None,
sort: Optional[List[str]] = None,
is_deleted: Optional[str] = None,
is_reclaimed: Optional[str] = None,
is_public: Optional[str] = None,
impersonate_user: Optional[str] = None,
can_tag: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Find instances of resources (v3).
Find IAM-enabled resources or storage and network resources that run on classic
infrastructure in a specific account ID. You can apply query strings if necessary.
To filter results, you can insert a string by using the Lucene syntax and the
query string is parsed into a series of terms and operators. A term can be a
single word or a phrase, in which case the search is performed for all the words,
in the same order. To filter for a specific value regardless of the property that
contains it, type the search term without specifying a field. Only resources that
belong to the account ID and that are accessible by the client are returned.
You must use `/v3/resources/search` when you need to fetch more than `10000`
resource items. On the first call, the operation returns a live cursor on the data
that you must use on all the subsequent calls to get the next batch of results
until you get the empty result set.
By default, the fields that are returned for every resource are `crn`, `name`,
`family`, `type`, and `account_id`. You can specify the subset of the fields you
want in your request using the `fields` request body attribute. Set `"fields":
["*"]` to discover the set of fields which are available to request.
:param str query: (optional) The Lucene-formatted query string. Default to
'*' if not set.
:param List[str] fields: (optional) The list of the fields returned by the
search. By default, the returned fields are the `account_id`, `name`,
`type`, `family`, and `crn`. For all queries, `crn` is always returned. You
may set `"fields": ["*"]` to discover the set of fields available to
request.
:param str search_cursor: (optional) An opaque cursor that is returned on
each call and that must be set on the subsequent call to get the next batch
of items. If the search returns no items, then the search_cursor is not
present in the response.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The account ID to filter resources.
:param int limit: (optional) The maximum number of hits to return. Defaults
to 10.
:param int timeout: (optional) A search timeout in milliseconds, bounding
the search request to run within the specified time value and bail with the
hits accumulated up to that point when expired. Defaults to the system
defined timeout.
:param List[str] sort: (optional) Comma separated properties names that are
used for sorting.
:param str is_deleted: (optional) Determines if deleted documents should be
included in result set or not. Possible values are false (default), true or
any. If false, only existing documents are returned; if true, only deleted
documents are returned; If any, both existing and deleted documents are
returned. (_for administrators only_).
:param str is_reclaimed: (optional) Determines if reclaimed documents
should be included in result set or not. Possible values are false
(default), true or any. If false, only not reclaimed documents are
returned; if true, only reclaimed documents are returned; If any, both
reclaimed and not reclaimed documents are returned.
:param str is_public: (optional) Determines if public resources should be
included in result set or not. Possible values are false (default), true or
any. If false, do not search public resources; if true, search only public
resources; If any, search also public resources.
:param str impersonate_user: (optional) The user on whose behalf the search
must be performed. Only a GhoST admin can impersonate a user, so be sure
you set a GhoST admin IAM token in the Authorization header if you set this
parameter. (_for administrators only_).
:param str can_tag: (optional) Determines if the result set must return the
resources that the user can tag or the resources that the user can view
(only a GhoST admin can use this parameter). If false (default), only
resources user can view are returned; if true, only resources that user has
permissions for tagging are returned (_for administrators only_).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ScanResult` object
"""
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='search',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'limit': limit,
'timeout': timeout,
'sort': convert_list(sort),
'is_deleted': is_deleted,
'is_reclaimed': is_reclaimed,
'is_public': is_public,
'impersonate_user': impersonate_user,
'can_tag': can_tag,
}
data = {
'query': query,
'fields': fields,
'search_cursor': search_cursor,
}
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 = '/v3/resources/search'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
|
719,545
|
ibm_platform_services.global_search_v2
|
__init__
|
Construct a new client for the global_search 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 global_search 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,558
|
ibm_platform_services.global_search_v2
|
search
|
Find instances of resources (v3).
Find IAM-enabled resources or storage and network resources that run on classic
infrastructure in a specific account ID. You can apply query strings if necessary.
To filter results, you can insert a string by using the Lucene syntax and the
query string is parsed into a series of terms and operators. A term can be a
single word or a phrase, in which case the search is performed for all the words,
in the same order. To filter for a specific value regardless of the property that
contains it, type the search term without specifying a field. Only resources that
belong to the account ID and that are accessible by the client are returned.
You must use `/v3/resources/search` when you need to fetch more than `10000`
resource items. On the first call, the operation returns a live cursor on the data
that you must use on all the subsequent calls to get the next batch of results
until you get the empty result set.
By default, the fields that are returned for every resource are `crn`, `name`,
`family`, `type`, and `account_id`. You can specify the subset of the fields you
want in your request using the `fields` request body attribute. Set `"fields":
["*"]` to discover the set of fields which are available to request.
:param str query: (optional) The Lucene-formatted query string. Default to
'*' if not set.
:param List[str] fields: (optional) The list of the fields returned by the
search. By default, the returned fields are the `account_id`, `name`,
`type`, `family`, and `crn`. For all queries, `crn` is always returned. You
may set `"fields": ["*"]` to discover the set of fields available to
request.
:param str search_cursor: (optional) An opaque cursor that is returned on
each call and that must be set on the subsequent call to get the next batch
of items. If the search returns no items, then the search_cursor is not
present in the response.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The account ID to filter resources.
:param int limit: (optional) The maximum number of hits to return. Defaults
to 10.
:param int timeout: (optional) A search timeout in milliseconds, bounding
the search request to run within the specified time value and bail with the
hits accumulated up to that point when expired. Defaults to the system
defined timeout.
:param List[str] sort: (optional) Comma separated properties names that are
used for sorting.
:param str is_deleted: (optional) Determines if deleted documents should be
included in result set or not. Possible values are false (default), true or
any. If false, only existing documents are returned; if true, only deleted
documents are returned; If any, both existing and deleted documents are
returned. (_for administrators only_).
:param str is_reclaimed: (optional) Determines if reclaimed documents
should be included in result set or not. Possible values are false
(default), true or any. If false, only not reclaimed documents are
returned; if true, only reclaimed documents are returned; If any, both
reclaimed and not reclaimed documents are returned.
:param str is_public: (optional) Determines if public resources should be
included in result set or not. Possible values are false (default), true or
any. If false, do not search public resources; if true, search only public
resources; If any, search also public resources.
:param str impersonate_user: (optional) The user on whose behalf the search
must be performed. Only a GhoST admin can impersonate a user, so be sure
you set a GhoST admin IAM token in the Authorization header if you set this
parameter. (_for administrators only_).
:param str can_tag: (optional) Determines if the result set must return the
resources that the user can tag or the resources that the user can view
(only a GhoST admin can use this parameter). If false (default), only
resources user can view are returned; if true, only resources that user has
permissions for tagging are returned (_for administrators only_).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ScanResult` object
|
def search(
self,
*,
query: Optional[str] = None,
fields: Optional[List[str]] = None,
search_cursor: Optional[str] = None,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
limit: Optional[int] = None,
timeout: Optional[int] = None,
sort: Optional[List[str]] = None,
is_deleted: Optional[str] = None,
is_reclaimed: Optional[str] = None,
is_public: Optional[str] = None,
impersonate_user: Optional[str] = None,
can_tag: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Find instances of resources (v3).
Find IAM-enabled resources or storage and network resources that run on classic
infrastructure in a specific account ID. You can apply query strings if necessary.
To filter results, you can insert a string by using the Lucene syntax and the
query string is parsed into a series of terms and operators. A term can be a
single word or a phrase, in which case the search is performed for all the words,
in the same order. To filter for a specific value regardless of the property that
contains it, type the search term without specifying a field. Only resources that
belong to the account ID and that are accessible by the client are returned.
You must use `/v3/resources/search` when you need to fetch more than `10000`
resource items. On the first call, the operation returns a live cursor on the data
that you must use on all the subsequent calls to get the next batch of results
until you get the empty result set.
By default, the fields that are returned for every resource are `crn`, `name`,
`family`, `type`, and `account_id`. You can specify the subset of the fields you
want in your request using the `fields` request body attribute. Set `"fields":
["*"]` to discover the set of fields which are available to request.
:param str query: (optional) The Lucene-formatted query string. Default to
'*' if not set.
:param List[str] fields: (optional) The list of the fields returned by the
search. By default, the returned fields are the `account_id`, `name`,
`type`, `family`, and `crn`. For all queries, `crn` is always returned. You
may set `"fields": ["*"]` to discover the set of fields available to
request.
:param str search_cursor: (optional) An opaque cursor that is returned on
each call and that must be set on the subsequent call to get the next batch
of items. If the search returns no items, then the search_cursor is not
present in the response.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The account ID to filter resources.
:param int limit: (optional) The maximum number of hits to return. Defaults
to 10.
:param int timeout: (optional) A search timeout in milliseconds, bounding
the search request to run within the specified time value and bail with the
hits accumulated up to that point when expired. Defaults to the system
defined timeout.
:param List[str] sort: (optional) Comma separated properties names that are
used for sorting.
:param str is_deleted: (optional) Determines if deleted documents should be
included in result set or not. Possible values are false (default), true or
any. If false, only existing documents are returned; if true, only deleted
documents are returned; If any, both existing and deleted documents are
returned. (_for administrators only_).
:param str is_reclaimed: (optional) Determines if reclaimed documents
should be included in result set or not. Possible values are false
(default), true or any. If false, only not reclaimed documents are
returned; if true, only reclaimed documents are returned; If any, both
reclaimed and not reclaimed documents are returned.
:param str is_public: (optional) Determines if public resources should be
included in result set or not. Possible values are false (default), true or
any. If false, do not search public resources; if true, search only public
resources; If any, search also public resources.
:param str impersonate_user: (optional) The user on whose behalf the search
must be performed. Only a GhoST admin can impersonate a user, so be sure
you set a GhoST admin IAM token in the Authorization header if you set this
parameter. (_for administrators only_).
:param str can_tag: (optional) Determines if the result set must return the
resources that the user can tag or the resources that the user can view
(only a GhoST admin can use this parameter). If false (default), only
resources user can view are returned; if true, only resources that user has
permissions for tagging are returned (_for administrators only_).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ScanResult` object
"""
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='search',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'limit': limit,
'timeout': timeout,
'sort': convert_list(sort),
'is_deleted': is_deleted,
'is_reclaimed': is_reclaimed,
'is_public': is_public,
'impersonate_user': impersonate_user,
'can_tag': can_tag,
}
data = {
'query': query,
'fields': fields,
'search_cursor': search_cursor,
}
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 = '/v3/resources/search'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, *, query: Optional[str] = None, fields: Optional[List[str]] = None, search_cursor: Optional[str] = None, x_request_id: Optional[str] = None, x_correlation_id: Optional[str] = None, account_id: Optional[str] = None, limit: Optional[int] = None, timeout: Optional[int] = None, sort: Optional[List[str]] = None, is_deleted: Optional[str] = None, is_reclaimed: Optional[str] = None, is_public: Optional[str] = None, impersonate_user: Optional[str] = None, can_tag: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,566
|
ibm_platform_services.global_tagging_v1
|
GlobalTaggingV1
|
The global_tagging V1 service.
|
class GlobalTaggingV1(BaseService):
"""The global_tagging V1 service."""
DEFAULT_SERVICE_URL = 'https://tags.global-search-tagging.cloud.ibm.com'
DEFAULT_SERVICE_NAME = 'global_tagging'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'GlobalTaggingV1':
"""
Return a new client for the global_tagging 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 global_tagging 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)
#########################
# tags
#########################
def list_tags(
self,
*,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
full_data: Optional[bool] = None,
providers: Optional[List[str]] = None,
attached_to: Optional[str] = None,
offset: Optional[int] = None,
limit: Optional[int] = None,
timeout: Optional[int] = None,
order_by_name: Optional[str] = None,
attached_only: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get all tags.
Lists all tags that are in a billing account. Use the `attached_to` parameter to
return the list of tags that are attached to the specified resource.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account to list the
tags for. If it is not set, then it is taken from the authorization token.
This parameter is required if `tag_type` is set to `service`.
:param str tag_type: (optional) The type of the tag you want to list.
Supported values are `user`, `service` and `access`.
:param bool full_data: (optional) If set to `true`, this query returns the
provider, `ghost`, `ims` or `ghost,ims`, where the tag exists and the
number of attached resources.
:param List[str] providers: (optional) Select a provider. Supported values
are `ghost` and `ims`. To list both Global Search and Tagging tags and
infrastructure tags, use `ghost,ims`. `service` and `access` tags can only
be attached to resources that are onboarded to Global Search and Tagging,
so you should not set this parameter to list them.
:param str attached_to: (optional) If you want to return only the list of
tags that are attached to a specified resource, pass the ID of the resource
on this parameter. For resources that are onboarded to Global Search and
Tagging, the resource ID is the CRN; for IMS resources, it is the IMS ID.
When using this parameter, you must specify the appropriate provider (`ims`
or `ghost`).
:param int offset: (optional) The offset is the index of the item from
which you want to start returning data from.
:param int limit: (optional) The number of tags to return.
:param int timeout: (optional) The timeout in milliseconds, bounds the
request to run within the specified time value. It returns the accumulated
results until time runs out.
:param str order_by_name: (optional) Order the output by tag name.
:param bool attached_only: (optional) Filter on attached tags. If `true`,
it returns only tags that are attached to one or more resources. If
`false`, it returns all tags.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagList` object
"""
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_tags',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'tag_type': tag_type,
'full_data': full_data,
'providers': convert_list(providers),
'attached_to': attached_to,
'offset': offset,
'limit': limit,
'timeout': timeout,
'order_by_name': order_by_name,
'attached_only': attached_only,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v3/tags'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_tag(
self,
tag_names: List[str],
*,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create an access management tag.
Create an access management tag. To create an `access` tag, you must have the
access listed in the [Granting users access to tag
resources](https://cloud.ibm.com/docs/account?topic=account-access) documentation.
`service` and `user` tags cannot be created upfront. They are created when they
are attached for the first time to a resource.
:param List[str] tag_names: An array of tag names to create.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account where the
tag must be created.
:param str tag_type: (optional) The type of the tags you want to create.
The only allowed value is `access`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateTagResults` object
"""
if tag_names is None:
raise ValueError('tag_names must be provided')
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_tag',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'tag_type': tag_type,
}
data = {
'tag_names': tag_names,
}
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 = '/v3/tags'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_tag_all(
self,
*,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
providers: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Delete all unused tags.
Delete the tags that are not attached to any resource.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str providers: (optional) Select a provider. Supported values are
`ghost` and `ims`.
:param str account_id: (optional) The ID of the billing account to delete
the tags for. If it is not set, then it is taken from the authorization
token. It is a required parameter if `tag_type` is set to `service`.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources (`providers` parameter set to `ims`).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DeleteTagsResult` object
"""
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_tag_all',
)
headers.update(sdk_headers)
params = {
'providers': providers,
'account_id': account_id,
'tag_type': tag_type,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v3/tags'
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def delete_tag(
self,
tag_name: str,
*,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
providers: Optional[List[str]] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Delete an unused tag.
Delete an existing tag. A tag can be deleted only if it is not attached to any
resource.
:param str tag_name: The name of tag to be deleted.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param List[str] providers: (optional) Select a provider. Supported values
are `ghost` and `ims`. To delete tags both in Global Search and Tagging and
in IMS, use `ghost,ims`.
:param str account_id: (optional) The ID of the billing account to delete
the tag for. It is a required parameter if `tag_type` is set to `service`,
otherwise it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources (`providers` parameter set to `ims`).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DeleteTagResults` object
"""
if not tag_name:
raise ValueError('tag_name must be provided')
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_tag',
)
headers.update(sdk_headers)
params = {
'providers': convert_list(providers),
'account_id': account_id,
'tag_type': tag_type,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['tag_name']
path_param_values = self.encode_path_vars(tag_name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v3/tags/{tag_name}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def attach_tag(
self,
resources: List['Resource'],
*,
tag_name: Optional[str] = None,
tag_names: Optional[List[str]] = None,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
replace: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Attach tags.
Attaches one or more tags to one or more resources. Each resource can have no more
than 1000 tags per each 'user' and 'service' type, and no more than 250 'access'
tags (which is the account limit).
:param List[Resource] resources: List of resources on which the tag or tags
are attached.
:param str tag_name: (optional) The name of the tag to attach.
:param List[str] tag_names: (optional) An array of tag names to attach.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account of the
tagged resource. It is a required parameter if `tag_type` is set to
`service`. Otherwise, it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources.
:param bool replace: (optional) Flag to request replacement of all attached
tags. Set 'true' if you want to replace all the list of tags attached to
the resource. Default value is false.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
"""
if resources is None:
raise ValueError('resources must be provided')
resources = [convert_model(x) for x in resources]
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='attach_tag',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'tag_type': tag_type,
'replace': replace,
}
data = {
'resources': resources,
'tag_name': tag_name,
'tag_names': tag_names,
}
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 = '/v3/tags/attach'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
def detach_tag(
self,
resources: List['Resource'],
*,
tag_name: Optional[str] = None,
tag_names: Optional[List[str]] = None,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Detach tags.
Detaches one or more tags from one or more resources.
:param List[Resource] resources: List of resources on which the tag or tags
are detached.
:param str tag_name: (optional) The name of the tag to detach.
:param List[str] tag_names: (optional) An array of tag names to detach.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account of the
untagged resource. It is a required parameter if `tag_type` is set to
`service`, otherwise it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
"""
if resources is None:
raise ValueError('resources must be provided')
resources = [convert_model(x) for x in resources]
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='detach_tag',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'tag_type': tag_type,
}
data = {
'resources': resources,
'tag_name': tag_name,
'tag_names': tag_names,
}
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 = '/v3/tags/detach'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
|
719,567
|
ibm_platform_services.global_tagging_v1
|
__init__
|
Construct a new client for the global_tagging 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 global_tagging 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,572
|
ibm_platform_services.global_tagging_v1
|
attach_tag
|
Attach tags.
Attaches one or more tags to one or more resources. Each resource can have no more
than 1000 tags per each 'user' and 'service' type, and no more than 250 'access'
tags (which is the account limit).
:param List[Resource] resources: List of resources on which the tag or tags
are attached.
:param str tag_name: (optional) The name of the tag to attach.
:param List[str] tag_names: (optional) An array of tag names to attach.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account of the
tagged resource. It is a required parameter if `tag_type` is set to
`service`. Otherwise, it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources.
:param bool replace: (optional) Flag to request replacement of all attached
tags. Set 'true' if you want to replace all the list of tags attached to
the resource. Default value is false.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
|
def attach_tag(
self,
resources: List['Resource'],
*,
tag_name: Optional[str] = None,
tag_names: Optional[List[str]] = None,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
replace: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Attach tags.
Attaches one or more tags to one or more resources. Each resource can have no more
than 1000 tags per each 'user' and 'service' type, and no more than 250 'access'
tags (which is the account limit).
:param List[Resource] resources: List of resources on which the tag or tags
are attached.
:param str tag_name: (optional) The name of the tag to attach.
:param List[str] tag_names: (optional) An array of tag names to attach.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account of the
tagged resource. It is a required parameter if `tag_type` is set to
`service`. Otherwise, it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources.
:param bool replace: (optional) Flag to request replacement of all attached
tags. Set 'true' if you want to replace all the list of tags attached to
the resource. Default value is false.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
"""
if resources is None:
raise ValueError('resources must be provided')
resources = [convert_model(x) for x in resources]
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='attach_tag',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'tag_type': tag_type,
'replace': replace,
}
data = {
'resources': resources,
'tag_name': tag_name,
'tag_names': tag_names,
}
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 = '/v3/tags/attach'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, resources: List[ibm_platform_services.global_tagging_v1.Resource], *, tag_name: Optional[str] = None, tag_names: Optional[List[str]] = None, x_request_id: Optional[str] = None, x_correlation_id: Optional[str] = None, account_id: Optional[str] = None, tag_type: Optional[str] = None, replace: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,574
|
ibm_platform_services.global_tagging_v1
|
create_tag
|
Create an access management tag.
Create an access management tag. To create an `access` tag, you must have the
access listed in the [Granting users access to tag
resources](https://cloud.ibm.com/docs/account?topic=account-access) documentation.
`service` and `user` tags cannot be created upfront. They are created when they
are attached for the first time to a resource.
:param List[str] tag_names: An array of tag names to create.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account where the
tag must be created.
:param str tag_type: (optional) The type of the tags you want to create.
The only allowed value is `access`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateTagResults` object
|
def create_tag(
self,
tag_names: List[str],
*,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create an access management tag.
Create an access management tag. To create an `access` tag, you must have the
access listed in the [Granting users access to tag
resources](https://cloud.ibm.com/docs/account?topic=account-access) documentation.
`service` and `user` tags cannot be created upfront. They are created when they
are attached for the first time to a resource.
:param List[str] tag_names: An array of tag names to create.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account where the
tag must be created.
:param str tag_type: (optional) The type of the tags you want to create.
The only allowed value is `access`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CreateTagResults` object
"""
if tag_names is None:
raise ValueError('tag_names must be provided')
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_tag',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'tag_type': tag_type,
}
data = {
'tag_names': tag_names,
}
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 = '/v3/tags'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, tag_names: List[str], *, x_request_id: Optional[str] = None, x_correlation_id: Optional[str] = None, account_id: Optional[str] = None, tag_type: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,575
|
ibm_platform_services.global_tagging_v1
|
delete_tag
|
Delete an unused tag.
Delete an existing tag. A tag can be deleted only if it is not attached to any
resource.
:param str tag_name: The name of tag to be deleted.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param List[str] providers: (optional) Select a provider. Supported values
are `ghost` and `ims`. To delete tags both in Global Search and Tagging and
in IMS, use `ghost,ims`.
:param str account_id: (optional) The ID of the billing account to delete
the tag for. It is a required parameter if `tag_type` is set to `service`,
otherwise it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources (`providers` parameter set to `ims`).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DeleteTagResults` object
|
def delete_tag(
self,
tag_name: str,
*,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
providers: Optional[List[str]] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Delete an unused tag.
Delete an existing tag. A tag can be deleted only if it is not attached to any
resource.
:param str tag_name: The name of tag to be deleted.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param List[str] providers: (optional) Select a provider. Supported values
are `ghost` and `ims`. To delete tags both in Global Search and Tagging and
in IMS, use `ghost,ims`.
:param str account_id: (optional) The ID of the billing account to delete
the tag for. It is a required parameter if `tag_type` is set to `service`,
otherwise it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources (`providers` parameter set to `ims`).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DeleteTagResults` object
"""
if not tag_name:
raise ValueError('tag_name must be provided')
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_tag',
)
headers.update(sdk_headers)
params = {
'providers': convert_list(providers),
'account_id': account_id,
'tag_type': tag_type,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['tag_name']
path_param_values = self.encode_path_vars(tag_name)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v3/tags/{tag_name}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, tag_name: str, *, x_request_id: Optional[str] = None, x_correlation_id: Optional[str] = None, providers: Optional[List[str]] = None, account_id: Optional[str] = None, tag_type: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,576
|
ibm_platform_services.global_tagging_v1
|
delete_tag_all
|
Delete all unused tags.
Delete the tags that are not attached to any resource.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str providers: (optional) Select a provider. Supported values are
`ghost` and `ims`.
:param str account_id: (optional) The ID of the billing account to delete
the tags for. If it is not set, then it is taken from the authorization
token. It is a required parameter if `tag_type` is set to `service`.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources (`providers` parameter set to `ims`).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DeleteTagsResult` object
|
def delete_tag_all(
self,
*,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
providers: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Delete all unused tags.
Delete the tags that are not attached to any resource.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str providers: (optional) Select a provider. Supported values are
`ghost` and `ims`.
:param str account_id: (optional) The ID of the billing account to delete
the tags for. If it is not set, then it is taken from the authorization
token. It is a required parameter if `tag_type` is set to `service`.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources (`providers` parameter set to `ims`).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DeleteTagsResult` object
"""
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_tag_all',
)
headers.update(sdk_headers)
params = {
'providers': providers,
'account_id': account_id,
'tag_type': tag_type,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v3/tags'
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, *, x_request_id: Optional[str] = None, x_correlation_id: Optional[str] = None, providers: Optional[str] = None, account_id: Optional[str] = None, tag_type: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,577
|
ibm_platform_services.global_tagging_v1
|
detach_tag
|
Detach tags.
Detaches one or more tags from one or more resources.
:param List[Resource] resources: List of resources on which the tag or tags
are detached.
:param str tag_name: (optional) The name of the tag to detach.
:param List[str] tag_names: (optional) An array of tag names to detach.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account of the
untagged resource. It is a required parameter if `tag_type` is set to
`service`, otherwise it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
|
def detach_tag(
self,
resources: List['Resource'],
*,
tag_name: Optional[str] = None,
tag_names: Optional[List[str]] = None,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Detach tags.
Detaches one or more tags from one or more resources.
:param List[Resource] resources: List of resources on which the tag or tags
are detached.
:param str tag_name: (optional) The name of the tag to detach.
:param List[str] tag_names: (optional) An array of tag names to detach.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account of the
untagged resource. It is a required parameter if `tag_type` is set to
`service`, otherwise it is inferred from the authorization IAM token.
:param str tag_type: (optional) The type of the tag. Supported values are
`user`, `service` and `access`. `service` and `access` are not supported
for IMS resources.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagResults` object
"""
if resources is None:
raise ValueError('resources must be provided')
resources = [convert_model(x) for x in resources]
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='detach_tag',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'tag_type': tag_type,
}
data = {
'resources': resources,
'tag_name': tag_name,
'tag_names': tag_names,
}
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 = '/v3/tags/detach'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, resources: List[ibm_platform_services.global_tagging_v1.Resource], *, tag_name: Optional[str] = None, tag_names: Optional[List[str]] = None, x_request_id: Optional[str] = None, x_correlation_id: Optional[str] = None, account_id: Optional[str] = None, tag_type: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,584
|
ibm_platform_services.global_tagging_v1
|
list_tags
|
Get all tags.
Lists all tags that are in a billing account. Use the `attached_to` parameter to
return the list of tags that are attached to the specified resource.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account to list the
tags for. If it is not set, then it is taken from the authorization token.
This parameter is required if `tag_type` is set to `service`.
:param str tag_type: (optional) The type of the tag you want to list.
Supported values are `user`, `service` and `access`.
:param bool full_data: (optional) If set to `true`, this query returns the
provider, `ghost`, `ims` or `ghost,ims`, where the tag exists and the
number of attached resources.
:param List[str] providers: (optional) Select a provider. Supported values
are `ghost` and `ims`. To list both Global Search and Tagging tags and
infrastructure tags, use `ghost,ims`. `service` and `access` tags can only
be attached to resources that are onboarded to Global Search and Tagging,
so you should not set this parameter to list them.
:param str attached_to: (optional) If you want to return only the list of
tags that are attached to a specified resource, pass the ID of the resource
on this parameter. For resources that are onboarded to Global Search and
Tagging, the resource ID is the CRN; for IMS resources, it is the IMS ID.
When using this parameter, you must specify the appropriate provider (`ims`
or `ghost`).
:param int offset: (optional) The offset is the index of the item from
which you want to start returning data from.
:param int limit: (optional) The number of tags to return.
:param int timeout: (optional) The timeout in milliseconds, bounds the
request to run within the specified time value. It returns the accumulated
results until time runs out.
:param str order_by_name: (optional) Order the output by tag name.
:param bool attached_only: (optional) Filter on attached tags. If `true`,
it returns only tags that are attached to one or more resources. If
`false`, it returns all tags.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagList` object
|
def list_tags(
self,
*,
x_request_id: Optional[str] = None,
x_correlation_id: Optional[str] = None,
account_id: Optional[str] = None,
tag_type: Optional[str] = None,
full_data: Optional[bool] = None,
providers: Optional[List[str]] = None,
attached_to: Optional[str] = None,
offset: Optional[int] = None,
limit: Optional[int] = None,
timeout: Optional[int] = None,
order_by_name: Optional[str] = None,
attached_only: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get all tags.
Lists all tags that are in a billing account. Use the `attached_to` parameter to
return the list of tags that are attached to the specified resource.
:param str x_request_id: (optional) An alphanumeric string that is used to
trace the request. The value may include ASCII alphanumerics and any of
following segment separators: space ( ), comma (,), hyphen, (-), and
underscore (_) and may have a length up to 1024 bytes. The value is
considered invalid and must be ignored if that value includes any other
character or is longer than 1024 bytes or is fewer than 8 characters. If
not specified or invalid, it is automatically replaced by a random (version
4) UUID.
:param str x_correlation_id: (optional) An alphanumeric string that is used
to trace the request as a part of a larger context: the same value is used
for downstream requests and retries of those requests. The value may
include ASCII alphanumerics and any of following segment separators: space
( ), comma (,), hyphen, (-), and underscore (_) and may have a length up to
1024 bytes. The value is considered invalid and must be ignored if that
value includes any other character or is longer than 1024 bytes or is fewer
than 8 characters. If not specified or invalid, it is automatically
replaced by a random (version 4) UUID.
:param str account_id: (optional) The ID of the billing account to list the
tags for. If it is not set, then it is taken from the authorization token.
This parameter is required if `tag_type` is set to `service`.
:param str tag_type: (optional) The type of the tag you want to list.
Supported values are `user`, `service` and `access`.
:param bool full_data: (optional) If set to `true`, this query returns the
provider, `ghost`, `ims` or `ghost,ims`, where the tag exists and the
number of attached resources.
:param List[str] providers: (optional) Select a provider. Supported values
are `ghost` and `ims`. To list both Global Search and Tagging tags and
infrastructure tags, use `ghost,ims`. `service` and `access` tags can only
be attached to resources that are onboarded to Global Search and Tagging,
so you should not set this parameter to list them.
:param str attached_to: (optional) If you want to return only the list of
tags that are attached to a specified resource, pass the ID of the resource
on this parameter. For resources that are onboarded to Global Search and
Tagging, the resource ID is the CRN; for IMS resources, it is the IMS ID.
When using this parameter, you must specify the appropriate provider (`ims`
or `ghost`).
:param int offset: (optional) The offset is the index of the item from
which you want to start returning data from.
:param int limit: (optional) The number of tags to return.
:param int timeout: (optional) The timeout in milliseconds, bounds the
request to run within the specified time value. It returns the accumulated
results until time runs out.
:param str order_by_name: (optional) Order the output by tag name.
:param bool attached_only: (optional) Filter on attached tags. If `true`,
it returns only tags that are attached to one or more resources. If
`false`, it returns all tags.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TagList` object
"""
headers = {
'x-request-id': x_request_id,
'x-correlation-id': x_correlation_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_tags',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'tag_type': tag_type,
'full_data': full_data,
'providers': convert_list(providers),
'attached_to': attached_to,
'offset': offset,
'limit': limit,
'timeout': timeout,
'order_by_name': order_by_name,
'attached_only': attached_only,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v3/tags'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, *, x_request_id: Optional[str] = None, x_correlation_id: Optional[str] = None, account_id: Optional[str] = None, tag_type: Optional[str] = None, full_data: Optional[bool] = None, providers: Optional[List[str]] = None, attached_to: Optional[str] = None, offset: Optional[int] = None, limit: Optional[int] = None, timeout: Optional[int] = None, order_by_name: Optional[str] = None, attached_only: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,610
|
ibm_platform_services.iam_access_groups_v2
|
IamAccessGroupsV2
|
The iam-access-groups V2 service.
|
class IamAccessGroupsV2(BaseService):
"""The iam-access-groups V2 service."""
DEFAULT_SERVICE_URL = 'https://iam.cloud.ibm.com'
DEFAULT_SERVICE_NAME = 'iam_access_groups'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'IamAccessGroupsV2':
"""
Return a new client for the iam-access-groups 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 iam-access-groups 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)
#########################
# Access group operations
#########################
def create_access_group(
self,
account_id: str,
name: str,
*,
description: str = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create an access group.
Create a new access group to assign multiple users and service ids to multiple
policies. The group will be created in the account specified by the `account_id`
parameter. The group name is a required field, but a description is optional.
Because the group's name does not have to be unique, it is possible to create
multiple groups with the same name.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str name: Give the access group a unique name that doesn't conflict
with an existing access group in the account. This field is
case-insensitive and has a limit of 100 characters.
:param str description: (optional) Assign an optional description for the
access group. This field has a limit of 250 characters.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Group` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if name is None:
raise ValueError('name must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='create_access_group',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
}
data = {
'name': name,
'description': description,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v2/groups'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_access_groups(
self,
account_id: str,
*,
transaction_id: str = None,
iam_id: str = None,
search: str = None,
membership_type: str = None,
limit: int = None,
offset: int = None,
sort: str = None,
show_federated: bool = None,
hide_public_access: bool = None,
**kwargs,
) -> DetailedResponse:
"""
List access groups.
This API lists access groups within an account. Parameters for pagination and
sorting can be used to filter the results. The `account_id` query parameter
determines which account to retrieve groups from. Only the groups you have access
to are returned (either because of a policy on a specific group or account level
access (admin, editor, or viewer)). There may be more groups in the account that
aren't shown if you lack the aforementioned permissions.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param str iam_id: (optional) Return groups for member ID (IBMid, service
ID or trusted profile ID).
:param str search: (optional) Use search to filter access groups list by
id, name or description.
* `search=id:<ACCESS_GROUP_ID>` - To list access groups by id
* `search=name:<ACCESS_GROUP_NAME>` - To list access groups by name
* `search=description:<ACCESS_GROUP_DESC>` - To list access groups by
description.
:param str membership_type: (optional) Membership type need to be specified
along with iam_id and must be either `static`, `dynamic` or `all`. If
membership type is `static`, members explicitly added to the group will be
shown. If membership type is `dynamic`, members accessing the access group
at the moment via dynamic rules will be shown. If membership type is `all`,
both static and dynamic members will be shown.
:param int limit: (optional) Return up to this limit of results where limit
is between 0 and 100.
:param int offset: (optional) The offset of the first result item to be
returned.
:param str sort: (optional) Sort the results by id, name, description, or
is_federated flag.
:param bool show_federated: (optional) If show_federated is true, each
group listed will return an is_federated value that is set to true if rules
exist for the group.
:param bool hide_public_access: (optional) If hide_public_access is true,
do not include the Public Access Group in the results.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `GroupsList` object
"""
if not account_id:
raise ValueError('account_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='list_access_groups',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'iam_id': iam_id,
'search': search,
'membership_type': membership_type,
'limit': limit,
'offset': offset,
'sort': sort,
'show_federated': show_federated,
'hide_public_access': hide_public_access,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v2/groups'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_access_group(
self,
access_group_id: str,
*,
transaction_id: str = None,
show_federated: bool = None,
**kwargs,
) -> DetailedResponse:
"""
Get an access group.
Retrieve an access group by its `access_group_id`. Only the groups data is
returned (group name, description, account_id, ...), not membership or rule
information. A revision number is returned in the `ETag` header, which is needed
when updating the access group.
:param str access_group_id: The access group identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param bool show_federated: (optional) If show_federated is true, the group
will return an is_federated value that is set to true if rules exist for
the 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 `Group` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_access_group',
)
headers.update(sdk_headers)
params = {
'show_federated': show_federated,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def update_access_group(
self,
access_group_id: str,
if_match: str,
*,
name: str = None,
description: str = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Update an access group.
Update the group name or description of an existing access group using this API.
An `If-Match` header must be populated with the group's most recent revision
number (which can be acquired in the `Get an access group` API).
:param str access_group_id: The access group identifier.
:param str if_match: The current revision number of the group being
updated. This can be found in the Create/Get access group response ETag
header.
:param str name: (optional) Give the access group a unique name that
doesn't conflict with an existing access group in the account. This field
is case-insensitive and has a limit of 100 characters.
:param str description: (optional) Assign an optional description for the
access group. This field has a limit of 250 characters.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Group` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='update_access_group',
)
headers.update(sdk_headers)
data = {
'name': name,
'description': description,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_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_access_group(
self,
access_group_id: str,
*,
transaction_id: str = None,
force: bool = None,
**kwargs,
) -> DetailedResponse:
"""
Delete an access group.
This API is used for deleting an access group. If the access group has no members
or rules associated with it, the group and its policies will be deleted. However,
if rules or members do exist, set the `force` parameter to true to delete the
group as well as its associated members, rules, and policies.
:param str access_group_id: The access group identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param bool force: (optional) If force is true, delete the group as well as
its associated members and rules.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='delete_access_group',
)
headers.update(sdk_headers)
params = {
'force': force,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
#########################
# Membership operations
#########################
def is_member_of_access_group(
self,
access_group_id: str,
iam_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Check membership in an access group.
This HEAD operation determines if a given `iam_id` is present in a group either
explicitly or via dynamic rules. No response body is returned with this request.
If the membership exists, a `204 - No Content` status code is returned. If the
membership or the group does not exist, a `404 - Not Found` status code is
returned.
:param str access_group_id: The access group identifier.
:param str iam_id: The IAM identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if not iam_id:
raise ValueError('iam_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='is_member_of_access_group',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['access_group_id', 'iam_id']
path_param_values = self.encode_path_vars(access_group_id, iam_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/members/{iam_id}'.format(**path_param_dict)
request = self.prepare_request(
method='HEAD',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def add_members_to_access_group(
self,
access_group_id: str,
*,
members: List['AddGroupMembersRequestMembersItem'] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Add members to an access group.
Use this API to add users (`IBMid-...`), service IDs (`iam-ServiceId-...`) or
trusted profiles (`iam-Profile-...`) to an access group. Any member added gains
access to resources defined in the group's policies. To revoke a given members's
access, simply remove them from the group. There is no limit to the number of
members one group can have, but each `iam_id` can only be added to 50 groups.
Additionally, this API request payload can add up to 50 members per call.
:param str access_group_id: The access group identifier.
:param List[AddGroupMembersRequestMembersItem] members: (optional) An array
of member objects to add to an access group.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AddGroupMembersResponse` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if members is not None:
members = [convert_model(x) for x in members]
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='add_members_to_access_group',
)
headers.update(sdk_headers)
data = {
'members': members,
}
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 = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/members'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_access_group_members(
self,
access_group_id: str,
*,
transaction_id: str = None,
membership_type: str = None,
limit: int = None,
offset: int = None,
type: str = None,
verbose: bool = None,
sort: str = None,
**kwargs,
) -> DetailedResponse:
"""
List access group members.
List all members of a given group using this API. Parameters for pagination and
sorting can be used to filter the results. The most useful query parameter may be
the `verbose` flag. If `verbose=true`, user, service ID and trusted profile names
will be retrieved for each `iam_id`. If performance is a concern, leave the
`verbose` parameter off so that name information does not get retrieved.
:param str access_group_id: The access group identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param str membership_type: (optional) Filters members by membership type.
Filter by `static`, `dynamic` or `all`. `static` lists the members
explicitly added to the access group, and `dynamic` lists the members that
are part of the access group at that time via dynamic rules. `all` lists
both static and dynamic members.
:param int limit: (optional) Return up to this limit of results where limit
is between 0 and 100.
:param int offset: (optional) The offset of the first result item to be
returned.
:param str type: (optional) Filter the results by member type.
:param bool verbose: (optional) Return user's email and name for each user
ID or the name for each service ID or trusted profile.
:param str sort: (optional) If verbose is true, sort the results by id,
name, or email.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `GroupMembersList` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='list_access_group_members',
)
headers.update(sdk_headers)
params = {
'membership_type': membership_type,
'limit': limit,
'offset': offset,
'type': type,
'verbose': verbose,
'sort': sort,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/members'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def remove_member_from_access_group(
self,
access_group_id: str,
iam_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete member from an access group.
Remove one member from a group using this API. If the operation is successful,
only a `204 - No Content` response with no body is returned. However, if any error
occurs, the standard error format will be returned. Dynamic member cannot be
deleted using this API. Dynamic rules needs to be adjusted to delete dynamic
members.
:param str access_group_id: The access group identifier.
:param str iam_id: The IAM identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if not iam_id:
raise ValueError('iam_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='remove_member_from_access_group',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['access_group_id', 'iam_id']
path_param_values = self.encode_path_vars(access_group_id, iam_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/members/{iam_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def remove_members_from_access_group(
self,
access_group_id: str,
*,
members: List[str] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete members from an access group.
Remove multiple members from a group using this API. On a successful call, this
API will always return 207. It is the caller's responsibility to iterate across
the body to determine successful deletion of each member. This API request payload
can delete up to 50 members per call. This API doesnt delete dynamic members
accessing the access group via dynamic rules.
:param str access_group_id: The access group identifier.
:param List[str] members: (optional) The `iam_id`s to remove from the
access group. This field has a limit of 50 `iam_id`s.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DeleteGroupBulkMembersResponse` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='remove_members_from_access_group',
)
headers.update(sdk_headers)
data = {
'members': members,
}
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 = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/members/delete'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def remove_member_from_all_access_groups(
self,
account_id: str,
iam_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete member from all access groups.
This API removes a given member from every group they are a member of within the
specified account. By using one operation, you can revoke one member's access to
all access groups in the account. If a partial failure occurs on deletion, the
response will be shown in the body.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str iam_id: The IAM identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `DeleteFromAllGroupsResponse` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not iam_id:
raise ValueError('iam_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='remove_member_from_all_access_groups',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['iam_id']
path_param_values = self.encode_path_vars(iam_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/_allgroups/members/{iam_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 add_member_to_multiple_access_groups(
self,
account_id: str,
iam_id: str,
*,
type: str = None,
groups: List[str] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Add member to multiple access groups.
This API will add a member to multiple access groups in an account. The limit of
how many groups that can be in the request is 50. The response is a list of
results that show if adding the member to each group was successful or not.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str iam_id: The IAM identifier.
:param str type: (optional) The type of the member, must be either "user",
"service" or "profile".
:param List[str] groups: (optional) The ids of the access groups a given
member is to be added to.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AddMembershipMultipleGroupsResponse` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not iam_id:
raise ValueError('iam_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='add_member_to_multiple_access_groups',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
}
data = {
'type': type,
'groups': groups,
}
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 = ['iam_id']
path_param_values = self.encode_path_vars(iam_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/_allgroups/members/{iam_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
#########################
# Rule operations
#########################
def add_access_group_rule(
self,
access_group_id: str,
expiration: int,
realm_name: str,
conditions: List['RuleConditions'],
*,
name: str = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create rule for an access group.
Rules can be used to dynamically add users to an access group. If a user's SAML
assertions match the rule's conditions during login, the user will be dynamically
added to the group. The duration of the user's access to the group is determined
by the `expiration` field. After access expires, the user will need to log in
again to regain access. Note that the condition's value field must be a
stringified JSON value. [Consult this documentation for further explanation of
dynamic rules.](/docs/account?topic=account-rules).
:param str access_group_id: The access group identifier.
:param int expiration: Session duration in hours. Access group membership
is revoked after this time period expires. Users must log back in to
refresh their access group membership.
:param str realm_name: The URL of the identity provider (IdP).
:param List[RuleConditions] conditions: A list of conditions that
identities must satisfy to gain access group membership.
:param str name: (optional) The name of the dynaimic rule.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Rule` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if expiration is None:
raise ValueError('expiration must be provided')
if realm_name is None:
raise ValueError('realm_name must be provided')
if conditions is None:
raise ValueError('conditions must be provided')
conditions = [convert_model(x) for x in conditions]
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='add_access_group_rule',
)
headers.update(sdk_headers)
data = {
'expiration': expiration,
'realm_name': realm_name,
'conditions': conditions,
'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 = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/rules'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_access_group_rules(
self,
access_group_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
List access group rules.
This API lists all rules in a given access group. Because only a few rules are
created on each group, there is no pagination or sorting support on this API.
:param str access_group_id: The access group identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `RulesList` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='list_access_group_rules',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/rules'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def get_access_group_rule(
self,
access_group_id: str,
rule_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get an access group rule.
Retrieve a rule from an access group. A revision number is returned in the `ETag`
header, which is needed when updating the rule.
:param str access_group_id: The access group identifier.
:param str rule_id: The rule to get.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Rule` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if not rule_id:
raise ValueError('rule_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_access_group_rule',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['access_group_id', 'rule_id']
path_param_values = self.encode_path_vars(access_group_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/rules/{rule_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def replace_access_group_rule(
self,
access_group_id: str,
rule_id: str,
if_match: str,
expiration: int,
realm_name: str,
conditions: List['RuleConditions'],
*,
name: str = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Replace an access group rule.
Update the body of an existing rule using this API. An `If-Match` header must be
populated with the rule's most recent revision number (which can be acquired in
the `Get an access group rule` API).
:param str access_group_id: The access group identifier.
:param str rule_id: The rule to get.
:param str if_match: The current revision number of the rule being updated.
This can be found in the Get Rule response ETag header.
:param int expiration: Session duration in hours. Access group membership
is revoked after this time period expires. Users must log back in to
refresh their access group membership.
:param str realm_name: The URL of the identity provider (IdP).
:param List[RuleConditions] conditions: A list of conditions that
identities must satisfy to gain access group membership.
:param str name: (optional) The name of the dynaimic rule.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Rule` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if not rule_id:
raise ValueError('rule_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if expiration is None:
raise ValueError('expiration must be provided')
if realm_name is None:
raise ValueError('realm_name must be provided')
if conditions is None:
raise ValueError('conditions must be provided')
conditions = [convert_model(x) for x in conditions]
headers = {
'If-Match': if_match,
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='replace_access_group_rule',
)
headers.update(sdk_headers)
data = {
'expiration': expiration,
'realm_name': realm_name,
'conditions': conditions,
'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 = ['access_group_id', 'rule_id']
path_param_values = self.encode_path_vars(access_group_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/rules/{rule_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def remove_access_group_rule(
self,
access_group_id: str,
rule_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete an access group rule.
Remove one rule from a group using this API. If the operation is successful, only
a `204 - No Content` response with no body is returned. However, if any error
occurs, the standard error format will be returned.
:param str access_group_id: The access group identifier.
:param str rule_id: The rule to get.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if not rule_id:
raise ValueError('rule_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='remove_access_group_rule',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['access_group_id', 'rule_id']
path_param_values = self.encode_path_vars(access_group_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/rules/{rule_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# Account settings
#########################
def get_account_settings(
self,
account_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get account settings.
Retrieve the access groups settings for a specific account.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: 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 not account_id:
raise ValueError('account_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_account_settings',
)
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 = '/v2/groups/settings'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def update_account_settings(
self,
account_id: str,
*,
public_access_enabled: bool = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Update account settings.
Update the access groups settings for a specific account. Note: When the
`public_access_enabled` setting is set to false, all policies within the account
attached to the Public Access group will be deleted. Only set
`public_access_enabled` to false if you are sure that you want those policies to
be removed.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param bool public_access_enabled: (optional) This flag controls the public
access feature within the account. It is set to true by default. Note: When
this flag is set to false, all policies within the account attached to the
Public Access group will be deleted.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: 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 not account_id:
raise ValueError('account_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='update_account_settings',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
}
data = {
'public_access_enabled': public_access_enabled,
}
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/groups/settings'
request = self.prepare_request(
method='PATCH',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
#########################
# Template operations
#########################
def create_template(
self,
name: str,
account_id: str,
*,
description: str = None,
group: 'AccessGroupRequest' = None,
policy_template_references: List['PolicyTemplates'] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create template.
Create an access group template. Make sure that the template is generic enough to
apply to multiple different child accounts. Before you can assign an access group
template to child accounts, you must commit it so that no further changes can be
made to the version.
:param str name: Give the access group template a unique name that doesn't
conflict with an existing access group templates in the account.
:param str account_id: Enterprise account id in which the template will be
created.
:param str description: (optional) Assign an optional description for the
access group template.
:param AccessGroupRequest group: (optional) Access Group Component.
:param List[PolicyTemplates] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
Access group input component.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateResponse` object
"""
if name is None:
raise ValueError('name must be provided')
if account_id is None:
raise ValueError('account_id must be provided')
if group is not None:
group = convert_model(group)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='create_template',
)
headers.update(sdk_headers)
data = {
'name': name,
'account_id': account_id,
'description': description,
'group': group,
'policy_template_references': policy_template_references,
}
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/group_templates'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_templates(
self,
account_id: str,
*,
transaction_id: str = None,
limit: int = None,
offset: int = None,
verbose: bool = None,
**kwargs,
) -> DetailedResponse:
"""
List templates.
List the access group templates in an enterprise account.
:param str account_id: Enterprise account ID.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param int limit: (optional) Return up to this limit of results where limit
is between 0 and 100.
:param int offset: (optional) The offset of the first result item to be
returned.
:param bool verbose: (optional) If `verbose=true`, IAM resource details are
returned. If performance is a concern, leave the `verbose` parameter off so
that details are not retrieved.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListTemplatesResponse` object
"""
if not account_id:
raise ValueError('account_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='list_templates',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'limit': limit,
'offset': offset,
'verbose': verbose,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/group_templates'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_template_version(
self,
template_id: str,
*,
name: str = None,
description: str = None,
group: 'AccessGroupRequest' = None,
policy_template_references: List['PolicyTemplates'] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create template version.
Create a new version of an access group template.
:param str template_id: ID of the template that you want to create a new
version of.
:param str name: (optional) This is an optional field. If the field is
included it will change the name value for all existing versions of the
template..
:param str description: (optional) Assign an optional description for the
access group template version.
:param AccessGroupRequest group: (optional) Access Group Component.
:param List[PolicyTemplates] policy_template_references: (optional) The
policy templates associated with the template version.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if group is not None:
group = convert_model(group)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='create_template_version',
)
headers.update(sdk_headers)
data = {
'name': name,
'description': description,
'group': group,
'policy_template_references': policy_template_references,
}
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 = ['template_id']
path_param_values = self.encode_path_vars(template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_template_versions(
self,
template_id: str,
*,
limit: int = None,
offset: int = None,
**kwargs,
) -> DetailedResponse:
"""
List template versions.
List all the versions of an access group template.
:param str template_id: ID of the template that you want to list all
versions of.
:param int limit: (optional) Return up to this limit of results where limit
is between 0 and 100.
:param int offset: (optional) The offset of the first result item to be
returned.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListTemplateVersionsResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='list_template_versions',
)
headers.update(sdk_headers)
params = {
'limit': limit,
'offset': offset,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id']
path_param_values = self.encode_path_vars(template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{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
def get_template_version(
self,
template_id: str,
version_num: str,
*,
verbose: bool = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get template version.
Get a specific version of a template.
:param str template_id: ID of the template to get a specific version of.
:param str version_num: Version number.
:param bool verbose: (optional) If `verbose=true`, IAM resource details are
returned. If performance is a concern, leave the `verbose` parameter off so
that details are not retrieved.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version_num:
raise ValueError('version_num must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_template_version',
)
headers.update(sdk_headers)
params = {
'verbose': verbose,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id', 'version_num']
path_param_values = self.encode_path_vars(template_id, version_num)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions/{version_num}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def update_template_version(
self,
template_id: str,
version_num: str,
if_match: str,
*,
name: str = None,
description: str = None,
group: 'AccessGroupRequest' = None,
policy_template_references: List['PolicyTemplates'] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Update template version.
Update a template version. You can only update a version that isn't committed.
Create a new version if you need to update a committed version.
:param str template_id: ID of the template.
:param str version_num: Version number of the template.
:param str if_match: ETag value of the template version document.
:param str name: (optional) This is an optional field. If the field is
included it will change the name value for all existing versions of the
template..
:param str description: (optional) Assign an optional description for the
access group template version.
:param AccessGroupRequest group: (optional) Access Group Component.
:param List[PolicyTemplates] policy_template_references: (optional) The
policy templates associated with the template version.
:param str transaction_id: (optional) transaction id in header.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateVersionResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version_num:
raise ValueError('version_num must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if group is not None:
group = convert_model(group)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {
'If-Match': if_match,
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='update_template_version',
)
headers.update(sdk_headers)
data = {
'name': name,
'description': description,
'group': group,
'policy_template_references': policy_template_references,
}
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 = ['template_id', 'version_num']
path_param_values = self.encode_path_vars(template_id, version_num)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions/{version_num}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_template_version(
self,
template_id: str,
version_num: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete template version.
Delete a template version. You must remove all assignments for a template version
before you can delete it.
:param str template_id: ID of the template to delete.
:param str version_num: version number in path.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version_num:
raise ValueError('version_num must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='delete_template_version',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version_num']
path_param_values = self.encode_path_vars(template_id, version_num)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions/{version_num}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def commit_template(
self,
template_id: str,
version_num: str,
if_match: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Commit a template.
Commit a template version. You must do this before you can assign a template
version to child accounts. After you commit the template version, you can't make
any further changes.
:param str template_id: ID of the template to commit.
:param str version_num: version number in path.
:param str if_match: ETag value of the template version document.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version_num:
raise ValueError('version_num must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='commit_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version_num']
path_param_values = self.encode_path_vars(template_id, version_num)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions/{version_num}/commit'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def get_latest_template_version(
self,
template_id: str,
*,
verbose: bool = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get latest template version.
Get the latest version of a template.
:param str template_id: ID of the template to get a specific version of.
:param bool verbose: (optional) If `verbose=true`, IAM resource details are
returned. If performance is a concern, leave the `verbose` parameter off so
that details are not retrieved.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_latest_template_version',
)
headers.update(sdk_headers)
params = {
'verbose': verbose,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id']
path_param_values = self.encode_path_vars(template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{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
def delete_template(
self,
template_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete template.
Endpoint to delete a template. All access assigned by that template is deleted
from all of the accounts where the template was assigned.
:param str template_id: template id parameter.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not template_id:
raise ValueError('template_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='delete_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id']
path_param_values = self.encode_path_vars(template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# Template assignment operations
#########################
def create_assignment(
self,
template_id: str,
template_version: str,
target_type: str,
target: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create assignment.
Assign a template version to accounts that have enabled enterprise-managed IAM.
You can specify individual accounts, or an entire account group to assign the
template to all current and future child accounts of that account group.
:param str template_id: The unique identifier of the template to be
assigned.
:param str template_version: The version number of the template to be
assigned.
:param str target_type: The type of the entity to which the template should
be assigned, e.g. 'Account', 'AccountGroup', etc.
:param str target: The unique identifier of the entity to which the
template should be assigned.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateAssignmentResponse` object
"""
if template_id is None:
raise ValueError('template_id must be provided')
if template_version is None:
raise ValueError('template_version must be provided')
if target_type is None:
raise ValueError('target_type must be provided')
if target is None:
raise ValueError('target must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='create_assignment',
)
headers.update(sdk_headers)
data = {
'template_id': template_id,
'template_version': template_version,
'target_type': target_type,
'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 = '/v1/group_assignments'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_assignments(
self,
account_id: str,
*,
template_id: str = None,
template_version: str = None,
target: str = None,
status: str = None,
transaction_id: str = None,
limit: int = None,
offset: int = None,
**kwargs,
) -> DetailedResponse:
"""
List assignments.
List template assignments from an enterprise account.
:param str account_id: Enterprise account ID.
:param str template_id: (optional) Filter results by Template Id.
:param str template_version: (optional) Filter results by Template Version.
:param str target: (optional) Filter results by the assignment target.
:param str status: (optional) Filter results by the assignment status.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param int limit: (optional) Return up to this limit of results where limit
is between 0 and 100.
:param int offset: (optional) The offset of the first result item to be
returned.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ListTemplateAssignmentResponse` object
"""
if not account_id:
raise ValueError('account_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='list_assignments',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'template_id': template_id,
'template_version': template_version,
'target': target,
'status': status,
'limit': limit,
'offset': offset,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/group_assignments'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_assignment(
self,
assignment_id: str,
*,
transaction_id: str = None,
verbose: bool = None,
**kwargs,
) -> DetailedResponse:
"""
Get assignment.
Get a specific template assignment.
:param str assignment_id: Assignment ID.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param bool verbose: (optional) Returns resources access group template
assigned, possible values `true` or `false`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentVerboseResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_assignment',
)
headers.update(sdk_headers)
params = {
'verbose': verbose,
}
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/group_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
def update_assignment(
self,
assignment_id: str,
if_match: str,
template_version: str,
**kwargs,
) -> DetailedResponse:
"""
Update Assignment.
Endpoint to update template assignment.
:param str assignment_id: ID of the Assignment Record.
:param str if_match: Version of the Assignment to be updated. Specify the
version that you retrieved when reading the Assignment. This value helps
identifying parallel usage of this API. Pass * to indicate to update any
version available. This might result in stale updates.
:param str template_version: Template version which shall be applied to the
assignment.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentVerboseResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id 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='V2',
operation_id='update_assignment',
)
headers.update(sdk_headers)
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/group_assignments/{assignment_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_assignment(
self,
assignment_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete assignment.
Delete an access group template assignment.
:param str assignment_id: assignment id path parameter.
:param str transaction_id: (optional) An optional transaction id for the
request.
: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 = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='delete_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/group_assignments/{assignment_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
|
719,611
|
ibm_platform_services.iam_access_groups_v2
|
__init__
|
Construct a new client for the iam-access-groups 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 iam-access-groups 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,616
|
ibm_platform_services.iam_access_groups_v2
|
add_access_group_rule
|
Create rule for an access group.
Rules can be used to dynamically add users to an access group. If a user's SAML
assertions match the rule's conditions during login, the user will be dynamically
added to the group. The duration of the user's access to the group is determined
by the `expiration` field. After access expires, the user will need to log in
again to regain access. Note that the condition's value field must be a
stringified JSON value. [Consult this documentation for further explanation of
dynamic rules.](/docs/account?topic=account-rules).
:param str access_group_id: The access group identifier.
:param int expiration: Session duration in hours. Access group membership
is revoked after this time period expires. Users must log back in to
refresh their access group membership.
:param str realm_name: The URL of the identity provider (IdP).
:param List[RuleConditions] conditions: A list of conditions that
identities must satisfy to gain access group membership.
:param str name: (optional) The name of the dynaimic rule.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Rule` object
|
def add_access_group_rule(
self,
access_group_id: str,
expiration: int,
realm_name: str,
conditions: List['RuleConditions'],
*,
name: str = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create rule for an access group.
Rules can be used to dynamically add users to an access group. If a user's SAML
assertions match the rule's conditions during login, the user will be dynamically
added to the group. The duration of the user's access to the group is determined
by the `expiration` field. After access expires, the user will need to log in
again to regain access. Note that the condition's value field must be a
stringified JSON value. [Consult this documentation for further explanation of
dynamic rules.](/docs/account?topic=account-rules).
:param str access_group_id: The access group identifier.
:param int expiration: Session duration in hours. Access group membership
is revoked after this time period expires. Users must log back in to
refresh their access group membership.
:param str realm_name: The URL of the identity provider (IdP).
:param List[RuleConditions] conditions: A list of conditions that
identities must satisfy to gain access group membership.
:param str name: (optional) The name of the dynaimic rule.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Rule` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if expiration is None:
raise ValueError('expiration must be provided')
if realm_name is None:
raise ValueError('realm_name must be provided')
if conditions is None:
raise ValueError('conditions must be provided')
conditions = [convert_model(x) for x in conditions]
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='add_access_group_rule',
)
headers.update(sdk_headers)
data = {
'expiration': expiration,
'realm_name': realm_name,
'conditions': conditions,
'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 = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/rules'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, access_group_id: str, expiration: int, realm_name: str, conditions: List[ibm_platform_services.iam_access_groups_v2.RuleConditions], *, name: Optional[str] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,617
|
ibm_platform_services.iam_access_groups_v2
|
add_member_to_multiple_access_groups
|
Add member to multiple access groups.
This API will add a member to multiple access groups in an account. The limit of
how many groups that can be in the request is 50. The response is a list of
results that show if adding the member to each group was successful or not.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str iam_id: The IAM identifier.
:param str type: (optional) The type of the member, must be either "user",
"service" or "profile".
:param List[str] groups: (optional) The ids of the access groups a given
member is to be added to.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AddMembershipMultipleGroupsResponse` object
|
def add_member_to_multiple_access_groups(
self,
account_id: str,
iam_id: str,
*,
type: str = None,
groups: List[str] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Add member to multiple access groups.
This API will add a member to multiple access groups in an account. The limit of
how many groups that can be in the request is 50. The response is a list of
results that show if adding the member to each group was successful or not.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str iam_id: The IAM identifier.
:param str type: (optional) The type of the member, must be either "user",
"service" or "profile".
:param List[str] groups: (optional) The ids of the access groups a given
member is to be added to.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AddMembershipMultipleGroupsResponse` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not iam_id:
raise ValueError('iam_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='add_member_to_multiple_access_groups',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
}
data = {
'type': type,
'groups': groups,
}
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 = ['iam_id']
path_param_values = self.encode_path_vars(iam_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/_allgroups/members/{iam_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, iam_id: str, *, type: Optional[str] = None, groups: Optional[List[str]] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,618
|
ibm_platform_services.iam_access_groups_v2
|
add_members_to_access_group
|
Add members to an access group.
Use this API to add users (`IBMid-...`), service IDs (`iam-ServiceId-...`) or
trusted profiles (`iam-Profile-...`) to an access group. Any member added gains
access to resources defined in the group's policies. To revoke a given members's
access, simply remove them from the group. There is no limit to the number of
members one group can have, but each `iam_id` can only be added to 50 groups.
Additionally, this API request payload can add up to 50 members per call.
:param str access_group_id: The access group identifier.
:param List[AddGroupMembersRequestMembersItem] members: (optional) An array
of member objects to add to an access group.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AddGroupMembersResponse` object
|
def add_members_to_access_group(
self,
access_group_id: str,
*,
members: List['AddGroupMembersRequestMembersItem'] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Add members to an access group.
Use this API to add users (`IBMid-...`), service IDs (`iam-ServiceId-...`) or
trusted profiles (`iam-Profile-...`) to an access group. Any member added gains
access to resources defined in the group's policies. To revoke a given members's
access, simply remove them from the group. There is no limit to the number of
members one group can have, but each `iam_id` can only be added to 50 groups.
Additionally, this API request payload can add up to 50 members per call.
:param str access_group_id: The access group identifier.
:param List[AddGroupMembersRequestMembersItem] members: (optional) An array
of member objects to add to an access group.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AddGroupMembersResponse` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if members is not None:
members = [convert_model(x) for x in members]
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='add_members_to_access_group',
)
headers.update(sdk_headers)
data = {
'members': members,
}
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 = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/members'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, access_group_id: str, *, members: Optional[List[ibm_platform_services.iam_access_groups_v2.AddGroupMembersRequestMembersItem]] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,619
|
ibm_platform_services.iam_access_groups_v2
|
commit_template
|
Commit a template.
Commit a template version. You must do this before you can assign a template
version to child accounts. After you commit the template version, you can't make
any further changes.
:param str template_id: ID of the template to commit.
:param str version_num: version number in path.
:param str if_match: ETag value of the template version document.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def commit_template(
self,
template_id: str,
version_num: str,
if_match: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Commit a template.
Commit a template version. You must do this before you can assign a template
version to child accounts. After you commit the template version, you can't make
any further changes.
:param str template_id: ID of the template to commit.
:param str version_num: version number in path.
:param str if_match: ETag value of the template version document.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version_num:
raise ValueError('version_num must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='commit_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version_num']
path_param_values = self.encode_path_vars(template_id, version_num)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions/{version_num}/commit'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, template_id: str, version_num: str, if_match: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,621
|
ibm_platform_services.iam_access_groups_v2
|
create_access_group
|
Create an access group.
Create a new access group to assign multiple users and service ids to multiple
policies. The group will be created in the account specified by the `account_id`
parameter. The group name is a required field, but a description is optional.
Because the group's name does not have to be unique, it is possible to create
multiple groups with the same name.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str name: Give the access group a unique name that doesn't conflict
with an existing access group in the account. This field is
case-insensitive and has a limit of 100 characters.
:param str description: (optional) Assign an optional description for the
access group. This field has a limit of 250 characters.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Group` object
|
def create_access_group(
self,
account_id: str,
name: str,
*,
description: str = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create an access group.
Create a new access group to assign multiple users and service ids to multiple
policies. The group will be created in the account specified by the `account_id`
parameter. The group name is a required field, but a description is optional.
Because the group's name does not have to be unique, it is possible to create
multiple groups with the same name.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str name: Give the access group a unique name that doesn't conflict
with an existing access group in the account. This field is
case-insensitive and has a limit of 100 characters.
:param str description: (optional) Assign an optional description for the
access group. This field has a limit of 250 characters.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Group` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if name is None:
raise ValueError('name must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='create_access_group',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
}
data = {
'name': name,
'description': description,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v2/groups'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, name: str, *, description: Optional[str] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,622
|
ibm_platform_services.iam_access_groups_v2
|
create_assignment
|
Create assignment.
Assign a template version to accounts that have enabled enterprise-managed IAM.
You can specify individual accounts, or an entire account group to assign the
template to all current and future child accounts of that account group.
:param str template_id: The unique identifier of the template to be
assigned.
:param str template_version: The version number of the template to be
assigned.
:param str target_type: The type of the entity to which the template should
be assigned, e.g. 'Account', 'AccountGroup', etc.
:param str target: The unique identifier of the entity to which the
template should be assigned.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateAssignmentResponse` object
|
def create_assignment(
self,
template_id: str,
template_version: str,
target_type: str,
target: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create assignment.
Assign a template version to accounts that have enabled enterprise-managed IAM.
You can specify individual accounts, or an entire account group to assign the
template to all current and future child accounts of that account group.
:param str template_id: The unique identifier of the template to be
assigned.
:param str template_version: The version number of the template to be
assigned.
:param str target_type: The type of the entity to which the template should
be assigned, e.g. 'Account', 'AccountGroup', etc.
:param str target: The unique identifier of the entity to which the
template should be assigned.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateAssignmentResponse` object
"""
if template_id is None:
raise ValueError('template_id must be provided')
if template_version is None:
raise ValueError('template_version must be provided')
if target_type is None:
raise ValueError('target_type must be provided')
if target is None:
raise ValueError('target must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='create_assignment',
)
headers.update(sdk_headers)
data = {
'template_id': template_id,
'template_version': template_version,
'target_type': target_type,
'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 = '/v1/group_assignments'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, template_id: str, template_version: str, target_type: str, target: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,623
|
ibm_platform_services.iam_access_groups_v2
|
create_template
|
Create template.
Create an access group template. Make sure that the template is generic enough to
apply to multiple different child accounts. Before you can assign an access group
template to child accounts, you must commit it so that no further changes can be
made to the version.
:param str name: Give the access group template a unique name that doesn't
conflict with an existing access group templates in the account.
:param str account_id: Enterprise account id in which the template will be
created.
:param str description: (optional) Assign an optional description for the
access group template.
:param AccessGroupRequest group: (optional) Access Group Component.
:param List[PolicyTemplates] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
Access group input component.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateResponse` object
|
def create_template(
self,
name: str,
account_id: str,
*,
description: str = None,
group: 'AccessGroupRequest' = None,
policy_template_references: List['PolicyTemplates'] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create template.
Create an access group template. Make sure that the template is generic enough to
apply to multiple different child accounts. Before you can assign an access group
template to child accounts, you must commit it so that no further changes can be
made to the version.
:param str name: Give the access group template a unique name that doesn't
conflict with an existing access group templates in the account.
:param str account_id: Enterprise account id in which the template will be
created.
:param str description: (optional) Assign an optional description for the
access group template.
:param AccessGroupRequest group: (optional) Access Group Component.
:param List[PolicyTemplates] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
Access group input component.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateResponse` object
"""
if name is None:
raise ValueError('name must be provided')
if account_id is None:
raise ValueError('account_id must be provided')
if group is not None:
group = convert_model(group)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='create_template',
)
headers.update(sdk_headers)
data = {
'name': name,
'account_id': account_id,
'description': description,
'group': group,
'policy_template_references': policy_template_references,
}
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/group_templates'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, name: str, account_id: str, *, description: Optional[str] = None, group: Optional[ibm_platform_services.iam_access_groups_v2.AccessGroupRequest] = None, policy_template_references: Optional[List[ibm_platform_services.iam_access_groups_v2.PolicyTemplates]] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,624
|
ibm_platform_services.iam_access_groups_v2
|
create_template_version
|
Create template version.
Create a new version of an access group template.
:param str template_id: ID of the template that you want to create a new
version of.
:param str name: (optional) This is an optional field. If the field is
included it will change the name value for all existing versions of the
template..
:param str description: (optional) Assign an optional description for the
access group template version.
:param AccessGroupRequest group: (optional) Access Group Component.
:param List[PolicyTemplates] policy_template_references: (optional) The
policy templates associated with the template version.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
|
def create_template_version(
self,
template_id: str,
*,
name: str = None,
description: str = None,
group: 'AccessGroupRequest' = None,
policy_template_references: List['PolicyTemplates'] = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Create template version.
Create a new version of an access group template.
:param str template_id: ID of the template that you want to create a new
version of.
:param str name: (optional) This is an optional field. If the field is
included it will change the name value for all existing versions of the
template..
:param str description: (optional) Assign an optional description for the
access group template version.
:param AccessGroupRequest group: (optional) Access Group Component.
:param List[PolicyTemplates] policy_template_references: (optional) The
policy templates associated with the template version.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if group is not None:
group = convert_model(group)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='create_template_version',
)
headers.update(sdk_headers)
data = {
'name': name,
'description': description,
'group': group,
'policy_template_references': policy_template_references,
}
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 = ['template_id']
path_param_values = self.encode_path_vars(template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, template_id: str, *, name: Optional[str] = None, description: Optional[str] = None, group: Optional[ibm_platform_services.iam_access_groups_v2.AccessGroupRequest] = None, policy_template_references: Optional[List[ibm_platform_services.iam_access_groups_v2.PolicyTemplates]] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,625
|
ibm_platform_services.iam_access_groups_v2
|
delete_access_group
|
Delete an access group.
This API is used for deleting an access group. If the access group has no members
or rules associated with it, the group and its policies will be deleted. However,
if rules or members do exist, set the `force` parameter to true to delete the
group as well as its associated members, rules, and policies.
:param str access_group_id: The access group identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param bool force: (optional) If force is true, delete the group as well as
its associated members and rules.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_access_group(
self,
access_group_id: str,
*,
transaction_id: str = None,
force: bool = None,
**kwargs,
) -> DetailedResponse:
"""
Delete an access group.
This API is used for deleting an access group. If the access group has no members
or rules associated with it, the group and its policies will be deleted. However,
if rules or members do exist, set the `force` parameter to true to delete the
group as well as its associated members, rules, and policies.
:param str access_group_id: The access group identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param bool force: (optional) If force is true, delete the group as well as
its associated members and rules.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='delete_access_group',
)
headers.update(sdk_headers)
params = {
'force': force,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_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, access_group_id: str, *, transaction_id: Optional[str] = None, force: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,626
|
ibm_platform_services.iam_access_groups_v2
|
delete_assignment
|
Delete assignment.
Delete an access group template assignment.
:param str assignment_id: assignment id path parameter.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_assignment(
self,
assignment_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete assignment.
Delete an access group template assignment.
:param str assignment_id: assignment id path parameter.
:param str transaction_id: (optional) An optional transaction id for the
request.
: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 = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='delete_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/group_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, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,627
|
ibm_platform_services.iam_access_groups_v2
|
delete_template
|
Delete template.
Endpoint to delete a template. All access assigned by that template is deleted
from all of the accounts where the template was assigned.
:param str template_id: template id parameter.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_template(
self,
template_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete template.
Endpoint to delete a template. All access assigned by that template is deleted
from all of the accounts where the template was assigned.
:param str template_id: template id parameter.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not template_id:
raise ValueError('template_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='delete_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id']
path_param_values = self.encode_path_vars(template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, template_id: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,628
|
ibm_platform_services.iam_access_groups_v2
|
delete_template_version
|
Delete template version.
Delete a template version. You must remove all assignments for a template version
before you can delete it.
:param str template_id: ID of the template to delete.
:param str version_num: version number in path.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_template_version(
self,
template_id: str,
version_num: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Delete template version.
Delete a template version. You must remove all assignments for a template version
before you can delete it.
:param str template_id: ID of the template to delete.
:param str version_num: version number in path.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version_num:
raise ValueError('version_num must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='delete_template_version',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version_num']
path_param_values = self.encode_path_vars(template_id, version_num)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions/{version_num}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, template_id: str, version_num: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,632
|
ibm_platform_services.iam_access_groups_v2
|
get_access_group
|
Get an access group.
Retrieve an access group by its `access_group_id`. Only the groups data is
returned (group name, description, account_id, ...), not membership or rule
information. A revision number is returned in the `ETag` header, which is needed
when updating the access group.
:param str access_group_id: The access group identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param bool show_federated: (optional) If show_federated is true, the group
will return an is_federated value that is set to true if rules exist for
the 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 `Group` object
|
def get_access_group(
self,
access_group_id: str,
*,
transaction_id: str = None,
show_federated: bool = None,
**kwargs,
) -> DetailedResponse:
"""
Get an access group.
Retrieve an access group by its `access_group_id`. Only the groups data is
returned (group name, description, account_id, ...), not membership or rule
information. A revision number is returned in the `ETag` header, which is needed
when updating the access group.
:param str access_group_id: The access group identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param bool show_federated: (optional) If show_federated is true, the group
will return an is_federated value that is set to true if rules exist for
the 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 `Group` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_access_group',
)
headers.update(sdk_headers)
params = {
'show_federated': show_federated,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['access_group_id']
path_param_values = self.encode_path_vars(access_group_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_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, access_group_id: str, *, transaction_id: Optional[str] = None, show_federated: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,633
|
ibm_platform_services.iam_access_groups_v2
|
get_access_group_rule
|
Get an access group rule.
Retrieve a rule from an access group. A revision number is returned in the `ETag`
header, which is needed when updating the rule.
:param str access_group_id: The access group identifier.
:param str rule_id: The rule to get.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Rule` object
|
def get_access_group_rule(
self,
access_group_id: str,
rule_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get an access group rule.
Retrieve a rule from an access group. A revision number is returned in the `ETag`
header, which is needed when updating the rule.
:param str access_group_id: The access group identifier.
:param str rule_id: The rule to get.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Rule` object
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if not rule_id:
raise ValueError('rule_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_access_group_rule',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['access_group_id', 'rule_id']
path_param_values = self.encode_path_vars(access_group_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/rules/{rule_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, access_group_id: str, rule_id: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,634
|
ibm_platform_services.iam_access_groups_v2
|
get_account_settings
|
Get account settings.
Retrieve the access groups settings for a specific account.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: 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,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get account settings.
Retrieve the access groups settings for a specific account.
:param str account_id: Account ID of the API keys(s) to query. If a service
IAM ID is specified in iam_id then account_id must match the account of the
IAM ID. If a user IAM ID is specified in iam_id then then account_id must
match the account of the Authorization token.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: 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 not account_id:
raise ValueError('account_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_account_settings',
)
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 = '/v2/groups/settings'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,635
|
ibm_platform_services.iam_access_groups_v2
|
get_assignment
|
Get assignment.
Get a specific template assignment.
:param str assignment_id: Assignment ID.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param bool verbose: (optional) Returns resources access group template
assigned, possible values `true` or `false`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentVerboseResponse` object
|
def get_assignment(
self,
assignment_id: str,
*,
transaction_id: str = None,
verbose: bool = None,
**kwargs,
) -> DetailedResponse:
"""
Get assignment.
Get a specific template assignment.
:param str assignment_id: Assignment ID.
:param str transaction_id: (optional) An optional transaction id for the
request.
:param bool verbose: (optional) Returns resources access group template
assigned, possible values `true` or `false`.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentVerboseResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_assignment',
)
headers.update(sdk_headers)
params = {
'verbose': verbose,
}
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/group_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, *, transaction_id: Optional[str] = None, verbose: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,639
|
ibm_platform_services.iam_access_groups_v2
|
get_latest_template_version
|
Get latest template version.
Get the latest version of a template.
:param str template_id: ID of the template to get a specific version of.
:param bool verbose: (optional) If `verbose=true`, IAM resource details are
returned. If performance is a concern, leave the `verbose` parameter off so
that details are not retrieved.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
|
def get_latest_template_version(
self,
template_id: str,
*,
verbose: bool = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get latest template version.
Get the latest version of a template.
:param str template_id: ID of the template to get a specific version of.
:param bool verbose: (optional) If `verbose=true`, IAM resource details are
returned. If performance is a concern, leave the `verbose` parameter off so
that details are not retrieved.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_latest_template_version',
)
headers.update(sdk_headers)
params = {
'verbose': verbose,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id']
path_param_values = self.encode_path_vars(template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{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, template_id: str, *, verbose: Optional[bool] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,640
|
ibm_platform_services.iam_access_groups_v2
|
get_template_version
|
Get template version.
Get a specific version of a template.
:param str template_id: ID of the template to get a specific version of.
:param str version_num: Version number.
:param bool verbose: (optional) If `verbose=true`, IAM resource details are
returned. If performance is a concern, leave the `verbose` parameter off so
that details are not retrieved.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
|
def get_template_version(
self,
template_id: str,
version_num: str,
*,
verbose: bool = None,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Get template version.
Get a specific version of a template.
:param str template_id: ID of the template to get a specific version of.
:param str version_num: Version number.
:param bool verbose: (optional) If `verbose=true`, IAM resource details are
returned. If performance is a concern, leave the `verbose` parameter off so
that details are not retrieved.
:param str transaction_id: (optional) An optional transaction id for the
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 `TemplateVersionResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version_num:
raise ValueError('version_num must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='get_template_version',
)
headers.update(sdk_headers)
params = {
'verbose': verbose,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id', 'version_num']
path_param_values = self.encode_path_vars(template_id, version_num)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/group_templates/{template_id}/versions/{version_num}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, template_id: str, version_num: str, *, verbose: Optional[bool] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,641
|
ibm_platform_services.iam_access_groups_v2
|
is_member_of_access_group
|
Check membership in an access group.
This HEAD operation determines if a given `iam_id` is present in a group either
explicitly or via dynamic rules. No response body is returned with this request.
If the membership exists, a `204 - No Content` status code is returned. If the
membership or the group does not exist, a `404 - Not Found` status code is
returned.
:param str access_group_id: The access group identifier.
:param str iam_id: The IAM identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def is_member_of_access_group(
self,
access_group_id: str,
iam_id: str,
*,
transaction_id: str = None,
**kwargs,
) -> DetailedResponse:
"""
Check membership in an access group.
This HEAD operation determines if a given `iam_id` is present in a group either
explicitly or via dynamic rules. No response body is returned with this request.
If the membership exists, a `204 - No Content` status code is returned. If the
membership or the group does not exist, a `404 - Not Found` status code is
returned.
:param str access_group_id: The access group identifier.
:param str iam_id: The IAM identifier.
:param str transaction_id: (optional) An optional transaction ID can be
passed to your request, which can be useful for tracking calls through
multiple services by using one identifier. The header key must be set to
Transaction-Id and the value is anything that you choose. If no transaction
ID is passed in, then a random ID is generated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not access_group_id:
raise ValueError('access_group_id must be provided')
if not iam_id:
raise ValueError('iam_id must be provided')
headers = {
'Transaction-Id': transaction_id,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V2',
operation_id='is_member_of_access_group',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['access_group_id', 'iam_id']
path_param_values = self.encode_path_vars(access_group_id, iam_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/groups/{access_group_id}/members/{iam_id}'.format(**path_param_dict)
request = self.prepare_request(
method='HEAD',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, access_group_id: str, iam_id: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.