{-# 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 #-}
module Amazonka.Route53RecoveryReadiness.Types.Resource where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53RecoveryReadiness.Types.DNSTargetResource
data Resource = Resource'
{
Resource -> Maybe [Text]
readinessScopes :: Prelude.Maybe [Prelude.Text],
Resource -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
Resource -> Maybe Text
componentId :: Prelude.Maybe Prelude.Text,
Resource -> Maybe DNSTargetResource
dnsTargetResource :: Prelude.Maybe DNSTargetResource
}
deriving (Resource -> Resource -> Bool
(Resource -> Resource -> Bool)
-> (Resource -> Resource -> Bool) -> Eq Resource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Resource -> Resource -> Bool
$c/= :: Resource -> Resource -> Bool
== :: Resource -> Resource -> Bool
$c== :: Resource -> Resource -> Bool
Prelude.Eq, ReadPrec [Resource]
ReadPrec Resource
Int -> ReadS Resource
ReadS [Resource]
(Int -> ReadS Resource)
-> ReadS [Resource]
-> ReadPrec Resource
-> ReadPrec [Resource]
-> Read Resource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Resource]
$creadListPrec :: ReadPrec [Resource]
readPrec :: ReadPrec Resource
$creadPrec :: ReadPrec Resource
readList :: ReadS [Resource]
$creadList :: ReadS [Resource]
readsPrec :: Int -> ReadS Resource
$creadsPrec :: Int -> ReadS Resource
Prelude.Read, Int -> Resource -> ShowS
[Resource] -> ShowS
Resource -> String
(Int -> Resource -> ShowS)
-> (Resource -> String) -> ([Resource] -> ShowS) -> Show Resource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Resource] -> ShowS
$cshowList :: [Resource] -> ShowS
show :: Resource -> String
$cshow :: Resource -> String
showsPrec :: Int -> Resource -> ShowS
$cshowsPrec :: Int -> Resource -> ShowS
Prelude.Show, (forall x. Resource -> Rep Resource x)
-> (forall x. Rep Resource x -> Resource) -> Generic Resource
forall x. Rep Resource x -> Resource
forall x. Resource -> Rep Resource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Resource x -> Resource
$cfrom :: forall x. Resource -> Rep Resource x
Prelude.Generic)
newResource ::
Resource
newResource :: Resource
newResource =
Resource' :: Maybe [Text]
-> Maybe Text -> Maybe Text -> Maybe DNSTargetResource -> Resource
Resource'
{ $sel:readinessScopes:Resource' :: Maybe [Text]
readinessScopes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:Resource' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:componentId:Resource' :: Maybe Text
componentId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:dnsTargetResource:Resource' :: Maybe DNSTargetResource
dnsTargetResource = Maybe DNSTargetResource
forall a. Maybe a
Prelude.Nothing
}
resource_readinessScopes :: Lens.Lens' Resource (Prelude.Maybe [Prelude.Text])
resource_readinessScopes :: (Maybe [Text] -> f (Maybe [Text])) -> Resource -> f Resource
resource_readinessScopes = (Resource -> Maybe [Text])
-> (Resource -> Maybe [Text] -> Resource)
-> Lens Resource Resource (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe [Text]
readinessScopes :: Maybe [Text]
$sel:readinessScopes:Resource' :: Resource -> Maybe [Text]
readinessScopes} -> Maybe [Text]
readinessScopes) (\s :: Resource
s@Resource' {} Maybe [Text]
a -> Resource
s {$sel:readinessScopes:Resource' :: Maybe [Text]
readinessScopes = Maybe [Text]
a} :: Resource) ((Maybe [Text] -> f (Maybe [Text])) -> Resource -> f Resource)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Resource
-> f Resource
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
resource_resourceArn :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_resourceArn :: (Maybe Text -> f (Maybe Text)) -> Resource -> f Resource
resource_resourceArn = (Resource -> Maybe Text)
-> (Resource -> Maybe Text -> Resource)
-> Lens Resource Resource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:Resource' :: Resource -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:resourceArn:Resource' :: Maybe Text
resourceArn = Maybe Text
a} :: Resource)
resource_componentId :: Lens.Lens' Resource (Prelude.Maybe Prelude.Text)
resource_componentId :: (Maybe Text -> f (Maybe Text)) -> Resource -> f Resource
resource_componentId = (Resource -> Maybe Text)
-> (Resource -> Maybe Text -> Resource)
-> Lens Resource Resource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe Text
componentId :: Maybe Text
$sel:componentId:Resource' :: Resource -> Maybe Text
componentId} -> Maybe Text
componentId) (\s :: Resource
s@Resource' {} Maybe Text
a -> Resource
s {$sel:componentId:Resource' :: Maybe Text
componentId = Maybe Text
a} :: Resource)
resource_dnsTargetResource :: Lens.Lens' Resource (Prelude.Maybe DNSTargetResource)
resource_dnsTargetResource :: (Maybe DNSTargetResource -> f (Maybe DNSTargetResource))
-> Resource -> f Resource
resource_dnsTargetResource = (Resource -> Maybe DNSTargetResource)
-> (Resource -> Maybe DNSTargetResource -> Resource)
-> Lens
Resource
Resource
(Maybe DNSTargetResource)
(Maybe DNSTargetResource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Resource' {Maybe DNSTargetResource
dnsTargetResource :: Maybe DNSTargetResource
$sel:dnsTargetResource:Resource' :: Resource -> Maybe DNSTargetResource
dnsTargetResource} -> Maybe DNSTargetResource
dnsTargetResource) (\s :: Resource
s@Resource' {} Maybe DNSTargetResource
a -> Resource
s {$sel:dnsTargetResource:Resource' :: Maybe DNSTargetResource
dnsTargetResource = Maybe DNSTargetResource
a} :: Resource)
instance Core.FromJSON Resource where
parseJSON :: Value -> Parser Resource
parseJSON =
String -> (Object -> Parser Resource) -> Value -> Parser Resource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Resource"
( \Object
x ->
Maybe [Text]
-> Maybe Text -> Maybe Text -> Maybe DNSTargetResource -> Resource
Resource'
(Maybe [Text]
-> Maybe Text -> Maybe Text -> Maybe DNSTargetResource -> Resource)
-> Parser (Maybe [Text])
-> Parser
(Maybe Text -> Maybe Text -> Maybe DNSTargetResource -> Resource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"readinessScopes"
Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty
)
Parser
(Maybe Text -> Maybe Text -> Maybe DNSTargetResource -> Resource)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe DNSTargetResource -> Resource)
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
"resourceArn")
Parser (Maybe Text -> Maybe DNSTargetResource -> Resource)
-> Parser (Maybe Text)
-> Parser (Maybe DNSTargetResource -> Resource)
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
"componentId")
Parser (Maybe DNSTargetResource -> Resource)
-> Parser (Maybe DNSTargetResource) -> Parser Resource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DNSTargetResource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"dnsTargetResource")
)
instance Prelude.Hashable Resource
instance Prelude.NFData Resource
instance Core.ToJSON Resource where
toJSON :: Resource -> Value
toJSON Resource' {Maybe [Text]
Maybe Text
Maybe DNSTargetResource
dnsTargetResource :: Maybe DNSTargetResource
componentId :: Maybe Text
resourceArn :: Maybe Text
readinessScopes :: Maybe [Text]
$sel:dnsTargetResource:Resource' :: Resource -> Maybe DNSTargetResource
$sel:componentId:Resource' :: Resource -> Maybe Text
$sel:resourceArn:Resource' :: Resource -> Maybe Text
$sel:readinessScopes:Resource' :: Resource -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"readinessScopes" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
readinessScopes,
(Text
"resourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
resourceArn,
(Text
"componentId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
componentId,
(Text
"dnsTargetResource" Text -> DNSTargetResource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DNSTargetResource -> Pair)
-> Maybe DNSTargetResource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DNSTargetResource
dnsTargetResource
]
)