{-# 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.UpdateHostedZoneComment
-- 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 the comment for a specified hosted zone.
module Amazonka.Route53.UpdateHostedZoneComment
  ( -- * Creating a Request
    UpdateHostedZoneComment (..),
    newUpdateHostedZoneComment,

    -- * Request Lenses
    updateHostedZoneComment_comment,
    updateHostedZoneComment_id,

    -- * Destructuring the Response
    UpdateHostedZoneCommentResponse (..),
    newUpdateHostedZoneCommentResponse,

    -- * Response Lenses
    updateHostedZoneCommentResponse_httpStatus,
    updateHostedZoneCommentResponse_hostedZone,
  )
where

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

-- | A request to update the comment for a hosted zone.
--
-- /See:/ 'newUpdateHostedZoneComment' smart constructor.
data UpdateHostedZoneComment = UpdateHostedZoneComment'
  { -- | The new comment for the hosted zone. If you don\'t specify a value for
    -- @Comment@, Amazon Route 53 deletes the existing value of the @Comment@
    -- element, if any.
    UpdateHostedZoneComment -> Maybe Text
comment :: Prelude.Maybe Prelude.Text,
    -- | The ID for the hosted zone that you want to update the comment for.
    UpdateHostedZoneComment -> ResourceId
id :: ResourceId
  }
  deriving (UpdateHostedZoneComment -> UpdateHostedZoneComment -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateHostedZoneComment -> UpdateHostedZoneComment -> Bool
$c/= :: UpdateHostedZoneComment -> UpdateHostedZoneComment -> Bool
== :: UpdateHostedZoneComment -> UpdateHostedZoneComment -> Bool
$c== :: UpdateHostedZoneComment -> UpdateHostedZoneComment -> Bool
Prelude.Eq, ReadPrec [UpdateHostedZoneComment]
ReadPrec UpdateHostedZoneComment
Int -> ReadS UpdateHostedZoneComment
ReadS [UpdateHostedZoneComment]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateHostedZoneComment]
$creadListPrec :: ReadPrec [UpdateHostedZoneComment]
readPrec :: ReadPrec UpdateHostedZoneComment
$creadPrec :: ReadPrec UpdateHostedZoneComment
readList :: ReadS [UpdateHostedZoneComment]
$creadList :: ReadS [UpdateHostedZoneComment]
readsPrec :: Int -> ReadS UpdateHostedZoneComment
$creadsPrec :: Int -> ReadS UpdateHostedZoneComment
Prelude.Read, Int -> UpdateHostedZoneComment -> ShowS
[UpdateHostedZoneComment] -> ShowS
UpdateHostedZoneComment -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateHostedZoneComment] -> ShowS
$cshowList :: [UpdateHostedZoneComment] -> ShowS
show :: UpdateHostedZoneComment -> String
$cshow :: UpdateHostedZoneComment -> String
showsPrec :: Int -> UpdateHostedZoneComment -> ShowS
$cshowsPrec :: Int -> UpdateHostedZoneComment -> ShowS
Prelude.Show, forall x. Rep UpdateHostedZoneComment x -> UpdateHostedZoneComment
forall x. UpdateHostedZoneComment -> Rep UpdateHostedZoneComment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateHostedZoneComment x -> UpdateHostedZoneComment
$cfrom :: forall x. UpdateHostedZoneComment -> Rep UpdateHostedZoneComment x
Prelude.Generic)

-- |
-- Create a value of 'UpdateHostedZoneComment' 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:
--
-- 'comment', 'updateHostedZoneComment_comment' - The new comment for the hosted zone. If you don\'t specify a value for
-- @Comment@, Amazon Route 53 deletes the existing value of the @Comment@
-- element, if any.
--
-- 'id', 'updateHostedZoneComment_id' - The ID for the hosted zone that you want to update the comment for.
newUpdateHostedZoneComment ::
  -- | 'id'
  ResourceId ->
  UpdateHostedZoneComment
newUpdateHostedZoneComment :: ResourceId -> UpdateHostedZoneComment
newUpdateHostedZoneComment ResourceId
pId_ =
  UpdateHostedZoneComment'
    { $sel:comment:UpdateHostedZoneComment' :: Maybe Text
comment = forall a. Maybe a
Prelude.Nothing,
      $sel:id:UpdateHostedZoneComment' :: ResourceId
id = ResourceId
pId_
    }

-- | The new comment for the hosted zone. If you don\'t specify a value for
-- @Comment@, Amazon Route 53 deletes the existing value of the @Comment@
-- element, if any.
updateHostedZoneComment_comment :: Lens.Lens' UpdateHostedZoneComment (Prelude.Maybe Prelude.Text)
updateHostedZoneComment_comment :: Lens' UpdateHostedZoneComment (Maybe Text)
updateHostedZoneComment_comment = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHostedZoneComment' {Maybe Text
comment :: Maybe Text
$sel:comment:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> Maybe Text
comment} -> Maybe Text
comment) (\s :: UpdateHostedZoneComment
s@UpdateHostedZoneComment' {} Maybe Text
a -> UpdateHostedZoneComment
s {$sel:comment:UpdateHostedZoneComment' :: Maybe Text
comment = Maybe Text
a} :: UpdateHostedZoneComment)

-- | The ID for the hosted zone that you want to update the comment for.
updateHostedZoneComment_id :: Lens.Lens' UpdateHostedZoneComment ResourceId
updateHostedZoneComment_id :: Lens' UpdateHostedZoneComment ResourceId
updateHostedZoneComment_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHostedZoneComment' {ResourceId
id :: ResourceId
$sel:id:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> ResourceId
id} -> ResourceId
id) (\s :: UpdateHostedZoneComment
s@UpdateHostedZoneComment' {} ResourceId
a -> UpdateHostedZoneComment
s {$sel:id:UpdateHostedZoneComment' :: ResourceId
id = ResourceId
a} :: UpdateHostedZoneComment)

instance Core.AWSRequest UpdateHostedZoneComment where
  type
    AWSResponse UpdateHostedZoneComment =
      UpdateHostedZoneCommentResponse
  request :: (Service -> Service)
-> UpdateHostedZoneComment -> Request UpdateHostedZoneComment
request Service -> Service
overrides =
    forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateHostedZoneComment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateHostedZoneComment)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Int -> HostedZone -> UpdateHostedZoneCommentResponse
UpdateHostedZoneCommentResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String a
Data..@ Text
"HostedZone")
      )

instance Prelude.Hashable UpdateHostedZoneComment where
  hashWithSalt :: Int -> UpdateHostedZoneComment -> Int
hashWithSalt Int
_salt UpdateHostedZoneComment' {Maybe Text
ResourceId
id :: ResourceId
comment :: Maybe Text
$sel:id:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> ResourceId
$sel:comment:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
comment
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceId
id

instance Prelude.NFData UpdateHostedZoneComment where
  rnf :: UpdateHostedZoneComment -> ()
rnf UpdateHostedZoneComment' {Maybe Text
ResourceId
id :: ResourceId
comment :: Maybe Text
$sel:id:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> ResourceId
$sel:comment:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
comment seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceId
id

instance Data.ToElement UpdateHostedZoneComment where
  toElement :: UpdateHostedZoneComment -> Element
toElement =
    forall a. ToXML a => Name -> a -> Element
Data.mkElement
      Name
"{https://route53.amazonaws.com/doc/2013-04-01/}UpdateHostedZoneCommentRequest"

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

instance Data.ToPath UpdateHostedZoneComment where
  toPath :: UpdateHostedZoneComment -> ByteString
toPath UpdateHostedZoneComment' {Maybe Text
ResourceId
id :: ResourceId
comment :: Maybe Text
$sel:id:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> ResourceId
$sel:comment:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/2013-04-01/hostedzone/", forall a. ToByteString a => a -> ByteString
Data.toBS ResourceId
id]

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

instance Data.ToXML UpdateHostedZoneComment where
  toXML :: UpdateHostedZoneComment -> XML
toXML UpdateHostedZoneComment' {Maybe Text
ResourceId
id :: ResourceId
comment :: Maybe Text
$sel:id:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> ResourceId
$sel:comment:UpdateHostedZoneComment' :: UpdateHostedZoneComment -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Comment" forall a. ToXML a => Name -> a -> XML
Data.@= Maybe Text
comment]

-- | A complex type that contains the response to the
-- @UpdateHostedZoneComment@ request.
--
-- /See:/ 'newUpdateHostedZoneCommentResponse' smart constructor.
data UpdateHostedZoneCommentResponse = UpdateHostedZoneCommentResponse'
  { -- | The response's http status code.
    UpdateHostedZoneCommentResponse -> Int
httpStatus :: Prelude.Int,
    -- | A complex type that contains the response to the
    -- @UpdateHostedZoneComment@ request.
    UpdateHostedZoneCommentResponse -> HostedZone
hostedZone :: HostedZone
  }
  deriving (UpdateHostedZoneCommentResponse
-> UpdateHostedZoneCommentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateHostedZoneCommentResponse
-> UpdateHostedZoneCommentResponse -> Bool
$c/= :: UpdateHostedZoneCommentResponse
-> UpdateHostedZoneCommentResponse -> Bool
== :: UpdateHostedZoneCommentResponse
-> UpdateHostedZoneCommentResponse -> Bool
$c== :: UpdateHostedZoneCommentResponse
-> UpdateHostedZoneCommentResponse -> Bool
Prelude.Eq, ReadPrec [UpdateHostedZoneCommentResponse]
ReadPrec UpdateHostedZoneCommentResponse
Int -> ReadS UpdateHostedZoneCommentResponse
ReadS [UpdateHostedZoneCommentResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateHostedZoneCommentResponse]
$creadListPrec :: ReadPrec [UpdateHostedZoneCommentResponse]
readPrec :: ReadPrec UpdateHostedZoneCommentResponse
$creadPrec :: ReadPrec UpdateHostedZoneCommentResponse
readList :: ReadS [UpdateHostedZoneCommentResponse]
$creadList :: ReadS [UpdateHostedZoneCommentResponse]
readsPrec :: Int -> ReadS UpdateHostedZoneCommentResponse
$creadsPrec :: Int -> ReadS UpdateHostedZoneCommentResponse
Prelude.Read, Int -> UpdateHostedZoneCommentResponse -> ShowS
[UpdateHostedZoneCommentResponse] -> ShowS
UpdateHostedZoneCommentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateHostedZoneCommentResponse] -> ShowS
$cshowList :: [UpdateHostedZoneCommentResponse] -> ShowS
show :: UpdateHostedZoneCommentResponse -> String
$cshow :: UpdateHostedZoneCommentResponse -> String
showsPrec :: Int -> UpdateHostedZoneCommentResponse -> ShowS
$cshowsPrec :: Int -> UpdateHostedZoneCommentResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateHostedZoneCommentResponse x
-> UpdateHostedZoneCommentResponse
forall x.
UpdateHostedZoneCommentResponse
-> Rep UpdateHostedZoneCommentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateHostedZoneCommentResponse x
-> UpdateHostedZoneCommentResponse
$cfrom :: forall x.
UpdateHostedZoneCommentResponse
-> Rep UpdateHostedZoneCommentResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateHostedZoneCommentResponse' 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', 'updateHostedZoneCommentResponse_httpStatus' - The response's http status code.
--
-- 'hostedZone', 'updateHostedZoneCommentResponse_hostedZone' - A complex type that contains the response to the
-- @UpdateHostedZoneComment@ request.
newUpdateHostedZoneCommentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'hostedZone'
  HostedZone ->
  UpdateHostedZoneCommentResponse
newUpdateHostedZoneCommentResponse :: Int -> HostedZone -> UpdateHostedZoneCommentResponse
newUpdateHostedZoneCommentResponse
  Int
pHttpStatus_
  HostedZone
pHostedZone_ =
    UpdateHostedZoneCommentResponse'
      { $sel:httpStatus:UpdateHostedZoneCommentResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:hostedZone:UpdateHostedZoneCommentResponse' :: HostedZone
hostedZone = HostedZone
pHostedZone_
      }

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

-- | A complex type that contains the response to the
-- @UpdateHostedZoneComment@ request.
updateHostedZoneCommentResponse_hostedZone :: Lens.Lens' UpdateHostedZoneCommentResponse HostedZone
updateHostedZoneCommentResponse_hostedZone :: Lens' UpdateHostedZoneCommentResponse HostedZone
updateHostedZoneCommentResponse_hostedZone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHostedZoneCommentResponse' {HostedZone
hostedZone :: HostedZone
$sel:hostedZone:UpdateHostedZoneCommentResponse' :: UpdateHostedZoneCommentResponse -> HostedZone
hostedZone} -> HostedZone
hostedZone) (\s :: UpdateHostedZoneCommentResponse
s@UpdateHostedZoneCommentResponse' {} HostedZone
a -> UpdateHostedZoneCommentResponse
s {$sel:hostedZone:UpdateHostedZoneCommentResponse' :: HostedZone
hostedZone = HostedZone
a} :: UpdateHostedZoneCommentResponse)

instance
  Prelude.NFData
    UpdateHostedZoneCommentResponse
  where
  rnf :: UpdateHostedZoneCommentResponse -> ()
rnf UpdateHostedZoneCommentResponse' {Int
HostedZone
hostedZone :: HostedZone
httpStatus :: Int
$sel:hostedZone:UpdateHostedZoneCommentResponse' :: UpdateHostedZoneCommentResponse -> HostedZone
$sel:httpStatus:UpdateHostedZoneCommentResponse' :: UpdateHostedZoneCommentResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf HostedZone
hostedZone