{-# 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.EKS.RegisterCluster
(
RegisterCluster (..),
newRegisterCluster,
registerCluster_clientRequestToken,
registerCluster_name,
registerCluster_connectorConfig,
RegisterClusterResponse (..),
newRegisterClusterResponse,
registerClusterResponse_cluster,
registerClusterResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.EKS.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 RegisterCluster = RegisterCluster'
{
RegisterCluster -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
RegisterCluster -> Text
name :: Prelude.Text,
RegisterCluster -> ConnectorConfigRequest
connectorConfig :: ConnectorConfigRequest
}
deriving (RegisterCluster -> RegisterCluster -> Bool
(RegisterCluster -> RegisterCluster -> Bool)
-> (RegisterCluster -> RegisterCluster -> Bool)
-> Eq RegisterCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterCluster -> RegisterCluster -> Bool
$c/= :: RegisterCluster -> RegisterCluster -> Bool
== :: RegisterCluster -> RegisterCluster -> Bool
$c== :: RegisterCluster -> RegisterCluster -> Bool
Prelude.Eq, ReadPrec [RegisterCluster]
ReadPrec RegisterCluster
Int -> ReadS RegisterCluster
ReadS [RegisterCluster]
(Int -> ReadS RegisterCluster)
-> ReadS [RegisterCluster]
-> ReadPrec RegisterCluster
-> ReadPrec [RegisterCluster]
-> Read RegisterCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterCluster]
$creadListPrec :: ReadPrec [RegisterCluster]
readPrec :: ReadPrec RegisterCluster
$creadPrec :: ReadPrec RegisterCluster
readList :: ReadS [RegisterCluster]
$creadList :: ReadS [RegisterCluster]
readsPrec :: Int -> ReadS RegisterCluster
$creadsPrec :: Int -> ReadS RegisterCluster
Prelude.Read, Int -> RegisterCluster -> ShowS
[RegisterCluster] -> ShowS
RegisterCluster -> String
(Int -> RegisterCluster -> ShowS)
-> (RegisterCluster -> String)
-> ([RegisterCluster] -> ShowS)
-> Show RegisterCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterCluster] -> ShowS
$cshowList :: [RegisterCluster] -> ShowS
show :: RegisterCluster -> String
$cshow :: RegisterCluster -> String
showsPrec :: Int -> RegisterCluster -> ShowS
$cshowsPrec :: Int -> RegisterCluster -> ShowS
Prelude.Show, (forall x. RegisterCluster -> Rep RegisterCluster x)
-> (forall x. Rep RegisterCluster x -> RegisterCluster)
-> Generic RegisterCluster
forall x. Rep RegisterCluster x -> RegisterCluster
forall x. RegisterCluster -> Rep RegisterCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterCluster x -> RegisterCluster
$cfrom :: forall x. RegisterCluster -> Rep RegisterCluster x
Prelude.Generic)
newRegisterCluster ::
Prelude.Text ->
ConnectorConfigRequest ->
RegisterCluster
newRegisterCluster :: Text -> ConnectorConfigRequest -> RegisterCluster
newRegisterCluster Text
pName_ ConnectorConfigRequest
pConnectorConfig_ =
RegisterCluster' :: Maybe Text -> Text -> ConnectorConfigRequest -> RegisterCluster
RegisterCluster'
{ $sel:clientRequestToken:RegisterCluster' :: Maybe Text
clientRequestToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:RegisterCluster' :: Text
name = Text
pName_,
$sel:connectorConfig:RegisterCluster' :: ConnectorConfigRequest
connectorConfig = ConnectorConfigRequest
pConnectorConfig_
}
registerCluster_clientRequestToken :: Lens.Lens' RegisterCluster (Prelude.Maybe Prelude.Text)
registerCluster_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> RegisterCluster -> f RegisterCluster
registerCluster_clientRequestToken = (RegisterCluster -> Maybe Text)
-> (RegisterCluster -> Maybe Text -> RegisterCluster)
-> Lens RegisterCluster RegisterCluster (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCluster' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:RegisterCluster' :: RegisterCluster -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: RegisterCluster
s@RegisterCluster' {} Maybe Text
a -> RegisterCluster
s {$sel:clientRequestToken:RegisterCluster' :: Maybe Text
clientRequestToken = Maybe Text
a} :: RegisterCluster)
registerCluster_name :: Lens.Lens' RegisterCluster Prelude.Text
registerCluster_name :: (Text -> f Text) -> RegisterCluster -> f RegisterCluster
registerCluster_name = (RegisterCluster -> Text)
-> (RegisterCluster -> Text -> RegisterCluster)
-> Lens RegisterCluster RegisterCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCluster' {Text
name :: Text
$sel:name:RegisterCluster' :: RegisterCluster -> Text
name} -> Text
name) (\s :: RegisterCluster
s@RegisterCluster' {} Text
a -> RegisterCluster
s {$sel:name:RegisterCluster' :: Text
name = Text
a} :: RegisterCluster)
registerCluster_connectorConfig :: Lens.Lens' RegisterCluster ConnectorConfigRequest
registerCluster_connectorConfig :: (ConnectorConfigRequest -> f ConnectorConfigRequest)
-> RegisterCluster -> f RegisterCluster
registerCluster_connectorConfig = (RegisterCluster -> ConnectorConfigRequest)
-> (RegisterCluster -> ConnectorConfigRequest -> RegisterCluster)
-> Lens
RegisterCluster
RegisterCluster
ConnectorConfigRequest
ConnectorConfigRequest
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCluster' {ConnectorConfigRequest
connectorConfig :: ConnectorConfigRequest
$sel:connectorConfig:RegisterCluster' :: RegisterCluster -> ConnectorConfigRequest
connectorConfig} -> ConnectorConfigRequest
connectorConfig) (\s :: RegisterCluster
s@RegisterCluster' {} ConnectorConfigRequest
a -> RegisterCluster
s {$sel:connectorConfig:RegisterCluster' :: ConnectorConfigRequest
connectorConfig = ConnectorConfigRequest
a} :: RegisterCluster)
instance Core.AWSRequest RegisterCluster where
type
AWSResponse RegisterCluster =
RegisterClusterResponse
request :: RegisterCluster -> Request RegisterCluster
request = Service -> RegisterCluster -> Request RegisterCluster
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterCluster)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegisterCluster))
-> Logger
-> Service
-> Proxy RegisterCluster
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterCluster)))
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 Cluster -> Int -> RegisterClusterResponse
RegisterClusterResponse'
(Maybe Cluster -> Int -> RegisterClusterResponse)
-> Either String (Maybe Cluster)
-> Either String (Int -> RegisterClusterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Cluster)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"cluster")
Either String (Int -> RegisterClusterResponse)
-> Either String Int -> Either String RegisterClusterResponse
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 RegisterCluster
instance Prelude.NFData RegisterCluster
instance Core.ToHeaders RegisterCluster where
toHeaders :: RegisterCluster -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterCluster -> 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 RegisterCluster where
toJSON :: RegisterCluster -> Value
toJSON RegisterCluster' {Maybe Text
Text
ConnectorConfigRequest
connectorConfig :: ConnectorConfigRequest
name :: Text
clientRequestToken :: Maybe Text
$sel:connectorConfig:RegisterCluster' :: RegisterCluster -> ConnectorConfigRequest
$sel:name:RegisterCluster' :: RegisterCluster -> Text
$sel:clientRequestToken:RegisterCluster' :: RegisterCluster -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"clientRequestToken" 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
clientRequestToken,
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
"connectorConfig" Text -> ConnectorConfigRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ConnectorConfigRequest
connectorConfig)
]
)
instance Core.ToPath RegisterCluster where
toPath :: RegisterCluster -> ByteString
toPath = ByteString -> RegisterCluster -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/cluster-registrations"
instance Core.ToQuery RegisterCluster where
toQuery :: RegisterCluster -> QueryString
toQuery = QueryString -> RegisterCluster -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterClusterResponse = RegisterClusterResponse'
{ RegisterClusterResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
RegisterClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterClusterResponse -> RegisterClusterResponse -> Bool
(RegisterClusterResponse -> RegisterClusterResponse -> Bool)
-> (RegisterClusterResponse -> RegisterClusterResponse -> Bool)
-> Eq RegisterClusterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterClusterResponse -> RegisterClusterResponse -> Bool
$c/= :: RegisterClusterResponse -> RegisterClusterResponse -> Bool
== :: RegisterClusterResponse -> RegisterClusterResponse -> Bool
$c== :: RegisterClusterResponse -> RegisterClusterResponse -> Bool
Prelude.Eq, ReadPrec [RegisterClusterResponse]
ReadPrec RegisterClusterResponse
Int -> ReadS RegisterClusterResponse
ReadS [RegisterClusterResponse]
(Int -> ReadS RegisterClusterResponse)
-> ReadS [RegisterClusterResponse]
-> ReadPrec RegisterClusterResponse
-> ReadPrec [RegisterClusterResponse]
-> Read RegisterClusterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterClusterResponse]
$creadListPrec :: ReadPrec [RegisterClusterResponse]
readPrec :: ReadPrec RegisterClusterResponse
$creadPrec :: ReadPrec RegisterClusterResponse
readList :: ReadS [RegisterClusterResponse]
$creadList :: ReadS [RegisterClusterResponse]
readsPrec :: Int -> ReadS RegisterClusterResponse
$creadsPrec :: Int -> ReadS RegisterClusterResponse
Prelude.Read, Int -> RegisterClusterResponse -> ShowS
[RegisterClusterResponse] -> ShowS
RegisterClusterResponse -> String
(Int -> RegisterClusterResponse -> ShowS)
-> (RegisterClusterResponse -> String)
-> ([RegisterClusterResponse] -> ShowS)
-> Show RegisterClusterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterClusterResponse] -> ShowS
$cshowList :: [RegisterClusterResponse] -> ShowS
show :: RegisterClusterResponse -> String
$cshow :: RegisterClusterResponse -> String
showsPrec :: Int -> RegisterClusterResponse -> ShowS
$cshowsPrec :: Int -> RegisterClusterResponse -> ShowS
Prelude.Show, (forall x.
RegisterClusterResponse -> Rep RegisterClusterResponse x)
-> (forall x.
Rep RegisterClusterResponse x -> RegisterClusterResponse)
-> Generic RegisterClusterResponse
forall x. Rep RegisterClusterResponse x -> RegisterClusterResponse
forall x. RegisterClusterResponse -> Rep RegisterClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterClusterResponse x -> RegisterClusterResponse
$cfrom :: forall x. RegisterClusterResponse -> Rep RegisterClusterResponse x
Prelude.Generic)
newRegisterClusterResponse ::
Prelude.Int ->
RegisterClusterResponse
newRegisterClusterResponse :: Int -> RegisterClusterResponse
newRegisterClusterResponse Int
pHttpStatus_ =
RegisterClusterResponse' :: Maybe Cluster -> Int -> RegisterClusterResponse
RegisterClusterResponse'
{ $sel:cluster:RegisterClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegisterClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
registerClusterResponse_cluster :: Lens.Lens' RegisterClusterResponse (Prelude.Maybe Cluster)
registerClusterResponse_cluster :: (Maybe Cluster -> f (Maybe Cluster))
-> RegisterClusterResponse -> f RegisterClusterResponse
registerClusterResponse_cluster = (RegisterClusterResponse -> Maybe Cluster)
-> (RegisterClusterResponse
-> Maybe Cluster -> RegisterClusterResponse)
-> Lens
RegisterClusterResponse
RegisterClusterResponse
(Maybe Cluster)
(Maybe Cluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:RegisterClusterResponse' :: RegisterClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: RegisterClusterResponse
s@RegisterClusterResponse' {} Maybe Cluster
a -> RegisterClusterResponse
s {$sel:cluster:RegisterClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: RegisterClusterResponse)
registerClusterResponse_httpStatus :: Lens.Lens' RegisterClusterResponse Prelude.Int
registerClusterResponse_httpStatus :: (Int -> f Int)
-> RegisterClusterResponse -> f RegisterClusterResponse
registerClusterResponse_httpStatus = (RegisterClusterResponse -> Int)
-> (RegisterClusterResponse -> Int -> RegisterClusterResponse)
-> Lens RegisterClusterResponse RegisterClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterClusterResponse' :: RegisterClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterClusterResponse
s@RegisterClusterResponse' {} Int
a -> RegisterClusterResponse
s {$sel:httpStatus:RegisterClusterResponse' :: Int
httpStatus = Int
a} :: RegisterClusterResponse)
instance Prelude.NFData RegisterClusterResponse