{-# 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.Lightsail.AttachCertificateToDistribution
(
AttachCertificateToDistribution (..),
newAttachCertificateToDistribution,
attachCertificateToDistribution_distributionName,
attachCertificateToDistribution_certificateName,
AttachCertificateToDistributionResponse (..),
newAttachCertificateToDistributionResponse,
attachCertificateToDistributionResponse_operation,
attachCertificateToDistributionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AttachCertificateToDistribution = AttachCertificateToDistribution'
{
AttachCertificateToDistribution -> Text
distributionName :: Prelude.Text,
AttachCertificateToDistribution -> Text
certificateName :: Prelude.Text
}
deriving (AttachCertificateToDistribution
-> AttachCertificateToDistribution -> Bool
(AttachCertificateToDistribution
-> AttachCertificateToDistribution -> Bool)
-> (AttachCertificateToDistribution
-> AttachCertificateToDistribution -> Bool)
-> Eq AttachCertificateToDistribution
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachCertificateToDistribution
-> AttachCertificateToDistribution -> Bool
$c/= :: AttachCertificateToDistribution
-> AttachCertificateToDistribution -> Bool
== :: AttachCertificateToDistribution
-> AttachCertificateToDistribution -> Bool
$c== :: AttachCertificateToDistribution
-> AttachCertificateToDistribution -> Bool
Prelude.Eq, ReadPrec [AttachCertificateToDistribution]
ReadPrec AttachCertificateToDistribution
Int -> ReadS AttachCertificateToDistribution
ReadS [AttachCertificateToDistribution]
(Int -> ReadS AttachCertificateToDistribution)
-> ReadS [AttachCertificateToDistribution]
-> ReadPrec AttachCertificateToDistribution
-> ReadPrec [AttachCertificateToDistribution]
-> Read AttachCertificateToDistribution
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachCertificateToDistribution]
$creadListPrec :: ReadPrec [AttachCertificateToDistribution]
readPrec :: ReadPrec AttachCertificateToDistribution
$creadPrec :: ReadPrec AttachCertificateToDistribution
readList :: ReadS [AttachCertificateToDistribution]
$creadList :: ReadS [AttachCertificateToDistribution]
readsPrec :: Int -> ReadS AttachCertificateToDistribution
$creadsPrec :: Int -> ReadS AttachCertificateToDistribution
Prelude.Read, Int -> AttachCertificateToDistribution -> ShowS
[AttachCertificateToDistribution] -> ShowS
AttachCertificateToDistribution -> String
(Int -> AttachCertificateToDistribution -> ShowS)
-> (AttachCertificateToDistribution -> String)
-> ([AttachCertificateToDistribution] -> ShowS)
-> Show AttachCertificateToDistribution
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachCertificateToDistribution] -> ShowS
$cshowList :: [AttachCertificateToDistribution] -> ShowS
show :: AttachCertificateToDistribution -> String
$cshow :: AttachCertificateToDistribution -> String
showsPrec :: Int -> AttachCertificateToDistribution -> ShowS
$cshowsPrec :: Int -> AttachCertificateToDistribution -> ShowS
Prelude.Show, (forall x.
AttachCertificateToDistribution
-> Rep AttachCertificateToDistribution x)
-> (forall x.
Rep AttachCertificateToDistribution x
-> AttachCertificateToDistribution)
-> Generic AttachCertificateToDistribution
forall x.
Rep AttachCertificateToDistribution x
-> AttachCertificateToDistribution
forall x.
AttachCertificateToDistribution
-> Rep AttachCertificateToDistribution x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AttachCertificateToDistribution x
-> AttachCertificateToDistribution
$cfrom :: forall x.
AttachCertificateToDistribution
-> Rep AttachCertificateToDistribution x
Prelude.Generic)
newAttachCertificateToDistribution ::
Prelude.Text ->
Prelude.Text ->
AttachCertificateToDistribution
newAttachCertificateToDistribution :: Text -> Text -> AttachCertificateToDistribution
newAttachCertificateToDistribution
Text
pDistributionName_
Text
pCertificateName_ =
AttachCertificateToDistribution' :: Text -> Text -> AttachCertificateToDistribution
AttachCertificateToDistribution'
{ $sel:distributionName:AttachCertificateToDistribution' :: Text
distributionName =
Text
pDistributionName_,
$sel:certificateName:AttachCertificateToDistribution' :: Text
certificateName = Text
pCertificateName_
}
attachCertificateToDistribution_distributionName :: Lens.Lens' AttachCertificateToDistribution Prelude.Text
attachCertificateToDistribution_distributionName :: (Text -> f Text)
-> AttachCertificateToDistribution
-> f AttachCertificateToDistribution
attachCertificateToDistribution_distributionName = (AttachCertificateToDistribution -> Text)
-> (AttachCertificateToDistribution
-> Text -> AttachCertificateToDistribution)
-> Lens
AttachCertificateToDistribution
AttachCertificateToDistribution
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachCertificateToDistribution' {Text
distributionName :: Text
$sel:distributionName:AttachCertificateToDistribution' :: AttachCertificateToDistribution -> Text
distributionName} -> Text
distributionName) (\s :: AttachCertificateToDistribution
s@AttachCertificateToDistribution' {} Text
a -> AttachCertificateToDistribution
s {$sel:distributionName:AttachCertificateToDistribution' :: Text
distributionName = Text
a} :: AttachCertificateToDistribution)
attachCertificateToDistribution_certificateName :: Lens.Lens' AttachCertificateToDistribution Prelude.Text
attachCertificateToDistribution_certificateName :: (Text -> f Text)
-> AttachCertificateToDistribution
-> f AttachCertificateToDistribution
attachCertificateToDistribution_certificateName = (AttachCertificateToDistribution -> Text)
-> (AttachCertificateToDistribution
-> Text -> AttachCertificateToDistribution)
-> Lens
AttachCertificateToDistribution
AttachCertificateToDistribution
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachCertificateToDistribution' {Text
certificateName :: Text
$sel:certificateName:AttachCertificateToDistribution' :: AttachCertificateToDistribution -> Text
certificateName} -> Text
certificateName) (\s :: AttachCertificateToDistribution
s@AttachCertificateToDistribution' {} Text
a -> AttachCertificateToDistribution
s {$sel:certificateName:AttachCertificateToDistribution' :: Text
certificateName = Text
a} :: AttachCertificateToDistribution)
instance
Core.AWSRequest
AttachCertificateToDistribution
where
type
AWSResponse AttachCertificateToDistribution =
AttachCertificateToDistributionResponse
request :: AttachCertificateToDistribution
-> Request AttachCertificateToDistribution
request = Service
-> AttachCertificateToDistribution
-> Request AttachCertificateToDistribution
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AttachCertificateToDistribution
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse AttachCertificateToDistribution)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AttachCertificateToDistribution))
-> Logger
-> Service
-> Proxy AttachCertificateToDistribution
-> ClientResponse ClientBody
-> m (Either
Error
(ClientResponse (AWSResponse AttachCertificateToDistribution)))
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 Operation -> Int -> AttachCertificateToDistributionResponse
AttachCertificateToDistributionResponse'
(Maybe Operation -> Int -> AttachCertificateToDistributionResponse)
-> Either String (Maybe Operation)
-> Either String (Int -> AttachCertificateToDistributionResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Operation)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operation")
Either String (Int -> AttachCertificateToDistributionResponse)
-> Either String Int
-> Either String AttachCertificateToDistributionResponse
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
AttachCertificateToDistribution
instance
Prelude.NFData
AttachCertificateToDistribution
instance
Core.ToHeaders
AttachCertificateToDistribution
where
toHeaders :: AttachCertificateToDistribution -> ResponseHeaders
toHeaders =
ResponseHeaders
-> AttachCertificateToDistribution -> 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
"Lightsail_20161128.AttachCertificateToDistribution" ::
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 AttachCertificateToDistribution where
toJSON :: AttachCertificateToDistribution -> Value
toJSON AttachCertificateToDistribution' {Text
certificateName :: Text
distributionName :: Text
$sel:certificateName:AttachCertificateToDistribution' :: AttachCertificateToDistribution -> Text
$sel:distributionName:AttachCertificateToDistribution' :: AttachCertificateToDistribution -> 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
"distributionName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
distributionName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"certificateName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateName)
]
)
instance Core.ToPath AttachCertificateToDistribution where
toPath :: AttachCertificateToDistribution -> ByteString
toPath = ByteString -> AttachCertificateToDistribution -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AttachCertificateToDistribution where
toQuery :: AttachCertificateToDistribution -> QueryString
toQuery = QueryString -> AttachCertificateToDistribution -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AttachCertificateToDistributionResponse = AttachCertificateToDistributionResponse'
{
AttachCertificateToDistributionResponse -> Maybe Operation
operation :: Prelude.Maybe Operation,
AttachCertificateToDistributionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AttachCertificateToDistributionResponse
-> AttachCertificateToDistributionResponse -> Bool
(AttachCertificateToDistributionResponse
-> AttachCertificateToDistributionResponse -> Bool)
-> (AttachCertificateToDistributionResponse
-> AttachCertificateToDistributionResponse -> Bool)
-> Eq AttachCertificateToDistributionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttachCertificateToDistributionResponse
-> AttachCertificateToDistributionResponse -> Bool
$c/= :: AttachCertificateToDistributionResponse
-> AttachCertificateToDistributionResponse -> Bool
== :: AttachCertificateToDistributionResponse
-> AttachCertificateToDistributionResponse -> Bool
$c== :: AttachCertificateToDistributionResponse
-> AttachCertificateToDistributionResponse -> Bool
Prelude.Eq, ReadPrec [AttachCertificateToDistributionResponse]
ReadPrec AttachCertificateToDistributionResponse
Int -> ReadS AttachCertificateToDistributionResponse
ReadS [AttachCertificateToDistributionResponse]
(Int -> ReadS AttachCertificateToDistributionResponse)
-> ReadS [AttachCertificateToDistributionResponse]
-> ReadPrec AttachCertificateToDistributionResponse
-> ReadPrec [AttachCertificateToDistributionResponse]
-> Read AttachCertificateToDistributionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AttachCertificateToDistributionResponse]
$creadListPrec :: ReadPrec [AttachCertificateToDistributionResponse]
readPrec :: ReadPrec AttachCertificateToDistributionResponse
$creadPrec :: ReadPrec AttachCertificateToDistributionResponse
readList :: ReadS [AttachCertificateToDistributionResponse]
$creadList :: ReadS [AttachCertificateToDistributionResponse]
readsPrec :: Int -> ReadS AttachCertificateToDistributionResponse
$creadsPrec :: Int -> ReadS AttachCertificateToDistributionResponse
Prelude.Read, Int -> AttachCertificateToDistributionResponse -> ShowS
[AttachCertificateToDistributionResponse] -> ShowS
AttachCertificateToDistributionResponse -> String
(Int -> AttachCertificateToDistributionResponse -> ShowS)
-> (AttachCertificateToDistributionResponse -> String)
-> ([AttachCertificateToDistributionResponse] -> ShowS)
-> Show AttachCertificateToDistributionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AttachCertificateToDistributionResponse] -> ShowS
$cshowList :: [AttachCertificateToDistributionResponse] -> ShowS
show :: AttachCertificateToDistributionResponse -> String
$cshow :: AttachCertificateToDistributionResponse -> String
showsPrec :: Int -> AttachCertificateToDistributionResponse -> ShowS
$cshowsPrec :: Int -> AttachCertificateToDistributionResponse -> ShowS
Prelude.Show, (forall x.
AttachCertificateToDistributionResponse
-> Rep AttachCertificateToDistributionResponse x)
-> (forall x.
Rep AttachCertificateToDistributionResponse x
-> AttachCertificateToDistributionResponse)
-> Generic AttachCertificateToDistributionResponse
forall x.
Rep AttachCertificateToDistributionResponse x
-> AttachCertificateToDistributionResponse
forall x.
AttachCertificateToDistributionResponse
-> Rep AttachCertificateToDistributionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AttachCertificateToDistributionResponse x
-> AttachCertificateToDistributionResponse
$cfrom :: forall x.
AttachCertificateToDistributionResponse
-> Rep AttachCertificateToDistributionResponse x
Prelude.Generic)
newAttachCertificateToDistributionResponse ::
Prelude.Int ->
AttachCertificateToDistributionResponse
newAttachCertificateToDistributionResponse :: Int -> AttachCertificateToDistributionResponse
newAttachCertificateToDistributionResponse
Int
pHttpStatus_ =
AttachCertificateToDistributionResponse' :: Maybe Operation -> Int -> AttachCertificateToDistributionResponse
AttachCertificateToDistributionResponse'
{ $sel:operation:AttachCertificateToDistributionResponse' :: Maybe Operation
operation =
Maybe Operation
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AttachCertificateToDistributionResponse' :: Int
httpStatus = Int
pHttpStatus_
}
attachCertificateToDistributionResponse_operation :: Lens.Lens' AttachCertificateToDistributionResponse (Prelude.Maybe Operation)
attachCertificateToDistributionResponse_operation :: (Maybe Operation -> f (Maybe Operation))
-> AttachCertificateToDistributionResponse
-> f AttachCertificateToDistributionResponse
attachCertificateToDistributionResponse_operation = (AttachCertificateToDistributionResponse -> Maybe Operation)
-> (AttachCertificateToDistributionResponse
-> Maybe Operation -> AttachCertificateToDistributionResponse)
-> Lens
AttachCertificateToDistributionResponse
AttachCertificateToDistributionResponse
(Maybe Operation)
(Maybe Operation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachCertificateToDistributionResponse' {Maybe Operation
operation :: Maybe Operation
$sel:operation:AttachCertificateToDistributionResponse' :: AttachCertificateToDistributionResponse -> Maybe Operation
operation} -> Maybe Operation
operation) (\s :: AttachCertificateToDistributionResponse
s@AttachCertificateToDistributionResponse' {} Maybe Operation
a -> AttachCertificateToDistributionResponse
s {$sel:operation:AttachCertificateToDistributionResponse' :: Maybe Operation
operation = Maybe Operation
a} :: AttachCertificateToDistributionResponse)
attachCertificateToDistributionResponse_httpStatus :: Lens.Lens' AttachCertificateToDistributionResponse Prelude.Int
attachCertificateToDistributionResponse_httpStatus :: (Int -> f Int)
-> AttachCertificateToDistributionResponse
-> f AttachCertificateToDistributionResponse
attachCertificateToDistributionResponse_httpStatus = (AttachCertificateToDistributionResponse -> Int)
-> (AttachCertificateToDistributionResponse
-> Int -> AttachCertificateToDistributionResponse)
-> Lens
AttachCertificateToDistributionResponse
AttachCertificateToDistributionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AttachCertificateToDistributionResponse' {Int
httpStatus :: Int
$sel:httpStatus:AttachCertificateToDistributionResponse' :: AttachCertificateToDistributionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AttachCertificateToDistributionResponse
s@AttachCertificateToDistributionResponse' {} Int
a -> AttachCertificateToDistributionResponse
s {$sel:httpStatus:AttachCertificateToDistributionResponse' :: Int
httpStatus = Int
a} :: AttachCertificateToDistributionResponse)
instance
Prelude.NFData
AttachCertificateToDistributionResponse