{-# 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.BlockerDeclaration where
import Amazonka.CodePipeline.Types.BlockerType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data BlockerDeclaration = BlockerDeclaration'
{
BlockerDeclaration -> Text
name :: Prelude.Text,
BlockerDeclaration -> BlockerType
type' :: BlockerType
}
deriving (BlockerDeclaration -> BlockerDeclaration -> Bool
(BlockerDeclaration -> BlockerDeclaration -> Bool)
-> (BlockerDeclaration -> BlockerDeclaration -> Bool)
-> Eq BlockerDeclaration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BlockerDeclaration -> BlockerDeclaration -> Bool
$c/= :: BlockerDeclaration -> BlockerDeclaration -> Bool
== :: BlockerDeclaration -> BlockerDeclaration -> Bool
$c== :: BlockerDeclaration -> BlockerDeclaration -> Bool
Prelude.Eq, ReadPrec [BlockerDeclaration]
ReadPrec BlockerDeclaration
Int -> ReadS BlockerDeclaration
ReadS [BlockerDeclaration]
(Int -> ReadS BlockerDeclaration)
-> ReadS [BlockerDeclaration]
-> ReadPrec BlockerDeclaration
-> ReadPrec [BlockerDeclaration]
-> Read BlockerDeclaration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BlockerDeclaration]
$creadListPrec :: ReadPrec [BlockerDeclaration]
readPrec :: ReadPrec BlockerDeclaration
$creadPrec :: ReadPrec BlockerDeclaration
readList :: ReadS [BlockerDeclaration]
$creadList :: ReadS [BlockerDeclaration]
readsPrec :: Int -> ReadS BlockerDeclaration
$creadsPrec :: Int -> ReadS BlockerDeclaration
Prelude.Read, Int -> BlockerDeclaration -> ShowS
[BlockerDeclaration] -> ShowS
BlockerDeclaration -> String
(Int -> BlockerDeclaration -> ShowS)
-> (BlockerDeclaration -> String)
-> ([BlockerDeclaration] -> ShowS)
-> Show BlockerDeclaration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BlockerDeclaration] -> ShowS
$cshowList :: [BlockerDeclaration] -> ShowS
show :: BlockerDeclaration -> String
$cshow :: BlockerDeclaration -> String
showsPrec :: Int -> BlockerDeclaration -> ShowS
$cshowsPrec :: Int -> BlockerDeclaration -> ShowS
Prelude.Show, (forall x. BlockerDeclaration -> Rep BlockerDeclaration x)
-> (forall x. Rep BlockerDeclaration x -> BlockerDeclaration)
-> Generic BlockerDeclaration
forall x. Rep BlockerDeclaration x -> BlockerDeclaration
forall x. BlockerDeclaration -> Rep BlockerDeclaration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BlockerDeclaration x -> BlockerDeclaration
$cfrom :: forall x. BlockerDeclaration -> Rep BlockerDeclaration x
Prelude.Generic)
newBlockerDeclaration ::
Prelude.Text ->
BlockerType ->
BlockerDeclaration
newBlockerDeclaration :: Text -> BlockerType -> BlockerDeclaration
newBlockerDeclaration Text
pName_ BlockerType
pType_ =
BlockerDeclaration' :: Text -> BlockerType -> BlockerDeclaration
BlockerDeclaration' {$sel:name:BlockerDeclaration' :: Text
name = Text
pName_, $sel:type':BlockerDeclaration' :: BlockerType
type' = BlockerType
pType_}
blockerDeclaration_name :: Lens.Lens' BlockerDeclaration Prelude.Text
blockerDeclaration_name :: (Text -> f Text) -> BlockerDeclaration -> f BlockerDeclaration
blockerDeclaration_name = (BlockerDeclaration -> Text)
-> (BlockerDeclaration -> Text -> BlockerDeclaration)
-> Lens BlockerDeclaration BlockerDeclaration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockerDeclaration' {Text
name :: Text
$sel:name:BlockerDeclaration' :: BlockerDeclaration -> Text
name} -> Text
name) (\s :: BlockerDeclaration
s@BlockerDeclaration' {} Text
a -> BlockerDeclaration
s {$sel:name:BlockerDeclaration' :: Text
name = Text
a} :: BlockerDeclaration)
blockerDeclaration_type :: Lens.Lens' BlockerDeclaration BlockerType
blockerDeclaration_type :: (BlockerType -> f BlockerType)
-> BlockerDeclaration -> f BlockerDeclaration
blockerDeclaration_type = (BlockerDeclaration -> BlockerType)
-> (BlockerDeclaration -> BlockerType -> BlockerDeclaration)
-> Lens
BlockerDeclaration BlockerDeclaration BlockerType BlockerType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BlockerDeclaration' {BlockerType
type' :: BlockerType
$sel:type':BlockerDeclaration' :: BlockerDeclaration -> BlockerType
type'} -> BlockerType
type') (\s :: BlockerDeclaration
s@BlockerDeclaration' {} BlockerType
a -> BlockerDeclaration
s {$sel:type':BlockerDeclaration' :: BlockerType
type' = BlockerType
a} :: BlockerDeclaration)
instance Core.FromJSON BlockerDeclaration where
parseJSON :: Value -> Parser BlockerDeclaration
parseJSON =
String
-> (Object -> Parser BlockerDeclaration)
-> Value
-> Parser BlockerDeclaration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"BlockerDeclaration"
( \Object
x ->
Text -> BlockerType -> BlockerDeclaration
BlockerDeclaration'
(Text -> BlockerType -> BlockerDeclaration)
-> Parser Text -> Parser (BlockerType -> BlockerDeclaration)
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
"name") Parser (BlockerType -> BlockerDeclaration)
-> Parser BlockerType -> Parser BlockerDeclaration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser BlockerType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"type")
)
instance Prelude.Hashable BlockerDeclaration
instance Prelude.NFData BlockerDeclaration
instance Core.ToJSON BlockerDeclaration where
toJSON :: BlockerDeclaration -> Value
toJSON BlockerDeclaration' {Text
BlockerType
type' :: BlockerType
name :: Text
$sel:type':BlockerDeclaration' :: BlockerDeclaration -> BlockerType
$sel:name:BlockerDeclaration' :: BlockerDeclaration -> 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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> BlockerType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= BlockerType
type')
]
)