Skip to content

archive_metric

archive_metric(
    app_id: AppId,
    metric_id: MetricId,
    *,
    config_overrides: Optional[AppMonetizationClientConfig] = None,
) -> ArchiveMetricResponse

Archives a metric, removing its definition from the app's draft configuration. The removal takes effect on the next call to PublishDraft. Already-recorded usage events and usage history are retained; archiving only stops the metric from aggregating further usage. Any plan quota or usage pack keyed to the metric is removed with it. If the metric was published, its metric ID and display name are permanently retired and cannot be reused.

Parameters:

  • app_id (AppId) –

    The ID of the app.

  • metric_id (MetricId) –

    The ID of the metric to archive.

Raises:

Source code in docs_src/capo_appmonetization/_services/app_monetization.py
def archive_metric(
    self,
    app_id: "capo_appmonetization.types.app_id.AppId",
    metric_id: "capo_appmonetization.types.metric_id.MetricId",
    *,
    config_overrides: Optional[AppMonetizationClientConfig] = None,
) -> "capo_appmonetization.types.archive_metric_response.ArchiveMetricResponse":
    """Archives a metric, removing its definition from the app's draft configuration. The removal takes effect on the next call to PublishDraft. Already-recorded usage events and usage history are retained; archiving only stops the metric from aggregating further usage. Any plan quota or usage pack keyed to the metric is removed with it. If the metric was published, its metric ID and display name are permanently retired and cannot be reused.

    Args:
        app_id: The ID of the app.
        metric_id: The ID of the metric to archive.

    Raises:
        capo_appmonetization.errors.access_denied_exception.AccessDeniedException: The caller does not have sufficient permission to perform this action.
        capo_appmonetization.errors.conflict_exception.ConflictException: The request conflicts with the current state of the resource, such as a duplicate identifier or a version mismatch. Retrieve the current state of the resource and retry the request.
        capo_appmonetization.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_appmonetization.errors.invalid_configuration_exception.InvalidConfigurationException: The requested configuration is not valid.
        capo_appmonetization.errors.resource_not_found_exception.ResourceNotFoundException: The referenced resource does not exist.
        capo_appmonetization.errors.revision_conflict_exception.RevisionConflictException: The request's revision does not match the resource's current revision. Retry with the current revision.
        capo_appmonetization.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: The request would cause a service quota to be exceeded.
        capo_appmonetization.errors.throttling_exception.ThrottlingException: The request was denied due to request throttling.
        capo_appmonetization.errors.validation_exception.ValidationException: The request failed input validation.
        capo_appmonetization.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_appmonetization.types.archive_metric_request.ArchiveMetricRequest]",
    ) -> OperationResponse[
        "capo_appmonetization.types.archive_metric_response.ArchiveMetricResponse"
    ]:
        import capo_appmonetization._operations.aws_monetization_ai_front_end.archive_metric

        output, http_response = (
            capo_appmonetization._operations.aws_monetization_ai_front_end.archive_metric.archive_metric(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ArchiveMetric")
    )
    input_: capo_appmonetization.types.archive_metric_request.ArchiveMetricRequest = {
        "app_id": app_id,
        "metric_id": metric_id,
    }

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