{-# 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.GetServiceInstance
(
GetServiceInstance (..),
newGetServiceInstance,
getServiceInstance_name,
getServiceInstance_serviceName,
GetServiceInstanceResponse (..),
newGetServiceInstanceResponse,
getServiceInstanceResponse_httpStatus,
getServiceInstanceResponse_serviceInstance,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetServiceInstance = GetServiceInstance'
{
GetServiceInstance -> Text
name :: Prelude.Text,
GetServiceInstance -> Text
serviceName :: Prelude.Text
}
deriving (GetServiceInstance -> GetServiceInstance -> Bool
(GetServiceInstance -> GetServiceInstance -> Bool)
-> (GetServiceInstance -> GetServiceInstance -> Bool)
-> Eq GetServiceInstance
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceInstance -> GetServiceInstance -> Bool
$c/= :: GetServiceInstance -> GetServiceInstance -> Bool
== :: GetServiceInstance -> GetServiceInstance -> Bool
$c== :: GetServiceInstance -> GetServiceInstance -> Bool
Prelude.Eq, ReadPrec [GetServiceInstance]
ReadPrec GetServiceInstance
Int -> ReadS GetServiceInstance
ReadS [GetServiceInstance]
(Int -> ReadS GetServiceInstance)
-> ReadS [GetServiceInstance]
-> ReadPrec GetServiceInstance
-> ReadPrec [GetServiceInstance]
-> Read GetServiceInstance
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServiceInstance]
$creadListPrec :: ReadPrec [GetServiceInstance]
readPrec :: ReadPrec GetServiceInstance
$creadPrec :: ReadPrec GetServiceInstance
readList :: ReadS [GetServiceInstance]
$creadList :: ReadS [GetServiceInstance]
readsPrec :: Int -> ReadS GetServiceInstance
$creadsPrec :: Int -> ReadS GetServiceInstance
Prelude.Read, Int -> GetServiceInstance -> ShowS
[GetServiceInstance] -> ShowS
GetServiceInstance -> String
(Int -> GetServiceInstance -> ShowS)
-> (GetServiceInstance -> String)
-> ([GetServiceInstance] -> ShowS)
-> Show GetServiceInstance
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceInstance] -> ShowS
$cshowList :: [GetServiceInstance] -> ShowS
show :: GetServiceInstance -> String
$cshow :: GetServiceInstance -> String
showsPrec :: Int -> GetServiceInstance -> ShowS
$cshowsPrec :: Int -> GetServiceInstance -> ShowS
Prelude.Show, (forall x. GetServiceInstance -> Rep GetServiceInstance x)
-> (forall x. Rep GetServiceInstance x -> GetServiceInstance)
-> Generic GetServiceInstance
forall x. Rep GetServiceInstance x -> GetServiceInstance
forall x. GetServiceInstance -> Rep GetServiceInstance x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetServiceInstance x -> GetServiceInstance
$cfrom :: forall x. GetServiceInstance -> Rep GetServiceInstance x
Prelude.Generic)
newGetServiceInstance ::
Prelude.Text ->
Prelude.Text ->
GetServiceInstance
newGetServiceInstance :: Text -> Text -> GetServiceInstance
newGetServiceInstance Text
pName_ Text
pServiceName_ =
GetServiceInstance' :: Text -> Text -> GetServiceInstance
GetServiceInstance'
{ $sel:name:GetServiceInstance' :: Text
name = Text
pName_,
$sel:serviceName:GetServiceInstance' :: Text
serviceName = Text
pServiceName_
}
getServiceInstance_name :: Lens.Lens' GetServiceInstance Prelude.Text
getServiceInstance_name :: (Text -> f Text) -> GetServiceInstance -> f GetServiceInstance
getServiceInstance_name = (GetServiceInstance -> Text)
-> (GetServiceInstance -> Text -> GetServiceInstance)
-> Lens GetServiceInstance GetServiceInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceInstance' {Text
name :: Text
$sel:name:GetServiceInstance' :: GetServiceInstance -> Text
name} -> Text
name) (\s :: GetServiceInstance
s@GetServiceInstance' {} Text
a -> GetServiceInstance
s {$sel:name:GetServiceInstance' :: Text
name = Text
a} :: GetServiceInstance)
getServiceInstance_serviceName :: Lens.Lens' GetServiceInstance Prelude.Text
getServiceInstance_serviceName :: (Text -> f Text) -> GetServiceInstance -> f GetServiceInstance
getServiceInstance_serviceName = (GetServiceInstance -> Text)
-> (GetServiceInstance -> Text -> GetServiceInstance)
-> Lens GetServiceInstance GetServiceInstance Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceInstance' {Text
serviceName :: Text
$sel:serviceName:GetServiceInstance' :: GetServiceInstance -> Text
serviceName} -> Text
serviceName) (\s :: GetServiceInstance
s@GetServiceInstance' {} Text
a -> GetServiceInstance
s {$sel:serviceName:GetServiceInstance' :: Text
serviceName = Text
a} :: GetServiceInstance)
instance Core.AWSRequest GetServiceInstance where
type
AWSResponse GetServiceInstance =
GetServiceInstanceResponse
request :: GetServiceInstance -> Request GetServiceInstance
request = Service -> GetServiceInstance -> Request GetServiceInstance
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetServiceInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetServiceInstance)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetServiceInstance))
-> Logger
-> Service
-> Proxy GetServiceInstance
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetServiceInstance)))
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 ->
Int -> ServiceInstance -> GetServiceInstanceResponse
GetServiceInstanceResponse'
(Int -> ServiceInstance -> GetServiceInstanceResponse)
-> Either String Int
-> Either String (ServiceInstance -> GetServiceInstanceResponse)
forall (f :: * -> *) a b. Functor 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))
Either String (ServiceInstance -> GetServiceInstanceResponse)
-> Either String ServiceInstance
-> Either String GetServiceInstanceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ServiceInstance
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"serviceInstance")
)
instance Prelude.Hashable GetServiceInstance
instance Prelude.NFData GetServiceInstance
instance Core.ToHeaders GetServiceInstance where
toHeaders :: GetServiceInstance -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetServiceInstance -> 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
"AwsProton20200720.GetServiceInstance" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetServiceInstance where
toJSON :: GetServiceInstance -> Value
toJSON GetServiceInstance' {Text
serviceName :: Text
name :: Text
$sel:serviceName:GetServiceInstance' :: GetServiceInstance -> Text
$sel:name:GetServiceInstance' :: GetServiceInstance -> 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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"serviceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceName)
]
)
instance Core.ToPath GetServiceInstance where
toPath :: GetServiceInstance -> ByteString
toPath = ByteString -> GetServiceInstance -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetServiceInstance where
toQuery :: GetServiceInstance -> QueryString
toQuery = QueryString -> GetServiceInstance -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetServiceInstanceResponse = GetServiceInstanceResponse'
{
GetServiceInstanceResponse -> Int
httpStatus :: Prelude.Int,
GetServiceInstanceResponse -> ServiceInstance
serviceInstance :: ServiceInstance
}
deriving (GetServiceInstanceResponse -> GetServiceInstanceResponse -> Bool
(GetServiceInstanceResponse -> GetServiceInstanceResponse -> Bool)
-> (GetServiceInstanceResponse
-> GetServiceInstanceResponse -> Bool)
-> Eq GetServiceInstanceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceInstanceResponse -> GetServiceInstanceResponse -> Bool
$c/= :: GetServiceInstanceResponse -> GetServiceInstanceResponse -> Bool
== :: GetServiceInstanceResponse -> GetServiceInstanceResponse -> Bool
$c== :: GetServiceInstanceResponse -> GetServiceInstanceResponse -> Bool
Prelude.Eq, Int -> GetServiceInstanceResponse -> ShowS
[GetServiceInstanceResponse] -> ShowS
GetServiceInstanceResponse -> String
(Int -> GetServiceInstanceResponse -> ShowS)
-> (GetServiceInstanceResponse -> String)
-> ([GetServiceInstanceResponse] -> ShowS)
-> Show GetServiceInstanceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceInstanceResponse] -> ShowS
$cshowList :: [GetServiceInstanceResponse] -> ShowS
show :: GetServiceInstanceResponse -> String
$cshow :: GetServiceInstanceResponse -> String
showsPrec :: Int -> GetServiceInstanceResponse -> ShowS
$cshowsPrec :: Int -> GetServiceInstanceResponse -> ShowS
Prelude.Show, (forall x.
GetServiceInstanceResponse -> Rep GetServiceInstanceResponse x)
-> (forall x.
Rep GetServiceInstanceResponse x -> GetServiceInstanceResponse)
-> Generic GetServiceInstanceResponse
forall x.
Rep GetServiceInstanceResponse x -> GetServiceInstanceResponse
forall x.
GetServiceInstanceResponse -> Rep GetServiceInstanceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetServiceInstanceResponse x -> GetServiceInstanceResponse
$cfrom :: forall x.
GetServiceInstanceResponse -> Rep GetServiceInstanceResponse x
Prelude.Generic)
newGetServiceInstanceResponse ::
Prelude.Int ->
ServiceInstance ->
GetServiceInstanceResponse
newGetServiceInstanceResponse :: Int -> ServiceInstance -> GetServiceInstanceResponse
newGetServiceInstanceResponse
Int
pHttpStatus_
ServiceInstance
pServiceInstance_ =
GetServiceInstanceResponse' :: Int -> ServiceInstance -> GetServiceInstanceResponse
GetServiceInstanceResponse'
{ $sel:httpStatus:GetServiceInstanceResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:serviceInstance:GetServiceInstanceResponse' :: ServiceInstance
serviceInstance = ServiceInstance
pServiceInstance_
}
getServiceInstanceResponse_httpStatus :: Lens.Lens' GetServiceInstanceResponse Prelude.Int
getServiceInstanceResponse_httpStatus :: (Int -> f Int)
-> GetServiceInstanceResponse -> f GetServiceInstanceResponse
getServiceInstanceResponse_httpStatus = (GetServiceInstanceResponse -> Int)
-> (GetServiceInstanceResponse
-> Int -> GetServiceInstanceResponse)
-> Lens
GetServiceInstanceResponse GetServiceInstanceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceInstanceResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetServiceInstanceResponse' :: GetServiceInstanceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetServiceInstanceResponse
s@GetServiceInstanceResponse' {} Int
a -> GetServiceInstanceResponse
s {$sel:httpStatus:GetServiceInstanceResponse' :: Int
httpStatus = Int
a} :: GetServiceInstanceResponse)
getServiceInstanceResponse_serviceInstance :: Lens.Lens' GetServiceInstanceResponse ServiceInstance
getServiceInstanceResponse_serviceInstance :: (ServiceInstance -> f ServiceInstance)
-> GetServiceInstanceResponse -> f GetServiceInstanceResponse
getServiceInstanceResponse_serviceInstance = (GetServiceInstanceResponse -> ServiceInstance)
-> (GetServiceInstanceResponse
-> ServiceInstance -> GetServiceInstanceResponse)
-> Lens
GetServiceInstanceResponse
GetServiceInstanceResponse
ServiceInstance
ServiceInstance
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceInstanceResponse' {ServiceInstance
serviceInstance :: ServiceInstance
$sel:serviceInstance:GetServiceInstanceResponse' :: GetServiceInstanceResponse -> ServiceInstance
serviceInstance} -> ServiceInstance
serviceInstance) (\s :: GetServiceInstanceResponse
s@GetServiceInstanceResponse' {} ServiceInstance
a -> GetServiceInstanceResponse
s {$sel:serviceInstance:GetServiceInstanceResponse' :: ServiceInstance
serviceInstance = ServiceInstance
a} :: GetServiceInstanceResponse)
instance Prelude.NFData GetServiceInstanceResponse