{-# 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.FIS.Types.ActionSummary
-- 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.FIS.Types.ActionSummary where

import qualified Amazonka.Core as Core
import Amazonka.FIS.Types.ActionTarget
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides a summary of an action.
--
-- /See:/ 'newActionSummary' smart constructor.
data ActionSummary = ActionSummary'
  { -- | The targets for the action.
    ActionSummary -> Maybe (HashMap Text ActionTarget)
targets :: Prelude.Maybe (Prelude.HashMap Prelude.Text ActionTarget),
    -- | The ID of the action.
    ActionSummary -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The description for the action.
    ActionSummary -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The tags for the action.
    ActionSummary -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (ActionSummary -> ActionSummary -> Bool
(ActionSummary -> ActionSummary -> Bool)
-> (ActionSummary -> ActionSummary -> Bool) -> Eq ActionSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionSummary -> ActionSummary -> Bool
$c/= :: ActionSummary -> ActionSummary -> Bool
== :: ActionSummary -> ActionSummary -> Bool
$c== :: ActionSummary -> ActionSummary -> Bool
Prelude.Eq, ReadPrec [ActionSummary]
ReadPrec ActionSummary
Int -> ReadS ActionSummary
ReadS [ActionSummary]
(Int -> ReadS ActionSummary)
-> ReadS [ActionSummary]
-> ReadPrec ActionSummary
-> ReadPrec [ActionSummary]
-> Read ActionSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionSummary]
$creadListPrec :: ReadPrec [ActionSummary]
readPrec :: ReadPrec ActionSummary
$creadPrec :: ReadPrec ActionSummary
readList :: ReadS [ActionSummary]
$creadList :: ReadS [ActionSummary]
readsPrec :: Int -> ReadS ActionSummary
$creadsPrec :: Int -> ReadS ActionSummary
Prelude.Read, Int -> ActionSummary -> ShowS
[ActionSummary] -> ShowS
ActionSummary -> String
(Int -> ActionSummary -> ShowS)
-> (ActionSummary -> String)
-> ([ActionSummary] -> ShowS)
-> Show ActionSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionSummary] -> ShowS
$cshowList :: [ActionSummary] -> ShowS
show :: ActionSummary -> String
$cshow :: ActionSummary -> String
showsPrec :: Int -> ActionSummary -> ShowS
$cshowsPrec :: Int -> ActionSummary -> ShowS
Prelude.Show, (forall x. ActionSummary -> Rep ActionSummary x)
-> (forall x. Rep ActionSummary x -> ActionSummary)
-> Generic ActionSummary
forall x. Rep ActionSummary x -> ActionSummary
forall x. ActionSummary -> Rep ActionSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionSummary x -> ActionSummary
$cfrom :: forall x. ActionSummary -> Rep ActionSummary x
Prelude.Generic)

-- |
-- Create a value of 'ActionSummary' 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:
--
-- 'targets', 'actionSummary_targets' - The targets for the action.
--
-- 'id', 'actionSummary_id' - The ID of the action.
--
-- 'description', 'actionSummary_description' - The description for the action.
--
-- 'tags', 'actionSummary_tags' - The tags for the action.
newActionSummary ::
  ActionSummary
newActionSummary :: ActionSummary
newActionSummary =
  ActionSummary' :: Maybe (HashMap Text ActionTarget)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> ActionSummary
ActionSummary'
    { $sel:targets:ActionSummary' :: Maybe (HashMap Text ActionTarget)
targets = Maybe (HashMap Text ActionTarget)
forall a. Maybe a
Prelude.Nothing,
      $sel:id:ActionSummary' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:ActionSummary' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:ActionSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The targets for the action.
actionSummary_targets :: Lens.Lens' ActionSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text ActionTarget))
actionSummary_targets :: (Maybe (HashMap Text ActionTarget)
 -> f (Maybe (HashMap Text ActionTarget)))
-> ActionSummary -> f ActionSummary
actionSummary_targets = (ActionSummary -> Maybe (HashMap Text ActionTarget))
-> (ActionSummary
    -> Maybe (HashMap Text ActionTarget) -> ActionSummary)
-> Lens
     ActionSummary
     ActionSummary
     (Maybe (HashMap Text ActionTarget))
     (Maybe (HashMap Text ActionTarget))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionSummary' {Maybe (HashMap Text ActionTarget)
targets :: Maybe (HashMap Text ActionTarget)
$sel:targets:ActionSummary' :: ActionSummary -> Maybe (HashMap Text ActionTarget)
targets} -> Maybe (HashMap Text ActionTarget)
targets) (\s :: ActionSummary
s@ActionSummary' {} Maybe (HashMap Text ActionTarget)
a -> ActionSummary
s {$sel:targets:ActionSummary' :: Maybe (HashMap Text ActionTarget)
targets = Maybe (HashMap Text ActionTarget)
a} :: ActionSummary) ((Maybe (HashMap Text ActionTarget)
  -> f (Maybe (HashMap Text ActionTarget)))
 -> ActionSummary -> f ActionSummary)
-> ((Maybe (HashMap Text ActionTarget)
     -> f (Maybe (HashMap Text ActionTarget)))
    -> Maybe (HashMap Text ActionTarget)
    -> f (Maybe (HashMap Text ActionTarget)))
-> (Maybe (HashMap Text ActionTarget)
    -> f (Maybe (HashMap Text ActionTarget)))
-> ActionSummary
-> f ActionSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text ActionTarget)
  (HashMap Text ActionTarget)
  (HashMap Text ActionTarget)
  (HashMap Text ActionTarget)
-> Iso
     (Maybe (HashMap Text ActionTarget))
     (Maybe (HashMap Text ActionTarget))
     (Maybe (HashMap Text ActionTarget))
     (Maybe (HashMap Text ActionTarget))
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 AnIso
  (HashMap Text ActionTarget)
  (HashMap Text ActionTarget)
  (HashMap Text ActionTarget)
  (HashMap Text ActionTarget)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the action.
actionSummary_id :: Lens.Lens' ActionSummary (Prelude.Maybe Prelude.Text)
actionSummary_id :: (Maybe Text -> f (Maybe Text)) -> ActionSummary -> f ActionSummary
actionSummary_id = (ActionSummary -> Maybe Text)
-> (ActionSummary -> Maybe Text -> ActionSummary)
-> Lens ActionSummary ActionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionSummary' {Maybe Text
id :: Maybe Text
$sel:id:ActionSummary' :: ActionSummary -> Maybe Text
id} -> Maybe Text
id) (\s :: ActionSummary
s@ActionSummary' {} Maybe Text
a -> ActionSummary
s {$sel:id:ActionSummary' :: Maybe Text
id = Maybe Text
a} :: ActionSummary)

-- | The description for the action.
actionSummary_description :: Lens.Lens' ActionSummary (Prelude.Maybe Prelude.Text)
actionSummary_description :: (Maybe Text -> f (Maybe Text)) -> ActionSummary -> f ActionSummary
actionSummary_description = (ActionSummary -> Maybe Text)
-> (ActionSummary -> Maybe Text -> ActionSummary)
-> Lens ActionSummary ActionSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionSummary' {Maybe Text
description :: Maybe Text
$sel:description:ActionSummary' :: ActionSummary -> Maybe Text
description} -> Maybe Text
description) (\s :: ActionSummary
s@ActionSummary' {} Maybe Text
a -> ActionSummary
s {$sel:description:ActionSummary' :: Maybe Text
description = Maybe Text
a} :: ActionSummary)

-- | The tags for the action.
actionSummary_tags :: Lens.Lens' ActionSummary (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
actionSummary_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ActionSummary -> f ActionSummary
actionSummary_tags = (ActionSummary -> Maybe (HashMap Text Text))
-> (ActionSummary -> Maybe (HashMap Text Text) -> ActionSummary)
-> Lens
     ActionSummary
     ActionSummary
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionSummary' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ActionSummary' :: ActionSummary -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ActionSummary
s@ActionSummary' {} Maybe (HashMap Text Text)
a -> ActionSummary
s {$sel:tags:ActionSummary' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ActionSummary) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ActionSummary -> f ActionSummary)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ActionSummary
-> f ActionSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ActionSummary where
  parseJSON :: Value -> Parser ActionSummary
parseJSON =
    String
-> (Object -> Parser ActionSummary)
-> Value
-> Parser ActionSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ActionSummary"
      ( \Object
x ->
          Maybe (HashMap Text ActionTarget)
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> ActionSummary
ActionSummary'
            (Maybe (HashMap Text ActionTarget)
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> ActionSummary)
-> Parser (Maybe (HashMap Text ActionTarget))
-> Parser
     (Maybe Text
      -> Maybe Text -> Maybe (HashMap Text Text) -> ActionSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe (HashMap Text ActionTarget)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"targets" Parser (Maybe (Maybe (HashMap Text ActionTarget)))
-> Maybe (HashMap Text ActionTarget)
-> Parser (Maybe (HashMap Text ActionTarget))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text ActionTarget)
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text -> Maybe (HashMap Text Text) -> ActionSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe (HashMap Text Text) -> ActionSummary)
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
"id")
            Parser (Maybe Text -> Maybe (HashMap Text Text) -> ActionSummary)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> ActionSummary)
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
"description")
            Parser (Maybe (HashMap Text Text) -> ActionSummary)
-> Parser (Maybe (HashMap Text Text)) -> Parser ActionSummary
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ActionSummary

instance Prelude.NFData ActionSummary