{-# 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.CreateBackendEnvironment
(
CreateBackendEnvironment (..),
newCreateBackendEnvironment,
createBackendEnvironment_deploymentArtifacts,
createBackendEnvironment_stackName,
createBackendEnvironment_appId,
createBackendEnvironment_environmentName,
CreateBackendEnvironmentResponse (..),
newCreateBackendEnvironmentResponse,
createBackendEnvironmentResponse_httpStatus,
createBackendEnvironmentResponse_backendEnvironment,
)
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 CreateBackendEnvironment = CreateBackendEnvironment'
{
CreateBackendEnvironment -> Maybe Text
deploymentArtifacts :: Prelude.Maybe Prelude.Text,
CreateBackendEnvironment -> Maybe Text
stackName :: Prelude.Maybe Prelude.Text,
CreateBackendEnvironment -> Text
appId :: Prelude.Text,
CreateBackendEnvironment -> Text
environmentName :: Prelude.Text
}
deriving (CreateBackendEnvironment -> CreateBackendEnvironment -> Bool
(CreateBackendEnvironment -> CreateBackendEnvironment -> Bool)
-> (CreateBackendEnvironment -> CreateBackendEnvironment -> Bool)
-> Eq CreateBackendEnvironment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackendEnvironment -> CreateBackendEnvironment -> Bool
$c/= :: CreateBackendEnvironment -> CreateBackendEnvironment -> Bool
== :: CreateBackendEnvironment -> CreateBackendEnvironment -> Bool
$c== :: CreateBackendEnvironment -> CreateBackendEnvironment -> Bool
Prelude.Eq, ReadPrec [CreateBackendEnvironment]
ReadPrec CreateBackendEnvironment
Int -> ReadS CreateBackendEnvironment
ReadS [CreateBackendEnvironment]
(Int -> ReadS CreateBackendEnvironment)
-> ReadS [CreateBackendEnvironment]
-> ReadPrec CreateBackendEnvironment
-> ReadPrec [CreateBackendEnvironment]
-> Read CreateBackendEnvironment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackendEnvironment]
$creadListPrec :: ReadPrec [CreateBackendEnvironment]
readPrec :: ReadPrec CreateBackendEnvironment
$creadPrec :: ReadPrec CreateBackendEnvironment
readList :: ReadS [CreateBackendEnvironment]
$creadList :: ReadS [CreateBackendEnvironment]
readsPrec :: Int -> ReadS CreateBackendEnvironment
$creadsPrec :: Int -> ReadS CreateBackendEnvironment
Prelude.Read, Int -> CreateBackendEnvironment -> ShowS
[CreateBackendEnvironment] -> ShowS
CreateBackendEnvironment -> String
(Int -> CreateBackendEnvironment -> ShowS)
-> (CreateBackendEnvironment -> String)
-> ([CreateBackendEnvironment] -> ShowS)
-> Show CreateBackendEnvironment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackendEnvironment] -> ShowS
$cshowList :: [CreateBackendEnvironment] -> ShowS
show :: CreateBackendEnvironment -> String
$cshow :: CreateBackendEnvironment -> String
showsPrec :: Int -> CreateBackendEnvironment -> ShowS
$cshowsPrec :: Int -> CreateBackendEnvironment -> ShowS
Prelude.Show, (forall x.
CreateBackendEnvironment -> Rep CreateBackendEnvironment x)
-> (forall x.
Rep CreateBackendEnvironment x -> CreateBackendEnvironment)
-> Generic CreateBackendEnvironment
forall x.
Rep CreateBackendEnvironment x -> CreateBackendEnvironment
forall x.
CreateBackendEnvironment -> Rep CreateBackendEnvironment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBackendEnvironment x -> CreateBackendEnvironment
$cfrom :: forall x.
CreateBackendEnvironment -> Rep CreateBackendEnvironment x
Prelude.Generic)
newCreateBackendEnvironment ::
Prelude.Text ->
Prelude.Text ->
CreateBackendEnvironment
newCreateBackendEnvironment :: Text -> Text -> CreateBackendEnvironment
newCreateBackendEnvironment Text
pAppId_ Text
pEnvironmentName_ =
CreateBackendEnvironment' :: Maybe Text
-> Maybe Text -> Text -> Text -> CreateBackendEnvironment
CreateBackendEnvironment'
{ $sel:deploymentArtifacts:CreateBackendEnvironment' :: Maybe Text
deploymentArtifacts =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:stackName:CreateBackendEnvironment' :: Maybe Text
stackName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:appId:CreateBackendEnvironment' :: Text
appId = Text
pAppId_,
$sel:environmentName:CreateBackendEnvironment' :: Text
environmentName = Text
pEnvironmentName_
}
createBackendEnvironment_deploymentArtifacts :: Lens.Lens' CreateBackendEnvironment (Prelude.Maybe Prelude.Text)
createBackendEnvironment_deploymentArtifacts :: (Maybe Text -> f (Maybe Text))
-> CreateBackendEnvironment -> f CreateBackendEnvironment
createBackendEnvironment_deploymentArtifacts = (CreateBackendEnvironment -> Maybe Text)
-> (CreateBackendEnvironment
-> Maybe Text -> CreateBackendEnvironment)
-> Lens
CreateBackendEnvironment
CreateBackendEnvironment
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendEnvironment' {Maybe Text
deploymentArtifacts :: Maybe Text
$sel:deploymentArtifacts:CreateBackendEnvironment' :: CreateBackendEnvironment -> Maybe Text
deploymentArtifacts} -> Maybe Text
deploymentArtifacts) (\s :: CreateBackendEnvironment
s@CreateBackendEnvironment' {} Maybe Text
a -> CreateBackendEnvironment
s {$sel:deploymentArtifacts:CreateBackendEnvironment' :: Maybe Text
deploymentArtifacts = Maybe Text
a} :: CreateBackendEnvironment)
createBackendEnvironment_stackName :: Lens.Lens' CreateBackendEnvironment (Prelude.Maybe Prelude.Text)
createBackendEnvironment_stackName :: (Maybe Text -> f (Maybe Text))
-> CreateBackendEnvironment -> f CreateBackendEnvironment
createBackendEnvironment_stackName = (CreateBackendEnvironment -> Maybe Text)
-> (CreateBackendEnvironment
-> Maybe Text -> CreateBackendEnvironment)
-> Lens
CreateBackendEnvironment
CreateBackendEnvironment
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendEnvironment' {Maybe Text
stackName :: Maybe Text
$sel:stackName:CreateBackendEnvironment' :: CreateBackendEnvironment -> Maybe Text
stackName} -> Maybe Text
stackName) (\s :: CreateBackendEnvironment
s@CreateBackendEnvironment' {} Maybe Text
a -> CreateBackendEnvironment
s {$sel:stackName:CreateBackendEnvironment' :: Maybe Text
stackName = Maybe Text
a} :: CreateBackendEnvironment)
createBackendEnvironment_appId :: Lens.Lens' CreateBackendEnvironment Prelude.Text
createBackendEnvironment_appId :: (Text -> f Text)
-> CreateBackendEnvironment -> f CreateBackendEnvironment
createBackendEnvironment_appId = (CreateBackendEnvironment -> Text)
-> (CreateBackendEnvironment -> Text -> CreateBackendEnvironment)
-> Lens CreateBackendEnvironment CreateBackendEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendEnvironment' {Text
appId :: Text
$sel:appId:CreateBackendEnvironment' :: CreateBackendEnvironment -> Text
appId} -> Text
appId) (\s :: CreateBackendEnvironment
s@CreateBackendEnvironment' {} Text
a -> CreateBackendEnvironment
s {$sel:appId:CreateBackendEnvironment' :: Text
appId = Text
a} :: CreateBackendEnvironment)
createBackendEnvironment_environmentName :: Lens.Lens' CreateBackendEnvironment Prelude.Text
createBackendEnvironment_environmentName :: (Text -> f Text)
-> CreateBackendEnvironment -> f CreateBackendEnvironment
createBackendEnvironment_environmentName = (CreateBackendEnvironment -> Text)
-> (CreateBackendEnvironment -> Text -> CreateBackendEnvironment)
-> Lens CreateBackendEnvironment CreateBackendEnvironment Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendEnvironment' {Text
environmentName :: Text
$sel:environmentName:CreateBackendEnvironment' :: CreateBackendEnvironment -> Text
environmentName} -> Text
environmentName) (\s :: CreateBackendEnvironment
s@CreateBackendEnvironment' {} Text
a -> CreateBackendEnvironment
s {$sel:environmentName:CreateBackendEnvironment' :: Text
environmentName = Text
a} :: CreateBackendEnvironment)
instance Core.AWSRequest CreateBackendEnvironment where
type
AWSResponse CreateBackendEnvironment =
CreateBackendEnvironmentResponse
request :: CreateBackendEnvironment -> Request CreateBackendEnvironment
request = Service
-> CreateBackendEnvironment -> Request CreateBackendEnvironment
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateBackendEnvironment
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateBackendEnvironment)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateBackendEnvironment))
-> Logger
-> Service
-> Proxy CreateBackendEnvironment
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateBackendEnvironment)))
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 -> BackendEnvironment -> CreateBackendEnvironmentResponse
CreateBackendEnvironmentResponse'
(Int -> BackendEnvironment -> CreateBackendEnvironmentResponse)
-> Either String Int
-> Either
String (BackendEnvironment -> CreateBackendEnvironmentResponse)
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 (BackendEnvironment -> CreateBackendEnvironmentResponse)
-> Either String BackendEnvironment
-> Either String CreateBackendEnvironmentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String BackendEnvironment
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"backendEnvironment")
)
instance Prelude.Hashable CreateBackendEnvironment
instance Prelude.NFData CreateBackendEnvironment
instance Core.ToHeaders CreateBackendEnvironment where
toHeaders :: CreateBackendEnvironment -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateBackendEnvironment -> 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 CreateBackendEnvironment where
toJSON :: CreateBackendEnvironment -> Value
toJSON CreateBackendEnvironment' {Maybe Text
Text
environmentName :: Text
appId :: Text
stackName :: Maybe Text
deploymentArtifacts :: Maybe Text
$sel:environmentName:CreateBackendEnvironment' :: CreateBackendEnvironment -> Text
$sel:appId:CreateBackendEnvironment' :: CreateBackendEnvironment -> Text
$sel:stackName:CreateBackendEnvironment' :: CreateBackendEnvironment -> Maybe Text
$sel:deploymentArtifacts:CreateBackendEnvironment' :: CreateBackendEnvironment -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"deploymentArtifacts" 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
deploymentArtifacts,
(Text
"stackName" 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
stackName,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"environmentName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
environmentName)
]
)
instance Core.ToPath CreateBackendEnvironment where
toPath :: CreateBackendEnvironment -> ByteString
toPath CreateBackendEnvironment' {Maybe Text
Text
environmentName :: Text
appId :: Text
stackName :: Maybe Text
deploymentArtifacts :: Maybe Text
$sel:environmentName:CreateBackendEnvironment' :: CreateBackendEnvironment -> Text
$sel:appId:CreateBackendEnvironment' :: CreateBackendEnvironment -> Text
$sel:stackName:CreateBackendEnvironment' :: CreateBackendEnvironment -> Maybe Text
$sel:deploymentArtifacts:CreateBackendEnvironment' :: CreateBackendEnvironment -> 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
"/backendenvironments"]
instance Core.ToQuery CreateBackendEnvironment where
toQuery :: CreateBackendEnvironment -> QueryString
toQuery = QueryString -> CreateBackendEnvironment -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateBackendEnvironmentResponse = CreateBackendEnvironmentResponse'
{
CreateBackendEnvironmentResponse -> Int
httpStatus :: Prelude.Int,
CreateBackendEnvironmentResponse -> BackendEnvironment
backendEnvironment :: BackendEnvironment
}
deriving (CreateBackendEnvironmentResponse
-> CreateBackendEnvironmentResponse -> Bool
(CreateBackendEnvironmentResponse
-> CreateBackendEnvironmentResponse -> Bool)
-> (CreateBackendEnvironmentResponse
-> CreateBackendEnvironmentResponse -> Bool)
-> Eq CreateBackendEnvironmentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateBackendEnvironmentResponse
-> CreateBackendEnvironmentResponse -> Bool
$c/= :: CreateBackendEnvironmentResponse
-> CreateBackendEnvironmentResponse -> Bool
== :: CreateBackendEnvironmentResponse
-> CreateBackendEnvironmentResponse -> Bool
$c== :: CreateBackendEnvironmentResponse
-> CreateBackendEnvironmentResponse -> Bool
Prelude.Eq, ReadPrec [CreateBackendEnvironmentResponse]
ReadPrec CreateBackendEnvironmentResponse
Int -> ReadS CreateBackendEnvironmentResponse
ReadS [CreateBackendEnvironmentResponse]
(Int -> ReadS CreateBackendEnvironmentResponse)
-> ReadS [CreateBackendEnvironmentResponse]
-> ReadPrec CreateBackendEnvironmentResponse
-> ReadPrec [CreateBackendEnvironmentResponse]
-> Read CreateBackendEnvironmentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateBackendEnvironmentResponse]
$creadListPrec :: ReadPrec [CreateBackendEnvironmentResponse]
readPrec :: ReadPrec CreateBackendEnvironmentResponse
$creadPrec :: ReadPrec CreateBackendEnvironmentResponse
readList :: ReadS [CreateBackendEnvironmentResponse]
$creadList :: ReadS [CreateBackendEnvironmentResponse]
readsPrec :: Int -> ReadS CreateBackendEnvironmentResponse
$creadsPrec :: Int -> ReadS CreateBackendEnvironmentResponse
Prelude.Read, Int -> CreateBackendEnvironmentResponse -> ShowS
[CreateBackendEnvironmentResponse] -> ShowS
CreateBackendEnvironmentResponse -> String
(Int -> CreateBackendEnvironmentResponse -> ShowS)
-> (CreateBackendEnvironmentResponse -> String)
-> ([CreateBackendEnvironmentResponse] -> ShowS)
-> Show CreateBackendEnvironmentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateBackendEnvironmentResponse] -> ShowS
$cshowList :: [CreateBackendEnvironmentResponse] -> ShowS
show :: CreateBackendEnvironmentResponse -> String
$cshow :: CreateBackendEnvironmentResponse -> String
showsPrec :: Int -> CreateBackendEnvironmentResponse -> ShowS
$cshowsPrec :: Int -> CreateBackendEnvironmentResponse -> ShowS
Prelude.Show, (forall x.
CreateBackendEnvironmentResponse
-> Rep CreateBackendEnvironmentResponse x)
-> (forall x.
Rep CreateBackendEnvironmentResponse x
-> CreateBackendEnvironmentResponse)
-> Generic CreateBackendEnvironmentResponse
forall x.
Rep CreateBackendEnvironmentResponse x
-> CreateBackendEnvironmentResponse
forall x.
CreateBackendEnvironmentResponse
-> Rep CreateBackendEnvironmentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateBackendEnvironmentResponse x
-> CreateBackendEnvironmentResponse
$cfrom :: forall x.
CreateBackendEnvironmentResponse
-> Rep CreateBackendEnvironmentResponse x
Prelude.Generic)
newCreateBackendEnvironmentResponse ::
Prelude.Int ->
BackendEnvironment ->
CreateBackendEnvironmentResponse
newCreateBackendEnvironmentResponse :: Int -> BackendEnvironment -> CreateBackendEnvironmentResponse
newCreateBackendEnvironmentResponse
Int
pHttpStatus_
BackendEnvironment
pBackendEnvironment_ =
CreateBackendEnvironmentResponse' :: Int -> BackendEnvironment -> CreateBackendEnvironmentResponse
CreateBackendEnvironmentResponse'
{ $sel:httpStatus:CreateBackendEnvironmentResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:backendEnvironment:CreateBackendEnvironmentResponse' :: BackendEnvironment
backendEnvironment = BackendEnvironment
pBackendEnvironment_
}
createBackendEnvironmentResponse_httpStatus :: Lens.Lens' CreateBackendEnvironmentResponse Prelude.Int
createBackendEnvironmentResponse_httpStatus :: (Int -> f Int)
-> CreateBackendEnvironmentResponse
-> f CreateBackendEnvironmentResponse
createBackendEnvironmentResponse_httpStatus = (CreateBackendEnvironmentResponse -> Int)
-> (CreateBackendEnvironmentResponse
-> Int -> CreateBackendEnvironmentResponse)
-> Lens
CreateBackendEnvironmentResponse
CreateBackendEnvironmentResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendEnvironmentResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateBackendEnvironmentResponse' :: CreateBackendEnvironmentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateBackendEnvironmentResponse
s@CreateBackendEnvironmentResponse' {} Int
a -> CreateBackendEnvironmentResponse
s {$sel:httpStatus:CreateBackendEnvironmentResponse' :: Int
httpStatus = Int
a} :: CreateBackendEnvironmentResponse)
createBackendEnvironmentResponse_backendEnvironment :: Lens.Lens' CreateBackendEnvironmentResponse BackendEnvironment
createBackendEnvironmentResponse_backendEnvironment :: (BackendEnvironment -> f BackendEnvironment)
-> CreateBackendEnvironmentResponse
-> f CreateBackendEnvironmentResponse
createBackendEnvironmentResponse_backendEnvironment = (CreateBackendEnvironmentResponse -> BackendEnvironment)
-> (CreateBackendEnvironmentResponse
-> BackendEnvironment -> CreateBackendEnvironmentResponse)
-> Lens
CreateBackendEnvironmentResponse
CreateBackendEnvironmentResponse
BackendEnvironment
BackendEnvironment
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateBackendEnvironmentResponse' {BackendEnvironment
backendEnvironment :: BackendEnvironment
$sel:backendEnvironment:CreateBackendEnvironmentResponse' :: CreateBackendEnvironmentResponse -> BackendEnvironment
backendEnvironment} -> BackendEnvironment
backendEnvironment) (\s :: CreateBackendEnvironmentResponse
s@CreateBackendEnvironmentResponse' {} BackendEnvironment
a -> CreateBackendEnvironmentResponse
s {$sel:backendEnvironment:CreateBackendEnvironmentResponse' :: BackendEnvironment
backendEnvironment = BackendEnvironment
a} :: CreateBackendEnvironmentResponse)
instance
Prelude.NFData
CreateBackendEnvironmentResponse