Skip to content

create_domain_access_grant_for_organization

create_domain_access_grant_for_organization(
    domain_id: DomainId,
    name: str,
    principal: OrganizationAccessGrantPrincipal,
    permission: OrganizationGrantPermission,
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateDomainAccessGrantForOrganizationOutput

Creates an AccessGrant that authorizes a principal to administer an organization domain.

Parameters:

  • domain_id (DomainId) –

    The ID of the organization domain to create the grant on.

  • name (str) –

    A name that identifies the access grant.

  • principal (OrganizationAccessGrantPrincipal) –

    The principal receiving the grant.

  • permission (OrganizationGrantPermission) –

    The permission to grant.

  • 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:

Examples:

Create an organization domain access grant The following example grants an Identity Center user administrative access to an organization domain. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> client.create_domain_access_grant_for_organization(domain_id='d-1a2b3c4d5e', name='org-domain-admin', principal={'principalType': 'IDC_USER', 'principalId': '94b6c7d8-1a2b-4c3d-9e4f-5a6b7c8d9e0f'}, permission='ADMIN', tags={'Team': 'observability'}, client_token='3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73')
Source code in docs_src/capo_cloudwatchomni/_services/cloud_watch_omni.py
def create_domain_access_grant_for_organization(
    self,
    domain_id: "capo_cloudwatchomni.types.domain_id.DomainId",
    name: str,
    principal: "capo_cloudwatchomni.types.organization_access_grant_principal.OrganizationAccessGrantPrincipal",
    permission: "capo_cloudwatchomni.types.organization_grant_permission.OrganizationGrantPermission",
    *,
    config_overrides: Optional[CloudWatchOmniClientConfig] = None,
    tags: Optional["capo_cloudwatchomni.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_cloudwatchomni.types.client_token.ClientToken"
    ] = None,
) -> "capo_cloudwatchomni.types.create_domain_access_grant_for_organization_output.CreateDomainAccessGrantForOrganizationOutput":
    """Creates an AccessGrant that authorizes a principal to administer an organization domain.

    Args:
        domain_id: The ID of the organization domain to create the grant on.
        name: A name that identifies the access grant.
        principal: The principal receiving the grant.
        permission: The permission to grant.
        tags: The tags to associate with the access grant.
        client_token: Idempotency token for safe retries. Repeated requests with the same token return the original result instead of creating a duplicate.

    Raises:
        capo_cloudwatchomni.errors.access_denied_exception.AccessDeniedException: The caller is not authorized to perform this action.
        capo_cloudwatchomni.errors.conflict_exception.ConflictException: The operation could not be completed because of a conflict with the current state of the resource.
        capo_cloudwatchomni.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_cloudwatchomni.errors.resource_not_found_exception.ResourceNotFoundException: The specified resource does not exist.
        capo_cloudwatchomni.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: A service quota was exceeded.
        capo_cloudwatchomni.errors.throttling_exception.ThrottlingException: The request was throttled due to exceeding the allowed request rate.
        capo_cloudwatchomni.errors.validation_exception.ValidationException: A parameter is specified incorrectly.
        capo_cloudwatchomni.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create an organization domain access grant
        The following example grants an Identity Center user administrative access to an organization domain. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> client.create_domain_access_grant_for_organization(domain_id='d-1a2b3c4d5e', name='org-domain-admin', principal={'principalType': 'IDC_USER', 'principalId': '94b6c7d8-1a2b-4c3d-9e4f-5a6b7c8d9e0f'}, permission='ADMIN', tags={'Team': 'observability'}, client_token='3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73')
    """

    def _handler(
        req: "OperationRequest[capo_cloudwatchomni.types.create_domain_access_grant_for_organization_input.CreateDomainAccessGrantForOrganizationInput]",
    ) -> OperationResponse[
        "capo_cloudwatchomni.types.create_domain_access_grant_for_organization_output.CreateDomainAccessGrantForOrganizationOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_domain_access_grant_for_organization

        output, http_response = (
            capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_domain_access_grant_for_organization.create_domain_access_grant_for_organization(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDomainAccessGrantForOrganization")
    )
    input_: capo_cloudwatchomni.types.create_domain_access_grant_for_organization_input.CreateDomainAccessGrantForOrganizationInput = {
        "domain_id": domain_id,
        "name": name,
        "principal": principal,
        "permission": permission,
    }
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output