Skip to content

update_workspace_configuration async

update_workspace_configuration(
    workspace_id: WorkspaceId,
    *,
    config_overrides: Optional[AsyncampClientConfig] = None,
    client_token: Optional[IdempotencyToken] = None,
    limits_per_label_set: Optional[LimitsPerLabelSetList] = None,
    retention_period_in_days: Optional[int] = None,
    out_of_order_time_window_in_seconds: Optional[int] = None,
    rule_query_offset_in_seconds: Optional[int] = None,
) -> UpdateWorkspaceConfigurationResponse

Use this operation to create or update the label sets, label set limits, and retention period of a workspace.

You must specify at least one of limitsPerLabelSet or retentionPeriodInDays for the request to be valid.

Parameters:

  • workspace_id (WorkspaceId) –

    The ID of the workspace that you want to update. To find the IDs of your workspaces, use the ListWorkspaces operation.

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

    You can include a token in your operation to make it an idempotent opeartion.

  • limits_per_label_set (Optional[LimitsPerLabelSetList], default: None ) –

    This is an array of structures, where each structure defines a label set for the workspace, and defines the active time series limit for each of those label sets. Each label name in a label set must be unique.

  • retention_period_in_days (Optional[int], default: None ) –

    Specifies how many days that metrics will be retained in the workspace.

  • out_of_order_time_window_in_seconds (Optional[int], default: None ) –

    Specifies the time window in seconds for accepting out of order samples. Out of order samples older than this window are rejected.

  • rule_query_offset_in_seconds (Optional[int], default: None ) –

    Specifies the duration in seconds to offset rule evaluation queries into the past. This allows ingested samples to be available before rule evaluation.

Raises:

Source code in docs_src/capo_amp/_services/async_amp.py
async def update_workspace_configuration(
    self,
    workspace_id: "capo_amp.types.workspace_id.WorkspaceId",
    *,
    config_overrides: Optional[AsyncampClientConfig] = None,
    client_token: Optional[
        "capo_amp.types.idempotency_token.IdempotencyToken"
    ] = None,
    limits_per_label_set: Optional[
        "capo_amp.types.limits_per_label_set_list.LimitsPerLabelSetList"
    ] = None,
    retention_period_in_days: Optional[int] = None,
    out_of_order_time_window_in_seconds: Optional[int] = None,
    rule_query_offset_in_seconds: Optional[int] = None,
) -> "capo_amp.types.update_workspace_configuration_response.UpdateWorkspaceConfigurationResponse":
    """<p>Use this operation to create or update the label sets, label set limits, and retention period of a workspace.</p> <p>You must specify at least one of <code>limitsPerLabelSet</code> or <code>retentionPeriodInDays</code> for the request to be valid.</p>

    Args:
        workspace_id: <p>The ID of the workspace that you want to update. To find the IDs of your workspaces, use the <a href="https://docs.aws.amazon.com/prometheus/latest/APIReference/API_ListWorkspaces.htm">ListWorkspaces</a> operation.</p>
        client_token: <p>You can include a token in your operation to make it an idempotent opeartion. </p>
        limits_per_label_set: <p>This is an array of structures, where each structure defines a label set for the workspace, and defines the active time series limit for each of those label sets. Each label name in a label set must be unique.</p>
        retention_period_in_days: <p>Specifies how many days that metrics will be retained in the workspace.</p>
        out_of_order_time_window_in_seconds: <p>Specifies the time window in seconds for accepting out of order samples. Out of order samples older than this window are rejected.</p>
        rule_query_offset_in_seconds: <p>Specifies the duration in seconds to offset rule evaluation queries into the past. This allows ingested samples to be available before rule evaluation.</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.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resources that doesn't exist.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_amp.types.update_workspace_configuration_request.UpdateWorkspaceConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_amp.types.update_workspace_configuration_response.UpdateWorkspaceConfigurationResponse"
    ]:
        import capo_amp._operations.amazon_prometheus_service.update_workspace_configuration

        (
            output,
            http_response,
        ) = await capo_amp._operations.amazon_prometheus_service.update_workspace_configuration.async_update_workspace_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateWorkspaceConfiguration")
    )
    input_: capo_amp.types.update_workspace_configuration_request.UpdateWorkspaceConfigurationRequest = {
        "workspace_id": workspace_id
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if limits_per_label_set is not None:
        input_["limits_per_label_set"] = limits_per_label_set
    if retention_period_in_days is not None:
        input_["retention_period_in_days"] = retention_period_in_days
    if out_of_order_time_window_in_seconds is not None:
        input_["out_of_order_time_window_in_seconds"] = (
            out_of_order_time_window_in_seconds
        )
    if rule_query_offset_in_seconds is not None:
        input_["rule_query_offset_in_seconds"] = rule_query_offset_in_seconds

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