{-# 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.CodePipeline.Types.ActionTypePermissions where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data ActionTypePermissions = ActionTypePermissions'
{
ActionTypePermissions -> NonEmpty Text
allowedAccounts :: Prelude.NonEmpty Prelude.Text
}
deriving (ActionTypePermissions -> ActionTypePermissions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ActionTypePermissions -> ActionTypePermissions -> Bool
$c/= :: ActionTypePermissions -> ActionTypePermissions -> Bool
== :: ActionTypePermissions -> ActionTypePermissions -> Bool
$c== :: ActionTypePermissions -> ActionTypePermissions -> Bool
Prelude.Eq, ReadPrec [ActionTypePermissions]
ReadPrec ActionTypePermissions
Int -> ReadS ActionTypePermissions
ReadS [ActionTypePermissions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ActionTypePermissions]
$creadListPrec :: ReadPrec [ActionTypePermissions]
readPrec :: ReadPrec ActionTypePermissions
$creadPrec :: ReadPrec ActionTypePermissions
readList :: ReadS [ActionTypePermissions]
$creadList :: ReadS [ActionTypePermissions]
readsPrec :: Int -> ReadS ActionTypePermissions
$creadsPrec :: Int -> ReadS ActionTypePermissions
Prelude.Read, Int -> ActionTypePermissions -> ShowS
[ActionTypePermissions] -> ShowS
ActionTypePermissions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ActionTypePermissions] -> ShowS
$cshowList :: [ActionTypePermissions] -> ShowS
show :: ActionTypePermissions -> String
$cshow :: ActionTypePermissions -> String
showsPrec :: Int -> ActionTypePermissions -> ShowS
$cshowsPrec :: Int -> ActionTypePermissions -> ShowS
Prelude.Show, forall x. Rep ActionTypePermissions x -> ActionTypePermissions
forall x. ActionTypePermissions -> Rep ActionTypePermissions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ActionTypePermissions x -> ActionTypePermissions
$cfrom :: forall x. ActionTypePermissions -> Rep ActionTypePermissions x
Prelude.Generic)
newActionTypePermissions ::
Prelude.NonEmpty Prelude.Text ->
ActionTypePermissions
newActionTypePermissions :: NonEmpty Text -> ActionTypePermissions
newActionTypePermissions NonEmpty Text
pAllowedAccounts_ =
ActionTypePermissions'
{ $sel:allowedAccounts:ActionTypePermissions' :: NonEmpty Text
allowedAccounts =
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pAllowedAccounts_
}
actionTypePermissions_allowedAccounts :: Lens.Lens' ActionTypePermissions (Prelude.NonEmpty Prelude.Text)
actionTypePermissions_allowedAccounts :: Lens' ActionTypePermissions (NonEmpty Text)
actionTypePermissions_allowedAccounts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ActionTypePermissions' {NonEmpty Text
allowedAccounts :: NonEmpty Text
$sel:allowedAccounts:ActionTypePermissions' :: ActionTypePermissions -> NonEmpty Text
allowedAccounts} -> NonEmpty Text
allowedAccounts) (\s :: ActionTypePermissions
s@ActionTypePermissions' {} NonEmpty Text
a -> ActionTypePermissions
s {$sel:allowedAccounts:ActionTypePermissions' :: NonEmpty Text
allowedAccounts = NonEmpty Text
a} :: ActionTypePermissions) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Data.FromJSON ActionTypePermissions where
parseJSON :: Value -> Parser ActionTypePermissions
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"ActionTypePermissions"
( \Object
x ->
NonEmpty Text -> ActionTypePermissions
ActionTypePermissions'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"allowedAccounts")
)
instance Prelude.Hashable ActionTypePermissions where
hashWithSalt :: Int -> ActionTypePermissions -> Int
hashWithSalt Int
_salt ActionTypePermissions' {NonEmpty Text
allowedAccounts :: NonEmpty Text
$sel:allowedAccounts:ActionTypePermissions' :: ActionTypePermissions -> NonEmpty Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
allowedAccounts
instance Prelude.NFData ActionTypePermissions where
rnf :: ActionTypePermissions -> ()
rnf ActionTypePermissions' {NonEmpty Text
allowedAccounts :: NonEmpty Text
$sel:allowedAccounts:ActionTypePermissions' :: ActionTypePermissions -> NonEmpty Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
allowedAccounts
instance Data.ToJSON ActionTypePermissions where
toJSON :: ActionTypePermissions -> Value
toJSON ActionTypePermissions' {NonEmpty Text
allowedAccounts :: NonEmpty Text
$sel:allowedAccounts:ActionTypePermissions' :: ActionTypePermissions -> NonEmpty Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"allowedAccounts" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
allowedAccounts)
]
)