{-# 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.UpdateClusterVersion
(
UpdateClusterVersion (..),
newUpdateClusterVersion,
updateClusterVersion_clientRequestToken,
updateClusterVersion_name,
updateClusterVersion_version,
UpdateClusterVersionResponse (..),
newUpdateClusterVersionResponse,
updateClusterVersionResponse_update,
updateClusterVersionResponse_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 UpdateClusterVersion = UpdateClusterVersion'
{
UpdateClusterVersion -> Maybe Text
clientRequestToken :: Prelude.Maybe Prelude.Text,
UpdateClusterVersion -> Text
name :: Prelude.Text,
UpdateClusterVersion -> Text
version :: Prelude.Text
}
deriving (UpdateClusterVersion -> UpdateClusterVersion -> Bool
(UpdateClusterVersion -> UpdateClusterVersion -> Bool)
-> (UpdateClusterVersion -> UpdateClusterVersion -> Bool)
-> Eq UpdateClusterVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateClusterVersion -> UpdateClusterVersion -> Bool
$c/= :: UpdateClusterVersion -> UpdateClusterVersion -> Bool
== :: UpdateClusterVersion -> UpdateClusterVersion -> Bool
$c== :: UpdateClusterVersion -> UpdateClusterVersion -> Bool
Prelude.Eq, ReadPrec [UpdateClusterVersion]
ReadPrec UpdateClusterVersion
Int -> ReadS UpdateClusterVersion
ReadS [UpdateClusterVersion]
(Int -> ReadS UpdateClusterVersion)
-> ReadS [UpdateClusterVersion]
-> ReadPrec UpdateClusterVersion
-> ReadPrec [UpdateClusterVersion]
-> Read UpdateClusterVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateClusterVersion]
$creadListPrec :: ReadPrec [UpdateClusterVersion]
readPrec :: ReadPrec UpdateClusterVersion
$creadPrec :: ReadPrec UpdateClusterVersion
readList :: ReadS [UpdateClusterVersion]
$creadList :: ReadS [UpdateClusterVersion]
readsPrec :: Int -> ReadS UpdateClusterVersion
$creadsPrec :: Int -> ReadS UpdateClusterVersion
Prelude.Read, Int -> UpdateClusterVersion -> ShowS
[UpdateClusterVersion] -> ShowS
UpdateClusterVersion -> String
(Int -> UpdateClusterVersion -> ShowS)
-> (UpdateClusterVersion -> String)
-> ([UpdateClusterVersion] -> ShowS)
-> Show UpdateClusterVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateClusterVersion] -> ShowS
$cshowList :: [UpdateClusterVersion] -> ShowS
show :: UpdateClusterVersion -> String
$cshow :: UpdateClusterVersion -> String
showsPrec :: Int -> UpdateClusterVersion -> ShowS
$cshowsPrec :: Int -> UpdateClusterVersion -> ShowS
Prelude.Show, (forall x. UpdateClusterVersion -> Rep UpdateClusterVersion x)
-> (forall x. Rep UpdateClusterVersion x -> UpdateClusterVersion)
-> Generic UpdateClusterVersion
forall x. Rep UpdateClusterVersion x -> UpdateClusterVersion
forall x. UpdateClusterVersion -> Rep UpdateClusterVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateClusterVersion x -> UpdateClusterVersion
$cfrom :: forall x. UpdateClusterVersion -> Rep UpdateClusterVersion x
Prelude.Generic)
newUpdateClusterVersion ::
Prelude.Text ->
Prelude.Text ->
UpdateClusterVersion
newUpdateClusterVersion :: Text -> Text -> UpdateClusterVersion
newUpdateClusterVersion Text
pName_ Text
pVersion_ =
UpdateClusterVersion' :: Maybe Text -> Text -> Text -> UpdateClusterVersion
UpdateClusterVersion'
{ $sel:clientRequestToken:UpdateClusterVersion' :: Maybe Text
clientRequestToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateClusterVersion' :: Text
name = Text
pName_,
$sel:version:UpdateClusterVersion' :: Text
version = Text
pVersion_
}
updateClusterVersion_clientRequestToken :: Lens.Lens' UpdateClusterVersion (Prelude.Maybe Prelude.Text)
updateClusterVersion_clientRequestToken :: (Maybe Text -> f (Maybe Text))
-> UpdateClusterVersion -> f UpdateClusterVersion
updateClusterVersion_clientRequestToken = (UpdateClusterVersion -> Maybe Text)
-> (UpdateClusterVersion -> Maybe Text -> UpdateClusterVersion)
-> Lens
UpdateClusterVersion UpdateClusterVersion (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClusterVersion' {Maybe Text
clientRequestToken :: Maybe Text
$sel:clientRequestToken:UpdateClusterVersion' :: UpdateClusterVersion -> Maybe Text
clientRequestToken} -> Maybe Text
clientRequestToken) (\s :: UpdateClusterVersion
s@UpdateClusterVersion' {} Maybe Text
a -> UpdateClusterVersion
s {$sel:clientRequestToken:UpdateClusterVersion' :: Maybe Text
clientRequestToken = Maybe Text
a} :: UpdateClusterVersion)
updateClusterVersion_name :: Lens.Lens' UpdateClusterVersion Prelude.Text
updateClusterVersion_name :: (Text -> f Text) -> UpdateClusterVersion -> f UpdateClusterVersion
updateClusterVersion_name = (UpdateClusterVersion -> Text)
-> (UpdateClusterVersion -> Text -> UpdateClusterVersion)
-> Lens UpdateClusterVersion UpdateClusterVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClusterVersion' {Text
name :: Text
$sel:name:UpdateClusterVersion' :: UpdateClusterVersion -> Text
name} -> Text
name) (\s :: UpdateClusterVersion
s@UpdateClusterVersion' {} Text
a -> UpdateClusterVersion
s {$sel:name:UpdateClusterVersion' :: Text
name = Text
a} :: UpdateClusterVersion)
updateClusterVersion_version :: Lens.Lens' UpdateClusterVersion Prelude.Text
updateClusterVersion_version :: (Text -> f Text) -> UpdateClusterVersion -> f UpdateClusterVersion
updateClusterVersion_version = (UpdateClusterVersion -> Text)
-> (UpdateClusterVersion -> Text -> UpdateClusterVersion)
-> Lens UpdateClusterVersion UpdateClusterVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClusterVersion' {Text
version :: Text
$sel:version:UpdateClusterVersion' :: UpdateClusterVersion -> Text
version} -> Text
version) (\s :: UpdateClusterVersion
s@UpdateClusterVersion' {} Text
a -> UpdateClusterVersion
s {$sel:version:UpdateClusterVersion' :: Text
version = Text
a} :: UpdateClusterVersion)
instance Core.AWSRequest UpdateClusterVersion where
type
AWSResponse UpdateClusterVersion =
UpdateClusterVersionResponse
request :: UpdateClusterVersion -> Request UpdateClusterVersion
request = Service -> UpdateClusterVersion -> Request UpdateClusterVersion
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateClusterVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateClusterVersion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse UpdateClusterVersion))
-> Logger
-> Service
-> Proxy UpdateClusterVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateClusterVersion)))
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 Update -> Int -> UpdateClusterVersionResponse
UpdateClusterVersionResponse'
(Maybe Update -> Int -> UpdateClusterVersionResponse)
-> Either String (Maybe Update)
-> Either String (Int -> UpdateClusterVersionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Update)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"update")
Either String (Int -> UpdateClusterVersionResponse)
-> Either String Int -> Either String UpdateClusterVersionResponse
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 UpdateClusterVersion
instance Prelude.NFData UpdateClusterVersion
instance Core.ToHeaders UpdateClusterVersion where
toHeaders :: UpdateClusterVersion -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateClusterVersion -> 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 UpdateClusterVersion where
toJSON :: UpdateClusterVersion -> Value
toJSON UpdateClusterVersion' {Maybe Text
Text
version :: Text
name :: Text
clientRequestToken :: Maybe Text
$sel:version:UpdateClusterVersion' :: UpdateClusterVersion -> Text
$sel:name:UpdateClusterVersion' :: UpdateClusterVersion -> Text
$sel:clientRequestToken:UpdateClusterVersion' :: UpdateClusterVersion -> 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
"version" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
version)
]
)
instance Core.ToPath UpdateClusterVersion where
toPath :: UpdateClusterVersion -> ByteString
toPath UpdateClusterVersion' {Maybe Text
Text
version :: Text
name :: Text
clientRequestToken :: Maybe Text
$sel:version:UpdateClusterVersion' :: UpdateClusterVersion -> Text
$sel:name:UpdateClusterVersion' :: UpdateClusterVersion -> Text
$sel:clientRequestToken:UpdateClusterVersion' :: UpdateClusterVersion -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/clusters/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name, ByteString
"/updates"]
instance Core.ToQuery UpdateClusterVersion where
toQuery :: UpdateClusterVersion -> QueryString
toQuery = QueryString -> UpdateClusterVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateClusterVersionResponse = UpdateClusterVersionResponse'
{
UpdateClusterVersionResponse -> Maybe Update
update :: Prelude.Maybe Update,
UpdateClusterVersionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateClusterVersionResponse
-> UpdateClusterVersionResponse -> Bool
(UpdateClusterVersionResponse
-> UpdateClusterVersionResponse -> Bool)
-> (UpdateClusterVersionResponse
-> UpdateClusterVersionResponse -> Bool)
-> Eq UpdateClusterVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateClusterVersionResponse
-> UpdateClusterVersionResponse -> Bool
$c/= :: UpdateClusterVersionResponse
-> UpdateClusterVersionResponse -> Bool
== :: UpdateClusterVersionResponse
-> UpdateClusterVersionResponse -> Bool
$c== :: UpdateClusterVersionResponse
-> UpdateClusterVersionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateClusterVersionResponse]
ReadPrec UpdateClusterVersionResponse
Int -> ReadS UpdateClusterVersionResponse
ReadS [UpdateClusterVersionResponse]
(Int -> ReadS UpdateClusterVersionResponse)
-> ReadS [UpdateClusterVersionResponse]
-> ReadPrec UpdateClusterVersionResponse
-> ReadPrec [UpdateClusterVersionResponse]
-> Read UpdateClusterVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateClusterVersionResponse]
$creadListPrec :: ReadPrec [UpdateClusterVersionResponse]
readPrec :: ReadPrec UpdateClusterVersionResponse
$creadPrec :: ReadPrec UpdateClusterVersionResponse
readList :: ReadS [UpdateClusterVersionResponse]
$creadList :: ReadS [UpdateClusterVersionResponse]
readsPrec :: Int -> ReadS UpdateClusterVersionResponse
$creadsPrec :: Int -> ReadS UpdateClusterVersionResponse
Prelude.Read, Int -> UpdateClusterVersionResponse -> ShowS
[UpdateClusterVersionResponse] -> ShowS
UpdateClusterVersionResponse -> String
(Int -> UpdateClusterVersionResponse -> ShowS)
-> (UpdateClusterVersionResponse -> String)
-> ([UpdateClusterVersionResponse] -> ShowS)
-> Show UpdateClusterVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateClusterVersionResponse] -> ShowS
$cshowList :: [UpdateClusterVersionResponse] -> ShowS
show :: UpdateClusterVersionResponse -> String
$cshow :: UpdateClusterVersionResponse -> String
showsPrec :: Int -> UpdateClusterVersionResponse -> ShowS
$cshowsPrec :: Int -> UpdateClusterVersionResponse -> ShowS
Prelude.Show, (forall x.
UpdateClusterVersionResponse -> Rep UpdateClusterVersionResponse x)
-> (forall x.
Rep UpdateClusterVersionResponse x -> UpdateClusterVersionResponse)
-> Generic UpdateClusterVersionResponse
forall x.
Rep UpdateClusterVersionResponse x -> UpdateClusterVersionResponse
forall x.
UpdateClusterVersionResponse -> Rep UpdateClusterVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateClusterVersionResponse x -> UpdateClusterVersionResponse
$cfrom :: forall x.
UpdateClusterVersionResponse -> Rep UpdateClusterVersionResponse x
Prelude.Generic)
newUpdateClusterVersionResponse ::
Prelude.Int ->
UpdateClusterVersionResponse
newUpdateClusterVersionResponse :: Int -> UpdateClusterVersionResponse
newUpdateClusterVersionResponse Int
pHttpStatus_ =
UpdateClusterVersionResponse' :: Maybe Update -> Int -> UpdateClusterVersionResponse
UpdateClusterVersionResponse'
{ $sel:update:UpdateClusterVersionResponse' :: Maybe Update
update =
Maybe Update
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateClusterVersionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateClusterVersionResponse_update :: Lens.Lens' UpdateClusterVersionResponse (Prelude.Maybe Update)
updateClusterVersionResponse_update :: (Maybe Update -> f (Maybe Update))
-> UpdateClusterVersionResponse -> f UpdateClusterVersionResponse
updateClusterVersionResponse_update = (UpdateClusterVersionResponse -> Maybe Update)
-> (UpdateClusterVersionResponse
-> Maybe Update -> UpdateClusterVersionResponse)
-> Lens
UpdateClusterVersionResponse
UpdateClusterVersionResponse
(Maybe Update)
(Maybe Update)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClusterVersionResponse' {Maybe Update
update :: Maybe Update
$sel:update:UpdateClusterVersionResponse' :: UpdateClusterVersionResponse -> Maybe Update
update} -> Maybe Update
update) (\s :: UpdateClusterVersionResponse
s@UpdateClusterVersionResponse' {} Maybe Update
a -> UpdateClusterVersionResponse
s {$sel:update:UpdateClusterVersionResponse' :: Maybe Update
update = Maybe Update
a} :: UpdateClusterVersionResponse)
updateClusterVersionResponse_httpStatus :: Lens.Lens' UpdateClusterVersionResponse Prelude.Int
updateClusterVersionResponse_httpStatus :: (Int -> f Int)
-> UpdateClusterVersionResponse -> f UpdateClusterVersionResponse
updateClusterVersionResponse_httpStatus = (UpdateClusterVersionResponse -> Int)
-> (UpdateClusterVersionResponse
-> Int -> UpdateClusterVersionResponse)
-> Lens
UpdateClusterVersionResponse UpdateClusterVersionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateClusterVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateClusterVersionResponse' :: UpdateClusterVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateClusterVersionResponse
s@UpdateClusterVersionResponse' {} Int
a -> UpdateClusterVersionResponse
s {$sel:httpStatus:UpdateClusterVersionResponse' :: Int
httpStatus = Int
a} :: UpdateClusterVersionResponse)
instance Prelude.NFData UpdateClusterVersionResponse