{-# 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.DeleteKeySigningKey
-- 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)
--
-- Deletes a key-signing key (KSK). Before you can delete a KSK, you must
-- deactivate it. The KSK must be deactivated before you can delete it
-- regardless of whether the hosted zone is enabled for DNSSEC signing.
module Amazonka.Route53.DeleteKeySigningKey
  ( -- * Creating a Request
    DeleteKeySigningKey (..),
    newDeleteKeySigningKey,

    -- * Request Lenses
    deleteKeySigningKey_hostedZoneId,
    deleteKeySigningKey_name,

    -- * Destructuring the Response
    DeleteKeySigningKeyResponse (..),
    newDeleteKeySigningKeyResponse,

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

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

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

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

instance Core.AWSRequest DeleteKeySigningKey where
  type
    AWSResponse DeleteKeySigningKey =
      DeleteKeySigningKeyResponse
  request :: DeleteKeySigningKey -> Request DeleteKeySigningKey
request = Service -> DeleteKeySigningKey -> Request DeleteKeySigningKey
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteKeySigningKey
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteKeySigningKey)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse DeleteKeySigningKey))
-> Logger
-> Service
-> Proxy DeleteKeySigningKey
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteKeySigningKey)))
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 -> DeleteKeySigningKeyResponse
DeleteKeySigningKeyResponse'
            (Int -> ChangeInfo -> DeleteKeySigningKeyResponse)
-> Either String Int
-> Either String (ChangeInfo -> DeleteKeySigningKeyResponse)
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 -> DeleteKeySigningKeyResponse)
-> Either String ChangeInfo
-> Either String DeleteKeySigningKeyResponse
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 DeleteKeySigningKey

instance Prelude.NFData DeleteKeySigningKey

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

instance Core.ToPath DeleteKeySigningKey where
  toPath :: DeleteKeySigningKey -> ByteString
toPath DeleteKeySigningKey' {Text
ResourceId
name :: Text
hostedZoneId :: ResourceId
$sel:name:DeleteKeySigningKey' :: DeleteKeySigningKey -> Text
$sel:hostedZoneId:DeleteKeySigningKey' :: DeleteKeySigningKey -> 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
      ]

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

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

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

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

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

instance Prelude.NFData DeleteKeySigningKeyResponse