{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.IoT.UpdateFleetMetric
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the data for a fleet metric.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions UpdateFleetMetric>
-- action.
module Amazonka.IoT.UpdateFleetMetric
  ( -- * Creating a Request
    UpdateFleetMetric (..),
    newUpdateFleetMetric,

    -- * Request Lenses
    updateFleetMetric_aggregationType,
    updateFleetMetric_period,
    updateFleetMetric_queryVersion,
    updateFleetMetric_aggregationField,
    updateFleetMetric_expectedVersion,
    updateFleetMetric_queryString,
    updateFleetMetric_description,
    updateFleetMetric_unit,
    updateFleetMetric_metricName,
    updateFleetMetric_indexName,

    -- * Destructuring the Response
    UpdateFleetMetricResponse (..),
    newUpdateFleetMetricResponse,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newUpdateFleetMetric' smart constructor.
data UpdateFleetMetric = UpdateFleetMetric'
  { -- | The type of the aggregation query.
    UpdateFleetMetric -> Maybe AggregationType
aggregationType :: Prelude.Maybe AggregationType,
    -- | The time in seconds between fleet metric emissions. Range [60(1 min),
    -- 86400(1 day)] and must be multiple of 60.
    UpdateFleetMetric -> Maybe Natural
period :: Prelude.Maybe Prelude.Natural,
    -- | The version of the query.
    UpdateFleetMetric -> Maybe Text
queryVersion :: Prelude.Maybe Prelude.Text,
    -- | The field to aggregate.
    UpdateFleetMetric -> Maybe Text
aggregationField :: Prelude.Maybe Prelude.Text,
    -- | The expected version of the fleet metric record in the registry.
    UpdateFleetMetric -> Maybe Integer
expectedVersion :: Prelude.Maybe Prelude.Integer,
    -- | The search query string.
    UpdateFleetMetric -> Maybe Text
queryString :: Prelude.Maybe Prelude.Text,
    -- | The description of the fleet metric.
    UpdateFleetMetric -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Used to support unit transformation such as milliseconds to seconds. The
    -- unit must be supported by
    -- <https://docs.aws.amazon.com/https:/docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html CW metric>.
    UpdateFleetMetric -> Maybe FleetMetricUnit
unit :: Prelude.Maybe FleetMetricUnit,
    -- | The name of the fleet metric to update.
    UpdateFleetMetric -> Text
metricName :: Prelude.Text,
    -- | The name of the index to search.
    UpdateFleetMetric -> Text
indexName :: Prelude.Text
  }
  deriving (UpdateFleetMetric -> UpdateFleetMetric -> Bool
(UpdateFleetMetric -> UpdateFleetMetric -> Bool)
-> (UpdateFleetMetric -> UpdateFleetMetric -> Bool)
-> Eq UpdateFleetMetric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFleetMetric -> UpdateFleetMetric -> Bool
$c/= :: UpdateFleetMetric -> UpdateFleetMetric -> Bool
== :: UpdateFleetMetric -> UpdateFleetMetric -> Bool
$c== :: UpdateFleetMetric -> UpdateFleetMetric -> Bool
Prelude.Eq, ReadPrec [UpdateFleetMetric]
ReadPrec UpdateFleetMetric
Int -> ReadS UpdateFleetMetric
ReadS [UpdateFleetMetric]
(Int -> ReadS UpdateFleetMetric)
-> ReadS [UpdateFleetMetric]
-> ReadPrec UpdateFleetMetric
-> ReadPrec [UpdateFleetMetric]
-> Read UpdateFleetMetric
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFleetMetric]
$creadListPrec :: ReadPrec [UpdateFleetMetric]
readPrec :: ReadPrec UpdateFleetMetric
$creadPrec :: ReadPrec UpdateFleetMetric
readList :: ReadS [UpdateFleetMetric]
$creadList :: ReadS [UpdateFleetMetric]
readsPrec :: Int -> ReadS UpdateFleetMetric
$creadsPrec :: Int -> ReadS UpdateFleetMetric
Prelude.Read, Int -> UpdateFleetMetric -> ShowS
[UpdateFleetMetric] -> ShowS
UpdateFleetMetric -> String
(Int -> UpdateFleetMetric -> ShowS)
-> (UpdateFleetMetric -> String)
-> ([UpdateFleetMetric] -> ShowS)
-> Show UpdateFleetMetric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFleetMetric] -> ShowS
$cshowList :: [UpdateFleetMetric] -> ShowS
show :: UpdateFleetMetric -> String
$cshow :: UpdateFleetMetric -> String
showsPrec :: Int -> UpdateFleetMetric -> ShowS
$cshowsPrec :: Int -> UpdateFleetMetric -> ShowS
Prelude.Show, (forall x. UpdateFleetMetric -> Rep UpdateFleetMetric x)
-> (forall x. Rep UpdateFleetMetric x -> UpdateFleetMetric)
-> Generic UpdateFleetMetric
forall x. Rep UpdateFleetMetric x -> UpdateFleetMetric
forall x. UpdateFleetMetric -> Rep UpdateFleetMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateFleetMetric x -> UpdateFleetMetric
$cfrom :: forall x. UpdateFleetMetric -> Rep UpdateFleetMetric x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFleetMetric' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'aggregationType', 'updateFleetMetric_aggregationType' - The type of the aggregation query.
--
-- 'period', 'updateFleetMetric_period' - The time in seconds between fleet metric emissions. Range [60(1 min),
-- 86400(1 day)] and must be multiple of 60.
--
-- 'queryVersion', 'updateFleetMetric_queryVersion' - The version of the query.
--
-- 'aggregationField', 'updateFleetMetric_aggregationField' - The field to aggregate.
--
-- 'expectedVersion', 'updateFleetMetric_expectedVersion' - The expected version of the fleet metric record in the registry.
--
-- 'queryString', 'updateFleetMetric_queryString' - The search query string.
--
-- 'description', 'updateFleetMetric_description' - The description of the fleet metric.
--
-- 'unit', 'updateFleetMetric_unit' - Used to support unit transformation such as milliseconds to seconds. The
-- unit must be supported by
-- <https://docs.aws.amazon.com/https:/docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html CW metric>.
--
-- 'metricName', 'updateFleetMetric_metricName' - The name of the fleet metric to update.
--
-- 'indexName', 'updateFleetMetric_indexName' - The name of the index to search.
newUpdateFleetMetric ::
  -- | 'metricName'
  Prelude.Text ->
  -- | 'indexName'
  Prelude.Text ->
  UpdateFleetMetric
newUpdateFleetMetric :: Text -> Text -> UpdateFleetMetric
newUpdateFleetMetric Text
pMetricName_ Text
pIndexName_ =
  UpdateFleetMetric' :: Maybe AggregationType
-> Maybe Natural
-> Maybe Text
-> Maybe Text
-> Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe FleetMetricUnit
-> Text
-> Text
-> UpdateFleetMetric
UpdateFleetMetric'
    { $sel:aggregationType:UpdateFleetMetric' :: Maybe AggregationType
aggregationType =
        Maybe AggregationType
forall a. Maybe a
Prelude.Nothing,
      $sel:period:UpdateFleetMetric' :: Maybe Natural
period = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:queryVersion:UpdateFleetMetric' :: Maybe Text
queryVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:aggregationField:UpdateFleetMetric' :: Maybe Text
aggregationField = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:expectedVersion:UpdateFleetMetric' :: Maybe Integer
expectedVersion = Maybe Integer
forall a. Maybe a
Prelude.Nothing,
      $sel:queryString:UpdateFleetMetric' :: Maybe Text
queryString = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:UpdateFleetMetric' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:unit:UpdateFleetMetric' :: Maybe FleetMetricUnit
unit = Maybe FleetMetricUnit
forall a. Maybe a
Prelude.Nothing,
      $sel:metricName:UpdateFleetMetric' :: Text
metricName = Text
pMetricName_,
      $sel:indexName:UpdateFleetMetric' :: Text
indexName = Text
pIndexName_
    }

-- | The type of the aggregation query.
updateFleetMetric_aggregationType :: Lens.Lens' UpdateFleetMetric (Prelude.Maybe AggregationType)
updateFleetMetric_aggregationType :: (Maybe AggregationType -> f (Maybe AggregationType))
-> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_aggregationType = (UpdateFleetMetric -> Maybe AggregationType)
-> (UpdateFleetMetric
    -> Maybe AggregationType -> UpdateFleetMetric)
-> Lens
     UpdateFleetMetric
     UpdateFleetMetric
     (Maybe AggregationType)
     (Maybe AggregationType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Maybe AggregationType
aggregationType :: Maybe AggregationType
$sel:aggregationType:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe AggregationType
aggregationType} -> Maybe AggregationType
aggregationType) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Maybe AggregationType
a -> UpdateFleetMetric
s {$sel:aggregationType:UpdateFleetMetric' :: Maybe AggregationType
aggregationType = Maybe AggregationType
a} :: UpdateFleetMetric)

-- | The time in seconds between fleet metric emissions. Range [60(1 min),
-- 86400(1 day)] and must be multiple of 60.
updateFleetMetric_period :: Lens.Lens' UpdateFleetMetric (Prelude.Maybe Prelude.Natural)
updateFleetMetric_period :: (Maybe Natural -> f (Maybe Natural))
-> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_period = (UpdateFleetMetric -> Maybe Natural)
-> (UpdateFleetMetric -> Maybe Natural -> UpdateFleetMetric)
-> Lens
     UpdateFleetMetric UpdateFleetMetric (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Maybe Natural
period :: Maybe Natural
$sel:period:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Natural
period} -> Maybe Natural
period) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Maybe Natural
a -> UpdateFleetMetric
s {$sel:period:UpdateFleetMetric' :: Maybe Natural
period = Maybe Natural
a} :: UpdateFleetMetric)

-- | The version of the query.
updateFleetMetric_queryVersion :: Lens.Lens' UpdateFleetMetric (Prelude.Maybe Prelude.Text)
updateFleetMetric_queryVersion :: (Maybe Text -> f (Maybe Text))
-> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_queryVersion = (UpdateFleetMetric -> Maybe Text)
-> (UpdateFleetMetric -> Maybe Text -> UpdateFleetMetric)
-> Lens
     UpdateFleetMetric UpdateFleetMetric (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Maybe Text
queryVersion :: Maybe Text
$sel:queryVersion:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
queryVersion} -> Maybe Text
queryVersion) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Maybe Text
a -> UpdateFleetMetric
s {$sel:queryVersion:UpdateFleetMetric' :: Maybe Text
queryVersion = Maybe Text
a} :: UpdateFleetMetric)

-- | The field to aggregate.
updateFleetMetric_aggregationField :: Lens.Lens' UpdateFleetMetric (Prelude.Maybe Prelude.Text)
updateFleetMetric_aggregationField :: (Maybe Text -> f (Maybe Text))
-> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_aggregationField = (UpdateFleetMetric -> Maybe Text)
-> (UpdateFleetMetric -> Maybe Text -> UpdateFleetMetric)
-> Lens
     UpdateFleetMetric UpdateFleetMetric (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Maybe Text
aggregationField :: Maybe Text
$sel:aggregationField:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
aggregationField} -> Maybe Text
aggregationField) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Maybe Text
a -> UpdateFleetMetric
s {$sel:aggregationField:UpdateFleetMetric' :: Maybe Text
aggregationField = Maybe Text
a} :: UpdateFleetMetric)

-- | The expected version of the fleet metric record in the registry.
updateFleetMetric_expectedVersion :: Lens.Lens' UpdateFleetMetric (Prelude.Maybe Prelude.Integer)
updateFleetMetric_expectedVersion :: (Maybe Integer -> f (Maybe Integer))
-> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_expectedVersion = (UpdateFleetMetric -> Maybe Integer)
-> (UpdateFleetMetric -> Maybe Integer -> UpdateFleetMetric)
-> Lens
     UpdateFleetMetric UpdateFleetMetric (Maybe Integer) (Maybe Integer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Maybe Integer
expectedVersion :: Maybe Integer
$sel:expectedVersion:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Integer
expectedVersion} -> Maybe Integer
expectedVersion) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Maybe Integer
a -> UpdateFleetMetric
s {$sel:expectedVersion:UpdateFleetMetric' :: Maybe Integer
expectedVersion = Maybe Integer
a} :: UpdateFleetMetric)

-- | The search query string.
updateFleetMetric_queryString :: Lens.Lens' UpdateFleetMetric (Prelude.Maybe Prelude.Text)
updateFleetMetric_queryString :: (Maybe Text -> f (Maybe Text))
-> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_queryString = (UpdateFleetMetric -> Maybe Text)
-> (UpdateFleetMetric -> Maybe Text -> UpdateFleetMetric)
-> Lens
     UpdateFleetMetric UpdateFleetMetric (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Maybe Text
queryString :: Maybe Text
$sel:queryString:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
queryString} -> Maybe Text
queryString) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Maybe Text
a -> UpdateFleetMetric
s {$sel:queryString:UpdateFleetMetric' :: Maybe Text
queryString = Maybe Text
a} :: UpdateFleetMetric)

-- | The description of the fleet metric.
updateFleetMetric_description :: Lens.Lens' UpdateFleetMetric (Prelude.Maybe Prelude.Text)
updateFleetMetric_description :: (Maybe Text -> f (Maybe Text))
-> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_description = (UpdateFleetMetric -> Maybe Text)
-> (UpdateFleetMetric -> Maybe Text -> UpdateFleetMetric)
-> Lens
     UpdateFleetMetric UpdateFleetMetric (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Maybe Text
description :: Maybe Text
$sel:description:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
description} -> Maybe Text
description) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Maybe Text
a -> UpdateFleetMetric
s {$sel:description:UpdateFleetMetric' :: Maybe Text
description = Maybe Text
a} :: UpdateFleetMetric)

-- | Used to support unit transformation such as milliseconds to seconds. The
-- unit must be supported by
-- <https://docs.aws.amazon.com/https:/docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/API_MetricDatum.html CW metric>.
updateFleetMetric_unit :: Lens.Lens' UpdateFleetMetric (Prelude.Maybe FleetMetricUnit)
updateFleetMetric_unit :: (Maybe FleetMetricUnit -> f (Maybe FleetMetricUnit))
-> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_unit = (UpdateFleetMetric -> Maybe FleetMetricUnit)
-> (UpdateFleetMetric
    -> Maybe FleetMetricUnit -> UpdateFleetMetric)
-> Lens
     UpdateFleetMetric
     UpdateFleetMetric
     (Maybe FleetMetricUnit)
     (Maybe FleetMetricUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Maybe FleetMetricUnit
unit :: Maybe FleetMetricUnit
$sel:unit:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe FleetMetricUnit
unit} -> Maybe FleetMetricUnit
unit) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Maybe FleetMetricUnit
a -> UpdateFleetMetric
s {$sel:unit:UpdateFleetMetric' :: Maybe FleetMetricUnit
unit = Maybe FleetMetricUnit
a} :: UpdateFleetMetric)

-- | The name of the fleet metric to update.
updateFleetMetric_metricName :: Lens.Lens' UpdateFleetMetric Prelude.Text
updateFleetMetric_metricName :: (Text -> f Text) -> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_metricName = (UpdateFleetMetric -> Text)
-> (UpdateFleetMetric -> Text -> UpdateFleetMetric)
-> Lens UpdateFleetMetric UpdateFleetMetric Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Text
metricName :: Text
$sel:metricName:UpdateFleetMetric' :: UpdateFleetMetric -> Text
metricName} -> Text
metricName) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Text
a -> UpdateFleetMetric
s {$sel:metricName:UpdateFleetMetric' :: Text
metricName = Text
a} :: UpdateFleetMetric)

-- | The name of the index to search.
updateFleetMetric_indexName :: Lens.Lens' UpdateFleetMetric Prelude.Text
updateFleetMetric_indexName :: (Text -> f Text) -> UpdateFleetMetric -> f UpdateFleetMetric
updateFleetMetric_indexName = (UpdateFleetMetric -> Text)
-> (UpdateFleetMetric -> Text -> UpdateFleetMetric)
-> Lens UpdateFleetMetric UpdateFleetMetric Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateFleetMetric' {Text
indexName :: Text
$sel:indexName:UpdateFleetMetric' :: UpdateFleetMetric -> Text
indexName} -> Text
indexName) (\s :: UpdateFleetMetric
s@UpdateFleetMetric' {} Text
a -> UpdateFleetMetric
s {$sel:indexName:UpdateFleetMetric' :: Text
indexName = Text
a} :: UpdateFleetMetric)

instance Core.AWSRequest UpdateFleetMetric where
  type
    AWSResponse UpdateFleetMetric =
      UpdateFleetMetricResponse
  request :: UpdateFleetMetric -> Request UpdateFleetMetric
request = Service -> UpdateFleetMetric -> Request UpdateFleetMetric
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateFleetMetric
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFleetMetric)))
response =
    AWSResponse UpdateFleetMetric
-> Logger
-> Service
-> Proxy UpdateFleetMetric
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateFleetMetric)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse UpdateFleetMetric
UpdateFleetMetricResponse
UpdateFleetMetricResponse'

instance Prelude.Hashable UpdateFleetMetric

instance Prelude.NFData UpdateFleetMetric

instance Core.ToHeaders UpdateFleetMetric where
  toHeaders :: UpdateFleetMetric -> [Header]
toHeaders = [Header] -> UpdateFleetMetric -> [Header]
forall a b. a -> b -> a
Prelude.const [Header]
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON UpdateFleetMetric where
  toJSON :: UpdateFleetMetric -> Value
toJSON UpdateFleetMetric' {Maybe Integer
Maybe Natural
Maybe Text
Maybe AggregationType
Maybe FleetMetricUnit
Text
indexName :: Text
metricName :: Text
unit :: Maybe FleetMetricUnit
description :: Maybe Text
queryString :: Maybe Text
expectedVersion :: Maybe Integer
aggregationField :: Maybe Text
queryVersion :: Maybe Text
period :: Maybe Natural
aggregationType :: Maybe AggregationType
$sel:indexName:UpdateFleetMetric' :: UpdateFleetMetric -> Text
$sel:metricName:UpdateFleetMetric' :: UpdateFleetMetric -> Text
$sel:unit:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe FleetMetricUnit
$sel:description:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
$sel:queryString:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
$sel:expectedVersion:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Integer
$sel:aggregationField:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
$sel:queryVersion:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
$sel:period:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Natural
$sel:aggregationType:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe AggregationType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"aggregationType" Text -> AggregationType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AggregationType -> Pair) -> Maybe AggregationType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AggregationType
aggregationType,
            (Text
"period" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
period,
            (Text
"queryVersion" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
queryVersion,
            (Text
"aggregationField" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
aggregationField,
            (Text
"expectedVersion" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Integer -> Pair) -> Maybe Integer -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Integer
expectedVersion,
            (Text
"queryString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
queryString,
            (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"unit" Text -> FleetMetricUnit -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FleetMetricUnit -> Pair) -> Maybe FleetMetricUnit -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FleetMetricUnit
unit,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"indexName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
indexName)
          ]
      )

instance Core.ToPath UpdateFleetMetric where
  toPath :: UpdateFleetMetric -> ByteString
toPath UpdateFleetMetric' {Maybe Integer
Maybe Natural
Maybe Text
Maybe AggregationType
Maybe FleetMetricUnit
Text
indexName :: Text
metricName :: Text
unit :: Maybe FleetMetricUnit
description :: Maybe Text
queryString :: Maybe Text
expectedVersion :: Maybe Integer
aggregationField :: Maybe Text
queryVersion :: Maybe Text
period :: Maybe Natural
aggregationType :: Maybe AggregationType
$sel:indexName:UpdateFleetMetric' :: UpdateFleetMetric -> Text
$sel:metricName:UpdateFleetMetric' :: UpdateFleetMetric -> Text
$sel:unit:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe FleetMetricUnit
$sel:description:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
$sel:queryString:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
$sel:expectedVersion:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Integer
$sel:aggregationField:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
$sel:queryVersion:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Text
$sel:period:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe Natural
$sel:aggregationType:UpdateFleetMetric' :: UpdateFleetMetric -> Maybe AggregationType
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/fleet-metric/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
metricName]

instance Core.ToQuery UpdateFleetMetric where
  toQuery :: UpdateFleetMetric -> QueryString
toQuery = QueryString -> UpdateFleetMetric -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newUpdateFleetMetricResponse' smart constructor.
data UpdateFleetMetricResponse = UpdateFleetMetricResponse'
  {
  }
  deriving (UpdateFleetMetricResponse -> UpdateFleetMetricResponse -> Bool
(UpdateFleetMetricResponse -> UpdateFleetMetricResponse -> Bool)
-> (UpdateFleetMetricResponse -> UpdateFleetMetricResponse -> Bool)
-> Eq UpdateFleetMetricResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateFleetMetricResponse -> UpdateFleetMetricResponse -> Bool
$c/= :: UpdateFleetMetricResponse -> UpdateFleetMetricResponse -> Bool
== :: UpdateFleetMetricResponse -> UpdateFleetMetricResponse -> Bool
$c== :: UpdateFleetMetricResponse -> UpdateFleetMetricResponse -> Bool
Prelude.Eq, ReadPrec [UpdateFleetMetricResponse]
ReadPrec UpdateFleetMetricResponse
Int -> ReadS UpdateFleetMetricResponse
ReadS [UpdateFleetMetricResponse]
(Int -> ReadS UpdateFleetMetricResponse)
-> ReadS [UpdateFleetMetricResponse]
-> ReadPrec UpdateFleetMetricResponse
-> ReadPrec [UpdateFleetMetricResponse]
-> Read UpdateFleetMetricResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateFleetMetricResponse]
$creadListPrec :: ReadPrec [UpdateFleetMetricResponse]
readPrec :: ReadPrec UpdateFleetMetricResponse
$creadPrec :: ReadPrec UpdateFleetMetricResponse
readList :: ReadS [UpdateFleetMetricResponse]
$creadList :: ReadS [UpdateFleetMetricResponse]
readsPrec :: Int -> ReadS UpdateFleetMetricResponse
$creadsPrec :: Int -> ReadS UpdateFleetMetricResponse
Prelude.Read, Int -> UpdateFleetMetricResponse -> ShowS
[UpdateFleetMetricResponse] -> ShowS
UpdateFleetMetricResponse -> String
(Int -> UpdateFleetMetricResponse -> ShowS)
-> (UpdateFleetMetricResponse -> String)
-> ([UpdateFleetMetricResponse] -> ShowS)
-> Show UpdateFleetMetricResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateFleetMetricResponse] -> ShowS
$cshowList :: [UpdateFleetMetricResponse] -> ShowS
show :: UpdateFleetMetricResponse -> String
$cshow :: UpdateFleetMetricResponse -> String
showsPrec :: Int -> UpdateFleetMetricResponse -> ShowS
$cshowsPrec :: Int -> UpdateFleetMetricResponse -> ShowS
Prelude.Show, (forall x.
 UpdateFleetMetricResponse -> Rep UpdateFleetMetricResponse x)
-> (forall x.
    Rep UpdateFleetMetricResponse x -> UpdateFleetMetricResponse)
-> Generic UpdateFleetMetricResponse
forall x.
Rep UpdateFleetMetricResponse x -> UpdateFleetMetricResponse
forall x.
UpdateFleetMetricResponse -> Rep UpdateFleetMetricResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateFleetMetricResponse x -> UpdateFleetMetricResponse
$cfrom :: forall x.
UpdateFleetMetricResponse -> Rep UpdateFleetMetricResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateFleetMetricResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
newUpdateFleetMetricResponse ::
  UpdateFleetMetricResponse
newUpdateFleetMetricResponse :: UpdateFleetMetricResponse
newUpdateFleetMetricResponse =
  UpdateFleetMetricResponse
UpdateFleetMetricResponse'

instance Prelude.NFData UpdateFleetMetricResponse