{-# 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.EnableDomainAutoRenew
-- 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 configures Amazon Route 53 to automatically renew the
-- specified domain before the domain registration expires. The cost of
-- renewing your domain registration is billed to your Amazon Web Services
-- account.
--
-- The period during which you can renew a domain name varies by TLD. For a
-- list of TLDs and their renewal policies, see
-- <https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/registrar-tld-list.html Domains That You Can Register with Amazon Route 53>
-- in the /Amazon Route 53 Developer Guide/. Route 53 requires that you
-- renew before the end of the renewal period so we can complete processing
-- before the deadline.
module Amazonka.Route53Domains.EnableDomainAutoRenew
  ( -- * Creating a Request
    EnableDomainAutoRenew (..),
    newEnableDomainAutoRenew,

    -- * Request Lenses
    enableDomainAutoRenew_domainName,

    -- * Destructuring the Response
    EnableDomainAutoRenewResponse (..),
    newEnableDomainAutoRenewResponse,

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

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

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

instance Core.AWSRequest EnableDomainAutoRenew where
  type
    AWSResponse EnableDomainAutoRenew =
      EnableDomainAutoRenewResponse
  request :: (Service -> Service)
-> EnableDomainAutoRenew -> Request EnableDomainAutoRenew
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 EnableDomainAutoRenew
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse EnableDomainAutoRenew)))
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 -> EnableDomainAutoRenewResponse
EnableDomainAutoRenewResponse'
            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 EnableDomainAutoRenew where
  hashWithSalt :: Int -> EnableDomainAutoRenew -> Int
hashWithSalt Int
_salt EnableDomainAutoRenew' {Text
domainName :: Text
$sel:domainName:EnableDomainAutoRenew' :: EnableDomainAutoRenew -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainName

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

instance Data.ToHeaders EnableDomainAutoRenew where
  toHeaders :: EnableDomainAutoRenew -> 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.EnableDomainAutoRenew" ::
                          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 EnableDomainAutoRenew where
  toJSON :: EnableDomainAutoRenew -> Value
toJSON EnableDomainAutoRenew' {Text
domainName :: Text
$sel:domainName:EnableDomainAutoRenew' :: EnableDomainAutoRenew -> 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 EnableDomainAutoRenew where
  toPath :: EnableDomainAutoRenew -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

instance Prelude.NFData EnableDomainAutoRenewResponse where
  rnf :: EnableDomainAutoRenewResponse -> ()
rnf EnableDomainAutoRenewResponse' {Int
httpStatus :: Int
$sel:httpStatus:EnableDomainAutoRenewResponse' :: EnableDomainAutoRenewResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus