{-# 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.IoT.TransferCertificate
(
TransferCertificate (..),
newTransferCertificate,
transferCertificate_transferMessage,
transferCertificate_certificateId,
transferCertificate_targetAwsAccount,
TransferCertificateResponse (..),
newTransferCertificateResponse,
transferCertificateResponse_transferredCertificateArn,
transferCertificateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.IoT.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 TransferCertificate = TransferCertificate'
{
TransferCertificate -> Maybe Text
transferMessage :: Prelude.Maybe Prelude.Text,
TransferCertificate -> Text
certificateId :: Prelude.Text,
TransferCertificate -> Text
targetAwsAccount :: Prelude.Text
}
deriving (TransferCertificate -> TransferCertificate -> Bool
(TransferCertificate -> TransferCertificate -> Bool)
-> (TransferCertificate -> TransferCertificate -> Bool)
-> Eq TransferCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransferCertificate -> TransferCertificate -> Bool
$c/= :: TransferCertificate -> TransferCertificate -> Bool
== :: TransferCertificate -> TransferCertificate -> Bool
$c== :: TransferCertificate -> TransferCertificate -> Bool
Prelude.Eq, ReadPrec [TransferCertificate]
ReadPrec TransferCertificate
Int -> ReadS TransferCertificate
ReadS [TransferCertificate]
(Int -> ReadS TransferCertificate)
-> ReadS [TransferCertificate]
-> ReadPrec TransferCertificate
-> ReadPrec [TransferCertificate]
-> Read TransferCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransferCertificate]
$creadListPrec :: ReadPrec [TransferCertificate]
readPrec :: ReadPrec TransferCertificate
$creadPrec :: ReadPrec TransferCertificate
readList :: ReadS [TransferCertificate]
$creadList :: ReadS [TransferCertificate]
readsPrec :: Int -> ReadS TransferCertificate
$creadsPrec :: Int -> ReadS TransferCertificate
Prelude.Read, Int -> TransferCertificate -> ShowS
[TransferCertificate] -> ShowS
TransferCertificate -> String
(Int -> TransferCertificate -> ShowS)
-> (TransferCertificate -> String)
-> ([TransferCertificate] -> ShowS)
-> Show TransferCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransferCertificate] -> ShowS
$cshowList :: [TransferCertificate] -> ShowS
show :: TransferCertificate -> String
$cshow :: TransferCertificate -> String
showsPrec :: Int -> TransferCertificate -> ShowS
$cshowsPrec :: Int -> TransferCertificate -> ShowS
Prelude.Show, (forall x. TransferCertificate -> Rep TransferCertificate x)
-> (forall x. Rep TransferCertificate x -> TransferCertificate)
-> Generic TransferCertificate
forall x. Rep TransferCertificate x -> TransferCertificate
forall x. TransferCertificate -> Rep TransferCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TransferCertificate x -> TransferCertificate
$cfrom :: forall x. TransferCertificate -> Rep TransferCertificate x
Prelude.Generic)
newTransferCertificate ::
Prelude.Text ->
Prelude.Text ->
TransferCertificate
newTransferCertificate :: Text -> Text -> TransferCertificate
newTransferCertificate
Text
pCertificateId_
Text
pTargetAwsAccount_ =
TransferCertificate' :: Maybe Text -> Text -> Text -> TransferCertificate
TransferCertificate'
{ $sel:transferMessage:TransferCertificate' :: Maybe Text
transferMessage =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:certificateId:TransferCertificate' :: Text
certificateId = Text
pCertificateId_,
$sel:targetAwsAccount:TransferCertificate' :: Text
targetAwsAccount = Text
pTargetAwsAccount_
}
transferCertificate_transferMessage :: Lens.Lens' TransferCertificate (Prelude.Maybe Prelude.Text)
transferCertificate_transferMessage :: (Maybe Text -> f (Maybe Text))
-> TransferCertificate -> f TransferCertificate
transferCertificate_transferMessage = (TransferCertificate -> Maybe Text)
-> (TransferCertificate -> Maybe Text -> TransferCertificate)
-> Lens
TransferCertificate TransferCertificate (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferCertificate' {Maybe Text
transferMessage :: Maybe Text
$sel:transferMessage:TransferCertificate' :: TransferCertificate -> Maybe Text
transferMessage} -> Maybe Text
transferMessage) (\s :: TransferCertificate
s@TransferCertificate' {} Maybe Text
a -> TransferCertificate
s {$sel:transferMessage:TransferCertificate' :: Maybe Text
transferMessage = Maybe Text
a} :: TransferCertificate)
transferCertificate_certificateId :: Lens.Lens' TransferCertificate Prelude.Text
transferCertificate_certificateId :: (Text -> f Text) -> TransferCertificate -> f TransferCertificate
transferCertificate_certificateId = (TransferCertificate -> Text)
-> (TransferCertificate -> Text -> TransferCertificate)
-> Lens TransferCertificate TransferCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferCertificate' {Text
certificateId :: Text
$sel:certificateId:TransferCertificate' :: TransferCertificate -> Text
certificateId} -> Text
certificateId) (\s :: TransferCertificate
s@TransferCertificate' {} Text
a -> TransferCertificate
s {$sel:certificateId:TransferCertificate' :: Text
certificateId = Text
a} :: TransferCertificate)
transferCertificate_targetAwsAccount :: Lens.Lens' TransferCertificate Prelude.Text
transferCertificate_targetAwsAccount :: (Text -> f Text) -> TransferCertificate -> f TransferCertificate
transferCertificate_targetAwsAccount = (TransferCertificate -> Text)
-> (TransferCertificate -> Text -> TransferCertificate)
-> Lens TransferCertificate TransferCertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferCertificate' {Text
targetAwsAccount :: Text
$sel:targetAwsAccount:TransferCertificate' :: TransferCertificate -> Text
targetAwsAccount} -> Text
targetAwsAccount) (\s :: TransferCertificate
s@TransferCertificate' {} Text
a -> TransferCertificate
s {$sel:targetAwsAccount:TransferCertificate' :: Text
targetAwsAccount = Text
a} :: TransferCertificate)
instance Core.AWSRequest TransferCertificate where
type
AWSResponse TransferCertificate =
TransferCertificateResponse
request :: TransferCertificate -> Request TransferCertificate
request = Service -> TransferCertificate -> Request TransferCertificate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON Service
defaultService
response :: Logger
-> Service
-> Proxy TransferCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse TransferCertificate)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse TransferCertificate))
-> Logger
-> Service
-> Proxy TransferCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse TransferCertificate)))
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 -> TransferCertificateResponse
TransferCertificateResponse'
(Maybe Text -> Int -> TransferCertificateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> TransferCertificateResponse)
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
"transferredCertificateArn")
Either String (Int -> TransferCertificateResponse)
-> Either String Int -> Either String TransferCertificateResponse
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 TransferCertificate
instance Prelude.NFData TransferCertificate
instance Core.ToHeaders TransferCertificate where
toHeaders :: TransferCertificate -> ResponseHeaders
toHeaders = ResponseHeaders -> TransferCertificate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON TransferCertificate where
toJSON :: TransferCertificate -> Value
toJSON TransferCertificate' {Maybe Text
Text
targetAwsAccount :: Text
certificateId :: Text
transferMessage :: Maybe Text
$sel:targetAwsAccount:TransferCertificate' :: TransferCertificate -> Text
$sel:certificateId:TransferCertificate' :: TransferCertificate -> Text
$sel:transferMessage:TransferCertificate' :: TransferCertificate -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"transferMessage" 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
transferMessage
]
)
instance Core.ToPath TransferCertificate where
toPath :: TransferCertificate -> ByteString
toPath TransferCertificate' {Maybe Text
Text
targetAwsAccount :: Text
certificateId :: Text
transferMessage :: Maybe Text
$sel:targetAwsAccount:TransferCertificate' :: TransferCertificate -> Text
$sel:certificateId:TransferCertificate' :: TransferCertificate -> Text
$sel:transferMessage:TransferCertificate' :: TransferCertificate -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/transfer-certificate/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
certificateId]
instance Core.ToQuery TransferCertificate where
toQuery :: TransferCertificate -> QueryString
toQuery TransferCertificate' {Maybe Text
Text
targetAwsAccount :: Text
certificateId :: Text
transferMessage :: Maybe Text
$sel:targetAwsAccount:TransferCertificate' :: TransferCertificate -> Text
$sel:certificateId:TransferCertificate' :: TransferCertificate -> Text
$sel:transferMessage:TransferCertificate' :: TransferCertificate -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"targetAwsAccount" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
targetAwsAccount]
data TransferCertificateResponse = TransferCertificateResponse'
{
TransferCertificateResponse -> Maybe Text
transferredCertificateArn :: Prelude.Maybe Prelude.Text,
TransferCertificateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TransferCertificateResponse -> TransferCertificateResponse -> Bool
(TransferCertificateResponse
-> TransferCertificateResponse -> Bool)
-> (TransferCertificateResponse
-> TransferCertificateResponse -> Bool)
-> Eq TransferCertificateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransferCertificateResponse -> TransferCertificateResponse -> Bool
$c/= :: TransferCertificateResponse -> TransferCertificateResponse -> Bool
== :: TransferCertificateResponse -> TransferCertificateResponse -> Bool
$c== :: TransferCertificateResponse -> TransferCertificateResponse -> Bool
Prelude.Eq, ReadPrec [TransferCertificateResponse]
ReadPrec TransferCertificateResponse
Int -> ReadS TransferCertificateResponse
ReadS [TransferCertificateResponse]
(Int -> ReadS TransferCertificateResponse)
-> ReadS [TransferCertificateResponse]
-> ReadPrec TransferCertificateResponse
-> ReadPrec [TransferCertificateResponse]
-> Read TransferCertificateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransferCertificateResponse]
$creadListPrec :: ReadPrec [TransferCertificateResponse]
readPrec :: ReadPrec TransferCertificateResponse
$creadPrec :: ReadPrec TransferCertificateResponse
readList :: ReadS [TransferCertificateResponse]
$creadList :: ReadS [TransferCertificateResponse]
readsPrec :: Int -> ReadS TransferCertificateResponse
$creadsPrec :: Int -> ReadS TransferCertificateResponse
Prelude.Read, Int -> TransferCertificateResponse -> ShowS
[TransferCertificateResponse] -> ShowS
TransferCertificateResponse -> String
(Int -> TransferCertificateResponse -> ShowS)
-> (TransferCertificateResponse -> String)
-> ([TransferCertificateResponse] -> ShowS)
-> Show TransferCertificateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransferCertificateResponse] -> ShowS
$cshowList :: [TransferCertificateResponse] -> ShowS
show :: TransferCertificateResponse -> String
$cshow :: TransferCertificateResponse -> String
showsPrec :: Int -> TransferCertificateResponse -> ShowS
$cshowsPrec :: Int -> TransferCertificateResponse -> ShowS
Prelude.Show, (forall x.
TransferCertificateResponse -> Rep TransferCertificateResponse x)
-> (forall x.
Rep TransferCertificateResponse x -> TransferCertificateResponse)
-> Generic TransferCertificateResponse
forall x.
Rep TransferCertificateResponse x -> TransferCertificateResponse
forall x.
TransferCertificateResponse -> Rep TransferCertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransferCertificateResponse x -> TransferCertificateResponse
$cfrom :: forall x.
TransferCertificateResponse -> Rep TransferCertificateResponse x
Prelude.Generic)
newTransferCertificateResponse ::
Prelude.Int ->
TransferCertificateResponse
newTransferCertificateResponse :: Int -> TransferCertificateResponse
newTransferCertificateResponse Int
pHttpStatus_ =
TransferCertificateResponse' :: Maybe Text -> Int -> TransferCertificateResponse
TransferCertificateResponse'
{ $sel:transferredCertificateArn:TransferCertificateResponse' :: Maybe Text
transferredCertificateArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TransferCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
transferCertificateResponse_transferredCertificateArn :: Lens.Lens' TransferCertificateResponse (Prelude.Maybe Prelude.Text)
transferCertificateResponse_transferredCertificateArn :: (Maybe Text -> f (Maybe Text))
-> TransferCertificateResponse -> f TransferCertificateResponse
transferCertificateResponse_transferredCertificateArn = (TransferCertificateResponse -> Maybe Text)
-> (TransferCertificateResponse
-> Maybe Text -> TransferCertificateResponse)
-> Lens
TransferCertificateResponse
TransferCertificateResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferCertificateResponse' {Maybe Text
transferredCertificateArn :: Maybe Text
$sel:transferredCertificateArn:TransferCertificateResponse' :: TransferCertificateResponse -> Maybe Text
transferredCertificateArn} -> Maybe Text
transferredCertificateArn) (\s :: TransferCertificateResponse
s@TransferCertificateResponse' {} Maybe Text
a -> TransferCertificateResponse
s {$sel:transferredCertificateArn:TransferCertificateResponse' :: Maybe Text
transferredCertificateArn = Maybe Text
a} :: TransferCertificateResponse)
transferCertificateResponse_httpStatus :: Lens.Lens' TransferCertificateResponse Prelude.Int
transferCertificateResponse_httpStatus :: (Int -> f Int)
-> TransferCertificateResponse -> f TransferCertificateResponse
transferCertificateResponse_httpStatus = (TransferCertificateResponse -> Int)
-> (TransferCertificateResponse
-> Int -> TransferCertificateResponse)
-> Lens
TransferCertificateResponse TransferCertificateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferCertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:TransferCertificateResponse' :: TransferCertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TransferCertificateResponse
s@TransferCertificateResponse' {} Int
a -> TransferCertificateResponse
s {$sel:httpStatus:TransferCertificateResponse' :: Int
httpStatus = Int
a} :: TransferCertificateResponse)
instance Prelude.NFData TransferCertificateResponse