{-# 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.PipelineDeclaration where
import Amazonka.CodePipeline.Types.ArtifactStore
import Amazonka.CodePipeline.Types.StageDeclaration
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data PipelineDeclaration = PipelineDeclaration'
{
PipelineDeclaration -> Maybe (HashMap Text ArtifactStore)
artifactStores :: Prelude.Maybe (Prelude.HashMap Prelude.Text ArtifactStore),
PipelineDeclaration -> Maybe ArtifactStore
artifactStore :: Prelude.Maybe ArtifactStore,
PipelineDeclaration -> Maybe Natural
version :: Prelude.Maybe Prelude.Natural,
PipelineDeclaration -> Text
name :: Prelude.Text,
PipelineDeclaration -> Text
roleArn :: Prelude.Text,
PipelineDeclaration -> [StageDeclaration]
stages :: [StageDeclaration]
}
deriving (PipelineDeclaration -> PipelineDeclaration -> Bool
(PipelineDeclaration -> PipelineDeclaration -> Bool)
-> (PipelineDeclaration -> PipelineDeclaration -> Bool)
-> Eq PipelineDeclaration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PipelineDeclaration -> PipelineDeclaration -> Bool
$c/= :: PipelineDeclaration -> PipelineDeclaration -> Bool
== :: PipelineDeclaration -> PipelineDeclaration -> Bool
$c== :: PipelineDeclaration -> PipelineDeclaration -> Bool
Prelude.Eq, ReadPrec [PipelineDeclaration]
ReadPrec PipelineDeclaration
Int -> ReadS PipelineDeclaration
ReadS [PipelineDeclaration]
(Int -> ReadS PipelineDeclaration)
-> ReadS [PipelineDeclaration]
-> ReadPrec PipelineDeclaration
-> ReadPrec [PipelineDeclaration]
-> Read PipelineDeclaration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PipelineDeclaration]
$creadListPrec :: ReadPrec [PipelineDeclaration]
readPrec :: ReadPrec PipelineDeclaration
$creadPrec :: ReadPrec PipelineDeclaration
readList :: ReadS [PipelineDeclaration]
$creadList :: ReadS [PipelineDeclaration]
readsPrec :: Int -> ReadS PipelineDeclaration
$creadsPrec :: Int -> ReadS PipelineDeclaration
Prelude.Read, Int -> PipelineDeclaration -> ShowS
[PipelineDeclaration] -> ShowS
PipelineDeclaration -> String
(Int -> PipelineDeclaration -> ShowS)
-> (PipelineDeclaration -> String)
-> ([PipelineDeclaration] -> ShowS)
-> Show PipelineDeclaration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PipelineDeclaration] -> ShowS
$cshowList :: [PipelineDeclaration] -> ShowS
show :: PipelineDeclaration -> String
$cshow :: PipelineDeclaration -> String
showsPrec :: Int -> PipelineDeclaration -> ShowS
$cshowsPrec :: Int -> PipelineDeclaration -> ShowS
Prelude.Show, (forall x. PipelineDeclaration -> Rep PipelineDeclaration x)
-> (forall x. Rep PipelineDeclaration x -> PipelineDeclaration)
-> Generic PipelineDeclaration
forall x. Rep PipelineDeclaration x -> PipelineDeclaration
forall x. PipelineDeclaration -> Rep PipelineDeclaration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PipelineDeclaration x -> PipelineDeclaration
$cfrom :: forall x. PipelineDeclaration -> Rep PipelineDeclaration x
Prelude.Generic)
newPipelineDeclaration ::
Prelude.Text ->
Prelude.Text ->
PipelineDeclaration
newPipelineDeclaration :: Text -> Text -> PipelineDeclaration
newPipelineDeclaration Text
pName_ Text
pRoleArn_ =
PipelineDeclaration' :: Maybe (HashMap Text ArtifactStore)
-> Maybe ArtifactStore
-> Maybe Natural
-> Text
-> Text
-> [StageDeclaration]
-> PipelineDeclaration
PipelineDeclaration'
{ $sel:artifactStores:PipelineDeclaration' :: Maybe (HashMap Text ArtifactStore)
artifactStores =
Maybe (HashMap Text ArtifactStore)
forall a. Maybe a
Prelude.Nothing,
$sel:artifactStore:PipelineDeclaration' :: Maybe ArtifactStore
artifactStore = Maybe ArtifactStore
forall a. Maybe a
Prelude.Nothing,
$sel:version:PipelineDeclaration' :: Maybe Natural
version = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:name:PipelineDeclaration' :: Text
name = Text
pName_,
$sel:roleArn:PipelineDeclaration' :: Text
roleArn = Text
pRoleArn_,
$sel:stages:PipelineDeclaration' :: [StageDeclaration]
stages = [StageDeclaration]
forall a. Monoid a => a
Prelude.mempty
}
pipelineDeclaration_artifactStores :: Lens.Lens' PipelineDeclaration (Prelude.Maybe (Prelude.HashMap Prelude.Text ArtifactStore))
pipelineDeclaration_artifactStores :: (Maybe (HashMap Text ArtifactStore)
-> f (Maybe (HashMap Text ArtifactStore)))
-> PipelineDeclaration -> f PipelineDeclaration
pipelineDeclaration_artifactStores = (PipelineDeclaration -> Maybe (HashMap Text ArtifactStore))
-> (PipelineDeclaration
-> Maybe (HashMap Text ArtifactStore) -> PipelineDeclaration)
-> Lens
PipelineDeclaration
PipelineDeclaration
(Maybe (HashMap Text ArtifactStore))
(Maybe (HashMap Text ArtifactStore))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDeclaration' {Maybe (HashMap Text ArtifactStore)
artifactStores :: Maybe (HashMap Text ArtifactStore)
$sel:artifactStores:PipelineDeclaration' :: PipelineDeclaration -> Maybe (HashMap Text ArtifactStore)
artifactStores} -> Maybe (HashMap Text ArtifactStore)
artifactStores) (\s :: PipelineDeclaration
s@PipelineDeclaration' {} Maybe (HashMap Text ArtifactStore)
a -> PipelineDeclaration
s {$sel:artifactStores:PipelineDeclaration' :: Maybe (HashMap Text ArtifactStore)
artifactStores = Maybe (HashMap Text ArtifactStore)
a} :: PipelineDeclaration) ((Maybe (HashMap Text ArtifactStore)
-> f (Maybe (HashMap Text ArtifactStore)))
-> PipelineDeclaration -> f PipelineDeclaration)
-> ((Maybe (HashMap Text ArtifactStore)
-> f (Maybe (HashMap Text ArtifactStore)))
-> Maybe (HashMap Text ArtifactStore)
-> f (Maybe (HashMap Text ArtifactStore)))
-> (Maybe (HashMap Text ArtifactStore)
-> f (Maybe (HashMap Text ArtifactStore)))
-> PipelineDeclaration
-> f PipelineDeclaration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text ArtifactStore)
(HashMap Text ArtifactStore)
(HashMap Text ArtifactStore)
(HashMap Text ArtifactStore)
-> Iso
(Maybe (HashMap Text ArtifactStore))
(Maybe (HashMap Text ArtifactStore))
(Maybe (HashMap Text ArtifactStore))
(Maybe (HashMap Text ArtifactStore))
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
(HashMap Text ArtifactStore)
(HashMap Text ArtifactStore)
(HashMap Text ArtifactStore)
(HashMap Text ArtifactStore)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
pipelineDeclaration_artifactStore :: Lens.Lens' PipelineDeclaration (Prelude.Maybe ArtifactStore)
pipelineDeclaration_artifactStore :: (Maybe ArtifactStore -> f (Maybe ArtifactStore))
-> PipelineDeclaration -> f PipelineDeclaration
pipelineDeclaration_artifactStore = (PipelineDeclaration -> Maybe ArtifactStore)
-> (PipelineDeclaration
-> Maybe ArtifactStore -> PipelineDeclaration)
-> Lens
PipelineDeclaration
PipelineDeclaration
(Maybe ArtifactStore)
(Maybe ArtifactStore)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDeclaration' {Maybe ArtifactStore
artifactStore :: Maybe ArtifactStore
$sel:artifactStore:PipelineDeclaration' :: PipelineDeclaration -> Maybe ArtifactStore
artifactStore} -> Maybe ArtifactStore
artifactStore) (\s :: PipelineDeclaration
s@PipelineDeclaration' {} Maybe ArtifactStore
a -> PipelineDeclaration
s {$sel:artifactStore:PipelineDeclaration' :: Maybe ArtifactStore
artifactStore = Maybe ArtifactStore
a} :: PipelineDeclaration)
pipelineDeclaration_version :: Lens.Lens' PipelineDeclaration (Prelude.Maybe Prelude.Natural)
pipelineDeclaration_version :: (Maybe Natural -> f (Maybe Natural))
-> PipelineDeclaration -> f PipelineDeclaration
pipelineDeclaration_version = (PipelineDeclaration -> Maybe Natural)
-> (PipelineDeclaration -> Maybe Natural -> PipelineDeclaration)
-> Lens
PipelineDeclaration
PipelineDeclaration
(Maybe Natural)
(Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDeclaration' {Maybe Natural
version :: Maybe Natural
$sel:version:PipelineDeclaration' :: PipelineDeclaration -> Maybe Natural
version} -> Maybe Natural
version) (\s :: PipelineDeclaration
s@PipelineDeclaration' {} Maybe Natural
a -> PipelineDeclaration
s {$sel:version:PipelineDeclaration' :: Maybe Natural
version = Maybe Natural
a} :: PipelineDeclaration)
pipelineDeclaration_name :: Lens.Lens' PipelineDeclaration Prelude.Text
pipelineDeclaration_name :: (Text -> f Text) -> PipelineDeclaration -> f PipelineDeclaration
pipelineDeclaration_name = (PipelineDeclaration -> Text)
-> (PipelineDeclaration -> Text -> PipelineDeclaration)
-> Lens PipelineDeclaration PipelineDeclaration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDeclaration' {Text
name :: Text
$sel:name:PipelineDeclaration' :: PipelineDeclaration -> Text
name} -> Text
name) (\s :: PipelineDeclaration
s@PipelineDeclaration' {} Text
a -> PipelineDeclaration
s {$sel:name:PipelineDeclaration' :: Text
name = Text
a} :: PipelineDeclaration)
pipelineDeclaration_roleArn :: Lens.Lens' PipelineDeclaration Prelude.Text
pipelineDeclaration_roleArn :: (Text -> f Text) -> PipelineDeclaration -> f PipelineDeclaration
pipelineDeclaration_roleArn = (PipelineDeclaration -> Text)
-> (PipelineDeclaration -> Text -> PipelineDeclaration)
-> Lens PipelineDeclaration PipelineDeclaration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDeclaration' {Text
roleArn :: Text
$sel:roleArn:PipelineDeclaration' :: PipelineDeclaration -> Text
roleArn} -> Text
roleArn) (\s :: PipelineDeclaration
s@PipelineDeclaration' {} Text
a -> PipelineDeclaration
s {$sel:roleArn:PipelineDeclaration' :: Text
roleArn = Text
a} :: PipelineDeclaration)
pipelineDeclaration_stages :: Lens.Lens' PipelineDeclaration [StageDeclaration]
pipelineDeclaration_stages :: ([StageDeclaration] -> f [StageDeclaration])
-> PipelineDeclaration -> f PipelineDeclaration
pipelineDeclaration_stages = (PipelineDeclaration -> [StageDeclaration])
-> (PipelineDeclaration
-> [StageDeclaration] -> PipelineDeclaration)
-> Lens
PipelineDeclaration
PipelineDeclaration
[StageDeclaration]
[StageDeclaration]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PipelineDeclaration' {[StageDeclaration]
stages :: [StageDeclaration]
$sel:stages:PipelineDeclaration' :: PipelineDeclaration -> [StageDeclaration]
stages} -> [StageDeclaration]
stages) (\s :: PipelineDeclaration
s@PipelineDeclaration' {} [StageDeclaration]
a -> PipelineDeclaration
s {$sel:stages:PipelineDeclaration' :: [StageDeclaration]
stages = [StageDeclaration]
a} :: PipelineDeclaration) (([StageDeclaration] -> f [StageDeclaration])
-> PipelineDeclaration -> f PipelineDeclaration)
-> (([StageDeclaration] -> f [StageDeclaration])
-> [StageDeclaration] -> f [StageDeclaration])
-> ([StageDeclaration] -> f [StageDeclaration])
-> PipelineDeclaration
-> f PipelineDeclaration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([StageDeclaration] -> f [StageDeclaration])
-> [StageDeclaration] -> f [StageDeclaration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON PipelineDeclaration where
parseJSON :: Value -> Parser PipelineDeclaration
parseJSON =
String
-> (Object -> Parser PipelineDeclaration)
-> Value
-> Parser PipelineDeclaration
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"PipelineDeclaration"
( \Object
x ->
Maybe (HashMap Text ArtifactStore)
-> Maybe ArtifactStore
-> Maybe Natural
-> Text
-> Text
-> [StageDeclaration]
-> PipelineDeclaration
PipelineDeclaration'
(Maybe (HashMap Text ArtifactStore)
-> Maybe ArtifactStore
-> Maybe Natural
-> Text
-> Text
-> [StageDeclaration]
-> PipelineDeclaration)
-> Parser (Maybe (HashMap Text ArtifactStore))
-> Parser
(Maybe ArtifactStore
-> Maybe Natural
-> Text
-> Text
-> [StageDeclaration]
-> PipelineDeclaration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Text -> Parser (Maybe (Maybe (HashMap Text ArtifactStore)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"artifactStores" Parser (Maybe (Maybe (HashMap Text ArtifactStore)))
-> Maybe (HashMap Text ArtifactStore)
-> Parser (Maybe (HashMap Text ArtifactStore))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text ArtifactStore)
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe ArtifactStore
-> Maybe Natural
-> Text
-> Text
-> [StageDeclaration]
-> PipelineDeclaration)
-> Parser (Maybe ArtifactStore)
-> Parser
(Maybe Natural
-> Text -> Text -> [StageDeclaration] -> PipelineDeclaration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ArtifactStore)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"artifactStore")
Parser
(Maybe Natural
-> Text -> Text -> [StageDeclaration] -> PipelineDeclaration)
-> Parser (Maybe Natural)
-> Parser
(Text -> Text -> [StageDeclaration] -> PipelineDeclaration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"version")
Parser (Text -> Text -> [StageDeclaration] -> PipelineDeclaration)
-> Parser Text
-> Parser (Text -> [StageDeclaration] -> PipelineDeclaration)
forall (f :: * -> *) a b. Applicative f => 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 (Text -> [StageDeclaration] -> PipelineDeclaration)
-> Parser Text
-> Parser ([StageDeclaration] -> PipelineDeclaration)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
Parser ([StageDeclaration] -> PipelineDeclaration)
-> Parser [StageDeclaration] -> Parser PipelineDeclaration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [StageDeclaration])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"stages" Parser (Maybe [StageDeclaration])
-> [StageDeclaration] -> Parser [StageDeclaration]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [StageDeclaration]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable PipelineDeclaration
instance Prelude.NFData PipelineDeclaration
instance Core.ToJSON PipelineDeclaration where
toJSON :: PipelineDeclaration -> Value
toJSON PipelineDeclaration' {[StageDeclaration]
Maybe Natural
Maybe (HashMap Text ArtifactStore)
Maybe ArtifactStore
Text
stages :: [StageDeclaration]
roleArn :: Text
name :: Text
version :: Maybe Natural
artifactStore :: Maybe ArtifactStore
artifactStores :: Maybe (HashMap Text ArtifactStore)
$sel:stages:PipelineDeclaration' :: PipelineDeclaration -> [StageDeclaration]
$sel:roleArn:PipelineDeclaration' :: PipelineDeclaration -> Text
$sel:name:PipelineDeclaration' :: PipelineDeclaration -> Text
$sel:version:PipelineDeclaration' :: PipelineDeclaration -> Maybe Natural
$sel:artifactStore:PipelineDeclaration' :: PipelineDeclaration -> Maybe ArtifactStore
$sel:artifactStores:PipelineDeclaration' :: PipelineDeclaration -> Maybe (HashMap Text ArtifactStore)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"artifactStores" Text -> HashMap Text ArtifactStore -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(HashMap Text ArtifactStore -> Pair)
-> Maybe (HashMap Text ArtifactStore) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text ArtifactStore)
artifactStores,
(Text
"artifactStore" Text -> ArtifactStore -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ArtifactStore -> Pair) -> Maybe ArtifactStore -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ArtifactStore
artifactStore,
(Text
"version" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
version,
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
"roleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
roleArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"stages" Text -> [StageDeclaration] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [StageDeclaration]
stages)
]
)