{-# 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.GetService
(
GetService (..),
newGetService,
getService_id,
GetServiceResponse (..),
newGetServiceResponse,
getServiceResponse_service,
getServiceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53AutoNaming.Types
data GetService = GetService'
{
GetService -> Text
id :: Prelude.Text
}
deriving (GetService -> GetService -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetService -> GetService -> Bool
$c/= :: GetService -> GetService -> Bool
== :: GetService -> GetService -> Bool
$c== :: GetService -> GetService -> Bool
Prelude.Eq, ReadPrec [GetService]
ReadPrec GetService
Int -> ReadS GetService
ReadS [GetService]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetService]
$creadListPrec :: ReadPrec [GetService]
readPrec :: ReadPrec GetService
$creadPrec :: ReadPrec GetService
readList :: ReadS [GetService]
$creadList :: ReadS [GetService]
readsPrec :: Int -> ReadS GetService
$creadsPrec :: Int -> ReadS GetService
Prelude.Read, Int -> GetService -> ShowS
[GetService] -> ShowS
GetService -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetService] -> ShowS
$cshowList :: [GetService] -> ShowS
show :: GetService -> String
$cshow :: GetService -> String
showsPrec :: Int -> GetService -> ShowS
$cshowsPrec :: Int -> GetService -> ShowS
Prelude.Show, forall x. Rep GetService x -> GetService
forall x. GetService -> Rep GetService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetService x -> GetService
$cfrom :: forall x. GetService -> Rep GetService x
Prelude.Generic)
newGetService ::
Prelude.Text ->
GetService
newGetService :: Text -> GetService
newGetService Text
pId_ = GetService' {$sel:id:GetService' :: Text
id = Text
pId_}
getService_id :: Lens.Lens' GetService Prelude.Text
getService_id :: Lens' GetService Text
getService_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetService' {Text
id :: Text
$sel:id:GetService' :: GetService -> Text
id} -> Text
id) (\s :: GetService
s@GetService' {} Text
a -> GetService
s {$sel:id:GetService' :: Text
id = Text
a} :: GetService)
instance Core.AWSRequest GetService where
type AWSResponse GetService = GetServiceResponse
request :: (Service -> Service) -> GetService -> Request GetService
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetService
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetService)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe ServiceInfo -> Int -> GetServiceResponse
GetServiceResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Service")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetService where
hashWithSalt :: Int -> GetService -> Int
hashWithSalt Int
_salt GetService' {Text
id :: Text
$sel:id:GetService' :: GetService -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
id
instance Prelude.NFData GetService where
rnf :: GetService -> ()
rnf GetService' {Text
id :: Text
$sel:id:GetService' :: GetService -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
id
instance Data.ToHeaders GetService where
toHeaders :: GetService -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Route53AutoNaming_v20170314.GetService" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetService where
toJSON :: GetService -> Value
toJSON GetService' {Text
id :: Text
$sel:id:GetService' :: GetService -> Text
..} =
[Pair] -> Value
Data.object
(forall a. [Maybe a] -> [a]
Prelude.catMaybes [forall a. a -> Maybe a
Prelude.Just (Key
"Id" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
id)])
instance Data.ToPath GetService where
toPath :: GetService -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetService where
toQuery :: GetService -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetServiceResponse = GetServiceResponse'
{
GetServiceResponse -> Maybe ServiceInfo
service :: Prelude.Maybe ServiceInfo,
GetServiceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetServiceResponse -> GetServiceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceResponse -> GetServiceResponse -> Bool
$c/= :: GetServiceResponse -> GetServiceResponse -> Bool
== :: GetServiceResponse -> GetServiceResponse -> Bool
$c== :: GetServiceResponse -> GetServiceResponse -> Bool
Prelude.Eq, ReadPrec [GetServiceResponse]
ReadPrec GetServiceResponse
Int -> ReadS GetServiceResponse
ReadS [GetServiceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServiceResponse]
$creadListPrec :: ReadPrec [GetServiceResponse]
readPrec :: ReadPrec GetServiceResponse
$creadPrec :: ReadPrec GetServiceResponse
readList :: ReadS [GetServiceResponse]
$creadList :: ReadS [GetServiceResponse]
readsPrec :: Int -> ReadS GetServiceResponse
$creadsPrec :: Int -> ReadS GetServiceResponse
Prelude.Read, Int -> GetServiceResponse -> ShowS
[GetServiceResponse] -> ShowS
GetServiceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceResponse] -> ShowS
$cshowList :: [GetServiceResponse] -> ShowS
show :: GetServiceResponse -> String
$cshow :: GetServiceResponse -> String
showsPrec :: Int -> GetServiceResponse -> ShowS
$cshowsPrec :: Int -> GetServiceResponse -> ShowS
Prelude.Show, forall x. Rep GetServiceResponse x -> GetServiceResponse
forall x. GetServiceResponse -> Rep GetServiceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetServiceResponse x -> GetServiceResponse
$cfrom :: forall x. GetServiceResponse -> Rep GetServiceResponse x
Prelude.Generic)
newGetServiceResponse ::
Prelude.Int ->
GetServiceResponse
newGetServiceResponse :: Int -> GetServiceResponse
newGetServiceResponse Int
pHttpStatus_ =
GetServiceResponse'
{ $sel:service:GetServiceResponse' :: Maybe ServiceInfo
service = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetServiceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getServiceResponse_service :: Lens.Lens' GetServiceResponse (Prelude.Maybe ServiceInfo)
getServiceResponse_service :: Lens' GetServiceResponse (Maybe ServiceInfo)
getServiceResponse_service = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceResponse' {Maybe ServiceInfo
service :: Maybe ServiceInfo
$sel:service:GetServiceResponse' :: GetServiceResponse -> Maybe ServiceInfo
service} -> Maybe ServiceInfo
service) (\s :: GetServiceResponse
s@GetServiceResponse' {} Maybe ServiceInfo
a -> GetServiceResponse
s {$sel:service:GetServiceResponse' :: Maybe ServiceInfo
service = Maybe ServiceInfo
a} :: GetServiceResponse)
getServiceResponse_httpStatus :: Lens.Lens' GetServiceResponse Prelude.Int
getServiceResponse_httpStatus :: Lens' GetServiceResponse Int
getServiceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetServiceResponse' :: GetServiceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetServiceResponse
s@GetServiceResponse' {} Int
a -> GetServiceResponse
s {$sel:httpStatus:GetServiceResponse' :: Int
httpStatus = Int
a} :: GetServiceResponse)
instance Prelude.NFData GetServiceResponse where
rnf :: GetServiceResponse -> ()
rnf GetServiceResponse' {Int
Maybe ServiceInfo
httpStatus :: Int
service :: Maybe ServiceInfo
$sel:httpStatus:GetServiceResponse' :: GetServiceResponse -> Int
$sel:service:GetServiceResponse' :: GetServiceResponse -> Maybe ServiceInfo
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe ServiceInfo
service
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus