{-# 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.Config.Types.Scope where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Scope = Scope'
{
Scope -> Maybe [Text]
complianceResourceTypes :: Prelude.Maybe [Prelude.Text],
Scope -> Maybe Text
complianceResourceId :: Prelude.Maybe Prelude.Text,
Scope -> Maybe Text
tagValue :: Prelude.Maybe Prelude.Text,
Scope -> Maybe Text
tagKey :: Prelude.Maybe Prelude.Text
}
deriving (Scope -> Scope -> Bool
(Scope -> Scope -> Bool) -> (Scope -> Scope -> Bool) -> Eq Scope
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Scope -> Scope -> Bool
$c/= :: Scope -> Scope -> Bool
== :: Scope -> Scope -> Bool
$c== :: Scope -> Scope -> Bool
Prelude.Eq, ReadPrec [Scope]
ReadPrec Scope
Int -> ReadS Scope
ReadS [Scope]
(Int -> ReadS Scope)
-> ReadS [Scope]
-> ReadPrec Scope
-> ReadPrec [Scope]
-> Read Scope
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Scope]
$creadListPrec :: ReadPrec [Scope]
readPrec :: ReadPrec Scope
$creadPrec :: ReadPrec Scope
readList :: ReadS [Scope]
$creadList :: ReadS [Scope]
readsPrec :: Int -> ReadS Scope
$creadsPrec :: Int -> ReadS Scope
Prelude.Read, Int -> Scope -> ShowS
[Scope] -> ShowS
Scope -> String
(Int -> Scope -> ShowS)
-> (Scope -> String) -> ([Scope] -> ShowS) -> Show Scope
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Scope] -> ShowS
$cshowList :: [Scope] -> ShowS
show :: Scope -> String
$cshow :: Scope -> String
showsPrec :: Int -> Scope -> ShowS
$cshowsPrec :: Int -> Scope -> ShowS
Prelude.Show, (forall x. Scope -> Rep Scope x)
-> (forall x. Rep Scope x -> Scope) -> Generic Scope
forall x. Rep Scope x -> Scope
forall x. Scope -> Rep Scope x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Scope x -> Scope
$cfrom :: forall x. Scope -> Rep Scope x
Prelude.Generic)
newScope ::
Scope
newScope :: Scope
newScope =
Scope' :: Maybe [Text] -> Maybe Text -> Maybe Text -> Maybe Text -> Scope
Scope'
{ $sel:complianceResourceTypes:Scope' :: Maybe [Text]
complianceResourceTypes = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:complianceResourceId:Scope' :: Maybe Text
complianceResourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tagValue:Scope' :: Maybe Text
tagValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:tagKey:Scope' :: Maybe Text
tagKey = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
scope_complianceResourceTypes :: Lens.Lens' Scope (Prelude.Maybe [Prelude.Text])
scope_complianceResourceTypes :: (Maybe [Text] -> f (Maybe [Text])) -> Scope -> f Scope
scope_complianceResourceTypes = (Scope -> Maybe [Text])
-> (Scope -> Maybe [Text] -> Scope)
-> Lens Scope Scope (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scope' {Maybe [Text]
complianceResourceTypes :: Maybe [Text]
$sel:complianceResourceTypes:Scope' :: Scope -> Maybe [Text]
complianceResourceTypes} -> Maybe [Text]
complianceResourceTypes) (\s :: Scope
s@Scope' {} Maybe [Text]
a -> Scope
s {$sel:complianceResourceTypes:Scope' :: Maybe [Text]
complianceResourceTypes = Maybe [Text]
a} :: Scope) ((Maybe [Text] -> f (Maybe [Text])) -> Scope -> f Scope)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> Scope
-> f Scope
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
scope_complianceResourceId :: Lens.Lens' Scope (Prelude.Maybe Prelude.Text)
scope_complianceResourceId :: (Maybe Text -> f (Maybe Text)) -> Scope -> f Scope
scope_complianceResourceId = (Scope -> Maybe Text)
-> (Scope -> Maybe Text -> Scope)
-> Lens Scope Scope (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scope' {Maybe Text
complianceResourceId :: Maybe Text
$sel:complianceResourceId:Scope' :: Scope -> Maybe Text
complianceResourceId} -> Maybe Text
complianceResourceId) (\s :: Scope
s@Scope' {} Maybe Text
a -> Scope
s {$sel:complianceResourceId:Scope' :: Maybe Text
complianceResourceId = Maybe Text
a} :: Scope)
scope_tagValue :: Lens.Lens' Scope (Prelude.Maybe Prelude.Text)
scope_tagValue :: (Maybe Text -> f (Maybe Text)) -> Scope -> f Scope
scope_tagValue = (Scope -> Maybe Text)
-> (Scope -> Maybe Text -> Scope)
-> Lens Scope Scope (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scope' {Maybe Text
tagValue :: Maybe Text
$sel:tagValue:Scope' :: Scope -> Maybe Text
tagValue} -> Maybe Text
tagValue) (\s :: Scope
s@Scope' {} Maybe Text
a -> Scope
s {$sel:tagValue:Scope' :: Maybe Text
tagValue = Maybe Text
a} :: Scope)
scope_tagKey :: Lens.Lens' Scope (Prelude.Maybe Prelude.Text)
scope_tagKey :: (Maybe Text -> f (Maybe Text)) -> Scope -> f Scope
scope_tagKey = (Scope -> Maybe Text)
-> (Scope -> Maybe Text -> Scope)
-> Lens Scope Scope (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Scope' {Maybe Text
tagKey :: Maybe Text
$sel:tagKey:Scope' :: Scope -> Maybe Text
tagKey} -> Maybe Text
tagKey) (\s :: Scope
s@Scope' {} Maybe Text
a -> Scope
s {$sel:tagKey:Scope' :: Maybe Text
tagKey = Maybe Text
a} :: Scope)
instance Core.FromJSON Scope where
parseJSON :: Value -> Parser Scope
parseJSON =
String -> (Object -> Parser Scope) -> Value -> Parser Scope
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Scope"
( \Object
x ->
Maybe [Text] -> Maybe Text -> Maybe Text -> Maybe Text -> Scope
Scope'
(Maybe [Text] -> Maybe Text -> Maybe Text -> Maybe Text -> Scope)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> Scope)
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
"ComplianceResourceTypes"
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 Text -> Scope)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> Scope)
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
"ComplianceResourceId")
Parser (Maybe Text -> Maybe Text -> Scope)
-> Parser (Maybe Text) -> Parser (Maybe Text -> Scope)
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
"TagValue")
Parser (Maybe Text -> Scope) -> Parser (Maybe Text) -> Parser Scope
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
"TagKey")
)
instance Prelude.Hashable Scope
instance Prelude.NFData Scope
instance Core.ToJSON Scope where
toJSON :: Scope -> Value
toJSON Scope' {Maybe [Text]
Maybe Text
tagKey :: Maybe Text
tagValue :: Maybe Text
complianceResourceId :: Maybe Text
complianceResourceTypes :: Maybe [Text]
$sel:tagKey:Scope' :: Scope -> Maybe Text
$sel:tagValue:Scope' :: Scope -> Maybe Text
$sel:complianceResourceId:Scope' :: Scope -> Maybe Text
$sel:complianceResourceTypes:Scope' :: Scope -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ComplianceResourceTypes" 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]
complianceResourceTypes,
(Text
"ComplianceResourceId" 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
complianceResourceId,
(Text
"TagValue" 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
tagValue,
(Text
"TagKey" 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
tagKey
]
)