{-# 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 Amazonka.DMS.Types
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 ImportCertificate = ImportCertificate'
{
ImportCertificate -> Maybe (Sensitive Text)
certificatePem :: Prelude.Maybe (Core.Sensitive Prelude.Text),
ImportCertificate -> Maybe Base64
certificateWallet :: Prelude.Maybe Core.Base64,
ImportCertificate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
ImportCertificate -> Text
certificateIdentifier :: Prelude.Text
}
deriving (ImportCertificate -> ImportCertificate -> Bool
(ImportCertificate -> ImportCertificate -> Bool)
-> (ImportCertificate -> ImportCertificate -> Bool)
-> Eq ImportCertificate
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
(Int -> ImportCertificate -> ShowS)
-> (ImportCertificate -> String)
-> ([ImportCertificate] -> ShowS)
-> Show ImportCertificate
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. ImportCertificate -> Rep ImportCertificate x)
-> (forall x. Rep ImportCertificate x -> ImportCertificate)
-> Generic ImportCertificate
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' :: Maybe (Sensitive Text)
-> Maybe Base64 -> Maybe [Tag] -> Text -> ImportCertificate
ImportCertificate'
{ $sel:certificatePem:ImportCertificate' :: Maybe (Sensitive Text)
certificatePem =
Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
$sel:certificateWallet:ImportCertificate' :: Maybe Base64
certificateWallet = Maybe Base64
forall a. Maybe a
Prelude.Nothing,
$sel:tags:ImportCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
$sel:certificateIdentifier:ImportCertificate' :: Text
certificateIdentifier = Text
pCertificateIdentifier_
}
importCertificate_certificatePem :: Lens.Lens' ImportCertificate (Prelude.Maybe Prelude.Text)
importCertificate_certificatePem :: (Maybe Text -> f (Maybe Text))
-> ImportCertificate -> f ImportCertificate
importCertificate_certificatePem = (ImportCertificate -> Maybe (Sensitive Text))
-> (ImportCertificate
-> Maybe (Sensitive Text) -> ImportCertificate)
-> Lens
ImportCertificate
ImportCertificate
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
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) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> ImportCertificate -> f ImportCertificate)
-> ((Maybe Text -> f (Maybe Text))
-> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> ImportCertificate
-> f ImportCertificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
(Maybe (Sensitive Text))
(Maybe (Sensitive Text))
(Maybe Text)
(Maybe Text)
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 AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive
importCertificate_certificateWallet :: Lens.Lens' ImportCertificate (Prelude.Maybe Prelude.ByteString)
importCertificate_certificateWallet :: (Maybe ByteString -> f (Maybe ByteString))
-> ImportCertificate -> f ImportCertificate
importCertificate_certificateWallet = (ImportCertificate -> Maybe Base64)
-> (ImportCertificate -> Maybe Base64 -> ImportCertificate)
-> Lens
ImportCertificate ImportCertificate (Maybe Base64) (Maybe Base64)
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) ((Maybe Base64 -> f (Maybe Base64))
-> ImportCertificate -> f ImportCertificate)
-> ((Maybe ByteString -> f (Maybe ByteString))
-> Maybe Base64 -> f (Maybe Base64))
-> (Maybe ByteString -> f (Maybe ByteString))
-> ImportCertificate
-> f ImportCertificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso Base64 Base64 ByteString ByteString
-> Iso
(Maybe Base64) (Maybe Base64) (Maybe ByteString) (Maybe ByteString)
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 AnIso Base64 Base64 ByteString ByteString
Iso' Base64 ByteString
Core._Base64
importCertificate_tags :: Lens.Lens' ImportCertificate (Prelude.Maybe [Tag])
importCertificate_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> ImportCertificate -> f ImportCertificate
importCertificate_tags = (ImportCertificate -> Maybe [Tag])
-> (ImportCertificate -> Maybe [Tag] -> ImportCertificate)
-> Lens
ImportCertificate ImportCertificate (Maybe [Tag]) (Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
-> ImportCertificate -> f ImportCertificate)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
-> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> ImportCertificate
-> f ImportCertificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 AnIso [Tag] [Tag] [Tag] [Tag]
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 :: (Text -> f Text) -> ImportCertificate -> f ImportCertificate
importCertificate_certificateIdentifier = (ImportCertificate -> Text)
-> (ImportCertificate -> Text -> ImportCertificate)
-> Lens ImportCertificate ImportCertificate Text Text
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 :: ImportCertificate -> Request ImportCertificate
request = Service -> ImportCertificate -> Request ImportCertificate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ImportCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportCertificate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ImportCertificate))
-> Logger
-> Service
-> Proxy ImportCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ImportCertificate)))
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 Certificate -> Int -> ImportCertificateResponse
ImportCertificateResponse'
(Maybe Certificate -> Int -> ImportCertificateResponse)
-> Either String (Maybe Certificate)
-> Either String (Int -> ImportCertificateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Certificate)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Certificate")
Either String (Int -> ImportCertificateResponse)
-> Either String Int -> Either String ImportCertificateResponse
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 ImportCertificate
instance Prelude.NFData ImportCertificate
instance Core.ToHeaders ImportCertificate where
toHeaders :: ImportCertificate -> ResponseHeaders
toHeaders =
ResponseHeaders -> ImportCertificate -> 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
"AmazonDMSv20160101.ImportCertificate" ::
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 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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"CertificatePem" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
certificatePem,
(Text
"CertificateWallet" Text -> Base64 -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Base64 -> Pair) -> Maybe Base64 -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Base64
certificateWallet,
(Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Text
"CertificateIdentifier"
Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateIdentifier
)
]
)
instance Core.ToPath ImportCertificate where
toPath :: ImportCertificate -> ByteString
toPath = ByteString -> ImportCertificate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ImportCertificate where
toQuery :: ImportCertificate -> QueryString
toQuery = QueryString -> ImportCertificate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(ImportCertificateResponse -> ImportCertificateResponse -> Bool)
-> (ImportCertificateResponse -> ImportCertificateResponse -> Bool)
-> Eq ImportCertificateResponse
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]
(Int -> ReadS ImportCertificateResponse)
-> ReadS [ImportCertificateResponse]
-> ReadPrec ImportCertificateResponse
-> ReadPrec [ImportCertificateResponse]
-> Read 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
(Int -> ImportCertificateResponse -> ShowS)
-> (ImportCertificateResponse -> String)
-> ([ImportCertificateResponse] -> ShowS)
-> Show ImportCertificateResponse
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.
ImportCertificateResponse -> Rep ImportCertificateResponse x)
-> (forall x.
Rep ImportCertificateResponse x -> ImportCertificateResponse)
-> Generic ImportCertificateResponse
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' :: Maybe Certificate -> Int -> ImportCertificateResponse
ImportCertificateResponse'
{ $sel:certificate:ImportCertificateResponse' :: Maybe Certificate
certificate =
Maybe Certificate
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ImportCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
importCertificateResponse_certificate :: Lens.Lens' ImportCertificateResponse (Prelude.Maybe Certificate)
importCertificateResponse_certificate :: (Maybe Certificate -> f (Maybe Certificate))
-> ImportCertificateResponse -> f ImportCertificateResponse
importCertificateResponse_certificate = (ImportCertificateResponse -> Maybe Certificate)
-> (ImportCertificateResponse
-> Maybe Certificate -> ImportCertificateResponse)
-> Lens
ImportCertificateResponse
ImportCertificateResponse
(Maybe Certificate)
(Maybe 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 :: (Int -> f Int)
-> ImportCertificateResponse -> f ImportCertificateResponse
importCertificateResponse_httpStatus = (ImportCertificateResponse -> Int)
-> (ImportCertificateResponse -> Int -> ImportCertificateResponse)
-> Lens ImportCertificateResponse ImportCertificateResponse Int Int
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