{-# 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.InventoryResultItem
-- 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.InventoryResultItem where

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

-- | The inventory result item.
--
-- /See:/ 'newInventoryResultItem' smart constructor.
data InventoryResultItem = InventoryResultItem'
  { -- | MD5 hash of the inventory item type contents. The content hash is used
    -- to determine whether to update inventory information. The PutInventory
    -- API doesn\'t update the inventory item type contents if the MD5 hash
    -- hasn\'t changed since last update.
    InventoryResultItem -> Maybe Text
contentHash :: Prelude.Maybe Prelude.Text,
    -- | The time inventory item data was captured.
    InventoryResultItem -> Maybe Text
captureTime :: Prelude.Maybe Prelude.Text,
    -- | The name of the inventory result item type.
    InventoryResultItem -> Text
typeName :: Prelude.Text,
    -- | The schema version for the inventory result item\/
    InventoryResultItem -> Text
schemaVersion :: Prelude.Text,
    -- | Contains all the inventory data of the item type. Results include
    -- attribute names and values.
    InventoryResultItem -> [HashMap Text Text]
content :: [Prelude.HashMap Prelude.Text Prelude.Text]
  }
  deriving (InventoryResultItem -> InventoryResultItem -> Bool
(InventoryResultItem -> InventoryResultItem -> Bool)
-> (InventoryResultItem -> InventoryResultItem -> Bool)
-> Eq InventoryResultItem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InventoryResultItem -> InventoryResultItem -> Bool
$c/= :: InventoryResultItem -> InventoryResultItem -> Bool
== :: InventoryResultItem -> InventoryResultItem -> Bool
$c== :: InventoryResultItem -> InventoryResultItem -> Bool
Prelude.Eq, ReadPrec [InventoryResultItem]
ReadPrec InventoryResultItem
Int -> ReadS InventoryResultItem
ReadS [InventoryResultItem]
(Int -> ReadS InventoryResultItem)
-> ReadS [InventoryResultItem]
-> ReadPrec InventoryResultItem
-> ReadPrec [InventoryResultItem]
-> Read InventoryResultItem
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InventoryResultItem]
$creadListPrec :: ReadPrec [InventoryResultItem]
readPrec :: ReadPrec InventoryResultItem
$creadPrec :: ReadPrec InventoryResultItem
readList :: ReadS [InventoryResultItem]
$creadList :: ReadS [InventoryResultItem]
readsPrec :: Int -> ReadS InventoryResultItem
$creadsPrec :: Int -> ReadS InventoryResultItem
Prelude.Read, Int -> InventoryResultItem -> ShowS
[InventoryResultItem] -> ShowS
InventoryResultItem -> String
(Int -> InventoryResultItem -> ShowS)
-> (InventoryResultItem -> String)
-> ([InventoryResultItem] -> ShowS)
-> Show InventoryResultItem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InventoryResultItem] -> ShowS
$cshowList :: [InventoryResultItem] -> ShowS
show :: InventoryResultItem -> String
$cshow :: InventoryResultItem -> String
showsPrec :: Int -> InventoryResultItem -> ShowS
$cshowsPrec :: Int -> InventoryResultItem -> ShowS
Prelude.Show, (forall x. InventoryResultItem -> Rep InventoryResultItem x)
-> (forall x. Rep InventoryResultItem x -> InventoryResultItem)
-> Generic InventoryResultItem
forall x. Rep InventoryResultItem x -> InventoryResultItem
forall x. InventoryResultItem -> Rep InventoryResultItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InventoryResultItem x -> InventoryResultItem
$cfrom :: forall x. InventoryResultItem -> Rep InventoryResultItem x
Prelude.Generic)

-- |
-- Create a value of 'InventoryResultItem' 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:
--
-- 'contentHash', 'inventoryResultItem_contentHash' - MD5 hash of the inventory item type contents. The content hash is used
-- to determine whether to update inventory information. The PutInventory
-- API doesn\'t update the inventory item type contents if the MD5 hash
-- hasn\'t changed since last update.
--
-- 'captureTime', 'inventoryResultItem_captureTime' - The time inventory item data was captured.
--
-- 'typeName', 'inventoryResultItem_typeName' - The name of the inventory result item type.
--
-- 'schemaVersion', 'inventoryResultItem_schemaVersion' - The schema version for the inventory result item\/
--
-- 'content', 'inventoryResultItem_content' - Contains all the inventory data of the item type. Results include
-- attribute names and values.
newInventoryResultItem ::
  -- | 'typeName'
  Prelude.Text ->
  -- | 'schemaVersion'
  Prelude.Text ->
  InventoryResultItem
newInventoryResultItem :: Text -> Text -> InventoryResultItem
newInventoryResultItem Text
pTypeName_ Text
pSchemaVersion_ =
  InventoryResultItem' :: Maybe Text
-> Maybe Text
-> Text
-> Text
-> [HashMap Text Text]
-> InventoryResultItem
InventoryResultItem'
    { $sel:contentHash:InventoryResultItem' :: Maybe Text
contentHash = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:captureTime:InventoryResultItem' :: Maybe Text
captureTime = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:typeName:InventoryResultItem' :: Text
typeName = Text
pTypeName_,
      $sel:schemaVersion:InventoryResultItem' :: Text
schemaVersion = Text
pSchemaVersion_,
      $sel:content:InventoryResultItem' :: [HashMap Text Text]
content = [HashMap Text Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | MD5 hash of the inventory item type contents. The content hash is used
-- to determine whether to update inventory information. The PutInventory
-- API doesn\'t update the inventory item type contents if the MD5 hash
-- hasn\'t changed since last update.
inventoryResultItem_contentHash :: Lens.Lens' InventoryResultItem (Prelude.Maybe Prelude.Text)
inventoryResultItem_contentHash :: (Maybe Text -> f (Maybe Text))
-> InventoryResultItem -> f InventoryResultItem
inventoryResultItem_contentHash = (InventoryResultItem -> Maybe Text)
-> (InventoryResultItem -> Maybe Text -> InventoryResultItem)
-> Lens
     InventoryResultItem InventoryResultItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryResultItem' {Maybe Text
contentHash :: Maybe Text
$sel:contentHash:InventoryResultItem' :: InventoryResultItem -> Maybe Text
contentHash} -> Maybe Text
contentHash) (\s :: InventoryResultItem
s@InventoryResultItem' {} Maybe Text
a -> InventoryResultItem
s {$sel:contentHash:InventoryResultItem' :: Maybe Text
contentHash = Maybe Text
a} :: InventoryResultItem)

-- | The time inventory item data was captured.
inventoryResultItem_captureTime :: Lens.Lens' InventoryResultItem (Prelude.Maybe Prelude.Text)
inventoryResultItem_captureTime :: (Maybe Text -> f (Maybe Text))
-> InventoryResultItem -> f InventoryResultItem
inventoryResultItem_captureTime = (InventoryResultItem -> Maybe Text)
-> (InventoryResultItem -> Maybe Text -> InventoryResultItem)
-> Lens
     InventoryResultItem InventoryResultItem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryResultItem' {Maybe Text
captureTime :: Maybe Text
$sel:captureTime:InventoryResultItem' :: InventoryResultItem -> Maybe Text
captureTime} -> Maybe Text
captureTime) (\s :: InventoryResultItem
s@InventoryResultItem' {} Maybe Text
a -> InventoryResultItem
s {$sel:captureTime:InventoryResultItem' :: Maybe Text
captureTime = Maybe Text
a} :: InventoryResultItem)

-- | The name of the inventory result item type.
inventoryResultItem_typeName :: Lens.Lens' InventoryResultItem Prelude.Text
inventoryResultItem_typeName :: (Text -> f Text) -> InventoryResultItem -> f InventoryResultItem
inventoryResultItem_typeName = (InventoryResultItem -> Text)
-> (InventoryResultItem -> Text -> InventoryResultItem)
-> Lens InventoryResultItem InventoryResultItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryResultItem' {Text
typeName :: Text
$sel:typeName:InventoryResultItem' :: InventoryResultItem -> Text
typeName} -> Text
typeName) (\s :: InventoryResultItem
s@InventoryResultItem' {} Text
a -> InventoryResultItem
s {$sel:typeName:InventoryResultItem' :: Text
typeName = Text
a} :: InventoryResultItem)

-- | The schema version for the inventory result item\/
inventoryResultItem_schemaVersion :: Lens.Lens' InventoryResultItem Prelude.Text
inventoryResultItem_schemaVersion :: (Text -> f Text) -> InventoryResultItem -> f InventoryResultItem
inventoryResultItem_schemaVersion = (InventoryResultItem -> Text)
-> (InventoryResultItem -> Text -> InventoryResultItem)
-> Lens InventoryResultItem InventoryResultItem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryResultItem' {Text
schemaVersion :: Text
$sel:schemaVersion:InventoryResultItem' :: InventoryResultItem -> Text
schemaVersion} -> Text
schemaVersion) (\s :: InventoryResultItem
s@InventoryResultItem' {} Text
a -> InventoryResultItem
s {$sel:schemaVersion:InventoryResultItem' :: Text
schemaVersion = Text
a} :: InventoryResultItem)

-- | Contains all the inventory data of the item type. Results include
-- attribute names and values.
inventoryResultItem_content :: Lens.Lens' InventoryResultItem [Prelude.HashMap Prelude.Text Prelude.Text]
inventoryResultItem_content :: ([HashMap Text Text] -> f [HashMap Text Text])
-> InventoryResultItem -> f InventoryResultItem
inventoryResultItem_content = (InventoryResultItem -> [HashMap Text Text])
-> (InventoryResultItem
    -> [HashMap Text Text] -> InventoryResultItem)
-> Lens
     InventoryResultItem
     InventoryResultItem
     [HashMap Text Text]
     [HashMap Text Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryResultItem' {[HashMap Text Text]
content :: [HashMap Text Text]
$sel:content:InventoryResultItem' :: InventoryResultItem -> [HashMap Text Text]
content} -> [HashMap Text Text]
content) (\s :: InventoryResultItem
s@InventoryResultItem' {} [HashMap Text Text]
a -> InventoryResultItem
s {$sel:content:InventoryResultItem' :: [HashMap Text Text]
content = [HashMap Text Text]
a} :: InventoryResultItem) (([HashMap Text Text] -> f [HashMap Text Text])
 -> InventoryResultItem -> f InventoryResultItem)
-> (([HashMap Text Text] -> f [HashMap Text Text])
    -> [HashMap Text Text] -> f [HashMap Text Text])
-> ([HashMap Text Text] -> f [HashMap Text Text])
-> InventoryResultItem
-> f InventoryResultItem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([HashMap Text Text] -> f [HashMap Text Text])
-> [HashMap Text Text] -> f [HashMap Text Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON InventoryResultItem where
  parseJSON :: Value -> Parser InventoryResultItem
parseJSON =
    String
-> (Object -> Parser InventoryResultItem)
-> Value
-> Parser InventoryResultItem
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InventoryResultItem"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Text
-> Text
-> [HashMap Text Text]
-> InventoryResultItem
InventoryResultItem'
            (Maybe Text
 -> Maybe Text
 -> Text
 -> Text
 -> [HashMap Text Text]
 -> InventoryResultItem)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Text -> Text -> [HashMap Text Text] -> InventoryResultItem)
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
"ContentHash")
            Parser
  (Maybe Text
   -> Text -> Text -> [HashMap Text Text] -> InventoryResultItem)
-> Parser (Maybe Text)
-> Parser
     (Text -> Text -> [HashMap Text Text] -> InventoryResultItem)
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
"CaptureTime")
            Parser (Text -> Text -> [HashMap Text Text] -> InventoryResultItem)
-> Parser Text
-> Parser (Text -> [HashMap Text Text] -> InventoryResultItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"TypeName")
            Parser (Text -> [HashMap Text Text] -> InventoryResultItem)
-> Parser Text
-> Parser ([HashMap Text Text] -> InventoryResultItem)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SchemaVersion")
            Parser ([HashMap Text Text] -> InventoryResultItem)
-> Parser [HashMap Text Text] -> Parser InventoryResultItem
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [HashMap Text Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Content" Parser (Maybe [HashMap Text Text])
-> [HashMap Text Text] -> Parser [HashMap Text Text]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [HashMap Text Text]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable InventoryResultItem

instance Prelude.NFData InventoryResultItem