{-# 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.EnableHostedZoneDNSSEC
-- 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)
--
-- Enables DNSSEC signing in a specific hosted zone.
module Amazonka.Route53.EnableHostedZoneDNSSEC
  ( -- * Creating a Request
    EnableHostedZoneDNSSEC (..),
    newEnableHostedZoneDNSSEC,

    -- * Request Lenses
    enableHostedZoneDNSSEC_hostedZoneId,

    -- * Destructuring the Response
    EnableHostedZoneDNSSECResponse (..),
    newEnableHostedZoneDNSSECResponse,

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

-- |
-- Create a value of 'EnableHostedZoneDNSSEC' 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', 'enableHostedZoneDNSSEC_hostedZoneId' - A unique string used to identify a hosted zone.
newEnableHostedZoneDNSSEC ::
  -- | 'hostedZoneId'
  ResourceId ->
  EnableHostedZoneDNSSEC
newEnableHostedZoneDNSSEC :: ResourceId -> EnableHostedZoneDNSSEC
newEnableHostedZoneDNSSEC ResourceId
pHostedZoneId_ =
  EnableHostedZoneDNSSEC' :: ResourceId -> EnableHostedZoneDNSSEC
EnableHostedZoneDNSSEC'
    { $sel:hostedZoneId:EnableHostedZoneDNSSEC' :: ResourceId
hostedZoneId =
        ResourceId
pHostedZoneId_
    }

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

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

instance Prelude.NFData EnableHostedZoneDNSSEC

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

instance Core.ToPath EnableHostedZoneDNSSEC where
  toPath :: EnableHostedZoneDNSSEC -> ByteString
toPath EnableHostedZoneDNSSEC' {ResourceId
hostedZoneId :: ResourceId
$sel:hostedZoneId:EnableHostedZoneDNSSEC' :: EnableHostedZoneDNSSEC -> ResourceId
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2013-04-01/hostedzone/",
        ResourceId -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ResourceId
hostedZoneId,
        ByteString
"/enable-dnssec"
      ]

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

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

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

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

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

instance
  Prelude.NFData
    EnableHostedZoneDNSSECResponse