{-# 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.AssociationOverview
-- 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.AssociationOverview 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

-- | Information about the association.
--
-- /See:/ 'newAssociationOverview' smart constructor.
data AssociationOverview = AssociationOverview'
  { -- | Returns the number of targets for the association status. For example,
    -- if you created an association with two managed nodes, and one of them
    -- was successful, this would return the count of managed nodes by status.
    AssociationOverview -> Maybe (HashMap Text Int)
associationStatusAggregatedCount :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Int),
    -- | A detailed status of the association.
    AssociationOverview -> Maybe Text
detailedStatus :: Prelude.Maybe Prelude.Text,
    -- | The status of the association. Status can be: Pending, Success, or
    -- Failed.
    AssociationOverview -> Maybe Text
status :: Prelude.Maybe Prelude.Text
  }
  deriving (AssociationOverview -> AssociationOverview -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociationOverview -> AssociationOverview -> Bool
$c/= :: AssociationOverview -> AssociationOverview -> Bool
== :: AssociationOverview -> AssociationOverview -> Bool
$c== :: AssociationOverview -> AssociationOverview -> Bool
Prelude.Eq, ReadPrec [AssociationOverview]
ReadPrec AssociationOverview
Int -> ReadS AssociationOverview
ReadS [AssociationOverview]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociationOverview]
$creadListPrec :: ReadPrec [AssociationOverview]
readPrec :: ReadPrec AssociationOverview
$creadPrec :: ReadPrec AssociationOverview
readList :: ReadS [AssociationOverview]
$creadList :: ReadS [AssociationOverview]
readsPrec :: Int -> ReadS AssociationOverview
$creadsPrec :: Int -> ReadS AssociationOverview
Prelude.Read, Int -> AssociationOverview -> ShowS
[AssociationOverview] -> ShowS
AssociationOverview -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociationOverview] -> ShowS
$cshowList :: [AssociationOverview] -> ShowS
show :: AssociationOverview -> String
$cshow :: AssociationOverview -> String
showsPrec :: Int -> AssociationOverview -> ShowS
$cshowsPrec :: Int -> AssociationOverview -> ShowS
Prelude.Show, forall x. Rep AssociationOverview x -> AssociationOverview
forall x. AssociationOverview -> Rep AssociationOverview x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociationOverview x -> AssociationOverview
$cfrom :: forall x. AssociationOverview -> Rep AssociationOverview x
Prelude.Generic)

-- |
-- Create a value of 'AssociationOverview' 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:
--
-- 'associationStatusAggregatedCount', 'associationOverview_associationStatusAggregatedCount' - Returns the number of targets for the association status. For example,
-- if you created an association with two managed nodes, and one of them
-- was successful, this would return the count of managed nodes by status.
--
-- 'detailedStatus', 'associationOverview_detailedStatus' - A detailed status of the association.
--
-- 'status', 'associationOverview_status' - The status of the association. Status can be: Pending, Success, or
-- Failed.
newAssociationOverview ::
  AssociationOverview
newAssociationOverview :: AssociationOverview
newAssociationOverview =
  AssociationOverview'
    { $sel:associationStatusAggregatedCount:AssociationOverview' :: Maybe (HashMap Text Int)
associationStatusAggregatedCount =
        forall a. Maybe a
Prelude.Nothing,
      $sel:detailedStatus:AssociationOverview' :: Maybe Text
detailedStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:status:AssociationOverview' :: Maybe Text
status = forall a. Maybe a
Prelude.Nothing
    }

-- | Returns the number of targets for the association status. For example,
-- if you created an association with two managed nodes, and one of them
-- was successful, this would return the count of managed nodes by status.
associationOverview_associationStatusAggregatedCount :: Lens.Lens' AssociationOverview (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Int))
associationOverview_associationStatusAggregatedCount :: Lens' AssociationOverview (Maybe (HashMap Text Int))
associationOverview_associationStatusAggregatedCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationOverview' {Maybe (HashMap Text Int)
associationStatusAggregatedCount :: Maybe (HashMap Text Int)
$sel:associationStatusAggregatedCount:AssociationOverview' :: AssociationOverview -> Maybe (HashMap Text Int)
associationStatusAggregatedCount} -> Maybe (HashMap Text Int)
associationStatusAggregatedCount) (\s :: AssociationOverview
s@AssociationOverview' {} Maybe (HashMap Text Int)
a -> AssociationOverview
s {$sel:associationStatusAggregatedCount:AssociationOverview' :: Maybe (HashMap Text Int)
associationStatusAggregatedCount = Maybe (HashMap Text Int)
a} :: AssociationOverview) 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

-- | A detailed status of the association.
associationOverview_detailedStatus :: Lens.Lens' AssociationOverview (Prelude.Maybe Prelude.Text)
associationOverview_detailedStatus :: Lens' AssociationOverview (Maybe Text)
associationOverview_detailedStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationOverview' {Maybe Text
detailedStatus :: Maybe Text
$sel:detailedStatus:AssociationOverview' :: AssociationOverview -> Maybe Text
detailedStatus} -> Maybe Text
detailedStatus) (\s :: AssociationOverview
s@AssociationOverview' {} Maybe Text
a -> AssociationOverview
s {$sel:detailedStatus:AssociationOverview' :: Maybe Text
detailedStatus = Maybe Text
a} :: AssociationOverview)

-- | The status of the association. Status can be: Pending, Success, or
-- Failed.
associationOverview_status :: Lens.Lens' AssociationOverview (Prelude.Maybe Prelude.Text)
associationOverview_status :: Lens' AssociationOverview (Maybe Text)
associationOverview_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociationOverview' {Maybe Text
status :: Maybe Text
$sel:status:AssociationOverview' :: AssociationOverview -> Maybe Text
status} -> Maybe Text
status) (\s :: AssociationOverview
s@AssociationOverview' {} Maybe Text
a -> AssociationOverview
s {$sel:status:AssociationOverview' :: Maybe Text
status = Maybe Text
a} :: AssociationOverview)

instance Data.FromJSON AssociationOverview where
  parseJSON :: Value -> Parser AssociationOverview
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AssociationOverview"
      ( \Object
x ->
          Maybe (HashMap Text Int)
-> Maybe Text -> Maybe Text -> AssociationOverview
AssociationOverview'
            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
"AssociationStatusAggregatedCount"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            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
"DetailedStatus")
            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
"Status")
      )

instance Prelude.Hashable AssociationOverview where
  hashWithSalt :: Int -> AssociationOverview -> Int
hashWithSalt Int
_salt AssociationOverview' {Maybe Text
Maybe (HashMap Text Int)
status :: Maybe Text
detailedStatus :: Maybe Text
associationStatusAggregatedCount :: Maybe (HashMap Text Int)
$sel:status:AssociationOverview' :: AssociationOverview -> Maybe Text
$sel:detailedStatus:AssociationOverview' :: AssociationOverview -> Maybe Text
$sel:associationStatusAggregatedCount:AssociationOverview' :: AssociationOverview -> Maybe (HashMap Text Int)
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Int)
associationStatusAggregatedCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
detailedStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
status

instance Prelude.NFData AssociationOverview where
  rnf :: AssociationOverview -> ()
rnf AssociationOverview' {Maybe Text
Maybe (HashMap Text Int)
status :: Maybe Text
detailedStatus :: Maybe Text
associationStatusAggregatedCount :: Maybe (HashMap Text Int)
$sel:status:AssociationOverview' :: AssociationOverview -> Maybe Text
$sel:detailedStatus:AssociationOverview' :: AssociationOverview -> Maybe Text
$sel:associationStatusAggregatedCount:AssociationOverview' :: AssociationOverview -> Maybe (HashMap Text Int)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Int)
associationStatusAggregatedCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
detailedStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
status