{-# 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.ElasticInference.Types.KeyValuePair
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ElasticInference.Types.KeyValuePair where

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

-- | A throughput entry for an Elastic Inference Accelerator type.
--
-- /See:/ 'newKeyValuePair' smart constructor.
data KeyValuePair = KeyValuePair'
  { -- | The throughput value of the Elastic Inference Accelerator type. It can
    -- assume the following values: TFLOPS16bit: the throughput expressed in
    -- 16bit TeraFLOPS. TFLOPS32bit: the throughput expressed in 32bit
    -- TeraFLOPS.
    KeyValuePair -> Maybe Text
key :: Prelude.Maybe Prelude.Text,
    -- | The throughput value of the Elastic Inference Accelerator type.
    KeyValuePair -> Maybe Int
value :: Prelude.Maybe Prelude.Int
  }
  deriving (KeyValuePair -> KeyValuePair -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyValuePair -> KeyValuePair -> Bool
$c/= :: KeyValuePair -> KeyValuePair -> Bool
== :: KeyValuePair -> KeyValuePair -> Bool
$c== :: KeyValuePair -> KeyValuePair -> Bool
Prelude.Eq, ReadPrec [KeyValuePair]
ReadPrec KeyValuePair
Int -> ReadS KeyValuePair
ReadS [KeyValuePair]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeyValuePair]
$creadListPrec :: ReadPrec [KeyValuePair]
readPrec :: ReadPrec KeyValuePair
$creadPrec :: ReadPrec KeyValuePair
readList :: ReadS [KeyValuePair]
$creadList :: ReadS [KeyValuePair]
readsPrec :: Int -> ReadS KeyValuePair
$creadsPrec :: Int -> ReadS KeyValuePair
Prelude.Read, Int -> KeyValuePair -> ShowS
[KeyValuePair] -> ShowS
KeyValuePair -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyValuePair] -> ShowS
$cshowList :: [KeyValuePair] -> ShowS
show :: KeyValuePair -> String
$cshow :: KeyValuePair -> String
showsPrec :: Int -> KeyValuePair -> ShowS
$cshowsPrec :: Int -> KeyValuePair -> ShowS
Prelude.Show, forall x. Rep KeyValuePair x -> KeyValuePair
forall x. KeyValuePair -> Rep KeyValuePair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyValuePair x -> KeyValuePair
$cfrom :: forall x. KeyValuePair -> Rep KeyValuePair x
Prelude.Generic)

-- |
-- Create a value of 'KeyValuePair' 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:
--
-- 'key', 'keyValuePair_key' - The throughput value of the Elastic Inference Accelerator type. It can
-- assume the following values: TFLOPS16bit: the throughput expressed in
-- 16bit TeraFLOPS. TFLOPS32bit: the throughput expressed in 32bit
-- TeraFLOPS.
--
-- 'value', 'keyValuePair_value' - The throughput value of the Elastic Inference Accelerator type.
newKeyValuePair ::
  KeyValuePair
newKeyValuePair :: KeyValuePair
newKeyValuePair =
  KeyValuePair'
    { $sel:key:KeyValuePair' :: Maybe Text
key = forall a. Maybe a
Prelude.Nothing,
      $sel:value:KeyValuePair' :: Maybe Int
value = forall a. Maybe a
Prelude.Nothing
    }

-- | The throughput value of the Elastic Inference Accelerator type. It can
-- assume the following values: TFLOPS16bit: the throughput expressed in
-- 16bit TeraFLOPS. TFLOPS32bit: the throughput expressed in 32bit
-- TeraFLOPS.
keyValuePair_key :: Lens.Lens' KeyValuePair (Prelude.Maybe Prelude.Text)
keyValuePair_key :: Lens' KeyValuePair (Maybe Text)
keyValuePair_key = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyValuePair' {Maybe Text
key :: Maybe Text
$sel:key:KeyValuePair' :: KeyValuePair -> Maybe Text
key} -> Maybe Text
key) (\s :: KeyValuePair
s@KeyValuePair' {} Maybe Text
a -> KeyValuePair
s {$sel:key:KeyValuePair' :: Maybe Text
key = Maybe Text
a} :: KeyValuePair)

-- | The throughput value of the Elastic Inference Accelerator type.
keyValuePair_value :: Lens.Lens' KeyValuePair (Prelude.Maybe Prelude.Int)
keyValuePair_value :: Lens' KeyValuePair (Maybe Int)
keyValuePair_value = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyValuePair' {Maybe Int
value :: Maybe Int
$sel:value:KeyValuePair' :: KeyValuePair -> Maybe Int
value} -> Maybe Int
value) (\s :: KeyValuePair
s@KeyValuePair' {} Maybe Int
a -> KeyValuePair
s {$sel:value:KeyValuePair' :: Maybe Int
value = Maybe Int
a} :: KeyValuePair)

instance Data.FromJSON KeyValuePair where
  parseJSON :: Value -> Parser KeyValuePair
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"KeyValuePair"
      ( \Object
x ->
          Maybe Text -> Maybe Int -> KeyValuePair
KeyValuePair'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"key")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"value")
      )

instance Prelude.Hashable KeyValuePair where
  hashWithSalt :: Int -> KeyValuePair -> Int
hashWithSalt Int
_salt KeyValuePair' {Maybe Int
Maybe Text
value :: Maybe Int
key :: Maybe Text
$sel:value:KeyValuePair' :: KeyValuePair -> Maybe Int
$sel:key:KeyValuePair' :: KeyValuePair -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
key
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
value

instance Prelude.NFData KeyValuePair where
  rnf :: KeyValuePair -> ()
rnf KeyValuePair' {Maybe Int
Maybe Text
value :: Maybe Int
key :: Maybe Text
$sel:value:KeyValuePair' :: KeyValuePair -> Maybe Int
$sel:key:KeyValuePair' :: KeyValuePair -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
key seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
value