{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
      { $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 :: Lens' UpdateCertificateOptions Text
updateCertificateOptions_certificateArn = 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 :: Lens' UpdateCertificateOptions CertificateOptions
updateCertificateOptions_options = 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 :: (Service -> Service)
-> UpdateCertificateOptions -> Request UpdateCertificateOptions
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateCertificateOptions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateCertificateOptions)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      UpdateCertificateOptionsResponse
UpdateCertificateOptionsResponse'

instance Prelude.Hashable UpdateCertificateOptions where
  hashWithSalt :: Int -> UpdateCertificateOptions -> Int
hashWithSalt Int
_salt UpdateCertificateOptions' {Text
CertificateOptions
options :: CertificateOptions
certificateArn :: Text
$sel:options:UpdateCertificateOptions' :: UpdateCertificateOptions -> CertificateOptions
$sel:certificateArn:UpdateCertificateOptions' :: UpdateCertificateOptions -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
certificateArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CertificateOptions
options

instance Prelude.NFData UpdateCertificateOptions where
  rnf :: UpdateCertificateOptions -> ()
rnf UpdateCertificateOptions' {Text
CertificateOptions
options :: CertificateOptions
certificateArn :: Text
$sel:options:UpdateCertificateOptions' :: UpdateCertificateOptions -> CertificateOptions
$sel:certificateArn:UpdateCertificateOptions' :: UpdateCertificateOptions -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
certificateArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CertificateOptions
options

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

instance Data.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
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"CertificateArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
certificateArn),
            forall a. a -> Maybe a
Prelude.Just (Key
"Options" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= CertificateOptions
options)
          ]
      )

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

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

-- | /See:/ 'newUpdateCertificateOptionsResponse' smart constructor.
data UpdateCertificateOptionsResponse = UpdateCertificateOptionsResponse'
  {
  }
  deriving (UpdateCertificateOptionsResponse
-> UpdateCertificateOptionsResponse -> Bool
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]
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
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.
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
  where
  rnf :: UpdateCertificateOptionsResponse -> ()
rnf UpdateCertificateOptionsResponse
_ = ()