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

-- | The inventory result item.
--
-- /See:/ 'newInventoryResultItem' smart constructor.
data InventoryResultItem = InventoryResultItem'
  { -- | The time inventory item data was captured.
    InventoryResultItem -> Maybe Text
captureTime :: Prelude.Maybe Prelude.Text,
    -- | 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 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
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]
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
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. 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:
--
-- 'captureTime', 'inventoryResultItem_captureTime' - The time inventory item data was captured.
--
-- '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.
--
-- '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'
    { $sel:captureTime:InventoryResultItem' :: Maybe Text
captureTime = forall a. Maybe a
Prelude.Nothing,
      $sel:contentHash:InventoryResultItem' :: Maybe Text
contentHash = 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 = forall a. Monoid a => a
Prelude.mempty
    }

-- | The time inventory item data was captured.
inventoryResultItem_captureTime :: Lens.Lens' InventoryResultItem (Prelude.Maybe Prelude.Text)
inventoryResultItem_captureTime :: Lens' InventoryResultItem (Maybe Text)
inventoryResultItem_captureTime = 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)

-- | 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 :: Lens' InventoryResultItem (Maybe Text)
inventoryResultItem_contentHash = 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 name of the inventory result item type.
inventoryResultItem_typeName :: Lens.Lens' InventoryResultItem Prelude.Text
inventoryResultItem_typeName :: Lens' InventoryResultItem Text
inventoryResultItem_typeName = 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 :: Lens' InventoryResultItem Text
inventoryResultItem_schemaVersion = 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 :: Lens' InventoryResultItem [HashMap Text Text]
inventoryResultItem_content = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable InventoryResultItem where
  hashWithSalt :: Int -> InventoryResultItem -> Int
hashWithSalt Int
_salt InventoryResultItem' {[HashMap Text Text]
Maybe Text
Text
content :: [HashMap Text Text]
schemaVersion :: Text
typeName :: Text
contentHash :: Maybe Text
captureTime :: Maybe Text
$sel:content:InventoryResultItem' :: InventoryResultItem -> [HashMap Text Text]
$sel:schemaVersion:InventoryResultItem' :: InventoryResultItem -> Text
$sel:typeName:InventoryResultItem' :: InventoryResultItem -> Text
$sel:contentHash:InventoryResultItem' :: InventoryResultItem -> Maybe Text
$sel:captureTime:InventoryResultItem' :: InventoryResultItem -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
captureTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
contentHash
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
typeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
schemaVersion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [HashMap Text Text]
content

instance Prelude.NFData InventoryResultItem where
  rnf :: InventoryResultItem -> ()
rnf InventoryResultItem' {[HashMap Text Text]
Maybe Text
Text
content :: [HashMap Text Text]
schemaVersion :: Text
typeName :: Text
contentHash :: Maybe Text
captureTime :: Maybe Text
$sel:content:InventoryResultItem' :: InventoryResultItem -> [HashMap Text Text]
$sel:schemaVersion:InventoryResultItem' :: InventoryResultItem -> Text
$sel:typeName:InventoryResultItem' :: InventoryResultItem -> Text
$sel:contentHash:InventoryResultItem' :: InventoryResultItem -> Maybe Text
$sel:captureTime:InventoryResultItem' :: InventoryResultItem -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
captureTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
contentHash
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
typeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
schemaVersion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [HashMap Text Text]
content