{-# 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.SSMSAP.Types.ComponentSummary
-- 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.SSMSAP.Types.ComponentSummary 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
import Amazonka.SSMSAP.Types.ComponentType

-- |
--
-- /See:/ 'newComponentSummary' smart constructor.
data ComponentSummary = ComponentSummary'
  { ComponentSummary -> Maybe Text
applicationId :: Prelude.Maybe Prelude.Text,
    ComponentSummary -> Maybe Text
componentId :: Prelude.Maybe Prelude.Text,
    ComponentSummary -> Maybe ComponentType
componentType :: Prelude.Maybe ComponentType,
    ComponentSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (ComponentSummary -> ComponentSummary -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ComponentSummary -> ComponentSummary -> Bool
$c/= :: ComponentSummary -> ComponentSummary -> Bool
== :: ComponentSummary -> ComponentSummary -> Bool
$c== :: ComponentSummary -> ComponentSummary -> Bool
Prelude.Eq, ReadPrec [ComponentSummary]
ReadPrec ComponentSummary
Int -> ReadS ComponentSummary
ReadS [ComponentSummary]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ComponentSummary]
$creadListPrec :: ReadPrec [ComponentSummary]
readPrec :: ReadPrec ComponentSummary
$creadPrec :: ReadPrec ComponentSummary
readList :: ReadS [ComponentSummary]
$creadList :: ReadS [ComponentSummary]
readsPrec :: Int -> ReadS ComponentSummary
$creadsPrec :: Int -> ReadS ComponentSummary
Prelude.Read, Int -> ComponentSummary -> ShowS
[ComponentSummary] -> ShowS
ComponentSummary -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ComponentSummary] -> ShowS
$cshowList :: [ComponentSummary] -> ShowS
show :: ComponentSummary -> String
$cshow :: ComponentSummary -> String
showsPrec :: Int -> ComponentSummary -> ShowS
$cshowsPrec :: Int -> ComponentSummary -> ShowS
Prelude.Show, forall x. Rep ComponentSummary x -> ComponentSummary
forall x. ComponentSummary -> Rep ComponentSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ComponentSummary x -> ComponentSummary
$cfrom :: forall x. ComponentSummary -> Rep ComponentSummary x
Prelude.Generic)

-- |
-- Create a value of 'ComponentSummary' 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:
--
-- 'applicationId', 'componentSummary_applicationId' -
--
-- 'componentId', 'componentSummary_componentId' -
--
-- 'componentType', 'componentSummary_componentType' -
--
-- 'tags', 'componentSummary_tags' -
newComponentSummary ::
  ComponentSummary
newComponentSummary :: ComponentSummary
newComponentSummary =
  ComponentSummary'
    { $sel:applicationId:ComponentSummary' :: Maybe Text
applicationId = forall a. Maybe a
Prelude.Nothing,
      $sel:componentId:ComponentSummary' :: Maybe Text
componentId = forall a. Maybe a
Prelude.Nothing,
      $sel:componentType:ComponentSummary' :: Maybe ComponentType
componentType = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ComponentSummary' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing
    }

componentSummary_applicationId :: Lens.Lens' ComponentSummary (Prelude.Maybe Prelude.Text)
componentSummary_applicationId :: Lens' ComponentSummary (Maybe Text)
componentSummary_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Maybe Text
applicationId :: Maybe Text
$sel:applicationId:ComponentSummary' :: ComponentSummary -> Maybe Text
applicationId} -> Maybe Text
applicationId) (\s :: ComponentSummary
s@ComponentSummary' {} Maybe Text
a -> ComponentSummary
s {$sel:applicationId:ComponentSummary' :: Maybe Text
applicationId = Maybe Text
a} :: ComponentSummary)

componentSummary_componentId :: Lens.Lens' ComponentSummary (Prelude.Maybe Prelude.Text)
componentSummary_componentId :: Lens' ComponentSummary (Maybe Text)
componentSummary_componentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Maybe Text
componentId :: Maybe Text
$sel:componentId:ComponentSummary' :: ComponentSummary -> Maybe Text
componentId} -> Maybe Text
componentId) (\s :: ComponentSummary
s@ComponentSummary' {} Maybe Text
a -> ComponentSummary
s {$sel:componentId:ComponentSummary' :: Maybe Text
componentId = Maybe Text
a} :: ComponentSummary)

componentSummary_componentType :: Lens.Lens' ComponentSummary (Prelude.Maybe ComponentType)
componentSummary_componentType :: Lens' ComponentSummary (Maybe ComponentType)
componentSummary_componentType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Maybe ComponentType
componentType :: Maybe ComponentType
$sel:componentType:ComponentSummary' :: ComponentSummary -> Maybe ComponentType
componentType} -> Maybe ComponentType
componentType) (\s :: ComponentSummary
s@ComponentSummary' {} Maybe ComponentType
a -> ComponentSummary
s {$sel:componentType:ComponentSummary' :: Maybe ComponentType
componentType = Maybe ComponentType
a} :: ComponentSummary)

componentSummary_tags :: Lens.Lens' ComponentSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
componentSummary_tags :: Lens' ComponentSummary (Maybe (HashMap Text Text))
componentSummary_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ComponentSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ComponentSummary' :: ComponentSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ComponentSummary
s@ComponentSummary' {} Maybe (HashMap Text Text)
a -> ComponentSummary
s {$sel:tags:ComponentSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ComponentSummary) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Data.FromJSON ComponentSummary where
  parseJSON :: Value -> Parser ComponentSummary
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ComponentSummary"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe ComponentType
-> Maybe (HashMap Text Text)
-> ComponentSummary
ComponentSummary'
            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
"ApplicationId")
            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
"ComponentId")
            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
"ComponentType")
            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
"Tags" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ComponentSummary where
  hashWithSalt :: Int -> ComponentSummary -> Int
hashWithSalt Int
_salt ComponentSummary' {Maybe Text
Maybe (HashMap Text Text)
Maybe ComponentType
tags :: Maybe (HashMap Text Text)
componentType :: Maybe ComponentType
componentId :: Maybe Text
applicationId :: Maybe Text
$sel:tags:ComponentSummary' :: ComponentSummary -> Maybe (HashMap Text Text)
$sel:componentType:ComponentSummary' :: ComponentSummary -> Maybe ComponentType
$sel:componentId:ComponentSummary' :: ComponentSummary -> Maybe Text
$sel:applicationId:ComponentSummary' :: ComponentSummary -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
applicationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
componentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ComponentType
componentType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags

instance Prelude.NFData ComponentSummary where
  rnf :: ComponentSummary -> ()
rnf ComponentSummary' {Maybe Text
Maybe (HashMap Text Text)
Maybe ComponentType
tags :: Maybe (HashMap Text Text)
componentType :: Maybe ComponentType
componentId :: Maybe Text
applicationId :: Maybe Text
$sel:tags:ComponentSummary' :: ComponentSummary -> Maybe (HashMap Text Text)
$sel:componentType:ComponentSummary' :: ComponentSummary -> Maybe ComponentType
$sel:componentId:ComponentSummary' :: ComponentSummary -> Maybe Text
$sel:applicationId:ComponentSummary' :: ComponentSummary -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
applicationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ComponentType
componentType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags