{-# 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.DeregisterCluster
(
DeregisterCluster (..),
newDeregisterCluster,
deregisterCluster_name,
DeregisterClusterResponse (..),
newDeregisterClusterResponse,
deregisterClusterResponse_cluster,
deregisterClusterResponse_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 DeregisterCluster = DeregisterCluster'
{
DeregisterCluster -> Text
name :: Prelude.Text
}
deriving (DeregisterCluster -> DeregisterCluster -> Bool
(DeregisterCluster -> DeregisterCluster -> Bool)
-> (DeregisterCluster -> DeregisterCluster -> Bool)
-> Eq DeregisterCluster
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterCluster -> DeregisterCluster -> Bool
$c/= :: DeregisterCluster -> DeregisterCluster -> Bool
== :: DeregisterCluster -> DeregisterCluster -> Bool
$c== :: DeregisterCluster -> DeregisterCluster -> Bool
Prelude.Eq, ReadPrec [DeregisterCluster]
ReadPrec DeregisterCluster
Int -> ReadS DeregisterCluster
ReadS [DeregisterCluster]
(Int -> ReadS DeregisterCluster)
-> ReadS [DeregisterCluster]
-> ReadPrec DeregisterCluster
-> ReadPrec [DeregisterCluster]
-> Read DeregisterCluster
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterCluster]
$creadListPrec :: ReadPrec [DeregisterCluster]
readPrec :: ReadPrec DeregisterCluster
$creadPrec :: ReadPrec DeregisterCluster
readList :: ReadS [DeregisterCluster]
$creadList :: ReadS [DeregisterCluster]
readsPrec :: Int -> ReadS DeregisterCluster
$creadsPrec :: Int -> ReadS DeregisterCluster
Prelude.Read, Int -> DeregisterCluster -> ShowS
[DeregisterCluster] -> ShowS
DeregisterCluster -> String
(Int -> DeregisterCluster -> ShowS)
-> (DeregisterCluster -> String)
-> ([DeregisterCluster] -> ShowS)
-> Show DeregisterCluster
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterCluster] -> ShowS
$cshowList :: [DeregisterCluster] -> ShowS
show :: DeregisterCluster -> String
$cshow :: DeregisterCluster -> String
showsPrec :: Int -> DeregisterCluster -> ShowS
$cshowsPrec :: Int -> DeregisterCluster -> ShowS
Prelude.Show, (forall x. DeregisterCluster -> Rep DeregisterCluster x)
-> (forall x. Rep DeregisterCluster x -> DeregisterCluster)
-> Generic DeregisterCluster
forall x. Rep DeregisterCluster x -> DeregisterCluster
forall x. DeregisterCluster -> Rep DeregisterCluster x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeregisterCluster x -> DeregisterCluster
$cfrom :: forall x. DeregisterCluster -> Rep DeregisterCluster x
Prelude.Generic)
newDeregisterCluster ::
Prelude.Text ->
DeregisterCluster
newDeregisterCluster :: Text -> DeregisterCluster
newDeregisterCluster Text
pName_ =
DeregisterCluster' :: Text -> DeregisterCluster
DeregisterCluster' {$sel:name:DeregisterCluster' :: Text
name = Text
pName_}
deregisterCluster_name :: Lens.Lens' DeregisterCluster Prelude.Text
deregisterCluster_name :: (Text -> f Text) -> DeregisterCluster -> f DeregisterCluster
deregisterCluster_name = (DeregisterCluster -> Text)
-> (DeregisterCluster -> Text -> DeregisterCluster)
-> Lens DeregisterCluster DeregisterCluster Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterCluster' {Text
name :: Text
$sel:name:DeregisterCluster' :: DeregisterCluster -> Text
name} -> Text
name) (\s :: DeregisterCluster
s@DeregisterCluster' {} Text
a -> DeregisterCluster
s {$sel:name:DeregisterCluster' :: Text
name = Text
a} :: DeregisterCluster)
instance Core.AWSRequest DeregisterCluster where
type
AWSResponse DeregisterCluster =
DeregisterClusterResponse
request :: DeregisterCluster -> Request DeregisterCluster
request = Service -> DeregisterCluster -> Request DeregisterCluster
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
response :: Logger
-> Service
-> Proxy DeregisterCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeregisterCluster)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeregisterCluster))
-> Logger
-> Service
-> Proxy DeregisterCluster
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DeregisterCluster)))
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 -> DeregisterClusterResponse
DeregisterClusterResponse'
(Maybe Cluster -> Int -> DeregisterClusterResponse)
-> Either String (Maybe Cluster)
-> Either String (Int -> DeregisterClusterResponse)
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 -> DeregisterClusterResponse)
-> Either String Int -> Either String DeregisterClusterResponse
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 DeregisterCluster
instance Prelude.NFData DeregisterCluster
instance Core.ToHeaders DeregisterCluster where
toHeaders :: DeregisterCluster -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeregisterCluster -> 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.ToPath DeregisterCluster where
toPath :: DeregisterCluster -> ByteString
toPath DeregisterCluster' {Text
name :: Text
$sel:name:DeregisterCluster' :: DeregisterCluster -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/cluster-registrations/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name]
instance Core.ToQuery DeregisterCluster where
toQuery :: DeregisterCluster -> QueryString
toQuery = QueryString -> DeregisterCluster -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeregisterClusterResponse = DeregisterClusterResponse'
{ DeregisterClusterResponse -> Maybe Cluster
cluster :: Prelude.Maybe Cluster,
DeregisterClusterResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeregisterClusterResponse -> DeregisterClusterResponse -> Bool
(DeregisterClusterResponse -> DeregisterClusterResponse -> Bool)
-> (DeregisterClusterResponse -> DeregisterClusterResponse -> Bool)
-> Eq DeregisterClusterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterClusterResponse -> DeregisterClusterResponse -> Bool
$c/= :: DeregisterClusterResponse -> DeregisterClusterResponse -> Bool
== :: DeregisterClusterResponse -> DeregisterClusterResponse -> Bool
$c== :: DeregisterClusterResponse -> DeregisterClusterResponse -> Bool
Prelude.Eq, ReadPrec [DeregisterClusterResponse]
ReadPrec DeregisterClusterResponse
Int -> ReadS DeregisterClusterResponse
ReadS [DeregisterClusterResponse]
(Int -> ReadS DeregisterClusterResponse)
-> ReadS [DeregisterClusterResponse]
-> ReadPrec DeregisterClusterResponse
-> ReadPrec [DeregisterClusterResponse]
-> Read DeregisterClusterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterClusterResponse]
$creadListPrec :: ReadPrec [DeregisterClusterResponse]
readPrec :: ReadPrec DeregisterClusterResponse
$creadPrec :: ReadPrec DeregisterClusterResponse
readList :: ReadS [DeregisterClusterResponse]
$creadList :: ReadS [DeregisterClusterResponse]
readsPrec :: Int -> ReadS DeregisterClusterResponse
$creadsPrec :: Int -> ReadS DeregisterClusterResponse
Prelude.Read, Int -> DeregisterClusterResponse -> ShowS
[DeregisterClusterResponse] -> ShowS
DeregisterClusterResponse -> String
(Int -> DeregisterClusterResponse -> ShowS)
-> (DeregisterClusterResponse -> String)
-> ([DeregisterClusterResponse] -> ShowS)
-> Show DeregisterClusterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterClusterResponse] -> ShowS
$cshowList :: [DeregisterClusterResponse] -> ShowS
show :: DeregisterClusterResponse -> String
$cshow :: DeregisterClusterResponse -> String
showsPrec :: Int -> DeregisterClusterResponse -> ShowS
$cshowsPrec :: Int -> DeregisterClusterResponse -> ShowS
Prelude.Show, (forall x.
DeregisterClusterResponse -> Rep DeregisterClusterResponse x)
-> (forall x.
Rep DeregisterClusterResponse x -> DeregisterClusterResponse)
-> Generic DeregisterClusterResponse
forall x.
Rep DeregisterClusterResponse x -> DeregisterClusterResponse
forall x.
DeregisterClusterResponse -> Rep DeregisterClusterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeregisterClusterResponse x -> DeregisterClusterResponse
$cfrom :: forall x.
DeregisterClusterResponse -> Rep DeregisterClusterResponse x
Prelude.Generic)
newDeregisterClusterResponse ::
Prelude.Int ->
DeregisterClusterResponse
newDeregisterClusterResponse :: Int -> DeregisterClusterResponse
newDeregisterClusterResponse Int
pHttpStatus_ =
DeregisterClusterResponse' :: Maybe Cluster -> Int -> DeregisterClusterResponse
DeregisterClusterResponse'
{ $sel:cluster:DeregisterClusterResponse' :: Maybe Cluster
cluster =
Maybe Cluster
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeregisterClusterResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deregisterClusterResponse_cluster :: Lens.Lens' DeregisterClusterResponse (Prelude.Maybe Cluster)
deregisterClusterResponse_cluster :: (Maybe Cluster -> f (Maybe Cluster))
-> DeregisterClusterResponse -> f DeregisterClusterResponse
deregisterClusterResponse_cluster = (DeregisterClusterResponse -> Maybe Cluster)
-> (DeregisterClusterResponse
-> Maybe Cluster -> DeregisterClusterResponse)
-> Lens
DeregisterClusterResponse
DeregisterClusterResponse
(Maybe Cluster)
(Maybe Cluster)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterClusterResponse' {Maybe Cluster
cluster :: Maybe Cluster
$sel:cluster:DeregisterClusterResponse' :: DeregisterClusterResponse -> Maybe Cluster
cluster} -> Maybe Cluster
cluster) (\s :: DeregisterClusterResponse
s@DeregisterClusterResponse' {} Maybe Cluster
a -> DeregisterClusterResponse
s {$sel:cluster:DeregisterClusterResponse' :: Maybe Cluster
cluster = Maybe Cluster
a} :: DeregisterClusterResponse)
deregisterClusterResponse_httpStatus :: Lens.Lens' DeregisterClusterResponse Prelude.Int
deregisterClusterResponse_httpStatus :: (Int -> f Int)
-> DeregisterClusterResponse -> f DeregisterClusterResponse
deregisterClusterResponse_httpStatus = (DeregisterClusterResponse -> Int)
-> (DeregisterClusterResponse -> Int -> DeregisterClusterResponse)
-> Lens DeregisterClusterResponse DeregisterClusterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterClusterResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeregisterClusterResponse' :: DeregisterClusterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeregisterClusterResponse
s@DeregisterClusterResponse' {} Int
a -> DeregisterClusterResponse
s {$sel:httpStatus:DeregisterClusterResponse' :: Int
httpStatus = Int
a} :: DeregisterClusterResponse)
instance Prelude.NFData DeregisterClusterResponse