{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Lightsail.CreateCertificate
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an SSL\/TLS certificate for an Amazon Lightsail content delivery
-- network (CDN) distribution and a container service.
--
-- After the certificate is valid, use the
-- @AttachCertificateToDistribution@ action to use the certificate and its
-- domains with your distribution. Or use the @UpdateContainerService@
-- action to use the certificate and its domains with your container
-- service.
--
-- Only certificates created in the @us-east-1@ AWS Region can be attached
-- to Lightsail distributions. Lightsail distributions are global resources
-- that can reference an origin in any AWS Region, and distribute its
-- content globally. However, all distributions are located in the
-- @us-east-1@ Region.
module Amazonka.Lightsail.CreateCertificate
  ( -- * Creating a Request
    CreateCertificate (..),
    newCreateCertificate,

    -- * Request Lenses
    createCertificate_subjectAlternativeNames,
    createCertificate_tags,
    createCertificate_certificateName,
    createCertificate_domainName,

    -- * Destructuring the Response
    CreateCertificateResponse (..),
    newCreateCertificateResponse,

    -- * Response Lenses
    createCertificateResponse_certificate,
    createCertificateResponse_operations,
    createCertificateResponse_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

-- | /See:/ 'newCreateCertificate' smart constructor.
data CreateCertificate = CreateCertificate'
  { -- | An array of strings that specify the alternate domains (e.g.,
    -- @example2.com@) and subdomains (e.g., @blog.example.com@) for the
    -- certificate.
    --
    -- You can specify a maximum of nine alternate domains (in addition to the
    -- primary domain name).
    --
    -- Wildcard domain entries (e.g., @*.example.com@) are not supported.
    CreateCertificate -> Maybe [Text]
subjectAlternativeNames :: Prelude.Maybe [Prelude.Text],
    -- | The tag keys and optional values to add to the certificate during
    -- create.
    --
    -- Use the @TagResource@ action to tag a resource after it\'s created.
    CreateCertificate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name for the certificate.
    CreateCertificate -> Text
certificateName :: Prelude.Text,
    -- | The domain name (e.g., @example.com@) for the certificate.
    CreateCertificate -> Text
domainName :: Prelude.Text
  }
  deriving (CreateCertificate -> CreateCertificate -> Bool
(CreateCertificate -> CreateCertificate -> Bool)
-> (CreateCertificate -> CreateCertificate -> Bool)
-> Eq CreateCertificate
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]
(Int -> ReadS CreateCertificate)
-> ReadS [CreateCertificate]
-> ReadPrec CreateCertificate
-> ReadPrec [CreateCertificate]
-> Read 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
(Int -> CreateCertificate -> ShowS)
-> (CreateCertificate -> String)
-> ([CreateCertificate] -> ShowS)
-> Show CreateCertificate
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. CreateCertificate -> Rep CreateCertificate x)
-> (forall x. Rep CreateCertificate x -> CreateCertificate)
-> Generic CreateCertificate
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)

-- |
-- Create a value of 'CreateCertificate' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'subjectAlternativeNames', 'createCertificate_subjectAlternativeNames' - An array of strings that specify the alternate domains (e.g.,
-- @example2.com@) and subdomains (e.g., @blog.example.com@) for the
-- certificate.
--
-- You can specify a maximum of nine alternate domains (in addition to the
-- primary domain name).
--
-- Wildcard domain entries (e.g., @*.example.com@) are not supported.
--
-- 'tags', 'createCertificate_tags' - The tag keys and optional values to add to the certificate during
-- create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
--
-- 'certificateName', 'createCertificate_certificateName' - The name for the certificate.
--
-- 'domainName', 'createCertificate_domainName' - The domain name (e.g., @example.com@) for the certificate.
newCreateCertificate ::
  -- | 'certificateName'
  Prelude.Text ->
  -- | 'domainName'
  Prelude.Text ->
  CreateCertificate
newCreateCertificate :: Text -> Text -> CreateCertificate
newCreateCertificate Text
pCertificateName_ Text
pDomainName_ =
  CreateCertificate' :: Maybe [Text] -> Maybe [Tag] -> Text -> Text -> CreateCertificate
CreateCertificate'
    { $sel:subjectAlternativeNames:CreateCertificate' :: Maybe [Text]
subjectAlternativeNames =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:certificateName:CreateCertificate' :: Text
certificateName = Text
pCertificateName_,
      $sel:domainName:CreateCertificate' :: Text
domainName = Text
pDomainName_
    }

-- | An array of strings that specify the alternate domains (e.g.,
-- @example2.com@) and subdomains (e.g., @blog.example.com@) for the
-- certificate.
--
-- You can specify a maximum of nine alternate domains (in addition to the
-- primary domain name).
--
-- Wildcard domain entries (e.g., @*.example.com@) are not supported.
createCertificate_subjectAlternativeNames :: Lens.Lens' CreateCertificate (Prelude.Maybe [Prelude.Text])
createCertificate_subjectAlternativeNames :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateCertificate -> f CreateCertificate
createCertificate_subjectAlternativeNames = (CreateCertificate -> Maybe [Text])
-> (CreateCertificate -> Maybe [Text] -> CreateCertificate)
-> Lens
     CreateCertificate CreateCertificate (Maybe [Text]) (Maybe [Text])
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) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateCertificate -> f CreateCertificate)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateCertificate
-> f CreateCertificate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The tag keys and optional values to add to the certificate during
-- create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
createCertificate_tags :: Lens.Lens' CreateCertificate (Prelude.Maybe [Tag])
createCertificate_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCertificate -> f CreateCertificate
createCertificate_tags = (CreateCertificate -> Maybe [Tag])
-> (CreateCertificate -> Maybe [Tag] -> CreateCertificate)
-> Lens
     CreateCertificate CreateCertificate (Maybe [Tag]) (Maybe [Tag])
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) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateCertificate -> f CreateCertificate)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateCertificate
-> f CreateCertificate
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

-- | The name for the certificate.
createCertificate_certificateName :: Lens.Lens' CreateCertificate Prelude.Text
createCertificate_certificateName :: (Text -> f Text) -> CreateCertificate -> f CreateCertificate
createCertificate_certificateName = (CreateCertificate -> Text)
-> (CreateCertificate -> Text -> CreateCertificate)
-> Lens CreateCertificate CreateCertificate Text Text
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)

-- | The domain name (e.g., @example.com@) for the certificate.
createCertificate_domainName :: Lens.Lens' CreateCertificate Prelude.Text
createCertificate_domainName :: (Text -> f Text) -> CreateCertificate -> f CreateCertificate
createCertificate_domainName = (CreateCertificate -> Text)
-> (CreateCertificate -> Text -> CreateCertificate)
-> Lens CreateCertificate CreateCertificate Text Text
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 :: CreateCertificate -> Request CreateCertificate
request = Service -> CreateCertificate -> Request CreateCertificate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateCertificate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCertificate)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateCertificate))
-> Logger
-> Service
-> Proxy CreateCertificate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCertificate)))
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 CertificateSummary
-> Maybe [Operation] -> Int -> CreateCertificateResponse
CreateCertificateResponse'
            (Maybe CertificateSummary
 -> Maybe [Operation] -> Int -> CreateCertificateResponse)
-> Either String (Maybe CertificateSummary)
-> Either
     String (Maybe [Operation] -> Int -> CreateCertificateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CertificateSummary)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"certificate")
            Either
  String (Maybe [Operation] -> Int -> CreateCertificateResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> CreateCertificateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateCertificateResponse)
-> Either String Int -> Either String CreateCertificateResponse
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 CreateCertificate

instance Prelude.NFData CreateCertificate

instance Core.ToHeaders CreateCertificate where
  toHeaders :: CreateCertificate -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateCertificate -> 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.CreateCertificate" ::
                          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 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
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"subjectAlternativeNames" 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]
subjectAlternativeNames,
            (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
"certificateName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainName)
          ]
      )

instance Core.ToPath CreateCertificate where
  toPath :: CreateCertificate -> ByteString
toPath = ByteString -> CreateCertificate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateCertificate where
  toQuery :: CreateCertificate -> QueryString
toQuery = QueryString -> CreateCertificate -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateCertificateResponse' smart constructor.
data CreateCertificateResponse = CreateCertificateResponse'
  { -- | An object that describes the certificate created.
    CreateCertificateResponse -> Maybe CertificateSummary
certificate :: Prelude.Maybe CertificateSummary,
    -- | An array of objects that describe the result of the action, such as the
    -- status of the request, the timestamp of the request, and the resources
    -- affected by the request.
    CreateCertificateResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
    -- | The response's http status code.
    CreateCertificateResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateCertificateResponse -> CreateCertificateResponse -> Bool
(CreateCertificateResponse -> CreateCertificateResponse -> Bool)
-> (CreateCertificateResponse -> CreateCertificateResponse -> Bool)
-> Eq CreateCertificateResponse
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]
(Int -> ReadS CreateCertificateResponse)
-> ReadS [CreateCertificateResponse]
-> ReadPrec CreateCertificateResponse
-> ReadPrec [CreateCertificateResponse]
-> Read 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
(Int -> CreateCertificateResponse -> ShowS)
-> (CreateCertificateResponse -> String)
-> ([CreateCertificateResponse] -> ShowS)
-> Show CreateCertificateResponse
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.
 CreateCertificateResponse -> Rep CreateCertificateResponse x)
-> (forall x.
    Rep CreateCertificateResponse x -> CreateCertificateResponse)
-> Generic CreateCertificateResponse
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)

-- |
-- Create a value of 'CreateCertificateResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'certificate', 'createCertificateResponse_certificate' - An object that describes the certificate created.
--
-- 'operations', 'createCertificateResponse_operations' - An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
--
-- 'httpStatus', 'createCertificateResponse_httpStatus' - The response's http status code.
newCreateCertificateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCertificateResponse
newCreateCertificateResponse :: Int -> CreateCertificateResponse
newCreateCertificateResponse Int
pHttpStatus_ =
  CreateCertificateResponse' :: Maybe CertificateSummary
-> Maybe [Operation] -> Int -> CreateCertificateResponse
CreateCertificateResponse'
    { $sel:certificate:CreateCertificateResponse' :: Maybe CertificateSummary
certificate =
        Maybe CertificateSummary
forall a. Maybe a
Prelude.Nothing,
      $sel:operations:CreateCertificateResponse' :: Maybe [Operation]
operations = Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that describes the certificate created.
createCertificateResponse_certificate :: Lens.Lens' CreateCertificateResponse (Prelude.Maybe CertificateSummary)
createCertificateResponse_certificate :: (Maybe CertificateSummary -> f (Maybe CertificateSummary))
-> CreateCertificateResponse -> f CreateCertificateResponse
createCertificateResponse_certificate = (CreateCertificateResponse -> Maybe CertificateSummary)
-> (CreateCertificateResponse
    -> Maybe CertificateSummary -> CreateCertificateResponse)
-> Lens
     CreateCertificateResponse
     CreateCertificateResponse
     (Maybe CertificateSummary)
     (Maybe CertificateSummary)
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)

-- | An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
createCertificateResponse_operations :: Lens.Lens' CreateCertificateResponse (Prelude.Maybe [Operation])
createCertificateResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateCertificateResponse -> f CreateCertificateResponse
createCertificateResponse_operations = (CreateCertificateResponse -> Maybe [Operation])
-> (CreateCertificateResponse
    -> Maybe [Operation] -> CreateCertificateResponse)
-> Lens
     CreateCertificateResponse
     CreateCertificateResponse
     (Maybe [Operation])
     (Maybe [Operation])
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) ((Maybe [Operation] -> f (Maybe [Operation]))
 -> CreateCertificateResponse -> f CreateCertificateResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
    -> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateCertificateResponse
-> f CreateCertificateResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
     (Maybe [Operation])
     (Maybe [Operation])
     (Maybe [Operation])
     (Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
createCertificateResponse_httpStatus :: Lens.Lens' CreateCertificateResponse Prelude.Int
createCertificateResponse_httpStatus :: (Int -> f Int)
-> CreateCertificateResponse -> f CreateCertificateResponse
createCertificateResponse_httpStatus = (CreateCertificateResponse -> Int)
-> (CreateCertificateResponse -> Int -> CreateCertificateResponse)
-> Lens CreateCertificateResponse CreateCertificateResponse Int Int
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