{-# 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.OpenSearch.GetUpgradeStatus
(
GetUpgradeStatus (..),
newGetUpgradeStatus,
getUpgradeStatus_domainName,
GetUpgradeStatusResponse (..),
newGetUpgradeStatusResponse,
getUpgradeStatusResponse_stepStatus,
getUpgradeStatusResponse_upgradeName,
getUpgradeStatusResponse_upgradeStep,
getUpgradeStatusResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.OpenSearch.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetUpgradeStatus = GetUpgradeStatus'
{ GetUpgradeStatus -> Text
domainName :: Prelude.Text
}
deriving (GetUpgradeStatus -> GetUpgradeStatus -> Bool
(GetUpgradeStatus -> GetUpgradeStatus -> Bool)
-> (GetUpgradeStatus -> GetUpgradeStatus -> Bool)
-> Eq GetUpgradeStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUpgradeStatus -> GetUpgradeStatus -> Bool
$c/= :: GetUpgradeStatus -> GetUpgradeStatus -> Bool
== :: GetUpgradeStatus -> GetUpgradeStatus -> Bool
$c== :: GetUpgradeStatus -> GetUpgradeStatus -> Bool
Prelude.Eq, ReadPrec [GetUpgradeStatus]
ReadPrec GetUpgradeStatus
Int -> ReadS GetUpgradeStatus
ReadS [GetUpgradeStatus]
(Int -> ReadS GetUpgradeStatus)
-> ReadS [GetUpgradeStatus]
-> ReadPrec GetUpgradeStatus
-> ReadPrec [GetUpgradeStatus]
-> Read GetUpgradeStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUpgradeStatus]
$creadListPrec :: ReadPrec [GetUpgradeStatus]
readPrec :: ReadPrec GetUpgradeStatus
$creadPrec :: ReadPrec GetUpgradeStatus
readList :: ReadS [GetUpgradeStatus]
$creadList :: ReadS [GetUpgradeStatus]
readsPrec :: Int -> ReadS GetUpgradeStatus
$creadsPrec :: Int -> ReadS GetUpgradeStatus
Prelude.Read, Int -> GetUpgradeStatus -> ShowS
[GetUpgradeStatus] -> ShowS
GetUpgradeStatus -> String
(Int -> GetUpgradeStatus -> ShowS)
-> (GetUpgradeStatus -> String)
-> ([GetUpgradeStatus] -> ShowS)
-> Show GetUpgradeStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUpgradeStatus] -> ShowS
$cshowList :: [GetUpgradeStatus] -> ShowS
show :: GetUpgradeStatus -> String
$cshow :: GetUpgradeStatus -> String
showsPrec :: Int -> GetUpgradeStatus -> ShowS
$cshowsPrec :: Int -> GetUpgradeStatus -> ShowS
Prelude.Show, (forall x. GetUpgradeStatus -> Rep GetUpgradeStatus x)
-> (forall x. Rep GetUpgradeStatus x -> GetUpgradeStatus)
-> Generic GetUpgradeStatus
forall x. Rep GetUpgradeStatus x -> GetUpgradeStatus
forall x. GetUpgradeStatus -> Rep GetUpgradeStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUpgradeStatus x -> GetUpgradeStatus
$cfrom :: forall x. GetUpgradeStatus -> Rep GetUpgradeStatus x
Prelude.Generic)
newGetUpgradeStatus ::
Prelude.Text ->
GetUpgradeStatus
newGetUpgradeStatus :: Text -> GetUpgradeStatus
newGetUpgradeStatus Text
pDomainName_ =
GetUpgradeStatus' :: Text -> GetUpgradeStatus
GetUpgradeStatus' {$sel:domainName:GetUpgradeStatus' :: Text
domainName = Text
pDomainName_}
getUpgradeStatus_domainName :: Lens.Lens' GetUpgradeStatus Prelude.Text
getUpgradeStatus_domainName :: (Text -> f Text) -> GetUpgradeStatus -> f GetUpgradeStatus
getUpgradeStatus_domainName = (GetUpgradeStatus -> Text)
-> (GetUpgradeStatus -> Text -> GetUpgradeStatus)
-> Lens GetUpgradeStatus GetUpgradeStatus Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUpgradeStatus' {Text
domainName :: Text
$sel:domainName:GetUpgradeStatus' :: GetUpgradeStatus -> Text
domainName} -> Text
domainName) (\s :: GetUpgradeStatus
s@GetUpgradeStatus' {} Text
a -> GetUpgradeStatus
s {$sel:domainName:GetUpgradeStatus' :: Text
domainName = Text
a} :: GetUpgradeStatus)
instance Core.AWSRequest GetUpgradeStatus where
type
AWSResponse GetUpgradeStatus =
GetUpgradeStatusResponse
request :: GetUpgradeStatus -> Request GetUpgradeStatus
request = Service -> GetUpgradeStatus -> Request GetUpgradeStatus
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetUpgradeStatus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUpgradeStatus)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetUpgradeStatus))
-> Logger
-> Service
-> Proxy GetUpgradeStatus
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetUpgradeStatus)))
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 UpgradeStatus
-> Maybe Text
-> Maybe UpgradeStep
-> Int
-> GetUpgradeStatusResponse
GetUpgradeStatusResponse'
(Maybe UpgradeStatus
-> Maybe Text
-> Maybe UpgradeStep
-> Int
-> GetUpgradeStatusResponse)
-> Either String (Maybe UpgradeStatus)
-> Either
String
(Maybe Text
-> Maybe UpgradeStep -> Int -> GetUpgradeStatusResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe UpgradeStatus)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"StepStatus")
Either
String
(Maybe Text
-> Maybe UpgradeStep -> Int -> GetUpgradeStatusResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe UpgradeStep -> Int -> GetUpgradeStatusResponse)
forall (f :: * -> *) a b. Applicative f => 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
"UpgradeName")
Either
String (Maybe UpgradeStep -> Int -> GetUpgradeStatusResponse)
-> Either String (Maybe UpgradeStep)
-> Either String (Int -> GetUpgradeStatusResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe UpgradeStep)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"UpgradeStep")
Either String (Int -> GetUpgradeStatusResponse)
-> Either String Int -> Either String GetUpgradeStatusResponse
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 GetUpgradeStatus
instance Prelude.NFData GetUpgradeStatus
instance Core.ToHeaders GetUpgradeStatus where
toHeaders :: GetUpgradeStatus -> ResponseHeaders
toHeaders = ResponseHeaders -> GetUpgradeStatus -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath GetUpgradeStatus where
toPath :: GetUpgradeStatus -> ByteString
toPath GetUpgradeStatus' {Text
domainName :: Text
$sel:domainName:GetUpgradeStatus' :: GetUpgradeStatus -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/2021-01-01/opensearch/upgradeDomain/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
domainName,
ByteString
"/status"
]
instance Core.ToQuery GetUpgradeStatus where
toQuery :: GetUpgradeStatus -> QueryString
toQuery = QueryString -> GetUpgradeStatus -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetUpgradeStatusResponse = GetUpgradeStatusResponse'
{
GetUpgradeStatusResponse -> Maybe UpgradeStatus
stepStatus :: Prelude.Maybe UpgradeStatus,
GetUpgradeStatusResponse -> Maybe Text
upgradeName :: Prelude.Maybe Prelude.Text,
GetUpgradeStatusResponse -> Maybe UpgradeStep
upgradeStep :: Prelude.Maybe UpgradeStep,
GetUpgradeStatusResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetUpgradeStatusResponse -> GetUpgradeStatusResponse -> Bool
(GetUpgradeStatusResponse -> GetUpgradeStatusResponse -> Bool)
-> (GetUpgradeStatusResponse -> GetUpgradeStatusResponse -> Bool)
-> Eq GetUpgradeStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUpgradeStatusResponse -> GetUpgradeStatusResponse -> Bool
$c/= :: GetUpgradeStatusResponse -> GetUpgradeStatusResponse -> Bool
== :: GetUpgradeStatusResponse -> GetUpgradeStatusResponse -> Bool
$c== :: GetUpgradeStatusResponse -> GetUpgradeStatusResponse -> Bool
Prelude.Eq, ReadPrec [GetUpgradeStatusResponse]
ReadPrec GetUpgradeStatusResponse
Int -> ReadS GetUpgradeStatusResponse
ReadS [GetUpgradeStatusResponse]
(Int -> ReadS GetUpgradeStatusResponse)
-> ReadS [GetUpgradeStatusResponse]
-> ReadPrec GetUpgradeStatusResponse
-> ReadPrec [GetUpgradeStatusResponse]
-> Read GetUpgradeStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUpgradeStatusResponse]
$creadListPrec :: ReadPrec [GetUpgradeStatusResponse]
readPrec :: ReadPrec GetUpgradeStatusResponse
$creadPrec :: ReadPrec GetUpgradeStatusResponse
readList :: ReadS [GetUpgradeStatusResponse]
$creadList :: ReadS [GetUpgradeStatusResponse]
readsPrec :: Int -> ReadS GetUpgradeStatusResponse
$creadsPrec :: Int -> ReadS GetUpgradeStatusResponse
Prelude.Read, Int -> GetUpgradeStatusResponse -> ShowS
[GetUpgradeStatusResponse] -> ShowS
GetUpgradeStatusResponse -> String
(Int -> GetUpgradeStatusResponse -> ShowS)
-> (GetUpgradeStatusResponse -> String)
-> ([GetUpgradeStatusResponse] -> ShowS)
-> Show GetUpgradeStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUpgradeStatusResponse] -> ShowS
$cshowList :: [GetUpgradeStatusResponse] -> ShowS
show :: GetUpgradeStatusResponse -> String
$cshow :: GetUpgradeStatusResponse -> String
showsPrec :: Int -> GetUpgradeStatusResponse -> ShowS
$cshowsPrec :: Int -> GetUpgradeStatusResponse -> ShowS
Prelude.Show, (forall x.
GetUpgradeStatusResponse -> Rep GetUpgradeStatusResponse x)
-> (forall x.
Rep GetUpgradeStatusResponse x -> GetUpgradeStatusResponse)
-> Generic GetUpgradeStatusResponse
forall x.
Rep GetUpgradeStatusResponse x -> GetUpgradeStatusResponse
forall x.
GetUpgradeStatusResponse -> Rep GetUpgradeStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetUpgradeStatusResponse x -> GetUpgradeStatusResponse
$cfrom :: forall x.
GetUpgradeStatusResponse -> Rep GetUpgradeStatusResponse x
Prelude.Generic)
newGetUpgradeStatusResponse ::
Prelude.Int ->
GetUpgradeStatusResponse
newGetUpgradeStatusResponse :: Int -> GetUpgradeStatusResponse
newGetUpgradeStatusResponse Int
pHttpStatus_ =
GetUpgradeStatusResponse' :: Maybe UpgradeStatus
-> Maybe Text
-> Maybe UpgradeStep
-> Int
-> GetUpgradeStatusResponse
GetUpgradeStatusResponse'
{ $sel:stepStatus:GetUpgradeStatusResponse' :: Maybe UpgradeStatus
stepStatus =
Maybe UpgradeStatus
forall a. Maybe a
Prelude.Nothing,
$sel:upgradeName:GetUpgradeStatusResponse' :: Maybe Text
upgradeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:upgradeStep:GetUpgradeStatusResponse' :: Maybe UpgradeStep
upgradeStep = Maybe UpgradeStep
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetUpgradeStatusResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getUpgradeStatusResponse_stepStatus :: Lens.Lens' GetUpgradeStatusResponse (Prelude.Maybe UpgradeStatus)
getUpgradeStatusResponse_stepStatus :: (Maybe UpgradeStatus -> f (Maybe UpgradeStatus))
-> GetUpgradeStatusResponse -> f GetUpgradeStatusResponse
getUpgradeStatusResponse_stepStatus = (GetUpgradeStatusResponse -> Maybe UpgradeStatus)
-> (GetUpgradeStatusResponse
-> Maybe UpgradeStatus -> GetUpgradeStatusResponse)
-> Lens
GetUpgradeStatusResponse
GetUpgradeStatusResponse
(Maybe UpgradeStatus)
(Maybe UpgradeStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUpgradeStatusResponse' {Maybe UpgradeStatus
stepStatus :: Maybe UpgradeStatus
$sel:stepStatus:GetUpgradeStatusResponse' :: GetUpgradeStatusResponse -> Maybe UpgradeStatus
stepStatus} -> Maybe UpgradeStatus
stepStatus) (\s :: GetUpgradeStatusResponse
s@GetUpgradeStatusResponse' {} Maybe UpgradeStatus
a -> GetUpgradeStatusResponse
s {$sel:stepStatus:GetUpgradeStatusResponse' :: Maybe UpgradeStatus
stepStatus = Maybe UpgradeStatus
a} :: GetUpgradeStatusResponse)
getUpgradeStatusResponse_upgradeName :: Lens.Lens' GetUpgradeStatusResponse (Prelude.Maybe Prelude.Text)
getUpgradeStatusResponse_upgradeName :: (Maybe Text -> f (Maybe Text))
-> GetUpgradeStatusResponse -> f GetUpgradeStatusResponse
getUpgradeStatusResponse_upgradeName = (GetUpgradeStatusResponse -> Maybe Text)
-> (GetUpgradeStatusResponse
-> Maybe Text -> GetUpgradeStatusResponse)
-> Lens
GetUpgradeStatusResponse
GetUpgradeStatusResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUpgradeStatusResponse' {Maybe Text
upgradeName :: Maybe Text
$sel:upgradeName:GetUpgradeStatusResponse' :: GetUpgradeStatusResponse -> Maybe Text
upgradeName} -> Maybe Text
upgradeName) (\s :: GetUpgradeStatusResponse
s@GetUpgradeStatusResponse' {} Maybe Text
a -> GetUpgradeStatusResponse
s {$sel:upgradeName:GetUpgradeStatusResponse' :: Maybe Text
upgradeName = Maybe Text
a} :: GetUpgradeStatusResponse)
getUpgradeStatusResponse_upgradeStep :: Lens.Lens' GetUpgradeStatusResponse (Prelude.Maybe UpgradeStep)
getUpgradeStatusResponse_upgradeStep :: (Maybe UpgradeStep -> f (Maybe UpgradeStep))
-> GetUpgradeStatusResponse -> f GetUpgradeStatusResponse
getUpgradeStatusResponse_upgradeStep = (GetUpgradeStatusResponse -> Maybe UpgradeStep)
-> (GetUpgradeStatusResponse
-> Maybe UpgradeStep -> GetUpgradeStatusResponse)
-> Lens
GetUpgradeStatusResponse
GetUpgradeStatusResponse
(Maybe UpgradeStep)
(Maybe UpgradeStep)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUpgradeStatusResponse' {Maybe UpgradeStep
upgradeStep :: Maybe UpgradeStep
$sel:upgradeStep:GetUpgradeStatusResponse' :: GetUpgradeStatusResponse -> Maybe UpgradeStep
upgradeStep} -> Maybe UpgradeStep
upgradeStep) (\s :: GetUpgradeStatusResponse
s@GetUpgradeStatusResponse' {} Maybe UpgradeStep
a -> GetUpgradeStatusResponse
s {$sel:upgradeStep:GetUpgradeStatusResponse' :: Maybe UpgradeStep
upgradeStep = Maybe UpgradeStep
a} :: GetUpgradeStatusResponse)
getUpgradeStatusResponse_httpStatus :: Lens.Lens' GetUpgradeStatusResponse Prelude.Int
getUpgradeStatusResponse_httpStatus :: (Int -> f Int)
-> GetUpgradeStatusResponse -> f GetUpgradeStatusResponse
getUpgradeStatusResponse_httpStatus = (GetUpgradeStatusResponse -> Int)
-> (GetUpgradeStatusResponse -> Int -> GetUpgradeStatusResponse)
-> Lens GetUpgradeStatusResponse GetUpgradeStatusResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUpgradeStatusResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetUpgradeStatusResponse' :: GetUpgradeStatusResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetUpgradeStatusResponse
s@GetUpgradeStatusResponse' {} Int
a -> GetUpgradeStatusResponse
s {$sel:httpStatus:GetUpgradeStatusResponse' :: Int
httpStatus = Int
a} :: GetUpgradeStatusResponse)
instance Prelude.NFData GetUpgradeStatusResponse