{-# 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.Route53.DeactivateKeySigningKey
-- 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)
--
-- Deactivates a key-signing key (KSK) so that it will not be used for
-- signing by DNSSEC. This operation changes the KSK status to @INACTIVE@.
module Amazonka.Route53.DeactivateKeySigningKey
  ( -- * Creating a Request
    DeactivateKeySigningKey (..),
    newDeactivateKeySigningKey,

    -- * Request Lenses
    deactivateKeySigningKey_hostedZoneId,
    deactivateKeySigningKey_name,

    -- * Destructuring the Response
    DeactivateKeySigningKeyResponse (..),
    newDeactivateKeySigningKeyResponse,

    -- * Response Lenses
    deactivateKeySigningKeyResponse_httpStatus,
    deactivateKeySigningKeyResponse_changeInfo,
  )
where

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
import Amazonka.Route53.Types

-- | /See:/ 'newDeactivateKeySigningKey' smart constructor.
data DeactivateKeySigningKey = DeactivateKeySigningKey'
  { -- | A unique string used to identify a hosted zone.
    DeactivateKeySigningKey -> ResourceId
hostedZoneId :: ResourceId,
    -- | A string used to identify a key-signing key (KSK).
    DeactivateKeySigningKey -> Text
name :: Prelude.Text
  }
  deriving (DeactivateKeySigningKey -> DeactivateKeySigningKey -> Bool
(DeactivateKeySigningKey -> DeactivateKeySigningKey -> Bool)
-> (DeactivateKeySigningKey -> DeactivateKeySigningKey -> Bool)
-> Eq DeactivateKeySigningKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeactivateKeySigningKey -> DeactivateKeySigningKey -> Bool
$c/= :: DeactivateKeySigningKey -> DeactivateKeySigningKey -> Bool
== :: DeactivateKeySigningKey -> DeactivateKeySigningKey -> Bool
$c== :: DeactivateKeySigningKey -> DeactivateKeySigningKey -> Bool
Prelude.Eq, ReadPrec [DeactivateKeySigningKey]
ReadPrec DeactivateKeySigningKey
Int -> ReadS DeactivateKeySigningKey
ReadS [DeactivateKeySigningKey]
(Int -> ReadS DeactivateKeySigningKey)
-> ReadS [DeactivateKeySigningKey]
-> ReadPrec DeactivateKeySigningKey
-> ReadPrec [DeactivateKeySigningKey]
-> Read DeactivateKeySigningKey
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeactivateKeySigningKey]
$creadListPrec :: ReadPrec [DeactivateKeySigningKey]
readPrec :: ReadPrec DeactivateKeySigningKey
$creadPrec :: ReadPrec DeactivateKeySigningKey
readList :: ReadS [DeactivateKeySigningKey]
$creadList :: ReadS [DeactivateKeySigningKey]
readsPrec :: Int -> ReadS DeactivateKeySigningKey
$creadsPrec :: Int -> ReadS DeactivateKeySigningKey
Prelude.Read, Int -> DeactivateKeySigningKey -> ShowS
[DeactivateKeySigningKey] -> ShowS
DeactivateKeySigningKey -> String
(Int -> DeactivateKeySigningKey -> ShowS)
-> (DeactivateKeySigningKey -> String)
-> ([DeactivateKeySigningKey] -> ShowS)
-> Show DeactivateKeySigningKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeactivateKeySigningKey] -> ShowS
$cshowList :: [DeactivateKeySigningKey] -> ShowS
show :: DeactivateKeySigningKey -> String
$cshow :: DeactivateKeySigningKey -> String
showsPrec :: Int -> DeactivateKeySigningKey -> ShowS
$cshowsPrec :: Int -> DeactivateKeySigningKey -> ShowS
Prelude.Show, (forall x.
 DeactivateKeySigningKey -> Rep DeactivateKeySigningKey x)
-> (forall x.
    Rep DeactivateKeySigningKey x -> DeactivateKeySigningKey)
-> Generic DeactivateKeySigningKey
forall x. Rep DeactivateKeySigningKey x -> DeactivateKeySigningKey
forall x. DeactivateKeySigningKey -> Rep DeactivateKeySigningKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeactivateKeySigningKey x -> DeactivateKeySigningKey
$cfrom :: forall x. DeactivateKeySigningKey -> Rep DeactivateKeySigningKey x
Prelude.Generic)

-- |
-- Create a value of 'DeactivateKeySigningKey' 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:
--
-- 'hostedZoneId', 'deactivateKeySigningKey_hostedZoneId' - A unique string used to identify a hosted zone.
--
-- 'name', 'deactivateKeySigningKey_name' - A string used to identify a key-signing key (KSK).
newDeactivateKeySigningKey ::
  -- | 'hostedZoneId'
  ResourceId ->
  -- | 'name'
  Prelude.Text ->
  DeactivateKeySigningKey
newDeactivateKeySigningKey :: ResourceId -> Text -> DeactivateKeySigningKey
newDeactivateKeySigningKey ResourceId
pHostedZoneId_ Text
pName_ =
  DeactivateKeySigningKey' :: ResourceId -> Text -> DeactivateKeySigningKey
DeactivateKeySigningKey'
    { $sel:hostedZoneId:DeactivateKeySigningKey' :: ResourceId
hostedZoneId =
        ResourceId
pHostedZoneId_,
      $sel:name:DeactivateKeySigningKey' :: Text
name = Text
pName_
    }

-- | A unique string used to identify a hosted zone.
deactivateKeySigningKey_hostedZoneId :: Lens.Lens' DeactivateKeySigningKey ResourceId
deactivateKeySigningKey_hostedZoneId :: (ResourceId -> f ResourceId)
-> DeactivateKeySigningKey -> f DeactivateKeySigningKey
deactivateKeySigningKey_hostedZoneId = (DeactivateKeySigningKey -> ResourceId)
-> (DeactivateKeySigningKey
    -> ResourceId -> DeactivateKeySigningKey)
-> Lens
     DeactivateKeySigningKey
     DeactivateKeySigningKey
     ResourceId
     ResourceId
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeactivateKeySigningKey' {ResourceId
hostedZoneId :: ResourceId
$sel:hostedZoneId:DeactivateKeySigningKey' :: DeactivateKeySigningKey -> ResourceId
hostedZoneId} -> ResourceId
hostedZoneId) (\s :: DeactivateKeySigningKey
s@DeactivateKeySigningKey' {} ResourceId
a -> DeactivateKeySigningKey
s {$sel:hostedZoneId:DeactivateKeySigningKey' :: ResourceId
hostedZoneId = ResourceId
a} :: DeactivateKeySigningKey)

-- | A string used to identify a key-signing key (KSK).
deactivateKeySigningKey_name :: Lens.Lens' DeactivateKeySigningKey Prelude.Text
deactivateKeySigningKey_name :: (Text -> f Text)
-> DeactivateKeySigningKey -> f DeactivateKeySigningKey
deactivateKeySigningKey_name = (DeactivateKeySigningKey -> Text)
-> (DeactivateKeySigningKey -> Text -> DeactivateKeySigningKey)
-> Lens DeactivateKeySigningKey DeactivateKeySigningKey Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeactivateKeySigningKey' {Text
name :: Text
$sel:name:DeactivateKeySigningKey' :: DeactivateKeySigningKey -> Text
name} -> Text
name) (\s :: DeactivateKeySigningKey
s@DeactivateKeySigningKey' {} Text
a -> DeactivateKeySigningKey
s {$sel:name:DeactivateKeySigningKey' :: Text
name = Text
a} :: DeactivateKeySigningKey)

instance Core.AWSRequest DeactivateKeySigningKey where
  type
    AWSResponse DeactivateKeySigningKey =
      DeactivateKeySigningKeyResponse
  request :: DeactivateKeySigningKey -> Request DeactivateKeySigningKey
request = Service
-> DeactivateKeySigningKey -> Request DeactivateKeySigningKey
forall a. ToRequest a => Service -> a -> Request a
Request.post Service
defaultService
  response :: Logger
-> Service
-> Proxy DeactivateKeySigningKey
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeactivateKeySigningKey)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse DeactivateKeySigningKey))
-> Logger
-> Service
-> Proxy DeactivateKeySigningKey
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeactivateKeySigningKey)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> ChangeInfo -> DeactivateKeySigningKeyResponse
DeactivateKeySigningKeyResponse'
            (Int -> ChangeInfo -> DeactivateKeySigningKeyResponse)
-> Either String Int
-> Either String (ChangeInfo -> DeactivateKeySigningKeyResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (ChangeInfo -> DeactivateKeySigningKeyResponse)
-> Either String ChangeInfo
-> Either String DeactivateKeySigningKeyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String ChangeInfo
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"ChangeInfo")
      )

instance Prelude.Hashable DeactivateKeySigningKey

instance Prelude.NFData DeactivateKeySigningKey

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

instance Core.ToPath DeactivateKeySigningKey where
  toPath :: DeactivateKeySigningKey -> ByteString
toPath DeactivateKeySigningKey' {Text
ResourceId
name :: Text
hostedZoneId :: ResourceId
$sel:name:DeactivateKeySigningKey' :: DeactivateKeySigningKey -> Text
$sel:hostedZoneId:DeactivateKeySigningKey' :: DeactivateKeySigningKey -> ResourceId
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2013-04-01/keysigningkey/",
        ResourceId -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ResourceId
hostedZoneId,
        ByteString
"/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name,
        ByteString
"/deactivate"
      ]

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

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

-- |
-- Create a value of 'DeactivateKeySigningKeyResponse' 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:
--
-- 'httpStatus', 'deactivateKeySigningKeyResponse_httpStatus' - The response's http status code.
--
-- 'changeInfo', 'deactivateKeySigningKeyResponse_changeInfo' - Undocumented member.
newDeactivateKeySigningKeyResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'changeInfo'
  ChangeInfo ->
  DeactivateKeySigningKeyResponse
newDeactivateKeySigningKeyResponse :: Int -> ChangeInfo -> DeactivateKeySigningKeyResponse
newDeactivateKeySigningKeyResponse
  Int
pHttpStatus_
  ChangeInfo
pChangeInfo_ =
    DeactivateKeySigningKeyResponse' :: Int -> ChangeInfo -> DeactivateKeySigningKeyResponse
DeactivateKeySigningKeyResponse'
      { $sel:httpStatus:DeactivateKeySigningKeyResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:changeInfo:DeactivateKeySigningKeyResponse' :: ChangeInfo
changeInfo = ChangeInfo
pChangeInfo_
      }

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

-- | Undocumented member.
deactivateKeySigningKeyResponse_changeInfo :: Lens.Lens' DeactivateKeySigningKeyResponse ChangeInfo
deactivateKeySigningKeyResponse_changeInfo :: (ChangeInfo -> f ChangeInfo)
-> DeactivateKeySigningKeyResponse
-> f DeactivateKeySigningKeyResponse
deactivateKeySigningKeyResponse_changeInfo = (DeactivateKeySigningKeyResponse -> ChangeInfo)
-> (DeactivateKeySigningKeyResponse
    -> ChangeInfo -> DeactivateKeySigningKeyResponse)
-> Lens
     DeactivateKeySigningKeyResponse
     DeactivateKeySigningKeyResponse
     ChangeInfo
     ChangeInfo
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeactivateKeySigningKeyResponse' {ChangeInfo
changeInfo :: ChangeInfo
$sel:changeInfo:DeactivateKeySigningKeyResponse' :: DeactivateKeySigningKeyResponse -> ChangeInfo
changeInfo} -> ChangeInfo
changeInfo) (\s :: DeactivateKeySigningKeyResponse
s@DeactivateKeySigningKeyResponse' {} ChangeInfo
a -> DeactivateKeySigningKeyResponse
s {$sel:changeInfo:DeactivateKeySigningKeyResponse' :: ChangeInfo
changeInfo = ChangeInfo
a} :: DeactivateKeySigningKeyResponse)

instance
  Prelude.NFData
    DeactivateKeySigningKeyResponse