{-# 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.ModifyHsm
(
ModifyHsm (..),
newModifyHsm,
modifyHsm_iamRoleArn,
modifyHsm_subnetId,
modifyHsm_syslogIp,
modifyHsm_externalId,
modifyHsm_eniIp,
modifyHsm_hsmArn,
ModifyHsmResponse (..),
newModifyHsmResponse,
modifyHsmResponse_hsmArn,
modifyHsmResponse_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 ModifyHsm = ModifyHsm'
{
ModifyHsm -> Maybe Text
iamRoleArn :: Prelude.Maybe Prelude.Text,
ModifyHsm -> Maybe Text
subnetId :: Prelude.Maybe Prelude.Text,
ModifyHsm -> Maybe Text
syslogIp :: Prelude.Maybe Prelude.Text,
ModifyHsm -> Maybe Text
externalId :: Prelude.Maybe Prelude.Text,
ModifyHsm -> Maybe Text
eniIp :: Prelude.Maybe Prelude.Text,
ModifyHsm -> Text
hsmArn :: Prelude.Text
}
deriving (ModifyHsm -> ModifyHsm -> Bool
(ModifyHsm -> ModifyHsm -> Bool)
-> (ModifyHsm -> ModifyHsm -> Bool) -> Eq ModifyHsm
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyHsm -> ModifyHsm -> Bool
$c/= :: ModifyHsm -> ModifyHsm -> Bool
== :: ModifyHsm -> ModifyHsm -> Bool
$c== :: ModifyHsm -> ModifyHsm -> Bool
Prelude.Eq, ReadPrec [ModifyHsm]
ReadPrec ModifyHsm
Int -> ReadS ModifyHsm
ReadS [ModifyHsm]
(Int -> ReadS ModifyHsm)
-> ReadS [ModifyHsm]
-> ReadPrec ModifyHsm
-> ReadPrec [ModifyHsm]
-> Read ModifyHsm
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyHsm]
$creadListPrec :: ReadPrec [ModifyHsm]
readPrec :: ReadPrec ModifyHsm
$creadPrec :: ReadPrec ModifyHsm
readList :: ReadS [ModifyHsm]
$creadList :: ReadS [ModifyHsm]
readsPrec :: Int -> ReadS ModifyHsm
$creadsPrec :: Int -> ReadS ModifyHsm
Prelude.Read, Int -> ModifyHsm -> ShowS
[ModifyHsm] -> ShowS
ModifyHsm -> String
(Int -> ModifyHsm -> ShowS)
-> (ModifyHsm -> String)
-> ([ModifyHsm] -> ShowS)
-> Show ModifyHsm
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyHsm] -> ShowS
$cshowList :: [ModifyHsm] -> ShowS
show :: ModifyHsm -> String
$cshow :: ModifyHsm -> String
showsPrec :: Int -> ModifyHsm -> ShowS
$cshowsPrec :: Int -> ModifyHsm -> ShowS
Prelude.Show, (forall x. ModifyHsm -> Rep ModifyHsm x)
-> (forall x. Rep ModifyHsm x -> ModifyHsm) -> Generic ModifyHsm
forall x. Rep ModifyHsm x -> ModifyHsm
forall x. ModifyHsm -> Rep ModifyHsm x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyHsm x -> ModifyHsm
$cfrom :: forall x. ModifyHsm -> Rep ModifyHsm x
Prelude.Generic)
newModifyHsm ::
Prelude.Text ->
ModifyHsm
newModifyHsm :: Text -> ModifyHsm
newModifyHsm Text
pHsmArn_ =
ModifyHsm' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Text
-> ModifyHsm
ModifyHsm'
{ $sel:iamRoleArn:ModifyHsm' :: Maybe Text
iamRoleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:subnetId:ModifyHsm' :: Maybe Text
subnetId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:syslogIp:ModifyHsm' :: Maybe Text
syslogIp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:externalId:ModifyHsm' :: Maybe Text
externalId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:eniIp:ModifyHsm' :: Maybe Text
eniIp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:hsmArn:ModifyHsm' :: Text
hsmArn = Text
pHsmArn_
}
modifyHsm_iamRoleArn :: Lens.Lens' ModifyHsm (Prelude.Maybe Prelude.Text)
modifyHsm_iamRoleArn :: (Maybe Text -> f (Maybe Text)) -> ModifyHsm -> f ModifyHsm
modifyHsm_iamRoleArn = (ModifyHsm -> Maybe Text)
-> (ModifyHsm -> Maybe Text -> ModifyHsm)
-> Lens ModifyHsm ModifyHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHsm' {Maybe Text
iamRoleArn :: Maybe Text
$sel:iamRoleArn:ModifyHsm' :: ModifyHsm -> Maybe Text
iamRoleArn} -> Maybe Text
iamRoleArn) (\s :: ModifyHsm
s@ModifyHsm' {} Maybe Text
a -> ModifyHsm
s {$sel:iamRoleArn:ModifyHsm' :: Maybe Text
iamRoleArn = Maybe Text
a} :: ModifyHsm)
modifyHsm_subnetId :: Lens.Lens' ModifyHsm (Prelude.Maybe Prelude.Text)
modifyHsm_subnetId :: (Maybe Text -> f (Maybe Text)) -> ModifyHsm -> f ModifyHsm
modifyHsm_subnetId = (ModifyHsm -> Maybe Text)
-> (ModifyHsm -> Maybe Text -> ModifyHsm)
-> Lens ModifyHsm ModifyHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHsm' {Maybe Text
subnetId :: Maybe Text
$sel:subnetId:ModifyHsm' :: ModifyHsm -> Maybe Text
subnetId} -> Maybe Text
subnetId) (\s :: ModifyHsm
s@ModifyHsm' {} Maybe Text
a -> ModifyHsm
s {$sel:subnetId:ModifyHsm' :: Maybe Text
subnetId = Maybe Text
a} :: ModifyHsm)
modifyHsm_syslogIp :: Lens.Lens' ModifyHsm (Prelude.Maybe Prelude.Text)
modifyHsm_syslogIp :: (Maybe Text -> f (Maybe Text)) -> ModifyHsm -> f ModifyHsm
modifyHsm_syslogIp = (ModifyHsm -> Maybe Text)
-> (ModifyHsm -> Maybe Text -> ModifyHsm)
-> Lens ModifyHsm ModifyHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHsm' {Maybe Text
syslogIp :: Maybe Text
$sel:syslogIp:ModifyHsm' :: ModifyHsm -> Maybe Text
syslogIp} -> Maybe Text
syslogIp) (\s :: ModifyHsm
s@ModifyHsm' {} Maybe Text
a -> ModifyHsm
s {$sel:syslogIp:ModifyHsm' :: Maybe Text
syslogIp = Maybe Text
a} :: ModifyHsm)
modifyHsm_externalId :: Lens.Lens' ModifyHsm (Prelude.Maybe Prelude.Text)
modifyHsm_externalId :: (Maybe Text -> f (Maybe Text)) -> ModifyHsm -> f ModifyHsm
modifyHsm_externalId = (ModifyHsm -> Maybe Text)
-> (ModifyHsm -> Maybe Text -> ModifyHsm)
-> Lens ModifyHsm ModifyHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHsm' {Maybe Text
externalId :: Maybe Text
$sel:externalId:ModifyHsm' :: ModifyHsm -> Maybe Text
externalId} -> Maybe Text
externalId) (\s :: ModifyHsm
s@ModifyHsm' {} Maybe Text
a -> ModifyHsm
s {$sel:externalId:ModifyHsm' :: Maybe Text
externalId = Maybe Text
a} :: ModifyHsm)
modifyHsm_eniIp :: Lens.Lens' ModifyHsm (Prelude.Maybe Prelude.Text)
modifyHsm_eniIp :: (Maybe Text -> f (Maybe Text)) -> ModifyHsm -> f ModifyHsm
modifyHsm_eniIp = (ModifyHsm -> Maybe Text)
-> (ModifyHsm -> Maybe Text -> ModifyHsm)
-> Lens ModifyHsm ModifyHsm (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHsm' {Maybe Text
eniIp :: Maybe Text
$sel:eniIp:ModifyHsm' :: ModifyHsm -> Maybe Text
eniIp} -> Maybe Text
eniIp) (\s :: ModifyHsm
s@ModifyHsm' {} Maybe Text
a -> ModifyHsm
s {$sel:eniIp:ModifyHsm' :: Maybe Text
eniIp = Maybe Text
a} :: ModifyHsm)
modifyHsm_hsmArn :: Lens.Lens' ModifyHsm Prelude.Text
modifyHsm_hsmArn :: (Text -> f Text) -> ModifyHsm -> f ModifyHsm
modifyHsm_hsmArn = (ModifyHsm -> Text)
-> (ModifyHsm -> Text -> ModifyHsm)
-> Lens ModifyHsm ModifyHsm Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHsm' {Text
hsmArn :: Text
$sel:hsmArn:ModifyHsm' :: ModifyHsm -> Text
hsmArn} -> Text
hsmArn) (\s :: ModifyHsm
s@ModifyHsm' {} Text
a -> ModifyHsm
s {$sel:hsmArn:ModifyHsm' :: Text
hsmArn = Text
a} :: ModifyHsm)
instance Core.AWSRequest ModifyHsm where
type AWSResponse ModifyHsm = ModifyHsmResponse
request :: ModifyHsm -> Request ModifyHsm
request = Service -> ModifyHsm -> Request ModifyHsm
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ModifyHsm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyHsm)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ModifyHsm))
-> Logger
-> Service
-> Proxy ModifyHsm
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ModifyHsm)))
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 -> Int -> ModifyHsmResponse
ModifyHsmResponse'
(Maybe Text -> Int -> ModifyHsmResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ModifyHsmResponse)
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
"HsmArn")
Either String (Int -> ModifyHsmResponse)
-> Either String Int -> Either String ModifyHsmResponse
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 ModifyHsm
instance Prelude.NFData ModifyHsm
instance Core.ToHeaders ModifyHsm where
toHeaders :: ModifyHsm -> ResponseHeaders
toHeaders =
ResponseHeaders -> ModifyHsm -> 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.ModifyHsm" ::
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 ModifyHsm where
toJSON :: ModifyHsm -> Value
toJSON ModifyHsm' {Maybe Text
Text
hsmArn :: Text
eniIp :: Maybe Text
externalId :: Maybe Text
syslogIp :: Maybe Text
subnetId :: Maybe Text
iamRoleArn :: Maybe Text
$sel:hsmArn:ModifyHsm' :: ModifyHsm -> Text
$sel:eniIp:ModifyHsm' :: ModifyHsm -> Maybe Text
$sel:externalId:ModifyHsm' :: ModifyHsm -> Maybe Text
$sel:syslogIp:ModifyHsm' :: ModifyHsm -> Maybe Text
$sel:subnetId:ModifyHsm' :: ModifyHsm -> Maybe Text
$sel:iamRoleArn:ModifyHsm' :: ModifyHsm -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IamRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
iamRoleArn,
(Text
"SubnetId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
subnetId,
(Text
"SyslogIp" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
syslogIp,
(Text
"ExternalId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
externalId,
(Text
"EniIp" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
eniIp,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HsmArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hsmArn)
]
)
instance Core.ToPath ModifyHsm where
toPath :: ModifyHsm -> ByteString
toPath = ByteString -> ModifyHsm -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ModifyHsm where
toQuery :: ModifyHsm -> QueryString
toQuery = QueryString -> ModifyHsm -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ModifyHsmResponse = ModifyHsmResponse'
{
ModifyHsmResponse -> Maybe Text
hsmArn :: Prelude.Maybe Prelude.Text,
ModifyHsmResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ModifyHsmResponse -> ModifyHsmResponse -> Bool
(ModifyHsmResponse -> ModifyHsmResponse -> Bool)
-> (ModifyHsmResponse -> ModifyHsmResponse -> Bool)
-> Eq ModifyHsmResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyHsmResponse -> ModifyHsmResponse -> Bool
$c/= :: ModifyHsmResponse -> ModifyHsmResponse -> Bool
== :: ModifyHsmResponse -> ModifyHsmResponse -> Bool
$c== :: ModifyHsmResponse -> ModifyHsmResponse -> Bool
Prelude.Eq, ReadPrec [ModifyHsmResponse]
ReadPrec ModifyHsmResponse
Int -> ReadS ModifyHsmResponse
ReadS [ModifyHsmResponse]
(Int -> ReadS ModifyHsmResponse)
-> ReadS [ModifyHsmResponse]
-> ReadPrec ModifyHsmResponse
-> ReadPrec [ModifyHsmResponse]
-> Read ModifyHsmResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyHsmResponse]
$creadListPrec :: ReadPrec [ModifyHsmResponse]
readPrec :: ReadPrec ModifyHsmResponse
$creadPrec :: ReadPrec ModifyHsmResponse
readList :: ReadS [ModifyHsmResponse]
$creadList :: ReadS [ModifyHsmResponse]
readsPrec :: Int -> ReadS ModifyHsmResponse
$creadsPrec :: Int -> ReadS ModifyHsmResponse
Prelude.Read, Int -> ModifyHsmResponse -> ShowS
[ModifyHsmResponse] -> ShowS
ModifyHsmResponse -> String
(Int -> ModifyHsmResponse -> ShowS)
-> (ModifyHsmResponse -> String)
-> ([ModifyHsmResponse] -> ShowS)
-> Show ModifyHsmResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyHsmResponse] -> ShowS
$cshowList :: [ModifyHsmResponse] -> ShowS
show :: ModifyHsmResponse -> String
$cshow :: ModifyHsmResponse -> String
showsPrec :: Int -> ModifyHsmResponse -> ShowS
$cshowsPrec :: Int -> ModifyHsmResponse -> ShowS
Prelude.Show, (forall x. ModifyHsmResponse -> Rep ModifyHsmResponse x)
-> (forall x. Rep ModifyHsmResponse x -> ModifyHsmResponse)
-> Generic ModifyHsmResponse
forall x. Rep ModifyHsmResponse x -> ModifyHsmResponse
forall x. ModifyHsmResponse -> Rep ModifyHsmResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModifyHsmResponse x -> ModifyHsmResponse
$cfrom :: forall x. ModifyHsmResponse -> Rep ModifyHsmResponse x
Prelude.Generic)
newModifyHsmResponse ::
Prelude.Int ->
ModifyHsmResponse
newModifyHsmResponse :: Int -> ModifyHsmResponse
newModifyHsmResponse Int
pHttpStatus_ =
ModifyHsmResponse' :: Maybe Text -> Int -> ModifyHsmResponse
ModifyHsmResponse'
{ $sel:hsmArn:ModifyHsmResponse' :: Maybe Text
hsmArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ModifyHsmResponse' :: Int
httpStatus = Int
pHttpStatus_
}
modifyHsmResponse_hsmArn :: Lens.Lens' ModifyHsmResponse (Prelude.Maybe Prelude.Text)
modifyHsmResponse_hsmArn :: (Maybe Text -> f (Maybe Text))
-> ModifyHsmResponse -> f ModifyHsmResponse
modifyHsmResponse_hsmArn = (ModifyHsmResponse -> Maybe Text)
-> (ModifyHsmResponse -> Maybe Text -> ModifyHsmResponse)
-> Lens
ModifyHsmResponse ModifyHsmResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHsmResponse' {Maybe Text
hsmArn :: Maybe Text
$sel:hsmArn:ModifyHsmResponse' :: ModifyHsmResponse -> Maybe Text
hsmArn} -> Maybe Text
hsmArn) (\s :: ModifyHsmResponse
s@ModifyHsmResponse' {} Maybe Text
a -> ModifyHsmResponse
s {$sel:hsmArn:ModifyHsmResponse' :: Maybe Text
hsmArn = Maybe Text
a} :: ModifyHsmResponse)
modifyHsmResponse_httpStatus :: Lens.Lens' ModifyHsmResponse Prelude.Int
modifyHsmResponse_httpStatus :: (Int -> f Int) -> ModifyHsmResponse -> f ModifyHsmResponse
modifyHsmResponse_httpStatus = (ModifyHsmResponse -> Int)
-> (ModifyHsmResponse -> Int -> ModifyHsmResponse)
-> Lens ModifyHsmResponse ModifyHsmResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyHsmResponse' {Int
httpStatus :: Int
$sel:httpStatus:ModifyHsmResponse' :: ModifyHsmResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ModifyHsmResponse
s@ModifyHsmResponse' {} Int
a -> ModifyHsmResponse
s {$sel:httpStatus:ModifyHsmResponse' :: Int
httpStatus = Int
a} :: ModifyHsmResponse)
instance Prelude.NFData ModifyHsmResponse