Skip to content

update_fleet_metric

update_fleet_metric(
    metric_name: FleetMetricName,
    index_name: IndexName,
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    query_string: Optional[QueryString] = None,
    aggregation_type: Optional[AggregationType] = None,
    period: Optional[FleetMetricPeriod] = None,
    aggregation_field: Optional[AggregationField] = None,
    description: Optional[FleetMetricDescription] = None,
    query_version: Optional[QueryVersion] = None,
    unit: Optional[FleetMetricUnit] = None,
    expected_version: Optional[OptionalVersion] = None,
) -> None

Updates the data for a fleet metric.

Requires permission to access the UpdateFleetMetric action.

Parameters:

Raises:

Source code in docs_src/capo_iot/_services/io_t.py
def update_fleet_metric(
    self,
    metric_name: "capo_iot.types.fleet_metric_name.FleetMetricName",
    index_name: "capo_iot.types.index_name.IndexName",
    *,
    config_overrides: Optional[IoTClientConfig] = None,
    query_string: Optional["capo_iot.types.query_string.QueryString"] = None,
    aggregation_type: Optional[
        "capo_iot.types.aggregation_type.AggregationType"
    ] = None,
    period: Optional["capo_iot.types.fleet_metric_period.FleetMetricPeriod"] = None,
    aggregation_field: Optional[
        "capo_iot.types.aggregation_field.AggregationField"
    ] = None,
    description: Optional[
        "capo_iot.types.fleet_metric_description.FleetMetricDescription"
    ] = None,
    query_version: Optional["capo_iot.types.query_version.QueryVersion"] = None,
    unit: Optional["capo_iot.types.fleet_metric_unit.FleetMetricUnit"] = None,
    expected_version: Optional[
        "capo_iot.types.optional_version.OptionalVersion"
    ] = None,
) -> None:
    """<p>Updates the data for a fleet metric.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">UpdateFleetMetric</a> action.</p>

    Args:
        metric_name: <p>The name of the fleet metric to update.</p>
        query_string: <p>The search query string.</p>
        aggregation_type: <p>The type of the aggregation query.</p>
        period: <p>The time in seconds between fleet metric emissions. Range [60(1 min), 86400(1 day)] and must be multiple of 60.</p>
        aggregation_field: <p>The field to aggregate.</p>
        description: <p>The description of the fleet metric.</p>
        query_version: <p>The version of the query.</p>
        index_name: <p>The name of the index to search.</p>
        unit: <p>Used to support unit transformation such as milliseconds to seconds. The unit must be supported by <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html">CW metric</a>.</p>
        expected_version: <p>The expected version of the fleet metric record in the registry.</p>

    Raises:
        capo_iot.errors.index_not_ready_exception.IndexNotReadyException: <p>The index is not ready.</p>
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_aggregation_exception.InvalidAggregationException: <p>The aggregation is invalid.</p>
        capo_iot.errors.invalid_query_exception.InvalidQueryException: <p>The query is invalid.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_iot.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is temporarily unavailable.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.unauthorized_exception.UnauthorizedException: <p>You are not authorized to perform this operation.</p>
        capo_iot.errors.version_conflict_exception.VersionConflictException: <p>An exception thrown when the version of an entity specified with the <code>expectedVersion</code> parameter does not match the latest version in the system.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_iot.types.update_fleet_metric_request.UpdateFleetMetricRequest]",
    ) -> OperationResponse[None]:
        import capo_iot._operations.aws_iot_service.update_fleet_metric

        output, http_response = (
            capo_iot._operations.aws_iot_service.update_fleet_metric.update_fleet_metric(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateFleetMetric")
    )
    input_: capo_iot.types.update_fleet_metric_request.UpdateFleetMetricRequest = {
        "metric_name": metric_name,
        "index_name": index_name,
    }
    if query_string is not None:
        input_["query_string"] = query_string
    if aggregation_type is not None:
        input_["aggregation_type"] = aggregation_type
    if period is not None:
        input_["period"] = period
    if aggregation_field is not None:
        input_["aggregation_field"] = aggregation_field
    if description is not None:
        input_["description"] = description
    if query_version is not None:
        input_["query_version"] = query_version
    if unit is not None:
        input_["unit"] = unit
    if expected_version is not None:
        input_["expected_version"] = expected_version

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