{-# 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.IoT.RegisterCACertificate
-- 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)
--
-- Registers a CA certificate with IoT. This CA certificate can then be
-- used to sign device certificates, which can be then registered with IoT.
-- You can register up to 10 CA certificates per Amazon Web Services
-- account that have the same subject field. This enables you to have up to
-- 10 certificate authorities sign your device certificates. If you have
-- more than one CA certificate registered, make sure you pass the CA
-- certificate when you register your device certificates with the
-- RegisterCertificate action.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions RegisterCACertificate>
-- action.
module Amazonka.IoT.RegisterCACertificate
  ( -- * Creating a Request
    RegisterCACertificate (..),
    newRegisterCACertificate,

    -- * Request Lenses
    registerCACertificate_setAsActive,
    registerCACertificate_allowAutoRegistration,
    registerCACertificate_registrationConfig,
    registerCACertificate_tags,
    registerCACertificate_caCertificate,
    registerCACertificate_verificationCertificate,

    -- * Destructuring the Response
    RegisterCACertificateResponse (..),
    newRegisterCACertificateResponse,

    -- * Response Lenses
    registerCACertificateResponse_certificateArn,
    registerCACertificateResponse_certificateId,
    registerCACertificateResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | The input to the RegisterCACertificate operation.
--
-- /See:/ 'newRegisterCACertificate' smart constructor.
data RegisterCACertificate = RegisterCACertificate'
  { -- | A boolean value that specifies if the CA certificate is set to active.
    RegisterCACertificate -> Maybe Bool
setAsActive :: Prelude.Maybe Prelude.Bool,
    -- | Allows this CA certificate to be used for auto registration of device
    -- certificates.
    RegisterCACertificate -> Maybe Bool
allowAutoRegistration :: Prelude.Maybe Prelude.Bool,
    -- | Information about the registration configuration.
    RegisterCACertificate -> Maybe RegistrationConfig
registrationConfig :: Prelude.Maybe RegistrationConfig,
    -- | Metadata which can be used to manage the CA certificate.
    --
    -- For URI Request parameters use format: ...key1=value1&key2=value2...
    --
    -- For the CLI command-line parameter use format: &&tags
    -- \"key1=value1&key2=value2...\"
    --
    -- For the cli-input-json file use format: \"tags\":
    -- \"key1=value1&key2=value2...\"
    RegisterCACertificate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The CA certificate.
    RegisterCACertificate -> Text
caCertificate :: Prelude.Text,
    -- | The private key verification certificate.
    RegisterCACertificate -> Text
verificationCertificate :: Prelude.Text
  }
  deriving (RegisterCACertificate -> RegisterCACertificate -> Bool
(RegisterCACertificate -> RegisterCACertificate -> Bool)
-> (RegisterCACertificate -> RegisterCACertificate -> Bool)
-> Eq RegisterCACertificate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterCACertificate -> RegisterCACertificate -> Bool
$c/= :: RegisterCACertificate -> RegisterCACertificate -> Bool
== :: RegisterCACertificate -> RegisterCACertificate -> Bool
$c== :: RegisterCACertificate -> RegisterCACertificate -> Bool
Prelude.Eq, ReadPrec [RegisterCACertificate]
ReadPrec RegisterCACertificate
Int -> ReadS RegisterCACertificate
ReadS [RegisterCACertificate]
(Int -> ReadS RegisterCACertificate)
-> ReadS [RegisterCACertificate]
-> ReadPrec RegisterCACertificate
-> ReadPrec [RegisterCACertificate]
-> Read RegisterCACertificate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterCACertificate]
$creadListPrec :: ReadPrec [RegisterCACertificate]
readPrec :: ReadPrec RegisterCACertificate
$creadPrec :: ReadPrec RegisterCACertificate
readList :: ReadS [RegisterCACertificate]
$creadList :: ReadS [RegisterCACertificate]
readsPrec :: Int -> ReadS RegisterCACertificate
$creadsPrec :: Int -> ReadS RegisterCACertificate
Prelude.Read, Int -> RegisterCACertificate -> ShowS
[RegisterCACertificate] -> ShowS
RegisterCACertificate -> String
(Int -> RegisterCACertificate -> ShowS)
-> (RegisterCACertificate -> String)
-> ([RegisterCACertificate] -> ShowS)
-> Show RegisterCACertificate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterCACertificate] -> ShowS
$cshowList :: [RegisterCACertificate] -> ShowS
show :: RegisterCACertificate -> String
$cshow :: RegisterCACertificate -> String
showsPrec :: Int -> RegisterCACertificate -> ShowS
$cshowsPrec :: Int -> RegisterCACertificate -> ShowS
Prelude.Show, (forall x. RegisterCACertificate -> Rep RegisterCACertificate x)
-> (forall x. Rep RegisterCACertificate x -> RegisterCACertificate)
-> Generic RegisterCACertificate
forall x. Rep RegisterCACertificate x -> RegisterCACertificate
forall x. RegisterCACertificate -> Rep RegisterCACertificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterCACertificate x -> RegisterCACertificate
$cfrom :: forall x. RegisterCACertificate -> Rep RegisterCACertificate x
Prelude.Generic)

-- |
-- Create a value of 'RegisterCACertificate' 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:
--
-- 'setAsActive', 'registerCACertificate_setAsActive' - A boolean value that specifies if the CA certificate is set to active.
--
-- 'allowAutoRegistration', 'registerCACertificate_allowAutoRegistration' - Allows this CA certificate to be used for auto registration of device
-- certificates.
--
-- 'registrationConfig', 'registerCACertificate_registrationConfig' - Information about the registration configuration.
--
-- 'tags', 'registerCACertificate_tags' - Metadata which can be used to manage the CA certificate.
--
-- For URI Request parameters use format: ...key1=value1&key2=value2...
--
-- For the CLI command-line parameter use format: &&tags
-- \"key1=value1&key2=value2...\"
--
-- For the cli-input-json file use format: \"tags\":
-- \"key1=value1&key2=value2...\"
--
-- 'caCertificate', 'registerCACertificate_caCertificate' - The CA certificate.
--
-- 'verificationCertificate', 'registerCACertificate_verificationCertificate' - The private key verification certificate.
newRegisterCACertificate ::
  -- | 'caCertificate'
  Prelude.Text ->
  -- | 'verificationCertificate'
  Prelude.Text ->
  RegisterCACertificate
newRegisterCACertificate :: Text -> Text -> RegisterCACertificate
newRegisterCACertificate
  Text
pCaCertificate_
  Text
pVerificationCertificate_ =
    RegisterCACertificate' :: Maybe Bool
-> Maybe Bool
-> Maybe RegistrationConfig
-> Maybe [Tag]
-> Text
-> Text
-> RegisterCACertificate
RegisterCACertificate'
      { $sel:setAsActive:RegisterCACertificate' :: Maybe Bool
setAsActive =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:allowAutoRegistration:RegisterCACertificate' :: Maybe Bool
allowAutoRegistration = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:registrationConfig:RegisterCACertificate' :: Maybe RegistrationConfig
registrationConfig = Maybe RegistrationConfig
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:RegisterCACertificate' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:caCertificate:RegisterCACertificate' :: Text
caCertificate = Text
pCaCertificate_,
        $sel:verificationCertificate:RegisterCACertificate' :: Text
verificationCertificate = Text
pVerificationCertificate_
      }

-- | A boolean value that specifies if the CA certificate is set to active.
registerCACertificate_setAsActive :: Lens.Lens' RegisterCACertificate (Prelude.Maybe Prelude.Bool)
registerCACertificate_setAsActive :: (Maybe Bool -> f (Maybe Bool))
-> RegisterCACertificate -> f RegisterCACertificate
registerCACertificate_setAsActive = (RegisterCACertificate -> Maybe Bool)
-> (RegisterCACertificate -> Maybe Bool -> RegisterCACertificate)
-> Lens
     RegisterCACertificate
     RegisterCACertificate
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificate' {Maybe Bool
setAsActive :: Maybe Bool
$sel:setAsActive:RegisterCACertificate' :: RegisterCACertificate -> Maybe Bool
setAsActive} -> Maybe Bool
setAsActive) (\s :: RegisterCACertificate
s@RegisterCACertificate' {} Maybe Bool
a -> RegisterCACertificate
s {$sel:setAsActive:RegisterCACertificate' :: Maybe Bool
setAsActive = Maybe Bool
a} :: RegisterCACertificate)

-- | Allows this CA certificate to be used for auto registration of device
-- certificates.
registerCACertificate_allowAutoRegistration :: Lens.Lens' RegisterCACertificate (Prelude.Maybe Prelude.Bool)
registerCACertificate_allowAutoRegistration :: (Maybe Bool -> f (Maybe Bool))
-> RegisterCACertificate -> f RegisterCACertificate
registerCACertificate_allowAutoRegistration = (RegisterCACertificate -> Maybe Bool)
-> (RegisterCACertificate -> Maybe Bool -> RegisterCACertificate)
-> Lens
     RegisterCACertificate
     RegisterCACertificate
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificate' {Maybe Bool
allowAutoRegistration :: Maybe Bool
$sel:allowAutoRegistration:RegisterCACertificate' :: RegisterCACertificate -> Maybe Bool
allowAutoRegistration} -> Maybe Bool
allowAutoRegistration) (\s :: RegisterCACertificate
s@RegisterCACertificate' {} Maybe Bool
a -> RegisterCACertificate
s {$sel:allowAutoRegistration:RegisterCACertificate' :: Maybe Bool
allowAutoRegistration = Maybe Bool
a} :: RegisterCACertificate)

-- | Information about the registration configuration.
registerCACertificate_registrationConfig :: Lens.Lens' RegisterCACertificate (Prelude.Maybe RegistrationConfig)
registerCACertificate_registrationConfig :: (Maybe RegistrationConfig -> f (Maybe RegistrationConfig))
-> RegisterCACertificate -> f RegisterCACertificate
registerCACertificate_registrationConfig = (RegisterCACertificate -> Maybe RegistrationConfig)
-> (RegisterCACertificate
    -> Maybe RegistrationConfig -> RegisterCACertificate)
-> Lens
     RegisterCACertificate
     RegisterCACertificate
     (Maybe RegistrationConfig)
     (Maybe RegistrationConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificate' {Maybe RegistrationConfig
registrationConfig :: Maybe RegistrationConfig
$sel:registrationConfig:RegisterCACertificate' :: RegisterCACertificate -> Maybe RegistrationConfig
registrationConfig} -> Maybe RegistrationConfig
registrationConfig) (\s :: RegisterCACertificate
s@RegisterCACertificate' {} Maybe RegistrationConfig
a -> RegisterCACertificate
s {$sel:registrationConfig:RegisterCACertificate' :: Maybe RegistrationConfig
registrationConfig = Maybe RegistrationConfig
a} :: RegisterCACertificate)

-- | Metadata which can be used to manage the CA certificate.
--
-- For URI Request parameters use format: ...key1=value1&key2=value2...
--
-- For the CLI command-line parameter use format: &&tags
-- \"key1=value1&key2=value2...\"
--
-- For the cli-input-json file use format: \"tags\":
-- \"key1=value1&key2=value2...\"
registerCACertificate_tags :: Lens.Lens' RegisterCACertificate (Prelude.Maybe [Tag])
registerCACertificate_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> RegisterCACertificate -> f RegisterCACertificate
registerCACertificate_tags = (RegisterCACertificate -> Maybe [Tag])
-> (RegisterCACertificate -> Maybe [Tag] -> RegisterCACertificate)
-> Lens
     RegisterCACertificate
     RegisterCACertificate
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificate' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:RegisterCACertificate' :: RegisterCACertificate -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: RegisterCACertificate
s@RegisterCACertificate' {} Maybe [Tag]
a -> RegisterCACertificate
s {$sel:tags:RegisterCACertificate' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: RegisterCACertificate) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> RegisterCACertificate -> f RegisterCACertificate)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> RegisterCACertificate
-> f RegisterCACertificate
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 CA certificate.
registerCACertificate_caCertificate :: Lens.Lens' RegisterCACertificate Prelude.Text
registerCACertificate_caCertificate :: (Text -> f Text)
-> RegisterCACertificate -> f RegisterCACertificate
registerCACertificate_caCertificate = (RegisterCACertificate -> Text)
-> (RegisterCACertificate -> Text -> RegisterCACertificate)
-> Lens RegisterCACertificate RegisterCACertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificate' {Text
caCertificate :: Text
$sel:caCertificate:RegisterCACertificate' :: RegisterCACertificate -> Text
caCertificate} -> Text
caCertificate) (\s :: RegisterCACertificate
s@RegisterCACertificate' {} Text
a -> RegisterCACertificate
s {$sel:caCertificate:RegisterCACertificate' :: Text
caCertificate = Text
a} :: RegisterCACertificate)

-- | The private key verification certificate.
registerCACertificate_verificationCertificate :: Lens.Lens' RegisterCACertificate Prelude.Text
registerCACertificate_verificationCertificate :: (Text -> f Text)
-> RegisterCACertificate -> f RegisterCACertificate
registerCACertificate_verificationCertificate = (RegisterCACertificate -> Text)
-> (RegisterCACertificate -> Text -> RegisterCACertificate)
-> Lens RegisterCACertificate RegisterCACertificate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificate' {Text
verificationCertificate :: Text
$sel:verificationCertificate:RegisterCACertificate' :: RegisterCACertificate -> Text
verificationCertificate} -> Text
verificationCertificate) (\s :: RegisterCACertificate
s@RegisterCACertificate' {} Text
a -> RegisterCACertificate
s {$sel:verificationCertificate:RegisterCACertificate' :: Text
verificationCertificate = Text
a} :: RegisterCACertificate)

instance Core.AWSRequest RegisterCACertificate where
  type
    AWSResponse RegisterCACertificate =
      RegisterCACertificateResponse
  request :: RegisterCACertificate -> Request RegisterCACertificate
request = Service -> RegisterCACertificate -> Request RegisterCACertificate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RegisterCACertificate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RegisterCACertificate)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse RegisterCACertificate))
-> Logger
-> Service
-> Proxy RegisterCACertificate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RegisterCACertificate)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> RegisterCACertificateResponse
RegisterCACertificateResponse'
            (Maybe Text -> Maybe Text -> Int -> RegisterCACertificateResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> RegisterCACertificateResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"certificateArn")
            Either String (Maybe Text -> Int -> RegisterCACertificateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RegisterCACertificateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"certificateId")
            Either String (Int -> RegisterCACertificateResponse)
-> Either String Int -> Either String RegisterCACertificateResponse
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 RegisterCACertificate

instance Prelude.NFData RegisterCACertificate

instance Core.ToHeaders RegisterCACertificate where
  toHeaders :: RegisterCACertificate -> ResponseHeaders
toHeaders = ResponseHeaders -> RegisterCACertificate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON RegisterCACertificate where
  toJSON :: RegisterCACertificate -> Value
toJSON RegisterCACertificate' {Maybe Bool
Maybe [Tag]
Maybe RegistrationConfig
Text
verificationCertificate :: Text
caCertificate :: Text
tags :: Maybe [Tag]
registrationConfig :: Maybe RegistrationConfig
allowAutoRegistration :: Maybe Bool
setAsActive :: Maybe Bool
$sel:verificationCertificate:RegisterCACertificate' :: RegisterCACertificate -> Text
$sel:caCertificate:RegisterCACertificate' :: RegisterCACertificate -> Text
$sel:tags:RegisterCACertificate' :: RegisterCACertificate -> Maybe [Tag]
$sel:registrationConfig:RegisterCACertificate' :: RegisterCACertificate -> Maybe RegistrationConfig
$sel:allowAutoRegistration:RegisterCACertificate' :: RegisterCACertificate -> Maybe Bool
$sel:setAsActive:RegisterCACertificate' :: RegisterCACertificate -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"registrationConfig" Text -> RegistrationConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RegistrationConfig -> Pair)
-> Maybe RegistrationConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RegistrationConfig
registrationConfig,
            (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
"caCertificate" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
caCertificate),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"verificationCertificate"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
verificationCertificate
              )
          ]
      )

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

instance Core.ToQuery RegisterCACertificate where
  toQuery :: RegisterCACertificate -> QueryString
toQuery RegisterCACertificate' {Maybe Bool
Maybe [Tag]
Maybe RegistrationConfig
Text
verificationCertificate :: Text
caCertificate :: Text
tags :: Maybe [Tag]
registrationConfig :: Maybe RegistrationConfig
allowAutoRegistration :: Maybe Bool
setAsActive :: Maybe Bool
$sel:verificationCertificate:RegisterCACertificate' :: RegisterCACertificate -> Text
$sel:caCertificate:RegisterCACertificate' :: RegisterCACertificate -> Text
$sel:tags:RegisterCACertificate' :: RegisterCACertificate -> Maybe [Tag]
$sel:registrationConfig:RegisterCACertificate' :: RegisterCACertificate -> Maybe RegistrationConfig
$sel:allowAutoRegistration:RegisterCACertificate' :: RegisterCACertificate -> Maybe Bool
$sel:setAsActive:RegisterCACertificate' :: RegisterCACertificate -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"setAsActive" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
setAsActive,
        ByteString
"allowAutoRegistration"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
allowAutoRegistration
      ]

-- | The output from the RegisterCACertificateResponse operation.
--
-- /See:/ 'newRegisterCACertificateResponse' smart constructor.
data RegisterCACertificateResponse = RegisterCACertificateResponse'
  { -- | The CA certificate ARN.
    RegisterCACertificateResponse -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
    -- | The CA certificate identifier.
    RegisterCACertificateResponse -> Maybe Text
certificateId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    RegisterCACertificateResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (RegisterCACertificateResponse
-> RegisterCACertificateResponse -> Bool
(RegisterCACertificateResponse
 -> RegisterCACertificateResponse -> Bool)
-> (RegisterCACertificateResponse
    -> RegisterCACertificateResponse -> Bool)
-> Eq RegisterCACertificateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterCACertificateResponse
-> RegisterCACertificateResponse -> Bool
$c/= :: RegisterCACertificateResponse
-> RegisterCACertificateResponse -> Bool
== :: RegisterCACertificateResponse
-> RegisterCACertificateResponse -> Bool
$c== :: RegisterCACertificateResponse
-> RegisterCACertificateResponse -> Bool
Prelude.Eq, ReadPrec [RegisterCACertificateResponse]
ReadPrec RegisterCACertificateResponse
Int -> ReadS RegisterCACertificateResponse
ReadS [RegisterCACertificateResponse]
(Int -> ReadS RegisterCACertificateResponse)
-> ReadS [RegisterCACertificateResponse]
-> ReadPrec RegisterCACertificateResponse
-> ReadPrec [RegisterCACertificateResponse]
-> Read RegisterCACertificateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterCACertificateResponse]
$creadListPrec :: ReadPrec [RegisterCACertificateResponse]
readPrec :: ReadPrec RegisterCACertificateResponse
$creadPrec :: ReadPrec RegisterCACertificateResponse
readList :: ReadS [RegisterCACertificateResponse]
$creadList :: ReadS [RegisterCACertificateResponse]
readsPrec :: Int -> ReadS RegisterCACertificateResponse
$creadsPrec :: Int -> ReadS RegisterCACertificateResponse
Prelude.Read, Int -> RegisterCACertificateResponse -> ShowS
[RegisterCACertificateResponse] -> ShowS
RegisterCACertificateResponse -> String
(Int -> RegisterCACertificateResponse -> ShowS)
-> (RegisterCACertificateResponse -> String)
-> ([RegisterCACertificateResponse] -> ShowS)
-> Show RegisterCACertificateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterCACertificateResponse] -> ShowS
$cshowList :: [RegisterCACertificateResponse] -> ShowS
show :: RegisterCACertificateResponse -> String
$cshow :: RegisterCACertificateResponse -> String
showsPrec :: Int -> RegisterCACertificateResponse -> ShowS
$cshowsPrec :: Int -> RegisterCACertificateResponse -> ShowS
Prelude.Show, (forall x.
 RegisterCACertificateResponse
 -> Rep RegisterCACertificateResponse x)
-> (forall x.
    Rep RegisterCACertificateResponse x
    -> RegisterCACertificateResponse)
-> Generic RegisterCACertificateResponse
forall x.
Rep RegisterCACertificateResponse x
-> RegisterCACertificateResponse
forall x.
RegisterCACertificateResponse
-> Rep RegisterCACertificateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterCACertificateResponse x
-> RegisterCACertificateResponse
$cfrom :: forall x.
RegisterCACertificateResponse
-> Rep RegisterCACertificateResponse x
Prelude.Generic)

-- |
-- Create a value of 'RegisterCACertificateResponse' 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:
--
-- 'certificateArn', 'registerCACertificateResponse_certificateArn' - The CA certificate ARN.
--
-- 'certificateId', 'registerCACertificateResponse_certificateId' - The CA certificate identifier.
--
-- 'httpStatus', 'registerCACertificateResponse_httpStatus' - The response's http status code.
newRegisterCACertificateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RegisterCACertificateResponse
newRegisterCACertificateResponse :: Int -> RegisterCACertificateResponse
newRegisterCACertificateResponse Int
pHttpStatus_ =
  RegisterCACertificateResponse' :: Maybe Text -> Maybe Text -> Int -> RegisterCACertificateResponse
RegisterCACertificateResponse'
    { $sel:certificateArn:RegisterCACertificateResponse' :: Maybe Text
certificateArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:certificateId:RegisterCACertificateResponse' :: Maybe Text
certificateId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RegisterCACertificateResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The CA certificate ARN.
registerCACertificateResponse_certificateArn :: Lens.Lens' RegisterCACertificateResponse (Prelude.Maybe Prelude.Text)
registerCACertificateResponse_certificateArn :: (Maybe Text -> f (Maybe Text))
-> RegisterCACertificateResponse -> f RegisterCACertificateResponse
registerCACertificateResponse_certificateArn = (RegisterCACertificateResponse -> Maybe Text)
-> (RegisterCACertificateResponse
    -> Maybe Text -> RegisterCACertificateResponse)
-> Lens
     RegisterCACertificateResponse
     RegisterCACertificateResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificateResponse' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:RegisterCACertificateResponse' :: RegisterCACertificateResponse -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: RegisterCACertificateResponse
s@RegisterCACertificateResponse' {} Maybe Text
a -> RegisterCACertificateResponse
s {$sel:certificateArn:RegisterCACertificateResponse' :: Maybe Text
certificateArn = Maybe Text
a} :: RegisterCACertificateResponse)

-- | The CA certificate identifier.
registerCACertificateResponse_certificateId :: Lens.Lens' RegisterCACertificateResponse (Prelude.Maybe Prelude.Text)
registerCACertificateResponse_certificateId :: (Maybe Text -> f (Maybe Text))
-> RegisterCACertificateResponse -> f RegisterCACertificateResponse
registerCACertificateResponse_certificateId = (RegisterCACertificateResponse -> Maybe Text)
-> (RegisterCACertificateResponse
    -> Maybe Text -> RegisterCACertificateResponse)
-> Lens
     RegisterCACertificateResponse
     RegisterCACertificateResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificateResponse' {Maybe Text
certificateId :: Maybe Text
$sel:certificateId:RegisterCACertificateResponse' :: RegisterCACertificateResponse -> Maybe Text
certificateId} -> Maybe Text
certificateId) (\s :: RegisterCACertificateResponse
s@RegisterCACertificateResponse' {} Maybe Text
a -> RegisterCACertificateResponse
s {$sel:certificateId:RegisterCACertificateResponse' :: Maybe Text
certificateId = Maybe Text
a} :: RegisterCACertificateResponse)

-- | The response's http status code.
registerCACertificateResponse_httpStatus :: Lens.Lens' RegisterCACertificateResponse Prelude.Int
registerCACertificateResponse_httpStatus :: (Int -> f Int)
-> RegisterCACertificateResponse -> f RegisterCACertificateResponse
registerCACertificateResponse_httpStatus = (RegisterCACertificateResponse -> Int)
-> (RegisterCACertificateResponse
    -> Int -> RegisterCACertificateResponse)
-> Lens
     RegisterCACertificateResponse RegisterCACertificateResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterCACertificateResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterCACertificateResponse' :: RegisterCACertificateResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterCACertificateResponse
s@RegisterCACertificateResponse' {} Int
a -> RegisterCACertificateResponse
s {$sel:httpStatus:RegisterCACertificateResponse' :: Int
httpStatus = Int
a} :: RegisterCACertificateResponse)

instance Prelude.NFData RegisterCACertificateResponse