{-# 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.OpsWorks.RegisterEcsCluster
(
RegisterEcsCluster (..),
newRegisterEcsCluster,
registerEcsCluster_ecsClusterArn,
registerEcsCluster_stackId,
RegisterEcsClusterResponse (..),
newRegisterEcsClusterResponse,
registerEcsClusterResponse_ecsClusterArn,
registerEcsClusterResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpsWorks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RegisterEcsCluster = RegisterEcsCluster'
{
RegisterEcsCluster -> Text
ecsClusterArn :: Prelude.Text,
RegisterEcsCluster -> Text
stackId :: Prelude.Text
}
deriving (RegisterEcsCluster -> RegisterEcsCluster -> Bool
(RegisterEcsCluster -> RegisterEcsCluster -> Bool)
-> (RegisterEcsCluster -> RegisterEcsCluster -> Bool)
-> Eq RegisterEcsCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterEcsCluster -> RegisterEcsCluster -> Bool
$c/= :: RegisterEcsCluster -> RegisterEcsCluster -> Bool
== :: RegisterEcsCluster -> RegisterEcsCluster -> Bool
$c== :: RegisterEcsCluster -> RegisterEcsCluster -> Bool
Prelude.Eq, ReadPrec [RegisterEcsCluster]
ReadPrec RegisterEcsCluster
Int -> ReadS RegisterEcsCluster
ReadS [RegisterEcsCluster]
(Int -> ReadS RegisterEcsCluster)
-> ReadS [RegisterEcsCluster]
-> ReadPrec RegisterEcsCluster
-> ReadPrec [RegisterEcsCluster]
-> Read RegisterEcsCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterEcsCluster]
$creadListPrec :: ReadPrec [RegisterEcsCluster]
readPrec :: ReadPrec RegisterEcsCluster
$creadPrec :: ReadPrec RegisterEcsCluster
readList :: ReadS [RegisterEcsCluster]
$creadList :: ReadS [RegisterEcsCluster]
readsPrec :: Int -> ReadS RegisterEcsCluster
$creadsPrec :: Int -> ReadS RegisterEcsCluster
Prelude.Read, Int -> RegisterEcsCluster -> ShowS
[RegisterEcsCluster] -> ShowS
RegisterEcsCluster -> String
(Int -> RegisterEcsCluster -> ShowS)
-> (RegisterEcsCluster -> String)
-> ([RegisterEcsCluster] -> ShowS)
-> Show RegisterEcsCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterEcsCluster] -> ShowS
$cshowList :: [RegisterEcsCluster] -> ShowS
show :: RegisterEcsCluster -> String
$cshow :: RegisterEcsCluster -> String
showsPrec :: Int -> RegisterEcsCluster -> ShowS
$cshowsPrec :: Int -> RegisterEcsCluster -> ShowS
Prelude.Show, (forall x. RegisterEcsCluster -> Rep RegisterEcsCluster x)
-> (forall x. Rep RegisterEcsCluster x -> RegisterEcsCluster)
-> Generic RegisterEcsCluster
forall x. Rep RegisterEcsCluster x -> RegisterEcsCluster
forall x. RegisterEcsCluster -> Rep RegisterEcsCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterEcsCluster x -> RegisterEcsCluster
$cfrom :: forall x. RegisterEcsCluster -> Rep RegisterEcsCluster x
Prelude.Generic)
newRegisterEcsCluster ::
Prelude.Text ->
Prelude.Text ->
RegisterEcsCluster
newRegisterEcsCluster :: Text -> Text -> RegisterEcsCluster
newRegisterEcsCluster Text
pEcsClusterArn_ Text
pStackId_ =
RegisterEcsCluster' :: Text -> Text -> RegisterEcsCluster
RegisterEcsCluster'
{ $sel:ecsClusterArn:RegisterEcsCluster' :: Text
ecsClusterArn =
Text
pEcsClusterArn_,
$sel:stackId:RegisterEcsCluster' :: Text
stackId = Text
pStackId_
}
registerEcsCluster_ecsClusterArn :: Lens.Lens' RegisterEcsCluster Prelude.Text
registerEcsCluster_ecsClusterArn :: (Text -> f Text) -> RegisterEcsCluster -> f RegisterEcsCluster
registerEcsCluster_ecsClusterArn = (RegisterEcsCluster -> Text)
-> (RegisterEcsCluster -> Text -> RegisterEcsCluster)
-> Lens RegisterEcsCluster RegisterEcsCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterEcsCluster' {Text
ecsClusterArn :: Text
$sel:ecsClusterArn:RegisterEcsCluster' :: RegisterEcsCluster -> Text
ecsClusterArn} -> Text
ecsClusterArn) (\s :: RegisterEcsCluster
s@RegisterEcsCluster' {} Text
a -> RegisterEcsCluster
s {$sel:ecsClusterArn:RegisterEcsCluster' :: Text
ecsClusterArn = Text
a} :: RegisterEcsCluster)
registerEcsCluster_stackId :: Lens.Lens' RegisterEcsCluster Prelude.Text
registerEcsCluster_stackId :: (Text -> f Text) -> RegisterEcsCluster -> f RegisterEcsCluster
registerEcsCluster_stackId = (RegisterEcsCluster -> Text)
-> (RegisterEcsCluster -> Text -> RegisterEcsCluster)
-> Lens RegisterEcsCluster RegisterEcsCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterEcsCluster' {Text
stackId :: Text
$sel:stackId:RegisterEcsCluster' :: RegisterEcsCluster -> Text
stackId} -> Text
stackId) (\s :: RegisterEcsCluster
s@RegisterEcsCluster' {} Text
a -> RegisterEcsCluster
s {$sel:stackId:RegisterEcsCluster' :: Text
stackId = Text
a} :: RegisterEcsCluster)
instance Core.AWSRequest RegisterEcsCluster where
type
AWSResponse RegisterEcsCluster =
RegisterEcsClusterResponse
request :: RegisterEcsCluster -> Request RegisterEcsCluster
request = Service -> RegisterEcsCluster -> Request RegisterEcsCluster
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterEcsCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterEcsCluster)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegisterEcsCluster))
-> Logger
-> Service
-> Proxy RegisterEcsCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterEcsCluster)))
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 Text -> Int -> RegisterEcsClusterResponse
RegisterEcsClusterResponse'
(Maybe Text -> Int -> RegisterEcsClusterResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RegisterEcsClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EcsClusterArn")
Either String (Int -> RegisterEcsClusterResponse)
-> Either String Int -> Either String RegisterEcsClusterResponse
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 RegisterEcsCluster
instance Prelude.NFData RegisterEcsCluster
instance Core.ToHeaders RegisterEcsCluster where
toHeaders :: RegisterEcsCluster -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterEcsCluster -> 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
"OpsWorks_20130218.RegisterEcsCluster" ::
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 RegisterEcsCluster where
toJSON :: RegisterEcsCluster -> Value
toJSON RegisterEcsCluster' {Text
stackId :: Text
ecsClusterArn :: Text
$sel:stackId:RegisterEcsCluster' :: RegisterEcsCluster -> Text
$sel:ecsClusterArn:RegisterEcsCluster' :: RegisterEcsCluster -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"EcsClusterArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ecsClusterArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"StackId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
stackId)
]
)
instance Core.ToPath RegisterEcsCluster where
toPath :: RegisterEcsCluster -> ByteString
toPath = ByteString -> RegisterEcsCluster -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RegisterEcsCluster where
toQuery :: RegisterEcsCluster -> QueryString
toQuery = QueryString -> RegisterEcsCluster -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterEcsClusterResponse = RegisterEcsClusterResponse'
{
RegisterEcsClusterResponse -> Maybe Text
ecsClusterArn :: Prelude.Maybe Prelude.Text,
RegisterEcsClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterEcsClusterResponse -> RegisterEcsClusterResponse -> Bool
(RegisterEcsClusterResponse -> RegisterEcsClusterResponse -> Bool)
-> (RegisterEcsClusterResponse
-> RegisterEcsClusterResponse -> Bool)
-> Eq RegisterEcsClusterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterEcsClusterResponse -> RegisterEcsClusterResponse -> Bool
$c/= :: RegisterEcsClusterResponse -> RegisterEcsClusterResponse -> Bool
== :: RegisterEcsClusterResponse -> RegisterEcsClusterResponse -> Bool
$c== :: RegisterEcsClusterResponse -> RegisterEcsClusterResponse -> Bool
Prelude.Eq, ReadPrec [RegisterEcsClusterResponse]
ReadPrec RegisterEcsClusterResponse
Int -> ReadS RegisterEcsClusterResponse
ReadS [RegisterEcsClusterResponse]
(Int -> ReadS RegisterEcsClusterResponse)
-> ReadS [RegisterEcsClusterResponse]
-> ReadPrec RegisterEcsClusterResponse
-> ReadPrec [RegisterEcsClusterResponse]
-> Read RegisterEcsClusterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterEcsClusterResponse]
$creadListPrec :: ReadPrec [RegisterEcsClusterResponse]
readPrec :: ReadPrec RegisterEcsClusterResponse
$creadPrec :: ReadPrec RegisterEcsClusterResponse
readList :: ReadS [RegisterEcsClusterResponse]
$creadList :: ReadS [RegisterEcsClusterResponse]
readsPrec :: Int -> ReadS RegisterEcsClusterResponse
$creadsPrec :: Int -> ReadS RegisterEcsClusterResponse
Prelude.Read, Int -> RegisterEcsClusterResponse -> ShowS
[RegisterEcsClusterResponse] -> ShowS
RegisterEcsClusterResponse -> String
(Int -> RegisterEcsClusterResponse -> ShowS)
-> (RegisterEcsClusterResponse -> String)
-> ([RegisterEcsClusterResponse] -> ShowS)
-> Show RegisterEcsClusterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterEcsClusterResponse] -> ShowS
$cshowList :: [RegisterEcsClusterResponse] -> ShowS
show :: RegisterEcsClusterResponse -> String
$cshow :: RegisterEcsClusterResponse -> String
showsPrec :: Int -> RegisterEcsClusterResponse -> ShowS
$cshowsPrec :: Int -> RegisterEcsClusterResponse -> ShowS
Prelude.Show, (forall x.
RegisterEcsClusterResponse -> Rep RegisterEcsClusterResponse x)
-> (forall x.
Rep RegisterEcsClusterResponse x -> RegisterEcsClusterResponse)
-> Generic RegisterEcsClusterResponse
forall x.
Rep RegisterEcsClusterResponse x -> RegisterEcsClusterResponse
forall x.
RegisterEcsClusterResponse -> Rep RegisterEcsClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterEcsClusterResponse x -> RegisterEcsClusterResponse
$cfrom :: forall x.
RegisterEcsClusterResponse -> Rep RegisterEcsClusterResponse x
Prelude.Generic)
newRegisterEcsClusterResponse ::
Prelude.Int ->
RegisterEcsClusterResponse
newRegisterEcsClusterResponse :: Int -> RegisterEcsClusterResponse
newRegisterEcsClusterResponse Int
pHttpStatus_ =
RegisterEcsClusterResponse' :: Maybe Text -> Int -> RegisterEcsClusterResponse
RegisterEcsClusterResponse'
{ $sel:ecsClusterArn:RegisterEcsClusterResponse' :: Maybe Text
ecsClusterArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegisterEcsClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
registerEcsClusterResponse_ecsClusterArn :: Lens.Lens' RegisterEcsClusterResponse (Prelude.Maybe Prelude.Text)
registerEcsClusterResponse_ecsClusterArn :: (Maybe Text -> f (Maybe Text))
-> RegisterEcsClusterResponse -> f RegisterEcsClusterResponse
registerEcsClusterResponse_ecsClusterArn = (RegisterEcsClusterResponse -> Maybe Text)
-> (RegisterEcsClusterResponse
-> Maybe Text -> RegisterEcsClusterResponse)
-> Lens
RegisterEcsClusterResponse
RegisterEcsClusterResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterEcsClusterResponse' {Maybe Text
ecsClusterArn :: Maybe Text
$sel:ecsClusterArn:RegisterEcsClusterResponse' :: RegisterEcsClusterResponse -> Maybe Text
ecsClusterArn} -> Maybe Text
ecsClusterArn) (\s :: RegisterEcsClusterResponse
s@RegisterEcsClusterResponse' {} Maybe Text
a -> RegisterEcsClusterResponse
s {$sel:ecsClusterArn:RegisterEcsClusterResponse' :: Maybe Text
ecsClusterArn = Maybe Text
a} :: RegisterEcsClusterResponse)
registerEcsClusterResponse_httpStatus :: Lens.Lens' RegisterEcsClusterResponse Prelude.Int
registerEcsClusterResponse_httpStatus :: (Int -> f Int)
-> RegisterEcsClusterResponse -> f RegisterEcsClusterResponse
registerEcsClusterResponse_httpStatus = (RegisterEcsClusterResponse -> Int)
-> (RegisterEcsClusterResponse
-> Int -> RegisterEcsClusterResponse)
-> Lens
RegisterEcsClusterResponse RegisterEcsClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterEcsClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterEcsClusterResponse' :: RegisterEcsClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterEcsClusterResponse
s@RegisterEcsClusterResponse' {} Int
a -> RegisterEcsClusterResponse
s {$sel:httpStatus:RegisterEcsClusterResponse' :: Int
httpStatus = Int
a} :: RegisterEcsClusterResponse)
instance Prelude.NFData RegisterEcsClusterResponse