{-# 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.Route53Domains.DisableDomainAutoRenew
-- 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)
--
-- This operation disables automatic renewal of domain registration for the
-- specified domain.
module Amazonka.Route53Domains.DisableDomainAutoRenew
  ( -- * Creating a Request
    DisableDomainAutoRenew (..),
    newDisableDomainAutoRenew,

    -- * Request Lenses
    disableDomainAutoRenew_domainName,

    -- * Destructuring the Response
    DisableDomainAutoRenewResponse (..),
    newDisableDomainAutoRenewResponse,

    -- * Response Lenses
    disableDomainAutoRenewResponse_httpStatus,
  )
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.Route53Domains.Types

-- | /See:/ 'newDisableDomainAutoRenew' smart constructor.
data DisableDomainAutoRenew = DisableDomainAutoRenew'
  { -- | The name of the domain that you want to disable automatic renewal for.
    DisableDomainAutoRenew -> Text
domainName :: Prelude.Text
  }
  deriving (DisableDomainAutoRenew -> DisableDomainAutoRenew -> Bool
(DisableDomainAutoRenew -> DisableDomainAutoRenew -> Bool)
-> (DisableDomainAutoRenew -> DisableDomainAutoRenew -> Bool)
-> Eq DisableDomainAutoRenew
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableDomainAutoRenew -> DisableDomainAutoRenew -> Bool
$c/= :: DisableDomainAutoRenew -> DisableDomainAutoRenew -> Bool
== :: DisableDomainAutoRenew -> DisableDomainAutoRenew -> Bool
$c== :: DisableDomainAutoRenew -> DisableDomainAutoRenew -> Bool
Prelude.Eq, ReadPrec [DisableDomainAutoRenew]
ReadPrec DisableDomainAutoRenew
Int -> ReadS DisableDomainAutoRenew
ReadS [DisableDomainAutoRenew]
(Int -> ReadS DisableDomainAutoRenew)
-> ReadS [DisableDomainAutoRenew]
-> ReadPrec DisableDomainAutoRenew
-> ReadPrec [DisableDomainAutoRenew]
-> Read DisableDomainAutoRenew
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableDomainAutoRenew]
$creadListPrec :: ReadPrec [DisableDomainAutoRenew]
readPrec :: ReadPrec DisableDomainAutoRenew
$creadPrec :: ReadPrec DisableDomainAutoRenew
readList :: ReadS [DisableDomainAutoRenew]
$creadList :: ReadS [DisableDomainAutoRenew]
readsPrec :: Int -> ReadS DisableDomainAutoRenew
$creadsPrec :: Int -> ReadS DisableDomainAutoRenew
Prelude.Read, Int -> DisableDomainAutoRenew -> ShowS
[DisableDomainAutoRenew] -> ShowS
DisableDomainAutoRenew -> String
(Int -> DisableDomainAutoRenew -> ShowS)
-> (DisableDomainAutoRenew -> String)
-> ([DisableDomainAutoRenew] -> ShowS)
-> Show DisableDomainAutoRenew
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableDomainAutoRenew] -> ShowS
$cshowList :: [DisableDomainAutoRenew] -> ShowS
show :: DisableDomainAutoRenew -> String
$cshow :: DisableDomainAutoRenew -> String
showsPrec :: Int -> DisableDomainAutoRenew -> ShowS
$cshowsPrec :: Int -> DisableDomainAutoRenew -> ShowS
Prelude.Show, (forall x. DisableDomainAutoRenew -> Rep DisableDomainAutoRenew x)
-> (forall x.
    Rep DisableDomainAutoRenew x -> DisableDomainAutoRenew)
-> Generic DisableDomainAutoRenew
forall x. Rep DisableDomainAutoRenew x -> DisableDomainAutoRenew
forall x. DisableDomainAutoRenew -> Rep DisableDomainAutoRenew x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DisableDomainAutoRenew x -> DisableDomainAutoRenew
$cfrom :: forall x. DisableDomainAutoRenew -> Rep DisableDomainAutoRenew x
Prelude.Generic)

-- |
-- Create a value of 'DisableDomainAutoRenew' 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:
--
-- 'domainName', 'disableDomainAutoRenew_domainName' - The name of the domain that you want to disable automatic renewal for.
newDisableDomainAutoRenew ::
  -- | 'domainName'
  Prelude.Text ->
  DisableDomainAutoRenew
newDisableDomainAutoRenew :: Text -> DisableDomainAutoRenew
newDisableDomainAutoRenew Text
pDomainName_ =
  DisableDomainAutoRenew' :: Text -> DisableDomainAutoRenew
DisableDomainAutoRenew' {$sel:domainName:DisableDomainAutoRenew' :: Text
domainName = Text
pDomainName_}

-- | The name of the domain that you want to disable automatic renewal for.
disableDomainAutoRenew_domainName :: Lens.Lens' DisableDomainAutoRenew Prelude.Text
disableDomainAutoRenew_domainName :: (Text -> f Text)
-> DisableDomainAutoRenew -> f DisableDomainAutoRenew
disableDomainAutoRenew_domainName = (DisableDomainAutoRenew -> Text)
-> (DisableDomainAutoRenew -> Text -> DisableDomainAutoRenew)
-> Lens DisableDomainAutoRenew DisableDomainAutoRenew Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DisableDomainAutoRenew' {Text
domainName :: Text
$sel:domainName:DisableDomainAutoRenew' :: DisableDomainAutoRenew -> Text
domainName} -> Text
domainName) (\s :: DisableDomainAutoRenew
s@DisableDomainAutoRenew' {} Text
a -> DisableDomainAutoRenew
s {$sel:domainName:DisableDomainAutoRenew' :: Text
domainName = Text
a} :: DisableDomainAutoRenew)

instance Core.AWSRequest DisableDomainAutoRenew where
  type
    AWSResponse DisableDomainAutoRenew =
      DisableDomainAutoRenewResponse
  request :: DisableDomainAutoRenew -> Request DisableDomainAutoRenew
request = Service -> DisableDomainAutoRenew -> Request DisableDomainAutoRenew
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DisableDomainAutoRenew
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableDomainAutoRenew)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DisableDomainAutoRenew))
-> Logger
-> Service
-> Proxy DisableDomainAutoRenew
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableDomainAutoRenew)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisableDomainAutoRenewResponse
DisableDomainAutoRenewResponse'
            (Int -> DisableDomainAutoRenewResponse)
-> Either String Int
-> Either String DisableDomainAutoRenewResponse
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))
      )

instance Prelude.Hashable DisableDomainAutoRenew

instance Prelude.NFData DisableDomainAutoRenew

instance Core.ToHeaders DisableDomainAutoRenew where
  toHeaders :: DisableDomainAutoRenew -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DisableDomainAutoRenew -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Route53Domains_v20140515.DisableDomainAutoRenew" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DisableDomainAutoRenew where
  toJSON :: DisableDomainAutoRenew -> Value
toJSON DisableDomainAutoRenew' {Text
domainName :: Text
$sel:domainName:DisableDomainAutoRenew' :: DisableDomainAutoRenew -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DomainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainName)]
      )

instance Core.ToPath DisableDomainAutoRenew where
  toPath :: DisableDomainAutoRenew -> ByteString
toPath = ByteString -> DisableDomainAutoRenew -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'DisableDomainAutoRenewResponse' 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', 'disableDomainAutoRenewResponse_httpStatus' - The response's http status code.
newDisableDomainAutoRenewResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DisableDomainAutoRenewResponse
newDisableDomainAutoRenewResponse :: Int -> DisableDomainAutoRenewResponse
newDisableDomainAutoRenewResponse Int
pHttpStatus_ =
  DisableDomainAutoRenewResponse' :: Int -> DisableDomainAutoRenewResponse
DisableDomainAutoRenewResponse'
    { $sel:httpStatus:DisableDomainAutoRenewResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DisableDomainAutoRenewResponse