{-# 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.CreateCertificate
(
CreateCertificate (..),
newCreateCertificate,
createCertificate_subjectAlternativeNames,
createCertificate_tags,
createCertificate_certificateName,
createCertificate_domainName,
CreateCertificateResponse (..),
newCreateCertificateResponse,
createCertificateResponse_certificate,
createCertificateResponse_operations,
createCertificateResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Lightsail.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateCertificate = CreateCertificate'
{
CreateCertificate -> Maybe [Text]
subjectAlternativeNames :: Prelude.Maybe [Prelude.Text],
CreateCertificate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
CreateCertificate -> Text
certificateName :: Prelude.Text,
CreateCertificate -> Text
domainName :: Prelude.Text
}
deriving (CreateCertificate -> CreateCertificate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCertificate -> CreateCertificate -> Bool
$c/= :: CreateCertificate -> CreateCertificate -> Bool
== :: CreateCertificate -> CreateCertificate -> Bool
$c== :: CreateCertificate -> CreateCertificate -> Bool
Prelude.Eq, ReadPrec [CreateCertificate]
ReadPrec CreateCertificate
Int -> ReadS CreateCertificate
ReadS [CreateCertificate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCertificate]
$creadListPrec :: ReadPrec [CreateCertificate]
readPrec :: ReadPrec CreateCertificate
$creadPrec :: ReadPrec CreateCertificate
readList :: ReadS [CreateCertificate]
$creadList :: ReadS [CreateCertificate]
readsPrec :: Int -> ReadS CreateCertificate
$creadsPrec :: Int -> ReadS CreateCertificate
Prelude.Read, Int -> CreateCertificate -> ShowS
[CreateCertificate] -> ShowS
CreateCertificate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCertificate] -> ShowS
$cshowList :: [CreateCertificate] -> ShowS
show :: CreateCertificate -> String
$cshow :: CreateCertificate -> String
showsPrec :: Int -> CreateCertificate -> ShowS
$cshowsPrec :: Int -> CreateCertificate -> ShowS
Prelude.Show, forall x. Rep CreateCertificate x -> CreateCertificate
forall x. CreateCertificate -> Rep CreateCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateCertificate x -> CreateCertificate
$cfrom :: forall x. CreateCertificate -> Rep CreateCertificate x
Prelude.Generic)
newCreateCertificate ::
Prelude.Text ->
Prelude.Text ->
CreateCertificate
newCreateCertificate :: Text -> Text -> CreateCertificate
newCreateCertificate Text
pCertificateName_ Text
pDomainName_ =
CreateCertificate'
{ $sel:subjectAlternativeNames:CreateCertificate' :: Maybe [Text]
subjectAlternativeNames =
forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateCertificate' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
$sel:certificateName:CreateCertificate' :: Text
certificateName = Text
pCertificateName_,
$sel:domainName:CreateCertificate' :: Text
domainName = Text
pDomainName_
}
createCertificate_subjectAlternativeNames :: Lens.Lens' CreateCertificate (Prelude.Maybe [Prelude.Text])
createCertificate_subjectAlternativeNames :: Lens' CreateCertificate (Maybe [Text])
createCertificate_subjectAlternativeNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCertificate' {Maybe [Text]
subjectAlternativeNames :: Maybe [Text]
$sel:subjectAlternativeNames:CreateCertificate' :: CreateCertificate -> Maybe [Text]
subjectAlternativeNames} -> Maybe [Text]
subjectAlternativeNames) (\s :: CreateCertificate
s@CreateCertificate' {} Maybe [Text]
a -> CreateCertificate
s {$sel:subjectAlternativeNames:CreateCertificate' :: Maybe [Text]
subjectAlternativeNames = Maybe [Text]
a} :: CreateCertificate) 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
createCertificate_tags :: Lens.Lens' CreateCertificate (Prelude.Maybe [Tag])
createCertificate_tags :: Lens' CreateCertificate (Maybe [Tag])
createCertificate_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCertificate' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateCertificate' :: CreateCertificate -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateCertificate
s@CreateCertificate' {} Maybe [Tag]
a -> CreateCertificate
s {$sel:tags:CreateCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateCertificate) 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
createCertificate_certificateName :: Lens.Lens' CreateCertificate Prelude.Text
createCertificate_certificateName :: Lens' CreateCertificate Text
createCertificate_certificateName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCertificate' {Text
certificateName :: Text
$sel:certificateName:CreateCertificate' :: CreateCertificate -> Text
certificateName} -> Text
certificateName) (\s :: CreateCertificate
s@CreateCertificate' {} Text
a -> CreateCertificate
s {$sel:certificateName:CreateCertificate' :: Text
certificateName = Text
a} :: CreateCertificate)
createCertificate_domainName :: Lens.Lens' CreateCertificate Prelude.Text
createCertificate_domainName :: Lens' CreateCertificate Text
createCertificate_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCertificate' {Text
domainName :: Text
$sel:domainName:CreateCertificate' :: CreateCertificate -> Text
domainName} -> Text
domainName) (\s :: CreateCertificate
s@CreateCertificate' {} Text
a -> CreateCertificate
s {$sel:domainName:CreateCertificate' :: Text
domainName = Text
a} :: CreateCertificate)
instance Core.AWSRequest CreateCertificate where
type
AWSResponse CreateCertificate =
CreateCertificateResponse
request :: (Service -> Service)
-> CreateCertificate -> Request CreateCertificate
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 CreateCertificate
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CreateCertificate)))
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 CertificateSummary
-> Maybe [Operation] -> Int -> CreateCertificateResponse
CreateCertificateResponse'
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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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 CreateCertificate where
hashWithSalt :: Int -> CreateCertificate -> Int
hashWithSalt Int
_salt CreateCertificate' {Maybe [Text]
Maybe [Tag]
Text
domainName :: Text
certificateName :: Text
tags :: Maybe [Tag]
subjectAlternativeNames :: Maybe [Text]
$sel:domainName:CreateCertificate' :: CreateCertificate -> Text
$sel:certificateName:CreateCertificate' :: CreateCertificate -> Text
$sel:tags:CreateCertificate' :: CreateCertificate -> Maybe [Tag]
$sel:subjectAlternativeNames:CreateCertificate' :: CreateCertificate -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subjectAlternativeNames
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
certificateName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName
instance Prelude.NFData CreateCertificate where
rnf :: CreateCertificate -> ()
rnf CreateCertificate' {Maybe [Text]
Maybe [Tag]
Text
domainName :: Text
certificateName :: Text
tags :: Maybe [Tag]
subjectAlternativeNames :: Maybe [Text]
$sel:domainName:CreateCertificate' :: CreateCertificate -> Text
$sel:certificateName:CreateCertificate' :: CreateCertificate -> Text
$sel:tags:CreateCertificate' :: CreateCertificate -> Maybe [Tag]
$sel:subjectAlternativeNames:CreateCertificate' :: CreateCertificate -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subjectAlternativeNames
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
certificateName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainName
instance Data.ToHeaders CreateCertificate where
toHeaders :: CreateCertificate -> 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
"Lightsail_20161128.CreateCertificate" ::
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 CreateCertificate where
toJSON :: CreateCertificate -> Value
toJSON CreateCertificate' {Maybe [Text]
Maybe [Tag]
Text
domainName :: Text
certificateName :: Text
tags :: Maybe [Tag]
subjectAlternativeNames :: Maybe [Text]
$sel:domainName:CreateCertificate' :: CreateCertificate -> Text
$sel:certificateName:CreateCertificate' :: CreateCertificate -> Text
$sel:tags:CreateCertificate' :: CreateCertificate -> Maybe [Tag]
$sel:subjectAlternativeNames:CreateCertificate' :: CreateCertificate -> Maybe [Text]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"subjectAlternativeNames" 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 [Text]
subjectAlternativeNames,
(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
"certificateName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
certificateName),
forall a. a -> Maybe a
Prelude.Just (Key
"domainName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
domainName)
]
)
instance Data.ToPath CreateCertificate where
toPath :: CreateCertificate -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery CreateCertificate where
toQuery :: CreateCertificate -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateCertificateResponse = CreateCertificateResponse'
{
CreateCertificateResponse -> Maybe CertificateSummary
certificate :: Prelude.Maybe CertificateSummary,
CreateCertificateResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
CreateCertificateResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateCertificateResponse -> CreateCertificateResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCertificateResponse -> CreateCertificateResponse -> Bool
$c/= :: CreateCertificateResponse -> CreateCertificateResponse -> Bool
== :: CreateCertificateResponse -> CreateCertificateResponse -> Bool
$c== :: CreateCertificateResponse -> CreateCertificateResponse -> Bool
Prelude.Eq, ReadPrec [CreateCertificateResponse]
ReadPrec CreateCertificateResponse
Int -> ReadS CreateCertificateResponse
ReadS [CreateCertificateResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCertificateResponse]
$creadListPrec :: ReadPrec [CreateCertificateResponse]
readPrec :: ReadPrec CreateCertificateResponse
$creadPrec :: ReadPrec CreateCertificateResponse
readList :: ReadS [CreateCertificateResponse]
$creadList :: ReadS [CreateCertificateResponse]
readsPrec :: Int -> ReadS CreateCertificateResponse
$creadsPrec :: Int -> ReadS CreateCertificateResponse
Prelude.Read, Int -> CreateCertificateResponse -> ShowS
[CreateCertificateResponse] -> ShowS
CreateCertificateResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCertificateResponse] -> ShowS
$cshowList :: [CreateCertificateResponse] -> ShowS
show :: CreateCertificateResponse -> String
$cshow :: CreateCertificateResponse -> String
showsPrec :: Int -> CreateCertificateResponse -> ShowS
$cshowsPrec :: Int -> CreateCertificateResponse -> ShowS
Prelude.Show, forall x.
Rep CreateCertificateResponse x -> CreateCertificateResponse
forall x.
CreateCertificateResponse -> Rep CreateCertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCertificateResponse x -> CreateCertificateResponse
$cfrom :: forall x.
CreateCertificateResponse -> Rep CreateCertificateResponse x
Prelude.Generic)
newCreateCertificateResponse ::
Prelude.Int ->
CreateCertificateResponse
newCreateCertificateResponse :: Int -> CreateCertificateResponse
newCreateCertificateResponse Int
pHttpStatus_ =
CreateCertificateResponse'
{ $sel:certificate:CreateCertificateResponse' :: Maybe CertificateSummary
certificate =
forall a. Maybe a
Prelude.Nothing,
$sel:operations:CreateCertificateResponse' :: Maybe [Operation]
operations = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createCertificateResponse_certificate :: Lens.Lens' CreateCertificateResponse (Prelude.Maybe CertificateSummary)
createCertificateResponse_certificate :: Lens' CreateCertificateResponse (Maybe CertificateSummary)
createCertificateResponse_certificate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCertificateResponse' {Maybe CertificateSummary
certificate :: Maybe CertificateSummary
$sel:certificate:CreateCertificateResponse' :: CreateCertificateResponse -> Maybe CertificateSummary
certificate} -> Maybe CertificateSummary
certificate) (\s :: CreateCertificateResponse
s@CreateCertificateResponse' {} Maybe CertificateSummary
a -> CreateCertificateResponse
s {$sel:certificate:CreateCertificateResponse' :: Maybe CertificateSummary
certificate = Maybe CertificateSummary
a} :: CreateCertificateResponse)
createCertificateResponse_operations :: Lens.Lens' CreateCertificateResponse (Prelude.Maybe [Operation])
createCertificateResponse_operations :: Lens' CreateCertificateResponse (Maybe [Operation])
createCertificateResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCertificateResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateCertificateResponse' :: CreateCertificateResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateCertificateResponse
s@CreateCertificateResponse' {} Maybe [Operation]
a -> CreateCertificateResponse
s {$sel:operations:CreateCertificateResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateCertificateResponse) 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
createCertificateResponse_httpStatus :: Lens.Lens' CreateCertificateResponse Prelude.Int
createCertificateResponse_httpStatus :: Lens' CreateCertificateResponse Int
createCertificateResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateCertificateResponse' :: CreateCertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateCertificateResponse
s@CreateCertificateResponse' {} Int
a -> CreateCertificateResponse
s {$sel:httpStatus:CreateCertificateResponse' :: Int
httpStatus = Int
a} :: CreateCertificateResponse)
instance Prelude.NFData CreateCertificateResponse where
rnf :: CreateCertificateResponse -> ()
rnf CreateCertificateResponse' {Int
Maybe [Operation]
Maybe CertificateSummary
httpStatus :: Int
operations :: Maybe [Operation]
certificate :: Maybe CertificateSummary
$sel:httpStatus:CreateCertificateResponse' :: CreateCertificateResponse -> Int
$sel:operations:CreateCertificateResponse' :: CreateCertificateResponse -> Maybe [Operation]
$sel:certificate:CreateCertificateResponse' :: CreateCertificateResponse -> Maybe CertificateSummary
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe CertificateSummary
certificate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Operation]
operations
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus