{-# 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.CertificateManager.UpdateCertificateOptions
-- 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)
--
-- Updates a certificate. Currently, you can use this function to specify
-- whether to opt in to or out of recording your certificate in a
-- certificate transparency log. For more information, see
-- <https://docs.aws.amazon.com/acm/latest/userguide/acm-bestpractices.html#best-practices-transparency Opting Out of Certificate Transparency Logging>.
module Amazonka.CertificateManager.UpdateCertificateOptions
  ( -- * Creating a Request
    UpdateCertificateOptions (..),
    newUpdateCertificateOptions,

    -- * Request Lenses
    updateCertificateOptions_certificateArn,
    updateCertificateOptions_options,

    -- * Destructuring the Response
    UpdateCertificateOptionsResponse (..),
    newUpdateCertificateOptionsResponse,
  )
where

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

-- | /See:/ 'newUpdateCertificateOptions' smart constructor.
data UpdateCertificateOptions = UpdateCertificateOptions'
  { -- | ARN of the requested certificate to update. This must be of the form:
    --
    -- @arn:aws:acm:us-east-1:account:certificate\/12345678-1234-1234-1234-123456789012 @
    UpdateCertificateOptions -> Text
certificateArn :: Prelude.Text,
    -- | Use to update the options for your certificate. Currently, you can
    -- specify whether to add your certificate to a transparency log.
    -- Certificate transparency makes it possible to detect SSL\/TLS
    -- certificates that have been mistakenly or maliciously issued.
    -- Certificates that have not been logged typically produce an error
    -- message in a browser.
    UpdateCertificateOptions -> CertificateOptions
options :: CertificateOptions
  }
  deriving (UpdateCertificateOptions -> UpdateCertificateOptions -> Bool
(UpdateCertificateOptions -> UpdateCertificateOptions -> Bool)
-> (UpdateCertificateOptions -> UpdateCertificateOptions -> Bool)
-> Eq UpdateCertificateOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCertificateOptions -> UpdateCertificateOptions -> Bool
$c/= :: UpdateCertificateOptions -> UpdateCertificateOptions -> Bool
== :: UpdateCertificateOptions -> UpdateCertificateOptions -> Bool
$c== :: UpdateCertificateOptions -> UpdateCertificateOptions -> Bool
Prelude.Eq, ReadPrec [UpdateCertificateOptions]
ReadPrec UpdateCertificateOptions
Int -> ReadS UpdateCertificateOptions
ReadS [UpdateCertificateOptions]
(Int -> ReadS UpdateCertificateOptions)
-> ReadS [UpdateCertificateOptions]
-> ReadPrec UpdateCertificateOptions
-> ReadPrec [UpdateCertificateOptions]
-> Read UpdateCertificateOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCertificateOptions]
$creadListPrec :: ReadPrec [UpdateCertificateOptions]
readPrec :: ReadPrec UpdateCertificateOptions
$creadPrec :: ReadPrec UpdateCertificateOptions
readList :: ReadS [UpdateCertificateOptions]
$creadList :: ReadS [UpdateCertificateOptions]
readsPrec :: Int -> ReadS UpdateCertificateOptions
$creadsPrec :: Int -> ReadS UpdateCertificateOptions
Prelude.Read, Int -> UpdateCertificateOptions -> ShowS
[UpdateCertificateOptions] -> ShowS
UpdateCertificateOptions -> String
(Int -> UpdateCertificateOptions -> ShowS)
-> (UpdateCertificateOptions -> String)
-> ([UpdateCertificateOptions] -> ShowS)
-> Show UpdateCertificateOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCertificateOptions] -> ShowS
$cshowList :: [UpdateCertificateOptions] -> ShowS
show :: UpdateCertificateOptions -> String
$cshow :: UpdateCertificateOptions -> String
showsPrec :: Int -> UpdateCertificateOptions -> ShowS
$cshowsPrec :: Int -> UpdateCertificateOptions -> ShowS
Prelude.Show, (forall x.
 UpdateCertificateOptions -> Rep UpdateCertificateOptions x)
-> (forall x.
    Rep UpdateCertificateOptions x -> UpdateCertificateOptions)
-> Generic UpdateCertificateOptions
forall x.
Rep UpdateCertificateOptions x -> UpdateCertificateOptions
forall x.
UpdateCertificateOptions -> Rep UpdateCertificateOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateCertificateOptions x -> UpdateCertificateOptions
$cfrom :: forall x.
UpdateCertificateOptions -> Rep UpdateCertificateOptions x
Prelude.Generic)

-- |
-- Create a value of 'UpdateCertificateOptions' 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', 'updateCertificateOptions_certificateArn' - ARN of the requested certificate to update. This must be of the form:
--
-- @arn:aws:acm:us-east-1:account:certificate\/12345678-1234-1234-1234-123456789012 @
--
-- 'options', 'updateCertificateOptions_options' - Use to update the options for your certificate. Currently, you can
-- specify whether to add your certificate to a transparency log.
-- Certificate transparency makes it possible to detect SSL\/TLS
-- certificates that have been mistakenly or maliciously issued.
-- Certificates that have not been logged typically produce an error
-- message in a browser.
newUpdateCertificateOptions ::
  -- | 'certificateArn'
  Prelude.Text ->
  -- | 'options'
  CertificateOptions ->
  UpdateCertificateOptions
newUpdateCertificateOptions :: Text -> CertificateOptions -> UpdateCertificateOptions
newUpdateCertificateOptions
  Text
pCertificateArn_
  CertificateOptions
pOptions_ =
    UpdateCertificateOptions' :: Text -> CertificateOptions -> UpdateCertificateOptions
UpdateCertificateOptions'
      { $sel:certificateArn:UpdateCertificateOptions' :: Text
certificateArn =
          Text
pCertificateArn_,
        $sel:options:UpdateCertificateOptions' :: CertificateOptions
options = CertificateOptions
pOptions_
      }

-- | ARN of the requested certificate to update. This must be of the form:
--
-- @arn:aws:acm:us-east-1:account:certificate\/12345678-1234-1234-1234-123456789012 @
updateCertificateOptions_certificateArn :: Lens.Lens' UpdateCertificateOptions Prelude.Text
updateCertificateOptions_certificateArn :: (Text -> f Text)
-> UpdateCertificateOptions -> f UpdateCertificateOptions
updateCertificateOptions_certificateArn = (UpdateCertificateOptions -> Text)
-> (UpdateCertificateOptions -> Text -> UpdateCertificateOptions)
-> Lens UpdateCertificateOptions UpdateCertificateOptions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCertificateOptions' {Text
certificateArn :: Text
$sel:certificateArn:UpdateCertificateOptions' :: UpdateCertificateOptions -> Text
certificateArn} -> Text
certificateArn) (\s :: UpdateCertificateOptions
s@UpdateCertificateOptions' {} Text
a -> UpdateCertificateOptions
s {$sel:certificateArn:UpdateCertificateOptions' :: Text
certificateArn = Text
a} :: UpdateCertificateOptions)

-- | Use to update the options for your certificate. Currently, you can
-- specify whether to add your certificate to a transparency log.
-- Certificate transparency makes it possible to detect SSL\/TLS
-- certificates that have been mistakenly or maliciously issued.
-- Certificates that have not been logged typically produce an error
-- message in a browser.
updateCertificateOptions_options :: Lens.Lens' UpdateCertificateOptions CertificateOptions
updateCertificateOptions_options :: (CertificateOptions -> f CertificateOptions)
-> UpdateCertificateOptions -> f UpdateCertificateOptions
updateCertificateOptions_options = (UpdateCertificateOptions -> CertificateOptions)
-> (UpdateCertificateOptions
    -> CertificateOptions -> UpdateCertificateOptions)
-> Lens
     UpdateCertificateOptions
     UpdateCertificateOptions
     CertificateOptions
     CertificateOptions
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCertificateOptions' {CertificateOptions
options :: CertificateOptions
$sel:options:UpdateCertificateOptions' :: UpdateCertificateOptions -> CertificateOptions
options} -> CertificateOptions
options) (\s :: UpdateCertificateOptions
s@UpdateCertificateOptions' {} CertificateOptions
a -> UpdateCertificateOptions
s {$sel:options:UpdateCertificateOptions' :: CertificateOptions
options = CertificateOptions
a} :: UpdateCertificateOptions)

instance Core.AWSRequest UpdateCertificateOptions where
  type
    AWSResponse UpdateCertificateOptions =
      UpdateCertificateOptionsResponse
  request :: UpdateCertificateOptions -> Request UpdateCertificateOptions
request = Service
-> UpdateCertificateOptions -> Request UpdateCertificateOptions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateCertificateOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateCertificateOptions)))
response =
    AWSResponse UpdateCertificateOptions
-> Logger
-> Service
-> Proxy UpdateCertificateOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateCertificateOptions)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse UpdateCertificateOptions
UpdateCertificateOptionsResponse
UpdateCertificateOptionsResponse'

instance Prelude.Hashable UpdateCertificateOptions

instance Prelude.NFData UpdateCertificateOptions

instance Core.ToHeaders UpdateCertificateOptions where
  toHeaders :: UpdateCertificateOptions -> [Header]
toHeaders =
    [Header] -> UpdateCertificateOptions -> [Header]
forall a b. a -> b -> a
Prelude.const
      ( [[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"CertificateManager.UpdateCertificateOptions" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON UpdateCertificateOptions where
  toJSON :: UpdateCertificateOptions -> Value
toJSON UpdateCertificateOptions' {Text
CertificateOptions
options :: CertificateOptions
certificateArn :: Text
$sel:options:UpdateCertificateOptions' :: UpdateCertificateOptions -> CertificateOptions
$sel:certificateArn:UpdateCertificateOptions' :: UpdateCertificateOptions -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"CertificateArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Options" Text -> CertificateOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CertificateOptions
options)
          ]
      )

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

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

-- | /See:/ 'newUpdateCertificateOptionsResponse' smart constructor.
data UpdateCertificateOptionsResponse = UpdateCertificateOptionsResponse'
  {
  }
  deriving (UpdateCertificateOptionsResponse
-> UpdateCertificateOptionsResponse -> Bool
(UpdateCertificateOptionsResponse
 -> UpdateCertificateOptionsResponse -> Bool)
-> (UpdateCertificateOptionsResponse
    -> UpdateCertificateOptionsResponse -> Bool)
-> Eq UpdateCertificateOptionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCertificateOptionsResponse
-> UpdateCertificateOptionsResponse -> Bool
$c/= :: UpdateCertificateOptionsResponse
-> UpdateCertificateOptionsResponse -> Bool
== :: UpdateCertificateOptionsResponse
-> UpdateCertificateOptionsResponse -> Bool
$c== :: UpdateCertificateOptionsResponse
-> UpdateCertificateOptionsResponse -> Bool
Prelude.Eq, ReadPrec [UpdateCertificateOptionsResponse]
ReadPrec UpdateCertificateOptionsResponse
Int -> ReadS UpdateCertificateOptionsResponse
ReadS [UpdateCertificateOptionsResponse]
(Int -> ReadS UpdateCertificateOptionsResponse)
-> ReadS [UpdateCertificateOptionsResponse]
-> ReadPrec UpdateCertificateOptionsResponse
-> ReadPrec [UpdateCertificateOptionsResponse]
-> Read UpdateCertificateOptionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCertificateOptionsResponse]
$creadListPrec :: ReadPrec [UpdateCertificateOptionsResponse]
readPrec :: ReadPrec UpdateCertificateOptionsResponse
$creadPrec :: ReadPrec UpdateCertificateOptionsResponse
readList :: ReadS [UpdateCertificateOptionsResponse]
$creadList :: ReadS [UpdateCertificateOptionsResponse]
readsPrec :: Int -> ReadS UpdateCertificateOptionsResponse
$creadsPrec :: Int -> ReadS UpdateCertificateOptionsResponse
Prelude.Read, Int -> UpdateCertificateOptionsResponse -> ShowS
[UpdateCertificateOptionsResponse] -> ShowS
UpdateCertificateOptionsResponse -> String
(Int -> UpdateCertificateOptionsResponse -> ShowS)
-> (UpdateCertificateOptionsResponse -> String)
-> ([UpdateCertificateOptionsResponse] -> ShowS)
-> Show UpdateCertificateOptionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCertificateOptionsResponse] -> ShowS
$cshowList :: [UpdateCertificateOptionsResponse] -> ShowS
show :: UpdateCertificateOptionsResponse -> String
$cshow :: UpdateCertificateOptionsResponse -> String
showsPrec :: Int -> UpdateCertificateOptionsResponse -> ShowS
$cshowsPrec :: Int -> UpdateCertificateOptionsResponse -> ShowS
Prelude.Show, (forall x.
 UpdateCertificateOptionsResponse
 -> Rep UpdateCertificateOptionsResponse x)
-> (forall x.
    Rep UpdateCertificateOptionsResponse x
    -> UpdateCertificateOptionsResponse)
-> Generic UpdateCertificateOptionsResponse
forall x.
Rep UpdateCertificateOptionsResponse x
-> UpdateCertificateOptionsResponse
forall x.
UpdateCertificateOptionsResponse
-> Rep UpdateCertificateOptionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateCertificateOptionsResponse x
-> UpdateCertificateOptionsResponse
$cfrom :: forall x.
UpdateCertificateOptionsResponse
-> Rep UpdateCertificateOptionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateCertificateOptionsResponse' 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.
newUpdateCertificateOptionsResponse ::
  UpdateCertificateOptionsResponse
newUpdateCertificateOptionsResponse :: UpdateCertificateOptionsResponse
newUpdateCertificateOptionsResponse =
  UpdateCertificateOptionsResponse
UpdateCertificateOptionsResponse'

instance
  Prelude.NFData
    UpdateCertificateOptionsResponse