{-# 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.Proton.GetService
(
GetService (..),
newGetService,
getService_name,
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 Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetService = GetService'
{
GetService -> Text
name :: 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
pName_ = GetService' {$sel:name:GetService' :: Text
name = Text
pName_}
getService_name :: Lens.Lens' GetService Prelude.Text
getService_name :: Lens' GetService Text
getService_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetService' {Text
name :: Text
$sel:name:GetService' :: GetService -> Text
name} -> Text
name) (\s :: GetService
s@GetService' {} Text
a -> GetService
s {$sel:name:GetService' :: Text
name = 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 Service -> 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
name :: Text
$sel:name:GetService' :: GetService -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData GetService where
rnf :: GetService -> ()
rnf GetService' {Text
name :: Text
$sel:name:GetService' :: GetService -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
name
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
"AwsProton20200720.GetService" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetService where
toJSON :: GetService -> Value
toJSON GetService' {Text
name :: Text
$sel:name:GetService' :: GetService -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
)
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 Service
service :: Prelude.Maybe Service,
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, 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 Service
service = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetServiceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getServiceResponse_service :: Lens.Lens' GetServiceResponse (Prelude.Maybe Service)
getServiceResponse_service :: Lens' GetServiceResponse (Maybe Service)
getServiceResponse_service = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceResponse' {Maybe Service
service :: Maybe Service
$sel:service:GetServiceResponse' :: GetServiceResponse -> Maybe Service
service} -> Maybe Service
service) (\s :: GetServiceResponse
s@GetServiceResponse' {} Maybe Service
a -> GetServiceResponse
s {$sel:service:GetServiceResponse' :: Maybe Service
service = Maybe Service
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 Service
httpStatus :: Int
service :: Maybe Service
$sel:httpStatus:GetServiceResponse' :: GetServiceResponse -> Int
$sel:service:GetServiceResponse' :: GetServiceResponse -> Maybe Service
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Service
service
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus