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,642 |
ibm_platform_services.iam_access_groups_v2
|
list_access_group_members
|
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
|
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
|
(self, access_group_id: str, *, transaction_id: Optional[str] = None, membership_type: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, type: Optional[str] = None, verbose: Optional[bool] = None, sort: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,643 |
ibm_platform_services.iam_access_groups_v2
|
list_access_group_rules
|
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
|
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
|
(self, access_group_id: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,644 |
ibm_platform_services.iam_access_groups_v2
|
list_access_groups
|
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
|
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
|
(self, account_id: str, *, transaction_id: Optional[str] = None, iam_id: Optional[str] = None, search: Optional[str] = None, membership_type: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, sort: Optional[str] = None, show_federated: Optional[bool] = None, hide_public_access: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,645 |
ibm_platform_services.iam_access_groups_v2
|
list_assignments
|
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
|
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
|
(self, account_id: str, *, template_id: Optional[str] = None, template_version: Optional[str] = None, target: Optional[str] = None, status: Optional[str] = None, transaction_id: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,646 |
ibm_platform_services.iam_access_groups_v2
|
list_template_versions
|
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
|
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
|
(self, template_id: str, *, limit: Optional[int] = None, offset: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,647 |
ibm_platform_services.iam_access_groups_v2
|
list_templates
|
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
|
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
|
(self, account_id: str, *, transaction_id: Optional[str] = None, limit: Optional[int] = None, offset: Optional[int] = None, verbose: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,649 |
ibm_platform_services.iam_access_groups_v2
|
remove_access_group_rule
|
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
|
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
|
(self, access_group_id: str, rule_id: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,650 |
ibm_platform_services.iam_access_groups_v2
|
remove_member_from_access_group
|
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
|
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
|
(self, access_group_id: str, iam_id: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,651 |
ibm_platform_services.iam_access_groups_v2
|
remove_member_from_all_access_groups
|
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
|
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
|
(self, account_id: str, iam_id: str, *, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,652 |
ibm_platform_services.iam_access_groups_v2
|
remove_members_from_access_group
|
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
|
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
|
(self, access_group_id: str, *, members: Optional[List[str]] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,653 |
ibm_platform_services.iam_access_groups_v2
|
replace_access_group_rule
|
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
|
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
|
(self, access_group_id: str, rule_id: str, if_match: 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,661 |
ibm_platform_services.iam_access_groups_v2
|
update_access_group
|
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
|
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
|
(self, access_group_id: str, if_match: str, *, name: Optional[str] = None, description: Optional[str] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,662 |
ibm_platform_services.iam_access_groups_v2
|
update_account_settings
|
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
|
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
|
(self, account_id: str, *, public_access_enabled: Optional[bool] = None, transaction_id: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,663 |
ibm_platform_services.iam_access_groups_v2
|
update_assignment
|
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
|
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
|
(self, assignment_id: str, if_match: str, template_version: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,664 |
ibm_platform_services.iam_access_groups_v2
|
update_template_version
|
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
|
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
|
(self, template_id: str, version_num: str, if_match: 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,665 |
ibm_platform_services.iam_identity_v1
|
IamIdentityV1
|
The iam_identity V1 service.
|
class IamIdentityV1(BaseService):
"""The iam_identity V1 service."""
DEFAULT_SERVICE_URL = 'https://iam.cloud.ibm.com'
DEFAULT_SERVICE_NAME = 'iam_identity'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'IamIdentityV1':
"""
Return a new client for the iam_identity 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_identity 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)
#########################
# API key operations
#########################
def list_api_keys(
self,
*,
account_id: Optional[str] = None,
iam_id: Optional[str] = None,
pagesize: Optional[int] = None,
pagetoken: Optional[str] = None,
scope: Optional[str] = None,
type: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get API keys for a given service or user IAM ID and account ID.
Returns the list of API key details for a given service or user IAM ID and account
ID. Users can manage user API keys for themself, or service ID API keys for
service IDs that are bound to an entity they have access to. In case of service
IDs and their API keys, a user must be either an account owner, a IBM Cloud org
manager or IBM Cloud space developer in order to manage service IDs of the entity.
:param str account_id: (optional) Account ID of the API keys 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: (optional) IAM ID of the API keys to be queried. The IAM
ID may be that of a user or a service. For a user IAM ID iam_id must match
the Authorization token.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str scope: (optional) Optional parameter to define the scope of the
queried API keys. Can be 'entity' (default) or 'account'.
:param str type: (optional) Optional parameter to filter the type of the
queried API keys. Can be 'user' or 'serviceid'.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and created_by. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKeyList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_api_keys',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'iam_id': iam_id,
'pagesize': pagesize,
'pagetoken': pagetoken,
'scope': scope,
'type': type,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/apikeys'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_api_key(
self,
name: str,
iam_id: str,
*,
description: Optional[str] = None,
account_id: Optional[str] = None,
apikey: Optional[str] = None,
store_value: Optional[bool] = None,
support_sessions: Optional[bool] = None,
action_when_leaked: Optional[str] = None,
entity_lock: Optional[str] = None,
entity_disable: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create an API key.
Creates an API key for a UserID or service ID. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str name: Name of the API key. The name is not checked for
uniqueness. Therefore multiple names with the same value can exist. Access
is done via the UUID of the API key.
:param str iam_id: The iam_id that this API key authenticates.
:param str description: (optional) The optional description of the API key.
The 'description' property is only available if a description was provided
during a create of an API key.
:param str account_id: (optional) The account ID of the API key.
:param str apikey: (optional) You can optionally passthrough the API key
value for this API key. If passed, a minimum length validation of 32
characters for that apiKey value is done, i.e. the value can contain any
characters and can even be non-URL safe, but the minimum length requirement
must be met. If omitted, the API key management will create an URL safe
opaque API key value. The value of the API key is checked for uniqueness.
Ensure enough variations when passing in this value.
:param bool store_value: (optional) Send true or false to set whether the
API key value is retrievable in the future by using the Get details of an
API key request. If you create an API key for a user, you must specify
`false` or omit the value. We don't allow storing of API keys for users.
:param bool support_sessions: (optional) Defines if the API key supports
sessions. Sessions are only supported for user apikeys.
:param str action_when_leaked: (optional) Defines the action to take when
API key is leaked, valid values are 'none', 'disable' and 'delete'.
:param str entity_lock: (optional) Indicates if the API key is locked for
further write operations. False by default.
:param str entity_disable: (optional) Indicates if the API key is disabled.
False by default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
"""
if name is None:
raise ValueError('name must be provided')
if iam_id is None:
raise ValueError('iam_id must be provided')
headers = {
'Entity-Lock': entity_lock,
'Entity-Disable': entity_disable,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_api_key',
)
headers.update(sdk_headers)
data = {
'name': name,
'iam_id': iam_id,
'description': description,
'account_id': account_id,
'apikey': apikey,
'store_value': store_value,
'support_sessions': support_sessions,
'action_when_leaked': action_when_leaked,
}
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/apikeys'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_api_keys_details(
self,
*,
iam_api_key: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get details of an API key by its value.
Returns the details of an API key by its value. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str iam_api_key: (optional) API key value.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
"""
headers = {
'IAM-ApiKey': iam_api_key,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_api_keys_details',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/apikeys/details'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_api_key(
self,
id: str,
*,
include_history: Optional[bool] = None,
include_activity: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get details of an API key.
Returns the details of an API key. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. In case of service IDs and their API keys, a user must be either an account
owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage
service IDs of the entity.
:param str id: Unique ID of the API key.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_api_key',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
'include_activity': include_activity,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{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_api_key(
self,
id: str,
if_match: str,
*,
name: Optional[str] = None,
description: Optional[str] = None,
support_sessions: Optional[bool] = None,
action_when_leaked: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Updates an API key.
Updates properties of an API key. This does NOT affect existing access tokens.
Their token content will stay unchanged until the access token is refreshed. To
update an API key, pass the property to be modified. To delete one property's
value, pass the property with an empty value "".Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str id: Unique ID of the API key to be updated.
:param str if_match: Version of the API key to be updated. Specify the
version that you retrieved when reading the API key. 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 name: (optional) The name of the API key to update. If specified
in the request the parameter must not be empty. The name is not checked for
uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the API key to
update. If specified an empty description will clear the description of the
API key. If a non empty value is provided the API key will be updated.
:param bool support_sessions: (optional) Defines if the API key supports
sessions. Sessions are only supported for user apikeys.
:param str action_when_leaked: (optional) Defines the action to take when
API key is leaked, valid values are 'none', 'disable' and 'delete'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
"""
if not id:
raise ValueError('id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_api_key',
)
headers.update(sdk_headers)
data = {
'name': name,
'description': description,
'support_sessions': support_sessions,
'action_when_leaked': action_when_leaked,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Deletes an API key.
Deletes an API key. Existing tokens will remain valid until expired. Users can
manage user API keys for themself, or service ID API keys for service IDs that are
bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def lock_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Lock the API key.
Locks an API key by ID. Users can manage user API keys for themself, or service ID
API keys for service IDs that are bound to an entity they have access to. In case
of service IDs and their API keys, a user must be either an account owner, a IBM
Cloud org manager or IBM Cloud space developer in order to manage service IDs of
the entity.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='lock_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}/lock'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def unlock_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Unlock the API key.
Unlocks an API key by ID. Users can manage user API keys for themself, or service
ID API keys for service IDs that are bound to an entity they have access to. In
case of service IDs and their API keys, a user must be either an account owner, a
IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs
of the entity.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='unlock_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}/lock'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def disable_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
disable the API key.
Disable an API key. Users can manage user API keys for themself, or service ID API
keys for service IDs that are bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='disable_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}/disable'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def enable_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Enable the API key.
Enable an API key. Users can manage user API keys for themself, or service ID API
keys for service IDs that are bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='enable_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}/disable'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# Service ID operations
#########################
def list_service_ids(
self,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
pagesize: Optional[int] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List service IDs.
Returns a list of service IDs. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. Note: apikey details are only included in the response when creating a Service
ID with an api key.
:param str account_id: (optional) Account ID of the service ID(s) to query.
This parameter is required (unless using a pagetoken).
:param str name: (optional) Name of the service ID(s) to query. Optional.20
items per page. Valid range is 1 to 100.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and modified_at. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceIdList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_service_ids',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'name': name,
'pagesize': pagesize,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/serviceids/'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_service_id(
self,
account_id: str,
name: str,
*,
description: Optional[str] = None,
unique_instance_crns: Optional[List[str]] = None,
apikey: Optional['ApiKeyInsideCreateServiceIdRequest'] = None,
entity_lock: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a service ID.
Creates a service ID for an IBM Cloud account. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str account_id: ID of the account the service ID belongs to.
:param str name: Name of the Service Id. The name is not checked for
uniqueness. Therefore multiple names with the same value can exist. Access
is done via the UUID of the Service Id.
:param str description: (optional) The optional description of the Service
Id. The 'description' property is only available if a description was
provided during a create of a Service Id.
:param List[str] unique_instance_crns: (optional) Optional list of CRNs
(string array) which point to the services connected to the service ID.
:param ApiKeyInsideCreateServiceIdRequest apikey: (optional) Parameters for
the API key in the Create service Id V1 REST request.
:param str entity_lock: (optional) Indicates if the service ID is locked
for further write operations. False by default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceId` object
"""
if account_id is None:
raise ValueError('account_id must be provided')
if name is None:
raise ValueError('name must be provided')
if apikey is not None:
apikey = convert_model(apikey)
headers = {
'Entity-Lock': entity_lock,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_service_id',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'unique_instance_crns': unique_instance_crns,
'apikey': apikey,
}
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/serviceids/'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_service_id(
self,
id: str,
*,
include_history: Optional[bool] = None,
include_activity: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get details of a service ID.
Returns the details of a service ID. Users can manage user API keys for themself,
or service ID API keys for service IDs that are bound to an entity they have
access to. Note: apikey details are only included in the response when creating a
Service ID with an api key.
:param str id: Unique ID of the service ID.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceId` object
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_service_id',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
'include_activity': include_activity,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{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_service_id(
self,
id: str,
if_match: str,
*,
name: Optional[str] = None,
description: Optional[str] = None,
unique_instance_crns: Optional[List[str]] = None,
**kwargs,
) -> DetailedResponse:
"""
Update service ID.
Updates properties of a service ID. This does NOT affect existing access tokens.
Their token content will stay unchanged until the access token is refreshed. To
update a service ID, pass the property to be modified. To delete one property's
value, pass the property with an empty value "".Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to. Note: apikey details are only included in the response when
creating a Service ID with an apikey.
:param str id: Unique ID of the service ID to be updated.
:param str if_match: Version of the service ID to be updated. Specify the
version that you retrieved as entity_tag (ETag header) when reading the
service ID. 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 name: (optional) The name of the service ID to update. If
specified in the request the parameter must not be empty. The name is not
checked for uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the service ID to
update. If specified an empty description will clear the description of the
service ID. If an non empty value is provided the service ID will be
updated.
:param List[str] unique_instance_crns: (optional) List of CRNs which point
to the services connected to this service ID. If specified an empty list
will clear all existing unique instance crns of the service 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 `ServiceId` object
"""
if not id:
raise ValueError('id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_service_id',
)
headers.update(sdk_headers)
data = {
'name': name,
'description': description,
'unique_instance_crns': unique_instance_crns,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_service_id(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Deletes a service ID and associated API keys.
Deletes a service ID and all API keys associated to it. Before deleting the
service ID, all associated API keys are deleted. In case a Delete Conflict (status
code 409) a retry of the request may help as the service ID is only deleted if the
associated API keys were successfully deleted before. Users can manage user API
keys for themself, or service ID API keys for service IDs that are bound to an
entity they have access to.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_service_id',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def lock_service_id(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Lock the service ID.
Locks a service ID by ID. Users can manage user API keys for themself, or service
ID API keys for service IDs that are bound to an entity they have access to. In
case of service IDs and their API keys, a user must be either an account owner, a
IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs
of the entity.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='lock_service_id',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}/lock'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def unlock_service_id(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Unlock the service ID.
Unlocks a service ID by ID. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. In case of service IDs and their API keys, a user must be either an account
owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage
service IDs of the entity.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='unlock_service_id',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}/lock'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# Trusted profiles operations
#########################
def create_profile(
self,
name: str,
account_id: str,
*,
description: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a trusted profile.
Create a trusted profile for a given account ID.
:param str name: Name of the trusted profile. The name is checked for
uniqueness. Therefore trusted profiles with the same names can not exist in
the same account.
:param str account_id: The account ID of the trusted profile.
:param str description: (optional) The optional description of the trusted
profile. The 'description' property is only available if a description was
provided during creation of trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
"""
if name is None:
raise ValueError('name must be provided')
if account_id is None:
raise ValueError('account_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_profile',
)
headers.update(sdk_headers)
data = {
'name': name,
'account_id': account_id,
'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 = '/v1/profiles'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_profiles(
self,
account_id: str,
*,
name: Optional[str] = None,
pagesize: Optional[int] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
pagetoken: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List trusted profiles.
List the trusted profiles in an account. The `account_id` query parameter
determines the account from which to retrieve the list of trusted profiles.
:param str account_id: Account ID to query for trusted profiles.
:param str name: (optional) Name of the trusted profile to query.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and modified_at. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfilesList` 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='list_profiles',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'name': name,
'pagesize': pagesize,
'sort': sort,
'order': order,
'include_history': include_history,
'pagetoken': pagetoken,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/profiles'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_profile(
self,
profile_id: str,
*,
include_activity: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get a trusted profile.
Retrieve a trusted profile by its `profile-id`. Only the trusted profile's data is
returned (`name`, `description`, `iam_id`, etc.), not the federated users or
compute resources that qualify to apply the trusted profile.
:param str profile_id: ID of the trusted profile to get.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_profile',
)
headers.update(sdk_headers)
params = {
'include_activity': include_activity,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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_profile(
self,
profile_id: str,
if_match: str,
*,
name: Optional[str] = None,
description: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update a trusted profile.
Update the name or description of an existing trusted profile.
:param str profile_id: ID of the trusted profile to be updated.
:param str if_match: Version of the trusted profile to be updated. Specify
the version that you retrived when reading list of trusted profiles. This
value helps to identify any parallel usage of trusted profile. Pass * to
indicate to update any version available. This might result in stale
updates.
:param str name: (optional) The name of the trusted profile to update. If
specified in the request the parameter must not be empty. The name is
checked for uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the trusted profile
to update. If specified an empty description will clear the description of
the trusted profile. If a non empty value is provided the trusted profile
will be updated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_profile',
)
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 = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_profile(
self,
profile_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a trusted profile.
Delete a trusted profile. When you delete trusted profile, compute resources and
federated users are unlinked from the profile and can no longer apply the trusted
profile identity.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_profile',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def create_claim_rule(
self,
profile_id: str,
type: str,
conditions: List['ProfileClaimRuleConditions'],
*,
context: Optional['ResponseContext'] = None,
name: Optional[str] = None,
realm_name: Optional[str] = None,
cr_type: Optional[str] = None,
expiration: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
Create claim rule for a trusted profile.
Create a claim rule for a trusted profile. There is a limit of 20 rules per
trusted profile.
:param str profile_id: ID of the trusted profile to create a claim rule.
:param str type: Type of the claim rule, either 'Profile-SAML' or
'Profile-CR'.
:param List[ProfileClaimRuleConditions] conditions: Conditions of this
claim rule.
:param ResponseContext context: (optional) Context with key properties for
problem determination.
:param str name: (optional) Name of the claim rule to be created or
updated.
:param str realm_name: (optional) The realm name of the Idp this claim rule
applies to. This field is required only if the type is specified as
'Profile-SAML'.
:param str cr_type: (optional) The compute resource type the rule applies
to, required only if type is specified as 'Profile-CR'. Valid values are
VSI, IKS_SA, ROKS_SA.
:param int expiration: (optional) Session expiration in seconds, only
required if type is 'Profile-SAML'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if type is None:
raise ValueError('type must be provided')
if conditions is None:
raise ValueError('conditions must be provided')
conditions = [convert_model(x) for x in conditions]
if context is not None:
context = convert_model(context)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_claim_rule',
)
headers.update(sdk_headers)
data = {
'type': type,
'conditions': conditions,
'context': context,
'name': name,
'realm_name': realm_name,
'cr_type': cr_type,
'expiration': expiration,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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_claim_rules(
self,
profile_id: str,
**kwargs,
) -> DetailedResponse:
"""
List claim rules for a trusted profile.
Get a list of all claim rules for a trusted profile. The `profile-id` query
parameter determines the profile from which to retrieve the list of claim rules.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRuleList` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_claim_rules',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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_claim_rule(
self,
profile_id: str,
rule_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get a claim rule for a trusted profile.
A specific claim rule can be fetched for a given trusted profile ID and rule ID.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to get.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not rule_id:
raise ValueError('rule_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_claim_rule',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id', 'rule-id']
path_param_values = self.encode_path_vars(profile_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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 update_claim_rule(
self,
profile_id: str,
rule_id: str,
if_match: str,
type: str,
conditions: List['ProfileClaimRuleConditions'],
*,
context: Optional['ResponseContext'] = None,
name: Optional[str] = None,
realm_name: Optional[str] = None,
cr_type: Optional[str] = None,
expiration: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
Update claim rule for a trusted profile.
Update a specific claim rule for a given trusted profile ID and rule ID.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to update.
:param str if_match: Version of the claim rule to be updated. Specify the
version that you retrived when reading list of claim rules. This value
helps to identify any parallel usage of claim rule. Pass * to indicate to
update any version available. This might result in stale updates.
:param str type: Type of the claim rule, either 'Profile-SAML' or
'Profile-CR'.
:param List[ProfileClaimRuleConditions] conditions: Conditions of this
claim rule.
:param ResponseContext context: (optional) Context with key properties for
problem determination.
:param str name: (optional) Name of the claim rule to be created or
updated.
:param str realm_name: (optional) The realm name of the Idp this claim rule
applies to. This field is required only if the type is specified as
'Profile-SAML'.
:param str cr_type: (optional) The compute resource type the rule applies
to, required only if type is specified as 'Profile-CR'. Valid values are
VSI, IKS_SA, ROKS_SA.
:param int expiration: (optional) Session expiration in seconds, only
required if type is 'Profile-SAML'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
"""
if not profile_id:
raise ValueError('profile_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 type is None:
raise ValueError('type must be provided')
if conditions is None:
raise ValueError('conditions must be provided')
conditions = [convert_model(x) for x in conditions]
if context is not None:
context = convert_model(context)
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_claim_rule',
)
headers.update(sdk_headers)
data = {
'type': type,
'conditions': conditions,
'context': context,
'name': name,
'realm_name': realm_name,
'cr_type': cr_type,
'expiration': expiration,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id', 'rule-id']
path_param_values = self.encode_path_vars(profile_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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 delete_claim_rule(
self,
profile_id: str,
rule_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a claim rule.
Delete a claim rule. When you delete a claim rule, federated user or compute
resources are no longer required to meet the conditions of the claim rule in order
to apply the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to delete.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not rule_id:
raise ValueError('rule_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_claim_rule',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['profile-id', 'rule-id']
path_param_values = self.encode_path_vars(profile_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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
def create_link(
self,
profile_id: str,
cr_type: str,
link: 'CreateProfileLinkRequestLink',
*,
name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create link to a trusted profile.
Create a direct link between a specific compute resource and a trusted profile,
rather than creating conditions that a compute resource must fulfill to apply a
trusted profile.
:param str profile_id: ID of the trusted profile.
:param str cr_type: The compute resource type. Valid values are VSI,
IKS_SA, ROKS_SA.
:param CreateProfileLinkRequestLink link: Link details.
:param str name: (optional) Optional name of the Link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLink` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if cr_type is None:
raise ValueError('cr_type must be provided')
if link is None:
raise ValueError('link must be provided')
link = convert_model(link)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_link',
)
headers.update(sdk_headers)
data = {
'cr_type': cr_type,
'link': link,
'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 = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/links'.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_links(
self,
profile_id: str,
**kwargs,
) -> DetailedResponse:
"""
List links to a trusted profile.
Get a list of links to a trusted profile.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLinkList` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_links',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/links'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def get_link(
self,
profile_id: str,
link_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get link to a trusted profile.
Get a specific link to a trusted profile by `link_id`.
:param str profile_id: ID of the trusted profile.
:param str link_id: ID of the link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLink` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not link_id:
raise ValueError('link_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_link',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id', 'link-id']
path_param_values = self.encode_path_vars(profile_id, link_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/links/{link-id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def delete_link(
self,
profile_id: str,
link_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete link to a trusted profile.
Delete a link between a compute resource and a trusted profile.
:param str profile_id: ID of the trusted profile.
:param str link_id: ID of the link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not link_id:
raise ValueError('link_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_link',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['profile-id', 'link-id']
path_param_values = self.encode_path_vars(profile_id, link_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/links/{link-id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def get_profile_identities(
self,
profile_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get a list of identities that can assume the trusted profile.
Get a list of identities that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentitiesResponse` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_profile_identities',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def set_profile_identities(
self,
profile_id: str,
if_match: str,
*,
identities: Optional[List['ProfileIdentityRequest']] = None,
**kwargs,
) -> DetailedResponse:
"""
Update the list of identities that can assume the trusted profile.
Update the list of identities that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str if_match: Entity tag of the Identities to be updated. Specify
the tag that you retrieved when reading the Profile Identities. This value
helps identify parallel usage of this API. Pass * to indicate updating any
available version, which may result in stale updates.
:param List[ProfileIdentityRequest] identities: (optional) List of
identities that can assume the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentitiesResponse` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if identities is not None:
identities = [convert_model(x) for x in identities]
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='set_profile_identities',
)
headers.update(sdk_headers)
data = {
'identities': identities,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def set_profile_identity(
self,
profile_id: str,
identity_type: str,
identifier: str,
type: str,
*,
accounts: Optional[List[str]] = None,
description: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Add a specific identity that can assume the trusted profile.
Add a specific identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier: Identifier of the identity that can assume the
trusted profiles. This can be a user identifier (IAM id), serviceid or crn.
Internally it uses account id of the service id for the identifier
'serviceid' and for the identifier 'crn' it uses account id contained in
the CRN.
:param str type: Type of the identity.
:param List[str] accounts: (optional) Only valid for the type user.
Accounts from which a user can assume the trusted profile.
:param str description: (optional) Description of the identity that can
assume the trusted profile. This is optional field for all the types of
identities. When this field is not set for the identity type 'serviceid'
then the description of the service id is used. Description is recommended
for the identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service
project'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentityResponse` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not identity_type:
raise ValueError('identity_type must be provided')
if identifier is None:
raise ValueError('identifier must be provided')
if type is None:
raise ValueError('type must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='set_profile_identity',
)
headers.update(sdk_headers)
data = {
'identifier': identifier,
'type': type,
'accounts': accounts,
'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 = ['profile-id', 'identity-type']
path_param_values = self.encode_path_vars(profile_id, identity_type)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities/{identity-type}'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_profile_identity(
self,
profile_id: str,
identity_type: str,
identifier_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get the identity that can assume the trusted profile.
Get the identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier_id: Identifier of the identity that can assume the
trusted profiles.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentityResponse` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not identity_type:
raise ValueError('identity_type must be provided')
if not identifier_id:
raise ValueError('identifier_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_profile_identity',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id', 'identity-type', 'identifier-id']
path_param_values = self.encode_path_vars(profile_id, identity_type, identifier_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities/{identity-type}/{identifier-id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def delete_profile_identity(
self,
profile_id: str,
identity_type: str,
identifier_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete the identity that can assume the trusted profile.
Delete the identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier_id: Identifier of the identity that can assume the
trusted profiles.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not identity_type:
raise ValueError('identity_type must be provided')
if not identifier_id:
raise ValueError('identifier_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_profile_identity',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['profile-id', 'identity-type', 'identifier-id']
path_param_values = self.encode_path_vars(profile_id, identity_type, identifier_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities/{identity-type}/{identifier-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,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get account configurations.
Returns the details of an account's configuration.
:param str account_id: Unique ID of the account.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsResponse` 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_settings',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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 = '/v1/accounts/{account_id}/settings/identity'.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_account_settings(
self,
if_match: str,
account_id: str,
*,
restrict_create_service_id: Optional[str] = None,
restrict_create_platform_apikey: Optional[str] = None,
allowed_ip_addresses: Optional[str] = None,
mfa: Optional[str] = None,
user_mfa: Optional[List['AccountSettingsUserMFA']] = None,
session_expiration_in_seconds: Optional[str] = None,
session_invalidation_in_seconds: Optional[str] = None,
max_sessions_per_identity: Optional[str] = None,
system_access_token_expiration_in_seconds: Optional[str] = None,
system_refresh_token_expiration_in_seconds: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update account configurations.
Allows a user to configure settings on their account with regards to MFA, MFA
excemption list, session lifetimes, access control for creating new identities,
and enforcing IP restrictions on token creation.
:param str if_match: Version of the account settings to be updated. Specify
the version that you retrieved as entity_tag (ETag header) when reading the
account. 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 account_id: The id of the account to update the settings for.
:param str restrict_create_service_id: (optional) Defines whether or not
creating a service ID is access controlled. Valid values:
* RESTRICTED - only users assigned the 'Service ID creator' role on the
IAM Identity Service can create service IDs, including the account owner
* NOT_RESTRICTED - all members of an account can create service IDs
* NOT_SET - to 'unset' a previous set value.
:param str restrict_create_platform_apikey: (optional) Defines whether or
not creating platform API keys is access controlled. Valid values:
* RESTRICTED - only users assigned the 'User API key creator' role on the
IAM Identity Service can create API keys, including the account owner
* NOT_RESTRICTED - all members of an account can create platform API keys
* NOT_SET - to 'unset' a previous set value.
:param str allowed_ip_addresses: (optional) Defines the IP addresses and
subnets from which IAM tokens can be created for the account.
:param str mfa: (optional) Defines the MFA trait for the account. Valid
values:
* NONE - No MFA trait set
* NONE_NO_ROPC- No MFA, disable CLI logins with only a password
* TOTP - For all non-federated IBMId users
* TOTP4ALL - For all users
* LEVEL1 - Email-based MFA for all users
* LEVEL2 - TOTP-based MFA for all users
* LEVEL3 - U2F MFA for all users.
:param List[AccountSettingsUserMFA] user_mfa: (optional) List of users that
are exempted from the MFA requirement of the account.
:param str session_expiration_in_seconds: (optional) Defines the session
expiration in seconds for the account. Valid values:
* Any whole number between between '900' and '86400'
* NOT_SET - To unset account setting and use service default.
:param str session_invalidation_in_seconds: (optional) Defines the period
of time in seconds in which a session will be invalidated due to
inactivity. Valid values:
* Any whole number between '900' and '7200'
* NOT_SET - To unset account setting and use service default.
:param str max_sessions_per_identity: (optional) Defines the max allowed
sessions per identity required by the account. Value values:
* Any whole number greater than 0
* NOT_SET - To unset account setting and use service default.
:param str system_access_token_expiration_in_seconds: (optional) Defines
the access token expiration in seconds. Valid values:
* Any whole number between '900' and '3600'
* NOT_SET - To unset account setting and use service default.
:param str system_refresh_token_expiration_in_seconds: (optional) Defines
the refresh token expiration in seconds. Valid values:
* Any whole number between '900' and '259200'
* NOT_SET - To unset account setting and use service default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsResponse` object
"""
if not if_match:
raise ValueError('if_match must be provided')
if not account_id:
raise ValueError('account_id must be provided')
if user_mfa is not None:
user_mfa = [convert_model(x) for x in user_mfa]
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_account_settings',
)
headers.update(sdk_headers)
data = {
'restrict_create_service_id': restrict_create_service_id,
'restrict_create_platform_apikey': restrict_create_platform_apikey,
'allowed_ip_addresses': allowed_ip_addresses,
'mfa': mfa,
'user_mfa': user_mfa,
'session_expiration_in_seconds': session_expiration_in_seconds,
'session_invalidation_in_seconds': session_invalidation_in_seconds,
'max_sessions_per_identity': max_sessions_per_identity,
'system_access_token_expiration_in_seconds': system_access_token_expiration_in_seconds,
'system_refresh_token_expiration_in_seconds': system_refresh_token_expiration_in_seconds,
}
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 = ['account_id']
path_param_values = self.encode_path_vars(account_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/accounts/{account_id}/settings/identity'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
#########################
# MFA enrollment status
#########################
def get_mfa_status(
self,
account_id: str,
iam_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get MFA enrollment status for a single user in the account.
Get MFA enrollment status for a single user in the account.
:param str account_id: ID of the account.
:param str iam_id: iam_id of the user. This user must be the member of the
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 `UserMfaEnrollments` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not iam_id:
raise ValueError('iam_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_mfa_status',
)
headers.update(sdk_headers)
params = {
'iam_id': iam_id,
}
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 = '/v1/mfa/accounts/{account_id}/status'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_mfa_report(
self,
account_id: str,
*,
type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Trigger MFA enrollment status report for the account.
Trigger MFA enrollment status report for the account by specifying the account ID.
It can take a few minutes to generate the report for retrieval.
:param str account_id: ID of the account.
:param str type: (optional) Optional report type. The supported value is
'mfa_status'. List MFA enrollment status for all the identities.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ReportReference` 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='create_mfa_report',
)
headers.update(sdk_headers)
params = {
'type': type,
}
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 = '/v1/mfa/accounts/{account_id}/report'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_mfa_report(
self,
account_id: str,
reference: str,
**kwargs,
) -> DetailedResponse:
"""
Get MFA enrollment status report for the account.
Get MFA enrollment status report for the account by specifying the account ID and
the reference that is generated by triggering the report. Reports older than a day
are deleted when generating a new report.
:param str account_id: ID of the account.
:param str reference: Reference for the report to be generated, You can use
'latest' to get the latest report for the given 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 `ReportMfaEnrollmentStatus` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not reference:
raise ValueError('reference must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_mfa_report',
)
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', 'reference']
path_param_values = self.encode_path_vars(account_id, reference)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/mfa/accounts/{account_id}/report/{reference}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# accountSettingsAssignments
#########################
def list_account_settings_assignments(
self,
*,
account_id: Optional[str] = None,
template_id: Optional[str] = None,
template_version: Optional[str] = None,
target: Optional[str] = None,
target_type: Optional[str] = None,
limit: Optional[int] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List assignments.
List account settings assignments.
:param str account_id: (optional) Account ID of the Assignments to query.
This parameter is required unless using a pagetoken.
:param str template_id: (optional) Filter results by Template Id.
:param str template_version: (optional) Filter results Template Version.
:param str target: (optional) Filter results by the assignment target.
:param str target_type: (optional) Filter results by the assignment's
target type.
:param int limit: (optional) Optional size of a single page. Default is 20
items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) If specified, the items are sorted by the value
of this property.
:param str order: (optional) Sort order.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentListResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_account_settings_assignments',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'template_id': template_id,
'template_version': template_version,
'target': target,
'target_type': target_type,
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/account_settings_assignments/'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_account_settings_assignment(
self,
template_id: str,
template_version: int,
target_type: str,
target: str,
**kwargs,
) -> DetailedResponse:
"""
Create assignment.
Create an assigment for an account settings template.
:param str template_id: ID of the template to assign.
:param int template_version: Version of the template to assign.
:param str target_type: Type of target to deploy to.
:param str target: Identifier of target to deploy to.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account_settings_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/account_settings_assignments/'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_account_settings_assignment(
self,
assignment_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get assignment.
Get an assigment for an account settings template.
:param str assignment_id: ID of the Assignment Record.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_account_settings_assignment',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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/account_settings_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 delete_account_settings_assignment(
self,
assignment_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete assignment.
Delete an account settings template assignment. This removes any IAM resources
created by this assignment in child accounts.
:param str assignment_id: ID of the Assignment Record.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ExceptionResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_account_settings_assignment',
)
headers.update(sdk_headers)
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/account_settings_assignments/{assignment_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def update_account_settings_assignment(
self,
assignment_id: str,
if_match: str,
template_version: int,
**kwargs,
) -> DetailedResponse:
"""
Update assignment.
Update an account settings assignment. Call this method to retry failed
assignments or migrate the settings in child accounts to a new version.
: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 int template_version: Template version to be applied to the
assignment. To retry all failed assignments, provide the existing version.
To migrate to a different version, provide the new version number.
:param dict headers: 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 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='V1',
operation_id='update_account_settings_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/account_settings_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
#########################
# accountSettingsTemplate
#########################
def list_account_settings_templates(
self,
*,
account_id: Optional[str] = None,
limit: Optional[str] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List account settings templates.
List account settings templates in an enterprise account.
:param str account_id: (optional) Account ID of the account settings
templates to query. This parameter is required unless using a pagetoken.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_account_settings_templates',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/account_settings_templates'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_account_settings_template(
self,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
account_settings: Optional['AccountSettingsComponent'] = None,
**kwargs,
) -> DetailedResponse:
"""
Create an account settings template.
Create a new account settings template in an enterprise account.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
"""
if account_settings is not None:
account_settings = convert_model(account_settings)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account_settings_template',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'account_settings': account_settings,
}
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/account_settings_templates'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_latest_account_settings_template_version(
self,
template_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get latest version of an account settings template.
Get the latest version of a specific account settings template in an enterprise
account.
:param str template_id: ID of the account settings template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` 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='V1',
operation_id='get_latest_account_settings_template_version',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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/account_settings_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_all_versions_of_account_settings_template(
self,
template_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete all versions of an account settings template.
Delete all versions of an account settings template in an enterprise account. If
any version is assigned to child accounts, you must first delete the assignment.
:param str template_id: ID of the account settings template.
: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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_all_versions_of_account_settings_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/account_settings_templates/{template_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def list_versions_of_account_settings_template(
self,
template_id: str,
*,
limit: Optional[str] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List account settings template versions.
List the versions of a specific account settings template in an enterprise
account.
:param str template_id: ID of the account settings template.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateList` 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='V1',
operation_id='list_versions_of_account_settings_template',
)
headers.update(sdk_headers)
params = {
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
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/account_settings_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 create_account_settings_template_version(
self,
template_id: str,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
account_settings: Optional['AccountSettingsComponent'] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a new version of an account settings template.
Create a new version of an account settings template in an Enterprise Account.
:param str template_id: ID of the account settings template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if account_settings is not None:
account_settings = convert_model(account_settings)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account_settings_template_version',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'account_settings': account_settings,
}
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/account_settings_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 get_account_settings_template_version(
self,
template_id: str,
version: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get version of an account settings template.
Get a specific version of an account settings template in an Enterprise Account.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_account_settings_template_version',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/account_settings_templates/{template_id}/versions/{version}'.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_account_settings_template_version(
self,
if_match: str,
template_id: str,
version: str,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
account_settings: Optional['AccountSettingsComponent'] = None,
**kwargs,
) -> DetailedResponse:
"""
Update version of an account settings template.
Update a specific version of an account settings template in an Enterprise
Account.
:param str if_match: Entity tag of the Template to be updated. Specify the
tag that you retrieved when reading the account settings template. 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_id: ID of the account settings template.
:param str version: Version of the account settings template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
"""
if not if_match:
raise ValueError('if_match must be provided')
if not template_id:
raise ValueError('template_id must be provided')
if not version:
raise ValueError('version must be provided')
if account_settings is not None:
account_settings = convert_model(account_settings)
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_account_settings_template_version',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'account_settings': account_settings,
}
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']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/account_settings_templates/{template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_account_settings_template_version(
self,
template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Delete version of an account settings template.
Delete a specific version of an account settings template in an Enterprise
Account.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
: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:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_account_settings_template_version',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/account_settings_templates/{template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def commit_account_settings_template(
self,
template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Commit a template version.
Commit a specific version of an account settings template in an Enterprise
Account. A Template must be committed before being assigned, and once committed,
can no longer be modified.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
: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:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='commit_account_settings_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/account_settings_templates/{template_id}/versions/{version}/commit'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# activityOperations
#########################
def create_report(
self,
account_id: str,
*,
type: Optional[str] = None,
duration: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Trigger activity report for the account.
Trigger activity report for the account by specifying the account ID. It can take
a few minutes to generate the report for retrieval.
:param str account_id: ID of the account.
:param str type: (optional) Optional report type. The supported value is
'inactive'. List all identities that have not authenticated within the time
indicated by duration.
:param str duration: (optional) Optional duration of the report. The
supported unit of duration is hours.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ReportReference` 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='create_report',
)
headers.update(sdk_headers)
params = {
'type': type,
'duration': duration,
}
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 = '/v1/activity/accounts/{account_id}/report'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def get_report(
self,
account_id: str,
reference: str,
**kwargs,
) -> DetailedResponse:
"""
Get activity report for the account.
Get activity report for the account by specifying the account ID and the reference
that is generated by triggering the report. Reports older than a day are deleted
when generating a new report.
:param str account_id: ID of the account.
:param str reference: Reference for the report to be generated, You can use
'latest' to get the latest report for the given 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 `Report` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not reference:
raise ValueError('reference must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_report',
)
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', 'reference']
path_param_values = self.encode_path_vars(account_id, reference)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/activity/accounts/{account_id}/report/{reference}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# trustedProfileAssignments
#########################
def list_trusted_profile_assignments(
self,
*,
account_id: Optional[str] = None,
template_id: Optional[str] = None,
template_version: Optional[str] = None,
target: Optional[str] = None,
target_type: Optional[str] = None,
limit: Optional[int] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List assignments.
List trusted profile template assignments.
:param str account_id: (optional) Account ID of the Assignments to query.
This parameter is required unless using a pagetoken.
:param str template_id: (optional) Filter results by Template Id.
:param str template_version: (optional) Filter results Template Version.
:param str target: (optional) Filter results by the assignment target.
:param str target_type: (optional) Filter results by the assignment's
target type.
:param int limit: (optional) Optional size of a single page. Default is 20
items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) If specified, the items are sorted by the value
of this property.
:param str order: (optional) Sort order.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentListResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_trusted_profile_assignments',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'template_id': template_id,
'template_version': template_version,
'target': target,
'target_type': target_type,
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/profile_assignments/'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_trusted_profile_assignment(
self,
template_id: str,
template_version: int,
target_type: str,
target: str,
**kwargs,
) -> DetailedResponse:
"""
Create assignment.
Create an assigment for a trusted profile template.
:param str template_id: ID of the template to assign.
:param int template_version: Version of the template to assign.
:param str target_type: Type of target to deploy to.
:param str target: Identifier of target to deploy to.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_trusted_profile_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/profile_assignments/'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_trusted_profile_assignment(
self,
assignment_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get assignment.
Get an assigment for a trusted profile template.
:param str assignment_id: ID of the Assignment Record.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_trusted_profile_assignment',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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/profile_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 delete_trusted_profile_assignment(
self,
assignment_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete assignment.
Delete a trusted profile assignment. This removes any IAM resources created by
this assignment in child accounts.
:param str assignment_id: ID of the Assignment Record.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ExceptionResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_trusted_profile_assignment',
)
headers.update(sdk_headers)
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/profile_assignments/{assignment_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def update_trusted_profile_assignment(
self,
assignment_id: str,
if_match: str,
template_version: int,
**kwargs,
) -> DetailedResponse:
"""
Update assignment.
Update a trusted profile assignment. Call this method to retry failed assignments
or migrate the trusted profile in child accounts to a new version.
: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 int template_version: Template version to be applied to the
assignment. To retry all failed assignments, provide the existing version.
To migrate to a different version, provide the new version number.
:param dict headers: 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 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='V1',
operation_id='update_trusted_profile_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/profile_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
#########################
# trustedProfileTemplate
#########################
def list_profile_templates(
self,
*,
account_id: Optional[str] = None,
limit: Optional[str] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List trusted profile templates.
List the trusted profile templates in an enterprise account.
:param str account_id: (optional) Account ID of the trusted profile
templates to query. This parameter is required unless using a pagetoken.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templates are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_profile_templates',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/profile_templates'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_profile_template(
self,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
profile: Optional['TemplateProfileComponentRequest'] = None,
policy_template_references: Optional[List['PolicyTemplateReference']] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a trusted profile template.
Create a new trusted profile template in an enterprise account.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
"""
if profile is not None:
profile = convert_model(profile)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_profile_template',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'profile': profile,
'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/profile_templates'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_latest_profile_template_version(
self,
template_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get latest version of a trusted profile template.
Get the latest version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` 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='V1',
operation_id='get_latest_profile_template_version',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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/profile_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_all_versions_of_profile_template(
self,
template_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete all versions of a trusted profile template.
Delete all versions of a trusted profile template in an enterprise account. If any
version is assigned to child accounts, you must first delete the assignment.
:param str template_id: ID of the trusted profile template.
: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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_all_versions_of_profile_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/profile_templates/{template_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def list_versions_of_profile_template(
self,
template_id: str,
*,
limit: Optional[str] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List trusted profile template versions.
List the versions of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateList` 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='V1',
operation_id='list_versions_of_profile_template',
)
headers.update(sdk_headers)
params = {
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
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/profile_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 create_profile_template_version(
self,
template_id: str,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
profile: Optional['TemplateProfileComponentRequest'] = None,
policy_template_references: Optional[List['PolicyTemplateReference']] = None,
**kwargs,
) -> DetailedResponse:
"""
Create new version of a trusted profile template.
Create a new version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if profile is not None:
profile = convert_model(profile)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_profile_template_version',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'profile': profile,
'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/profile_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 get_profile_template_version(
self,
template_id: str,
version: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get version of trusted profile template.
Get a specific version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_profile_template_version',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profile_templates/{template_id}/versions/{version}'.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_profile_template_version(
self,
if_match: str,
template_id: str,
version: str,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
profile: Optional['TemplateProfileComponentRequest'] = None,
policy_template_references: Optional[List['PolicyTemplateReference']] = None,
**kwargs,
) -> DetailedResponse:
"""
Update version of trusted profile template.
Update a specific version of a trusted profile template in an enterprise account.
:param str if_match: Entity tag of the Template to be updated. Specify the
tag that you retrieved when reading the Profile Template. 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_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
"""
if not if_match:
raise ValueError('if_match must be provided')
if not template_id:
raise ValueError('template_id must be provided')
if not version:
raise ValueError('version must be provided')
if profile is not None:
profile = convert_model(profile)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_profile_template_version',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'profile': profile,
'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']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profile_templates/{template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_profile_template_version(
self,
template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Delete version of trusted profile template.
Delete a specific version of a trusted profile template in an enterprise account.
If the version is assigned to child accounts, you must first delete the
assignment.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
: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:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_profile_template_version',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profile_templates/{template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def commit_profile_template(
self,
template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Commit a template version.
Commit a specific version of a trusted profile template in an enterprise account.
You must commit a template before you can assign it to child accounts. Once a
template is committed, you can no longer modify the template.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
: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:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='commit_profile_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profile_templates/{template_id}/versions/{version}/commit'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
|
719,666 |
ibm_platform_services.iam_identity_v1
|
__init__
|
Construct a new client for the iam_identity 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_identity 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,671 |
ibm_platform_services.iam_identity_v1
|
commit_account_settings_template
|
Commit a template version.
Commit a specific version of an account settings template in an Enterprise
Account. A Template must be committed before being assigned, and once committed,
can no longer be modified.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def commit_account_settings_template(
self,
template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Commit a template version.
Commit a specific version of an account settings template in an Enterprise
Account. A Template must be committed before being assigned, and once committed,
can no longer be modified.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
: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:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='commit_account_settings_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/account_settings_templates/{template_id}/versions/{version}/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: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,672 |
ibm_platform_services.iam_identity_v1
|
commit_profile_template
|
Commit a template version.
Commit a specific version of a trusted profile template in an enterprise account.
You must commit a template before you can assign it to child accounts. Once a
template is committed, you can no longer modify the template.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def commit_profile_template(
self,
template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Commit a template version.
Commit a specific version of a trusted profile template in an enterprise account.
You must commit a template before you can assign it to child accounts. Once a
template is committed, you can no longer modify the template.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
: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:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='commit_profile_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profile_templates/{template_id}/versions/{version}/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: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,674 |
ibm_platform_services.iam_identity_v1
|
create_account_settings_assignment
|
Create assignment.
Create an assigment for an account settings template.
:param str template_id: ID of the template to assign.
:param int template_version: Version of the template to assign.
:param str target_type: Type of target to deploy to.
:param str target: Identifier of target to deploy to.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentResponse` object
|
def create_account_settings_assignment(
self,
template_id: str,
template_version: int,
target_type: str,
target: str,
**kwargs,
) -> DetailedResponse:
"""
Create assignment.
Create an assigment for an account settings template.
:param str template_id: ID of the template to assign.
:param int template_version: Version of the template to assign.
:param str target_type: Type of target to deploy to.
:param str target: Identifier of target to deploy to.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account_settings_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/account_settings_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: int, target_type: str, target: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,675 |
ibm_platform_services.iam_identity_v1
|
create_account_settings_template
|
Create an account settings template.
Create a new account settings template in an enterprise account.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
|
def create_account_settings_template(
self,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
account_settings: Optional['AccountSettingsComponent'] = None,
**kwargs,
) -> DetailedResponse:
"""
Create an account settings template.
Create a new account settings template in an enterprise account.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
"""
if account_settings is not None:
account_settings = convert_model(account_settings)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account_settings_template',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'account_settings': account_settings,
}
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/account_settings_templates'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, *, account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, account_settings: Optional[ibm_platform_services.iam_identity_v1.AccountSettingsComponent] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,676 |
ibm_platform_services.iam_identity_v1
|
create_account_settings_template_version
|
Create a new version of an account settings template.
Create a new version of an account settings template in an Enterprise Account.
:param str template_id: ID of the account settings template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
|
def create_account_settings_template_version(
self,
template_id: str,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
account_settings: Optional['AccountSettingsComponent'] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a new version of an account settings template.
Create a new version of an account settings template in an Enterprise Account.
:param str template_id: ID of the account settings template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if account_settings is not None:
account_settings = convert_model(account_settings)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_account_settings_template_version',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'account_settings': account_settings,
}
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/account_settings_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, *, account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, account_settings: Optional[ibm_platform_services.iam_identity_v1.AccountSettingsComponent] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,677 |
ibm_platform_services.iam_identity_v1
|
create_api_key
|
Create an API key.
Creates an API key for a UserID or service ID. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str name: Name of the API key. The name is not checked for
uniqueness. Therefore multiple names with the same value can exist. Access
is done via the UUID of the API key.
:param str iam_id: The iam_id that this API key authenticates.
:param str description: (optional) The optional description of the API key.
The 'description' property is only available if a description was provided
during a create of an API key.
:param str account_id: (optional) The account ID of the API key.
:param str apikey: (optional) You can optionally passthrough the API key
value for this API key. If passed, a minimum length validation of 32
characters for that apiKey value is done, i.e. the value can contain any
characters and can even be non-URL safe, but the minimum length requirement
must be met. If omitted, the API key management will create an URL safe
opaque API key value. The value of the API key is checked for uniqueness.
Ensure enough variations when passing in this value.
:param bool store_value: (optional) Send true or false to set whether the
API key value is retrievable in the future by using the Get details of an
API key request. If you create an API key for a user, you must specify
`false` or omit the value. We don't allow storing of API keys for users.
:param bool support_sessions: (optional) Defines if the API key supports
sessions. Sessions are only supported for user apikeys.
:param str action_when_leaked: (optional) Defines the action to take when
API key is leaked, valid values are 'none', 'disable' and 'delete'.
:param str entity_lock: (optional) Indicates if the API key is locked for
further write operations. False by default.
:param str entity_disable: (optional) Indicates if the API key is disabled.
False by default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
|
def create_api_key(
self,
name: str,
iam_id: str,
*,
description: Optional[str] = None,
account_id: Optional[str] = None,
apikey: Optional[str] = None,
store_value: Optional[bool] = None,
support_sessions: Optional[bool] = None,
action_when_leaked: Optional[str] = None,
entity_lock: Optional[str] = None,
entity_disable: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create an API key.
Creates an API key for a UserID or service ID. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str name: Name of the API key. The name is not checked for
uniqueness. Therefore multiple names with the same value can exist. Access
is done via the UUID of the API key.
:param str iam_id: The iam_id that this API key authenticates.
:param str description: (optional) The optional description of the API key.
The 'description' property is only available if a description was provided
during a create of an API key.
:param str account_id: (optional) The account ID of the API key.
:param str apikey: (optional) You can optionally passthrough the API key
value for this API key. If passed, a minimum length validation of 32
characters for that apiKey value is done, i.e. the value can contain any
characters and can even be non-URL safe, but the minimum length requirement
must be met. If omitted, the API key management will create an URL safe
opaque API key value. The value of the API key is checked for uniqueness.
Ensure enough variations when passing in this value.
:param bool store_value: (optional) Send true or false to set whether the
API key value is retrievable in the future by using the Get details of an
API key request. If you create an API key for a user, you must specify
`false` or omit the value. We don't allow storing of API keys for users.
:param bool support_sessions: (optional) Defines if the API key supports
sessions. Sessions are only supported for user apikeys.
:param str action_when_leaked: (optional) Defines the action to take when
API key is leaked, valid values are 'none', 'disable' and 'delete'.
:param str entity_lock: (optional) Indicates if the API key is locked for
further write operations. False by default.
:param str entity_disable: (optional) Indicates if the API key is disabled.
False by default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
"""
if name is None:
raise ValueError('name must be provided')
if iam_id is None:
raise ValueError('iam_id must be provided')
headers = {
'Entity-Lock': entity_lock,
'Entity-Disable': entity_disable,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_api_key',
)
headers.update(sdk_headers)
data = {
'name': name,
'iam_id': iam_id,
'description': description,
'account_id': account_id,
'apikey': apikey,
'store_value': store_value,
'support_sessions': support_sessions,
'action_when_leaked': action_when_leaked,
}
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/apikeys'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, name: str, iam_id: str, *, description: Optional[str] = None, account_id: Optional[str] = None, apikey: Optional[str] = None, store_value: Optional[bool] = None, support_sessions: Optional[bool] = None, action_when_leaked: Optional[str] = None, entity_lock: Optional[str] = None, entity_disable: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,678 |
ibm_platform_services.iam_identity_v1
|
create_claim_rule
|
Create claim rule for a trusted profile.
Create a claim rule for a trusted profile. There is a limit of 20 rules per
trusted profile.
:param str profile_id: ID of the trusted profile to create a claim rule.
:param str type: Type of the claim rule, either 'Profile-SAML' or
'Profile-CR'.
:param List[ProfileClaimRuleConditions] conditions: Conditions of this
claim rule.
:param ResponseContext context: (optional) Context with key properties for
problem determination.
:param str name: (optional) Name of the claim rule to be created or
updated.
:param str realm_name: (optional) The realm name of the Idp this claim rule
applies to. This field is required only if the type is specified as
'Profile-SAML'.
:param str cr_type: (optional) The compute resource type the rule applies
to, required only if type is specified as 'Profile-CR'. Valid values are
VSI, IKS_SA, ROKS_SA.
:param int expiration: (optional) Session expiration in seconds, only
required if type is 'Profile-SAML'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
|
def create_claim_rule(
self,
profile_id: str,
type: str,
conditions: List['ProfileClaimRuleConditions'],
*,
context: Optional['ResponseContext'] = None,
name: Optional[str] = None,
realm_name: Optional[str] = None,
cr_type: Optional[str] = None,
expiration: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
Create claim rule for a trusted profile.
Create a claim rule for a trusted profile. There is a limit of 20 rules per
trusted profile.
:param str profile_id: ID of the trusted profile to create a claim rule.
:param str type: Type of the claim rule, either 'Profile-SAML' or
'Profile-CR'.
:param List[ProfileClaimRuleConditions] conditions: Conditions of this
claim rule.
:param ResponseContext context: (optional) Context with key properties for
problem determination.
:param str name: (optional) Name of the claim rule to be created or
updated.
:param str realm_name: (optional) The realm name of the Idp this claim rule
applies to. This field is required only if the type is specified as
'Profile-SAML'.
:param str cr_type: (optional) The compute resource type the rule applies
to, required only if type is specified as 'Profile-CR'. Valid values are
VSI, IKS_SA, ROKS_SA.
:param int expiration: (optional) Session expiration in seconds, only
required if type is 'Profile-SAML'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if type is None:
raise ValueError('type must be provided')
if conditions is None:
raise ValueError('conditions must be provided')
conditions = [convert_model(x) for x in conditions]
if context is not None:
context = convert_model(context)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_claim_rule',
)
headers.update(sdk_headers)
data = {
'type': type,
'conditions': conditions,
'context': context,
'name': name,
'realm_name': realm_name,
'cr_type': cr_type,
'expiration': expiration,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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, profile_id: str, type: str, conditions: List[ibm_platform_services.iam_identity_v1.ProfileClaimRuleConditions], *, context: Optional[ibm_platform_services.iam_identity_v1.ResponseContext] = None, name: Optional[str] = None, realm_name: Optional[str] = None, cr_type: Optional[str] = None, expiration: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,679 |
ibm_platform_services.iam_identity_v1
|
create_link
|
Create link to a trusted profile.
Create a direct link between a specific compute resource and a trusted profile,
rather than creating conditions that a compute resource must fulfill to apply a
trusted profile.
:param str profile_id: ID of the trusted profile.
:param str cr_type: The compute resource type. Valid values are VSI,
IKS_SA, ROKS_SA.
:param CreateProfileLinkRequestLink link: Link details.
:param str name: (optional) Optional name of the Link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLink` object
|
def create_link(
self,
profile_id: str,
cr_type: str,
link: 'CreateProfileLinkRequestLink',
*,
name: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create link to a trusted profile.
Create a direct link between a specific compute resource and a trusted profile,
rather than creating conditions that a compute resource must fulfill to apply a
trusted profile.
:param str profile_id: ID of the trusted profile.
:param str cr_type: The compute resource type. Valid values are VSI,
IKS_SA, ROKS_SA.
:param CreateProfileLinkRequestLink link: Link details.
:param str name: (optional) Optional name of the Link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLink` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if cr_type is None:
raise ValueError('cr_type must be provided')
if link is None:
raise ValueError('link must be provided')
link = convert_model(link)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_link',
)
headers.update(sdk_headers)
data = {
'cr_type': cr_type,
'link': link,
'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 = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/links'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, cr_type: str, link: ibm_platform_services.iam_identity_v1.CreateProfileLinkRequestLink, *, name: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,680 |
ibm_platform_services.iam_identity_v1
|
create_mfa_report
|
Trigger MFA enrollment status report for the account.
Trigger MFA enrollment status report for the account by specifying the account ID.
It can take a few minutes to generate the report for retrieval.
:param str account_id: ID of the account.
:param str type: (optional) Optional report type. The supported value is
'mfa_status'. List MFA enrollment status for all the identities.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ReportReference` object
|
def create_mfa_report(
self,
account_id: str,
*,
type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Trigger MFA enrollment status report for the account.
Trigger MFA enrollment status report for the account by specifying the account ID.
It can take a few minutes to generate the report for retrieval.
:param str account_id: ID of the account.
:param str type: (optional) Optional report type. The supported value is
'mfa_status'. List MFA enrollment status for all the identities.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ReportReference` 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='create_mfa_report',
)
headers.update(sdk_headers)
params = {
'type': type,
}
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 = '/v1/mfa/accounts/{account_id}/report'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, *, type: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,681 |
ibm_platform_services.iam_identity_v1
|
create_profile
|
Create a trusted profile.
Create a trusted profile for a given account ID.
:param str name: Name of the trusted profile. The name is checked for
uniqueness. Therefore trusted profiles with the same names can not exist in
the same account.
:param str account_id: The account ID of the trusted profile.
:param str description: (optional) The optional description of the trusted
profile. The 'description' property is only available if a description was
provided during creation of trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
|
def create_profile(
self,
name: str,
account_id: str,
*,
description: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a trusted profile.
Create a trusted profile for a given account ID.
:param str name: Name of the trusted profile. The name is checked for
uniqueness. Therefore trusted profiles with the same names can not exist in
the same account.
:param str account_id: The account ID of the trusted profile.
:param str description: (optional) The optional description of the trusted
profile. The 'description' property is only available if a description was
provided during creation of trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
"""
if name is None:
raise ValueError('name must be provided')
if account_id is None:
raise ValueError('account_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_profile',
)
headers.update(sdk_headers)
data = {
'name': name,
'account_id': account_id,
'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 = '/v1/profiles'
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, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,682 |
ibm_platform_services.iam_identity_v1
|
create_profile_template
|
Create a trusted profile template.
Create a new trusted profile template in an enterprise account.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
|
def create_profile_template(
self,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
profile: Optional['TemplateProfileComponentRequest'] = None,
policy_template_references: Optional[List['PolicyTemplateReference']] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a trusted profile template.
Create a new trusted profile template in an enterprise account.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
"""
if profile is not None:
profile = convert_model(profile)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_profile_template',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'profile': profile,
'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/profile_templates'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, *, account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, profile: Optional[ibm_platform_services.iam_identity_v1.TemplateProfileComponentRequest] = None, policy_template_references: Optional[List[ibm_platform_services.iam_identity_v1.PolicyTemplateReference]] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,683 |
ibm_platform_services.iam_identity_v1
|
create_profile_template_version
|
Create new version of a trusted profile template.
Create a new version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
|
def create_profile_template_version(
self,
template_id: str,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
profile: Optional['TemplateProfileComponentRequest'] = None,
policy_template_references: Optional[List['PolicyTemplateReference']] = None,
**kwargs,
) -> DetailedResponse:
"""
Create new version of a trusted profile template.
Create a new version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if profile is not None:
profile = convert_model(profile)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_profile_template_version',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'profile': profile,
'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/profile_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, *, account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, profile: Optional[ibm_platform_services.iam_identity_v1.TemplateProfileComponentRequest] = None, policy_template_references: Optional[List[ibm_platform_services.iam_identity_v1.PolicyTemplateReference]] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,684 |
ibm_platform_services.iam_identity_v1
|
create_report
|
Trigger activity report for the account.
Trigger activity report for the account by specifying the account ID. It can take
a few minutes to generate the report for retrieval.
:param str account_id: ID of the account.
:param str type: (optional) Optional report type. The supported value is
'inactive'. List all identities that have not authenticated within the time
indicated by duration.
:param str duration: (optional) Optional duration of the report. The
supported unit of duration is hours.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ReportReference` object
|
def create_report(
self,
account_id: str,
*,
type: Optional[str] = None,
duration: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Trigger activity report for the account.
Trigger activity report for the account by specifying the account ID. It can take
a few minutes to generate the report for retrieval.
:param str account_id: ID of the account.
:param str type: (optional) Optional report type. The supported value is
'inactive'. List all identities that have not authenticated within the time
indicated by duration.
:param str duration: (optional) Optional duration of the report. The
supported unit of duration is hours.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ReportReference` 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='create_report',
)
headers.update(sdk_headers)
params = {
'type': type,
'duration': duration,
}
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 = '/v1/activity/accounts/{account_id}/report'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, *, type: Optional[str] = None, duration: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,685 |
ibm_platform_services.iam_identity_v1
|
create_service_id
|
Create a service ID.
Creates a service ID for an IBM Cloud account. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str account_id: ID of the account the service ID belongs to.
:param str name: Name of the Service Id. The name is not checked for
uniqueness. Therefore multiple names with the same value can exist. Access
is done via the UUID of the Service Id.
:param str description: (optional) The optional description of the Service
Id. The 'description' property is only available if a description was
provided during a create of a Service Id.
:param List[str] unique_instance_crns: (optional) Optional list of CRNs
(string array) which point to the services connected to the service ID.
:param ApiKeyInsideCreateServiceIdRequest apikey: (optional) Parameters for
the API key in the Create service Id V1 REST request.
:param str entity_lock: (optional) Indicates if the service ID is locked
for further write operations. False by default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceId` object
|
def create_service_id(
self,
account_id: str,
name: str,
*,
description: Optional[str] = None,
unique_instance_crns: Optional[List[str]] = None,
apikey: Optional['ApiKeyInsideCreateServiceIdRequest'] = None,
entity_lock: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a service ID.
Creates a service ID for an IBM Cloud account. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str account_id: ID of the account the service ID belongs to.
:param str name: Name of the Service Id. The name is not checked for
uniqueness. Therefore multiple names with the same value can exist. Access
is done via the UUID of the Service Id.
:param str description: (optional) The optional description of the Service
Id. The 'description' property is only available if a description was
provided during a create of a Service Id.
:param List[str] unique_instance_crns: (optional) Optional list of CRNs
(string array) which point to the services connected to the service ID.
:param ApiKeyInsideCreateServiceIdRequest apikey: (optional) Parameters for
the API key in the Create service Id V1 REST request.
:param str entity_lock: (optional) Indicates if the service ID is locked
for further write operations. False by default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceId` object
"""
if account_id is None:
raise ValueError('account_id must be provided')
if name is None:
raise ValueError('name must be provided')
if apikey is not None:
apikey = convert_model(apikey)
headers = {
'Entity-Lock': entity_lock,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_service_id',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'unique_instance_crns': unique_instance_crns,
'apikey': apikey,
}
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/serviceids/'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, name: str, *, description: Optional[str] = None, unique_instance_crns: Optional[List[str]] = None, apikey: Optional[ibm_platform_services.iam_identity_v1.ApiKeyInsideCreateServiceIdRequest] = None, entity_lock: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,686 |
ibm_platform_services.iam_identity_v1
|
create_trusted_profile_assignment
|
Create assignment.
Create an assigment for a trusted profile template.
:param str template_id: ID of the template to assign.
:param int template_version: Version of the template to assign.
:param str target_type: Type of target to deploy to.
:param str target: Identifier of target to deploy to.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentResponse` object
|
def create_trusted_profile_assignment(
self,
template_id: str,
template_version: int,
target_type: str,
target: str,
**kwargs,
) -> DetailedResponse:
"""
Create assignment.
Create an assigment for a trusted profile template.
:param str template_id: ID of the template to assign.
:param int template_version: Version of the template to assign.
:param str target_type: Type of target to deploy to.
:param str target: Identifier of target to deploy to.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_trusted_profile_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/profile_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: int, target_type: str, target: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,687 |
ibm_platform_services.iam_identity_v1
|
delete_account_settings_assignment
|
Delete assignment.
Delete an account settings template assignment. This removes any IAM resources
created by this assignment in child accounts.
:param str assignment_id: ID of the Assignment Record.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ExceptionResponse` object
|
def delete_account_settings_assignment(
self,
assignment_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete assignment.
Delete an account settings template assignment. This removes any IAM resources
created by this assignment in child accounts.
:param str assignment_id: ID of the Assignment Record.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ExceptionResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_account_settings_assignment',
)
headers.update(sdk_headers)
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/account_settings_assignments/{assignment_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, assignment_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,688 |
ibm_platform_services.iam_identity_v1
|
delete_account_settings_template_version
|
Delete version of an account settings template.
Delete a specific version of an account settings template in an Enterprise
Account.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
: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_settings_template_version(
self,
template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Delete version of an account settings template.
Delete a specific version of an account settings template in an Enterprise
Account.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
: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:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_account_settings_template_version',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/account_settings_templates/{template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, template_id: str, version: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,689 |
ibm_platform_services.iam_identity_v1
|
delete_all_versions_of_account_settings_template
|
Delete all versions of an account settings template.
Delete all versions of an account settings template in an enterprise account. If
any version is assigned to child accounts, you must first delete the assignment.
:param str template_id: ID of the account settings template.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_all_versions_of_account_settings_template(
self,
template_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete all versions of an account settings template.
Delete all versions of an account settings template in an enterprise account. If
any version is assigned to child accounts, you must first delete the assignment.
:param str template_id: ID of the account settings template.
: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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_all_versions_of_account_settings_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/account_settings_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, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,690 |
ibm_platform_services.iam_identity_v1
|
delete_all_versions_of_profile_template
|
Delete all versions of a trusted profile template.
Delete all versions of a trusted profile template in an enterprise account. If any
version is assigned to child accounts, you must first delete the assignment.
:param str template_id: ID of the trusted profile template.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_all_versions_of_profile_template(
self,
template_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete all versions of a trusted profile template.
Delete all versions of a trusted profile template in an enterprise account. If any
version is assigned to child accounts, you must first delete the assignment.
:param str template_id: ID of the trusted profile template.
: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 = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_all_versions_of_profile_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/profile_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, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,691 |
ibm_platform_services.iam_identity_v1
|
delete_api_key
|
Deletes an API key.
Deletes an API key. Existing tokens will remain valid until expired. Users can
manage user API keys for themself, or service ID API keys for service IDs that are
bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Deletes an API key.
Deletes an API key. Existing tokens will remain valid until expired. Users can
manage user API keys for themself, or service ID API keys for service IDs that are
bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,692 |
ibm_platform_services.iam_identity_v1
|
delete_claim_rule
|
Delete a claim rule.
Delete a claim rule. When you delete a claim rule, federated user or compute
resources are no longer required to meet the conditions of the claim rule in order
to apply the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to delete.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_claim_rule(
self,
profile_id: str,
rule_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a claim rule.
Delete a claim rule. When you delete a claim rule, federated user or compute
resources are no longer required to meet the conditions of the claim rule in order
to apply the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to delete.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not rule_id:
raise ValueError('rule_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_claim_rule',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['profile-id', 'rule-id']
path_param_values = self.encode_path_vars(profile_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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
|
(self, profile_id: str, rule_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,693 |
ibm_platform_services.iam_identity_v1
|
delete_link
|
Delete link to a trusted profile.
Delete a link between a compute resource and a trusted profile.
:param str profile_id: ID of the trusted profile.
:param str link_id: ID of the link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_link(
self,
profile_id: str,
link_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete link to a trusted profile.
Delete a link between a compute resource and a trusted profile.
:param str profile_id: ID of the trusted profile.
:param str link_id: ID of the link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not link_id:
raise ValueError('link_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_link',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['profile-id', 'link-id']
path_param_values = self.encode_path_vars(profile_id, link_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/links/{link-id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, link_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,694 |
ibm_platform_services.iam_identity_v1
|
delete_profile
|
Delete a trusted profile.
Delete a trusted profile. When you delete trusted profile, compute resources and
federated users are unlinked from the profile and can no longer apply the trusted
profile identity.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_profile(
self,
profile_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a trusted profile.
Delete a trusted profile. When you delete trusted profile, compute resources and
federated users are unlinked from the profile and can no longer apply the trusted
profile identity.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_profile',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,695 |
ibm_platform_services.iam_identity_v1
|
delete_profile_identity
|
Delete the identity that can assume the trusted profile.
Delete the identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier_id: Identifier of the identity that can assume the
trusted profiles.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_profile_identity(
self,
profile_id: str,
identity_type: str,
identifier_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete the identity that can assume the trusted profile.
Delete the identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier_id: Identifier of the identity that can assume the
trusted profiles.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not identity_type:
raise ValueError('identity_type must be provided')
if not identifier_id:
raise ValueError('identifier_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_profile_identity',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['profile-id', 'identity-type', 'identifier-id']
path_param_values = self.encode_path_vars(profile_id, identity_type, identifier_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities/{identity-type}/{identifier-id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, identity_type: str, identifier_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,696 |
ibm_platform_services.iam_identity_v1
|
delete_profile_template_version
|
Delete version of trusted profile template.
Delete a specific version of a trusted profile template in an enterprise account.
If the version is assigned to child accounts, you must first delete the
assignment.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_profile_template_version(
self,
template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Delete version of trusted profile template.
Delete a specific version of a trusted profile template in an enterprise account.
If the version is assigned to child accounts, you must first delete the
assignment.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
: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:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_profile_template_version',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profile_templates/{template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, template_id: str, version: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,697 |
ibm_platform_services.iam_identity_v1
|
delete_service_id
|
Deletes a service ID and associated API keys.
Deletes a service ID and all API keys associated to it. Before deleting the
service ID, all associated API keys are deleted. In case a Delete Conflict (status
code 409) a retry of the request may help as the service ID is only deleted if the
associated API keys were successfully deleted before. Users can manage user API
keys for themself, or service ID API keys for service IDs that are bound to an
entity they have access to.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_service_id(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Deletes a service ID and associated API keys.
Deletes a service ID and all API keys associated to it. Before deleting the
service ID, all associated API keys are deleted. In case a Delete Conflict (status
code 409) a retry of the request may help as the service ID is only deleted if the
associated API keys were successfully deleted before. Users can manage user API
keys for themself, or service ID API keys for service IDs that are bound to an
entity they have access to.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_service_id',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,698 |
ibm_platform_services.iam_identity_v1
|
delete_trusted_profile_assignment
|
Delete assignment.
Delete a trusted profile assignment. This removes any IAM resources created by
this assignment in child accounts.
:param str assignment_id: ID of the Assignment Record.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ExceptionResponse` object
|
def delete_trusted_profile_assignment(
self,
assignment_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete assignment.
Delete a trusted profile assignment. This removes any IAM resources created by
this assignment in child accounts.
:param str assignment_id: ID of the Assignment Record.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ExceptionResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_trusted_profile_assignment',
)
headers.update(sdk_headers)
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/profile_assignments/{assignment_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, assignment_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,699 |
ibm_platform_services.iam_identity_v1
|
disable_api_key
|
disable the API key.
Disable an API key. Users can manage user API keys for themself, or service ID API
keys for service IDs that are bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def disable_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
disable the API key.
Disable an API key. Users can manage user API keys for themself, or service ID API
keys for service IDs that are bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='disable_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}/disable'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,701 |
ibm_platform_services.iam_identity_v1
|
enable_api_key
|
Enable the API key.
Enable an API key. Users can manage user API keys for themself, or service ID API
keys for service IDs that are bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def enable_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Enable the API key.
Enable an API key. Users can manage user API keys for themself, or service ID API
keys for service IDs that are bound to an entity they have access to.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='enable_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}/disable'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,704 |
ibm_platform_services.iam_identity_v1
|
get_account_settings
|
Get account configurations.
Returns the details of an account's configuration.
:param str account_id: Unique ID of the account.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsResponse` object
|
def get_account_settings(
self,
account_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get account configurations.
Returns the details of an account's configuration.
:param str account_id: Unique ID of the account.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsResponse` 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_settings',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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 = '/v1/accounts/{account_id}/settings/identity'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, *, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,705 |
ibm_platform_services.iam_identity_v1
|
get_account_settings_assignment
|
Get assignment.
Get an assigment for an account settings template.
:param str assignment_id: ID of the Assignment Record.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentResponse` object
|
def get_account_settings_assignment(
self,
assignment_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get assignment.
Get an assigment for an account settings template.
:param str assignment_id: ID of the Assignment Record.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_account_settings_assignment',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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/account_settings_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, *, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,706 |
ibm_platform_services.iam_identity_v1
|
get_account_settings_template_version
|
Get version of an account settings template.
Get a specific version of an account settings template in an Enterprise Account.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
|
def get_account_settings_template_version(
self,
template_id: str,
version: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get version of an account settings template.
Get a specific version of an account settings template in an Enterprise Account.
:param str template_id: ID of the account settings template.
:param str version: Version of the account settings template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_account_settings_template_version',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/account_settings_templates/{template_id}/versions/{version}'.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: str, *, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,707 |
ibm_platform_services.iam_identity_v1
|
get_api_key
|
Get details of an API key.
Returns the details of an API key. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. In case of service IDs and their API keys, a user must be either an account
owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage
service IDs of the entity.
:param str id: Unique ID of the API key.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
|
def get_api_key(
self,
id: str,
*,
include_history: Optional[bool] = None,
include_activity: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get details of an API key.
Returns the details of an API key. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. In case of service IDs and their API keys, a user must be either an account
owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage
service IDs of the entity.
:param str id: Unique ID of the API key.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_api_key',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
'include_activity': include_activity,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, *, include_history: Optional[bool] = None, include_activity: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,708 |
ibm_platform_services.iam_identity_v1
|
get_api_keys_details
|
Get details of an API key by its value.
Returns the details of an API key by its value. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str iam_api_key: (optional) API key value.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
|
def get_api_keys_details(
self,
*,
iam_api_key: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get details of an API key by its value.
Returns the details of an API key by its value. Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str iam_api_key: (optional) API key value.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
"""
headers = {
'IAM-ApiKey': iam_api_key,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_api_keys_details',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/apikeys/details'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, *, iam_api_key: Optional[str] = None, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,710 |
ibm_platform_services.iam_identity_v1
|
get_claim_rule
|
Get a claim rule for a trusted profile.
A specific claim rule can be fetched for a given trusted profile ID and rule ID.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to get.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
|
def get_claim_rule(
self,
profile_id: str,
rule_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get a claim rule for a trusted profile.
A specific claim rule can be fetched for a given trusted profile ID and rule ID.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to get.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not rule_id:
raise ValueError('rule_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_claim_rule',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id', 'rule-id']
path_param_values = self.encode_path_vars(profile_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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, profile_id: str, rule_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,713 |
ibm_platform_services.iam_identity_v1
|
get_latest_account_settings_template_version
|
Get latest version of an account settings template.
Get the latest version of a specific account settings template in an enterprise
account.
:param str template_id: ID of the account settings template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
|
def get_latest_account_settings_template_version(
self,
template_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get latest version of an account settings template.
Get the latest version of a specific account settings template in an enterprise
account.
:param str template_id: ID of the account settings template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` 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='V1',
operation_id='get_latest_account_settings_template_version',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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/account_settings_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, *, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,714 |
ibm_platform_services.iam_identity_v1
|
get_latest_profile_template_version
|
Get latest version of a trusted profile template.
Get the latest version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
|
def get_latest_profile_template_version(
self,
template_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get latest version of a trusted profile template.
Get the latest version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` 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='V1',
operation_id='get_latest_profile_template_version',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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/profile_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, *, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,715 |
ibm_platform_services.iam_identity_v1
|
get_link
|
Get link to a trusted profile.
Get a specific link to a trusted profile by `link_id`.
:param str profile_id: ID of the trusted profile.
:param str link_id: ID of the link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLink` object
|
def get_link(
self,
profile_id: str,
link_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get link to a trusted profile.
Get a specific link to a trusted profile by `link_id`.
:param str profile_id: ID of the trusted profile.
:param str link_id: ID of the link.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLink` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not link_id:
raise ValueError('link_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_link',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id', 'link-id']
path_param_values = self.encode_path_vars(profile_id, link_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/links/{link-id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, link_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,716 |
ibm_platform_services.iam_identity_v1
|
get_mfa_report
|
Get MFA enrollment status report for the account.
Get MFA enrollment status report for the account by specifying the account ID and
the reference that is generated by triggering the report. Reports older than a day
are deleted when generating a new report.
:param str account_id: ID of the account.
:param str reference: Reference for the report to be generated, You can use
'latest' to get the latest report for the given 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 `ReportMfaEnrollmentStatus` object
|
def get_mfa_report(
self,
account_id: str,
reference: str,
**kwargs,
) -> DetailedResponse:
"""
Get MFA enrollment status report for the account.
Get MFA enrollment status report for the account by specifying the account ID and
the reference that is generated by triggering the report. Reports older than a day
are deleted when generating a new report.
:param str account_id: ID of the account.
:param str reference: Reference for the report to be generated, You can use
'latest' to get the latest report for the given 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 `ReportMfaEnrollmentStatus` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not reference:
raise ValueError('reference must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_mfa_report',
)
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', 'reference']
path_param_values = self.encode_path_vars(account_id, reference)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/mfa/accounts/{account_id}/report/{reference}'.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, reference: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,717 |
ibm_platform_services.iam_identity_v1
|
get_mfa_status
|
Get MFA enrollment status for a single user in the account.
Get MFA enrollment status for a single user in the account.
:param str account_id: ID of the account.
:param str iam_id: iam_id of the user. This user must be the member of the
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 `UserMfaEnrollments` object
|
def get_mfa_status(
self,
account_id: str,
iam_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get MFA enrollment status for a single user in the account.
Get MFA enrollment status for a single user in the account.
:param str account_id: ID of the account.
:param str iam_id: iam_id of the user. This user must be the member of the
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 `UserMfaEnrollments` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not iam_id:
raise ValueError('iam_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_mfa_status',
)
headers.update(sdk_headers)
params = {
'iam_id': iam_id,
}
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 = '/v1/mfa/accounts/{account_id}/status'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, iam_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,718 |
ibm_platform_services.iam_identity_v1
|
get_profile
|
Get a trusted profile.
Retrieve a trusted profile by its `profile-id`. Only the trusted profile's data is
returned (`name`, `description`, `iam_id`, etc.), not the federated users or
compute resources that qualify to apply the trusted profile.
:param str profile_id: ID of the trusted profile to get.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
|
def get_profile(
self,
profile_id: str,
*,
include_activity: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get a trusted profile.
Retrieve a trusted profile by its `profile-id`. Only the trusted profile's data is
returned (`name`, `description`, `iam_id`, etc.), not the federated users or
compute resources that qualify to apply the trusted profile.
:param str profile_id: ID of the trusted profile to get.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_profile',
)
headers.update(sdk_headers)
params = {
'include_activity': include_activity,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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, profile_id: str, *, include_activity: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,719 |
ibm_platform_services.iam_identity_v1
|
get_profile_identities
|
Get a list of identities that can assume the trusted profile.
Get a list of identities that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentitiesResponse` object
|
def get_profile_identities(
self,
profile_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get a list of identities that can assume the trusted profile.
Get a list of identities that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentitiesResponse` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_profile_identities',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,720 |
ibm_platform_services.iam_identity_v1
|
get_profile_identity
|
Get the identity that can assume the trusted profile.
Get the identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier_id: Identifier of the identity that can assume the
trusted profiles.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentityResponse` object
|
def get_profile_identity(
self,
profile_id: str,
identity_type: str,
identifier_id: str,
**kwargs,
) -> DetailedResponse:
"""
Get the identity that can assume the trusted profile.
Get the identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier_id: Identifier of the identity that can assume the
trusted profiles.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentityResponse` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not identity_type:
raise ValueError('identity_type must be provided')
if not identifier_id:
raise ValueError('identifier_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_profile_identity',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id', 'identity-type', 'identifier-id']
path_param_values = self.encode_path_vars(profile_id, identity_type, identifier_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities/{identity-type}/{identifier-id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, identity_type: str, identifier_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,721 |
ibm_platform_services.iam_identity_v1
|
get_profile_template_version
|
Get version of trusted profile template.
Get a specific version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
|
def get_profile_template_version(
self,
template_id: str,
version: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get version of trusted profile template.
Get a specific version of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
"""
if not template_id:
raise ValueError('template_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_profile_template_version',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['template_id', 'version']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profile_templates/{template_id}/versions/{version}'.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: str, *, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,722 |
ibm_platform_services.iam_identity_v1
|
get_report
|
Get activity report for the account.
Get activity report for the account by specifying the account ID and the reference
that is generated by triggering the report. Reports older than a day are deleted
when generating a new report.
:param str account_id: ID of the account.
:param str reference: Reference for the report to be generated, You can use
'latest' to get the latest report for the given 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 `Report` object
|
def get_report(
self,
account_id: str,
reference: str,
**kwargs,
) -> DetailedResponse:
"""
Get activity report for the account.
Get activity report for the account by specifying the account ID and the reference
that is generated by triggering the report. Reports older than a day are deleted
when generating a new report.
:param str account_id: ID of the account.
:param str reference: Reference for the report to be generated, You can use
'latest' to get the latest report for the given 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 `Report` object
"""
if not account_id:
raise ValueError('account_id must be provided')
if not reference:
raise ValueError('reference must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_report',
)
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', 'reference']
path_param_values = self.encode_path_vars(account_id, reference)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/activity/accounts/{account_id}/report/{reference}'.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, reference: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,723 |
ibm_platform_services.iam_identity_v1
|
get_service_id
|
Get details of a service ID.
Returns the details of a service ID. Users can manage user API keys for themself,
or service ID API keys for service IDs that are bound to an entity they have
access to. Note: apikey details are only included in the response when creating a
Service ID with an api key.
:param str id: Unique ID of the service ID.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceId` object
|
def get_service_id(
self,
id: str,
*,
include_history: Optional[bool] = None,
include_activity: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get details of a service ID.
Returns the details of a service ID. Users can manage user API keys for themself,
or service ID API keys for service IDs that are bound to an entity they have
access to. Note: apikey details are only included in the response when creating a
Service ID with an api key.
:param str id: Unique ID of the service ID.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param bool include_activity: (optional) Defines if the entity's activity
is included in the response. Retrieving activity data is an expensive
operation, so only request this when needed.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceId` object
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_service_id',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
'include_activity': include_activity,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, *, include_history: Optional[bool] = None, include_activity: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,724 |
ibm_platform_services.iam_identity_v1
|
get_trusted_profile_assignment
|
Get assignment.
Get an assigment for a trusted profile template.
:param str assignment_id: ID of the Assignment Record.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentResponse` object
|
def get_trusted_profile_assignment(
self,
assignment_id: str,
*,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get assignment.
Get an assigment for a trusted profile template.
:param str assignment_id: ID of the Assignment Record.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_trusted_profile_assignment',
)
headers.update(sdk_headers)
params = {
'include_history': include_history,
}
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/profile_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, *, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,725 |
ibm_platform_services.iam_identity_v1
|
list_account_settings_assignments
|
List assignments.
List account settings assignments.
:param str account_id: (optional) Account ID of the Assignments to query.
This parameter is required unless using a pagetoken.
:param str template_id: (optional) Filter results by Template Id.
:param str template_version: (optional) Filter results Template Version.
:param str target: (optional) Filter results by the assignment target.
:param str target_type: (optional) Filter results by the assignment's
target type.
:param int limit: (optional) Optional size of a single page. Default is 20
items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) If specified, the items are sorted by the value
of this property.
:param str order: (optional) Sort order.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentListResponse` object
|
def list_account_settings_assignments(
self,
*,
account_id: Optional[str] = None,
template_id: Optional[str] = None,
template_version: Optional[str] = None,
target: Optional[str] = None,
target_type: Optional[str] = None,
limit: Optional[int] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List assignments.
List account settings assignments.
:param str account_id: (optional) Account ID of the Assignments to query.
This parameter is required unless using a pagetoken.
:param str template_id: (optional) Filter results by Template Id.
:param str template_version: (optional) Filter results Template Version.
:param str target: (optional) Filter results by the assignment target.
:param str target_type: (optional) Filter results by the assignment's
target type.
:param int limit: (optional) Optional size of a single page. Default is 20
items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) If specified, the items are sorted by the value
of this property.
:param str order: (optional) Sort order.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentListResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_account_settings_assignments',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'template_id': template_id,
'template_version': template_version,
'target': target,
'target_type': target_type,
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/account_settings_assignments/'
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, template_id: Optional[str] = None, template_version: Optional[str] = None, target: Optional[str] = None, target_type: Optional[str] = None, limit: Optional[int] = None, pagetoken: Optional[str] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,726 |
ibm_platform_services.iam_identity_v1
|
list_account_settings_templates
|
List account settings templates.
List account settings templates in an enterprise account.
:param str account_id: (optional) Account ID of the account settings
templates to query. This parameter is required unless using a pagetoken.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateList` object
|
def list_account_settings_templates(
self,
*,
account_id: Optional[str] = None,
limit: Optional[str] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List account settings templates.
List account settings templates in an enterprise account.
:param str account_id: (optional) Account ID of the account settings
templates to query. This parameter is required unless using a pagetoken.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_account_settings_templates',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/account_settings_templates'
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, limit: Optional[str] = None, pagetoken: Optional[str] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,727 |
ibm_platform_services.iam_identity_v1
|
list_api_keys
|
Get API keys for a given service or user IAM ID and account ID.
Returns the list of API key details for a given service or user IAM ID and account
ID. Users can manage user API keys for themself, or service ID API keys for
service IDs that are bound to an entity they have access to. In case of service
IDs and their API keys, a user must be either an account owner, a IBM Cloud org
manager or IBM Cloud space developer in order to manage service IDs of the entity.
:param str account_id: (optional) Account ID of the API keys 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: (optional) IAM ID of the API keys to be queried. The IAM
ID may be that of a user or a service. For a user IAM ID iam_id must match
the Authorization token.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str scope: (optional) Optional parameter to define the scope of the
queried API keys. Can be 'entity' (default) or 'account'.
:param str type: (optional) Optional parameter to filter the type of the
queried API keys. Can be 'user' or 'serviceid'.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and created_by. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKeyList` object
|
def list_api_keys(
self,
*,
account_id: Optional[str] = None,
iam_id: Optional[str] = None,
pagesize: Optional[int] = None,
pagetoken: Optional[str] = None,
scope: Optional[str] = None,
type: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Get API keys for a given service or user IAM ID and account ID.
Returns the list of API key details for a given service or user IAM ID and account
ID. Users can manage user API keys for themself, or service ID API keys for
service IDs that are bound to an entity they have access to. In case of service
IDs and their API keys, a user must be either an account owner, a IBM Cloud org
manager or IBM Cloud space developer in order to manage service IDs of the entity.
:param str account_id: (optional) Account ID of the API keys 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: (optional) IAM ID of the API keys to be queried. The IAM
ID may be that of a user or a service. For a user IAM ID iam_id must match
the Authorization token.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str scope: (optional) Optional parameter to define the scope of the
queried API keys. Can be 'entity' (default) or 'account'.
:param str type: (optional) Optional parameter to filter the type of the
queried API keys. Can be 'user' or 'serviceid'.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and created_by. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKeyList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_api_keys',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'iam_id': iam_id,
'pagesize': pagesize,
'pagetoken': pagetoken,
'scope': scope,
'type': type,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/apikeys'
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, iam_id: Optional[str] = None, pagesize: Optional[int] = None, pagetoken: Optional[str] = None, scope: Optional[str] = None, type: Optional[str] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,728 |
ibm_platform_services.iam_identity_v1
|
list_claim_rules
|
List claim rules for a trusted profile.
Get a list of all claim rules for a trusted profile. The `profile-id` query
parameter determines the profile from which to retrieve the list of claim rules.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRuleList` object
|
def list_claim_rules(
self,
profile_id: str,
**kwargs,
) -> DetailedResponse:
"""
List claim rules for a trusted profile.
Get a list of all claim rules for a trusted profile. The `profile-id` query
parameter determines the profile from which to retrieve the list of claim rules.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRuleList` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_claim_rules',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/rules'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,729 |
ibm_platform_services.iam_identity_v1
|
list_links
|
List links to a trusted profile.
Get a list of links to a trusted profile.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLinkList` object
|
def list_links(
self,
profile_id: str,
**kwargs,
) -> DetailedResponse:
"""
List links to a trusted profile.
Get a list of links to a trusted profile.
:param str profile_id: ID of the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileLinkList` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_links',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/links'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,730 |
ibm_platform_services.iam_identity_v1
|
list_profile_templates
|
List trusted profile templates.
List the trusted profile templates in an enterprise account.
:param str account_id: (optional) Account ID of the trusted profile
templates to query. This parameter is required unless using a pagetoken.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templates are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateList` object
|
def list_profile_templates(
self,
*,
account_id: Optional[str] = None,
limit: Optional[str] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List trusted profile templates.
List the trusted profile templates in an enterprise account.
:param str account_id: (optional) Account ID of the trusted profile
templates to query. This parameter is required unless using a pagetoken.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templates are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_profile_templates',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/profile_templates'
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, limit: Optional[str] = None, pagetoken: Optional[str] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,731 |
ibm_platform_services.iam_identity_v1
|
list_profiles
|
List trusted profiles.
List the trusted profiles in an account. The `account_id` query parameter
determines the account from which to retrieve the list of trusted profiles.
:param str account_id: Account ID to query for trusted profiles.
:param str name: (optional) Name of the trusted profile to query.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and modified_at. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfilesList` object
|
def list_profiles(
self,
account_id: str,
*,
name: Optional[str] = None,
pagesize: Optional[int] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
pagetoken: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List trusted profiles.
List the trusted profiles in an account. The `account_id` query parameter
determines the account from which to retrieve the list of trusted profiles.
:param str account_id: Account ID to query for trusted profiles.
:param str name: (optional) Name of the trusted profile to query.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and modified_at. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfilesList` 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='list_profiles',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'name': name,
'pagesize': pagesize,
'sort': sort,
'order': order,
'include_history': include_history,
'pagetoken': pagetoken,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/profiles'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
|
(self, account_id: str, *, name: Optional[str] = None, pagesize: Optional[int] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[bool] = None, pagetoken: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,732 |
ibm_platform_services.iam_identity_v1
|
list_service_ids
|
List service IDs.
Returns a list of service IDs. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. Note: apikey details are only included in the response when creating a Service
ID with an api key.
:param str account_id: (optional) Account ID of the service ID(s) to query.
This parameter is required (unless using a pagetoken).
:param str name: (optional) Name of the service ID(s) to query. Optional.20
items per page. Valid range is 1 to 100.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and modified_at. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceIdList` object
|
def list_service_ids(
self,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
pagesize: Optional[int] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List service IDs.
Returns a list of service IDs. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. Note: apikey details are only included in the response when creating a Service
ID with an api key.
:param str account_id: (optional) Account ID of the service ID(s) to query.
This parameter is required (unless using a pagetoken).
:param str name: (optional) Name of the service ID(s) to query. Optional.20
items per page. Valid range is 1 to 100.
:param int pagesize: (optional) Optional size of a single page. Default is
20 items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property, valid values are name,
description, created_at and modified_at. If specified, the items are sorted
by the value of this property.
:param str order: (optional) Optional sort order, valid values are asc and
desc. Default: asc.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ServiceIdList` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_service_ids',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'name': name,
'pagesize': pagesize,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/serviceids/'
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, name: Optional[str] = None, pagesize: Optional[int] = None, pagetoken: Optional[str] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,733 |
ibm_platform_services.iam_identity_v1
|
list_trusted_profile_assignments
|
List assignments.
List trusted profile template assignments.
:param str account_id: (optional) Account ID of the Assignments to query.
This parameter is required unless using a pagetoken.
:param str template_id: (optional) Filter results by Template Id.
:param str template_version: (optional) Filter results Template Version.
:param str target: (optional) Filter results by the assignment target.
:param str target_type: (optional) Filter results by the assignment's
target type.
:param int limit: (optional) Optional size of a single page. Default is 20
items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) If specified, the items are sorted by the value
of this property.
:param str order: (optional) Sort order.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentListResponse` object
|
def list_trusted_profile_assignments(
self,
*,
account_id: Optional[str] = None,
template_id: Optional[str] = None,
template_version: Optional[str] = None,
target: Optional[str] = None,
target_type: Optional[str] = None,
limit: Optional[int] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
List assignments.
List trusted profile template assignments.
:param str account_id: (optional) Account ID of the Assignments to query.
This parameter is required unless using a pagetoken.
:param str template_id: (optional) Filter results by Template Id.
:param str template_version: (optional) Filter results Template Version.
:param str target: (optional) Filter results by the assignment target.
:param str target_type: (optional) Filter results by the assignment's
target type.
:param int limit: (optional) Optional size of a single page. Default is 20
items per page. Valid range is 1 to 100.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) If specified, the items are sorted by the value
of this property.
:param str order: (optional) Sort order.
:param bool include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TemplateAssignmentListResponse` object
"""
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_trusted_profile_assignments',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'template_id': template_id,
'template_version': template_version,
'target': target,
'target_type': target_type,
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/profile_assignments/'
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, template_id: Optional[str] = None, template_version: Optional[str] = None, target: Optional[str] = None, target_type: Optional[str] = None, limit: Optional[int] = None, pagetoken: Optional[str] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,734 |
ibm_platform_services.iam_identity_v1
|
list_versions_of_account_settings_template
|
List account settings template versions.
List the versions of a specific account settings template in an enterprise
account.
:param str template_id: ID of the account settings template.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateList` object
|
def list_versions_of_account_settings_template(
self,
template_id: str,
*,
limit: Optional[str] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List account settings template versions.
List the versions of a specific account settings template in an enterprise
account.
:param str template_id: ID of the account settings template.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateList` 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='V1',
operation_id='list_versions_of_account_settings_template',
)
headers.update(sdk_headers)
params = {
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
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/account_settings_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
|
(self, template_id: str, *, limit: Optional[str] = None, pagetoken: Optional[str] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,735 |
ibm_platform_services.iam_identity_v1
|
list_versions_of_profile_template
|
List trusted profile template versions.
List the versions of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateList` object
|
def list_versions_of_profile_template(
self,
template_id: str,
*,
limit: Optional[str] = None,
pagetoken: Optional[str] = None,
sort: Optional[str] = None,
order: Optional[str] = None,
include_history: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List trusted profile template versions.
List the versions of a trusted profile template in an enterprise account.
:param str template_id: ID of the trusted profile template.
:param str limit: (optional) Optional size of a single page.
:param str pagetoken: (optional) Optional Prev or Next page token returned
from a previous query execution. Default is start with first page.
:param str sort: (optional) Optional sort property. If specified, the
returned templated are sorted according to this property.
:param str order: (optional) Optional sort order.
:param str include_history: (optional) Defines if the entity history is
included in the response.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateList` 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='V1',
operation_id='list_versions_of_profile_template',
)
headers.update(sdk_headers)
params = {
'limit': limit,
'pagetoken': pagetoken,
'sort': sort,
'order': order,
'include_history': include_history,
}
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/profile_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
|
(self, template_id: str, *, limit: Optional[str] = None, pagetoken: Optional[str] = None, sort: Optional[str] = None, order: Optional[str] = None, include_history: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,736 |
ibm_platform_services.iam_identity_v1
|
lock_api_key
|
Lock the API key.
Locks an API key by ID. Users can manage user API keys for themself, or service ID
API keys for service IDs that are bound to an entity they have access to. In case
of service IDs and their API keys, a user must be either an account owner, a IBM
Cloud org manager or IBM Cloud space developer in order to manage service IDs of
the entity.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def lock_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Lock the API key.
Locks an API key by ID. Users can manage user API keys for themself, or service ID
API keys for service IDs that are bound to an entity they have access to. In case
of service IDs and their API keys, a user must be either an account owner, a IBM
Cloud org manager or IBM Cloud space developer in order to manage service IDs of
the entity.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='lock_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}/lock'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,737 |
ibm_platform_services.iam_identity_v1
|
lock_service_id
|
Lock the service ID.
Locks a service ID by ID. Users can manage user API keys for themself, or service
ID API keys for service IDs that are bound to an entity they have access to. In
case of service IDs and their API keys, a user must be either an account owner, a
IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs
of the entity.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def lock_service_id(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Lock the service ID.
Locks a service ID by ID. Users can manage user API keys for themself, or service
ID API keys for service IDs that are bound to an entity they have access to. In
case of service IDs and their API keys, a user must be either an account owner, a
IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs
of the entity.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='lock_service_id',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}/lock'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,745 |
ibm_platform_services.iam_identity_v1
|
set_profile_identities
|
Update the list of identities that can assume the trusted profile.
Update the list of identities that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str if_match: Entity tag of the Identities to be updated. Specify
the tag that you retrieved when reading the Profile Identities. This value
helps identify parallel usage of this API. Pass * to indicate updating any
available version, which may result in stale updates.
:param List[ProfileIdentityRequest] identities: (optional) List of
identities that can assume the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentitiesResponse` object
|
def set_profile_identities(
self,
profile_id: str,
if_match: str,
*,
identities: Optional[List['ProfileIdentityRequest']] = None,
**kwargs,
) -> DetailedResponse:
"""
Update the list of identities that can assume the trusted profile.
Update the list of identities that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str if_match: Entity tag of the Identities to be updated. Specify
the tag that you retrieved when reading the Profile Identities. This value
helps identify parallel usage of this API. Pass * to indicate updating any
available version, which may result in stale updates.
:param List[ProfileIdentityRequest] identities: (optional) List of
identities that can assume the trusted profile.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentitiesResponse` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if identities is not None:
identities = [convert_model(x) for x in identities]
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='set_profile_identities',
)
headers.update(sdk_headers)
data = {
'identities': identities,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, if_match: str, *, identities: Optional[List[ibm_platform_services.iam_identity_v1.ProfileIdentityRequest]] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,746 |
ibm_platform_services.iam_identity_v1
|
set_profile_identity
|
Add a specific identity that can assume the trusted profile.
Add a specific identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier: Identifier of the identity that can assume the
trusted profiles. This can be a user identifier (IAM id), serviceid or crn.
Internally it uses account id of the service id for the identifier
'serviceid' and for the identifier 'crn' it uses account id contained in
the CRN.
:param str type: Type of the identity.
:param List[str] accounts: (optional) Only valid for the type user.
Accounts from which a user can assume the trusted profile.
:param str description: (optional) Description of the identity that can
assume the trusted profile. This is optional field for all the types of
identities. When this field is not set for the identity type 'serviceid'
then the description of the service id is used. Description is recommended
for the identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service
project'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentityResponse` object
|
def set_profile_identity(
self,
profile_id: str,
identity_type: str,
identifier: str,
type: str,
*,
accounts: Optional[List[str]] = None,
description: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Add a specific identity that can assume the trusted profile.
Add a specific identity that can assume the trusted profile.
:param str profile_id: ID of the trusted profile.
:param str identity_type: Type of the identity.
:param str identifier: Identifier of the identity that can assume the
trusted profiles. This can be a user identifier (IAM id), serviceid or crn.
Internally it uses account id of the service id for the identifier
'serviceid' and for the identifier 'crn' it uses account id contained in
the CRN.
:param str type: Type of the identity.
:param List[str] accounts: (optional) Only valid for the type user.
Accounts from which a user can assume the trusted profile.
:param str description: (optional) Description of the identity that can
assume the trusted profile. This is optional field for all the types of
identities. When this field is not set for the identity type 'serviceid'
then the description of the service id is used. Description is recommended
for the identity type 'crn' E.g. 'Instance 1234 of IBM Cloud Service
project'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileIdentityResponse` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not identity_type:
raise ValueError('identity_type must be provided')
if identifier is None:
raise ValueError('identifier must be provided')
if type is None:
raise ValueError('type must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='set_profile_identity',
)
headers.update(sdk_headers)
data = {
'identifier': identifier,
'type': type,
'accounts': accounts,
'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 = ['profile-id', 'identity-type']
path_param_values = self.encode_path_vars(profile_id, identity_type)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-id}/identities/{identity-type}'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, profile_id: str, identity_type: str, identifier: str, type: str, *, accounts: Optional[List[str]] = None, description: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,748 |
ibm_platform_services.iam_identity_v1
|
unlock_api_key
|
Unlock the API key.
Unlocks an API key by ID. Users can manage user API keys for themself, or service
ID API keys for service IDs that are bound to an entity they have access to. In
case of service IDs and their API keys, a user must be either an account owner, a
IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs
of the entity.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def unlock_api_key(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Unlock the API key.
Unlocks an API key by ID. Users can manage user API keys for themself, or service
ID API keys for service IDs that are bound to an entity they have access to. In
case of service IDs and their API keys, a user must be either an account owner, a
IBM Cloud org manager or IBM Cloud space developer in order to manage service IDs
of the entity.
:param str id: Unique ID of the API key.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='unlock_api_key',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}/lock'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,749 |
ibm_platform_services.iam_identity_v1
|
unlock_service_id
|
Unlock the service ID.
Unlocks a service ID by ID. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. In case of service IDs and their API keys, a user must be either an account
owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage
service IDs of the entity.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def unlock_service_id(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Unlock the service ID.
Unlocks a service ID by ID. Users can manage user API keys for themself, or
service ID API keys for service IDs that are bound to an entity they have access
to. In case of service IDs and their API keys, a user must be either an account
owner, a IBM Cloud org manager or IBM Cloud space developer in order to manage
service IDs of the entity.
:param str id: Unique ID of the service ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='unlock_service_id',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}/lock'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,750 |
ibm_platform_services.iam_identity_v1
|
update_account_settings
|
Update account configurations.
Allows a user to configure settings on their account with regards to MFA, MFA
excemption list, session lifetimes, access control for creating new identities,
and enforcing IP restrictions on token creation.
:param str if_match: Version of the account settings to be updated. Specify
the version that you retrieved as entity_tag (ETag header) when reading the
account. 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 account_id: The id of the account to update the settings for.
:param str restrict_create_service_id: (optional) Defines whether or not
creating a service ID is access controlled. Valid values:
* RESTRICTED - only users assigned the 'Service ID creator' role on the
IAM Identity Service can create service IDs, including the account owner
* NOT_RESTRICTED - all members of an account can create service IDs
* NOT_SET - to 'unset' a previous set value.
:param str restrict_create_platform_apikey: (optional) Defines whether or
not creating platform API keys is access controlled. Valid values:
* RESTRICTED - only users assigned the 'User API key creator' role on the
IAM Identity Service can create API keys, including the account owner
* NOT_RESTRICTED - all members of an account can create platform API keys
* NOT_SET - to 'unset' a previous set value.
:param str allowed_ip_addresses: (optional) Defines the IP addresses and
subnets from which IAM tokens can be created for the account.
:param str mfa: (optional) Defines the MFA trait for the account. Valid
values:
* NONE - No MFA trait set
* NONE_NO_ROPC- No MFA, disable CLI logins with only a password
* TOTP - For all non-federated IBMId users
* TOTP4ALL - For all users
* LEVEL1 - Email-based MFA for all users
* LEVEL2 - TOTP-based MFA for all users
* LEVEL3 - U2F MFA for all users.
:param List[AccountSettingsUserMFA] user_mfa: (optional) List of users that
are exempted from the MFA requirement of the account.
:param str session_expiration_in_seconds: (optional) Defines the session
expiration in seconds for the account. Valid values:
* Any whole number between between '900' and '86400'
* NOT_SET - To unset account setting and use service default.
:param str session_invalidation_in_seconds: (optional) Defines the period
of time in seconds in which a session will be invalidated due to
inactivity. Valid values:
* Any whole number between '900' and '7200'
* NOT_SET - To unset account setting and use service default.
:param str max_sessions_per_identity: (optional) Defines the max allowed
sessions per identity required by the account. Value values:
* Any whole number greater than 0
* NOT_SET - To unset account setting and use service default.
:param str system_access_token_expiration_in_seconds: (optional) Defines
the access token expiration in seconds. Valid values:
* Any whole number between '900' and '3600'
* NOT_SET - To unset account setting and use service default.
:param str system_refresh_token_expiration_in_seconds: (optional) Defines
the refresh token expiration in seconds. Valid values:
* Any whole number between '900' and '259200'
* NOT_SET - To unset account setting and use service default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsResponse` object
|
def update_account_settings(
self,
if_match: str,
account_id: str,
*,
restrict_create_service_id: Optional[str] = None,
restrict_create_platform_apikey: Optional[str] = None,
allowed_ip_addresses: Optional[str] = None,
mfa: Optional[str] = None,
user_mfa: Optional[List['AccountSettingsUserMFA']] = None,
session_expiration_in_seconds: Optional[str] = None,
session_invalidation_in_seconds: Optional[str] = None,
max_sessions_per_identity: Optional[str] = None,
system_access_token_expiration_in_seconds: Optional[str] = None,
system_refresh_token_expiration_in_seconds: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update account configurations.
Allows a user to configure settings on their account with regards to MFA, MFA
excemption list, session lifetimes, access control for creating new identities,
and enforcing IP restrictions on token creation.
:param str if_match: Version of the account settings to be updated. Specify
the version that you retrieved as entity_tag (ETag header) when reading the
account. 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 account_id: The id of the account to update the settings for.
:param str restrict_create_service_id: (optional) Defines whether or not
creating a service ID is access controlled. Valid values:
* RESTRICTED - only users assigned the 'Service ID creator' role on the
IAM Identity Service can create service IDs, including the account owner
* NOT_RESTRICTED - all members of an account can create service IDs
* NOT_SET - to 'unset' a previous set value.
:param str restrict_create_platform_apikey: (optional) Defines whether or
not creating platform API keys is access controlled. Valid values:
* RESTRICTED - only users assigned the 'User API key creator' role on the
IAM Identity Service can create API keys, including the account owner
* NOT_RESTRICTED - all members of an account can create platform API keys
* NOT_SET - to 'unset' a previous set value.
:param str allowed_ip_addresses: (optional) Defines the IP addresses and
subnets from which IAM tokens can be created for the account.
:param str mfa: (optional) Defines the MFA trait for the account. Valid
values:
* NONE - No MFA trait set
* NONE_NO_ROPC- No MFA, disable CLI logins with only a password
* TOTP - For all non-federated IBMId users
* TOTP4ALL - For all users
* LEVEL1 - Email-based MFA for all users
* LEVEL2 - TOTP-based MFA for all users
* LEVEL3 - U2F MFA for all users.
:param List[AccountSettingsUserMFA] user_mfa: (optional) List of users that
are exempted from the MFA requirement of the account.
:param str session_expiration_in_seconds: (optional) Defines the session
expiration in seconds for the account. Valid values:
* Any whole number between between '900' and '86400'
* NOT_SET - To unset account setting and use service default.
:param str session_invalidation_in_seconds: (optional) Defines the period
of time in seconds in which a session will be invalidated due to
inactivity. Valid values:
* Any whole number between '900' and '7200'
* NOT_SET - To unset account setting and use service default.
:param str max_sessions_per_identity: (optional) Defines the max allowed
sessions per identity required by the account. Value values:
* Any whole number greater than 0
* NOT_SET - To unset account setting and use service default.
:param str system_access_token_expiration_in_seconds: (optional) Defines
the access token expiration in seconds. Valid values:
* Any whole number between '900' and '3600'
* NOT_SET - To unset account setting and use service default.
:param str system_refresh_token_expiration_in_seconds: (optional) Defines
the refresh token expiration in seconds. Valid values:
* Any whole number between '900' and '259200'
* NOT_SET - To unset account setting and use service default.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsResponse` object
"""
if not if_match:
raise ValueError('if_match must be provided')
if not account_id:
raise ValueError('account_id must be provided')
if user_mfa is not None:
user_mfa = [convert_model(x) for x in user_mfa]
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_account_settings',
)
headers.update(sdk_headers)
data = {
'restrict_create_service_id': restrict_create_service_id,
'restrict_create_platform_apikey': restrict_create_platform_apikey,
'allowed_ip_addresses': allowed_ip_addresses,
'mfa': mfa,
'user_mfa': user_mfa,
'session_expiration_in_seconds': session_expiration_in_seconds,
'session_invalidation_in_seconds': session_invalidation_in_seconds,
'max_sessions_per_identity': max_sessions_per_identity,
'system_access_token_expiration_in_seconds': system_access_token_expiration_in_seconds,
'system_refresh_token_expiration_in_seconds': system_refresh_token_expiration_in_seconds,
}
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 = ['account_id']
path_param_values = self.encode_path_vars(account_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/accounts/{account_id}/settings/identity'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, if_match: str, account_id: str, *, restrict_create_service_id: Optional[str] = None, restrict_create_platform_apikey: Optional[str] = None, allowed_ip_addresses: Optional[str] = None, mfa: Optional[str] = None, user_mfa: Optional[List[ibm_platform_services.iam_identity_v1.AccountSettingsUserMFA]] = None, session_expiration_in_seconds: Optional[str] = None, session_invalidation_in_seconds: Optional[str] = None, max_sessions_per_identity: Optional[str] = None, system_access_token_expiration_in_seconds: Optional[str] = None, system_refresh_token_expiration_in_seconds: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,751 |
ibm_platform_services.iam_identity_v1
|
update_account_settings_assignment
|
Update assignment.
Update an account settings assignment. Call this method to retry failed
assignments or migrate the settings in child accounts to a new version.
: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 int template_version: Template version to be applied to the
assignment. To retry all failed assignments, provide the existing version.
To migrate to a different version, provide the new version number.
:param dict headers: 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 update_account_settings_assignment(
self,
assignment_id: str,
if_match: str,
template_version: int,
**kwargs,
) -> DetailedResponse:
"""
Update assignment.
Update an account settings assignment. Call this method to retry failed
assignments or migrate the settings in child accounts to a new version.
: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 int template_version: Template version to be applied to the
assignment. To retry all failed assignments, provide the existing version.
To migrate to a different version, provide the new version number.
:param dict headers: 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 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='V1',
operation_id='update_account_settings_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/account_settings_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
|
(self, assignment_id: str, if_match: str, template_version: int, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,752 |
ibm_platform_services.iam_identity_v1
|
update_account_settings_template_version
|
Update version of an account settings template.
Update a specific version of an account settings template in an Enterprise
Account.
:param str if_match: Entity tag of the Template to be updated. Specify the
tag that you retrieved when reading the account settings template. 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_id: ID of the account settings template.
:param str version: Version of the account settings template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
|
def update_account_settings_template_version(
self,
if_match: str,
template_id: str,
version: str,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
account_settings: Optional['AccountSettingsComponent'] = None,
**kwargs,
) -> DetailedResponse:
"""
Update version of an account settings template.
Update a specific version of an account settings template in an Enterprise
Account.
:param str if_match: Entity tag of the Template to be updated. Specify the
tag that you retrieved when reading the account settings template. 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_id: ID of the account settings template.
:param str version: Version of the account settings template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param AccountSettingsComponent account_settings: (optional)
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `AccountSettingsTemplateResponse` object
"""
if not if_match:
raise ValueError('if_match must be provided')
if not template_id:
raise ValueError('template_id must be provided')
if not version:
raise ValueError('version must be provided')
if account_settings is not None:
account_settings = convert_model(account_settings)
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_account_settings_template_version',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'account_settings': account_settings,
}
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']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/account_settings_templates/{template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, if_match: str, template_id: str, version: str, *, account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, account_settings: Optional[ibm_platform_services.iam_identity_v1.AccountSettingsComponent] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,753 |
ibm_platform_services.iam_identity_v1
|
update_api_key
|
Updates an API key.
Updates properties of an API key. This does NOT affect existing access tokens.
Their token content will stay unchanged until the access token is refreshed. To
update an API key, pass the property to be modified. To delete one property's
value, pass the property with an empty value "".Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str id: Unique ID of the API key to be updated.
:param str if_match: Version of the API key to be updated. Specify the
version that you retrieved when reading the API key. 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 name: (optional) The name of the API key to update. If specified
in the request the parameter must not be empty. The name is not checked for
uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the API key to
update. If specified an empty description will clear the description of the
API key. If a non empty value is provided the API key will be updated.
:param bool support_sessions: (optional) Defines if the API key supports
sessions. Sessions are only supported for user apikeys.
:param str action_when_leaked: (optional) Defines the action to take when
API key is leaked, valid values are 'none', 'disable' and 'delete'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
|
def update_api_key(
self,
id: str,
if_match: str,
*,
name: Optional[str] = None,
description: Optional[str] = None,
support_sessions: Optional[bool] = None,
action_when_leaked: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Updates an API key.
Updates properties of an API key. This does NOT affect existing access tokens.
Their token content will stay unchanged until the access token is refreshed. To
update an API key, pass the property to be modified. To delete one property's
value, pass the property with an empty value "".Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to.
:param str id: Unique ID of the API key to be updated.
:param str if_match: Version of the API key to be updated. Specify the
version that you retrieved when reading the API key. 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 name: (optional) The name of the API key to update. If specified
in the request the parameter must not be empty. The name is not checked for
uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the API key to
update. If specified an empty description will clear the description of the
API key. If a non empty value is provided the API key will be updated.
:param bool support_sessions: (optional) Defines if the API key supports
sessions. Sessions are only supported for user apikeys.
:param str action_when_leaked: (optional) Defines the action to take when
API key is leaked, valid values are 'none', 'disable' and 'delete'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ApiKey` object
"""
if not id:
raise ValueError('id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_api_key',
)
headers.update(sdk_headers)
data = {
'name': name,
'description': description,
'support_sessions': support_sessions,
'action_when_leaked': action_when_leaked,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/apikeys/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, if_match: str, *, name: Optional[str] = None, description: Optional[str] = None, support_sessions: Optional[bool] = None, action_when_leaked: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,754 |
ibm_platform_services.iam_identity_v1
|
update_claim_rule
|
Update claim rule for a trusted profile.
Update a specific claim rule for a given trusted profile ID and rule ID.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to update.
:param str if_match: Version of the claim rule to be updated. Specify the
version that you retrived when reading list of claim rules. This value
helps to identify any parallel usage of claim rule. Pass * to indicate to
update any version available. This might result in stale updates.
:param str type: Type of the claim rule, either 'Profile-SAML' or
'Profile-CR'.
:param List[ProfileClaimRuleConditions] conditions: Conditions of this
claim rule.
:param ResponseContext context: (optional) Context with key properties for
problem determination.
:param str name: (optional) Name of the claim rule to be created or
updated.
:param str realm_name: (optional) The realm name of the Idp this claim rule
applies to. This field is required only if the type is specified as
'Profile-SAML'.
:param str cr_type: (optional) The compute resource type the rule applies
to, required only if type is specified as 'Profile-CR'. Valid values are
VSI, IKS_SA, ROKS_SA.
:param int expiration: (optional) Session expiration in seconds, only
required if type is 'Profile-SAML'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
|
def update_claim_rule(
self,
profile_id: str,
rule_id: str,
if_match: str,
type: str,
conditions: List['ProfileClaimRuleConditions'],
*,
context: Optional['ResponseContext'] = None,
name: Optional[str] = None,
realm_name: Optional[str] = None,
cr_type: Optional[str] = None,
expiration: Optional[int] = None,
**kwargs,
) -> DetailedResponse:
"""
Update claim rule for a trusted profile.
Update a specific claim rule for a given trusted profile ID and rule ID.
:param str profile_id: ID of the trusted profile.
:param str rule_id: ID of the claim rule to update.
:param str if_match: Version of the claim rule to be updated. Specify the
version that you retrived when reading list of claim rules. This value
helps to identify any parallel usage of claim rule. Pass * to indicate to
update any version available. This might result in stale updates.
:param str type: Type of the claim rule, either 'Profile-SAML' or
'Profile-CR'.
:param List[ProfileClaimRuleConditions] conditions: Conditions of this
claim rule.
:param ResponseContext context: (optional) Context with key properties for
problem determination.
:param str name: (optional) Name of the claim rule to be created or
updated.
:param str realm_name: (optional) The realm name of the Idp this claim rule
applies to. This field is required only if the type is specified as
'Profile-SAML'.
:param str cr_type: (optional) The compute resource type the rule applies
to, required only if type is specified as 'Profile-CR'. Valid values are
VSI, IKS_SA, ROKS_SA.
:param int expiration: (optional) Session expiration in seconds, only
required if type is 'Profile-SAML'.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `ProfileClaimRule` object
"""
if not profile_id:
raise ValueError('profile_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 type is None:
raise ValueError('type must be provided')
if conditions is None:
raise ValueError('conditions must be provided')
conditions = [convert_model(x) for x in conditions]
if context is not None:
context = convert_model(context)
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_claim_rule',
)
headers.update(sdk_headers)
data = {
'type': type,
'conditions': conditions,
'context': context,
'name': name,
'realm_name': realm_name,
'cr_type': cr_type,
'expiration': expiration,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['profile-id', 'rule-id']
path_param_values = self.encode_path_vars(profile_id, rule_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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
|
(self, profile_id: str, rule_id: str, if_match: str, type: str, conditions: List[ibm_platform_services.iam_identity_v1.ProfileClaimRuleConditions], *, context: Optional[ibm_platform_services.iam_identity_v1.ResponseContext] = None, name: Optional[str] = None, realm_name: Optional[str] = None, cr_type: Optional[str] = None, expiration: Optional[int] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,755 |
ibm_platform_services.iam_identity_v1
|
update_profile
|
Update a trusted profile.
Update the name or description of an existing trusted profile.
:param str profile_id: ID of the trusted profile to be updated.
:param str if_match: Version of the trusted profile to be updated. Specify
the version that you retrived when reading list of trusted profiles. This
value helps to identify any parallel usage of trusted profile. Pass * to
indicate to update any version available. This might result in stale
updates.
:param str name: (optional) The name of the trusted profile to update. If
specified in the request the parameter must not be empty. The name is
checked for uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the trusted profile
to update. If specified an empty description will clear the description of
the trusted profile. If a non empty value is provided the trusted profile
will be updated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
|
def update_profile(
self,
profile_id: str,
if_match: str,
*,
name: Optional[str] = None,
description: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update a trusted profile.
Update the name or description of an existing trusted profile.
:param str profile_id: ID of the trusted profile to be updated.
:param str if_match: Version of the trusted profile to be updated. Specify
the version that you retrived when reading list of trusted profiles. This
value helps to identify any parallel usage of trusted profile. Pass * to
indicate to update any version available. This might result in stale
updates.
:param str name: (optional) The name of the trusted profile to update. If
specified in the request the parameter must not be empty. The name is
checked for uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the trusted profile
to update. If specified an empty description will clear the description of
the trusted profile. If a non empty value is provided the trusted profile
will be updated.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfile` object
"""
if not profile_id:
raise ValueError('profile_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_profile',
)
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 = ['profile-id']
path_param_values = self.encode_path_vars(profile_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profiles/{profile-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, profile_id: str, if_match: str, *, name: Optional[str] = None, description: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,756 |
ibm_platform_services.iam_identity_v1
|
update_profile_template_version
|
Update version of trusted profile template.
Update a specific version of a trusted profile template in an enterprise account.
:param str if_match: Entity tag of the Template to be updated. Specify the
tag that you retrieved when reading the Profile Template. 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_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
|
def update_profile_template_version(
self,
if_match: str,
template_id: str,
version: str,
*,
account_id: Optional[str] = None,
name: Optional[str] = None,
description: Optional[str] = None,
profile: Optional['TemplateProfileComponentRequest'] = None,
policy_template_references: Optional[List['PolicyTemplateReference']] = None,
**kwargs,
) -> DetailedResponse:
"""
Update version of trusted profile template.
Update a specific version of a trusted profile template in an enterprise account.
:param str if_match: Entity tag of the Template to be updated. Specify the
tag that you retrieved when reading the Profile Template. 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_id: ID of the trusted profile template.
:param str version: Version of the Profile Template.
:param str account_id: (optional) ID of the account where the template
resides.
:param str name: (optional) The name of the trusted profile template. This
is visible only in the enterprise account. Required field when creating a
new template. Otherwise this field is optional. If the field is included it
will change the name value for all existing versions of the template.
:param str description: (optional) The description of the trusted profile
template. Describe the template for enterprise account users.
:param TemplateProfileComponentRequest profile: (optional) Input body
parameters for the TemplateProfileComponent.
:param List[PolicyTemplateReference] policy_template_references: (optional)
Existing policy templates that you can reference to assign access in the
trusted profile component.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `TrustedProfileTemplateResponse` object
"""
if not if_match:
raise ValueError('if_match must be provided')
if not template_id:
raise ValueError('template_id must be provided')
if not version:
raise ValueError('version must be provided')
if profile is not None:
profile = convert_model(profile)
if policy_template_references is not None:
policy_template_references = [convert_model(x) for x in policy_template_references]
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_profile_template_version',
)
headers.update(sdk_headers)
data = {
'account_id': account_id,
'name': name,
'description': description,
'profile': profile,
'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']
path_param_values = self.encode_path_vars(template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/profile_templates/{template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, if_match: str, template_id: str, version: str, *, account_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, profile: Optional[ibm_platform_services.iam_identity_v1.TemplateProfileComponentRequest] = None, policy_template_references: Optional[List[ibm_platform_services.iam_identity_v1.PolicyTemplateReference]] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,757 |
ibm_platform_services.iam_identity_v1
|
update_service_id
|
Update service ID.
Updates properties of a service ID. This does NOT affect existing access tokens.
Their token content will stay unchanged until the access token is refreshed. To
update a service ID, pass the property to be modified. To delete one property's
value, pass the property with an empty value "".Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to. Note: apikey details are only included in the response when
creating a Service ID with an apikey.
:param str id: Unique ID of the service ID to be updated.
:param str if_match: Version of the service ID to be updated. Specify the
version that you retrieved as entity_tag (ETag header) when reading the
service ID. 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 name: (optional) The name of the service ID to update. If
specified in the request the parameter must not be empty. The name is not
checked for uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the service ID to
update. If specified an empty description will clear the description of the
service ID. If an non empty value is provided the service ID will be
updated.
:param List[str] unique_instance_crns: (optional) List of CRNs which point
to the services connected to this service ID. If specified an empty list
will clear all existing unique instance crns of the service 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 `ServiceId` object
|
def update_service_id(
self,
id: str,
if_match: str,
*,
name: Optional[str] = None,
description: Optional[str] = None,
unique_instance_crns: Optional[List[str]] = None,
**kwargs,
) -> DetailedResponse:
"""
Update service ID.
Updates properties of a service ID. This does NOT affect existing access tokens.
Their token content will stay unchanged until the access token is refreshed. To
update a service ID, pass the property to be modified. To delete one property's
value, pass the property with an empty value "".Users can manage user API keys for
themself, or service ID API keys for service IDs that are bound to an entity they
have access to. Note: apikey details are only included in the response when
creating a Service ID with an apikey.
:param str id: Unique ID of the service ID to be updated.
:param str if_match: Version of the service ID to be updated. Specify the
version that you retrieved as entity_tag (ETag header) when reading the
service ID. 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 name: (optional) The name of the service ID to update. If
specified in the request the parameter must not be empty. The name is not
checked for uniqueness. Failure to this will result in an Error condition.
:param str description: (optional) The description of the service ID to
update. If specified an empty description will clear the description of the
service ID. If an non empty value is provided the service ID will be
updated.
:param List[str] unique_instance_crns: (optional) List of CRNs which point
to the services connected to this service ID. If specified an empty list
will clear all existing unique instance crns of the service 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 `ServiceId` object
"""
if not id:
raise ValueError('id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_service_id',
)
headers.update(sdk_headers)
data = {
'name': name,
'description': description,
'unique_instance_crns': unique_instance_crns,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/serviceids/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, id: str, if_match: str, *, name: Optional[str] = None, description: Optional[str] = None, unique_instance_crns: Optional[List[str]] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,758 |
ibm_platform_services.iam_identity_v1
|
update_trusted_profile_assignment
|
Update assignment.
Update a trusted profile assignment. Call this method to retry failed assignments
or migrate the trusted profile in child accounts to a new version.
: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 int template_version: Template version to be applied to the
assignment. To retry all failed assignments, provide the existing version.
To migrate to a different version, provide the new version number.
:param dict headers: 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 update_trusted_profile_assignment(
self,
assignment_id: str,
if_match: str,
template_version: int,
**kwargs,
) -> DetailedResponse:
"""
Update assignment.
Update a trusted profile assignment. Call this method to retry failed assignments
or migrate the trusted profile in child accounts to a new version.
: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 int template_version: Template version to be applied to the
assignment. To retry all failed assignments, provide the existing version.
To migrate to a different version, provide the new version number.
:param dict headers: 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 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='V1',
operation_id='update_trusted_profile_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/profile_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
|
(self, assignment_id: str, if_match: str, template_version: int, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,759 |
ibm_platform_services.iam_policy_management_v1
|
IamPolicyManagementV1
|
The iam_policy_management V1 service.
|
class IamPolicyManagementV1(BaseService):
"""The iam_policy_management V1 service."""
DEFAULT_SERVICE_URL = 'https://iam.cloud.ibm.com'
DEFAULT_SERVICE_NAME = 'iam_policy_management'
@classmethod
def new_instance(
cls,
service_name: str = DEFAULT_SERVICE_NAME,
) -> 'IamPolicyManagementV1':
"""
Return a new client for the iam_policy_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 iam_policy_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)
#########################
# Policies
#########################
def list_policies(
self,
account_id: str,
*,
accept_language: Optional[str] = None,
iam_id: Optional[str] = None,
access_group_id: Optional[str] = None,
type: Optional[str] = None,
service_type: Optional[str] = None,
tag_name: Optional[str] = None,
tag_value: Optional[str] = None,
sort: Optional[str] = None,
format: Optional[str] = None,
state: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Get policies by attributes.
Get policies and filter by attributes. While managing policies, you might want to
retrieve policies in the account and filter by attribute values. This can be done
through query parameters. The following attributes are supported: account_id,
iam_id, access_group_id, type, service_type, sort, format and state. account_id is
a required query parameter. Only policies that have the specified attributes and
that the caller has read access to are returned. If the caller does not have read
access to any policies an empty array is returned.
:param str account_id: The account GUID that the policies belong to.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param str iam_id: (optional) Optional IAM ID used to identify the subject.
:param str access_group_id: (optional) Optional access group id.
:param str type: (optional) Optional type of policy.
:param str service_type: (optional) Optional type of service.
:param str tag_name: (optional) Optional name of the access tag in the
policy.
:param str tag_value: (optional) Optional value of the access tag in the
policy.
:param str sort: (optional) Optional top level policy field to sort
results. Ascending sort is default. Descending sort available by prepending
'-' to field. Example '-last_modified_at'.
:param str format: (optional) Include additional data per policy returned
* `include_last_permit` - returns details of when the policy last granted a
permit decision and the number of times it has done so
* `display` - returns the list of all actions included in each of the
policy roles.
:param str state: (optional) The state of the policy.
* `active` - returns active policies
* `deleted` - returns non-active policies.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyCollection` object
"""
if not account_id:
raise ValueError('account_id must be provided')
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_policies',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'iam_id': iam_id,
'access_group_id': access_group_id,
'type': type,
'service_type': service_type,
'tag_name': tag_name,
'tag_value': tag_value,
'sort': sort,
'format': format,
'state': state,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/policies'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_policy(
self,
type: str,
subjects: List['PolicySubject'],
roles: List['PolicyRole'],
resources: List['PolicyResource'],
*,
description: Optional[str] = None,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a policy.
Creates a policy to grant access between a subject and a resource. There are two
types of policies: **access** and **authorization**. A policy administrator might
want to create an access policy which grants access to a user, service-id, or an
access group. They might also want to create an authorization policy and setup
access between services.
### Access
To create an access policy, use **`"type": "access"`** in the body. The possible
subject attributes are **`iam_id`** and **`access_group_id`**. Use the
**`iam_id`** subject attribute for assigning access for a user or service-id. Use
the **`access_group_id`** subject attribute for assigning access for an access
group. Assign roles that are supported by the service or platform roles. For more
information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). Use only the
resource attributes supported by the service. To view a service's or the
platform's supported attributes, check the [documentation](/docs?tab=all-docs).
The policy resource must include either the **`serviceType`**, **`serviceName`**,
**`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`**
attribute. The IAM Services group (`IAM`) is a subset of account management
services that includes the IAM platform services IAM Identity, IAM Access
Management, IAM Users Management, IAM Groups, and future IAM services. If the
subject is a locked service-id, the request will fail.
### Authorization
Authorization policies are supported by services on a case by case basis. Refer to
service documentation to verify their support of authorization policies. To create
an authorization policy, use **`"type": "authorization"`** in the body. The
subject attributes must match the supported authorization subjects of the
resource. Multiple subject attributes might be provided. The following attributes
are supported:
serviceName, serviceInstance, region, resourceType, resource, accountId,
resourceGroupId Assign roles that are supported by the service or platform roles.
For more information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). The user must
also have the same level of access or greater to the target resource in order to
grant the role. Use only the resource attributes supported by the service. To view
a service's or the platform's supported attributes, check the
[documentation](/docs?tab=all-docs). Both the policy subject and the policy
resource must include the **`accountId`** attributes. The policy subject must
include either **`serviceName`** or **`resourceGroupId`** (or both) attributes.
### Attribute Operators
Currently, only the `stringEquals` and the `stringMatch` operators are available.
Resource attributes may support one or both operators. For more information, see
[Assigning access by using wildcard
policies](https://cloud.ibm.com/docs/account?topic=account-wildcard).
### Attribute Validations
Policy attribute values must be between 1 and 1,000 characters in length. If
location related attributes like geography, country, metro, region, satellite, and
locationvalues are supported by the service, they are validated against Global
Catalog locations.
:param str type: The policy type; either 'access' or 'authorization'.
:param List[PolicySubject] subjects: The subjects associated with a policy.
:param List[PolicyRole] roles: A set of role cloud resource names (CRNs)
granted by the policy.
:param List[PolicyResource] resources: The resources associated with a
policy.
:param str description: (optional) Customer-defined description.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Policy` object
"""
if type is None:
raise ValueError('type must be provided')
if subjects is None:
raise ValueError('subjects must be provided')
if roles is None:
raise ValueError('roles must be provided')
if resources is None:
raise ValueError('resources must be provided')
subjects = [convert_model(x) for x in subjects]
roles = [convert_model(x) for x in roles]
resources = [convert_model(x) for x in resources]
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_policy',
)
headers.update(sdk_headers)
data = {
'type': type,
'subjects': subjects,
'roles': roles,
'resources': resources,
'description': description,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/policies'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def replace_policy(
self,
policy_id: str,
if_match: str,
type: str,
subjects: List['PolicySubject'],
roles: List['PolicyRole'],
resources: List['PolicyResource'],
*,
description: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update a policy.
Update a policy to grant access between a subject and a resource. A policy
administrator might want to update an existing policy. The policy type cannot be
changed (You cannot change an access policy to an authorization policy).
### Access
To update an access policy, use **`"type": "access"`** in the body. The possible
subject attributes are **`iam_id`** and **`access_group_id`**. Use the
**`iam_id`** subject attribute for assigning access for a user or service-id. Use
the **`access_group_id`** subject attribute for assigning access for an access
group. Assign roles that are supported by the service or platform roles. For more
information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). Use only the
resource attributes supported by the service. To view a service's or the
platform's supported attributes, check the [documentation](/docs?tab=all-docs).
The policy resource must include either the **`serviceType`**, **`serviceName`**,
or **`resourceGroupId`** attribute and the **`accountId`** attribute.` If the
subject is a locked service-id, the request will fail.
### Authorization
To update an authorization policy, use **`"type": "authorization"`** in the body.
The subject attributes must match the supported authorization subjects of the
resource. Multiple subject attributes might be provided. The following attributes
are supported:
serviceName, serviceInstance, region, resourceType, resource, accountId,
resourceGroupId Assign roles that are supported by the service or platform roles.
For more information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). The user must
also have the same level of access or greater to the target resource in order to
grant the role. Use only the resource attributes supported by the service. To view
a service's or the platform's supported attributes, check the
[documentation](/docs?tab=all-docs). Both the policy subject and the policy
resource must include the **`accountId`** attributes. The policy subject must
include either **`serviceName`** or **`resourceGroupId`** (or both) attributes.
### Attribute Operators
Currently, only the `stringEquals` and the `stringMatch` operators are available.
Resource attributes might support one or both operators. For more information, see
[Assigning access by using wildcard
policies](https://cloud.ibm.com/docs/account?topic=account-wildcard).
### Attribute Validations
Policy attribute values must be between 1 and 1,000 characters in length. If
location related attributes like geography, country, metro, region, satellite, and
locationvalues are supported by the service, they are validated against Global
Catalog locations.
:param str policy_id: The policy ID.
:param str if_match: The revision number for updating a policy and must
match the ETag value of the existing policy. The Etag can be retrieved
using the GET /v1/policies/{policy_id} API and looking at the ETag response
header.
:param str type: The policy type; either 'access' or 'authorization'.
:param List[PolicySubject] subjects: The subjects associated with a policy.
:param List[PolicyRole] roles: A set of role cloud resource names (CRNs)
granted by the policy.
:param List[PolicyResource] resources: The resources associated with a
policy.
:param str description: (optional) Customer-defined description.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Policy` object
"""
if not policy_id:
raise ValueError('policy_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if type is None:
raise ValueError('type must be provided')
if subjects is None:
raise ValueError('subjects must be provided')
if roles is None:
raise ValueError('roles must be provided')
if resources is None:
raise ValueError('resources must be provided')
subjects = [convert_model(x) for x in subjects]
roles = [convert_model(x) for x in roles]
resources = [convert_model(x) for x in resources]
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='replace_policy',
)
headers.update(sdk_headers)
data = {
'type': type,
'subjects': subjects,
'roles': roles,
'resources': resources,
'description': description,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_id']
path_param_values = self.encode_path_vars(policy_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policies/{policy_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_policy(
self,
policy_id: str,
**kwargs,
) -> DetailedResponse:
"""
Retrieve a policy by ID.
Retrieve a policy by providing a policy ID.
:param str policy_id: The policy ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateMetaData` object
"""
if not policy_id:
raise ValueError('policy_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_policy',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_id']
path_param_values = self.encode_path_vars(policy_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policies/{policy_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def delete_policy(
self,
policy_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a policy by ID.
Delete a policy by providing a policy ID. A policy cannot be deleted if the
subject ID contains a locked service ID. If the subject of the policy is a locked
service-id, the request will fail.
:param str policy_id: The policy ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not policy_id:
raise ValueError('policy_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_policy',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['policy_id']
path_param_values = self.encode_path_vars(policy_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policies/{policy_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def update_policy_state(
self,
policy_id: str,
if_match: str,
*,
state: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Restore a deleted policy by ID.
Restore a policy that has recently been deleted. A policy administrator might want
to restore a deleted policy. To restore a policy, use **`"state": "active"`** in
the body.
:param str policy_id: The policy ID.
:param str if_match: The revision number for updating a policy and must
match the ETag value of the existing policy. The Etag can be retrieved
using the GET /v1/policies/{policy_id} API and looking at the ETag response
header.
:param str state: (optional) The policy state.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Policy` object
"""
if not policy_id:
raise ValueError('policy_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_policy_state',
)
headers.update(sdk_headers)
data = {
'state': state,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_id']
path_param_values = self.encode_path_vars(policy_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policies/{policy_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
#########################
# Roles
#########################
def list_roles(
self,
*,
accept_language: Optional[str] = None,
account_id: Optional[str] = None,
service_name: Optional[str] = None,
source_service_name: Optional[str] = None,
policy_type: Optional[str] = None,
service_group_id: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Get roles by filters.
Get roles based on the filters. While managing roles, you may want to retrieve
roles and filter by usages. This can be done through query parameters. Currently,
we only support the following attributes: account_id, service_name,
service_group_id, source_service_name and policy_type. Both service_name and
service_group_id attributes are mutually exclusive. Only roles that match the
filter and that the caller has read access to are returned. If the caller does not
have read access to any roles an empty array is returned.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param str account_id: (optional) Optional account GUID in which the roles
belong to.
:param str service_name: (optional) Optional name of IAM enabled service.
:param str source_service_name: (optional) Optional name of source IAM
enabled service.
:param str policy_type: (optional) Optional Policy Type.
:param str service_group_id: (optional) Optional id of service group.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `RoleCollection` object
"""
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_roles',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'service_name': service_name,
'source_service_name': source_service_name,
'policy_type': policy_type,
'service_group_id': service_group_id,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v2/roles'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_role(
self,
display_name: str,
actions: List[str],
name: str,
account_id: str,
service_name: str,
*,
description: Optional[str] = None,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a role.
Creates a custom role for a specific service within the account. An account owner
or a user assigned the Administrator role on the Role management service can
create a custom role. Any number of actions for a single service can be mapped to
the new role, but there must be at least one service-defined action to
successfully create the new role.
:param str display_name: The display name of the role that is shown in the
console.
:param List[str] actions: The actions of the role. For more information,
see [IAM roles and
actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions).
:param str name: The name of the role that is used in the CRN. Can only be
alphanumeric and has to be capitalized.
:param str account_id: The account GUID.
:param str service_name: The service name.
:param str description: (optional) The description of the role.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CustomRole` object
"""
if display_name is None:
raise ValueError('display_name must be provided')
if actions is None:
raise ValueError('actions must be provided')
if name is None:
raise ValueError('name must be provided')
if account_id is None:
raise ValueError('account_id must be provided')
if service_name is None:
raise ValueError('service_name must be provided')
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_role',
)
headers.update(sdk_headers)
data = {
'display_name': display_name,
'actions': actions,
'name': name,
'account_id': account_id,
'service_name': service_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/roles'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def replace_role(
self,
role_id: str,
if_match: str,
display_name: str,
actions: List[str],
*,
description: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Update a role.
Update a custom role. A role administrator might want to update an existing role
by updating the display name, description, or the actions that are mapped to the
role. The name, account_id, and service_name can't be changed.
:param str role_id: The role ID.
:param str if_match: The revision number for updating a role and must match
the ETag value of the existing role. The Etag can be retrieved using the
GET /v2/roles/{role_id} API and looking at the ETag response header.
:param str display_name: The display name of the role that is shown in the
console.
:param List[str] actions: The actions of the role. For more information,
see [IAM roles and
actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions).
:param str description: (optional) The description of the role.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CustomRole` object
"""
if not role_id:
raise ValueError('role_id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if display_name is None:
raise ValueError('display_name must be provided')
if actions is None:
raise ValueError('actions must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='replace_role',
)
headers.update(sdk_headers)
data = {
'display_name': display_name,
'actions': actions,
'description': description,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['role_id']
path_param_values = self.encode_path_vars(role_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/roles/{role_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_role(
self,
role_id: str,
**kwargs,
) -> DetailedResponse:
"""
Retrieve a role by ID.
Retrieve a role by providing a role ID.
:param str role_id: The role ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CustomRole` object
"""
if not role_id:
raise ValueError('role_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_role',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['role_id']
path_param_values = self.encode_path_vars(role_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/roles/{role_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def delete_role(
self,
role_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a role by ID.
Delete a role by providing a role ID.
:param str role_id: The role ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not role_id:
raise ValueError('role_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_role',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['role_id']
path_param_values = self.encode_path_vars(role_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/roles/{role_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# v2/Policies
#########################
def list_v2_policies(
self,
account_id: str,
*,
accept_language: Optional[str] = None,
iam_id: Optional[str] = None,
access_group_id: Optional[str] = None,
type: Optional[str] = None,
service_type: Optional[str] = None,
service_name: Optional[str] = None,
service_group_id: Optional[str] = None,
sort: Optional[str] = None,
format: Optional[str] = None,
state: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Get policies by attributes.
Get policies and filter by attributes. While managing policies, you might want to
retrieve policies in the account and filter by attribute values. This can be done
through query parameters. The following attributes are supported: account_id,
iam_id, access_group_id, type, service_type, sort, format and state. account_id is
a required query parameter. Only policies that have the specified attributes and
that the caller has read access to are returned. If the caller does not have read
access to any policies an empty array is returned.
:param str account_id: The account GUID in which the policies belong to.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param str iam_id: (optional) Optional IAM ID used to identify the subject.
:param str access_group_id: (optional) Optional access group id.
:param str type: (optional) Optional type of policy.
:param str service_type: (optional) Optional type of service.
:param str service_name: (optional) Optional name of service.
:param str service_group_id: (optional) Optional ID of service group.
:param str sort: (optional) Optional top level policy field to sort
results. Ascending sort is default. Descending sort available by prepending
'-' to field, for example, '-last_modified_at'. Note that last permit
information is only included when 'format=include_last_permit', for
example, "format=include_last_permit&sort=last_permit_at" Example fields
that can be sorted on:
- 'id'
- 'type'
- 'href'
- 'created_at'
- 'created_by_id'
- 'last_modified_at'
- 'last_modified_by_id'
- 'state'
- 'last_permit_at'
- 'last_permit_frequency'.
:param str format: (optional) Include additional data per policy returned
* `include_last_permit` - returns details of when the policy last granted a
permit decision and the number of times it has done so
* `display` - returns the list of all actions included in each of the
policy roles and translations for all relevant fields.
:param str state: (optional) The state of the policy.
* `active` - returns active policies
* `deleted` - returns non-active policies.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `V2PolicyCollection` object
"""
if not account_id:
raise ValueError('account_id must be provided')
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_v2_policies',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'iam_id': iam_id,
'access_group_id': access_group_id,
'type': type,
'service_type': service_type,
'service_name': service_name,
'service_group_id': service_group_id,
'sort': sort,
'format': format,
'state': state,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v2/policies'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_v2_policy(
self,
control: 'Control',
type: str,
*,
description: Optional[str] = None,
subject: Optional['V2PolicySubject'] = None,
resource: Optional['V2PolicyResource'] = None,
pattern: Optional[str] = None,
rule: Optional['V2PolicyRule'] = None,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a policy.
Creates a policy to grant access between a subject and a resource. Currently,
there is one type of a v2/policy: **access**. A policy administrator might want to
create an access policy that grants access to a user, service-id, or an access
group.
### Access
To create an access policy, use **`"type": "access"`** in the body. The supported
subject attributes are **`iam_id`** and **`access_group_id`**. Use the
**`iam_id`** subject attribute to assign access to a user or service-id. Use the
**`access_group_id`** subject attribute to assign access to an access group.
Assign roles that are supported by the service or platform roles. For more
information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). Use only the
resource attributes supported by the service. To view a service's or the
platform's supported attributes, check the [documentation](/docs?tab=all-docs).
The policy resource must include either the **`serviceType`**, **`serviceName`**,
**`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`**
attribute. In the rule field, you can specify a single condition by using
**`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`**
with a combination **`operator`**. The possible combination operators are
**`and`** and **`or`**.
Currently, we support two types of patterns:
1. `time-based`: Used to specify a time-based restriction
Combine conditions to specify a time-based restriction (e.g., access only during
business hours, during the Monday-Friday work week). For example, a policy can
grant access Monday-Friday, 9:00am-5:00pm using the following rule:
```json
"rule": {
"operator": "and",
"conditions": [{
"key": "{{environment.attributes.day_of_week}}",
"operator": "dayOfWeekAnyOf",
"value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"]
},
"key": "{{environment.attributes.current_time}}",
"operator": "timeGreaterThanOrEquals",
"value": "09:00:00+00:00"
},
"key": "{{environment.attributes.current_time}}",
"operator": "timeLessThanOrEquals",
"value": "17:00:00+00:00"
}]
}
``` You can use the following operators in the **`key`** and **`value`** pair:
```
'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan',
'timeGreaterThanOrEquals',
'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan',
'dateGreaterThanOrEquals',
'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan',
'dateTimeGreaterThanOrEquals',
'dayOfWeekEquals', 'dayOfWeekAnyOf'
``` The pattern field that matches the rule is required when rule is provided. For
the business hour rule example above, the **`pattern`** is
**`"time-based-conditions:weekly"`**. For more information, see [Time-based
conditions
operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties)
and
[Limiting access with time-based
conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the
subject is a locked service-id, the request will fail.
2. `attribute-based`: Used to specify a combination of OR/AND based conditions
applied on resource attributes.
Combine conditions to specify an attribute-based condition using AND/OR-based
operators.
For example, a policy can grant access based on multiple conditions applied on the
resource attributes below:
```json
"pattern": "attribute-based-condition:resource:literal-and-wildcard"
"rule": {
"operator": "or",
"conditions": [
{
"operator": "and",
"conditions": [
{
"key": "{{resource.attributes.prefix}}",
"operator": "stringEquals",
"value": "home/test"
},
{
"key": "{{environment.attributes.delimiter}}",
"operator": "stringEquals",
"value": "/"
}
]
},
{
"key": "{{resource.attributes.path}}",
"operator": "stringMatch",
"value": "home/David/*"
}
]
}
```
In addition to satisfying the `resources` section, the policy grants permission
only if either the `path` begins with `home/David/` **OR** the `prefix` is
`home/test` and the `delimiter` is `/`. This mechanism helps you consolidate
multiple policies in to a single policy, making policies easier to administer and
stay within the policy limit for an account. View the list of operators that can
be used in the condition
[here](/docs/account?topic=account-wildcard#string-comparisons).
### Authorization
Authorization policies are supported by services on a case by case basis. Refer to
service documentation to verify their support of authorization policies. To create
an authorization policy, use **`"type": "authorization"`** in the body. The
subject attributes must match the supported authorization subjects of the
resource. Multiple subject attributes might be provided. The following attributes
are supported:
serviceName, serviceInstance, region, resourceType, resource, accountId,
resourceGroupId Assign roles that are supported by the service or platform roles.
For more information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). The user must
also have the same level of access or greater to the target resource in order to
grant the role. Use only the resource attributes supported by the service. To view
a service's or the platform's supported attributes, check the
[documentation](/docs?tab=all-docs). Both the policy subject and the policy
resource must include the **`accountId`** attributes. The policy subject must
include either **`serviceName`** or **`resourceGroupId`** (or both) attributes.
### Attribute Operators
Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators
are available. For more information, see [Assigning access by using wildcard
policies](https://cloud.ibm.com/docs/account?topic=account-wildcard).
### Attribute Validations
Policy attribute values must be between 1 and 1,000 characters in length. If
location related attributes like geography, country, metro, region, satellite, and
locationvalues are supported by the service, they are validated against Global
Catalog locations.
:param Control control: Specifies the type of access granted by the policy.
:param str type: The policy type; either 'access' or 'authorization'.
:param str description: (optional) Description of the policy.
:param V2PolicySubject subject: (optional) The subject attributes for whom
the policy grants access.
:param V2PolicyResource resource: (optional) The resource attributes to
which the policy grants access.
:param str pattern: (optional) Indicates pattern of rule, either
'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or
'time-based-conditions:weekly:custom-hours'.
:param V2PolicyRule rule: (optional) Additional access conditions
associated with the policy.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `V2Policy` object
"""
if control is None:
raise ValueError('control must be provided')
if type is None:
raise ValueError('type must be provided')
control = convert_model(control)
if subject is not None:
subject = convert_model(subject)
if resource is not None:
resource = convert_model(resource)
if rule is not None:
rule = convert_model(rule)
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_v2_policy',
)
headers.update(sdk_headers)
data = {
'control': control,
'type': type,
'description': description,
'subject': subject,
'resource': resource,
'pattern': pattern,
'rule': rule,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v2/policies'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def replace_v2_policy(
self,
id: str,
if_match: str,
control: 'Control',
type: str,
*,
description: Optional[str] = None,
subject: Optional['V2PolicySubject'] = None,
resource: Optional['V2PolicyResource'] = None,
pattern: Optional[str] = None,
rule: Optional['V2PolicyRule'] = None,
**kwargs,
) -> DetailedResponse:
"""
Update a policy.
Update a policy to grant access between a subject and a resource. A policy
administrator might want to update an existing policy.
### Access
To update an access policy, use **`"type": "access"`** in the body. The supported
subject attributes are **`iam_id`** and **`access_group_id`**. Use the
**`iam_id`** subject attribute to assign access to a user or service-id. Use the
**`access_group_id`** subject attribute to assign access to an access group.
Assign roles that are supported by the service or platform roles. For more
information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). Use only the
resource attributes supported by the service. To view a service's or the
platform's supported attributes, check the [documentation](/docs?tab=all-docs).
The policy resource must include either the **`serviceType`**, **`serviceName`**,
**`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`**
attribute. In the rule field, you can specify a single condition by using
**`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`**
with a combination **`operator`**. The possible combination operators are
**`and`** and **`or`**.
Currently, we support two types of patterns:
1. `time-based`: Used to specify a time-based restriction
Combine conditions to specify a time-based restriction (e.g., access only during
business hours, during the Monday-Friday work week). For example, a policy can
grant access Monday-Friday, 9:00am-5:00pm using the following rule:
```json
"rule": {
"operator": "and",
"conditions": [{
"key": "{{environment.attributes.day_of_week}}",
"operator": "dayOfWeekAnyOf",
"value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"]
},
"key": "{{environment.attributes.current_time}}",
"operator": "timeGreaterThanOrEquals",
"value": "09:00:00+00:00"
},
"key": "{{environment.attributes.current_time}}",
"operator": "timeLessThanOrEquals",
"value": "17:00:00+00:00"
}]
}
``` You can use the following operators in the **`key`** and **`value`** pair:
```
'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan',
'timeGreaterThanOrEquals',
'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan',
'dateGreaterThanOrEquals',
'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan',
'dateTimeGreaterThanOrEquals',
'dayOfWeekEquals', 'dayOfWeekAnyOf'
``` The pattern field that matches the rule is required when rule is provided. For
the business hour rule example above, the **`pattern`** is
**`"time-based-conditions:weekly"`**. For more information, see [Time-based
conditions
operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties)
and
[Limiting access with time-based
conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the
subject is a locked service-id, the request will fail.
2. `attribute-based`: Used to specify a combination of OR/AND based conditions
applied on resource attributes.
Combine conditions to specify an attribute-based condition using AND/OR-based
operators.
For example, a policy can grant access based on multiple conditions applied on the
resource attributes below:
```json
"pattern": "attribute-based-condition:resource:literal-and-wildcard"
"rule": {
"operator": "or",
"conditions": [
{
"operator": "and",
"conditions": [
{
"key": "{{resource.attributes.prefix}}",
"operator": "stringEquals",
"value": "home/test"
},
{
"key": "{{environment.attributes.delimiter}}",
"operator": "stringEquals",
"value": "/"
}
]
},
{
"key": "{{resource.attributes.path}}",
"operator": "stringMatch",
"value": "home/David/*"
}
]
}
```
In addition to satisfying the `resources` section, the policy grants permission
only if either the `path` begins with `home/David/` **OR** the `prefix` is
`home/test` and the `delimiter` is `/`. This mechanism helps you consolidate
multiple policies in to a single policy, making policies easier to administer and
stay within the policy limit for an account. View the list of operators that can
be used in the condition
[here](/docs/account?topic=account-wildcard#string-comparisons).
### Authorization
To update an authorization policy, use **`"type": "authorization"`** in the body.
The subject attributes must match the supported authorization subjects of the
resource. Multiple subject attributes might be provided. The following attributes
are supported:
serviceName, serviceInstance, region, resourceType, resource, accountId,
resourceGroupId Assign roles that are supported by the service or platform roles.
For more information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). The user must
also have the same level of access or greater to the target resource in order to
grant the role. Use only the resource attributes supported by the service. To view
a service's or the platform's supported attributes, check the
[documentation](/docs?tab=all-docs). Both the policy subject and the policy
resource must include the **`accountId`** attributes. The policy subject must
include either **`serviceName`** or **`resourceGroupId`** (or both) attributes.
### Attribute Operators
Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators
are available. For more information, see [Assigning access by using wildcard
policies](https://cloud.ibm.com/docs/account?topic=account-wildcard).
### Attribute Validations
Policy attribute values must be between 1 and 1,000 characters in length. If
location related attributes like geography, country, metro, region, satellite, and
locationvalues are supported by the service, they are validated against Global
Catalog locations.
:param str id: The policy ID.
:param str if_match: The revision number for updating a policy and must
match the ETag value of the existing policy. The Etag can be retrieved
using the GET /v2/policies/{id} API and looking at the ETag response
header.
:param Control control: Specifies the type of access granted by the policy.
:param str type: The policy type; either 'access' or 'authorization'.
:param str description: (optional) Description of the policy.
:param V2PolicySubject subject: (optional) The subject attributes for whom
the policy grants access.
:param V2PolicyResource resource: (optional) The resource attributes to
which the policy grants access.
:param str pattern: (optional) Indicates pattern of rule, either
'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or
'time-based-conditions:weekly:custom-hours'.
:param V2PolicyRule rule: (optional) Additional access conditions
associated with the policy.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `V2Policy` object
"""
if not id:
raise ValueError('id must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if control is None:
raise ValueError('control must be provided')
if type is None:
raise ValueError('type must be provided')
control = convert_model(control)
if subject is not None:
subject = convert_model(subject)
if resource is not None:
resource = convert_model(resource)
if rule is not None:
rule = convert_model(rule)
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='replace_v2_policy',
)
headers.update(sdk_headers)
data = {
'control': control,
'type': type,
'description': description,
'subject': subject,
'resource': resource,
'pattern': pattern,
'rule': rule,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_v2_policy(
self,
id: str,
*,
format: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Retrieve a policy by ID.
Retrieve a policy by providing a policy ID.
:param str id: The policy ID.
:param str format: (optional) Include additional data for policy returned
* `include_last_permit` - returns details of when the policy last granted a
permit decision and the number of times it has done so
* `display` - returns the list of all actions included in each of the
policy roles and translations for all relevant fields.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `V2PolicyTemplateMetaData` object
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_v2_policy',
)
headers.update(sdk_headers)
params = {
'format': format,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def delete_v2_policy(
self,
id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a policy by ID.
Delete a policy by providing a policy ID. A policy cannot be deleted if the
subject ID contains a locked service ID. If the subject of the policy is a locked
service-id, the request will fail.
:param str id: The policy ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not id:
raise ValueError('id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_v2_policy',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['id']
path_param_values = self.encode_path_vars(id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v2/policies/{id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# Policy templates
#########################
def list_policy_templates(
self,
account_id: str,
*,
accept_language: Optional[str] = None,
state: Optional[str] = None,
name: Optional[str] = None,
policy_service_type: Optional[str] = None,
policy_service_name: Optional[str] = None,
policy_service_group_id: Optional[str] = None,
policy_type: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
List policy templates by attributes.
List policy templates and filter by attributes by using query parameters. The
following attributes are supported:
`account_id`, `policy_service_name`, `policy_service_type`,
`policy_service_group_id` and `policy_type`.
`account_id` is a required query parameter. These attributes
`policy_service_name`, `policy_service_type` and `policy_service_group_id` are
mutually exclusive. Only policy templates that have the specified attributes and
that the caller has read access to are returned. If the caller does not have read
access to any policy templates an empty array is returned.
:param str account_id: The account GUID that the policy templates belong
to.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param str state: (optional) The policy template state.
:param str name: (optional) The policy template name.
:param str policy_service_type: (optional) Service type, Optional.
:param str policy_service_name: (optional) Service name, Optional.
:param str policy_service_group_id: (optional) Service group id, Optional.
:param str policy_type: (optional) Policy type, Optional.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateCollection` object
"""
if not account_id:
raise ValueError('account_id must be provided')
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_policy_templates',
)
headers.update(sdk_headers)
params = {
'account_id': account_id,
'state': state,
'name': name,
'policy_service_type': policy_service_type,
'policy_service_name': policy_service_name,
'policy_service_group_id': policy_service_group_id,
'policy_type': policy_type,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/policy_templates'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_policy_template(
self,
name: str,
account_id: str,
policy: 'TemplatePolicy',
*,
description: Optional[str] = None,
committed: Optional[bool] = None,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a policy template.
Create a policy template. Policy templates define a policy without requiring a
subject, and you can use them to grant access to multiple subjects.
:param str name: Required field when creating a new template. Otherwise
this field is optional. If the field is included it will change the name
value for all existing versions of the template.
:param str account_id: Enterprise account ID where this template will be
created.
:param TemplatePolicy policy: The core set of properties associated with
the template's policy objet.
:param str description: (optional) Description of the policy template. This
is shown to users in the enterprise account. Use this to describe the
purpose or context of the policy for enterprise users managing IAM
templates.
:param bool committed: (optional) Committed status of the template.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateLimitData` object
"""
if name is None:
raise ValueError('name must be provided')
if account_id is None:
raise ValueError('account_id must be provided')
if policy is None:
raise ValueError('policy must be provided')
policy = convert_model(policy)
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_policy_template',
)
headers.update(sdk_headers)
data = {
'name': name,
'account_id': account_id,
'policy': policy,
'description': description,
'committed': committed,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/policy_templates'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_policy_template(
self,
policy_template_id: str,
*,
state: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Retrieve latest version of a policy template.
Retrieve the latest version of a policy template by providing a policy template
ID.
:param str policy_template_id: The policy template ID.
:param str state: (optional) The policy template state.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplate` object
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_policy_template',
)
headers.update(sdk_headers)
params = {
'state': state,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_template_id']
path_param_values = self.encode_path_vars(policy_template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def delete_policy_template(
self,
policy_template_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a policy template.
Delete a policy template by providing the policy template ID. This deletes all
versions of this template. A policy template can't be deleted if any version of
the template is assigned to one or more child accounts. You must remove the policy
assignments first.
:param str policy_template_id: The policy template ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_policy_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['policy_template_id']
path_param_values = self.encode_path_vars(policy_template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def create_policy_template_version(
self,
policy_template_id: str,
policy: 'TemplatePolicy',
*,
name: Optional[str] = None,
description: Optional[str] = None,
committed: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a new policy template version.
Create a new version of a policy template. Use this if you need to make updates to
a policy template that is committed.
:param str policy_template_id: The policy template ID.
:param TemplatePolicy policy: The core set of properties associated with
the template's policy objet.
:param str name: (optional) Required field when creating a new template.
Otherwise this field is optional. If the field is included it will change
the name value for all existing versions of the template.
:param str description: (optional) Description of the policy template. This
is shown to users in the enterprise account. Use this to describe the
purpose or context of the policy for enterprise users managing IAM
templates.
:param bool committed: (optional) Committed status of the template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateLimitData` object
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
if policy is None:
raise ValueError('policy must be provided')
policy = convert_model(policy)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_policy_template_version',
)
headers.update(sdk_headers)
data = {
'policy': policy,
'name': name,
'description': description,
'committed': committed,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_template_id']
path_param_values = self.encode_path_vars(policy_template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}/versions'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def list_policy_template_versions(
self,
policy_template_id: str,
*,
state: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Retrieve policy template versions.
Retrieve the versions of a policy template by providing a policy template ID.
:param str policy_template_id: The policy template ID.
:param str state: (optional) The policy template state.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateVersionsCollection` object
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_policy_template_versions',
)
headers.update(sdk_headers)
params = {
'state': state,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_template_id']
path_param_values = self.encode_path_vars(policy_template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}/versions'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def replace_policy_template(
self,
policy_template_id: str,
version: str,
if_match: str,
policy: 'TemplatePolicy',
*,
name: Optional[str] = None,
description: Optional[str] = None,
committed: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Update a policy template version.
Update a specific version of a policy template. You can use this only if the
version isn't committed.
:param str policy_template_id: The policy template ID.
:param str version: The policy template version.
:param str if_match: The revision number for updating a policy template
version and must match the ETag value of the existing policy template
version. The Etag can be retrieved using the GET
/v1/policy_templates/{policy_template_id}/versions/{version} API and
looking at the ETag response header.
:param TemplatePolicy policy: The core set of properties associated with
the template's policy objet.
:param str name: (optional) Required field when creating a new template.
Otherwise this field is optional. If the field is included it will change
the name value for all existing versions of the template.
:param str description: (optional) Description of the policy template. This
is shown to users in the enterprise account. Use this to describe the
purpose or context of the policy for enterprise users managing IAM
templates.
:param bool committed: (optional) Committed status of the template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplate` object
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
if not version:
raise ValueError('version must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if policy is None:
raise ValueError('policy must be provided')
policy = convert_model(policy)
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='replace_policy_template',
)
headers.update(sdk_headers)
data = {
'policy': policy,
'name': name,
'description': description,
'committed': committed,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_template_id', 'version']
path_param_values = self.encode_path_vars(policy_template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='PUT',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_policy_template_version(
self,
policy_template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a policy template version.
Delete a specific version of a policy template by providing a policy template ID
and version number. You can't delete a policy template version that is assigned to
one or more child accounts. You must remove the policy assignments first.
:param str policy_template_id: The policy template ID.
:param str version: The policy template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_policy_template_version',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['policy_template_id', 'version']
path_param_values = self.encode_path_vars(policy_template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def get_policy_template_version(
self,
policy_template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Retrieve a policy template version.
Retrieve a policy template by providing a policy template ID and version number.
:param str policy_template_id: The policy template ID.
:param str version: The policy template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplate` object
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_policy_template_version',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_template_id', 'version']
path_param_values = self.encode_path_vars(policy_template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}/versions/{version}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
def commit_policy_template(
self,
policy_template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Commit a policy template version.
Commit a policy template version. You can make no further changes to the policy
template once it's committed. If you need to make updates after committing a
version, create a new version.
:param str policy_template_id: The policy template ID.
:param str version: The policy template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='commit_policy_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['policy_template_id', 'version']
path_param_values = self.encode_path_vars(policy_template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}/versions/{version}/commit'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
#########################
# Policy assignments
#########################
def list_policy_assignments(
self,
version: str,
account_id: str,
*,
accept_language: Optional[str] = None,
template_id: Optional[str] = None,
template_version: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Get policy template assignments.
Get policy template assignments by attributes. The following attributes are
supported:
`account_id`, `template_id`, `template_version`, `sort`.
`account_id` is a required query parameter. Only policy template assignments that
have the specified attributes and that the caller has read access to are returned.
If the caller does not have read access to any policy template assignments an
empty array is returned.
:param str version: specify version of response body format.
:param str account_id: The account GUID in which the policies belong to.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param str template_id: (optional) Optional template id.
:param str template_version: (optional) Optional policy template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateAssignmentCollection` object
"""
if not version:
raise ValueError('version must be provided')
if not account_id:
raise ValueError('account_id must be provided')
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='list_policy_assignments',
)
headers.update(sdk_headers)
params = {
'version': version,
'account_id': account_id,
'template_id': template_id,
'template_version': template_version,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/policy_assignments'
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def create_policy_template_assignment(
self,
version: str,
target: 'AssignmentTargetDetails',
options: 'PolicyAssignmentV1Options',
templates: List['AssignmentTemplateDetails'],
*,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a policy authorization template assignment.
Assign a policy template to child accounts and account groups. This creates the
policy in the accounts and account groups that you specify.
:param str version: specify version of response body format.
:param AssignmentTargetDetails target: assignment target account and type.
:param PolicyAssignmentV1Options options: The set of properties required
for a policy assignment.
:param List[AssignmentTemplateDetails] templates: List of template details
for policy assignment.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyAssignmentV1Collection` object
"""
if not version:
raise ValueError('version must be provided')
if target is None:
raise ValueError('target must be provided')
if options is None:
raise ValueError('options must be provided')
if templates is None:
raise ValueError('templates must be provided')
target = convert_model(target)
options = convert_model(options)
templates = [convert_model(x) for x in templates]
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_policy_template_assignment',
)
headers.update(sdk_headers)
params = {
'version': version,
}
data = {
'target': target,
'options': options,
'templates': templates,
}
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/policy_assignments'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
def get_policy_assignment(
self,
assignment_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Retrieve a policy assignment.
Retrieve a policy template assignment by providing a policy assignment ID.
:param str assignment_id: The policy template assignment ID.
:param str version: specify version of response body format.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `GetPolicyAssignmentResponse` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='get_policy_assignment',
)
headers.update(sdk_headers)
params = {
'version': version,
}
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['assignment_id']
path_param_values = self.encode_path_vars(assignment_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_assignments/{assignment_id}'.format(**path_param_dict)
request = self.prepare_request(
method='GET',
url=url,
headers=headers,
params=params,
)
response = self.send(request, **kwargs)
return response
def update_policy_assignment(
self,
assignment_id: str,
version: str,
if_match: str,
template_version: str,
**kwargs,
) -> DetailedResponse:
"""
Update a policy authorization type assignment.
Update a policy assignment by providing a policy assignment ID.
:param str assignment_id: The policy template assignment ID.
:param str version: specify version of response body format.
:param str if_match: The revision number for updating a policy assignment
and must match the ETag value of the existing policy assignment. The Etag
can be retrieved using the GET /v1/policy_assignments/{assignment_id} API
and looking at the ETag response header.
:param str template_version: The policy template version to update to.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyAssignmentV1` object
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
if not version:
raise ValueError('version must be provided')
if not if_match:
raise ValueError('if_match must be provided')
if template_version is None:
raise ValueError('template_version must be provided')
headers = {
'If-Match': if_match,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='update_policy_assignment',
)
headers.update(sdk_headers)
params = {
'version': version,
}
data = {
'template_version': template_version,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['assignment_id']
path_param_values = self.encode_path_vars(assignment_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_assignments/{assignment_id}'.format(**path_param_dict)
request = self.prepare_request(
method='PATCH',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
def delete_policy_assignment(
self,
assignment_id: str,
**kwargs,
) -> DetailedResponse:
"""
Remove a policy assignment.
Remove a policy template assignment by providing a policy assignment ID. You can't
delete a policy assignment if the status is "in_progress".
:param str assignment_id: The policy template assignment ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not assignment_id:
raise ValueError('assignment_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_policy_assignment',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['assignment_id']
path_param_values = self.encode_path_vars(assignment_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_assignments/{assignment_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(authenticator: ibm_cloud_sdk_core.authenticators.authenticator.Authenticator = None) -> None
|
719,760 |
ibm_platform_services.iam_policy_management_v1
|
__init__
|
Construct a new client for the iam_policy_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 iam_policy_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,765 |
ibm_platform_services.iam_policy_management_v1
|
commit_policy_template
|
Commit a policy template version.
Commit a policy template version. You can make no further changes to the policy
template once it's committed. If you need to make updates after committing a
version, create a new version.
:param str policy_template_id: The policy template ID.
:param str version: The policy template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def commit_policy_template(
self,
policy_template_id: str,
version: str,
**kwargs,
) -> DetailedResponse:
"""
Commit a policy template version.
Commit a policy template version. You can make no further changes to the policy
template once it's committed. If you need to make updates after committing a
version, create a new version.
:param str policy_template_id: The policy template ID.
:param str version: The policy template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
if not version:
raise ValueError('version must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='commit_policy_template',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['policy_template_id', 'version']
path_param_values = self.encode_path_vars(policy_template_id, version)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}/versions/{version}/commit'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, policy_template_id: str, version: str, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,767 |
ibm_platform_services.iam_policy_management_v1
|
create_policy
|
Create a policy.
Creates a policy to grant access between a subject and a resource. There are two
types of policies: **access** and **authorization**. A policy administrator might
want to create an access policy which grants access to a user, service-id, or an
access group. They might also want to create an authorization policy and setup
access between services.
### Access
To create an access policy, use **`"type": "access"`** in the body. The possible
subject attributes are **`iam_id`** and **`access_group_id`**. Use the
**`iam_id`** subject attribute for assigning access for a user or service-id. Use
the **`access_group_id`** subject attribute for assigning access for an access
group. Assign roles that are supported by the service or platform roles. For more
information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). Use only the
resource attributes supported by the service. To view a service's or the
platform's supported attributes, check the [documentation](/docs?tab=all-docs).
The policy resource must include either the **`serviceType`**, **`serviceName`**,
**`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`**
attribute. The IAM Services group (`IAM`) is a subset of account management
services that includes the IAM platform services IAM Identity, IAM Access
Management, IAM Users Management, IAM Groups, and future IAM services. If the
subject is a locked service-id, the request will fail.
### Authorization
Authorization policies are supported by services on a case by case basis. Refer to
service documentation to verify their support of authorization policies. To create
an authorization policy, use **`"type": "authorization"`** in the body. The
subject attributes must match the supported authorization subjects of the
resource. Multiple subject attributes might be provided. The following attributes
are supported:
serviceName, serviceInstance, region, resourceType, resource, accountId,
resourceGroupId Assign roles that are supported by the service or platform roles.
For more information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). The user must
also have the same level of access or greater to the target resource in order to
grant the role. Use only the resource attributes supported by the service. To view
a service's or the platform's supported attributes, check the
[documentation](/docs?tab=all-docs). Both the policy subject and the policy
resource must include the **`accountId`** attributes. The policy subject must
include either **`serviceName`** or **`resourceGroupId`** (or both) attributes.
### Attribute Operators
Currently, only the `stringEquals` and the `stringMatch` operators are available.
Resource attributes may support one or both operators. For more information, see
[Assigning access by using wildcard
policies](https://cloud.ibm.com/docs/account?topic=account-wildcard).
### Attribute Validations
Policy attribute values must be between 1 and 1,000 characters in length. If
location related attributes like geography, country, metro, region, satellite, and
locationvalues are supported by the service, they are validated against Global
Catalog locations.
:param str type: The policy type; either 'access' or 'authorization'.
:param List[PolicySubject] subjects: The subjects associated with a policy.
:param List[PolicyRole] roles: A set of role cloud resource names (CRNs)
granted by the policy.
:param List[PolicyResource] resources: The resources associated with a
policy.
:param str description: (optional) Customer-defined description.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Policy` object
|
def create_policy(
self,
type: str,
subjects: List['PolicySubject'],
roles: List['PolicyRole'],
resources: List['PolicyResource'],
*,
description: Optional[str] = None,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a policy.
Creates a policy to grant access between a subject and a resource. There are two
types of policies: **access** and **authorization**. A policy administrator might
want to create an access policy which grants access to a user, service-id, or an
access group. They might also want to create an authorization policy and setup
access between services.
### Access
To create an access policy, use **`"type": "access"`** in the body. The possible
subject attributes are **`iam_id`** and **`access_group_id`**. Use the
**`iam_id`** subject attribute for assigning access for a user or service-id. Use
the **`access_group_id`** subject attribute for assigning access for an access
group. Assign roles that are supported by the service or platform roles. For more
information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). Use only the
resource attributes supported by the service. To view a service's or the
platform's supported attributes, check the [documentation](/docs?tab=all-docs).
The policy resource must include either the **`serviceType`**, **`serviceName`**,
**`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`**
attribute. The IAM Services group (`IAM`) is a subset of account management
services that includes the IAM platform services IAM Identity, IAM Access
Management, IAM Users Management, IAM Groups, and future IAM services. If the
subject is a locked service-id, the request will fail.
### Authorization
Authorization policies are supported by services on a case by case basis. Refer to
service documentation to verify their support of authorization policies. To create
an authorization policy, use **`"type": "authorization"`** in the body. The
subject attributes must match the supported authorization subjects of the
resource. Multiple subject attributes might be provided. The following attributes
are supported:
serviceName, serviceInstance, region, resourceType, resource, accountId,
resourceGroupId Assign roles that are supported by the service or platform roles.
For more information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). The user must
also have the same level of access or greater to the target resource in order to
grant the role. Use only the resource attributes supported by the service. To view
a service's or the platform's supported attributes, check the
[documentation](/docs?tab=all-docs). Both the policy subject and the policy
resource must include the **`accountId`** attributes. The policy subject must
include either **`serviceName`** or **`resourceGroupId`** (or both) attributes.
### Attribute Operators
Currently, only the `stringEquals` and the `stringMatch` operators are available.
Resource attributes may support one or both operators. For more information, see
[Assigning access by using wildcard
policies](https://cloud.ibm.com/docs/account?topic=account-wildcard).
### Attribute Validations
Policy attribute values must be between 1 and 1,000 characters in length. If
location related attributes like geography, country, metro, region, satellite, and
locationvalues are supported by the service, they are validated against Global
Catalog locations.
:param str type: The policy type; either 'access' or 'authorization'.
:param List[PolicySubject] subjects: The subjects associated with a policy.
:param List[PolicyRole] roles: A set of role cloud resource names (CRNs)
granted by the policy.
:param List[PolicyResource] resources: The resources associated with a
policy.
:param str description: (optional) Customer-defined description.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `Policy` object
"""
if type is None:
raise ValueError('type must be provided')
if subjects is None:
raise ValueError('subjects must be provided')
if roles is None:
raise ValueError('roles must be provided')
if resources is None:
raise ValueError('resources must be provided')
subjects = [convert_model(x) for x in subjects]
roles = [convert_model(x) for x in roles]
resources = [convert_model(x) for x in resources]
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_policy',
)
headers.update(sdk_headers)
data = {
'type': type,
'subjects': subjects,
'roles': roles,
'resources': resources,
'description': description,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/policies'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, type: str, subjects: List[ibm_platform_services.iam_policy_management_v1.PolicySubject], roles: List[ibm_platform_services.iam_policy_management_v1.PolicyRole], resources: List[ibm_platform_services.iam_policy_management_v1.PolicyResource], *, description: Optional[str] = None, accept_language: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,768 |
ibm_platform_services.iam_policy_management_v1
|
create_policy_template
|
Create a policy template.
Create a policy template. Policy templates define a policy without requiring a
subject, and you can use them to grant access to multiple subjects.
:param str name: Required field when creating a new template. Otherwise
this field is optional. If the field is included it will change the name
value for all existing versions of the template.
:param str account_id: Enterprise account ID where this template will be
created.
:param TemplatePolicy policy: The core set of properties associated with
the template's policy objet.
:param str description: (optional) Description of the policy template. This
is shown to users in the enterprise account. Use this to describe the
purpose or context of the policy for enterprise users managing IAM
templates.
:param bool committed: (optional) Committed status of the template.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateLimitData` object
|
def create_policy_template(
self,
name: str,
account_id: str,
policy: 'TemplatePolicy',
*,
description: Optional[str] = None,
committed: Optional[bool] = None,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a policy template.
Create a policy template. Policy templates define a policy without requiring a
subject, and you can use them to grant access to multiple subjects.
:param str name: Required field when creating a new template. Otherwise
this field is optional. If the field is included it will change the name
value for all existing versions of the template.
:param str account_id: Enterprise account ID where this template will be
created.
:param TemplatePolicy policy: The core set of properties associated with
the template's policy objet.
:param str description: (optional) Description of the policy template. This
is shown to users in the enterprise account. Use this to describe the
purpose or context of the policy for enterprise users managing IAM
templates.
:param bool committed: (optional) Committed status of the template.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateLimitData` object
"""
if name is None:
raise ValueError('name must be provided')
if account_id is None:
raise ValueError('account_id must be provided')
if policy is None:
raise ValueError('policy must be provided')
policy = convert_model(policy)
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_policy_template',
)
headers.update(sdk_headers)
data = {
'name': name,
'account_id': account_id,
'policy': policy,
'description': description,
'committed': committed,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v1/policy_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, policy: ibm_platform_services.iam_policy_management_v1.TemplatePolicy, *, description: Optional[str] = None, committed: Optional[bool] = None, accept_language: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,769 |
ibm_platform_services.iam_policy_management_v1
|
create_policy_template_assignment
|
Create a policy authorization template assignment.
Assign a policy template to child accounts and account groups. This creates the
policy in the accounts and account groups that you specify.
:param str version: specify version of response body format.
:param AssignmentTargetDetails target: assignment target account and type.
:param PolicyAssignmentV1Options options: The set of properties required
for a policy assignment.
:param List[AssignmentTemplateDetails] templates: List of template details
for policy assignment.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyAssignmentV1Collection` object
|
def create_policy_template_assignment(
self,
version: str,
target: 'AssignmentTargetDetails',
options: 'PolicyAssignmentV1Options',
templates: List['AssignmentTemplateDetails'],
*,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a policy authorization template assignment.
Assign a policy template to child accounts and account groups. This creates the
policy in the accounts and account groups that you specify.
:param str version: specify version of response body format.
:param AssignmentTargetDetails target: assignment target account and type.
:param PolicyAssignmentV1Options options: The set of properties required
for a policy assignment.
:param List[AssignmentTemplateDetails] templates: List of template details
for policy assignment.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyAssignmentV1Collection` object
"""
if not version:
raise ValueError('version must be provided')
if target is None:
raise ValueError('target must be provided')
if options is None:
raise ValueError('options must be provided')
if templates is None:
raise ValueError('templates must be provided')
target = convert_model(target)
options = convert_model(options)
templates = [convert_model(x) for x in templates]
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_policy_template_assignment',
)
headers.update(sdk_headers)
params = {
'version': version,
}
data = {
'target': target,
'options': options,
'templates': templates,
}
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/policy_assignments'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
params=params,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, version: str, target: ibm_platform_services.iam_policy_management_v1.AssignmentTargetDetails, options: ibm_platform_services.iam_policy_management_v1.PolicyAssignmentV1Options, templates: List[ibm_platform_services.iam_policy_management_v1.AssignmentTemplateDetails], *, accept_language: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,770 |
ibm_platform_services.iam_policy_management_v1
|
create_policy_template_version
|
Create a new policy template version.
Create a new version of a policy template. Use this if you need to make updates to
a policy template that is committed.
:param str policy_template_id: The policy template ID.
:param TemplatePolicy policy: The core set of properties associated with
the template's policy objet.
:param str name: (optional) Required field when creating a new template.
Otherwise this field is optional. If the field is included it will change
the name value for all existing versions of the template.
:param str description: (optional) Description of the policy template. This
is shown to users in the enterprise account. Use this to describe the
purpose or context of the policy for enterprise users managing IAM
templates.
:param bool committed: (optional) Committed status of the template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateLimitData` object
|
def create_policy_template_version(
self,
policy_template_id: str,
policy: 'TemplatePolicy',
*,
name: Optional[str] = None,
description: Optional[str] = None,
committed: Optional[bool] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a new policy template version.
Create a new version of a policy template. Use this if you need to make updates to
a policy template that is committed.
:param str policy_template_id: The policy template ID.
:param TemplatePolicy policy: The core set of properties associated with
the template's policy objet.
:param str name: (optional) Required field when creating a new template.
Otherwise this field is optional. If the field is included it will change
the name value for all existing versions of the template.
:param str description: (optional) Description of the policy template. This
is shown to users in the enterprise account. Use this to describe the
purpose or context of the policy for enterprise users managing IAM
templates.
:param bool committed: (optional) Committed status of the template version.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `PolicyTemplateLimitData` object
"""
if not policy_template_id:
raise ValueError('policy_template_id must be provided')
if policy is None:
raise ValueError('policy must be provided')
policy = convert_model(policy)
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_policy_template_version',
)
headers.update(sdk_headers)
data = {
'policy': policy,
'name': name,
'description': description,
'committed': committed,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
path_param_keys = ['policy_template_id']
path_param_values = self.encode_path_vars(policy_template_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policy_templates/{policy_template_id}/versions'.format(**path_param_dict)
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, policy_template_id: str, policy: ibm_platform_services.iam_policy_management_v1.TemplatePolicy, *, name: Optional[str] = None, description: Optional[str] = None, committed: Optional[bool] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,771 |
ibm_platform_services.iam_policy_management_v1
|
create_role
|
Create a role.
Creates a custom role for a specific service within the account. An account owner
or a user assigned the Administrator role on the Role management service can
create a custom role. Any number of actions for a single service can be mapped to
the new role, but there must be at least one service-defined action to
successfully create the new role.
:param str display_name: The display name of the role that is shown in the
console.
:param List[str] actions: The actions of the role. For more information,
see [IAM roles and
actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions).
:param str name: The name of the role that is used in the CRN. Can only be
alphanumeric and has to be capitalized.
:param str account_id: The account GUID.
:param str service_name: The service name.
:param str description: (optional) The description of the role.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CustomRole` object
|
def create_role(
self,
display_name: str,
actions: List[str],
name: str,
account_id: str,
service_name: str,
*,
description: Optional[str] = None,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a role.
Creates a custom role for a specific service within the account. An account owner
or a user assigned the Administrator role on the Role management service can
create a custom role. Any number of actions for a single service can be mapped to
the new role, but there must be at least one service-defined action to
successfully create the new role.
:param str display_name: The display name of the role that is shown in the
console.
:param List[str] actions: The actions of the role. For more information,
see [IAM roles and
actions](https://cloud.ibm.com/docs/account?topic=account-iam-service-roles-actions).
:param str name: The name of the role that is used in the CRN. Can only be
alphanumeric and has to be capitalized.
:param str account_id: The account GUID.
:param str service_name: The service name.
:param str description: (optional) The description of the role.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `CustomRole` object
"""
if display_name is None:
raise ValueError('display_name must be provided')
if actions is None:
raise ValueError('actions must be provided')
if name is None:
raise ValueError('name must be provided')
if account_id is None:
raise ValueError('account_id must be provided')
if service_name is None:
raise ValueError('service_name must be provided')
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_role',
)
headers.update(sdk_headers)
data = {
'display_name': display_name,
'actions': actions,
'name': name,
'account_id': account_id,
'service_name': service_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/roles'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, display_name: str, actions: List[str], name: str, account_id: str, service_name: str, *, description: Optional[str] = None, accept_language: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,772 |
ibm_platform_services.iam_policy_management_v1
|
create_v2_policy
|
Create a policy.
Creates a policy to grant access between a subject and a resource. Currently,
there is one type of a v2/policy: **access**. A policy administrator might want to
create an access policy that grants access to a user, service-id, or an access
group.
### Access
To create an access policy, use **`"type": "access"`** in the body. The supported
subject attributes are **`iam_id`** and **`access_group_id`**. Use the
**`iam_id`** subject attribute to assign access to a user or service-id. Use the
**`access_group_id`** subject attribute to assign access to an access group.
Assign roles that are supported by the service or platform roles. For more
information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). Use only the
resource attributes supported by the service. To view a service's or the
platform's supported attributes, check the [documentation](/docs?tab=all-docs).
The policy resource must include either the **`serviceType`**, **`serviceName`**,
**`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`**
attribute. In the rule field, you can specify a single condition by using
**`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`**
with a combination **`operator`**. The possible combination operators are
**`and`** and **`or`**.
Currently, we support two types of patterns:
1. `time-based`: Used to specify a time-based restriction
Combine conditions to specify a time-based restriction (e.g., access only during
business hours, during the Monday-Friday work week). For example, a policy can
grant access Monday-Friday, 9:00am-5:00pm using the following rule:
```json
"rule": {
"operator": "and",
"conditions": [{
"key": "{{environment.attributes.day_of_week}}",
"operator": "dayOfWeekAnyOf",
"value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"]
},
"key": "{{environment.attributes.current_time}}",
"operator": "timeGreaterThanOrEquals",
"value": "09:00:00+00:00"
},
"key": "{{environment.attributes.current_time}}",
"operator": "timeLessThanOrEquals",
"value": "17:00:00+00:00"
}]
}
``` You can use the following operators in the **`key`** and **`value`** pair:
```
'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan',
'timeGreaterThanOrEquals',
'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan',
'dateGreaterThanOrEquals',
'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan',
'dateTimeGreaterThanOrEquals',
'dayOfWeekEquals', 'dayOfWeekAnyOf'
``` The pattern field that matches the rule is required when rule is provided. For
the business hour rule example above, the **`pattern`** is
**`"time-based-conditions:weekly"`**. For more information, see [Time-based
conditions
operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties)
and
[Limiting access with time-based
conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the
subject is a locked service-id, the request will fail.
2. `attribute-based`: Used to specify a combination of OR/AND based conditions
applied on resource attributes.
Combine conditions to specify an attribute-based condition using AND/OR-based
operators.
For example, a policy can grant access based on multiple conditions applied on the
resource attributes below:
```json
"pattern": "attribute-based-condition:resource:literal-and-wildcard"
"rule": {
"operator": "or",
"conditions": [
{
"operator": "and",
"conditions": [
{
"key": "{{resource.attributes.prefix}}",
"operator": "stringEquals",
"value": "home/test"
},
{
"key": "{{environment.attributes.delimiter}}",
"operator": "stringEquals",
"value": "/"
}
]
},
{
"key": "{{resource.attributes.path}}",
"operator": "stringMatch",
"value": "home/David/*"
}
]
}
```
In addition to satisfying the `resources` section, the policy grants permission
only if either the `path` begins with `home/David/` **OR** the `prefix` is
`home/test` and the `delimiter` is `/`. This mechanism helps you consolidate
multiple policies in to a single policy, making policies easier to administer and
stay within the policy limit for an account. View the list of operators that can
be used in the condition
[here](/docs/account?topic=account-wildcard#string-comparisons).
### Authorization
Authorization policies are supported by services on a case by case basis. Refer to
service documentation to verify their support of authorization policies. To create
an authorization policy, use **`"type": "authorization"`** in the body. The
subject attributes must match the supported authorization subjects of the
resource. Multiple subject attributes might be provided. The following attributes
are supported:
serviceName, serviceInstance, region, resourceType, resource, accountId,
resourceGroupId Assign roles that are supported by the service or platform roles.
For more information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). The user must
also have the same level of access or greater to the target resource in order to
grant the role. Use only the resource attributes supported by the service. To view
a service's or the platform's supported attributes, check the
[documentation](/docs?tab=all-docs). Both the policy subject and the policy
resource must include the **`accountId`** attributes. The policy subject must
include either **`serviceName`** or **`resourceGroupId`** (or both) attributes.
### Attribute Operators
Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators
are available. For more information, see [Assigning access by using wildcard
policies](https://cloud.ibm.com/docs/account?topic=account-wildcard).
### Attribute Validations
Policy attribute values must be between 1 and 1,000 characters in length. If
location related attributes like geography, country, metro, region, satellite, and
locationvalues are supported by the service, they are validated against Global
Catalog locations.
:param Control control: Specifies the type of access granted by the policy.
:param str type: The policy type; either 'access' or 'authorization'.
:param str description: (optional) Description of the policy.
:param V2PolicySubject subject: (optional) The subject attributes for whom
the policy grants access.
:param V2PolicyResource resource: (optional) The resource attributes to
which the policy grants access.
:param str pattern: (optional) Indicates pattern of rule, either
'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or
'time-based-conditions:weekly:custom-hours'.
:param V2PolicyRule rule: (optional) Additional access conditions
associated with the policy.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `V2Policy` object
|
def create_v2_policy(
self,
control: 'Control',
type: str,
*,
description: Optional[str] = None,
subject: Optional['V2PolicySubject'] = None,
resource: Optional['V2PolicyResource'] = None,
pattern: Optional[str] = None,
rule: Optional['V2PolicyRule'] = None,
accept_language: Optional[str] = None,
**kwargs,
) -> DetailedResponse:
"""
Create a policy.
Creates a policy to grant access between a subject and a resource. Currently,
there is one type of a v2/policy: **access**. A policy administrator might want to
create an access policy that grants access to a user, service-id, or an access
group.
### Access
To create an access policy, use **`"type": "access"`** in the body. The supported
subject attributes are **`iam_id`** and **`access_group_id`**. Use the
**`iam_id`** subject attribute to assign access to a user or service-id. Use the
**`access_group_id`** subject attribute to assign access to an access group.
Assign roles that are supported by the service or platform roles. For more
information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). Use only the
resource attributes supported by the service. To view a service's or the
platform's supported attributes, check the [documentation](/docs?tab=all-docs).
The policy resource must include either the **`serviceType`**, **`serviceName`**,
**`resourceGroupId`** or **`service_group_id`** attribute and the **`accountId`**
attribute. In the rule field, you can specify a single condition by using
**`key`**, **`value`**, and condition **`operator`**, or a set of **`conditions`**
with a combination **`operator`**. The possible combination operators are
**`and`** and **`or`**.
Currently, we support two types of patterns:
1. `time-based`: Used to specify a time-based restriction
Combine conditions to specify a time-based restriction (e.g., access only during
business hours, during the Monday-Friday work week). For example, a policy can
grant access Monday-Friday, 9:00am-5:00pm using the following rule:
```json
"rule": {
"operator": "and",
"conditions": [{
"key": "{{environment.attributes.day_of_week}}",
"operator": "dayOfWeekAnyOf",
"value": ["1+00:00", "2+00:00", "3+00:00", "4+00:00", "5+00:00"]
},
"key": "{{environment.attributes.current_time}}",
"operator": "timeGreaterThanOrEquals",
"value": "09:00:00+00:00"
},
"key": "{{environment.attributes.current_time}}",
"operator": "timeLessThanOrEquals",
"value": "17:00:00+00:00"
}]
}
``` You can use the following operators in the **`key`** and **`value`** pair:
```
'timeLessThan', 'timeLessThanOrEquals', 'timeGreaterThan',
'timeGreaterThanOrEquals',
'dateLessThan', 'dateLessThanOrEquals', 'dateGreaterThan',
'dateGreaterThanOrEquals',
'dateTimeLessThan', 'dateTimeLessThanOrEquals', 'dateTimeGreaterThan',
'dateTimeGreaterThanOrEquals',
'dayOfWeekEquals', 'dayOfWeekAnyOf'
``` The pattern field that matches the rule is required when rule is provided. For
the business hour rule example above, the **`pattern`** is
**`"time-based-conditions:weekly"`**. For more information, see [Time-based
conditions
operators](/docs/account?topic=account-iam-condition-properties&interface=ui#policy-condition-properties)
and
[Limiting access with time-based
conditions](/docs/account?topic=account-iam-time-based&interface=ui). If the
subject is a locked service-id, the request will fail.
2. `attribute-based`: Used to specify a combination of OR/AND based conditions
applied on resource attributes.
Combine conditions to specify an attribute-based condition using AND/OR-based
operators.
For example, a policy can grant access based on multiple conditions applied on the
resource attributes below:
```json
"pattern": "attribute-based-condition:resource:literal-and-wildcard"
"rule": {
"operator": "or",
"conditions": [
{
"operator": "and",
"conditions": [
{
"key": "{{resource.attributes.prefix}}",
"operator": "stringEquals",
"value": "home/test"
},
{
"key": "{{environment.attributes.delimiter}}",
"operator": "stringEquals",
"value": "/"
}
]
},
{
"key": "{{resource.attributes.path}}",
"operator": "stringMatch",
"value": "home/David/*"
}
]
}
```
In addition to satisfying the `resources` section, the policy grants permission
only if either the `path` begins with `home/David/` **OR** the `prefix` is
`home/test` and the `delimiter` is `/`. This mechanism helps you consolidate
multiple policies in to a single policy, making policies easier to administer and
stay within the policy limit for an account. View the list of operators that can
be used in the condition
[here](/docs/account?topic=account-wildcard#string-comparisons).
### Authorization
Authorization policies are supported by services on a case by case basis. Refer to
service documentation to verify their support of authorization policies. To create
an authorization policy, use **`"type": "authorization"`** in the body. The
subject attributes must match the supported authorization subjects of the
resource. Multiple subject attributes might be provided. The following attributes
are supported:
serviceName, serviceInstance, region, resourceType, resource, accountId,
resourceGroupId Assign roles that are supported by the service or platform roles.
For more information, see [IAM roles and
actions](/docs/account?topic=account-iam-service-roles-actions). The user must
also have the same level of access or greater to the target resource in order to
grant the role. Use only the resource attributes supported by the service. To view
a service's or the platform's supported attributes, check the
[documentation](/docs?tab=all-docs). Both the policy subject and the policy
resource must include the **`accountId`** attributes. The policy subject must
include either **`serviceName`** or **`resourceGroupId`** (or both) attributes.
### Attribute Operators
Currently, only the `stringEquals`, `stringMatch`, and `stringEquals` operators
are available. For more information, see [Assigning access by using wildcard
policies](https://cloud.ibm.com/docs/account?topic=account-wildcard).
### Attribute Validations
Policy attribute values must be between 1 and 1,000 characters in length. If
location related attributes like geography, country, metro, region, satellite, and
locationvalues are supported by the service, they are validated against Global
Catalog locations.
:param Control control: Specifies the type of access granted by the policy.
:param str type: The policy type; either 'access' or 'authorization'.
:param str description: (optional) Description of the policy.
:param V2PolicySubject subject: (optional) The subject attributes for whom
the policy grants access.
:param V2PolicyResource resource: (optional) The resource attributes to
which the policy grants access.
:param str pattern: (optional) Indicates pattern of rule, either
'time-based-conditions:once', 'time-based-conditions:weekly:all-day', or
'time-based-conditions:weekly:custom-hours'.
:param V2PolicyRule rule: (optional) Additional access conditions
associated with the policy.
:param str accept_language: (optional) Language code for translations
* `default` - English
* `de` - German (Standard)
* `en` - English
* `es` - Spanish (Spain)
* `fr` - French (Standard)
* `it` - Italian (Standard)
* `ja` - Japanese
* `ko` - Korean
* `pt-br` - Portuguese (Brazil)
* `zh-cn` - Chinese (Simplified, PRC)
* `zh-tw` - (Chinese, Taiwan).
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse with `dict` result representing a `V2Policy` object
"""
if control is None:
raise ValueError('control must be provided')
if type is None:
raise ValueError('type must be provided')
control = convert_model(control)
if subject is not None:
subject = convert_model(subject)
if resource is not None:
resource = convert_model(resource)
if rule is not None:
rule = convert_model(rule)
headers = {
'Accept-Language': accept_language,
}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='create_v2_policy',
)
headers.update(sdk_headers)
data = {
'control': control,
'type': type,
'description': description,
'subject': subject,
'resource': resource,
'pattern': pattern,
'rule': rule,
}
data = {k: v for (k, v) in data.items() if v is not None}
data = json.dumps(data)
headers['content-type'] = 'application/json'
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
headers['Accept'] = 'application/json'
url = '/v2/policies'
request = self.prepare_request(
method='POST',
url=url,
headers=headers,
data=data,
)
response = self.send(request, **kwargs)
return response
|
(self, control: ibm_platform_services.iam_policy_management_v1.Control, type: str, *, description: Optional[str] = None, subject: Optional[ibm_platform_services.iam_policy_management_v1.V2PolicySubject] = None, resource: Optional[ibm_platform_services.iam_policy_management_v1.V2PolicyResource] = None, pattern: Optional[str] = None, rule: Optional[ibm_platform_services.iam_policy_management_v1.V2PolicyRule] = None, accept_language: Optional[str] = None, **kwargs) -> ibm_cloud_sdk_core.detailed_response.DetailedResponse
|
719,773 |
ibm_platform_services.iam_policy_management_v1
|
delete_policy
|
Delete a policy by ID.
Delete a policy by providing a policy ID. A policy cannot be deleted if the
subject ID contains a locked service ID. If the subject of the policy is a locked
service-id, the request will fail.
:param str policy_id: The policy ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
|
def delete_policy(
self,
policy_id: str,
**kwargs,
) -> DetailedResponse:
"""
Delete a policy by ID.
Delete a policy by providing a policy ID. A policy cannot be deleted if the
subject ID contains a locked service ID. If the subject of the policy is a locked
service-id, the request will fail.
:param str policy_id: The policy ID.
:param dict headers: A `dict` containing the request headers
:return: A `DetailedResponse` containing the result, headers and HTTP status code.
:rtype: DetailedResponse
"""
if not policy_id:
raise ValueError('policy_id must be provided')
headers = {}
sdk_headers = get_sdk_headers(
service_name=self.DEFAULT_SERVICE_NAME,
service_version='V1',
operation_id='delete_policy',
)
headers.update(sdk_headers)
if 'headers' in kwargs:
headers.update(kwargs.get('headers'))
del kwargs['headers']
path_param_keys = ['policy_id']
path_param_values = self.encode_path_vars(policy_id)
path_param_dict = dict(zip(path_param_keys, path_param_values))
url = '/v1/policies/{policy_id}'.format(**path_param_dict)
request = self.prepare_request(
method='DELETE',
url=url,
headers=headers,
)
response = self.send(request, **kwargs)
return response
|
(self, policy_id: str, **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.