{-# 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.CreateLoadBalancerTlsCertificate
-- 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 load balancer.
--
-- TLS is just an updated, more secure version of Secure Socket Layer
-- (SSL).
--
-- The @CreateLoadBalancerTlsCertificate@ operation supports tag-based
-- access control via resource tags applied to the resource identified by
-- @load balancer name@. For more information, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-controlling-access-using-tags Amazon Lightsail Developer Guide>.
module Amazonka.Lightsail.CreateLoadBalancerTlsCertificate
  ( -- * Creating a Request
    CreateLoadBalancerTlsCertificate (..),
    newCreateLoadBalancerTlsCertificate,

    -- * Request Lenses
    createLoadBalancerTlsCertificate_certificateAlternativeNames,
    createLoadBalancerTlsCertificate_tags,
    createLoadBalancerTlsCertificate_loadBalancerName,
    createLoadBalancerTlsCertificate_certificateName,
    createLoadBalancerTlsCertificate_certificateDomainName,

    -- * Destructuring the Response
    CreateLoadBalancerTlsCertificateResponse (..),
    newCreateLoadBalancerTlsCertificateResponse,

    -- * Response Lenses
    createLoadBalancerTlsCertificateResponse_operations,
    createLoadBalancerTlsCertificateResponse_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:/ 'newCreateLoadBalancerTlsCertificate' smart constructor.
data CreateLoadBalancerTlsCertificate = CreateLoadBalancerTlsCertificate'
  { -- | An array of strings listing alternative domains and subdomains for your
    -- SSL\/TLS certificate. Lightsail will de-dupe the names for you. You can
    -- have a maximum of 9 alternative names (in addition to the 1 primary
    -- domain). We do not support wildcards (e.g., @*.example.com@).
    CreateLoadBalancerTlsCertificate -> Maybe [Text]
certificateAlternativeNames :: Prelude.Maybe [Prelude.Text],
    -- | The tag keys and optional values to add to the resource during create.
    --
    -- Use the @TagResource@ action to tag a resource after it\'s created.
    CreateLoadBalancerTlsCertificate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The load balancer name where you want to create the SSL\/TLS
    -- certificate.
    CreateLoadBalancerTlsCertificate -> Text
loadBalancerName :: Prelude.Text,
    -- | The SSL\/TLS certificate name.
    --
    -- You can have up to 10 certificates in your account at one time. Each
    -- Lightsail load balancer can have up to 2 certificates associated with it
    -- at one time. There is also an overall limit to the number of
    -- certificates that can be issue in a 365-day period. For more
    -- information, see
    -- <http://docs.aws.amazon.com/acm/latest/userguide/acm-limits.html Limits>.
    CreateLoadBalancerTlsCertificate -> Text
certificateName :: Prelude.Text,
    -- | The domain name (e.g., @example.com@) for your SSL\/TLS certificate.
    CreateLoadBalancerTlsCertificate -> Text
certificateDomainName :: Prelude.Text
  }
  deriving (CreateLoadBalancerTlsCertificate
-> CreateLoadBalancerTlsCertificate -> Bool
(CreateLoadBalancerTlsCertificate
 -> CreateLoadBalancerTlsCertificate -> Bool)
-> (CreateLoadBalancerTlsCertificate
    -> CreateLoadBalancerTlsCertificate -> Bool)
-> Eq CreateLoadBalancerTlsCertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLoadBalancerTlsCertificate
-> CreateLoadBalancerTlsCertificate -> Bool
$c/= :: CreateLoadBalancerTlsCertificate
-> CreateLoadBalancerTlsCertificate -> Bool
== :: CreateLoadBalancerTlsCertificate
-> CreateLoadBalancerTlsCertificate -> Bool
$c== :: CreateLoadBalancerTlsCertificate
-> CreateLoadBalancerTlsCertificate -> Bool
Prelude.Eq, ReadPrec [CreateLoadBalancerTlsCertificate]
ReadPrec CreateLoadBalancerTlsCertificate
Int -> ReadS CreateLoadBalancerTlsCertificate
ReadS [CreateLoadBalancerTlsCertificate]
(Int -> ReadS CreateLoadBalancerTlsCertificate)
-> ReadS [CreateLoadBalancerTlsCertificate]
-> ReadPrec CreateLoadBalancerTlsCertificate
-> ReadPrec [CreateLoadBalancerTlsCertificate]
-> Read CreateLoadBalancerTlsCertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLoadBalancerTlsCertificate]
$creadListPrec :: ReadPrec [CreateLoadBalancerTlsCertificate]
readPrec :: ReadPrec CreateLoadBalancerTlsCertificate
$creadPrec :: ReadPrec CreateLoadBalancerTlsCertificate
readList :: ReadS [CreateLoadBalancerTlsCertificate]
$creadList :: ReadS [CreateLoadBalancerTlsCertificate]
readsPrec :: Int -> ReadS CreateLoadBalancerTlsCertificate
$creadsPrec :: Int -> ReadS CreateLoadBalancerTlsCertificate
Prelude.Read, Int -> CreateLoadBalancerTlsCertificate -> ShowS
[CreateLoadBalancerTlsCertificate] -> ShowS
CreateLoadBalancerTlsCertificate -> String
(Int -> CreateLoadBalancerTlsCertificate -> ShowS)
-> (CreateLoadBalancerTlsCertificate -> String)
-> ([CreateLoadBalancerTlsCertificate] -> ShowS)
-> Show CreateLoadBalancerTlsCertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLoadBalancerTlsCertificate] -> ShowS
$cshowList :: [CreateLoadBalancerTlsCertificate] -> ShowS
show :: CreateLoadBalancerTlsCertificate -> String
$cshow :: CreateLoadBalancerTlsCertificate -> String
showsPrec :: Int -> CreateLoadBalancerTlsCertificate -> ShowS
$cshowsPrec :: Int -> CreateLoadBalancerTlsCertificate -> ShowS
Prelude.Show, (forall x.
 CreateLoadBalancerTlsCertificate
 -> Rep CreateLoadBalancerTlsCertificate x)
-> (forall x.
    Rep CreateLoadBalancerTlsCertificate x
    -> CreateLoadBalancerTlsCertificate)
-> Generic CreateLoadBalancerTlsCertificate
forall x.
Rep CreateLoadBalancerTlsCertificate x
-> CreateLoadBalancerTlsCertificate
forall x.
CreateLoadBalancerTlsCertificate
-> Rep CreateLoadBalancerTlsCertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLoadBalancerTlsCertificate x
-> CreateLoadBalancerTlsCertificate
$cfrom :: forall x.
CreateLoadBalancerTlsCertificate
-> Rep CreateLoadBalancerTlsCertificate x
Prelude.Generic)

-- |
-- Create a value of 'CreateLoadBalancerTlsCertificate' 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:
--
-- 'certificateAlternativeNames', 'createLoadBalancerTlsCertificate_certificateAlternativeNames' - An array of strings listing alternative domains and subdomains for your
-- SSL\/TLS certificate. Lightsail will de-dupe the names for you. You can
-- have a maximum of 9 alternative names (in addition to the 1 primary
-- domain). We do not support wildcards (e.g., @*.example.com@).
--
-- 'tags', 'createLoadBalancerTlsCertificate_tags' - The tag keys and optional values to add to the resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
--
-- 'loadBalancerName', 'createLoadBalancerTlsCertificate_loadBalancerName' - The load balancer name where you want to create the SSL\/TLS
-- certificate.
--
-- 'certificateName', 'createLoadBalancerTlsCertificate_certificateName' - The SSL\/TLS certificate name.
--
-- You can have up to 10 certificates in your account at one time. Each
-- Lightsail load balancer can have up to 2 certificates associated with it
-- at one time. There is also an overall limit to the number of
-- certificates that can be issue in a 365-day period. For more
-- information, see
-- <http://docs.aws.amazon.com/acm/latest/userguide/acm-limits.html Limits>.
--
-- 'certificateDomainName', 'createLoadBalancerTlsCertificate_certificateDomainName' - The domain name (e.g., @example.com@) for your SSL\/TLS certificate.
newCreateLoadBalancerTlsCertificate ::
  -- | 'loadBalancerName'
  Prelude.Text ->
  -- | 'certificateName'
  Prelude.Text ->
  -- | 'certificateDomainName'
  Prelude.Text ->
  CreateLoadBalancerTlsCertificate
newCreateLoadBalancerTlsCertificate :: Text -> Text -> Text -> CreateLoadBalancerTlsCertificate
newCreateLoadBalancerTlsCertificate
  Text
pLoadBalancerName_
  Text
pCertificateName_
  Text
pCertificateDomainName_ =
    CreateLoadBalancerTlsCertificate' :: Maybe [Text]
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> CreateLoadBalancerTlsCertificate
CreateLoadBalancerTlsCertificate'
      { $sel:certificateAlternativeNames:CreateLoadBalancerTlsCertificate' :: Maybe [Text]
certificateAlternativeNames =
          Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateLoadBalancerTlsCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:loadBalancerName:CreateLoadBalancerTlsCertificate' :: Text
loadBalancerName = Text
pLoadBalancerName_,
        $sel:certificateName:CreateLoadBalancerTlsCertificate' :: Text
certificateName = Text
pCertificateName_,
        $sel:certificateDomainName:CreateLoadBalancerTlsCertificate' :: Text
certificateDomainName =
          Text
pCertificateDomainName_
      }

-- | An array of strings listing alternative domains and subdomains for your
-- SSL\/TLS certificate. Lightsail will de-dupe the names for you. You can
-- have a maximum of 9 alternative names (in addition to the 1 primary
-- domain). We do not support wildcards (e.g., @*.example.com@).
createLoadBalancerTlsCertificate_certificateAlternativeNames :: Lens.Lens' CreateLoadBalancerTlsCertificate (Prelude.Maybe [Prelude.Text])
createLoadBalancerTlsCertificate_certificateAlternativeNames :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateLoadBalancerTlsCertificate
-> f CreateLoadBalancerTlsCertificate
createLoadBalancerTlsCertificate_certificateAlternativeNames = (CreateLoadBalancerTlsCertificate -> Maybe [Text])
-> (CreateLoadBalancerTlsCertificate
    -> Maybe [Text] -> CreateLoadBalancerTlsCertificate)
-> Lens
     CreateLoadBalancerTlsCertificate
     CreateLoadBalancerTlsCertificate
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoadBalancerTlsCertificate' {Maybe [Text]
certificateAlternativeNames :: Maybe [Text]
$sel:certificateAlternativeNames:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Maybe [Text]
certificateAlternativeNames} -> Maybe [Text]
certificateAlternativeNames) (\s :: CreateLoadBalancerTlsCertificate
s@CreateLoadBalancerTlsCertificate' {} Maybe [Text]
a -> CreateLoadBalancerTlsCertificate
s {$sel:certificateAlternativeNames:CreateLoadBalancerTlsCertificate' :: Maybe [Text]
certificateAlternativeNames = Maybe [Text]
a} :: CreateLoadBalancerTlsCertificate) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateLoadBalancerTlsCertificate
 -> f CreateLoadBalancerTlsCertificate)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateLoadBalancerTlsCertificate
-> f CreateLoadBalancerTlsCertificate
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 resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
createLoadBalancerTlsCertificate_tags :: Lens.Lens' CreateLoadBalancerTlsCertificate (Prelude.Maybe [Tag])
createLoadBalancerTlsCertificate_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateLoadBalancerTlsCertificate
-> f CreateLoadBalancerTlsCertificate
createLoadBalancerTlsCertificate_tags = (CreateLoadBalancerTlsCertificate -> Maybe [Tag])
-> (CreateLoadBalancerTlsCertificate
    -> Maybe [Tag] -> CreateLoadBalancerTlsCertificate)
-> Lens
     CreateLoadBalancerTlsCertificate
     CreateLoadBalancerTlsCertificate
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoadBalancerTlsCertificate' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateLoadBalancerTlsCertificate
s@CreateLoadBalancerTlsCertificate' {} Maybe [Tag]
a -> CreateLoadBalancerTlsCertificate
s {$sel:tags:CreateLoadBalancerTlsCertificate' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateLoadBalancerTlsCertificate) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateLoadBalancerTlsCertificate
 -> f CreateLoadBalancerTlsCertificate)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateLoadBalancerTlsCertificate
-> f CreateLoadBalancerTlsCertificate
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 load balancer name where you want to create the SSL\/TLS
-- certificate.
createLoadBalancerTlsCertificate_loadBalancerName :: Lens.Lens' CreateLoadBalancerTlsCertificate Prelude.Text
createLoadBalancerTlsCertificate_loadBalancerName :: (Text -> f Text)
-> CreateLoadBalancerTlsCertificate
-> f CreateLoadBalancerTlsCertificate
createLoadBalancerTlsCertificate_loadBalancerName = (CreateLoadBalancerTlsCertificate -> Text)
-> (CreateLoadBalancerTlsCertificate
    -> Text -> CreateLoadBalancerTlsCertificate)
-> Lens
     CreateLoadBalancerTlsCertificate
     CreateLoadBalancerTlsCertificate
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoadBalancerTlsCertificate' {Text
loadBalancerName :: Text
$sel:loadBalancerName:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Text
loadBalancerName} -> Text
loadBalancerName) (\s :: CreateLoadBalancerTlsCertificate
s@CreateLoadBalancerTlsCertificate' {} Text
a -> CreateLoadBalancerTlsCertificate
s {$sel:loadBalancerName:CreateLoadBalancerTlsCertificate' :: Text
loadBalancerName = Text
a} :: CreateLoadBalancerTlsCertificate)

-- | The SSL\/TLS certificate name.
--
-- You can have up to 10 certificates in your account at one time. Each
-- Lightsail load balancer can have up to 2 certificates associated with it
-- at one time. There is also an overall limit to the number of
-- certificates that can be issue in a 365-day period. For more
-- information, see
-- <http://docs.aws.amazon.com/acm/latest/userguide/acm-limits.html Limits>.
createLoadBalancerTlsCertificate_certificateName :: Lens.Lens' CreateLoadBalancerTlsCertificate Prelude.Text
createLoadBalancerTlsCertificate_certificateName :: (Text -> f Text)
-> CreateLoadBalancerTlsCertificate
-> f CreateLoadBalancerTlsCertificate
createLoadBalancerTlsCertificate_certificateName = (CreateLoadBalancerTlsCertificate -> Text)
-> (CreateLoadBalancerTlsCertificate
    -> Text -> CreateLoadBalancerTlsCertificate)
-> Lens
     CreateLoadBalancerTlsCertificate
     CreateLoadBalancerTlsCertificate
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoadBalancerTlsCertificate' {Text
certificateName :: Text
$sel:certificateName:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Text
certificateName} -> Text
certificateName) (\s :: CreateLoadBalancerTlsCertificate
s@CreateLoadBalancerTlsCertificate' {} Text
a -> CreateLoadBalancerTlsCertificate
s {$sel:certificateName:CreateLoadBalancerTlsCertificate' :: Text
certificateName = Text
a} :: CreateLoadBalancerTlsCertificate)

-- | The domain name (e.g., @example.com@) for your SSL\/TLS certificate.
createLoadBalancerTlsCertificate_certificateDomainName :: Lens.Lens' CreateLoadBalancerTlsCertificate Prelude.Text
createLoadBalancerTlsCertificate_certificateDomainName :: (Text -> f Text)
-> CreateLoadBalancerTlsCertificate
-> f CreateLoadBalancerTlsCertificate
createLoadBalancerTlsCertificate_certificateDomainName = (CreateLoadBalancerTlsCertificate -> Text)
-> (CreateLoadBalancerTlsCertificate
    -> Text -> CreateLoadBalancerTlsCertificate)
-> Lens
     CreateLoadBalancerTlsCertificate
     CreateLoadBalancerTlsCertificate
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoadBalancerTlsCertificate' {Text
certificateDomainName :: Text
$sel:certificateDomainName:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Text
certificateDomainName} -> Text
certificateDomainName) (\s :: CreateLoadBalancerTlsCertificate
s@CreateLoadBalancerTlsCertificate' {} Text
a -> CreateLoadBalancerTlsCertificate
s {$sel:certificateDomainName:CreateLoadBalancerTlsCertificate' :: Text
certificateDomainName = Text
a} :: CreateLoadBalancerTlsCertificate)

instance
  Core.AWSRequest
    CreateLoadBalancerTlsCertificate
  where
  type
    AWSResponse CreateLoadBalancerTlsCertificate =
      CreateLoadBalancerTlsCertificateResponse
  request :: CreateLoadBalancerTlsCertificate
-> Request CreateLoadBalancerTlsCertificate
request = Service
-> CreateLoadBalancerTlsCertificate
-> Request CreateLoadBalancerTlsCertificate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLoadBalancerTlsCertificate
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateLoadBalancerTlsCertificate)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLoadBalancerTlsCertificate))
-> Logger
-> Service
-> Proxy CreateLoadBalancerTlsCertificate
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse CreateLoadBalancerTlsCertificate)))
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 -> CreateLoadBalancerTlsCertificateResponse
CreateLoadBalancerTlsCertificateResponse'
            (Maybe [Operation]
 -> Int -> CreateLoadBalancerTlsCertificateResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> CreateLoadBalancerTlsCertificateResponse)
forall (f :: * -> *) a b. Functor 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 -> CreateLoadBalancerTlsCertificateResponse)
-> Either String Int
-> Either String CreateLoadBalancerTlsCertificateResponse
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
    CreateLoadBalancerTlsCertificate

instance
  Prelude.NFData
    CreateLoadBalancerTlsCertificate

instance
  Core.ToHeaders
    CreateLoadBalancerTlsCertificate
  where
  toHeaders :: CreateLoadBalancerTlsCertificate -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> CreateLoadBalancerTlsCertificate -> 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.CreateLoadBalancerTlsCertificate" ::
                          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 CreateLoadBalancerTlsCertificate where
  toJSON :: CreateLoadBalancerTlsCertificate -> Value
toJSON CreateLoadBalancerTlsCertificate' {Maybe [Text]
Maybe [Tag]
Text
certificateDomainName :: Text
certificateName :: Text
loadBalancerName :: Text
tags :: Maybe [Tag]
certificateAlternativeNames :: Maybe [Text]
$sel:certificateDomainName:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Text
$sel:certificateName:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Text
$sel:loadBalancerName:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Text
$sel:tags:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Maybe [Tag]
$sel:certificateAlternativeNames:CreateLoadBalancerTlsCertificate' :: CreateLoadBalancerTlsCertificate -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"certificateAlternativeNames" 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]
certificateAlternativeNames,
            (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
"loadBalancerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
loadBalancerName),
            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
"certificateDomainName"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateDomainName
              )
          ]
      )

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

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

-- | /See:/ 'newCreateLoadBalancerTlsCertificateResponse' smart constructor.
data CreateLoadBalancerTlsCertificateResponse = CreateLoadBalancerTlsCertificateResponse'
  { -- | 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.
    CreateLoadBalancerTlsCertificateResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
    -- | The response's http status code.
    CreateLoadBalancerTlsCertificateResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateLoadBalancerTlsCertificateResponse
-> CreateLoadBalancerTlsCertificateResponse -> Bool
(CreateLoadBalancerTlsCertificateResponse
 -> CreateLoadBalancerTlsCertificateResponse -> Bool)
-> (CreateLoadBalancerTlsCertificateResponse
    -> CreateLoadBalancerTlsCertificateResponse -> Bool)
-> Eq CreateLoadBalancerTlsCertificateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLoadBalancerTlsCertificateResponse
-> CreateLoadBalancerTlsCertificateResponse -> Bool
$c/= :: CreateLoadBalancerTlsCertificateResponse
-> CreateLoadBalancerTlsCertificateResponse -> Bool
== :: CreateLoadBalancerTlsCertificateResponse
-> CreateLoadBalancerTlsCertificateResponse -> Bool
$c== :: CreateLoadBalancerTlsCertificateResponse
-> CreateLoadBalancerTlsCertificateResponse -> Bool
Prelude.Eq, ReadPrec [CreateLoadBalancerTlsCertificateResponse]
ReadPrec CreateLoadBalancerTlsCertificateResponse
Int -> ReadS CreateLoadBalancerTlsCertificateResponse
ReadS [CreateLoadBalancerTlsCertificateResponse]
(Int -> ReadS CreateLoadBalancerTlsCertificateResponse)
-> ReadS [CreateLoadBalancerTlsCertificateResponse]
-> ReadPrec CreateLoadBalancerTlsCertificateResponse
-> ReadPrec [CreateLoadBalancerTlsCertificateResponse]
-> Read CreateLoadBalancerTlsCertificateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLoadBalancerTlsCertificateResponse]
$creadListPrec :: ReadPrec [CreateLoadBalancerTlsCertificateResponse]
readPrec :: ReadPrec CreateLoadBalancerTlsCertificateResponse
$creadPrec :: ReadPrec CreateLoadBalancerTlsCertificateResponse
readList :: ReadS [CreateLoadBalancerTlsCertificateResponse]
$creadList :: ReadS [CreateLoadBalancerTlsCertificateResponse]
readsPrec :: Int -> ReadS CreateLoadBalancerTlsCertificateResponse
$creadsPrec :: Int -> ReadS CreateLoadBalancerTlsCertificateResponse
Prelude.Read, Int -> CreateLoadBalancerTlsCertificateResponse -> ShowS
[CreateLoadBalancerTlsCertificateResponse] -> ShowS
CreateLoadBalancerTlsCertificateResponse -> String
(Int -> CreateLoadBalancerTlsCertificateResponse -> ShowS)
-> (CreateLoadBalancerTlsCertificateResponse -> String)
-> ([CreateLoadBalancerTlsCertificateResponse] -> ShowS)
-> Show CreateLoadBalancerTlsCertificateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLoadBalancerTlsCertificateResponse] -> ShowS
$cshowList :: [CreateLoadBalancerTlsCertificateResponse] -> ShowS
show :: CreateLoadBalancerTlsCertificateResponse -> String
$cshow :: CreateLoadBalancerTlsCertificateResponse -> String
showsPrec :: Int -> CreateLoadBalancerTlsCertificateResponse -> ShowS
$cshowsPrec :: Int -> CreateLoadBalancerTlsCertificateResponse -> ShowS
Prelude.Show, (forall x.
 CreateLoadBalancerTlsCertificateResponse
 -> Rep CreateLoadBalancerTlsCertificateResponse x)
-> (forall x.
    Rep CreateLoadBalancerTlsCertificateResponse x
    -> CreateLoadBalancerTlsCertificateResponse)
-> Generic CreateLoadBalancerTlsCertificateResponse
forall x.
Rep CreateLoadBalancerTlsCertificateResponse x
-> CreateLoadBalancerTlsCertificateResponse
forall x.
CreateLoadBalancerTlsCertificateResponse
-> Rep CreateLoadBalancerTlsCertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLoadBalancerTlsCertificateResponse x
-> CreateLoadBalancerTlsCertificateResponse
$cfrom :: forall x.
CreateLoadBalancerTlsCertificateResponse
-> Rep CreateLoadBalancerTlsCertificateResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateLoadBalancerTlsCertificateResponse' 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:
--
-- 'operations', 'createLoadBalancerTlsCertificateResponse_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', 'createLoadBalancerTlsCertificateResponse_httpStatus' - The response's http status code.
newCreateLoadBalancerTlsCertificateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLoadBalancerTlsCertificateResponse
newCreateLoadBalancerTlsCertificateResponse :: Int -> CreateLoadBalancerTlsCertificateResponse
newCreateLoadBalancerTlsCertificateResponse
  Int
pHttpStatus_ =
    CreateLoadBalancerTlsCertificateResponse' :: Maybe [Operation]
-> Int -> CreateLoadBalancerTlsCertificateResponse
CreateLoadBalancerTlsCertificateResponse'
      { $sel:operations:CreateLoadBalancerTlsCertificateResponse' :: Maybe [Operation]
operations =
          Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:CreateLoadBalancerTlsCertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | 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.
createLoadBalancerTlsCertificateResponse_operations :: Lens.Lens' CreateLoadBalancerTlsCertificateResponse (Prelude.Maybe [Operation])
createLoadBalancerTlsCertificateResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateLoadBalancerTlsCertificateResponse
-> f CreateLoadBalancerTlsCertificateResponse
createLoadBalancerTlsCertificateResponse_operations = (CreateLoadBalancerTlsCertificateResponse -> Maybe [Operation])
-> (CreateLoadBalancerTlsCertificateResponse
    -> Maybe [Operation] -> CreateLoadBalancerTlsCertificateResponse)
-> Lens
     CreateLoadBalancerTlsCertificateResponse
     CreateLoadBalancerTlsCertificateResponse
     (Maybe [Operation])
     (Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoadBalancerTlsCertificateResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateLoadBalancerTlsCertificateResponse' :: CreateLoadBalancerTlsCertificateResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateLoadBalancerTlsCertificateResponse
s@CreateLoadBalancerTlsCertificateResponse' {} Maybe [Operation]
a -> CreateLoadBalancerTlsCertificateResponse
s {$sel:operations:CreateLoadBalancerTlsCertificateResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateLoadBalancerTlsCertificateResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
 -> CreateLoadBalancerTlsCertificateResponse
 -> f CreateLoadBalancerTlsCertificateResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
    -> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateLoadBalancerTlsCertificateResponse
-> f CreateLoadBalancerTlsCertificateResponse
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.
createLoadBalancerTlsCertificateResponse_httpStatus :: Lens.Lens' CreateLoadBalancerTlsCertificateResponse Prelude.Int
createLoadBalancerTlsCertificateResponse_httpStatus :: (Int -> f Int)
-> CreateLoadBalancerTlsCertificateResponse
-> f CreateLoadBalancerTlsCertificateResponse
createLoadBalancerTlsCertificateResponse_httpStatus = (CreateLoadBalancerTlsCertificateResponse -> Int)
-> (CreateLoadBalancerTlsCertificateResponse
    -> Int -> CreateLoadBalancerTlsCertificateResponse)
-> Lens
     CreateLoadBalancerTlsCertificateResponse
     CreateLoadBalancerTlsCertificateResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoadBalancerTlsCertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLoadBalancerTlsCertificateResponse' :: CreateLoadBalancerTlsCertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLoadBalancerTlsCertificateResponse
s@CreateLoadBalancerTlsCertificateResponse' {} Int
a -> CreateLoadBalancerTlsCertificateResponse
s {$sel:httpStatus:CreateLoadBalancerTlsCertificateResponse' :: Int
httpStatus = Int
a} :: CreateLoadBalancerTlsCertificateResponse)

instance
  Prelude.NFData
    CreateLoadBalancerTlsCertificateResponse