{-# 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.CloudHSM.GetConfig
(
GetConfig (..),
newGetConfig,
getConfig_clientArn,
getConfig_clientVersion,
getConfig_hapgList,
GetConfigResponse (..),
newGetConfigResponse,
getConfigResponse_configFile,
getConfigResponse_configCred,
getConfigResponse_configType,
getConfigResponse_httpStatus,
)
where
import Amazonka.CloudHSM.Types
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
data GetConfig = GetConfig'
{
GetConfig -> Text
clientArn :: Prelude.Text,
GetConfig -> ClientVersion
clientVersion :: ClientVersion,
GetConfig -> [Text]
hapgList :: [Prelude.Text]
}
deriving (GetConfig -> GetConfig -> Bool
(GetConfig -> GetConfig -> Bool)
-> (GetConfig -> GetConfig -> Bool) -> Eq GetConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConfig -> GetConfig -> Bool
$c/= :: GetConfig -> GetConfig -> Bool
== :: GetConfig -> GetConfig -> Bool
$c== :: GetConfig -> GetConfig -> Bool
Prelude.Eq, ReadPrec [GetConfig]
ReadPrec GetConfig
Int -> ReadS GetConfig
ReadS [GetConfig]
(Int -> ReadS GetConfig)
-> ReadS [GetConfig]
-> ReadPrec GetConfig
-> ReadPrec [GetConfig]
-> Read GetConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConfig]
$creadListPrec :: ReadPrec [GetConfig]
readPrec :: ReadPrec GetConfig
$creadPrec :: ReadPrec GetConfig
readList :: ReadS [GetConfig]
$creadList :: ReadS [GetConfig]
readsPrec :: Int -> ReadS GetConfig
$creadsPrec :: Int -> ReadS GetConfig
Prelude.Read, Int -> GetConfig -> ShowS
[GetConfig] -> ShowS
GetConfig -> String
(Int -> GetConfig -> ShowS)
-> (GetConfig -> String)
-> ([GetConfig] -> ShowS)
-> Show GetConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConfig] -> ShowS
$cshowList :: [GetConfig] -> ShowS
show :: GetConfig -> String
$cshow :: GetConfig -> String
showsPrec :: Int -> GetConfig -> ShowS
$cshowsPrec :: Int -> GetConfig -> ShowS
Prelude.Show, (forall x. GetConfig -> Rep GetConfig x)
-> (forall x. Rep GetConfig x -> GetConfig) -> Generic GetConfig
forall x. Rep GetConfig x -> GetConfig
forall x. GetConfig -> Rep GetConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConfig x -> GetConfig
$cfrom :: forall x. GetConfig -> Rep GetConfig x
Prelude.Generic)
newGetConfig ::
Prelude.Text ->
ClientVersion ->
GetConfig
newGetConfig :: Text -> ClientVersion -> GetConfig
newGetConfig Text
pClientArn_ ClientVersion
pClientVersion_ =
GetConfig' :: Text -> ClientVersion -> [Text] -> GetConfig
GetConfig'
{ $sel:clientArn:GetConfig' :: Text
clientArn = Text
pClientArn_,
$sel:clientVersion:GetConfig' :: ClientVersion
clientVersion = ClientVersion
pClientVersion_,
$sel:hapgList:GetConfig' :: [Text]
hapgList = [Text]
forall a. Monoid a => a
Prelude.mempty
}
getConfig_clientArn :: Lens.Lens' GetConfig Prelude.Text
getConfig_clientArn :: (Text -> f Text) -> GetConfig -> f GetConfig
getConfig_clientArn = (GetConfig -> Text)
-> (GetConfig -> Text -> GetConfig)
-> Lens GetConfig GetConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfig' {Text
clientArn :: Text
$sel:clientArn:GetConfig' :: GetConfig -> Text
clientArn} -> Text
clientArn) (\s :: GetConfig
s@GetConfig' {} Text
a -> GetConfig
s {$sel:clientArn:GetConfig' :: Text
clientArn = Text
a} :: GetConfig)
getConfig_clientVersion :: Lens.Lens' GetConfig ClientVersion
getConfig_clientVersion :: (ClientVersion -> f ClientVersion) -> GetConfig -> f GetConfig
getConfig_clientVersion = (GetConfig -> ClientVersion)
-> (GetConfig -> ClientVersion -> GetConfig)
-> Lens GetConfig GetConfig ClientVersion ClientVersion
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfig' {ClientVersion
clientVersion :: ClientVersion
$sel:clientVersion:GetConfig' :: GetConfig -> ClientVersion
clientVersion} -> ClientVersion
clientVersion) (\s :: GetConfig
s@GetConfig' {} ClientVersion
a -> GetConfig
s {$sel:clientVersion:GetConfig' :: ClientVersion
clientVersion = ClientVersion
a} :: GetConfig)
getConfig_hapgList :: Lens.Lens' GetConfig [Prelude.Text]
getConfig_hapgList :: ([Text] -> f [Text]) -> GetConfig -> f GetConfig
getConfig_hapgList = (GetConfig -> [Text])
-> (GetConfig -> [Text] -> GetConfig)
-> Lens GetConfig GetConfig [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfig' {[Text]
hapgList :: [Text]
$sel:hapgList:GetConfig' :: GetConfig -> [Text]
hapgList} -> [Text]
hapgList) (\s :: GetConfig
s@GetConfig' {} [Text]
a -> GetConfig
s {$sel:hapgList:GetConfig' :: [Text]
hapgList = [Text]
a} :: GetConfig) (([Text] -> f [Text]) -> GetConfig -> f GetConfig)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> GetConfig
-> f GetConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest GetConfig where
type AWSResponse GetConfig = GetConfigResponse
request :: GetConfig -> Request GetConfig
request = Service -> GetConfig -> Request GetConfig
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetConfig
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetConfig)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetConfig))
-> Logger
-> Service
-> Proxy GetConfig
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetConfig)))
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 Text -> Maybe Text -> Maybe Text -> Int -> GetConfigResponse
GetConfigResponse'
(Maybe Text
-> Maybe Text -> Maybe Text -> Int -> GetConfigResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe Text -> Maybe Text -> Int -> GetConfigResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConfigFile")
Either
String (Maybe Text -> Maybe Text -> Int -> GetConfigResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> GetConfigResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConfigCred")
Either String (Maybe Text -> Int -> GetConfigResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetConfigResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ConfigType")
Either String (Int -> GetConfigResponse)
-> Either String Int -> Either String GetConfigResponse
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 GetConfig
instance Prelude.NFData GetConfig
instance Core.ToHeaders GetConfig where
toHeaders :: GetConfig -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetConfig -> 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
"CloudHsmFrontendService.GetConfig" ::
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 GetConfig where
toJSON :: GetConfig -> Value
toJSON GetConfig' {[Text]
Text
ClientVersion
hapgList :: [Text]
clientVersion :: ClientVersion
clientArn :: Text
$sel:hapgList:GetConfig' :: GetConfig -> [Text]
$sel:clientVersion:GetConfig' :: GetConfig -> ClientVersion
$sel:clientArn:GetConfig' :: GetConfig -> 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
"ClientArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientArn),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ClientVersion" Text -> ClientVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ClientVersion
clientVersion),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HapgList" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
hapgList)
]
)
instance Core.ToPath GetConfig where
toPath :: GetConfig -> ByteString
toPath = ByteString -> GetConfig -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetConfig where
toQuery :: GetConfig -> QueryString
toQuery = QueryString -> GetConfig -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetConfigResponse = GetConfigResponse'
{
GetConfigResponse -> Maybe Text
configFile :: Prelude.Maybe Prelude.Text,
GetConfigResponse -> Maybe Text
configCred :: Prelude.Maybe Prelude.Text,
GetConfigResponse -> Maybe Text
configType :: Prelude.Maybe Prelude.Text,
GetConfigResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetConfigResponse -> GetConfigResponse -> Bool
(GetConfigResponse -> GetConfigResponse -> Bool)
-> (GetConfigResponse -> GetConfigResponse -> Bool)
-> Eq GetConfigResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetConfigResponse -> GetConfigResponse -> Bool
$c/= :: GetConfigResponse -> GetConfigResponse -> Bool
== :: GetConfigResponse -> GetConfigResponse -> Bool
$c== :: GetConfigResponse -> GetConfigResponse -> Bool
Prelude.Eq, ReadPrec [GetConfigResponse]
ReadPrec GetConfigResponse
Int -> ReadS GetConfigResponse
ReadS [GetConfigResponse]
(Int -> ReadS GetConfigResponse)
-> ReadS [GetConfigResponse]
-> ReadPrec GetConfigResponse
-> ReadPrec [GetConfigResponse]
-> Read GetConfigResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetConfigResponse]
$creadListPrec :: ReadPrec [GetConfigResponse]
readPrec :: ReadPrec GetConfigResponse
$creadPrec :: ReadPrec GetConfigResponse
readList :: ReadS [GetConfigResponse]
$creadList :: ReadS [GetConfigResponse]
readsPrec :: Int -> ReadS GetConfigResponse
$creadsPrec :: Int -> ReadS GetConfigResponse
Prelude.Read, Int -> GetConfigResponse -> ShowS
[GetConfigResponse] -> ShowS
GetConfigResponse -> String
(Int -> GetConfigResponse -> ShowS)
-> (GetConfigResponse -> String)
-> ([GetConfigResponse] -> ShowS)
-> Show GetConfigResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetConfigResponse] -> ShowS
$cshowList :: [GetConfigResponse] -> ShowS
show :: GetConfigResponse -> String
$cshow :: GetConfigResponse -> String
showsPrec :: Int -> GetConfigResponse -> ShowS
$cshowsPrec :: Int -> GetConfigResponse -> ShowS
Prelude.Show, (forall x. GetConfigResponse -> Rep GetConfigResponse x)
-> (forall x. Rep GetConfigResponse x -> GetConfigResponse)
-> Generic GetConfigResponse
forall x. Rep GetConfigResponse x -> GetConfigResponse
forall x. GetConfigResponse -> Rep GetConfigResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetConfigResponse x -> GetConfigResponse
$cfrom :: forall x. GetConfigResponse -> Rep GetConfigResponse x
Prelude.Generic)
newGetConfigResponse ::
Prelude.Int ->
GetConfigResponse
newGetConfigResponse :: Int -> GetConfigResponse
newGetConfigResponse Int
pHttpStatus_ =
GetConfigResponse' :: Maybe Text -> Maybe Text -> Maybe Text -> Int -> GetConfigResponse
GetConfigResponse'
{ $sel:configFile:GetConfigResponse' :: Maybe Text
configFile = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:configCred:GetConfigResponse' :: Maybe Text
configCred = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:configType:GetConfigResponse' :: Maybe Text
configType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetConfigResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getConfigResponse_configFile :: Lens.Lens' GetConfigResponse (Prelude.Maybe Prelude.Text)
getConfigResponse_configFile :: (Maybe Text -> f (Maybe Text))
-> GetConfigResponse -> f GetConfigResponse
getConfigResponse_configFile = (GetConfigResponse -> Maybe Text)
-> (GetConfigResponse -> Maybe Text -> GetConfigResponse)
-> Lens
GetConfigResponse GetConfigResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigResponse' {Maybe Text
configFile :: Maybe Text
$sel:configFile:GetConfigResponse' :: GetConfigResponse -> Maybe Text
configFile} -> Maybe Text
configFile) (\s :: GetConfigResponse
s@GetConfigResponse' {} Maybe Text
a -> GetConfigResponse
s {$sel:configFile:GetConfigResponse' :: Maybe Text
configFile = Maybe Text
a} :: GetConfigResponse)
getConfigResponse_configCred :: Lens.Lens' GetConfigResponse (Prelude.Maybe Prelude.Text)
getConfigResponse_configCred :: (Maybe Text -> f (Maybe Text))
-> GetConfigResponse -> f GetConfigResponse
getConfigResponse_configCred = (GetConfigResponse -> Maybe Text)
-> (GetConfigResponse -> Maybe Text -> GetConfigResponse)
-> Lens
GetConfigResponse GetConfigResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigResponse' {Maybe Text
configCred :: Maybe Text
$sel:configCred:GetConfigResponse' :: GetConfigResponse -> Maybe Text
configCred} -> Maybe Text
configCred) (\s :: GetConfigResponse
s@GetConfigResponse' {} Maybe Text
a -> GetConfigResponse
s {$sel:configCred:GetConfigResponse' :: Maybe Text
configCred = Maybe Text
a} :: GetConfigResponse)
getConfigResponse_configType :: Lens.Lens' GetConfigResponse (Prelude.Maybe Prelude.Text)
getConfigResponse_configType :: (Maybe Text -> f (Maybe Text))
-> GetConfigResponse -> f GetConfigResponse
getConfigResponse_configType = (GetConfigResponse -> Maybe Text)
-> (GetConfigResponse -> Maybe Text -> GetConfigResponse)
-> Lens
GetConfigResponse GetConfigResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigResponse' {Maybe Text
configType :: Maybe Text
$sel:configType:GetConfigResponse' :: GetConfigResponse -> Maybe Text
configType} -> Maybe Text
configType) (\s :: GetConfigResponse
s@GetConfigResponse' {} Maybe Text
a -> GetConfigResponse
s {$sel:configType:GetConfigResponse' :: Maybe Text
configType = Maybe Text
a} :: GetConfigResponse)
getConfigResponse_httpStatus :: Lens.Lens' GetConfigResponse Prelude.Int
getConfigResponse_httpStatus :: (Int -> f Int) -> GetConfigResponse -> f GetConfigResponse
getConfigResponse_httpStatus = (GetConfigResponse -> Int)
-> (GetConfigResponse -> Int -> GetConfigResponse)
-> Lens GetConfigResponse GetConfigResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetConfigResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetConfigResponse' :: GetConfigResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetConfigResponse
s@GetConfigResponse' {} Int
a -> GetConfigResponse
s {$sel:httpStatus:GetConfigResponse' :: Int
httpStatus = Int
a} :: GetConfigResponse)
instance Prelude.NFData GetConfigResponse