Skip to content

create_access_profile async

create_access_profile(
    space_id: SpaceId,
    name: AccessProfileName,
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    description: Optional[str] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateAccessProfileOutput

Creates an access profile in a space. Use GetAccessProfile and ListAccessProfiles to retrieve profiles, and UpdateAccessProfile to modify one.

Parameters:

  • space_id (SpaceId) –

    The unique ID of the space to create the profile in.

  • name (AccessProfileName) –

    A name that identifies the access profile.

  • description (Optional[str], default: None ) –

    An optional description of the access profile.

  • tags (Optional[TagMap], default: None ) –

    The tags to associate with the access profile.

  • 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 access profile The following example creates a customer-managed access profile in a space. Payloads are shown as JSON; on the wire they are CBOR-encoded.

>>> await client.create_access_profile(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', name='Analyst read-only profile', description='Read-only access for analysts.', tags={'Team': 'observability'}, client_token='3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73')
Source code in docs_src/capo_cloudwatchomni/_services/async_cloud_watch_omni.py
async def create_access_profile(
    self,
    space_id: "capo_cloudwatchomni.types.space_id.SpaceId",
    name: "capo_cloudwatchomni.types.access_profile_name.AccessProfileName",
    *,
    config_overrides: Optional[AsyncCloudWatchOmniClientConfig] = None,
    description: Optional[str] = None,
    tags: Optional["capo_cloudwatchomni.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_cloudwatchomni.types.client_token.ClientToken"
    ] = None,
) -> "capo_cloudwatchomni.types.create_access_profile_output.CreateAccessProfileOutput":
    """Creates an access profile in a space. Use GetAccessProfile and ListAccessProfiles to retrieve profiles, and UpdateAccessProfile to modify one.

    Args:
        space_id: The unique ID of the space to create the profile in.
        name: A name that identifies the access profile.
        description: An optional description of the access profile.
        tags: The tags to associate with the access profile.
        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 access profile
        The following example creates a customer-managed access profile in a space. Payloads are shown as JSON; on the wire they are CBOR-encoded.

        >>> await client.create_access_profile(space_id='a1b2c3d4-5e6f-4a3b-8c9d-0e1f2a3b4c5d', name='Analyst read-only profile', description='Read-only access for analysts.', tags={'Team': 'observability'}, client_token='3f2a9c1e-7b04-4d8a-9e15-6c2b8d0f4a73')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatchomni.types.create_access_profile_input.CreateAccessProfileInput]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatchomni.types.create_access_profile_output.CreateAccessProfileOutput"
    ]:
        import capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_access_profile

        (
            output,
            http_response,
        ) = await capo_cloudwatchomni._operations.cloud_watch_omni_frontend.create_access_profile.async_create_access_profile(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAccessProfile")
    )
    input_: capo_cloudwatchomni.types.create_access_profile_input.CreateAccessProfileInput = {
        "space_id": space_id,
        "name": name,
    }
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output