{-# 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.DMS.ImportCertificate
(
ImportCertificate (..),
newImportCertificate,
importCertificate_certificatePem,
importCertificate_certificateWallet,
importCertificate_tags,
importCertificate_certificateIdentifier,
ImportCertificateResponse (..),
newImportCertificateResponse,
importCertificateResponse_certificate,
importCertificateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.DMS.Types
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ImportCertificate = ImportCertificate'
{
ImportCertificate -> Maybe (Sensitive Text)
certificatePem :: Prelude.Maybe (Data.Sensitive Prelude.Text),
ImportCertificate -> Maybe Base64
certificateWallet :: Prelude.Maybe Data.Base64,
ImportCertificate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
ImportCertificate -> Text
certificateIdentifier :: Prelude.Text
}
deriving (ImportCertificate -> ImportCertificate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportCertificate -> ImportCertificate -> Bool
$c/= :: ImportCertificate -> ImportCertificate -> Bool
== :: ImportCertificate -> ImportCertificate -> Bool
$c== :: ImportCertificate -> ImportCertificate -> Bool
Prelude.Eq, Int -> ImportCertificate -> ShowS
[ImportCertificate] -> ShowS
ImportCertificate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportCertificate] -> ShowS
$cshowList :: [ImportCertificate] -> ShowS
show :: ImportCertificate -> String
$cshow :: ImportCertificate -> String
showsPrec :: Int -> ImportCertificate -> ShowS
$cshowsPrec :: Int -> ImportCertificate -> ShowS
Prelude.Show, forall x. Rep ImportCertificate x -> ImportCertificate
forall x. ImportCertificate -> Rep ImportCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ImportCertificate x -> ImportCertificate
$cfrom :: forall x. ImportCertificate -> Rep ImportCertificate x
Prelude.Generic)
newImportCertificate ::
Prelude.Text ->
ImportCertificate
newImportCertificate :: Text -> ImportCertificate
newImportCertificate Text
pCertificateIdentifier_ =
ImportCertificate'
{ $sel:certificatePem:ImportCertificate' :: Maybe (Sensitive Text)
certificatePem =
forall a. Maybe a
Prelude.Nothing,
$sel:certificateWallet:ImportCertificate' :: Maybe Base64
certificateWallet = forall a. Maybe a
Prelude.Nothing,
$sel:tags:ImportCertificate' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:certificateIdentifier:ImportCertificate' :: Text
certificateIdentifier = Text
pCertificateIdentifier_
}
importCertificate_certificatePem :: Lens.Lens' ImportCertificate (Prelude.Maybe Prelude.Text)
importCertificate_certificatePem :: Lens' ImportCertificate (Maybe Text)
importCertificate_certificatePem = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportCertificate' {Maybe (Sensitive Text)
certificatePem :: Maybe (Sensitive Text)
$sel:certificatePem:ImportCertificate' :: ImportCertificate -> Maybe (Sensitive Text)
certificatePem} -> Maybe (Sensitive Text)
certificatePem) (\s :: ImportCertificate
s@ImportCertificate' {} Maybe (Sensitive Text)
a -> ImportCertificate
s {$sel:certificatePem:ImportCertificate' :: Maybe (Sensitive Text)
certificatePem = Maybe (Sensitive Text)
a} :: ImportCertificate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall a. Iso' (Sensitive a) a
Data._Sensitive
importCertificate_certificateWallet :: Lens.Lens' ImportCertificate (Prelude.Maybe Prelude.ByteString)
importCertificate_certificateWallet :: Lens' ImportCertificate (Maybe ByteString)
importCertificate_certificateWallet = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportCertificate' {Maybe Base64
certificateWallet :: Maybe Base64
$sel:certificateWallet:ImportCertificate' :: ImportCertificate -> Maybe Base64
certificateWallet} -> Maybe Base64
certificateWallet) (\s :: ImportCertificate
s@ImportCertificate' {} Maybe Base64
a -> ImportCertificate
s {$sel:certificateWallet:ImportCertificate' :: Maybe Base64
certificateWallet = Maybe Base64
a} :: ImportCertificate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping Iso' Base64 ByteString
Data._Base64
importCertificate_tags :: Lens.Lens' ImportCertificate (Prelude.Maybe [Tag])
importCertificate_tags :: Lens' ImportCertificate (Maybe [Tag])
importCertificate_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportCertificate' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:ImportCertificate' :: ImportCertificate -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: ImportCertificate
s@ImportCertificate' {} Maybe [Tag]
a -> ImportCertificate
s {$sel:tags:ImportCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: ImportCertificate) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
importCertificate_certificateIdentifier :: Lens.Lens' ImportCertificate Prelude.Text
importCertificate_certificateIdentifier :: Lens' ImportCertificate Text
importCertificate_certificateIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportCertificate' {Text
certificateIdentifier :: Text
$sel:certificateIdentifier:ImportCertificate' :: ImportCertificate -> Text
certificateIdentifier} -> Text
certificateIdentifier) (\s :: ImportCertificate
s@ImportCertificate' {} Text
a -> ImportCertificate
s {$sel:certificateIdentifier:ImportCertificate' :: Text
certificateIdentifier = Text
a} :: ImportCertificate)
instance Core.AWSRequest ImportCertificate where
type
AWSResponse ImportCertificate =
ImportCertificateResponse
request :: (Service -> Service)
-> ImportCertificate -> Request ImportCertificate
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 ImportCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportCertificate)))
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 Certificate -> Int -> ImportCertificateResponse
ImportCertificateResponse'
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
"Certificate")
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 ImportCertificate where
hashWithSalt :: Int -> ImportCertificate -> Int
hashWithSalt Int
_salt ImportCertificate' {Maybe [Tag]
Maybe Base64
Maybe (Sensitive Text)
Text
certificateIdentifier :: Text
tags :: Maybe [Tag]
certificateWallet :: Maybe Base64
certificatePem :: Maybe (Sensitive Text)
$sel:certificateIdentifier:ImportCertificate' :: ImportCertificate -> Text
$sel:tags:ImportCertificate' :: ImportCertificate -> Maybe [Tag]
$sel:certificateWallet:ImportCertificate' :: ImportCertificate -> Maybe Base64
$sel:certificatePem:ImportCertificate' :: ImportCertificate -> Maybe (Sensitive Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
certificatePem
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Base64
certificateWallet
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
certificateIdentifier
instance Prelude.NFData ImportCertificate where
rnf :: ImportCertificate -> ()
rnf ImportCertificate' {Maybe [Tag]
Maybe Base64
Maybe (Sensitive Text)
Text
certificateIdentifier :: Text
tags :: Maybe [Tag]
certificateWallet :: Maybe Base64
certificatePem :: Maybe (Sensitive Text)
$sel:certificateIdentifier:ImportCertificate' :: ImportCertificate -> Text
$sel:tags:ImportCertificate' :: ImportCertificate -> Maybe [Tag]
$sel:certificateWallet:ImportCertificate' :: ImportCertificate -> Maybe Base64
$sel:certificatePem:ImportCertificate' :: ImportCertificate -> Maybe (Sensitive Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
certificatePem
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Base64
certificateWallet
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
certificateIdentifier
instance Data.ToHeaders ImportCertificate where
toHeaders :: ImportCertificate -> 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
"AmazonDMSv20160101.ImportCertificate" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ImportCertificate where
toJSON :: ImportCertificate -> Value
toJSON ImportCertificate' {Maybe [Tag]
Maybe Base64
Maybe (Sensitive Text)
Text
certificateIdentifier :: Text
tags :: Maybe [Tag]
certificateWallet :: Maybe Base64
certificatePem :: Maybe (Sensitive Text)
$sel:certificateIdentifier:ImportCertificate' :: ImportCertificate -> Text
$sel:tags:ImportCertificate' :: ImportCertificate -> Maybe [Tag]
$sel:certificateWallet:ImportCertificate' :: ImportCertificate -> Maybe Base64
$sel:certificatePem:ImportCertificate' :: ImportCertificate -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"CertificatePem" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
certificatePem,
(Key
"CertificateWallet" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Base64
certificateWallet,
(Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
forall a. a -> Maybe a
Prelude.Just
( Key
"CertificateIdentifier"
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
certificateIdentifier
)
]
)
instance Data.ToPath ImportCertificate where
toPath :: ImportCertificate -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ImportCertificate where
toQuery :: ImportCertificate -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ImportCertificateResponse = ImportCertificateResponse'
{
ImportCertificateResponse -> Maybe Certificate
certificate :: Prelude.Maybe Certificate,
ImportCertificateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ImportCertificateResponse -> ImportCertificateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ImportCertificateResponse -> ImportCertificateResponse -> Bool
$c/= :: ImportCertificateResponse -> ImportCertificateResponse -> Bool
== :: ImportCertificateResponse -> ImportCertificateResponse -> Bool
$c== :: ImportCertificateResponse -> ImportCertificateResponse -> Bool
Prelude.Eq, ReadPrec [ImportCertificateResponse]
ReadPrec ImportCertificateResponse
Int -> ReadS ImportCertificateResponse
ReadS [ImportCertificateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ImportCertificateResponse]
$creadListPrec :: ReadPrec [ImportCertificateResponse]
readPrec :: ReadPrec ImportCertificateResponse
$creadPrec :: ReadPrec ImportCertificateResponse
readList :: ReadS [ImportCertificateResponse]
$creadList :: ReadS [ImportCertificateResponse]
readsPrec :: Int -> ReadS ImportCertificateResponse
$creadsPrec :: Int -> ReadS ImportCertificateResponse
Prelude.Read, Int -> ImportCertificateResponse -> ShowS
[ImportCertificateResponse] -> ShowS
ImportCertificateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ImportCertificateResponse] -> ShowS
$cshowList :: [ImportCertificateResponse] -> ShowS
show :: ImportCertificateResponse -> String
$cshow :: ImportCertificateResponse -> String
showsPrec :: Int -> ImportCertificateResponse -> ShowS
$cshowsPrec :: Int -> ImportCertificateResponse -> ShowS
Prelude.Show, forall x.
Rep ImportCertificateResponse x -> ImportCertificateResponse
forall x.
ImportCertificateResponse -> Rep ImportCertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ImportCertificateResponse x -> ImportCertificateResponse
$cfrom :: forall x.
ImportCertificateResponse -> Rep ImportCertificateResponse x
Prelude.Generic)
newImportCertificateResponse ::
Prelude.Int ->
ImportCertificateResponse
newImportCertificateResponse :: Int -> ImportCertificateResponse
newImportCertificateResponse Int
pHttpStatus_ =
ImportCertificateResponse'
{ $sel:certificate:ImportCertificateResponse' :: Maybe Certificate
certificate =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ImportCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
importCertificateResponse_certificate :: Lens.Lens' ImportCertificateResponse (Prelude.Maybe Certificate)
importCertificateResponse_certificate :: Lens' ImportCertificateResponse (Maybe Certificate)
importCertificateResponse_certificate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportCertificateResponse' {Maybe Certificate
certificate :: Maybe Certificate
$sel:certificate:ImportCertificateResponse' :: ImportCertificateResponse -> Maybe Certificate
certificate} -> Maybe Certificate
certificate) (\s :: ImportCertificateResponse
s@ImportCertificateResponse' {} Maybe Certificate
a -> ImportCertificateResponse
s {$sel:certificate:ImportCertificateResponse' :: Maybe Certificate
certificate = Maybe Certificate
a} :: ImportCertificateResponse)
importCertificateResponse_httpStatus :: Lens.Lens' ImportCertificateResponse Prelude.Int
importCertificateResponse_httpStatus :: Lens' ImportCertificateResponse Int
importCertificateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ImportCertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:ImportCertificateResponse' :: ImportCertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ImportCertificateResponse
s@ImportCertificateResponse' {} Int
a -> ImportCertificateResponse
s {$sel:httpStatus:ImportCertificateResponse' :: Int
httpStatus = Int
a} :: ImportCertificateResponse)
instance Prelude.NFData ImportCertificateResponse where
rnf :: ImportCertificateResponse -> ()
rnf ImportCertificateResponse' {Int
Maybe Certificate
httpStatus :: Int
certificate :: Maybe Certificate
$sel:httpStatus:ImportCertificateResponse' :: ImportCertificateResponse -> Int
$sel:certificate:ImportCertificateResponse' :: ImportCertificateResponse -> Maybe Certificate
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Certificate
certificate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus