{-# 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-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)
--
-- 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.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

-- | 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
(UpdateHostedZoneComment -> UpdateHostedZoneComment -> Bool)
-> (UpdateHostedZoneComment -> UpdateHostedZoneComment -> Bool)
-> Eq UpdateHostedZoneComment
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]
(Int -> ReadS UpdateHostedZoneComment)
-> ReadS [UpdateHostedZoneComment]
-> ReadPrec UpdateHostedZoneComment
-> ReadPrec [UpdateHostedZoneComment]
-> Read 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
(Int -> UpdateHostedZoneComment -> ShowS)
-> (UpdateHostedZoneComment -> String)
-> ([UpdateHostedZoneComment] -> ShowS)
-> Show UpdateHostedZoneComment
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.
 UpdateHostedZoneComment -> Rep UpdateHostedZoneComment x)
-> (forall x.
    Rep UpdateHostedZoneComment x -> UpdateHostedZoneComment)
-> Generic UpdateHostedZoneComment
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' :: Maybe Text -> ResourceId -> UpdateHostedZoneComment
UpdateHostedZoneComment'
    { $sel:comment:UpdateHostedZoneComment' :: Maybe Text
comment = Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> UpdateHostedZoneComment -> f UpdateHostedZoneComment
updateHostedZoneComment_comment = (UpdateHostedZoneComment -> Maybe Text)
-> (UpdateHostedZoneComment
    -> Maybe Text -> UpdateHostedZoneComment)
-> Lens
     UpdateHostedZoneComment
     UpdateHostedZoneComment
     (Maybe Text)
     (Maybe Text)
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 :: (ResourceId -> f ResourceId)
-> UpdateHostedZoneComment -> f UpdateHostedZoneComment
updateHostedZoneComment_id = (UpdateHostedZoneComment -> ResourceId)
-> (UpdateHostedZoneComment
    -> ResourceId -> UpdateHostedZoneComment)
-> Lens
     UpdateHostedZoneComment
     UpdateHostedZoneComment
     ResourceId
     ResourceId
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 :: UpdateHostedZoneComment -> Request UpdateHostedZoneComment
request = Service
-> UpdateHostedZoneComment -> Request UpdateHostedZoneComment
forall a. (ToRequest a, ToElement a) => Service -> a -> Request a
Request.postXML Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateHostedZoneComment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateHostedZoneComment)))
response =
    (Int
 -> ResponseHeaders
 -> [Node]
 -> Either String (AWSResponse UpdateHostedZoneComment))
-> Logger
-> Service
-> Proxy UpdateHostedZoneComment
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateHostedZoneComment)))
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 -> HostedZone -> UpdateHostedZoneCommentResponse
UpdateHostedZoneCommentResponse'
            (Int -> HostedZone -> UpdateHostedZoneCommentResponse)
-> Either String Int
-> Either String (HostedZone -> UpdateHostedZoneCommentResponse)
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 (HostedZone -> UpdateHostedZoneCommentResponse)
-> Either String HostedZone
-> Either String UpdateHostedZoneCommentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String HostedZone
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"HostedZone")
      )

instance Prelude.Hashable UpdateHostedZoneComment

instance Prelude.NFData UpdateHostedZoneComment

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

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

instance Core.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
..} =
    [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
id]

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

instance Core.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
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat [Name
"Comment" Name -> Maybe Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= 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
(UpdateHostedZoneCommentResponse
 -> UpdateHostedZoneCommentResponse -> Bool)
-> (UpdateHostedZoneCommentResponse
    -> UpdateHostedZoneCommentResponse -> Bool)
-> Eq UpdateHostedZoneCommentResponse
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]
(Int -> ReadS UpdateHostedZoneCommentResponse)
-> ReadS [UpdateHostedZoneCommentResponse]
-> ReadPrec UpdateHostedZoneCommentResponse
-> ReadPrec [UpdateHostedZoneCommentResponse]
-> Read 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
(Int -> UpdateHostedZoneCommentResponse -> ShowS)
-> (UpdateHostedZoneCommentResponse -> String)
-> ([UpdateHostedZoneCommentResponse] -> ShowS)
-> Show UpdateHostedZoneCommentResponse
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.
 UpdateHostedZoneCommentResponse
 -> Rep UpdateHostedZoneCommentResponse x)
-> (forall x.
    Rep UpdateHostedZoneCommentResponse x
    -> UpdateHostedZoneCommentResponse)
-> Generic UpdateHostedZoneCommentResponse
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' :: Int -> HostedZone -> UpdateHostedZoneCommentResponse
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 :: (Int -> f Int)
-> UpdateHostedZoneCommentResponse
-> f UpdateHostedZoneCommentResponse
updateHostedZoneCommentResponse_httpStatus = (UpdateHostedZoneCommentResponse -> Int)
-> (UpdateHostedZoneCommentResponse
    -> Int -> UpdateHostedZoneCommentResponse)
-> Lens
     UpdateHostedZoneCommentResponse
     UpdateHostedZoneCommentResponse
     Int
     Int
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 :: (HostedZone -> f HostedZone)
-> UpdateHostedZoneCommentResponse
-> f UpdateHostedZoneCommentResponse
updateHostedZoneCommentResponse_hostedZone = (UpdateHostedZoneCommentResponse -> HostedZone)
-> (UpdateHostedZoneCommentResponse
    -> HostedZone -> UpdateHostedZoneCommentResponse)
-> Lens
     UpdateHostedZoneCommentResponse
     UpdateHostedZoneCommentResponse
     HostedZone
     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