{-# 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.Route53AutoNaming.GetOperation
(
GetOperation (..),
newGetOperation,
getOperation_operationId,
GetOperationResponse (..),
newGetOperationResponse,
getOperationResponse_operation,
getOperationResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53AutoNaming.Types
data GetOperation = GetOperation'
{
GetOperation -> Text
operationId :: Prelude.Text
}
deriving (GetOperation -> GetOperation -> Bool
(GetOperation -> GetOperation -> Bool)
-> (GetOperation -> GetOperation -> Bool) -> Eq GetOperation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOperation -> GetOperation -> Bool
$c/= :: GetOperation -> GetOperation -> Bool
== :: GetOperation -> GetOperation -> Bool
$c== :: GetOperation -> GetOperation -> Bool
Prelude.Eq, ReadPrec [GetOperation]
ReadPrec GetOperation
Int -> ReadS GetOperation
ReadS [GetOperation]
(Int -> ReadS GetOperation)
-> ReadS [GetOperation]
-> ReadPrec GetOperation
-> ReadPrec [GetOperation]
-> Read GetOperation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOperation]
$creadListPrec :: ReadPrec [GetOperation]
readPrec :: ReadPrec GetOperation
$creadPrec :: ReadPrec GetOperation
readList :: ReadS [GetOperation]
$creadList :: ReadS [GetOperation]
readsPrec :: Int -> ReadS GetOperation
$creadsPrec :: Int -> ReadS GetOperation
Prelude.Read, Int -> GetOperation -> ShowS
[GetOperation] -> ShowS
GetOperation -> String
(Int -> GetOperation -> ShowS)
-> (GetOperation -> String)
-> ([GetOperation] -> ShowS)
-> Show GetOperation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOperation] -> ShowS
$cshowList :: [GetOperation] -> ShowS
show :: GetOperation -> String
$cshow :: GetOperation -> String
showsPrec :: Int -> GetOperation -> ShowS
$cshowsPrec :: Int -> GetOperation -> ShowS
Prelude.Show, (forall x. GetOperation -> Rep GetOperation x)
-> (forall x. Rep GetOperation x -> GetOperation)
-> Generic GetOperation
forall x. Rep GetOperation x -> GetOperation
forall x. GetOperation -> Rep GetOperation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOperation x -> GetOperation
$cfrom :: forall x. GetOperation -> Rep GetOperation x
Prelude.Generic)
newGetOperation ::
Prelude.Text ->
GetOperation
newGetOperation :: Text -> GetOperation
newGetOperation Text
pOperationId_ =
GetOperation' :: Text -> GetOperation
GetOperation' {$sel:operationId:GetOperation' :: Text
operationId = Text
pOperationId_}
getOperation_operationId :: Lens.Lens' GetOperation Prelude.Text
getOperation_operationId :: (Text -> f Text) -> GetOperation -> f GetOperation
getOperation_operationId = (GetOperation -> Text)
-> (GetOperation -> Text -> GetOperation)
-> Lens GetOperation GetOperation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOperation' {Text
operationId :: Text
$sel:operationId:GetOperation' :: GetOperation -> Text
operationId} -> Text
operationId) (\s :: GetOperation
s@GetOperation' {} Text
a -> GetOperation
s {$sel:operationId:GetOperation' :: Text
operationId = Text
a} :: GetOperation)
instance Core.AWSRequest GetOperation where
type AWSResponse GetOperation = GetOperationResponse
request :: GetOperation -> Request GetOperation
request = Service -> GetOperation -> Request GetOperation
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetOperation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetOperation)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetOperation))
-> Logger
-> Service
-> Proxy GetOperation
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetOperation)))
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 Operation -> Int -> GetOperationResponse
GetOperationResponse'
(Maybe Operation -> Int -> GetOperationResponse)
-> Either String (Maybe Operation)
-> Either String (Int -> GetOperationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Operation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Operation")
Either String (Int -> GetOperationResponse)
-> Either String Int -> Either String GetOperationResponse
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 GetOperation
instance Prelude.NFData GetOperation
instance Core.ToHeaders GetOperation where
toHeaders :: GetOperation -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetOperation -> 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
"Route53AutoNaming_v20170314.GetOperation" ::
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 GetOperation where
toJSON :: GetOperation -> Value
toJSON GetOperation' {Text
operationId :: Text
$sel:operationId:GetOperation' :: GetOperation -> 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
"OperationId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
operationId)]
)
instance Core.ToPath GetOperation where
toPath :: GetOperation -> ByteString
toPath = ByteString -> GetOperation -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetOperation where
toQuery :: GetOperation -> QueryString
toQuery = QueryString -> GetOperation -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetOperationResponse = GetOperationResponse'
{
GetOperationResponse -> Maybe Operation
operation :: Prelude.Maybe Operation,
GetOperationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetOperationResponse -> GetOperationResponse -> Bool
(GetOperationResponse -> GetOperationResponse -> Bool)
-> (GetOperationResponse -> GetOperationResponse -> Bool)
-> Eq GetOperationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetOperationResponse -> GetOperationResponse -> Bool
$c/= :: GetOperationResponse -> GetOperationResponse -> Bool
== :: GetOperationResponse -> GetOperationResponse -> Bool
$c== :: GetOperationResponse -> GetOperationResponse -> Bool
Prelude.Eq, ReadPrec [GetOperationResponse]
ReadPrec GetOperationResponse
Int -> ReadS GetOperationResponse
ReadS [GetOperationResponse]
(Int -> ReadS GetOperationResponse)
-> ReadS [GetOperationResponse]
-> ReadPrec GetOperationResponse
-> ReadPrec [GetOperationResponse]
-> Read GetOperationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetOperationResponse]
$creadListPrec :: ReadPrec [GetOperationResponse]
readPrec :: ReadPrec GetOperationResponse
$creadPrec :: ReadPrec GetOperationResponse
readList :: ReadS [GetOperationResponse]
$creadList :: ReadS [GetOperationResponse]
readsPrec :: Int -> ReadS GetOperationResponse
$creadsPrec :: Int -> ReadS GetOperationResponse
Prelude.Read, Int -> GetOperationResponse -> ShowS
[GetOperationResponse] -> ShowS
GetOperationResponse -> String
(Int -> GetOperationResponse -> ShowS)
-> (GetOperationResponse -> String)
-> ([GetOperationResponse] -> ShowS)
-> Show GetOperationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetOperationResponse] -> ShowS
$cshowList :: [GetOperationResponse] -> ShowS
show :: GetOperationResponse -> String
$cshow :: GetOperationResponse -> String
showsPrec :: Int -> GetOperationResponse -> ShowS
$cshowsPrec :: Int -> GetOperationResponse -> ShowS
Prelude.Show, (forall x. GetOperationResponse -> Rep GetOperationResponse x)
-> (forall x. Rep GetOperationResponse x -> GetOperationResponse)
-> Generic GetOperationResponse
forall x. Rep GetOperationResponse x -> GetOperationResponse
forall x. GetOperationResponse -> Rep GetOperationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetOperationResponse x -> GetOperationResponse
$cfrom :: forall x. GetOperationResponse -> Rep GetOperationResponse x
Prelude.Generic)
newGetOperationResponse ::
Prelude.Int ->
GetOperationResponse
newGetOperationResponse :: Int -> GetOperationResponse
newGetOperationResponse Int
pHttpStatus_ =
GetOperationResponse' :: Maybe Operation -> Int -> GetOperationResponse
GetOperationResponse'
{ $sel:operation:GetOperationResponse' :: Maybe Operation
operation = Maybe Operation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetOperationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getOperationResponse_operation :: Lens.Lens' GetOperationResponse (Prelude.Maybe Operation)
getOperationResponse_operation :: (Maybe Operation -> f (Maybe Operation))
-> GetOperationResponse -> f GetOperationResponse
getOperationResponse_operation = (GetOperationResponse -> Maybe Operation)
-> (GetOperationResponse
-> Maybe Operation -> GetOperationResponse)
-> Lens
GetOperationResponse
GetOperationResponse
(Maybe Operation)
(Maybe Operation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOperationResponse' {Maybe Operation
operation :: Maybe Operation
$sel:operation:GetOperationResponse' :: GetOperationResponse -> Maybe Operation
operation} -> Maybe Operation
operation) (\s :: GetOperationResponse
s@GetOperationResponse' {} Maybe Operation
a -> GetOperationResponse
s {$sel:operation:GetOperationResponse' :: Maybe Operation
operation = Maybe Operation
a} :: GetOperationResponse)
getOperationResponse_httpStatus :: Lens.Lens' GetOperationResponse Prelude.Int
getOperationResponse_httpStatus :: (Int -> f Int) -> GetOperationResponse -> f GetOperationResponse
getOperationResponse_httpStatus = (GetOperationResponse -> Int)
-> (GetOperationResponse -> Int -> GetOperationResponse)
-> Lens GetOperationResponse GetOperationResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOperationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetOperationResponse' :: GetOperationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetOperationResponse
s@GetOperationResponse' {} Int
a -> GetOperationResponse
s {$sel:httpStatus:GetOperationResponse' :: Int
httpStatus = Int
a} :: GetOperationResponse)
instance Prelude.NFData GetOperationResponse