{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.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.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
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]
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
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. 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' {$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 :: Lens' DisableDomainAutoRenew Text
disableDomainAutoRenew_domainName = 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 :: (Service -> Service)
-> DisableDomainAutoRenew -> Request DisableDomainAutoRenew
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DisableDomainAutoRenew
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DisableDomainAutoRenew)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DisableDomainAutoRenewResponse
DisableDomainAutoRenewResponse'
            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))
      )

instance Prelude.Hashable DisableDomainAutoRenew where
  hashWithSalt :: Int -> DisableDomainAutoRenew -> Int
hashWithSalt Int
_salt DisableDomainAutoRenew' {Text
domainName :: Text
$sel:domainName:DisableDomainAutoRenew' :: DisableDomainAutoRenew -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName

instance Prelude.NFData DisableDomainAutoRenew where
  rnf :: DisableDomainAutoRenew -> ()
rnf DisableDomainAutoRenew' {Text
domainName :: Text
$sel:domainName:DisableDomainAutoRenew' :: DisableDomainAutoRenew -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
domainName

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

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

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

instance Data.ToQuery DisableDomainAutoRenew where
  toQuery :: DisableDomainAutoRenew -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:httpStatus:DisableDomainAutoRenewResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
disableDomainAutoRenewResponse_httpStatus :: Lens.Lens' DisableDomainAutoRenewResponse Prelude.Int
disableDomainAutoRenewResponse_httpStatus :: Lens' DisableDomainAutoRenewResponse Int
disableDomainAutoRenewResponse_httpStatus = 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
  where
  rnf :: DisableDomainAutoRenewResponse -> ()
rnf DisableDomainAutoRenewResponse' {Int
httpStatus :: Int
$sel:httpStatus:DisableDomainAutoRenewResponse' :: DisableDomainAutoRenewResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus