CloudWatchOmni / Client / create_access_grant
create_access_grant¶
- CloudWatchOmni.Client.create_access_grant(**kwargs)¶
Creates an AccessGrant that authorizes a principal to perform a set of actions on resources in a space.
Optionally narrow the grant with scoped actions that limit it to specific resources and fields. Use ListAccessGrants and GetAccessGrant to retrieve grants, and DeleteAccessGrant to remove them.
See also: AWS API Documentation
Request Syntax
response = client.create_access_grant( domainId='string', spaceId='string', name='string', principal={ 'principalType': 'IDC_USER'|'IDC_GROUP'|'IAM_USER'|'IAM_ROLE'|'IAM_ROOT'|'ACCESS_PROFILE'|'ALERT'|'AGENT', 'principalId': 'string', 'principalAttributes': [ { 'key': 'string', 'value': 'string' }, ] }, permission='SPACE_ADMIN'|'READ'|'READ_WRITE_DELETE'|'CUSTOM', scopedActions=[ { 'actions': [ 'string', ], 'resources': [ { 'resourceType': 'string', 'resourceArns': [ 'string', ], 'tags': { 'string': 'string' }, 'signalTypes': [ 'LOGS'|'TRACES', ], 'rowScopeGroups': [ [ { 'field': 'string', 'operator': 'IN', 'values': [ 'string', ] }, ], ] }, ], 'contextConditions': { 'string': [ 'string', ] } }, ], tags={ 'string': 'string' }, clientToken='string' )
- Parameters:
domainId (string) –
[REQUIRED]
The ID of the domain that contains the space.
spaceId (string) –
[REQUIRED]
The ID of the space to scope the grant to.
name (string) –
[REQUIRED]
A name that identifies the access grant.
principal (dict) –
[REQUIRED]
The principal receiving the grant.
principalType (string) – [REQUIRED]
The type of principal receiving the grant.
principalId (string) –
The ID of the principal receiving the grant.
principalAttributes (list) –
Attribute conditions for attribute-based access. When provided, the grant targets any principal matching all specified conditions. Supported only for IDC_USER principals.
(dict) –
A single attribute condition used to match principals for attribute-based access.
key (string) – [REQUIRED]
The Identity Center user attribute to match on. One of userName, active, userStatus, displayName, email, name.givenName, name.familyName, enterprise.department, enterprise.division, enterprise.organization, enterprise.costCenter, or enterprise.employeeNumber. Each key may appear only once per grant.
value (string) – [REQUIRED]
The attribute value.
permission (string) –
[REQUIRED]
The permission to grant. Exactly one permission is granted per request.
scopedActions (list) –
Groups of actions to allow, each with the resource scopes and conditions that limit those actions.
(dict) –
A group of actions within an access grant, together with the resource scopes and context conditions that apply to exactly those actions.
actions (list) – [REQUIRED]
The actions this group applies to.
(string) –
A single scoped action in “vendor-code:Action” form (e.g. “bedrock:InvokeModel”). Wildcards are not permitted.
resources (list) –
Optional resource scopes constraining these actions to specific resources.
(dict) –
A single resource scope entry within an AccessGrant. Associates a resource type with optional ARN patterns, tag conditions, and row-level filters.
resourceType (string) – [REQUIRED]
Resource type name (e.g., “DataSet”, “OmniDashboard”).
resourceArns (list) –
Specific resource ARNs or ARN patterns. When set, actions are limited to these resources. When absent, defaults to “*”.
(string) –
tags (dict) –
Tag-based conditions for dynamic resource scoping. Access applies only to resources carrying all of the specified tag key/value pairs.
(string) –
(string) –
signalTypes (list) –
Signal types this scope’s row filtering applies to. Required when rowScopeGroups is set.
(string) –
Telemetry signal type that row-scoped access control applies to.
rowScopeGroups (list) –
Row-level filters for this scope, as an OR of AND-groups: a row is visible when it matches every filter in any one group. Requires signalTypes.
Row filters are additive across a principal’s matching grants. A signal type with no matching group is unrestricted, and when rowScopeGroups is omitted all rows are visible for all signal types.
(list) –
A group of row filters that must all match. A row satisfies the group only when it matches every filter in it.
(dict) –
A single additive row-level filter on an AccessGrant. A row is visible when its value for the given field matches the filter’s values. Row filters are additive: the visible rows are the union of all row filters across a principal’s matching grants.
field (string) – [REQUIRED]
The field (column) the allowlist applies to (e.g., “serviceName”, “accountId”).
operator (string) – [REQUIRED]
Match operator applied to this filter’s values.
values (list) – [REQUIRED]
The values the field is matched against.
(string) –
A single allowlist value for a RowScope field.
contextConditions (dict) –
Optional context conditions for fine-grained access control on these actions.
(string) –
(list) –
Generic list of strings.
(string) –
tags (dict) –
The tags to associate with the access grant.
(string) –
Tag key. Must be non-empty; AWS-standard maximum length. Constraining the key (rather than a bare String) rejects empty-key payloads at the edge with a 400 ValidationException instead of faulting downstream as a 500.
(string) –
Tag value. AWS-standard maximum length; may be empty.
clientToken (string) –
Idempotency token for safe retries. Repeated requests with the same token return the original result instead of creating a duplicate.
This field is autopopulated if not provided.
- Return type:
dict
- Returns:
Response Syntax
{ 'accessGrant': { 'grantId': 'string', 'grantArn': 'string', 'name': 'string', 'accountId': 'string', 'domainId': 'string', 'principal': { 'principalType': 'IDC_USER'|'IDC_GROUP'|'IAM_USER'|'IAM_ROLE'|'IAM_ROOT'|'ACCESS_PROFILE'|'ALERT'|'AGENT', 'principalId': 'string', 'principalAttributes': [ { 'key': 'string', 'value': 'string' }, ] }, 'permission': 'SPACE_ADMIN'|'READ'|'READ_WRITE_DELETE'|'CUSTOM', 'grantType': 'SERVICE_MANAGED'|'CUSTOMER_MANAGED', 'createdBy': 'string', 'createdAt': datetime(2015, 1, 1), 'updatedAt': datetime(2015, 1, 1), 'spaceId': 'string', 'scopedActions': [ { 'actions': [ 'string', ], 'resources': [ { 'resourceType': 'string', 'resourceArns': [ 'string', ], 'tags': { 'string': 'string' }, 'signalTypes': [ 'LOGS'|'TRACES', ], 'rowScopeGroups': [ [ { 'field': 'string', 'operator': 'IN', 'values': [ 'string', ] }, ], ] }, ], 'contextConditions': { 'string': [ 'string', ] } }, ] } }
Response Structure
(dict) –
accessGrant (dict) –
The details of the created access grant.
grantId (string) –
The unique ID of the access grant.
grantArn (string) –
The Amazon Resource Name (ARN) of the access grant.
name (string) –
A name that identifies the access grant.
accountId (string) –
The AWS account ID that owns the grant.
domainId (string) –
The ID of the domain the grant belongs to.
principal (dict) –
The principal receiving the grant.
principalType (string) –
The type of principal receiving the grant.
principalId (string) –
The ID of the principal receiving the grant.
principalAttributes (list) –
Attribute conditions for attribute-based access. When provided, the grant targets any principal matching all specified conditions. Supported only for IDC_USER principals.
(dict) –
A single attribute condition used to match principals for attribute-based access.
key (string) –
The Identity Center user attribute to match on. One of userName, active, userStatus, displayName, email, name.givenName, name.familyName, enterprise.department, enterprise.division, enterprise.organization, enterprise.costCenter, or enterprise.employeeNumber. Each key may appear only once per grant.
value (string) –
The attribute value.
permission (string) –
The permission granted.
grantType (string) –
Who manages the grant.
createdBy (string) –
The principal that created the grant.
createdAt (datetime) –
The timestamp when the grant was created.
updatedAt (datetime) –
The timestamp when the grant was last updated.
spaceId (string) –
The space this grant applies to. Domain-scoped grants are returned by ListDomainAccessGrantsForOrganization instead.
scopedActions (list) –
Groups of actions allowed by the grant, each with the resource scopes and conditions that limit those actions.
(dict) –
A group of actions within an access grant, together with the resource scopes and context conditions that apply to exactly those actions.
actions (list) –
The actions this group applies to.
(string) –
A single scoped action in “vendor-code:Action” form (e.g. “bedrock:InvokeModel”). Wildcards are not permitted.
resources (list) –
Optional resource scopes constraining these actions to specific resources.
(dict) –
A single resource scope entry within an AccessGrant. Associates a resource type with optional ARN patterns, tag conditions, and row-level filters.
resourceType (string) –
Resource type name (e.g., “DataSet”, “OmniDashboard”).
resourceArns (list) –
Specific resource ARNs or ARN patterns. When set, actions are limited to these resources. When absent, defaults to “*”.
(string) –
tags (dict) –
Tag-based conditions for dynamic resource scoping. Access applies only to resources carrying all of the specified tag key/value pairs.
(string) –
(string) –
signalTypes (list) –
Signal types this scope’s row filtering applies to. Required when rowScopeGroups is set.
(string) –
Telemetry signal type that row-scoped access control applies to.
rowScopeGroups (list) –
Row-level filters for this scope, as an OR of AND-groups: a row is visible when it matches every filter in any one group. Requires signalTypes.
Row filters are additive across a principal’s matching grants. A signal type with no matching group is unrestricted, and when rowScopeGroups is omitted all rows are visible for all signal types.
(list) –
A group of row filters that must all match. A row satisfies the group only when it matches every filter in it.
(dict) –
A single additive row-level filter on an AccessGrant. A row is visible when its value for the given field matches the filter’s values. Row filters are additive: the visible rows are the union of all row filters across a principal’s matching grants.
field (string) –
The field (column) the allowlist applies to (e.g., “serviceName”, “accountId”).
operator (string) –
Match operator applied to this filter’s values.
values (list) –
The values the field is matched against.
(string) –
A single allowlist value for a RowScope field.
contextConditions (dict) –
Optional context conditions for fine-grained access control on these actions.
(string) –
(list) –
Generic list of strings.
(string) –
Exceptions
CloudWatchOmni.Client.exceptions.ThrottlingExceptionCloudWatchOmni.Client.exceptions.ValidationExceptionCloudWatchOmni.Client.exceptions.ResourceNotFoundExceptionCloudWatchOmni.Client.exceptions.AccessDeniedExceptionCloudWatchOmni.Client.exceptions.InternalServerExceptionCloudWatchOmni.Client.exceptions.ConflictExceptionCloudWatchOmni.Client.exceptions.ServiceQuotaExceededException