{-# 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.SSM.GetServiceSetting
(
GetServiceSetting (..),
newGetServiceSetting,
getServiceSetting_settingId,
GetServiceSettingResponse (..),
newGetServiceSettingResponse,
getServiceSettingResponse_serviceSetting,
getServiceSettingResponse_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.SSM.Types
data GetServiceSetting = GetServiceSetting'
{
GetServiceSetting -> Text
settingId :: Prelude.Text
}
deriving (GetServiceSetting -> GetServiceSetting -> Bool
(GetServiceSetting -> GetServiceSetting -> Bool)
-> (GetServiceSetting -> GetServiceSetting -> Bool)
-> Eq GetServiceSetting
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceSetting -> GetServiceSetting -> Bool
$c/= :: GetServiceSetting -> GetServiceSetting -> Bool
== :: GetServiceSetting -> GetServiceSetting -> Bool
$c== :: GetServiceSetting -> GetServiceSetting -> Bool
Prelude.Eq, ReadPrec [GetServiceSetting]
ReadPrec GetServiceSetting
Int -> ReadS GetServiceSetting
ReadS [GetServiceSetting]
(Int -> ReadS GetServiceSetting)
-> ReadS [GetServiceSetting]
-> ReadPrec GetServiceSetting
-> ReadPrec [GetServiceSetting]
-> Read GetServiceSetting
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServiceSetting]
$creadListPrec :: ReadPrec [GetServiceSetting]
readPrec :: ReadPrec GetServiceSetting
$creadPrec :: ReadPrec GetServiceSetting
readList :: ReadS [GetServiceSetting]
$creadList :: ReadS [GetServiceSetting]
readsPrec :: Int -> ReadS GetServiceSetting
$creadsPrec :: Int -> ReadS GetServiceSetting
Prelude.Read, Int -> GetServiceSetting -> ShowS
[GetServiceSetting] -> ShowS
GetServiceSetting -> String
(Int -> GetServiceSetting -> ShowS)
-> (GetServiceSetting -> String)
-> ([GetServiceSetting] -> ShowS)
-> Show GetServiceSetting
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceSetting] -> ShowS
$cshowList :: [GetServiceSetting] -> ShowS
show :: GetServiceSetting -> String
$cshow :: GetServiceSetting -> String
showsPrec :: Int -> GetServiceSetting -> ShowS
$cshowsPrec :: Int -> GetServiceSetting -> ShowS
Prelude.Show, (forall x. GetServiceSetting -> Rep GetServiceSetting x)
-> (forall x. Rep GetServiceSetting x -> GetServiceSetting)
-> Generic GetServiceSetting
forall x. Rep GetServiceSetting x -> GetServiceSetting
forall x. GetServiceSetting -> Rep GetServiceSetting x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetServiceSetting x -> GetServiceSetting
$cfrom :: forall x. GetServiceSetting -> Rep GetServiceSetting x
Prelude.Generic)
newGetServiceSetting ::
Prelude.Text ->
GetServiceSetting
newGetServiceSetting :: Text -> GetServiceSetting
newGetServiceSetting Text
pSettingId_ =
GetServiceSetting' :: Text -> GetServiceSetting
GetServiceSetting' {$sel:settingId:GetServiceSetting' :: Text
settingId = Text
pSettingId_}
getServiceSetting_settingId :: Lens.Lens' GetServiceSetting Prelude.Text
getServiceSetting_settingId :: (Text -> f Text) -> GetServiceSetting -> f GetServiceSetting
getServiceSetting_settingId = (GetServiceSetting -> Text)
-> (GetServiceSetting -> Text -> GetServiceSetting)
-> Lens GetServiceSetting GetServiceSetting Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceSetting' {Text
settingId :: Text
$sel:settingId:GetServiceSetting' :: GetServiceSetting -> Text
settingId} -> Text
settingId) (\s :: GetServiceSetting
s@GetServiceSetting' {} Text
a -> GetServiceSetting
s {$sel:settingId:GetServiceSetting' :: Text
settingId = Text
a} :: GetServiceSetting)
instance Core.AWSRequest GetServiceSetting where
type
AWSResponse GetServiceSetting =
GetServiceSettingResponse
request :: GetServiceSetting -> Request GetServiceSetting
request = Service -> GetServiceSetting -> Request GetServiceSetting
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetServiceSetting
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetServiceSetting)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetServiceSetting))
-> Logger
-> Service
-> Proxy GetServiceSetting
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetServiceSetting)))
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 ServiceSetting -> Int -> GetServiceSettingResponse
GetServiceSettingResponse'
(Maybe ServiceSetting -> Int -> GetServiceSettingResponse)
-> Either String (Maybe ServiceSetting)
-> Either String (Int -> GetServiceSettingResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ServiceSetting)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ServiceSetting")
Either String (Int -> GetServiceSettingResponse)
-> Either String Int -> Either String GetServiceSettingResponse
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 GetServiceSetting
instance Prelude.NFData GetServiceSetting
instance Core.ToHeaders GetServiceSetting where
toHeaders :: GetServiceSetting -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetServiceSetting -> 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
"AmazonSSM.GetServiceSetting" ::
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 GetServiceSetting where
toJSON :: GetServiceSetting -> Value
toJSON GetServiceSetting' {Text
settingId :: Text
$sel:settingId:GetServiceSetting' :: GetServiceSetting -> 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
"SettingId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
settingId)]
)
instance Core.ToPath GetServiceSetting where
toPath :: GetServiceSetting -> ByteString
toPath = ByteString -> GetServiceSetting -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetServiceSetting where
toQuery :: GetServiceSetting -> QueryString
toQuery = QueryString -> GetServiceSetting -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetServiceSettingResponse = GetServiceSettingResponse'
{
GetServiceSettingResponse -> Maybe ServiceSetting
serviceSetting :: Prelude.Maybe ServiceSetting,
GetServiceSettingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetServiceSettingResponse -> GetServiceSettingResponse -> Bool
(GetServiceSettingResponse -> GetServiceSettingResponse -> Bool)
-> (GetServiceSettingResponse -> GetServiceSettingResponse -> Bool)
-> Eq GetServiceSettingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetServiceSettingResponse -> GetServiceSettingResponse -> Bool
$c/= :: GetServiceSettingResponse -> GetServiceSettingResponse -> Bool
== :: GetServiceSettingResponse -> GetServiceSettingResponse -> Bool
$c== :: GetServiceSettingResponse -> GetServiceSettingResponse -> Bool
Prelude.Eq, ReadPrec [GetServiceSettingResponse]
ReadPrec GetServiceSettingResponse
Int -> ReadS GetServiceSettingResponse
ReadS [GetServiceSettingResponse]
(Int -> ReadS GetServiceSettingResponse)
-> ReadS [GetServiceSettingResponse]
-> ReadPrec GetServiceSettingResponse
-> ReadPrec [GetServiceSettingResponse]
-> Read GetServiceSettingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetServiceSettingResponse]
$creadListPrec :: ReadPrec [GetServiceSettingResponse]
readPrec :: ReadPrec GetServiceSettingResponse
$creadPrec :: ReadPrec GetServiceSettingResponse
readList :: ReadS [GetServiceSettingResponse]
$creadList :: ReadS [GetServiceSettingResponse]
readsPrec :: Int -> ReadS GetServiceSettingResponse
$creadsPrec :: Int -> ReadS GetServiceSettingResponse
Prelude.Read, Int -> GetServiceSettingResponse -> ShowS
[GetServiceSettingResponse] -> ShowS
GetServiceSettingResponse -> String
(Int -> GetServiceSettingResponse -> ShowS)
-> (GetServiceSettingResponse -> String)
-> ([GetServiceSettingResponse] -> ShowS)
-> Show GetServiceSettingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetServiceSettingResponse] -> ShowS
$cshowList :: [GetServiceSettingResponse] -> ShowS
show :: GetServiceSettingResponse -> String
$cshow :: GetServiceSettingResponse -> String
showsPrec :: Int -> GetServiceSettingResponse -> ShowS
$cshowsPrec :: Int -> GetServiceSettingResponse -> ShowS
Prelude.Show, (forall x.
GetServiceSettingResponse -> Rep GetServiceSettingResponse x)
-> (forall x.
Rep GetServiceSettingResponse x -> GetServiceSettingResponse)
-> Generic GetServiceSettingResponse
forall x.
Rep GetServiceSettingResponse x -> GetServiceSettingResponse
forall x.
GetServiceSettingResponse -> Rep GetServiceSettingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetServiceSettingResponse x -> GetServiceSettingResponse
$cfrom :: forall x.
GetServiceSettingResponse -> Rep GetServiceSettingResponse x
Prelude.Generic)
newGetServiceSettingResponse ::
Prelude.Int ->
GetServiceSettingResponse
newGetServiceSettingResponse :: Int -> GetServiceSettingResponse
newGetServiceSettingResponse Int
pHttpStatus_ =
GetServiceSettingResponse' :: Maybe ServiceSetting -> Int -> GetServiceSettingResponse
GetServiceSettingResponse'
{ $sel:serviceSetting:GetServiceSettingResponse' :: Maybe ServiceSetting
serviceSetting =
Maybe ServiceSetting
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetServiceSettingResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getServiceSettingResponse_serviceSetting :: Lens.Lens' GetServiceSettingResponse (Prelude.Maybe ServiceSetting)
getServiceSettingResponse_serviceSetting :: (Maybe ServiceSetting -> f (Maybe ServiceSetting))
-> GetServiceSettingResponse -> f GetServiceSettingResponse
getServiceSettingResponse_serviceSetting = (GetServiceSettingResponse -> Maybe ServiceSetting)
-> (GetServiceSettingResponse
-> Maybe ServiceSetting -> GetServiceSettingResponse)
-> Lens
GetServiceSettingResponse
GetServiceSettingResponse
(Maybe ServiceSetting)
(Maybe ServiceSetting)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceSettingResponse' {Maybe ServiceSetting
serviceSetting :: Maybe ServiceSetting
$sel:serviceSetting:GetServiceSettingResponse' :: GetServiceSettingResponse -> Maybe ServiceSetting
serviceSetting} -> Maybe ServiceSetting
serviceSetting) (\s :: GetServiceSettingResponse
s@GetServiceSettingResponse' {} Maybe ServiceSetting
a -> GetServiceSettingResponse
s {$sel:serviceSetting:GetServiceSettingResponse' :: Maybe ServiceSetting
serviceSetting = Maybe ServiceSetting
a} :: GetServiceSettingResponse)
getServiceSettingResponse_httpStatus :: Lens.Lens' GetServiceSettingResponse Prelude.Int
getServiceSettingResponse_httpStatus :: (Int -> f Int)
-> GetServiceSettingResponse -> f GetServiceSettingResponse
getServiceSettingResponse_httpStatus = (GetServiceSettingResponse -> Int)
-> (GetServiceSettingResponse -> Int -> GetServiceSettingResponse)
-> Lens GetServiceSettingResponse GetServiceSettingResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetServiceSettingResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetServiceSettingResponse' :: GetServiceSettingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetServiceSettingResponse
s@GetServiceSettingResponse' {} Int
a -> GetServiceSettingResponse
s {$sel:httpStatus:GetServiceSettingResponse' :: Int
httpStatus = Int
a} :: GetServiceSettingResponse)
instance Prelude.NFData GetServiceSettingResponse