{-# 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.ECS.CreateCapacityProvider
(
CreateCapacityProvider (..),
newCreateCapacityProvider,
createCapacityProvider_tags,
createCapacityProvider_name,
createCapacityProvider_autoScalingGroupProvider,
CreateCapacityProviderResponse (..),
newCreateCapacityProviderResponse,
createCapacityProviderResponse_capacityProvider,
createCapacityProviderResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECS.Types
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 CreateCapacityProvider = CreateCapacityProvider'
{
CreateCapacityProvider -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateCapacityProvider -> Text
name :: Prelude.Text,
CreateCapacityProvider -> AutoScalingGroupProvider
autoScalingGroupProvider :: AutoScalingGroupProvider
}
deriving (CreateCapacityProvider -> CreateCapacityProvider -> Bool
(CreateCapacityProvider -> CreateCapacityProvider -> Bool)
-> (CreateCapacityProvider -> CreateCapacityProvider -> Bool)
-> Eq CreateCapacityProvider
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCapacityProvider -> CreateCapacityProvider -> Bool
$c/= :: CreateCapacityProvider -> CreateCapacityProvider -> Bool
== :: CreateCapacityProvider -> CreateCapacityProvider -> Bool
$c== :: CreateCapacityProvider -> CreateCapacityProvider -> Bool
Prelude.Eq, ReadPrec [CreateCapacityProvider]
ReadPrec CreateCapacityProvider
Int -> ReadS CreateCapacityProvider
ReadS [CreateCapacityProvider]
(Int -> ReadS CreateCapacityProvider)
-> ReadS [CreateCapacityProvider]
-> ReadPrec CreateCapacityProvider
-> ReadPrec [CreateCapacityProvider]
-> Read CreateCapacityProvider
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCapacityProvider]
$creadListPrec :: ReadPrec [CreateCapacityProvider]
readPrec :: ReadPrec CreateCapacityProvider
$creadPrec :: ReadPrec CreateCapacityProvider
readList :: ReadS [CreateCapacityProvider]
$creadList :: ReadS [CreateCapacityProvider]
readsPrec :: Int -> ReadS CreateCapacityProvider
$creadsPrec :: Int -> ReadS CreateCapacityProvider
Prelude.Read, Int -> CreateCapacityProvider -> ShowS
[CreateCapacityProvider] -> ShowS
CreateCapacityProvider -> String
(Int -> CreateCapacityProvider -> ShowS)
-> (CreateCapacityProvider -> String)
-> ([CreateCapacityProvider] -> ShowS)
-> Show CreateCapacityProvider
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCapacityProvider] -> ShowS
$cshowList :: [CreateCapacityProvider] -> ShowS
show :: CreateCapacityProvider -> String
$cshow :: CreateCapacityProvider -> String
showsPrec :: Int -> CreateCapacityProvider -> ShowS
$cshowsPrec :: Int -> CreateCapacityProvider -> ShowS
Prelude.Show, (forall x. CreateCapacityProvider -> Rep CreateCapacityProvider x)
-> (forall x.
Rep CreateCapacityProvider x -> CreateCapacityProvider)
-> Generic CreateCapacityProvider
forall x. Rep CreateCapacityProvider x -> CreateCapacityProvider
forall x. CreateCapacityProvider -> Rep CreateCapacityProvider x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCapacityProvider x -> CreateCapacityProvider
$cfrom :: forall x. CreateCapacityProvider -> Rep CreateCapacityProvider x
Prelude.Generic)
newCreateCapacityProvider ::
Prelude.Text ->
AutoScalingGroupProvider ->
CreateCapacityProvider
newCreateCapacityProvider :: Text -> AutoScalingGroupProvider -> CreateCapacityProvider
newCreateCapacityProvider
Text
pName_
AutoScalingGroupProvider
pAutoScalingGroupProvider_ =
CreateCapacityProvider' :: Maybe [Tag]
-> Text -> AutoScalingGroupProvider -> CreateCapacityProvider
CreateCapacityProvider'
{ $sel:tags:CreateCapacityProvider' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:name:CreateCapacityProvider' :: Text
name = Text
pName_,
$sel:autoScalingGroupProvider:CreateCapacityProvider' :: AutoScalingGroupProvider
autoScalingGroupProvider =
AutoScalingGroupProvider
pAutoScalingGroupProvider_
}
createCapacityProvider_tags :: Lens.Lens' CreateCapacityProvider (Prelude.Maybe [Tag])
createCapacityProvider_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCapacityProvider -> f CreateCapacityProvider
createCapacityProvider_tags = (CreateCapacityProvider -> Maybe [Tag])
-> (CreateCapacityProvider
-> Maybe [Tag] -> CreateCapacityProvider)
-> Lens
CreateCapacityProvider
CreateCapacityProvider
(Maybe [Tag])
(Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityProvider' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateCapacityProvider' :: CreateCapacityProvider -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateCapacityProvider
s@CreateCapacityProvider' {} Maybe [Tag]
a -> CreateCapacityProvider
s {$sel:tags:CreateCapacityProvider' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateCapacityProvider) ((Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCapacityProvider -> f CreateCapacityProvider)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCapacityProvider
-> f CreateCapacityProvider
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createCapacityProvider_name :: Lens.Lens' CreateCapacityProvider Prelude.Text
createCapacityProvider_name :: (Text -> f Text)
-> CreateCapacityProvider -> f CreateCapacityProvider
createCapacityProvider_name = (CreateCapacityProvider -> Text)
-> (CreateCapacityProvider -> Text -> CreateCapacityProvider)
-> Lens CreateCapacityProvider CreateCapacityProvider Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityProvider' {Text
name :: Text
$sel:name:CreateCapacityProvider' :: CreateCapacityProvider -> Text
name} -> Text
name) (\s :: CreateCapacityProvider
s@CreateCapacityProvider' {} Text
a -> CreateCapacityProvider
s {$sel:name:CreateCapacityProvider' :: Text
name = Text
a} :: CreateCapacityProvider)
createCapacityProvider_autoScalingGroupProvider :: Lens.Lens' CreateCapacityProvider AutoScalingGroupProvider
createCapacityProvider_autoScalingGroupProvider :: (AutoScalingGroupProvider -> f AutoScalingGroupProvider)
-> CreateCapacityProvider -> f CreateCapacityProvider
createCapacityProvider_autoScalingGroupProvider = (CreateCapacityProvider -> AutoScalingGroupProvider)
-> (CreateCapacityProvider
-> AutoScalingGroupProvider -> CreateCapacityProvider)
-> Lens
CreateCapacityProvider
CreateCapacityProvider
AutoScalingGroupProvider
AutoScalingGroupProvider
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityProvider' {AutoScalingGroupProvider
autoScalingGroupProvider :: AutoScalingGroupProvider
$sel:autoScalingGroupProvider:CreateCapacityProvider' :: CreateCapacityProvider -> AutoScalingGroupProvider
autoScalingGroupProvider} -> AutoScalingGroupProvider
autoScalingGroupProvider) (\s :: CreateCapacityProvider
s@CreateCapacityProvider' {} AutoScalingGroupProvider
a -> CreateCapacityProvider
s {$sel:autoScalingGroupProvider:CreateCapacityProvider' :: AutoScalingGroupProvider
autoScalingGroupProvider = AutoScalingGroupProvider
a} :: CreateCapacityProvider)
instance Core.AWSRequest CreateCapacityProvider where
type
AWSResponse CreateCapacityProvider =
CreateCapacityProviderResponse
request :: CreateCapacityProvider -> Request CreateCapacityProvider
request = Service -> CreateCapacityProvider -> Request CreateCapacityProvider
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CreateCapacityProvider
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCapacityProvider)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CreateCapacityProvider))
-> Logger
-> Service
-> Proxy CreateCapacityProvider
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCapacityProvider)))
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 CapacityProvider -> Int -> CreateCapacityProviderResponse
CreateCapacityProviderResponse'
(Maybe CapacityProvider -> Int -> CreateCapacityProviderResponse)
-> Either String (Maybe CapacityProvider)
-> Either String (Int -> CreateCapacityProviderResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CapacityProvider)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"capacityProvider")
Either String (Int -> CreateCapacityProviderResponse)
-> Either String Int
-> Either String CreateCapacityProviderResponse
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 CreateCapacityProvider
instance Prelude.NFData CreateCapacityProvider
instance Core.ToHeaders CreateCapacityProvider where
toHeaders :: CreateCapacityProvider -> ResponseHeaders
toHeaders =
ResponseHeaders -> CreateCapacityProvider -> 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
"AmazonEC2ContainerServiceV20141113.CreateCapacityProvider" ::
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 CreateCapacityProvider where
toJSON :: CreateCapacityProvider -> Value
toJSON CreateCapacityProvider' {Maybe [Tag]
Text
AutoScalingGroupProvider
autoScalingGroupProvider :: AutoScalingGroupProvider
name :: Text
tags :: Maybe [Tag]
$sel:autoScalingGroupProvider:CreateCapacityProvider' :: CreateCapacityProvider -> AutoScalingGroupProvider
$sel:name:CreateCapacityProvider' :: CreateCapacityProvider -> Text
$sel:tags:CreateCapacityProvider' :: CreateCapacityProvider -> Maybe [Tag]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
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
"autoScalingGroupProvider"
Text -> AutoScalingGroupProvider -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AutoScalingGroupProvider
autoScalingGroupProvider
)
]
)
instance Core.ToPath CreateCapacityProvider where
toPath :: CreateCapacityProvider -> ByteString
toPath = ByteString -> CreateCapacityProvider -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CreateCapacityProvider where
toQuery :: CreateCapacityProvider -> QueryString
toQuery = QueryString -> CreateCapacityProvider -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CreateCapacityProviderResponse = CreateCapacityProviderResponse'
{
CreateCapacityProviderResponse -> Maybe CapacityProvider
capacityProvider :: Prelude.Maybe CapacityProvider,
CreateCapacityProviderResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCapacityProviderResponse
-> CreateCapacityProviderResponse -> Bool
(CreateCapacityProviderResponse
-> CreateCapacityProviderResponse -> Bool)
-> (CreateCapacityProviderResponse
-> CreateCapacityProviderResponse -> Bool)
-> Eq CreateCapacityProviderResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCapacityProviderResponse
-> CreateCapacityProviderResponse -> Bool
$c/= :: CreateCapacityProviderResponse
-> CreateCapacityProviderResponse -> Bool
== :: CreateCapacityProviderResponse
-> CreateCapacityProviderResponse -> Bool
$c== :: CreateCapacityProviderResponse
-> CreateCapacityProviderResponse -> Bool
Prelude.Eq, ReadPrec [CreateCapacityProviderResponse]
ReadPrec CreateCapacityProviderResponse
Int -> ReadS CreateCapacityProviderResponse
ReadS [CreateCapacityProviderResponse]
(Int -> ReadS CreateCapacityProviderResponse)
-> ReadS [CreateCapacityProviderResponse]
-> ReadPrec CreateCapacityProviderResponse
-> ReadPrec [CreateCapacityProviderResponse]
-> Read CreateCapacityProviderResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCapacityProviderResponse]
$creadListPrec :: ReadPrec [CreateCapacityProviderResponse]
readPrec :: ReadPrec CreateCapacityProviderResponse
$creadPrec :: ReadPrec CreateCapacityProviderResponse
readList :: ReadS [CreateCapacityProviderResponse]
$creadList :: ReadS [CreateCapacityProviderResponse]
readsPrec :: Int -> ReadS CreateCapacityProviderResponse
$creadsPrec :: Int -> ReadS CreateCapacityProviderResponse
Prelude.Read, Int -> CreateCapacityProviderResponse -> ShowS
[CreateCapacityProviderResponse] -> ShowS
CreateCapacityProviderResponse -> String
(Int -> CreateCapacityProviderResponse -> ShowS)
-> (CreateCapacityProviderResponse -> String)
-> ([CreateCapacityProviderResponse] -> ShowS)
-> Show CreateCapacityProviderResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCapacityProviderResponse] -> ShowS
$cshowList :: [CreateCapacityProviderResponse] -> ShowS
show :: CreateCapacityProviderResponse -> String
$cshow :: CreateCapacityProviderResponse -> String
showsPrec :: Int -> CreateCapacityProviderResponse -> ShowS
$cshowsPrec :: Int -> CreateCapacityProviderResponse -> ShowS
Prelude.Show, (forall x.
CreateCapacityProviderResponse
-> Rep CreateCapacityProviderResponse x)
-> (forall x.
Rep CreateCapacityProviderResponse x
-> CreateCapacityProviderResponse)
-> Generic CreateCapacityProviderResponse
forall x.
Rep CreateCapacityProviderResponse x
-> CreateCapacityProviderResponse
forall x.
CreateCapacityProviderResponse
-> Rep CreateCapacityProviderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCapacityProviderResponse x
-> CreateCapacityProviderResponse
$cfrom :: forall x.
CreateCapacityProviderResponse
-> Rep CreateCapacityProviderResponse x
Prelude.Generic)
newCreateCapacityProviderResponse ::
Prelude.Int ->
CreateCapacityProviderResponse
newCreateCapacityProviderResponse :: Int -> CreateCapacityProviderResponse
newCreateCapacityProviderResponse Int
pHttpStatus_ =
CreateCapacityProviderResponse' :: Maybe CapacityProvider -> Int -> CreateCapacityProviderResponse
CreateCapacityProviderResponse'
{ $sel:capacityProvider:CreateCapacityProviderResponse' :: Maybe CapacityProvider
capacityProvider =
Maybe CapacityProvider
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCapacityProviderResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCapacityProviderResponse_capacityProvider :: Lens.Lens' CreateCapacityProviderResponse (Prelude.Maybe CapacityProvider)
createCapacityProviderResponse_capacityProvider :: (Maybe CapacityProvider -> f (Maybe CapacityProvider))
-> CreateCapacityProviderResponse
-> f CreateCapacityProviderResponse
createCapacityProviderResponse_capacityProvider = (CreateCapacityProviderResponse -> Maybe CapacityProvider)
-> (CreateCapacityProviderResponse
-> Maybe CapacityProvider -> CreateCapacityProviderResponse)
-> Lens
CreateCapacityProviderResponse
CreateCapacityProviderResponse
(Maybe CapacityProvider)
(Maybe CapacityProvider)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityProviderResponse' {Maybe CapacityProvider
capacityProvider :: Maybe CapacityProvider
$sel:capacityProvider:CreateCapacityProviderResponse' :: CreateCapacityProviderResponse -> Maybe CapacityProvider
capacityProvider} -> Maybe CapacityProvider
capacityProvider) (\s :: CreateCapacityProviderResponse
s@CreateCapacityProviderResponse' {} Maybe CapacityProvider
a -> CreateCapacityProviderResponse
s {$sel:capacityProvider:CreateCapacityProviderResponse' :: Maybe CapacityProvider
capacityProvider = Maybe CapacityProvider
a} :: CreateCapacityProviderResponse)
createCapacityProviderResponse_httpStatus :: Lens.Lens' CreateCapacityProviderResponse Prelude.Int
createCapacityProviderResponse_httpStatus :: (Int -> f Int)
-> CreateCapacityProviderResponse
-> f CreateCapacityProviderResponse
createCapacityProviderResponse_httpStatus = (CreateCapacityProviderResponse -> Int)
-> (CreateCapacityProviderResponse
-> Int -> CreateCapacityProviderResponse)
-> Lens
CreateCapacityProviderResponse
CreateCapacityProviderResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityProviderResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCapacityProviderResponse' :: CreateCapacityProviderResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCapacityProviderResponse
s@CreateCapacityProviderResponse' {} Int
a -> CreateCapacityProviderResponse
s {$sel:httpStatus:CreateCapacityProviderResponse' :: Int
httpStatus = Int
a} :: CreateCapacityProviderResponse)
instance
Prelude.NFData
CreateCapacityProviderResponse