{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Amplify.StartDeployment
(
StartDeployment (..),
newStartDeployment,
startDeployment_jobId,
startDeployment_sourceUrl,
startDeployment_appId,
startDeployment_branchName,
StartDeploymentResponse (..),
newStartDeploymentResponse,
startDeploymentResponse_httpStatus,
startDeploymentResponse_jobSummary,
)
where
import Amazonka.Amplify.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data StartDeployment = StartDeployment'
{
StartDeployment -> Maybe Text
jobId :: Prelude.Maybe Prelude.Text,
StartDeployment -> Maybe Text
sourceUrl :: Prelude.Maybe Prelude.Text,
StartDeployment -> Text
appId :: Prelude.Text,
StartDeployment -> Text
branchName :: Prelude.Text
}
deriving (StartDeployment -> StartDeployment -> Bool
(StartDeployment -> StartDeployment -> Bool)
-> (StartDeployment -> StartDeployment -> Bool)
-> Eq StartDeployment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDeployment -> StartDeployment -> Bool
$c/= :: StartDeployment -> StartDeployment -> Bool
== :: StartDeployment -> StartDeployment -> Bool
$c== :: StartDeployment -> StartDeployment -> Bool
Prelude.Eq, ReadPrec [StartDeployment]
ReadPrec StartDeployment
Int -> ReadS StartDeployment
ReadS [StartDeployment]
(Int -> ReadS StartDeployment)
-> ReadS [StartDeployment]
-> ReadPrec StartDeployment
-> ReadPrec [StartDeployment]
-> Read StartDeployment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDeployment]
$creadListPrec :: ReadPrec [StartDeployment]
readPrec :: ReadPrec StartDeployment
$creadPrec :: ReadPrec StartDeployment
readList :: ReadS [StartDeployment]
$creadList :: ReadS [StartDeployment]
readsPrec :: Int -> ReadS StartDeployment
$creadsPrec :: Int -> ReadS StartDeployment
Prelude.Read, Int -> StartDeployment -> ShowS
[StartDeployment] -> ShowS
StartDeployment -> String
(Int -> StartDeployment -> ShowS)
-> (StartDeployment -> String)
-> ([StartDeployment] -> ShowS)
-> Show StartDeployment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDeployment] -> ShowS
$cshowList :: [StartDeployment] -> ShowS
show :: StartDeployment -> String
$cshow :: StartDeployment -> String
showsPrec :: Int -> StartDeployment -> ShowS
$cshowsPrec :: Int -> StartDeployment -> ShowS
Prelude.Show, (forall x. StartDeployment -> Rep StartDeployment x)
-> (forall x. Rep StartDeployment x -> StartDeployment)
-> Generic StartDeployment
forall x. Rep StartDeployment x -> StartDeployment
forall x. StartDeployment -> Rep StartDeployment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartDeployment x -> StartDeployment
$cfrom :: forall x. StartDeployment -> Rep StartDeployment x
Prelude.Generic)
newStartDeployment ::
Prelude.Text ->
Prelude.Text ->
StartDeployment
newStartDeployment :: Text -> Text -> StartDeployment
newStartDeployment Text
pAppId_ Text
pBranchName_ =
StartDeployment' :: Maybe Text -> Maybe Text -> Text -> Text -> StartDeployment
StartDeployment'
{ $sel:jobId:StartDeployment' :: Maybe Text
jobId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sourceUrl:StartDeployment' :: Maybe Text
sourceUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:appId:StartDeployment' :: Text
appId = Text
pAppId_,
$sel:branchName:StartDeployment' :: Text
branchName = Text
pBranchName_
}
startDeployment_jobId :: Lens.Lens' StartDeployment (Prelude.Maybe Prelude.Text)
startDeployment_jobId :: (Maybe Text -> f (Maybe Text))
-> StartDeployment -> f StartDeployment
startDeployment_jobId = (StartDeployment -> Maybe Text)
-> (StartDeployment -> Maybe Text -> StartDeployment)
-> Lens StartDeployment StartDeployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeployment' {Maybe Text
jobId :: Maybe Text
$sel:jobId:StartDeployment' :: StartDeployment -> Maybe Text
jobId} -> Maybe Text
jobId) (\s :: StartDeployment
s@StartDeployment' {} Maybe Text
a -> StartDeployment
s {$sel:jobId:StartDeployment' :: Maybe Text
jobId = Maybe Text
a} :: StartDeployment)
startDeployment_sourceUrl :: Lens.Lens' StartDeployment (Prelude.Maybe Prelude.Text)
startDeployment_sourceUrl :: (Maybe Text -> f (Maybe Text))
-> StartDeployment -> f StartDeployment
startDeployment_sourceUrl = (StartDeployment -> Maybe Text)
-> (StartDeployment -> Maybe Text -> StartDeployment)
-> Lens StartDeployment StartDeployment (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeployment' {Maybe Text
sourceUrl :: Maybe Text
$sel:sourceUrl:StartDeployment' :: StartDeployment -> Maybe Text
sourceUrl} -> Maybe Text
sourceUrl) (\s :: StartDeployment
s@StartDeployment' {} Maybe Text
a -> StartDeployment
s {$sel:sourceUrl:StartDeployment' :: Maybe Text
sourceUrl = Maybe Text
a} :: StartDeployment)
startDeployment_appId :: Lens.Lens' StartDeployment Prelude.Text
startDeployment_appId :: (Text -> f Text) -> StartDeployment -> f StartDeployment
startDeployment_appId = (StartDeployment -> Text)
-> (StartDeployment -> Text -> StartDeployment)
-> Lens StartDeployment StartDeployment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeployment' {Text
appId :: Text
$sel:appId:StartDeployment' :: StartDeployment -> Text
appId} -> Text
appId) (\s :: StartDeployment
s@StartDeployment' {} Text
a -> StartDeployment
s {$sel:appId:StartDeployment' :: Text
appId = Text
a} :: StartDeployment)
startDeployment_branchName :: Lens.Lens' StartDeployment Prelude.Text
startDeployment_branchName :: (Text -> f Text) -> StartDeployment -> f StartDeployment
startDeployment_branchName = (StartDeployment -> Text)
-> (StartDeployment -> Text -> StartDeployment)
-> Lens StartDeployment StartDeployment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeployment' {Text
branchName :: Text
$sel:branchName:StartDeployment' :: StartDeployment -> Text
branchName} -> Text
branchName) (\s :: StartDeployment
s@StartDeployment' {} Text
a -> StartDeployment
s {$sel:branchName:StartDeployment' :: Text
branchName = Text
a} :: StartDeployment)
instance Core.AWSRequest StartDeployment where
type
AWSResponse StartDeployment =
StartDeploymentResponse
request :: StartDeployment -> Request StartDeployment
request = Service -> StartDeployment -> Request StartDeployment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartDeployment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartDeployment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartDeployment))
-> Logger
-> Service
-> Proxy StartDeployment
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartDeployment)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> JobSummary -> StartDeploymentResponse
StartDeploymentResponse'
(Int -> JobSummary -> StartDeploymentResponse)
-> Either String Int
-> Either String (JobSummary -> StartDeploymentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
Either String (JobSummary -> StartDeploymentResponse)
-> Either String JobSummary
-> Either String StartDeploymentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String JobSummary
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"jobSummary")
)
instance Prelude.Hashable StartDeployment
instance Prelude.NFData StartDeployment
instance Core.ToHeaders StartDeployment where
toHeaders :: StartDeployment -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartDeployment -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON StartDeployment where
toJSON :: StartDeployment -> Value
toJSON StartDeployment' {Maybe Text
Text
branchName :: Text
appId :: Text
sourceUrl :: Maybe Text
jobId :: Maybe Text
$sel:branchName:StartDeployment' :: StartDeployment -> Text
$sel:appId:StartDeployment' :: StartDeployment -> Text
$sel:sourceUrl:StartDeployment' :: StartDeployment -> Maybe Text
$sel:jobId:StartDeployment' :: StartDeployment -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"jobId" 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
jobId,
(Text
"sourceUrl" 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
sourceUrl
]
)
instance Core.ToPath StartDeployment where
toPath :: StartDeployment -> ByteString
toPath StartDeployment' {Maybe Text
Text
branchName :: Text
appId :: Text
sourceUrl :: Maybe Text
jobId :: Maybe Text
$sel:branchName:StartDeployment' :: StartDeployment -> Text
$sel:appId:StartDeployment' :: StartDeployment -> Text
$sel:sourceUrl:StartDeployment' :: StartDeployment -> Maybe Text
$sel:jobId:StartDeployment' :: StartDeployment -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/apps/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
appId,
ByteString
"/branches/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
branchName,
ByteString
"/deployments/start"
]
instance Core.ToQuery StartDeployment where
toQuery :: StartDeployment -> QueryString
toQuery = QueryString -> StartDeployment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartDeploymentResponse = StartDeploymentResponse'
{
StartDeploymentResponse -> Int
httpStatus :: Prelude.Int,
StartDeploymentResponse -> JobSummary
jobSummary :: JobSummary
}
deriving (StartDeploymentResponse -> StartDeploymentResponse -> Bool
(StartDeploymentResponse -> StartDeploymentResponse -> Bool)
-> (StartDeploymentResponse -> StartDeploymentResponse -> Bool)
-> Eq StartDeploymentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartDeploymentResponse -> StartDeploymentResponse -> Bool
$c/= :: StartDeploymentResponse -> StartDeploymentResponse -> Bool
== :: StartDeploymentResponse -> StartDeploymentResponse -> Bool
$c== :: StartDeploymentResponse -> StartDeploymentResponse -> Bool
Prelude.Eq, ReadPrec [StartDeploymentResponse]
ReadPrec StartDeploymentResponse
Int -> ReadS StartDeploymentResponse
ReadS [StartDeploymentResponse]
(Int -> ReadS StartDeploymentResponse)
-> ReadS [StartDeploymentResponse]
-> ReadPrec StartDeploymentResponse
-> ReadPrec [StartDeploymentResponse]
-> Read StartDeploymentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartDeploymentResponse]
$creadListPrec :: ReadPrec [StartDeploymentResponse]
readPrec :: ReadPrec StartDeploymentResponse
$creadPrec :: ReadPrec StartDeploymentResponse
readList :: ReadS [StartDeploymentResponse]
$creadList :: ReadS [StartDeploymentResponse]
readsPrec :: Int -> ReadS StartDeploymentResponse
$creadsPrec :: Int -> ReadS StartDeploymentResponse
Prelude.Read, Int -> StartDeploymentResponse -> ShowS
[StartDeploymentResponse] -> ShowS
StartDeploymentResponse -> String
(Int -> StartDeploymentResponse -> ShowS)
-> (StartDeploymentResponse -> String)
-> ([StartDeploymentResponse] -> ShowS)
-> Show StartDeploymentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartDeploymentResponse] -> ShowS
$cshowList :: [StartDeploymentResponse] -> ShowS
show :: StartDeploymentResponse -> String
$cshow :: StartDeploymentResponse -> String
showsPrec :: Int -> StartDeploymentResponse -> ShowS
$cshowsPrec :: Int -> StartDeploymentResponse -> ShowS
Prelude.Show, (forall x.
StartDeploymentResponse -> Rep StartDeploymentResponse x)
-> (forall x.
Rep StartDeploymentResponse x -> StartDeploymentResponse)
-> Generic StartDeploymentResponse
forall x. Rep StartDeploymentResponse x -> StartDeploymentResponse
forall x. StartDeploymentResponse -> Rep StartDeploymentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartDeploymentResponse x -> StartDeploymentResponse
$cfrom :: forall x. StartDeploymentResponse -> Rep StartDeploymentResponse x
Prelude.Generic)
newStartDeploymentResponse ::
Prelude.Int ->
JobSummary ->
StartDeploymentResponse
newStartDeploymentResponse :: Int -> JobSummary -> StartDeploymentResponse
newStartDeploymentResponse Int
pHttpStatus_ JobSummary
pJobSummary_ =
StartDeploymentResponse' :: Int -> JobSummary -> StartDeploymentResponse
StartDeploymentResponse'
{ $sel:httpStatus:StartDeploymentResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:jobSummary:StartDeploymentResponse' :: JobSummary
jobSummary = JobSummary
pJobSummary_
}
startDeploymentResponse_httpStatus :: Lens.Lens' StartDeploymentResponse Prelude.Int
startDeploymentResponse_httpStatus :: (Int -> f Int)
-> StartDeploymentResponse -> f StartDeploymentResponse
startDeploymentResponse_httpStatus = (StartDeploymentResponse -> Int)
-> (StartDeploymentResponse -> Int -> StartDeploymentResponse)
-> Lens StartDeploymentResponse StartDeploymentResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeploymentResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartDeploymentResponse' :: StartDeploymentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartDeploymentResponse
s@StartDeploymentResponse' {} Int
a -> StartDeploymentResponse
s {$sel:httpStatus:StartDeploymentResponse' :: Int
httpStatus = Int
a} :: StartDeploymentResponse)
startDeploymentResponse_jobSummary :: Lens.Lens' StartDeploymentResponse JobSummary
startDeploymentResponse_jobSummary :: (JobSummary -> f JobSummary)
-> StartDeploymentResponse -> f StartDeploymentResponse
startDeploymentResponse_jobSummary = (StartDeploymentResponse -> JobSummary)
-> (StartDeploymentResponse
-> JobSummary -> StartDeploymentResponse)
-> Lens
StartDeploymentResponse
StartDeploymentResponse
JobSummary
JobSummary
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartDeploymentResponse' {JobSummary
jobSummary :: JobSummary
$sel:jobSummary:StartDeploymentResponse' :: StartDeploymentResponse -> JobSummary
jobSummary} -> JobSummary
jobSummary) (\s :: StartDeploymentResponse
s@StartDeploymentResponse' {} JobSummary
a -> StartDeploymentResponse
s {$sel:jobSummary:StartDeploymentResponse' :: JobSummary
jobSummary = JobSummary
a} :: StartDeploymentResponse)
instance Prelude.NFData StartDeploymentResponse