{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.FleetMetricNameAndArn
-- 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)
module Amazonka.IoT.Types.FleetMetricNameAndArn where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The name and ARN of a fleet metric.
--
-- /See:/ 'newFleetMetricNameAndArn' smart constructor.
data FleetMetricNameAndArn = FleetMetricNameAndArn'
  { -- | The fleet metric name.
    FleetMetricNameAndArn -> Maybe Text
metricName :: Prelude.Maybe Prelude.Text,
    -- | The fleet metric ARN.
    FleetMetricNameAndArn -> Maybe Text
metricArn :: Prelude.Maybe Prelude.Text
  }
  deriving (FleetMetricNameAndArn -> FleetMetricNameAndArn -> Bool
(FleetMetricNameAndArn -> FleetMetricNameAndArn -> Bool)
-> (FleetMetricNameAndArn -> FleetMetricNameAndArn -> Bool)
-> Eq FleetMetricNameAndArn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FleetMetricNameAndArn -> FleetMetricNameAndArn -> Bool
$c/= :: FleetMetricNameAndArn -> FleetMetricNameAndArn -> Bool
== :: FleetMetricNameAndArn -> FleetMetricNameAndArn -> Bool
$c== :: FleetMetricNameAndArn -> FleetMetricNameAndArn -> Bool
Prelude.Eq, ReadPrec [FleetMetricNameAndArn]
ReadPrec FleetMetricNameAndArn
Int -> ReadS FleetMetricNameAndArn
ReadS [FleetMetricNameAndArn]
(Int -> ReadS FleetMetricNameAndArn)
-> ReadS [FleetMetricNameAndArn]
-> ReadPrec FleetMetricNameAndArn
-> ReadPrec [FleetMetricNameAndArn]
-> Read FleetMetricNameAndArn
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FleetMetricNameAndArn]
$creadListPrec :: ReadPrec [FleetMetricNameAndArn]
readPrec :: ReadPrec FleetMetricNameAndArn
$creadPrec :: ReadPrec FleetMetricNameAndArn
readList :: ReadS [FleetMetricNameAndArn]
$creadList :: ReadS [FleetMetricNameAndArn]
readsPrec :: Int -> ReadS FleetMetricNameAndArn
$creadsPrec :: Int -> ReadS FleetMetricNameAndArn
Prelude.Read, Int -> FleetMetricNameAndArn -> ShowS
[FleetMetricNameAndArn] -> ShowS
FleetMetricNameAndArn -> String
(Int -> FleetMetricNameAndArn -> ShowS)
-> (FleetMetricNameAndArn -> String)
-> ([FleetMetricNameAndArn] -> ShowS)
-> Show FleetMetricNameAndArn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FleetMetricNameAndArn] -> ShowS
$cshowList :: [FleetMetricNameAndArn] -> ShowS
show :: FleetMetricNameAndArn -> String
$cshow :: FleetMetricNameAndArn -> String
showsPrec :: Int -> FleetMetricNameAndArn -> ShowS
$cshowsPrec :: Int -> FleetMetricNameAndArn -> ShowS
Prelude.Show, (forall x. FleetMetricNameAndArn -> Rep FleetMetricNameAndArn x)
-> (forall x. Rep FleetMetricNameAndArn x -> FleetMetricNameAndArn)
-> Generic FleetMetricNameAndArn
forall x. Rep FleetMetricNameAndArn x -> FleetMetricNameAndArn
forall x. FleetMetricNameAndArn -> Rep FleetMetricNameAndArn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep FleetMetricNameAndArn x -> FleetMetricNameAndArn
$cfrom :: forall x. FleetMetricNameAndArn -> Rep FleetMetricNameAndArn x
Prelude.Generic)

-- |
-- Create a value of 'FleetMetricNameAndArn' 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', 'fleetMetricNameAndArn_metricName' - The fleet metric name.
--
-- 'metricArn', 'fleetMetricNameAndArn_metricArn' - The fleet metric ARN.
newFleetMetricNameAndArn ::
  FleetMetricNameAndArn
newFleetMetricNameAndArn :: FleetMetricNameAndArn
newFleetMetricNameAndArn =
  FleetMetricNameAndArn' :: Maybe Text -> Maybe Text -> FleetMetricNameAndArn
FleetMetricNameAndArn'
    { $sel:metricName:FleetMetricNameAndArn' :: Maybe Text
metricName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:metricArn:FleetMetricNameAndArn' :: Maybe Text
metricArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The fleet metric name.
fleetMetricNameAndArn_metricName :: Lens.Lens' FleetMetricNameAndArn (Prelude.Maybe Prelude.Text)
fleetMetricNameAndArn_metricName :: (Maybe Text -> f (Maybe Text))
-> FleetMetricNameAndArn -> f FleetMetricNameAndArn
fleetMetricNameAndArn_metricName = (FleetMetricNameAndArn -> Maybe Text)
-> (FleetMetricNameAndArn -> Maybe Text -> FleetMetricNameAndArn)
-> Lens
     FleetMetricNameAndArn
     FleetMetricNameAndArn
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetMetricNameAndArn' {Maybe Text
metricName :: Maybe Text
$sel:metricName:FleetMetricNameAndArn' :: FleetMetricNameAndArn -> Maybe Text
metricName} -> Maybe Text
metricName) (\s :: FleetMetricNameAndArn
s@FleetMetricNameAndArn' {} Maybe Text
a -> FleetMetricNameAndArn
s {$sel:metricName:FleetMetricNameAndArn' :: Maybe Text
metricName = Maybe Text
a} :: FleetMetricNameAndArn)

-- | The fleet metric ARN.
fleetMetricNameAndArn_metricArn :: Lens.Lens' FleetMetricNameAndArn (Prelude.Maybe Prelude.Text)
fleetMetricNameAndArn_metricArn :: (Maybe Text -> f (Maybe Text))
-> FleetMetricNameAndArn -> f FleetMetricNameAndArn
fleetMetricNameAndArn_metricArn = (FleetMetricNameAndArn -> Maybe Text)
-> (FleetMetricNameAndArn -> Maybe Text -> FleetMetricNameAndArn)
-> Lens
     FleetMetricNameAndArn
     FleetMetricNameAndArn
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FleetMetricNameAndArn' {Maybe Text
metricArn :: Maybe Text
$sel:metricArn:FleetMetricNameAndArn' :: FleetMetricNameAndArn -> Maybe Text
metricArn} -> Maybe Text
metricArn) (\s :: FleetMetricNameAndArn
s@FleetMetricNameAndArn' {} Maybe Text
a -> FleetMetricNameAndArn
s {$sel:metricArn:FleetMetricNameAndArn' :: Maybe Text
metricArn = Maybe Text
a} :: FleetMetricNameAndArn)

instance Core.FromJSON FleetMetricNameAndArn where
  parseJSON :: Value -> Parser FleetMetricNameAndArn
parseJSON =
    String
-> (Object -> Parser FleetMetricNameAndArn)
-> Value
-> Parser FleetMetricNameAndArn
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FleetMetricNameAndArn"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> FleetMetricNameAndArn
FleetMetricNameAndArn'
            (Maybe Text -> Maybe Text -> FleetMetricNameAndArn)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> FleetMetricNameAndArn)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"metricName")
            Parser (Maybe Text -> FleetMetricNameAndArn)
-> Parser (Maybe Text) -> Parser FleetMetricNameAndArn
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"metricArn")
      )

instance Prelude.Hashable FleetMetricNameAndArn

instance Prelude.NFData FleetMetricNameAndArn