Skip to content

create_logging_configuration async

create_logging_configuration(
    workspace_id: WorkspaceId,
    log_group_arn: LogGroupArn,
    *,
    config_overrides: Optional[AsyncampClientConfig] = None,
    client_token: Optional[IdempotencyToken] = None,
) -> CreateLoggingConfigurationResponse

The CreateLoggingConfiguration operation creates rules and alerting logging configuration for the workspace. Use this operation to set the CloudWatch log group to which the logs will be published to.

These logging configurations are only for rules and alerting logs.

Parameters:

  • workspace_id (WorkspaceId) –

    The ID of the workspace to create the logging configuration for.

  • log_group_arn (LogGroupArn) –

    The ARN of the CloudWatch log group to which the vended log data will be published. This log group must exist prior to calling this operation.

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

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

Raises:

Source code in docs_src/capo_amp/_services/async_amp.py
async def create_logging_configuration(
    self,
    workspace_id: "capo_amp.types.workspace_id.WorkspaceId",
    log_group_arn: "capo_amp.types.log_group_arn.LogGroupArn",
    *,
    config_overrides: Optional[AsyncampClientConfig] = None,
    client_token: Optional[
        "capo_amp.types.idempotency_token.IdempotencyToken"
    ] = None,
) -> "capo_amp.types.create_logging_configuration_response.CreateLoggingConfigurationResponse":
    """<p>The <code>CreateLoggingConfiguration</code> operation creates rules and alerting logging configuration for the workspace. Use this operation to set the CloudWatch log group to which the logs will be published to.</p> <note> <p>These logging configurations are only for rules and alerting logs.</p> </note>

    Args:
        workspace_id: <p>The ID of the workspace to create the logging configuration for.</p>
        log_group_arn: <p>The ARN of the CloudWatch log group to which the vended log data will be published. This log group must exist prior to calling this operation.</p>
        client_token: <p>A unique identifier that you can provide to ensure the idempotency of the request. Case-sensitive.</p>

    Raises:
        capo_amp.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</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.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.create_logging_configuration_request.CreateLoggingConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_amp.types.create_logging_configuration_response.CreateLoggingConfigurationResponse"
    ]:
        import capo_amp._operations.amazon_prometheus_service.create_logging_configuration

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateLoggingConfiguration")
    )
    input_: capo_amp.types.create_logging_configuration_request.CreateLoggingConfigurationRequest = {
        "workspace_id": workspace_id,
        "log_group_arn": log_group_arn,
    }
    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