{-# 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.Lightsail.CreateCloudFormationStack
(
CreateCloudFormationStack (..),
newCreateCloudFormationStack,
createCloudFormationStack_instances,
CreateCloudFormationStackResponse (..),
newCreateCloudFormationStackResponse,
createCloudFormationStackResponse_operations,
createCloudFormationStackResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateCloudFormationStack = CreateCloudFormationStack'
{
CreateCloudFormationStack -> [InstanceEntry]
instances :: [InstanceEntry]
}
deriving (CreateCloudFormationStack -> CreateCloudFormationStack -> Bool
(CreateCloudFormationStack -> CreateCloudFormationStack -> Bool)
-> (CreateCloudFormationStack -> CreateCloudFormationStack -> Bool)
-> Eq CreateCloudFormationStack
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCloudFormationStack -> CreateCloudFormationStack -> Bool
$c/= :: CreateCloudFormationStack -> CreateCloudFormationStack -> Bool
== :: CreateCloudFormationStack -> CreateCloudFormationStack -> Bool
$c== :: CreateCloudFormationStack -> CreateCloudFormationStack -> Bool
Prelude.Eq, ReadPrec [CreateCloudFormationStack]
ReadPrec CreateCloudFormationStack
Int -> ReadS CreateCloudFormationStack
ReadS [CreateCloudFormationStack]
(Int -> ReadS CreateCloudFormationStack)
-> ReadS [CreateCloudFormationStack]
-> ReadPrec CreateCloudFormationStack
-> ReadPrec [CreateCloudFormationStack]
-> Read CreateCloudFormationStack
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCloudFormationStack]
$creadListPrec :: ReadPrec [CreateCloudFormationStack]
readPrec :: ReadPrec CreateCloudFormationStack
$creadPrec :: ReadPrec CreateCloudFormationStack
readList :: ReadS [CreateCloudFormationStack]
$creadList :: ReadS [CreateCloudFormationStack]
readsPrec :: Int -> ReadS CreateCloudFormationStack
$creadsPrec :: Int -> ReadS CreateCloudFormationStack
Prelude.Read, Int -> CreateCloudFormationStack -> ShowS
[CreateCloudFormationStack] -> ShowS
CreateCloudFormationStack -> String
(Int -> CreateCloudFormationStack -> ShowS)
-> (CreateCloudFormationStack -> String)
-> ([CreateCloudFormationStack] -> ShowS)
-> Show CreateCloudFormationStack
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCloudFormationStack] -> ShowS
$cshowList :: [CreateCloudFormationStack] -> ShowS
show :: CreateCloudFormationStack -> String
$cshow :: CreateCloudFormationStack -> String
showsPrec :: Int -> CreateCloudFormationStack -> ShowS
$cshowsPrec :: Int -> CreateCloudFormationStack -> ShowS
Prelude.Show, (forall x.
CreateCloudFormationStack -> Rep CreateCloudFormationStack x)
-> (forall x.
Rep CreateCloudFormationStack x -> CreateCloudFormationStack)
-> Generic CreateCloudFormationStack
forall x.
Rep CreateCloudFormationStack x -> CreateCloudFormationStack
forall x.
CreateCloudFormationStack -> Rep CreateCloudFormationStack x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCloudFormationStack x -> CreateCloudFormationStack
$cfrom :: forall x.
CreateCloudFormationStack -> Rep CreateCloudFormationStack x
Prelude.Generic)
newCreateCloudFormationStack ::
CreateCloudFormationStack
newCreateCloudFormationStack :: CreateCloudFormationStack
newCreateCloudFormationStack =
CreateCloudFormationStack' :: [InstanceEntry] -> CreateCloudFormationStack
CreateCloudFormationStack'
{ $sel:instances:CreateCloudFormationStack' :: [InstanceEntry]
instances =
[InstanceEntry]
forall a. Monoid a => a
Prelude.mempty
}
createCloudFormationStack_instances :: Lens.Lens' CreateCloudFormationStack [InstanceEntry]
createCloudFormationStack_instances :: ([InstanceEntry] -> f [InstanceEntry])
-> CreateCloudFormationStack -> f CreateCloudFormationStack
createCloudFormationStack_instances = (CreateCloudFormationStack -> [InstanceEntry])
-> (CreateCloudFormationStack
-> [InstanceEntry] -> CreateCloudFormationStack)
-> Lens
CreateCloudFormationStack
CreateCloudFormationStack
[InstanceEntry]
[InstanceEntry]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCloudFormationStack' {[InstanceEntry]
instances :: [InstanceEntry]
$sel:instances:CreateCloudFormationStack' :: CreateCloudFormationStack -> [InstanceEntry]
instances} -> [InstanceEntry]
instances) (\s :: CreateCloudFormationStack
s@CreateCloudFormationStack' {} [InstanceEntry]
a -> CreateCloudFormationStack
s {$sel:instances:CreateCloudFormationStack' :: [InstanceEntry]
instances = [InstanceEntry]
a} :: CreateCloudFormationStack) (([InstanceEntry] -> f [InstanceEntry])
-> CreateCloudFormationStack -> f CreateCloudFormationStack)
-> (([InstanceEntry] -> f [InstanceEntry])
-> [InstanceEntry] -> f [InstanceEntry])
-> ([InstanceEntry] -> f [InstanceEntry])
-> CreateCloudFormationStack
-> f CreateCloudFormationStack
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([InstanceEntry] -> f [InstanceEntry])
-> [InstanceEntry] -> f [InstanceEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest CreateCloudFormationStack where
type
AWSResponse CreateCloudFormationStack =
CreateCloudFormationStackResponse
request :: CreateCloudFormationStack -> Request CreateCloudFormationStack
request = Service
-> CreateCloudFormationStack -> Request CreateCloudFormationStack
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCloudFormationStack
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCloudFormationStack)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateCloudFormationStack))
-> Logger
-> Service
-> Proxy CreateCloudFormationStack
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCloudFormationStack)))
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 ->
Maybe [Operation] -> Int -> CreateCloudFormationStackResponse
CreateCloudFormationStackResponse'
(Maybe [Operation] -> Int -> CreateCloudFormationStackResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> CreateCloudFormationStackResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Key -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> CreateCloudFormationStackResponse)
-> Either String Int
-> Either String CreateCloudFormationStackResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable CreateCloudFormationStack
instance Prelude.NFData CreateCloudFormationStack
instance Core.ToHeaders CreateCloudFormationStack where
toHeaders :: CreateCloudFormationStack -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateCloudFormationStack -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Lightsail_20161128.CreateCloudFormationStack" ::
Prelude.ByteString
),
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 CreateCloudFormationStack where
toJSON :: CreateCloudFormationStack -> Value
toJSON CreateCloudFormationStack' {[InstanceEntry]
instances :: [InstanceEntry]
$sel:instances:CreateCloudFormationStack' :: CreateCloudFormationStack -> [InstanceEntry]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Key
"instances" Key -> [InstanceEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= [InstanceEntry]
instances)]
)
instance Core.ToPath CreateCloudFormationStack where
toPath :: CreateCloudFormationStack -> ByteString
toPath = ByteString -> CreateCloudFormationStack -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateCloudFormationStack where
toQuery :: CreateCloudFormationStack -> QueryString
toQuery = QueryString -> CreateCloudFormationStack -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateCloudFormationStackResponse = CreateCloudFormationStackResponse'
{
CreateCloudFormationStackResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
CreateCloudFormationStackResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCloudFormationStackResponse
-> CreateCloudFormationStackResponse -> Bool
(CreateCloudFormationStackResponse
-> CreateCloudFormationStackResponse -> Bool)
-> (CreateCloudFormationStackResponse
-> CreateCloudFormationStackResponse -> Bool)
-> Eq CreateCloudFormationStackResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCloudFormationStackResponse
-> CreateCloudFormationStackResponse -> Bool
$c/= :: CreateCloudFormationStackResponse
-> CreateCloudFormationStackResponse -> Bool
== :: CreateCloudFormationStackResponse
-> CreateCloudFormationStackResponse -> Bool
$c== :: CreateCloudFormationStackResponse
-> CreateCloudFormationStackResponse -> Bool
Prelude.Eq, ReadPrec [CreateCloudFormationStackResponse]
ReadPrec CreateCloudFormationStackResponse
Int -> ReadS CreateCloudFormationStackResponse
ReadS [CreateCloudFormationStackResponse]
(Int -> ReadS CreateCloudFormationStackResponse)
-> ReadS [CreateCloudFormationStackResponse]
-> ReadPrec CreateCloudFormationStackResponse
-> ReadPrec [CreateCloudFormationStackResponse]
-> Read CreateCloudFormationStackResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCloudFormationStackResponse]
$creadListPrec :: ReadPrec [CreateCloudFormationStackResponse]
readPrec :: ReadPrec CreateCloudFormationStackResponse
$creadPrec :: ReadPrec CreateCloudFormationStackResponse
readList :: ReadS [CreateCloudFormationStackResponse]
$creadList :: ReadS [CreateCloudFormationStackResponse]
readsPrec :: Int -> ReadS CreateCloudFormationStackResponse
$creadsPrec :: Int -> ReadS CreateCloudFormationStackResponse
Prelude.Read, Int -> CreateCloudFormationStackResponse -> ShowS
[CreateCloudFormationStackResponse] -> ShowS
CreateCloudFormationStackResponse -> String
(Int -> CreateCloudFormationStackResponse -> ShowS)
-> (CreateCloudFormationStackResponse -> String)
-> ([CreateCloudFormationStackResponse] -> ShowS)
-> Show CreateCloudFormationStackResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCloudFormationStackResponse] -> ShowS
$cshowList :: [CreateCloudFormationStackResponse] -> ShowS
show :: CreateCloudFormationStackResponse -> String
$cshow :: CreateCloudFormationStackResponse -> String
showsPrec :: Int -> CreateCloudFormationStackResponse -> ShowS
$cshowsPrec :: Int -> CreateCloudFormationStackResponse -> ShowS
Prelude.Show, (forall x.
CreateCloudFormationStackResponse
-> Rep CreateCloudFormationStackResponse x)
-> (forall x.
Rep CreateCloudFormationStackResponse x
-> CreateCloudFormationStackResponse)
-> Generic CreateCloudFormationStackResponse
forall x.
Rep CreateCloudFormationStackResponse x
-> CreateCloudFormationStackResponse
forall x.
CreateCloudFormationStackResponse
-> Rep CreateCloudFormationStackResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCloudFormationStackResponse x
-> CreateCloudFormationStackResponse
$cfrom :: forall x.
CreateCloudFormationStackResponse
-> Rep CreateCloudFormationStackResponse x
Prelude.Generic)
newCreateCloudFormationStackResponse ::
Prelude.Int ->
CreateCloudFormationStackResponse
newCreateCloudFormationStackResponse :: Int -> CreateCloudFormationStackResponse
newCreateCloudFormationStackResponse Int
pHttpStatus_ =
CreateCloudFormationStackResponse' :: Maybe [Operation] -> Int -> CreateCloudFormationStackResponse
CreateCloudFormationStackResponse'
{ $sel:operations:CreateCloudFormationStackResponse' :: Maybe [Operation]
operations =
Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCloudFormationStackResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCloudFormationStackResponse_operations :: Lens.Lens' CreateCloudFormationStackResponse (Prelude.Maybe [Operation])
createCloudFormationStackResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateCloudFormationStackResponse
-> f CreateCloudFormationStackResponse
createCloudFormationStackResponse_operations = (CreateCloudFormationStackResponse -> Maybe [Operation])
-> (CreateCloudFormationStackResponse
-> Maybe [Operation] -> CreateCloudFormationStackResponse)
-> Lens
CreateCloudFormationStackResponse
CreateCloudFormationStackResponse
(Maybe [Operation])
(Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCloudFormationStackResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateCloudFormationStackResponse' :: CreateCloudFormationStackResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateCloudFormationStackResponse
s@CreateCloudFormationStackResponse' {} Maybe [Operation]
a -> CreateCloudFormationStackResponse
s {$sel:operations:CreateCloudFormationStackResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateCloudFormationStackResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
-> CreateCloudFormationStackResponse
-> f CreateCloudFormationStackResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
-> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateCloudFormationStackResponse
-> f CreateCloudFormationStackResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
(Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCloudFormationStackResponse_httpStatus :: Lens.Lens' CreateCloudFormationStackResponse Prelude.Int
createCloudFormationStackResponse_httpStatus :: (Int -> f Int)
-> CreateCloudFormationStackResponse
-> f CreateCloudFormationStackResponse
createCloudFormationStackResponse_httpStatus = (CreateCloudFormationStackResponse -> Int)
-> (CreateCloudFormationStackResponse
-> Int -> CreateCloudFormationStackResponse)
-> Lens
CreateCloudFormationStackResponse
CreateCloudFormationStackResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCloudFormationStackResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCloudFormationStackResponse' :: CreateCloudFormationStackResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCloudFormationStackResponse
s@CreateCloudFormationStackResponse' {} Int
a -> CreateCloudFormationStackResponse
s {$sel:httpStatus:CreateCloudFormationStackResponse' :: Int
httpStatus = Int
a} :: CreateCloudFormationStackResponse)
instance
Prelude.NFData
CreateCloudFormationStackResponse