{-# 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.CreateCustomMetric
-- 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)
--
-- Use this API to define a Custom Metric published by your devices to
-- Device Defender.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions CreateCustomMetric>
-- action.
module Amazonka.IoT.CreateCustomMetric
  ( -- * Creating a Request
    CreateCustomMetric (..),
    newCreateCustomMetric,

    -- * Request Lenses
    createCustomMetric_displayName,
    createCustomMetric_tags,
    createCustomMetric_metricName,
    createCustomMetric_metricType,
    createCustomMetric_clientRequestToken,

    -- * Destructuring the Response
    CreateCustomMetricResponse (..),
    newCreateCustomMetricResponse,

    -- * Response Lenses
    createCustomMetricResponse_metricName,
    createCustomMetricResponse_metricArn,
    createCustomMetricResponse_httpStatus,
  )
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:/ 'newCreateCustomMetric' smart constructor.
data CreateCustomMetric = CreateCustomMetric'
  { -- | Field represents a friendly name in the console for the custom metric;
    -- it doesn\'t have to be unique. Don\'t use this name as the metric
    -- identifier in the device metric report. Can be updated once defined.
    CreateCustomMetric -> Maybe Text
displayName :: Prelude.Maybe Prelude.Text,
    -- | Metadata that can be used to manage the custom metric.
    CreateCustomMetric -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the custom metric. This will be used in the metric report
    -- submitted from the device\/thing. Shouldn\'t begin with @aws:@. Cannot
    -- be updated once defined.
    CreateCustomMetric -> Text
metricName :: Prelude.Text,
    -- | The type of the custom metric. Types include @string-list@,
    -- @ip-address-list@, @number-list@, and @number@.
    CreateCustomMetric -> CustomMetricType
metricType :: CustomMetricType,
    -- | Each custom metric must have a unique client request token. If you try
    -- to create a new custom metric that already exists with a different
    -- token, an exception occurs. If you omit this value, Amazon Web Services
    -- SDKs will automatically generate a unique client request.
    CreateCustomMetric -> Text
clientRequestToken :: Prelude.Text
  }
  deriving (CreateCustomMetric -> CreateCustomMetric -> Bool
(CreateCustomMetric -> CreateCustomMetric -> Bool)
-> (CreateCustomMetric -> CreateCustomMetric -> Bool)
-> Eq CreateCustomMetric
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomMetric -> CreateCustomMetric -> Bool
$c/= :: CreateCustomMetric -> CreateCustomMetric -> Bool
== :: CreateCustomMetric -> CreateCustomMetric -> Bool
$c== :: CreateCustomMetric -> CreateCustomMetric -> Bool
Prelude.Eq, ReadPrec [CreateCustomMetric]
ReadPrec CreateCustomMetric
Int -> ReadS CreateCustomMetric
ReadS [CreateCustomMetric]
(Int -> ReadS CreateCustomMetric)
-> ReadS [CreateCustomMetric]
-> ReadPrec CreateCustomMetric
-> ReadPrec [CreateCustomMetric]
-> Read CreateCustomMetric
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomMetric]
$creadListPrec :: ReadPrec [CreateCustomMetric]
readPrec :: ReadPrec CreateCustomMetric
$creadPrec :: ReadPrec CreateCustomMetric
readList :: ReadS [CreateCustomMetric]
$creadList :: ReadS [CreateCustomMetric]
readsPrec :: Int -> ReadS CreateCustomMetric
$creadsPrec :: Int -> ReadS CreateCustomMetric
Prelude.Read, Int -> CreateCustomMetric -> ShowS
[CreateCustomMetric] -> ShowS
CreateCustomMetric -> String
(Int -> CreateCustomMetric -> ShowS)
-> (CreateCustomMetric -> String)
-> ([CreateCustomMetric] -> ShowS)
-> Show CreateCustomMetric
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomMetric] -> ShowS
$cshowList :: [CreateCustomMetric] -> ShowS
show :: CreateCustomMetric -> String
$cshow :: CreateCustomMetric -> String
showsPrec :: Int -> CreateCustomMetric -> ShowS
$cshowsPrec :: Int -> CreateCustomMetric -> ShowS
Prelude.Show, (forall x. CreateCustomMetric -> Rep CreateCustomMetric x)
-> (forall x. Rep CreateCustomMetric x -> CreateCustomMetric)
-> Generic CreateCustomMetric
forall x. Rep CreateCustomMetric x -> CreateCustomMetric
forall x. CreateCustomMetric -> Rep CreateCustomMetric x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCustomMetric x -> CreateCustomMetric
$cfrom :: forall x. CreateCustomMetric -> Rep CreateCustomMetric x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomMetric' 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:
--
-- 'displayName', 'createCustomMetric_displayName' - Field represents a friendly name in the console for the custom metric;
-- it doesn\'t have to be unique. Don\'t use this name as the metric
-- identifier in the device metric report. Can be updated once defined.
--
-- 'tags', 'createCustomMetric_tags' - Metadata that can be used to manage the custom metric.
--
-- 'metricName', 'createCustomMetric_metricName' - The name of the custom metric. This will be used in the metric report
-- submitted from the device\/thing. Shouldn\'t begin with @aws:@. Cannot
-- be updated once defined.
--
-- 'metricType', 'createCustomMetric_metricType' - The type of the custom metric. Types include @string-list@,
-- @ip-address-list@, @number-list@, and @number@.
--
-- 'clientRequestToken', 'createCustomMetric_clientRequestToken' - Each custom metric must have a unique client request token. If you try
-- to create a new custom metric that already exists with a different
-- token, an exception occurs. If you omit this value, Amazon Web Services
-- SDKs will automatically generate a unique client request.
newCreateCustomMetric ::
  -- | 'metricName'
  Prelude.Text ->
  -- | 'metricType'
  CustomMetricType ->
  -- | 'clientRequestToken'
  Prelude.Text ->
  CreateCustomMetric
newCreateCustomMetric :: Text -> CustomMetricType -> Text -> CreateCustomMetric
newCreateCustomMetric
  Text
pMetricName_
  CustomMetricType
pMetricType_
  Text
pClientRequestToken_ =
    CreateCustomMetric' :: Maybe Text
-> Maybe [Tag]
-> Text
-> CustomMetricType
-> Text
-> CreateCustomMetric
CreateCustomMetric'
      { $sel:displayName:CreateCustomMetric' :: Maybe Text
displayName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateCustomMetric' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:metricName:CreateCustomMetric' :: Text
metricName = Text
pMetricName_,
        $sel:metricType:CreateCustomMetric' :: CustomMetricType
metricType = CustomMetricType
pMetricType_,
        $sel:clientRequestToken:CreateCustomMetric' :: Text
clientRequestToken = Text
pClientRequestToken_
      }

-- | Field represents a friendly name in the console for the custom metric;
-- it doesn\'t have to be unique. Don\'t use this name as the metric
-- identifier in the device metric report. Can be updated once defined.
createCustomMetric_displayName :: Lens.Lens' CreateCustomMetric (Prelude.Maybe Prelude.Text)
createCustomMetric_displayName :: (Maybe Text -> f (Maybe Text))
-> CreateCustomMetric -> f CreateCustomMetric
createCustomMetric_displayName = (CreateCustomMetric -> Maybe Text)
-> (CreateCustomMetric -> Maybe Text -> CreateCustomMetric)
-> Lens
     CreateCustomMetric CreateCustomMetric (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetric' {Maybe Text
displayName :: Maybe Text
$sel:displayName:CreateCustomMetric' :: CreateCustomMetric -> Maybe Text
displayName} -> Maybe Text
displayName) (\s :: CreateCustomMetric
s@CreateCustomMetric' {} Maybe Text
a -> CreateCustomMetric
s {$sel:displayName:CreateCustomMetric' :: Maybe Text
displayName = Maybe Text
a} :: CreateCustomMetric)

-- | Metadata that can be used to manage the custom metric.
createCustomMetric_tags :: Lens.Lens' CreateCustomMetric (Prelude.Maybe [Tag])
createCustomMetric_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCustomMetric -> f CreateCustomMetric
createCustomMetric_tags = (CreateCustomMetric -> Maybe [Tag])
-> (CreateCustomMetric -> Maybe [Tag] -> CreateCustomMetric)
-> Lens
     CreateCustomMetric CreateCustomMetric (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetric' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateCustomMetric' :: CreateCustomMetric -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateCustomMetric
s@CreateCustomMetric' {} Maybe [Tag]
a -> CreateCustomMetric
s {$sel:tags:CreateCustomMetric' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateCustomMetric) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateCustomMetric -> f CreateCustomMetric)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCustomMetric
-> f CreateCustomMetric
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the custom metric. This will be used in the metric report
-- submitted from the device\/thing. Shouldn\'t begin with @aws:@. Cannot
-- be updated once defined.
createCustomMetric_metricName :: Lens.Lens' CreateCustomMetric Prelude.Text
createCustomMetric_metricName :: (Text -> f Text) -> CreateCustomMetric -> f CreateCustomMetric
createCustomMetric_metricName = (CreateCustomMetric -> Text)
-> (CreateCustomMetric -> Text -> CreateCustomMetric)
-> Lens CreateCustomMetric CreateCustomMetric Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetric' {Text
metricName :: Text
$sel:metricName:CreateCustomMetric' :: CreateCustomMetric -> Text
metricName} -> Text
metricName) (\s :: CreateCustomMetric
s@CreateCustomMetric' {} Text
a -> CreateCustomMetric
s {$sel:metricName:CreateCustomMetric' :: Text
metricName = Text
a} :: CreateCustomMetric)

-- | The type of the custom metric. Types include @string-list@,
-- @ip-address-list@, @number-list@, and @number@.
createCustomMetric_metricType :: Lens.Lens' CreateCustomMetric CustomMetricType
createCustomMetric_metricType :: (CustomMetricType -> f CustomMetricType)
-> CreateCustomMetric -> f CreateCustomMetric
createCustomMetric_metricType = (CreateCustomMetric -> CustomMetricType)
-> (CreateCustomMetric -> CustomMetricType -> CreateCustomMetric)
-> Lens
     CreateCustomMetric
     CreateCustomMetric
     CustomMetricType
     CustomMetricType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetric' {CustomMetricType
metricType :: CustomMetricType
$sel:metricType:CreateCustomMetric' :: CreateCustomMetric -> CustomMetricType
metricType} -> CustomMetricType
metricType) (\s :: CreateCustomMetric
s@CreateCustomMetric' {} CustomMetricType
a -> CreateCustomMetric
s {$sel:metricType:CreateCustomMetric' :: CustomMetricType
metricType = CustomMetricType
a} :: CreateCustomMetric)

-- | Each custom metric must have a unique client request token. If you try
-- to create a new custom metric that already exists with a different
-- token, an exception occurs. If you omit this value, Amazon Web Services
-- SDKs will automatically generate a unique client request.
createCustomMetric_clientRequestToken :: Lens.Lens' CreateCustomMetric Prelude.Text
createCustomMetric_clientRequestToken :: (Text -> f Text) -> CreateCustomMetric -> f CreateCustomMetric
createCustomMetric_clientRequestToken = (CreateCustomMetric -> Text)
-> (CreateCustomMetric -> Text -> CreateCustomMetric)
-> Lens CreateCustomMetric CreateCustomMetric Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetric' {Text
clientRequestToken :: Text
$sel:clientRequestToken:CreateCustomMetric' :: CreateCustomMetric -> Text
clientRequestToken} -> Text
clientRequestToken) (\s :: CreateCustomMetric
s@CreateCustomMetric' {} Text
a -> CreateCustomMetric
s {$sel:clientRequestToken:CreateCustomMetric' :: Text
clientRequestToken = Text
a} :: CreateCustomMetric)

instance Core.AWSRequest CreateCustomMetric where
  type
    AWSResponse CreateCustomMetric =
      CreateCustomMetricResponse
  request :: CreateCustomMetric -> Request CreateCustomMetric
request = Service -> CreateCustomMetric -> Request CreateCustomMetric
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateCustomMetric
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCustomMetric)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateCustomMetric))
-> Logger
-> Service
-> Proxy CreateCustomMetric
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCustomMetric)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> CreateCustomMetricResponse
CreateCustomMetricResponse'
            (Maybe Text -> Maybe Text -> Int -> CreateCustomMetricResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateCustomMetricResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"metricName")
            Either String (Maybe Text -> Int -> CreateCustomMetricResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateCustomMetricResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"metricArn")
            Either String (Int -> CreateCustomMetricResponse)
-> Either String Int -> Either String CreateCustomMetricResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateCustomMetric

instance Prelude.NFData CreateCustomMetric

instance Core.ToHeaders CreateCustomMetric where
  toHeaders :: CreateCustomMetric -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateCustomMetric -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateCustomMetric where
  toJSON :: CreateCustomMetric -> Value
toJSON CreateCustomMetric' {Maybe [Tag]
Maybe Text
Text
CustomMetricType
clientRequestToken :: Text
metricType :: CustomMetricType
metricName :: Text
tags :: Maybe [Tag]
displayName :: Maybe Text
$sel:clientRequestToken:CreateCustomMetric' :: CreateCustomMetric -> Text
$sel:metricType:CreateCustomMetric' :: CreateCustomMetric -> CustomMetricType
$sel:metricName:CreateCustomMetric' :: CreateCustomMetric -> Text
$sel:tags:CreateCustomMetric' :: CreateCustomMetric -> Maybe [Tag]
$sel:displayName:CreateCustomMetric' :: CreateCustomMetric -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"displayName" 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
displayName,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"metricType" Text -> CustomMetricType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CustomMetricType
metricType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"clientRequestToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientRequestToken)
          ]
      )

instance Core.ToPath CreateCustomMetric where
  toPath :: CreateCustomMetric -> ByteString
toPath CreateCustomMetric' {Maybe [Tag]
Maybe Text
Text
CustomMetricType
clientRequestToken :: Text
metricType :: CustomMetricType
metricName :: Text
tags :: Maybe [Tag]
displayName :: Maybe Text
$sel:clientRequestToken:CreateCustomMetric' :: CreateCustomMetric -> Text
$sel:metricType:CreateCustomMetric' :: CreateCustomMetric -> CustomMetricType
$sel:metricName:CreateCustomMetric' :: CreateCustomMetric -> Text
$sel:tags:CreateCustomMetric' :: CreateCustomMetric -> Maybe [Tag]
$sel:displayName:CreateCustomMetric' :: CreateCustomMetric -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/custom-metric/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
metricName]

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

-- | /See:/ 'newCreateCustomMetricResponse' smart constructor.
data CreateCustomMetricResponse = CreateCustomMetricResponse'
  { -- | The name of the custom metric to be used in the metric report.
    CreateCustomMetricResponse -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Number (ARN) of the custom metric, e.g.
    -- @arn:aws-partition:iot:region:accountId:custommetric\/metricName @
    CreateCustomMetricResponse -> Maybe Text
metricArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateCustomMetricResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateCustomMetricResponse -> CreateCustomMetricResponse -> Bool
(CreateCustomMetricResponse -> CreateCustomMetricResponse -> Bool)
-> (CreateCustomMetricResponse
    -> CreateCustomMetricResponse -> Bool)
-> Eq CreateCustomMetricResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCustomMetricResponse -> CreateCustomMetricResponse -> Bool
$c/= :: CreateCustomMetricResponse -> CreateCustomMetricResponse -> Bool
== :: CreateCustomMetricResponse -> CreateCustomMetricResponse -> Bool
$c== :: CreateCustomMetricResponse -> CreateCustomMetricResponse -> Bool
Prelude.Eq, ReadPrec [CreateCustomMetricResponse]
ReadPrec CreateCustomMetricResponse
Int -> ReadS CreateCustomMetricResponse
ReadS [CreateCustomMetricResponse]
(Int -> ReadS CreateCustomMetricResponse)
-> ReadS [CreateCustomMetricResponse]
-> ReadPrec CreateCustomMetricResponse
-> ReadPrec [CreateCustomMetricResponse]
-> Read CreateCustomMetricResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCustomMetricResponse]
$creadListPrec :: ReadPrec [CreateCustomMetricResponse]
readPrec :: ReadPrec CreateCustomMetricResponse
$creadPrec :: ReadPrec CreateCustomMetricResponse
readList :: ReadS [CreateCustomMetricResponse]
$creadList :: ReadS [CreateCustomMetricResponse]
readsPrec :: Int -> ReadS CreateCustomMetricResponse
$creadsPrec :: Int -> ReadS CreateCustomMetricResponse
Prelude.Read, Int -> CreateCustomMetricResponse -> ShowS
[CreateCustomMetricResponse] -> ShowS
CreateCustomMetricResponse -> String
(Int -> CreateCustomMetricResponse -> ShowS)
-> (CreateCustomMetricResponse -> String)
-> ([CreateCustomMetricResponse] -> ShowS)
-> Show CreateCustomMetricResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCustomMetricResponse] -> ShowS
$cshowList :: [CreateCustomMetricResponse] -> ShowS
show :: CreateCustomMetricResponse -> String
$cshow :: CreateCustomMetricResponse -> String
showsPrec :: Int -> CreateCustomMetricResponse -> ShowS
$cshowsPrec :: Int -> CreateCustomMetricResponse -> ShowS
Prelude.Show, (forall x.
 CreateCustomMetricResponse -> Rep CreateCustomMetricResponse x)
-> (forall x.
    Rep CreateCustomMetricResponse x -> CreateCustomMetricResponse)
-> Generic CreateCustomMetricResponse
forall x.
Rep CreateCustomMetricResponse x -> CreateCustomMetricResponse
forall x.
CreateCustomMetricResponse -> Rep CreateCustomMetricResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCustomMetricResponse x -> CreateCustomMetricResponse
$cfrom :: forall x.
CreateCustomMetricResponse -> Rep CreateCustomMetricResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateCustomMetricResponse' 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:
--
-- 'metricName', 'createCustomMetricResponse_metricName' - The name of the custom metric to be used in the metric report.
--
-- 'metricArn', 'createCustomMetricResponse_metricArn' - The Amazon Resource Number (ARN) of the custom metric, e.g.
-- @arn:aws-partition:iot:region:accountId:custommetric\/metricName @
--
-- 'httpStatus', 'createCustomMetricResponse_httpStatus' - The response's http status code.
newCreateCustomMetricResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCustomMetricResponse
newCreateCustomMetricResponse :: Int -> CreateCustomMetricResponse
newCreateCustomMetricResponse Int
pHttpStatus_ =
  CreateCustomMetricResponse' :: Maybe Text -> Maybe Text -> Int -> CreateCustomMetricResponse
CreateCustomMetricResponse'
    { $sel:metricName:CreateCustomMetricResponse' :: Maybe Text
metricName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:metricArn:CreateCustomMetricResponse' :: Maybe Text
metricArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateCustomMetricResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The name of the custom metric to be used in the metric report.
createCustomMetricResponse_metricName :: Lens.Lens' CreateCustomMetricResponse (Prelude.Maybe Prelude.Text)
createCustomMetricResponse_metricName :: (Maybe Text -> f (Maybe Text))
-> CreateCustomMetricResponse -> f CreateCustomMetricResponse
createCustomMetricResponse_metricName = (CreateCustomMetricResponse -> Maybe Text)
-> (CreateCustomMetricResponse
    -> Maybe Text -> CreateCustomMetricResponse)
-> Lens
     CreateCustomMetricResponse
     CreateCustomMetricResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetricResponse' {Maybe Text
metricName :: Maybe Text
$sel:metricName:CreateCustomMetricResponse' :: CreateCustomMetricResponse -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: CreateCustomMetricResponse
s@CreateCustomMetricResponse' {} Maybe Text
a -> CreateCustomMetricResponse
s {$sel:metricName:CreateCustomMetricResponse' :: Maybe Text
metricName = Maybe Text
a} :: CreateCustomMetricResponse)

-- | The Amazon Resource Number (ARN) of the custom metric, e.g.
-- @arn:aws-partition:iot:region:accountId:custommetric\/metricName @
createCustomMetricResponse_metricArn :: Lens.Lens' CreateCustomMetricResponse (Prelude.Maybe Prelude.Text)
createCustomMetricResponse_metricArn :: (Maybe Text -> f (Maybe Text))
-> CreateCustomMetricResponse -> f CreateCustomMetricResponse
createCustomMetricResponse_metricArn = (CreateCustomMetricResponse -> Maybe Text)
-> (CreateCustomMetricResponse
    -> Maybe Text -> CreateCustomMetricResponse)
-> Lens
     CreateCustomMetricResponse
     CreateCustomMetricResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetricResponse' {Maybe Text
metricArn :: Maybe Text
$sel:metricArn:CreateCustomMetricResponse' :: CreateCustomMetricResponse -> Maybe Text
metricArn} -> Maybe Text
metricArn) (\s :: CreateCustomMetricResponse
s@CreateCustomMetricResponse' {} Maybe Text
a -> CreateCustomMetricResponse
s {$sel:metricArn:CreateCustomMetricResponse' :: Maybe Text
metricArn = Maybe Text
a} :: CreateCustomMetricResponse)

-- | The response's http status code.
createCustomMetricResponse_httpStatus :: Lens.Lens' CreateCustomMetricResponse Prelude.Int
createCustomMetricResponse_httpStatus :: (Int -> f Int)
-> CreateCustomMetricResponse -> f CreateCustomMetricResponse
createCustomMetricResponse_httpStatus = (CreateCustomMetricResponse -> Int)
-> (CreateCustomMetricResponse
    -> Int -> CreateCustomMetricResponse)
-> Lens
     CreateCustomMetricResponse CreateCustomMetricResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCustomMetricResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCustomMetricResponse' :: CreateCustomMetricResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCustomMetricResponse
s@CreateCustomMetricResponse' {} Int
a -> CreateCustomMetricResponse
s {$sel:httpStatus:CreateCustomMetricResponse' :: Int
httpStatus = Int
a} :: CreateCustomMetricResponse)

instance Prelude.NFData CreateCustomMetricResponse