Skip to content

create_workspace

create_workspace(
    *,
    config_overrides: Optional[ampClientConfig] = None,
    alias: Optional[WorkspaceAlias] = None,
    client_token: Optional[IdempotencyToken] = None,
    tags: Optional[TagMap] = None,
    kms_key_arn: Optional[KmsKeyArn] = None,
) -> CreateWorkspaceResponse

Creates a Prometheus workspace. A workspace is a logical space dedicated to the storage and querying of Prometheus metrics. You can have one or more workspaces in each Region in your account.

Parameters:

  • alias (Optional[WorkspaceAlias], default: None ) –

    An alias that you assign to this workspace to help you identify it. It does not need to be unique.

    Blank spaces at the beginning or end of the alias that you specify will be trimmed from the value used.

  • client_token (Optional[IdempotencyToken], default: None ) –

    A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.

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

    The list of tag keys and values to associate with the workspace.

  • kms_key_arn (Optional[KmsKeyArn], default: None ) –

    (optional) The ARN for a customer managed KMS key to use for encrypting data within your workspace. For more information about using your own key in your workspace, see Encryption at rest in the Amazon Managed Service for Prometheus User Guide.

Raises:

Source code in docs_src/capo_amp/_services/amp.py
def create_workspace(
    self,
    *,
    config_overrides: Optional[ampClientConfig] = None,
    alias: Optional["capo_amp.types.workspace_alias.WorkspaceAlias"] = None,
    client_token: Optional[
        "capo_amp.types.idempotency_token.IdempotencyToken"
    ] = None,
    tags: Optional["capo_amp.types.tag_map.TagMap"] = None,
    kms_key_arn: Optional["capo_amp.types.kms_key_arn.KmsKeyArn"] = None,
) -> "capo_amp.types.create_workspace_response.CreateWorkspaceResponse":
    """<p>Creates a Prometheus workspace. A workspace is a logical space dedicated to the storage and querying of Prometheus metrics. You can have one or more workspaces in each Region in your account.</p>

    Args:
        alias: <p>An alias that you assign to this workspace to help you identify it. It does not need to be unique.</p> <p>Blank spaces at the beginning or end of the alias that you specify will be trimmed from the value used.</p>
        client_token: <p>A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.</p>
        tags: <p>The list of tag keys and values to associate with the workspace.</p>
        kms_key_arn: <p>(optional) The ARN for a customer managed KMS key to use for encrypting data within your workspace. For more information about using your own key in your workspace, see <a href="https://docs.aws.amazon.com/prometheus/latest/userguide/encryption-at-rest-Amazon-Service-Prometheus.html">Encryption at rest</a> in the <i>Amazon Managed Service for Prometheus User Guide</i>.</p>

    Raises:
        capo_amp.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_amp.errors.conflict_exception.ConflictException: <p>The request would cause an inconsistent state.</p>
        capo_amp.errors.internal_server_exception.InternalServerException: <p>An unexpected error occurred during the processing of the request.</p>
        capo_amp.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Completing the request would cause a service quota to be exceeded.</p>
        capo_amp.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_amp.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_amp.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_amp.types.create_workspace_request.CreateWorkspaceRequest]",
    ) -> OperationResponse[
        "capo_amp.types.create_workspace_response.CreateWorkspaceResponse"
    ]:
        import capo_amp._operations.amazon_prometheus_service.create_workspace

        output, http_response = (
            capo_amp._operations.amazon_prometheus_service.create_workspace.create_workspace(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateWorkspace")
    )
    input_: capo_amp.types.create_workspace_request.CreateWorkspaceRequest = {}
    if alias is not None:
        input_["alias"] = alias
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags
    if kms_key_arn is not None:
        input_["kms_key_arn"] = kms_key_arn

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