create_access_grant
¶
create_access_grant(
domain_id: DomainId,
space_id: SpaceId,
name: str,
principal: AccessGrantPrincipal,
permission: AccessGrantPermission,
*,
config_overrides: Optional[CloudWatchOmniClientConfig] = None,
scoped_actions: Optional[ScopedActionsList] = None,
tags: Optional[TagMap] = None,
client_token: Optional[ClientToken] = None,
) -> CreateAccessGrantOutput
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.
Parameters:
-
domain_id(DomainId) –The ID of the domain that contains the space.
-
space_id(SpaceId) –The ID of the space to scope the grant to.
-
name(str) –A name that identifies the access grant.
-
principal(AccessGrantPrincipal) –The principal receiving the grant.
-
permission(AccessGrantPermission) –The permission to grant. Exactly one permission is granted per request.
-
scoped_actions(Optional[ScopedActionsList], default:None) –Groups of actions to allow, each with the resource scopes and conditions that limit those actions.
-
tags(Optional[TagMap], default:None) –The tags to associate with the access grant.
-
client_token(Optional[ClientToken], default:None) –Idempotency token for safe retries. Repeated requests with the same token return the original result instead of creating a duplicate.
Raises:
-
AccessDeniedException–The caller is not authorized to perform this action.
-
ConflictException–The operation could not be completed because of a conflict with the current state of the resource.
-
InternalServerException–An unexpected error occurred while processing the request.
-
ResourceNotFoundException–The specified resource does not exist.
-
ServiceQuotaExceededException–A service quota was exceeded.
-
ThrottlingException–The request was throttled due to exceeding the allowed request rate.
-
ValidationException–A parameter is specified incorrectly.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Create an access grant The following example creates a custom access grant that authorizes an Identity Center user to read and update a specific dashboard in a space. Payloads are shown as JSON; on the wire they are CBOR-encoded.
>>> client.create_access_grant(domain_id='d-1a2b3c4d5e', space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', name='analyst-read-access', principal={'principalType': 'IDC_USER', 'principalId': '94b6c7d8-1a2b-4c3d-9e4f-5a6b7c8d9e0f'}, permission='CUSTOM', scoped_actions=[{'actions': ['cloudwatch:GetOmniDashboard', 'cloudwatch:UpdateOmniDashboard'], 'resources': [{'resourceType': 'OmniDashboard', 'resourceArns': ['arn:aws:cloudwatch:us-east-1:123456789012:omni-dashboard/c3d4e5f6-7a8b-4c9d-8e0f-1a2b3c4d5e6f']}]}], tags={'Team': 'observability'}, client_token='3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73')
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | |