{-# 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 #-}
module Amazonka.Route53Domains.RenewDomain
(
RenewDomain (..),
newRenewDomain,
renewDomain_durationInYears,
renewDomain_domainName,
renewDomain_currentExpiryYear,
RenewDomainResponse (..),
newRenewDomainResponse,
renewDomainResponse_httpStatus,
renewDomainResponse_operationId,
)
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
data RenewDomain = RenewDomain'
{
RenewDomain -> Maybe Natural
durationInYears :: Prelude.Maybe Prelude.Natural,
RenewDomain -> Text
domainName :: Prelude.Text,
RenewDomain -> Int
currentExpiryYear :: Prelude.Int
}
deriving (RenewDomain -> RenewDomain -> Bool
(RenewDomain -> RenewDomain -> Bool)
-> (RenewDomain -> RenewDomain -> Bool) -> Eq RenewDomain
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenewDomain -> RenewDomain -> Bool
$c/= :: RenewDomain -> RenewDomain -> Bool
== :: RenewDomain -> RenewDomain -> Bool
$c== :: RenewDomain -> RenewDomain -> Bool
Prelude.Eq, ReadPrec [RenewDomain]
ReadPrec RenewDomain
Int -> ReadS RenewDomain
ReadS [RenewDomain]
(Int -> ReadS RenewDomain)
-> ReadS [RenewDomain]
-> ReadPrec RenewDomain
-> ReadPrec [RenewDomain]
-> Read RenewDomain
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenewDomain]
$creadListPrec :: ReadPrec [RenewDomain]
readPrec :: ReadPrec RenewDomain
$creadPrec :: ReadPrec RenewDomain
readList :: ReadS [RenewDomain]
$creadList :: ReadS [RenewDomain]
readsPrec :: Int -> ReadS RenewDomain
$creadsPrec :: Int -> ReadS RenewDomain
Prelude.Read, Int -> RenewDomain -> ShowS
[RenewDomain] -> ShowS
RenewDomain -> String
(Int -> RenewDomain -> ShowS)
-> (RenewDomain -> String)
-> ([RenewDomain] -> ShowS)
-> Show RenewDomain
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenewDomain] -> ShowS
$cshowList :: [RenewDomain] -> ShowS
show :: RenewDomain -> String
$cshow :: RenewDomain -> String
showsPrec :: Int -> RenewDomain -> ShowS
$cshowsPrec :: Int -> RenewDomain -> ShowS
Prelude.Show, (forall x. RenewDomain -> Rep RenewDomain x)
-> (forall x. Rep RenewDomain x -> RenewDomain)
-> Generic RenewDomain
forall x. Rep RenewDomain x -> RenewDomain
forall x. RenewDomain -> Rep RenewDomain x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenewDomain x -> RenewDomain
$cfrom :: forall x. RenewDomain -> Rep RenewDomain x
Prelude.Generic)
newRenewDomain ::
Prelude.Text ->
Prelude.Int ->
RenewDomain
newRenewDomain :: Text -> Int -> RenewDomain
newRenewDomain Text
pDomainName_ Int
pCurrentExpiryYear_ =
RenewDomain' :: Maybe Natural -> Text -> Int -> RenewDomain
RenewDomain'
{ $sel:durationInYears:RenewDomain' :: Maybe Natural
durationInYears = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:domainName:RenewDomain' :: Text
domainName = Text
pDomainName_,
$sel:currentExpiryYear:RenewDomain' :: Int
currentExpiryYear = Int
pCurrentExpiryYear_
}
renewDomain_durationInYears :: Lens.Lens' RenewDomain (Prelude.Maybe Prelude.Natural)
renewDomain_durationInYears :: (Maybe Natural -> f (Maybe Natural))
-> RenewDomain -> f RenewDomain
renewDomain_durationInYears = (RenewDomain -> Maybe Natural)
-> (RenewDomain -> Maybe Natural -> RenewDomain)
-> Lens RenewDomain RenewDomain (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenewDomain' {Maybe Natural
durationInYears :: Maybe Natural
$sel:durationInYears:RenewDomain' :: RenewDomain -> Maybe Natural
durationInYears} -> Maybe Natural
durationInYears) (\s :: RenewDomain
s@RenewDomain' {} Maybe Natural
a -> RenewDomain
s {$sel:durationInYears:RenewDomain' :: Maybe Natural
durationInYears = Maybe Natural
a} :: RenewDomain)
renewDomain_domainName :: Lens.Lens' RenewDomain Prelude.Text
renewDomain_domainName :: (Text -> f Text) -> RenewDomain -> f RenewDomain
renewDomain_domainName = (RenewDomain -> Text)
-> (RenewDomain -> Text -> RenewDomain)
-> Lens RenewDomain RenewDomain Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenewDomain' {Text
domainName :: Text
$sel:domainName:RenewDomain' :: RenewDomain -> Text
domainName} -> Text
domainName) (\s :: RenewDomain
s@RenewDomain' {} Text
a -> RenewDomain
s {$sel:domainName:RenewDomain' :: Text
domainName = Text
a} :: RenewDomain)
renewDomain_currentExpiryYear :: Lens.Lens' RenewDomain Prelude.Int
renewDomain_currentExpiryYear :: (Int -> f Int) -> RenewDomain -> f RenewDomain
renewDomain_currentExpiryYear = (RenewDomain -> Int)
-> (RenewDomain -> Int -> RenewDomain)
-> Lens RenewDomain RenewDomain Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenewDomain' {Int
currentExpiryYear :: Int
$sel:currentExpiryYear:RenewDomain' :: RenewDomain -> Int
currentExpiryYear} -> Int
currentExpiryYear) (\s :: RenewDomain
s@RenewDomain' {} Int
a -> RenewDomain
s {$sel:currentExpiryYear:RenewDomain' :: Int
currentExpiryYear = Int
a} :: RenewDomain)
instance Core.AWSRequest RenewDomain where
type AWSResponse RenewDomain = RenewDomainResponse
request :: RenewDomain -> Request RenewDomain
request = Service -> RenewDomain -> Request RenewDomain
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RenewDomain
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RenewDomain)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RenewDomain))
-> Logger
-> Service
-> Proxy RenewDomain
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RenewDomain)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int -> Text -> RenewDomainResponse
RenewDomainResponse'
(Int -> Text -> RenewDomainResponse)
-> Either String Int -> Either String (Text -> RenewDomainResponse)
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 (Text -> RenewDomainResponse)
-> Either String Text -> Either String RenewDomainResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"OperationId")
)
instance Prelude.Hashable RenewDomain
instance Prelude.NFData RenewDomain
instance Core.ToHeaders RenewDomain where
toHeaders :: RenewDomain -> ResponseHeaders
toHeaders =
ResponseHeaders -> RenewDomain -> 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.RenewDomain" ::
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 RenewDomain where
toJSON :: RenewDomain -> Value
toJSON RenewDomain' {Int
Maybe Natural
Text
currentExpiryYear :: Int
domainName :: Text
durationInYears :: Maybe Natural
$sel:currentExpiryYear:RenewDomain' :: RenewDomain -> Int
$sel:domainName:RenewDomain' :: RenewDomain -> Text
$sel:durationInYears:RenewDomain' :: RenewDomain -> Maybe Natural
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"DurationInYears" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
durationInYears,
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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"CurrentExpiryYear" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
currentExpiryYear)
]
)
instance Core.ToPath RenewDomain where
toPath :: RenewDomain -> ByteString
toPath = ByteString -> RenewDomain -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RenewDomain where
toQuery :: RenewDomain -> QueryString
toQuery = QueryString -> RenewDomain -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RenewDomainResponse = RenewDomainResponse'
{
RenewDomainResponse -> Int
httpStatus :: Prelude.Int,
RenewDomainResponse -> Text
operationId :: Prelude.Text
}
deriving (RenewDomainResponse -> RenewDomainResponse -> Bool
(RenewDomainResponse -> RenewDomainResponse -> Bool)
-> (RenewDomainResponse -> RenewDomainResponse -> Bool)
-> Eq RenewDomainResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RenewDomainResponse -> RenewDomainResponse -> Bool
$c/= :: RenewDomainResponse -> RenewDomainResponse -> Bool
== :: RenewDomainResponse -> RenewDomainResponse -> Bool
$c== :: RenewDomainResponse -> RenewDomainResponse -> Bool
Prelude.Eq, ReadPrec [RenewDomainResponse]
ReadPrec RenewDomainResponse
Int -> ReadS RenewDomainResponse
ReadS [RenewDomainResponse]
(Int -> ReadS RenewDomainResponse)
-> ReadS [RenewDomainResponse]
-> ReadPrec RenewDomainResponse
-> ReadPrec [RenewDomainResponse]
-> Read RenewDomainResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RenewDomainResponse]
$creadListPrec :: ReadPrec [RenewDomainResponse]
readPrec :: ReadPrec RenewDomainResponse
$creadPrec :: ReadPrec RenewDomainResponse
readList :: ReadS [RenewDomainResponse]
$creadList :: ReadS [RenewDomainResponse]
readsPrec :: Int -> ReadS RenewDomainResponse
$creadsPrec :: Int -> ReadS RenewDomainResponse
Prelude.Read, Int -> RenewDomainResponse -> ShowS
[RenewDomainResponse] -> ShowS
RenewDomainResponse -> String
(Int -> RenewDomainResponse -> ShowS)
-> (RenewDomainResponse -> String)
-> ([RenewDomainResponse] -> ShowS)
-> Show RenewDomainResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RenewDomainResponse] -> ShowS
$cshowList :: [RenewDomainResponse] -> ShowS
show :: RenewDomainResponse -> String
$cshow :: RenewDomainResponse -> String
showsPrec :: Int -> RenewDomainResponse -> ShowS
$cshowsPrec :: Int -> RenewDomainResponse -> ShowS
Prelude.Show, (forall x. RenewDomainResponse -> Rep RenewDomainResponse x)
-> (forall x. Rep RenewDomainResponse x -> RenewDomainResponse)
-> Generic RenewDomainResponse
forall x. Rep RenewDomainResponse x -> RenewDomainResponse
forall x. RenewDomainResponse -> Rep RenewDomainResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RenewDomainResponse x -> RenewDomainResponse
$cfrom :: forall x. RenewDomainResponse -> Rep RenewDomainResponse x
Prelude.Generic)
newRenewDomainResponse ::
Prelude.Int ->
Prelude.Text ->
RenewDomainResponse
newRenewDomainResponse :: Int -> Text -> RenewDomainResponse
newRenewDomainResponse Int
pHttpStatus_ Text
pOperationId_ =
RenewDomainResponse' :: Int -> Text -> RenewDomainResponse
RenewDomainResponse'
{ $sel:httpStatus:RenewDomainResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:operationId:RenewDomainResponse' :: Text
operationId = Text
pOperationId_
}
renewDomainResponse_httpStatus :: Lens.Lens' RenewDomainResponse Prelude.Int
renewDomainResponse_httpStatus :: (Int -> f Int) -> RenewDomainResponse -> f RenewDomainResponse
renewDomainResponse_httpStatus = (RenewDomainResponse -> Int)
-> (RenewDomainResponse -> Int -> RenewDomainResponse)
-> Lens RenewDomainResponse RenewDomainResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenewDomainResponse' {Int
httpStatus :: Int
$sel:httpStatus:RenewDomainResponse' :: RenewDomainResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RenewDomainResponse
s@RenewDomainResponse' {} Int
a -> RenewDomainResponse
s {$sel:httpStatus:RenewDomainResponse' :: Int
httpStatus = Int
a} :: RenewDomainResponse)
renewDomainResponse_operationId :: Lens.Lens' RenewDomainResponse Prelude.Text
renewDomainResponse_operationId :: (Text -> f Text) -> RenewDomainResponse -> f RenewDomainResponse
renewDomainResponse_operationId = (RenewDomainResponse -> Text)
-> (RenewDomainResponse -> Text -> RenewDomainResponse)
-> Lens RenewDomainResponse RenewDomainResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RenewDomainResponse' {Text
operationId :: Text
$sel:operationId:RenewDomainResponse' :: RenewDomainResponse -> Text
operationId} -> Text
operationId) (\s :: RenewDomainResponse
s@RenewDomainResponse' {} Text
a -> RenewDomainResponse
s {$sel:operationId:RenewDomainResponse' :: Text
operationId = Text
a} :: RenewDomainResponse)
instance Prelude.NFData RenewDomainResponse