{-# 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-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 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 AWS 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.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:/ '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
(EnableDomainAutoRenew -> EnableDomainAutoRenew -> Bool)
-> (EnableDomainAutoRenew -> EnableDomainAutoRenew -> Bool)
-> Eq EnableDomainAutoRenew
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]
(Int -> ReadS EnableDomainAutoRenew)
-> ReadS [EnableDomainAutoRenew]
-> ReadPrec EnableDomainAutoRenew
-> ReadPrec [EnableDomainAutoRenew]
-> Read 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
(Int -> EnableDomainAutoRenew -> ShowS)
-> (EnableDomainAutoRenew -> String)
-> ([EnableDomainAutoRenew] -> ShowS)
-> Show EnableDomainAutoRenew
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. EnableDomainAutoRenew -> Rep EnableDomainAutoRenew x)
-> (forall x. Rep EnableDomainAutoRenew x -> EnableDomainAutoRenew)
-> Generic EnableDomainAutoRenew
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' :: Text -> EnableDomainAutoRenew
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 :: (Text -> f Text)
-> EnableDomainAutoRenew -> f EnableDomainAutoRenew
enableDomainAutoRenew_domainName = (EnableDomainAutoRenew -> Text)
-> (EnableDomainAutoRenew -> Text -> EnableDomainAutoRenew)
-> Lens EnableDomainAutoRenew EnableDomainAutoRenew Text Text
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 :: EnableDomainAutoRenew -> Request EnableDomainAutoRenew
request = Service -> EnableDomainAutoRenew -> Request EnableDomainAutoRenew
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy EnableDomainAutoRenew
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse EnableDomainAutoRenew)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse EnableDomainAutoRenew))
-> Logger
-> Service
-> Proxy EnableDomainAutoRenew
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse EnableDomainAutoRenew)))
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 -> EnableDomainAutoRenewResponse
EnableDomainAutoRenewResponse'
            (Int -> EnableDomainAutoRenewResponse)
-> Either String Int -> Either String EnableDomainAutoRenewResponse
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 EnableDomainAutoRenew

instance Prelude.NFData EnableDomainAutoRenew

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

instance Core.ToQuery EnableDomainAutoRenew where
  toQuery :: EnableDomainAutoRenew -> QueryString
toQuery = QueryString -> EnableDomainAutoRenew -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(EnableDomainAutoRenewResponse
 -> EnableDomainAutoRenewResponse -> Bool)
-> (EnableDomainAutoRenewResponse
    -> EnableDomainAutoRenewResponse -> Bool)
-> Eq EnableDomainAutoRenewResponse
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]
(Int -> ReadS EnableDomainAutoRenewResponse)
-> ReadS [EnableDomainAutoRenewResponse]
-> ReadPrec EnableDomainAutoRenewResponse
-> ReadPrec [EnableDomainAutoRenewResponse]
-> Read 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
(Int -> EnableDomainAutoRenewResponse -> ShowS)
-> (EnableDomainAutoRenewResponse -> String)
-> ([EnableDomainAutoRenewResponse] -> ShowS)
-> Show EnableDomainAutoRenewResponse
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.
 EnableDomainAutoRenewResponse
 -> Rep EnableDomainAutoRenewResponse x)
-> (forall x.
    Rep EnableDomainAutoRenewResponse x
    -> EnableDomainAutoRenewResponse)
-> Generic EnableDomainAutoRenewResponse
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' :: Int -> EnableDomainAutoRenewResponse
EnableDomainAutoRenewResponse'
    { $sel:httpStatus:EnableDomainAutoRenewResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
enableDomainAutoRenewResponse_httpStatus :: Lens.Lens' EnableDomainAutoRenewResponse Prelude.Int
enableDomainAutoRenewResponse_httpStatus :: (Int -> f Int)
-> EnableDomainAutoRenewResponse -> f EnableDomainAutoRenewResponse
enableDomainAutoRenewResponse_httpStatus = (EnableDomainAutoRenewResponse -> Int)
-> (EnableDomainAutoRenewResponse
    -> Int -> EnableDomainAutoRenewResponse)
-> Lens
     EnableDomainAutoRenewResponse EnableDomainAutoRenewResponse Int Int
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