{-# 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.WorkSpaces.Types.ConnectionAliasPermission where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ConnectionAliasPermission = ConnectionAliasPermission'
{
ConnectionAliasPermission -> Text
sharedAccountId :: Prelude.Text,
ConnectionAliasPermission -> Bool
allowAssociation :: Prelude.Bool
}
deriving (ConnectionAliasPermission -> ConnectionAliasPermission -> Bool
(ConnectionAliasPermission -> ConnectionAliasPermission -> Bool)
-> (ConnectionAliasPermission -> ConnectionAliasPermission -> Bool)
-> Eq ConnectionAliasPermission
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConnectionAliasPermission -> ConnectionAliasPermission -> Bool
$c/= :: ConnectionAliasPermission -> ConnectionAliasPermission -> Bool
== :: ConnectionAliasPermission -> ConnectionAliasPermission -> Bool
$c== :: ConnectionAliasPermission -> ConnectionAliasPermission -> Bool
Prelude.Eq, ReadPrec [ConnectionAliasPermission]
ReadPrec ConnectionAliasPermission
Int -> ReadS ConnectionAliasPermission
ReadS [ConnectionAliasPermission]
(Int -> ReadS ConnectionAliasPermission)
-> ReadS [ConnectionAliasPermission]
-> ReadPrec ConnectionAliasPermission
-> ReadPrec [ConnectionAliasPermission]
-> Read ConnectionAliasPermission
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ConnectionAliasPermission]
$creadListPrec :: ReadPrec [ConnectionAliasPermission]
readPrec :: ReadPrec ConnectionAliasPermission
$creadPrec :: ReadPrec ConnectionAliasPermission
readList :: ReadS [ConnectionAliasPermission]
$creadList :: ReadS [ConnectionAliasPermission]
readsPrec :: Int -> ReadS ConnectionAliasPermission
$creadsPrec :: Int -> ReadS ConnectionAliasPermission
Prelude.Read, Int -> ConnectionAliasPermission -> ShowS
[ConnectionAliasPermission] -> ShowS
ConnectionAliasPermission -> String
(Int -> ConnectionAliasPermission -> ShowS)
-> (ConnectionAliasPermission -> String)
-> ([ConnectionAliasPermission] -> ShowS)
-> Show ConnectionAliasPermission
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConnectionAliasPermission] -> ShowS
$cshowList :: [ConnectionAliasPermission] -> ShowS
show :: ConnectionAliasPermission -> String
$cshow :: ConnectionAliasPermission -> String
showsPrec :: Int -> ConnectionAliasPermission -> ShowS
$cshowsPrec :: Int -> ConnectionAliasPermission -> ShowS
Prelude.Show, (forall x.
ConnectionAliasPermission -> Rep ConnectionAliasPermission x)
-> (forall x.
Rep ConnectionAliasPermission x -> ConnectionAliasPermission)
-> Generic ConnectionAliasPermission
forall x.
Rep ConnectionAliasPermission x -> ConnectionAliasPermission
forall x.
ConnectionAliasPermission -> Rep ConnectionAliasPermission x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ConnectionAliasPermission x -> ConnectionAliasPermission
$cfrom :: forall x.
ConnectionAliasPermission -> Rep ConnectionAliasPermission x
Prelude.Generic)
newConnectionAliasPermission ::
Prelude.Text ->
Prelude.Bool ->
ConnectionAliasPermission
newConnectionAliasPermission :: Text -> Bool -> ConnectionAliasPermission
newConnectionAliasPermission
Text
pSharedAccountId_
Bool
pAllowAssociation_ =
ConnectionAliasPermission' :: Text -> Bool -> ConnectionAliasPermission
ConnectionAliasPermission'
{ $sel:sharedAccountId:ConnectionAliasPermission' :: Text
sharedAccountId =
Text
pSharedAccountId_,
$sel:allowAssociation:ConnectionAliasPermission' :: Bool
allowAssociation = Bool
pAllowAssociation_
}
connectionAliasPermission_sharedAccountId :: Lens.Lens' ConnectionAliasPermission Prelude.Text
connectionAliasPermission_sharedAccountId :: (Text -> f Text)
-> ConnectionAliasPermission -> f ConnectionAliasPermission
connectionAliasPermission_sharedAccountId = (ConnectionAliasPermission -> Text)
-> (ConnectionAliasPermission -> Text -> ConnectionAliasPermission)
-> Lens
ConnectionAliasPermission ConnectionAliasPermission Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAliasPermission' {Text
sharedAccountId :: Text
$sel:sharedAccountId:ConnectionAliasPermission' :: ConnectionAliasPermission -> Text
sharedAccountId} -> Text
sharedAccountId) (\s :: ConnectionAliasPermission
s@ConnectionAliasPermission' {} Text
a -> ConnectionAliasPermission
s {$sel:sharedAccountId:ConnectionAliasPermission' :: Text
sharedAccountId = Text
a} :: ConnectionAliasPermission)
connectionAliasPermission_allowAssociation :: Lens.Lens' ConnectionAliasPermission Prelude.Bool
connectionAliasPermission_allowAssociation :: (Bool -> f Bool)
-> ConnectionAliasPermission -> f ConnectionAliasPermission
connectionAliasPermission_allowAssociation = (ConnectionAliasPermission -> Bool)
-> (ConnectionAliasPermission -> Bool -> ConnectionAliasPermission)
-> Lens
ConnectionAliasPermission ConnectionAliasPermission Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ConnectionAliasPermission' {Bool
allowAssociation :: Bool
$sel:allowAssociation:ConnectionAliasPermission' :: ConnectionAliasPermission -> Bool
allowAssociation} -> Bool
allowAssociation) (\s :: ConnectionAliasPermission
s@ConnectionAliasPermission' {} Bool
a -> ConnectionAliasPermission
s {$sel:allowAssociation:ConnectionAliasPermission' :: Bool
allowAssociation = Bool
a} :: ConnectionAliasPermission)
instance Core.FromJSON ConnectionAliasPermission where
parseJSON :: Value -> Parser ConnectionAliasPermission
parseJSON =
String
-> (Object -> Parser ConnectionAliasPermission)
-> Value
-> Parser ConnectionAliasPermission
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ConnectionAliasPermission"
( \Object
x ->
Text -> Bool -> ConnectionAliasPermission
ConnectionAliasPermission'
(Text -> Bool -> ConnectionAliasPermission)
-> Parser Text -> Parser (Bool -> ConnectionAliasPermission)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"SharedAccountId")
Parser (Bool -> ConnectionAliasPermission)
-> Parser Bool -> Parser ConnectionAliasPermission
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"AllowAssociation")
)
instance Prelude.Hashable ConnectionAliasPermission
instance Prelude.NFData ConnectionAliasPermission
instance Core.ToJSON ConnectionAliasPermission where
toJSON :: ConnectionAliasPermission -> Value
toJSON ConnectionAliasPermission' {Bool
Text
allowAssociation :: Bool
sharedAccountId :: Text
$sel:allowAssociation:ConnectionAliasPermission' :: ConnectionAliasPermission -> Bool
$sel:sharedAccountId:ConnectionAliasPermission' :: ConnectionAliasPermission -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SharedAccountId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sharedAccountId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AllowAssociation" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
allowAssociation)
]
)