{-# 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.Route53RecoveryReadiness.Types.ResourceSetOutput
-- 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.Route53RecoveryReadiness.Types.ResourceSetOutput where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53RecoveryReadiness.Types.Resource

-- | A collection of resources of the same type
--
-- /See:/ 'newResourceSetOutput' smart constructor.
data ResourceSetOutput = ResourceSetOutput'
  { ResourceSetOutput -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | AWS Resource Type of the resources in the ResourceSet
    ResourceSetOutput -> Text
resourceSetType :: Prelude.Text,
    -- | The name of the ResourceSet
    ResourceSetOutput -> Text
resourceSetName :: Prelude.Text,
    -- | The arn for the ResourceSet
    ResourceSetOutput -> Text
resourceSetArn :: Prelude.Text,
    -- | A list of Resource objects
    ResourceSetOutput -> [Resource]
resources :: [Resource]
  }
  deriving (ResourceSetOutput -> ResourceSetOutput -> Bool
(ResourceSetOutput -> ResourceSetOutput -> Bool)
-> (ResourceSetOutput -> ResourceSetOutput -> Bool)
-> Eq ResourceSetOutput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceSetOutput -> ResourceSetOutput -> Bool
$c/= :: ResourceSetOutput -> ResourceSetOutput -> Bool
== :: ResourceSetOutput -> ResourceSetOutput -> Bool
$c== :: ResourceSetOutput -> ResourceSetOutput -> Bool
Prelude.Eq, ReadPrec [ResourceSetOutput]
ReadPrec ResourceSetOutput
Int -> ReadS ResourceSetOutput
ReadS [ResourceSetOutput]
(Int -> ReadS ResourceSetOutput)
-> ReadS [ResourceSetOutput]
-> ReadPrec ResourceSetOutput
-> ReadPrec [ResourceSetOutput]
-> Read ResourceSetOutput
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceSetOutput]
$creadListPrec :: ReadPrec [ResourceSetOutput]
readPrec :: ReadPrec ResourceSetOutput
$creadPrec :: ReadPrec ResourceSetOutput
readList :: ReadS [ResourceSetOutput]
$creadList :: ReadS [ResourceSetOutput]
readsPrec :: Int -> ReadS ResourceSetOutput
$creadsPrec :: Int -> ReadS ResourceSetOutput
Prelude.Read, Int -> ResourceSetOutput -> ShowS
[ResourceSetOutput] -> ShowS
ResourceSetOutput -> String
(Int -> ResourceSetOutput -> ShowS)
-> (ResourceSetOutput -> String)
-> ([ResourceSetOutput] -> ShowS)
-> Show ResourceSetOutput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceSetOutput] -> ShowS
$cshowList :: [ResourceSetOutput] -> ShowS
show :: ResourceSetOutput -> String
$cshow :: ResourceSetOutput -> String
showsPrec :: Int -> ResourceSetOutput -> ShowS
$cshowsPrec :: Int -> ResourceSetOutput -> ShowS
Prelude.Show, (forall x. ResourceSetOutput -> Rep ResourceSetOutput x)
-> (forall x. Rep ResourceSetOutput x -> ResourceSetOutput)
-> Generic ResourceSetOutput
forall x. Rep ResourceSetOutput x -> ResourceSetOutput
forall x. ResourceSetOutput -> Rep ResourceSetOutput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceSetOutput x -> ResourceSetOutput
$cfrom :: forall x. ResourceSetOutput -> Rep ResourceSetOutput x
Prelude.Generic)

-- |
-- Create a value of 'ResourceSetOutput' 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:
--
-- 'tags', 'resourceSetOutput_tags' - Undocumented member.
--
-- 'resourceSetType', 'resourceSetOutput_resourceSetType' - AWS Resource Type of the resources in the ResourceSet
--
-- 'resourceSetName', 'resourceSetOutput_resourceSetName' - The name of the ResourceSet
--
-- 'resourceSetArn', 'resourceSetOutput_resourceSetArn' - The arn for the ResourceSet
--
-- 'resources', 'resourceSetOutput_resources' - A list of Resource objects
newResourceSetOutput ::
  -- | 'resourceSetType'
  Prelude.Text ->
  -- | 'resourceSetName'
  Prelude.Text ->
  -- | 'resourceSetArn'
  Prelude.Text ->
  ResourceSetOutput
newResourceSetOutput :: Text -> Text -> Text -> ResourceSetOutput
newResourceSetOutput
  Text
pResourceSetType_
  Text
pResourceSetName_
  Text
pResourceSetArn_ =
    ResourceSetOutput' :: Maybe (HashMap Text Text)
-> Text -> Text -> Text -> [Resource] -> ResourceSetOutput
ResourceSetOutput'
      { $sel:tags:ResourceSetOutput' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:resourceSetType:ResourceSetOutput' :: Text
resourceSetType = Text
pResourceSetType_,
        $sel:resourceSetName:ResourceSetOutput' :: Text
resourceSetName = Text
pResourceSetName_,
        $sel:resourceSetArn:ResourceSetOutput' :: Text
resourceSetArn = Text
pResourceSetArn_,
        $sel:resources:ResourceSetOutput' :: [Resource]
resources = [Resource]
forall a. Monoid a => a
Prelude.mempty
      }

-- | Undocumented member.
resourceSetOutput_tags :: Lens.Lens' ResourceSetOutput (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
resourceSetOutput_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> ResourceSetOutput -> f ResourceSetOutput
resourceSetOutput_tags = (ResourceSetOutput -> Maybe (HashMap Text Text))
-> (ResourceSetOutput
    -> Maybe (HashMap Text Text) -> ResourceSetOutput)
-> Lens
     ResourceSetOutput
     ResourceSetOutput
     (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 (\ResourceSetOutput' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:ResourceSetOutput' :: ResourceSetOutput -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: ResourceSetOutput
s@ResourceSetOutput' {} Maybe (HashMap Text Text)
a -> ResourceSetOutput
s {$sel:tags:ResourceSetOutput' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: ResourceSetOutput) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> ResourceSetOutput -> f ResourceSetOutput)
-> ((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)))
-> ResourceSetOutput
-> f ResourceSetOutput
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

-- | AWS Resource Type of the resources in the ResourceSet
resourceSetOutput_resourceSetType :: Lens.Lens' ResourceSetOutput Prelude.Text
resourceSetOutput_resourceSetType :: (Text -> f Text) -> ResourceSetOutput -> f ResourceSetOutput
resourceSetOutput_resourceSetType = (ResourceSetOutput -> Text)
-> (ResourceSetOutput -> Text -> ResourceSetOutput)
-> Lens ResourceSetOutput ResourceSetOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSetOutput' {Text
resourceSetType :: Text
$sel:resourceSetType:ResourceSetOutput' :: ResourceSetOutput -> Text
resourceSetType} -> Text
resourceSetType) (\s :: ResourceSetOutput
s@ResourceSetOutput' {} Text
a -> ResourceSetOutput
s {$sel:resourceSetType:ResourceSetOutput' :: Text
resourceSetType = Text
a} :: ResourceSetOutput)

-- | The name of the ResourceSet
resourceSetOutput_resourceSetName :: Lens.Lens' ResourceSetOutput Prelude.Text
resourceSetOutput_resourceSetName :: (Text -> f Text) -> ResourceSetOutput -> f ResourceSetOutput
resourceSetOutput_resourceSetName = (ResourceSetOutput -> Text)
-> (ResourceSetOutput -> Text -> ResourceSetOutput)
-> Lens ResourceSetOutput ResourceSetOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSetOutput' {Text
resourceSetName :: Text
$sel:resourceSetName:ResourceSetOutput' :: ResourceSetOutput -> Text
resourceSetName} -> Text
resourceSetName) (\s :: ResourceSetOutput
s@ResourceSetOutput' {} Text
a -> ResourceSetOutput
s {$sel:resourceSetName:ResourceSetOutput' :: Text
resourceSetName = Text
a} :: ResourceSetOutput)

-- | The arn for the ResourceSet
resourceSetOutput_resourceSetArn :: Lens.Lens' ResourceSetOutput Prelude.Text
resourceSetOutput_resourceSetArn :: (Text -> f Text) -> ResourceSetOutput -> f ResourceSetOutput
resourceSetOutput_resourceSetArn = (ResourceSetOutput -> Text)
-> (ResourceSetOutput -> Text -> ResourceSetOutput)
-> Lens ResourceSetOutput ResourceSetOutput Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSetOutput' {Text
resourceSetArn :: Text
$sel:resourceSetArn:ResourceSetOutput' :: ResourceSetOutput -> Text
resourceSetArn} -> Text
resourceSetArn) (\s :: ResourceSetOutput
s@ResourceSetOutput' {} Text
a -> ResourceSetOutput
s {$sel:resourceSetArn:ResourceSetOutput' :: Text
resourceSetArn = Text
a} :: ResourceSetOutput)

-- | A list of Resource objects
resourceSetOutput_resources :: Lens.Lens' ResourceSetOutput [Resource]
resourceSetOutput_resources :: ([Resource] -> f [Resource])
-> ResourceSetOutput -> f ResourceSetOutput
resourceSetOutput_resources = (ResourceSetOutput -> [Resource])
-> (ResourceSetOutput -> [Resource] -> ResourceSetOutput)
-> Lens ResourceSetOutput ResourceSetOutput [Resource] [Resource]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceSetOutput' {[Resource]
resources :: [Resource]
$sel:resources:ResourceSetOutput' :: ResourceSetOutput -> [Resource]
resources} -> [Resource]
resources) (\s :: ResourceSetOutput
s@ResourceSetOutput' {} [Resource]
a -> ResourceSetOutput
s {$sel:resources:ResourceSetOutput' :: [Resource]
resources = [Resource]
a} :: ResourceSetOutput) (([Resource] -> f [Resource])
 -> ResourceSetOutput -> f ResourceSetOutput)
-> (([Resource] -> f [Resource]) -> [Resource] -> f [Resource])
-> ([Resource] -> f [Resource])
-> ResourceSetOutput
-> f ResourceSetOutput
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Resource] -> f [Resource]) -> [Resource] -> f [Resource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ResourceSetOutput where
  parseJSON :: Value -> Parser ResourceSetOutput
parseJSON =
    String
-> (Object -> Parser ResourceSetOutput)
-> Value
-> Parser ResourceSetOutput
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceSetOutput"
      ( \Object
x ->
          Maybe (HashMap Text Text)
-> Text -> Text -> Text -> [Resource] -> ResourceSetOutput
ResourceSetOutput'
            (Maybe (HashMap Text Text)
 -> Text -> Text -> Text -> [Resource] -> ResourceSetOutput)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Text -> Text -> Text -> [Resource] -> ResourceSetOutput)
forall (f :: * -> *) a b. Functor 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)
            Parser (Text -> Text -> Text -> [Resource] -> ResourceSetOutput)
-> Parser Text
-> Parser (Text -> Text -> [Resource] -> ResourceSetOutput)
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
"resourceSetType")
            Parser (Text -> Text -> [Resource] -> ResourceSetOutput)
-> Parser Text -> Parser (Text -> [Resource] -> ResourceSetOutput)
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
"resourceSetName")
            Parser (Text -> [Resource] -> ResourceSetOutput)
-> Parser Text -> Parser ([Resource] -> ResourceSetOutput)
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
"resourceSetArn")
            Parser ([Resource] -> ResourceSetOutput)
-> Parser [Resource] -> Parser ResourceSetOutput
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [Resource])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"resources" Parser (Maybe [Resource]) -> [Resource] -> Parser [Resource]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [Resource]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ResourceSetOutput

instance Prelude.NFData ResourceSetOutput