{-# 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.SSM.Types.InventoryItemAttribute
-- 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.SSM.Types.InventoryItemAttribute where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.InventoryAttributeDataType

-- | Attributes are the entries within the inventory item content. It
-- contains name and value.
--
-- /See:/ 'newInventoryItemAttribute' smart constructor.
data InventoryItemAttribute = InventoryItemAttribute'
  { -- | Name of the inventory item attribute.
    InventoryItemAttribute -> Text
name :: Prelude.Text,
    -- | The data type of the inventory item attribute.
    InventoryItemAttribute -> InventoryAttributeDataType
dataType :: InventoryAttributeDataType
  }
  deriving (InventoryItemAttribute -> InventoryItemAttribute -> Bool
(InventoryItemAttribute -> InventoryItemAttribute -> Bool)
-> (InventoryItemAttribute -> InventoryItemAttribute -> Bool)
-> Eq InventoryItemAttribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InventoryItemAttribute -> InventoryItemAttribute -> Bool
$c/= :: InventoryItemAttribute -> InventoryItemAttribute -> Bool
== :: InventoryItemAttribute -> InventoryItemAttribute -> Bool
$c== :: InventoryItemAttribute -> InventoryItemAttribute -> Bool
Prelude.Eq, ReadPrec [InventoryItemAttribute]
ReadPrec InventoryItemAttribute
Int -> ReadS InventoryItemAttribute
ReadS [InventoryItemAttribute]
(Int -> ReadS InventoryItemAttribute)
-> ReadS [InventoryItemAttribute]
-> ReadPrec InventoryItemAttribute
-> ReadPrec [InventoryItemAttribute]
-> Read InventoryItemAttribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InventoryItemAttribute]
$creadListPrec :: ReadPrec [InventoryItemAttribute]
readPrec :: ReadPrec InventoryItemAttribute
$creadPrec :: ReadPrec InventoryItemAttribute
readList :: ReadS [InventoryItemAttribute]
$creadList :: ReadS [InventoryItemAttribute]
readsPrec :: Int -> ReadS InventoryItemAttribute
$creadsPrec :: Int -> ReadS InventoryItemAttribute
Prelude.Read, Int -> InventoryItemAttribute -> ShowS
[InventoryItemAttribute] -> ShowS
InventoryItemAttribute -> String
(Int -> InventoryItemAttribute -> ShowS)
-> (InventoryItemAttribute -> String)
-> ([InventoryItemAttribute] -> ShowS)
-> Show InventoryItemAttribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InventoryItemAttribute] -> ShowS
$cshowList :: [InventoryItemAttribute] -> ShowS
show :: InventoryItemAttribute -> String
$cshow :: InventoryItemAttribute -> String
showsPrec :: Int -> InventoryItemAttribute -> ShowS
$cshowsPrec :: Int -> InventoryItemAttribute -> ShowS
Prelude.Show, (forall x. InventoryItemAttribute -> Rep InventoryItemAttribute x)
-> (forall x.
    Rep InventoryItemAttribute x -> InventoryItemAttribute)
-> Generic InventoryItemAttribute
forall x. Rep InventoryItemAttribute x -> InventoryItemAttribute
forall x. InventoryItemAttribute -> Rep InventoryItemAttribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InventoryItemAttribute x -> InventoryItemAttribute
$cfrom :: forall x. InventoryItemAttribute -> Rep InventoryItemAttribute x
Prelude.Generic)

-- |
-- Create a value of 'InventoryItemAttribute' 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:
--
-- 'name', 'inventoryItemAttribute_name' - Name of the inventory item attribute.
--
-- 'dataType', 'inventoryItemAttribute_dataType' - The data type of the inventory item attribute.
newInventoryItemAttribute ::
  -- | 'name'
  Prelude.Text ->
  -- | 'dataType'
  InventoryAttributeDataType ->
  InventoryItemAttribute
newInventoryItemAttribute :: Text -> InventoryAttributeDataType -> InventoryItemAttribute
newInventoryItemAttribute Text
pName_ InventoryAttributeDataType
pDataType_ =
  InventoryItemAttribute' :: Text -> InventoryAttributeDataType -> InventoryItemAttribute
InventoryItemAttribute'
    { $sel:name:InventoryItemAttribute' :: Text
name = Text
pName_,
      $sel:dataType:InventoryItemAttribute' :: InventoryAttributeDataType
dataType = InventoryAttributeDataType
pDataType_
    }

-- | Name of the inventory item attribute.
inventoryItemAttribute_name :: Lens.Lens' InventoryItemAttribute Prelude.Text
inventoryItemAttribute_name :: (Text -> f Text)
-> InventoryItemAttribute -> f InventoryItemAttribute
inventoryItemAttribute_name = (InventoryItemAttribute -> Text)
-> (InventoryItemAttribute -> Text -> InventoryItemAttribute)
-> Lens InventoryItemAttribute InventoryItemAttribute Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryItemAttribute' {Text
name :: Text
$sel:name:InventoryItemAttribute' :: InventoryItemAttribute -> Text
name} -> Text
name) (\s :: InventoryItemAttribute
s@InventoryItemAttribute' {} Text
a -> InventoryItemAttribute
s {$sel:name:InventoryItemAttribute' :: Text
name = Text
a} :: InventoryItemAttribute)

-- | The data type of the inventory item attribute.
inventoryItemAttribute_dataType :: Lens.Lens' InventoryItemAttribute InventoryAttributeDataType
inventoryItemAttribute_dataType :: (InventoryAttributeDataType -> f InventoryAttributeDataType)
-> InventoryItemAttribute -> f InventoryItemAttribute
inventoryItemAttribute_dataType = (InventoryItemAttribute -> InventoryAttributeDataType)
-> (InventoryItemAttribute
    -> InventoryAttributeDataType -> InventoryItemAttribute)
-> Lens
     InventoryItemAttribute
     InventoryItemAttribute
     InventoryAttributeDataType
     InventoryAttributeDataType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryItemAttribute' {InventoryAttributeDataType
dataType :: InventoryAttributeDataType
$sel:dataType:InventoryItemAttribute' :: InventoryItemAttribute -> InventoryAttributeDataType
dataType} -> InventoryAttributeDataType
dataType) (\s :: InventoryItemAttribute
s@InventoryItemAttribute' {} InventoryAttributeDataType
a -> InventoryItemAttribute
s {$sel:dataType:InventoryItemAttribute' :: InventoryAttributeDataType
dataType = InventoryAttributeDataType
a} :: InventoryItemAttribute)

instance Core.FromJSON InventoryItemAttribute where
  parseJSON :: Value -> Parser InventoryItemAttribute
parseJSON =
    String
-> (Object -> Parser InventoryItemAttribute)
-> Value
-> Parser InventoryItemAttribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InventoryItemAttribute"
      ( \Object
x ->
          Text -> InventoryAttributeDataType -> InventoryItemAttribute
InventoryItemAttribute'
            (Text -> InventoryAttributeDataType -> InventoryItemAttribute)
-> Parser Text
-> Parser (InventoryAttributeDataType -> InventoryItemAttribute)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"Name")
            Parser (InventoryAttributeDataType -> InventoryItemAttribute)
-> Parser InventoryAttributeDataType
-> Parser InventoryItemAttribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser InventoryAttributeDataType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DataType")
      )

instance Prelude.Hashable InventoryItemAttribute

instance Prelude.NFData InventoryItemAttribute