Skip to content

get_metric async

get_metric(
    app_id: AppId,
    metric_id: MetricId,
    scope: RequestScope,
    *,
    config_overrides: Optional[AsyncAppMonetizationClientConfig] = None,
    stage: Optional[PlanStage] = None,
) -> GetMetricResponse

Returns the details of a metric.

Parameters:

  • app_id (AppId) –

    The ID of the app.

  • metric_id (MetricId) –

    The ID of the metric to retrieve.

  • stage (Optional[PlanStage], default: None ) –

    The offering stage to read the metric from: DRAFT (the latest draft) or PUBLISHED (the offering customers see). Absent: PUBLISHED when scope=live, DRAFT when scope=sandbox.

  • scope (RequestScope) –

    Required. The environment: live or sandbox. live reads the published offering by default; sandbox reads the app's draft.

Raises:

Source code in docs_src/capo_appmonetization/_services/async_app_monetization.py
async def get_metric(
    self,
    app_id: "capo_appmonetization.types.app_id.AppId",
    metric_id: "capo_appmonetization.types.metric_id.MetricId",
    scope: "capo_appmonetization.types.request_scope.RequestScope",
    *,
    config_overrides: Optional[AsyncAppMonetizationClientConfig] = None,
    stage: Optional["capo_appmonetization.types.plan_stage.PlanStage"] = None,
) -> "capo_appmonetization.types.get_metric_response.GetMetricResponse":
    """Returns the details of a metric.

    Args:
        app_id: The ID of the app.
        metric_id: The ID of the metric to retrieve.
        stage: The offering stage to read the metric from: DRAFT (the latest draft) or PUBLISHED (the offering customers see). Absent: PUBLISHED when scope=live, DRAFT when scope=sandbox.
        scope: Required. The environment: live or sandbox. live reads the published offering by default; sandbox reads the app's draft.

    Raises:
        capo_appmonetization.errors.access_denied_exception.AccessDeniedException: The caller does not have sufficient permission to perform this action.
        capo_appmonetization.errors.internal_server_exception.InternalServerException: An unexpected error occurred while processing the request.
        capo_appmonetization.errors.resource_not_found_exception.ResourceNotFoundException: The referenced resource does not exist.
        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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_appmonetization.types.get_metric_request.GetMetricRequest]",
    ) -> AsyncOperationResponse[
        "capo_appmonetization.types.get_metric_response.GetMetricResponse"
    ]:
        import capo_appmonetization._operations.aws_monetization_ai_front_end.get_metric

        (
            output,
            http_response,
        ) = await capo_appmonetization._operations.aws_monetization_ai_front_end.get_metric.async_get_metric(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetMetric")
    )
    input_: capo_appmonetization.types.get_metric_request.GetMetricRequest = {
        "app_id": app_id,
        "metric_id": metric_id,
        "scope": scope,
    }
    if stage is not None:
        input_["stage"] = stage

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