{-# 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.CheckDomainAvailability
(
CheckDomainAvailability (..),
newCheckDomainAvailability,
checkDomainAvailability_idnLangCode,
checkDomainAvailability_domainName,
CheckDomainAvailabilityResponse (..),
newCheckDomainAvailabilityResponse,
checkDomainAvailabilityResponse_httpStatus,
checkDomainAvailabilityResponse_availability,
)
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 CheckDomainAvailability = CheckDomainAvailability'
{
CheckDomainAvailability -> Maybe Text
idnLangCode :: Prelude.Maybe Prelude.Text,
CheckDomainAvailability -> Text
domainName :: Prelude.Text
}
deriving (CheckDomainAvailability -> CheckDomainAvailability -> Bool
(CheckDomainAvailability -> CheckDomainAvailability -> Bool)
-> (CheckDomainAvailability -> CheckDomainAvailability -> Bool)
-> Eq CheckDomainAvailability
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CheckDomainAvailability -> CheckDomainAvailability -> Bool
$c/= :: CheckDomainAvailability -> CheckDomainAvailability -> Bool
== :: CheckDomainAvailability -> CheckDomainAvailability -> Bool
$c== :: CheckDomainAvailability -> CheckDomainAvailability -> Bool
Prelude.Eq, ReadPrec [CheckDomainAvailability]
ReadPrec CheckDomainAvailability
Int -> ReadS CheckDomainAvailability
ReadS [CheckDomainAvailability]
(Int -> ReadS CheckDomainAvailability)
-> ReadS [CheckDomainAvailability]
-> ReadPrec CheckDomainAvailability
-> ReadPrec [CheckDomainAvailability]
-> Read CheckDomainAvailability
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CheckDomainAvailability]
$creadListPrec :: ReadPrec [CheckDomainAvailability]
readPrec :: ReadPrec CheckDomainAvailability
$creadPrec :: ReadPrec CheckDomainAvailability
readList :: ReadS [CheckDomainAvailability]
$creadList :: ReadS [CheckDomainAvailability]
readsPrec :: Int -> ReadS CheckDomainAvailability
$creadsPrec :: Int -> ReadS CheckDomainAvailability
Prelude.Read, Int -> CheckDomainAvailability -> ShowS
[CheckDomainAvailability] -> ShowS
CheckDomainAvailability -> String
(Int -> CheckDomainAvailability -> ShowS)
-> (CheckDomainAvailability -> String)
-> ([CheckDomainAvailability] -> ShowS)
-> Show CheckDomainAvailability
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CheckDomainAvailability] -> ShowS
$cshowList :: [CheckDomainAvailability] -> ShowS
show :: CheckDomainAvailability -> String
$cshow :: CheckDomainAvailability -> String
showsPrec :: Int -> CheckDomainAvailability -> ShowS
$cshowsPrec :: Int -> CheckDomainAvailability -> ShowS
Prelude.Show, (forall x.
CheckDomainAvailability -> Rep CheckDomainAvailability x)
-> (forall x.
Rep CheckDomainAvailability x -> CheckDomainAvailability)
-> Generic CheckDomainAvailability
forall x. Rep CheckDomainAvailability x -> CheckDomainAvailability
forall x. CheckDomainAvailability -> Rep CheckDomainAvailability x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CheckDomainAvailability x -> CheckDomainAvailability
$cfrom :: forall x. CheckDomainAvailability -> Rep CheckDomainAvailability x
Prelude.Generic)
newCheckDomainAvailability ::
Prelude.Text ->
CheckDomainAvailability
newCheckDomainAvailability :: Text -> CheckDomainAvailability
newCheckDomainAvailability Text
pDomainName_ =
CheckDomainAvailability' :: Maybe Text -> Text -> CheckDomainAvailability
CheckDomainAvailability'
{ $sel:idnLangCode:CheckDomainAvailability' :: Maybe Text
idnLangCode =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:domainName:CheckDomainAvailability' :: Text
domainName = Text
pDomainName_
}
checkDomainAvailability_idnLangCode :: Lens.Lens' CheckDomainAvailability (Prelude.Maybe Prelude.Text)
checkDomainAvailability_idnLangCode :: (Maybe Text -> f (Maybe Text))
-> CheckDomainAvailability -> f CheckDomainAvailability
checkDomainAvailability_idnLangCode = (CheckDomainAvailability -> Maybe Text)
-> (CheckDomainAvailability
-> Maybe Text -> CheckDomainAvailability)
-> Lens
CheckDomainAvailability
CheckDomainAvailability
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckDomainAvailability' {Maybe Text
idnLangCode :: Maybe Text
$sel:idnLangCode:CheckDomainAvailability' :: CheckDomainAvailability -> Maybe Text
idnLangCode} -> Maybe Text
idnLangCode) (\s :: CheckDomainAvailability
s@CheckDomainAvailability' {} Maybe Text
a -> CheckDomainAvailability
s {$sel:idnLangCode:CheckDomainAvailability' :: Maybe Text
idnLangCode = Maybe Text
a} :: CheckDomainAvailability)
checkDomainAvailability_domainName :: Lens.Lens' CheckDomainAvailability Prelude.Text
checkDomainAvailability_domainName :: (Text -> f Text)
-> CheckDomainAvailability -> f CheckDomainAvailability
checkDomainAvailability_domainName = (CheckDomainAvailability -> Text)
-> (CheckDomainAvailability -> Text -> CheckDomainAvailability)
-> Lens CheckDomainAvailability CheckDomainAvailability Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckDomainAvailability' {Text
domainName :: Text
$sel:domainName:CheckDomainAvailability' :: CheckDomainAvailability -> Text
domainName} -> Text
domainName) (\s :: CheckDomainAvailability
s@CheckDomainAvailability' {} Text
a -> CheckDomainAvailability
s {$sel:domainName:CheckDomainAvailability' :: Text
domainName = Text
a} :: CheckDomainAvailability)
instance Core.AWSRequest CheckDomainAvailability where
type
AWSResponse CheckDomainAvailability =
CheckDomainAvailabilityResponse
request :: CheckDomainAvailability -> Request CheckDomainAvailability
request = Service
-> CheckDomainAvailability -> Request CheckDomainAvailability
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy CheckDomainAvailability
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CheckDomainAvailability)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse CheckDomainAvailability))
-> Logger
-> Service
-> Proxy CheckDomainAvailability
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse CheckDomainAvailability)))
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 -> DomainAvailability -> CheckDomainAvailabilityResponse
CheckDomainAvailabilityResponse'
(Int -> DomainAvailability -> CheckDomainAvailabilityResponse)
-> Either String Int
-> Either
String (DomainAvailability -> CheckDomainAvailabilityResponse)
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 (DomainAvailability -> CheckDomainAvailabilityResponse)
-> Either String DomainAvailability
-> Either String CheckDomainAvailabilityResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String DomainAvailability
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Availability")
)
instance Prelude.Hashable CheckDomainAvailability
instance Prelude.NFData CheckDomainAvailability
instance Core.ToHeaders CheckDomainAvailability where
toHeaders :: CheckDomainAvailability -> ResponseHeaders
toHeaders =
ResponseHeaders -> CheckDomainAvailability -> 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.CheckDomainAvailability" ::
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 CheckDomainAvailability where
toJSON :: CheckDomainAvailability -> Value
toJSON CheckDomainAvailability' {Maybe Text
Text
domainName :: Text
idnLangCode :: Maybe Text
$sel:domainName:CheckDomainAvailability' :: CheckDomainAvailability -> Text
$sel:idnLangCode:CheckDomainAvailability' :: CheckDomainAvailability -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"IdnLangCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
idnLangCode,
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 CheckDomainAvailability where
toPath :: CheckDomainAvailability -> ByteString
toPath = ByteString -> CheckDomainAvailability -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery CheckDomainAvailability where
toQuery :: CheckDomainAvailability -> QueryString
toQuery = QueryString -> CheckDomainAvailability -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data CheckDomainAvailabilityResponse = CheckDomainAvailabilityResponse'
{
CheckDomainAvailabilityResponse -> Int
httpStatus :: Prelude.Int,
CheckDomainAvailabilityResponse -> DomainAvailability
availability :: DomainAvailability
}
deriving (CheckDomainAvailabilityResponse
-> CheckDomainAvailabilityResponse -> Bool
(CheckDomainAvailabilityResponse
-> CheckDomainAvailabilityResponse -> Bool)
-> (CheckDomainAvailabilityResponse
-> CheckDomainAvailabilityResponse -> Bool)
-> Eq CheckDomainAvailabilityResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CheckDomainAvailabilityResponse
-> CheckDomainAvailabilityResponse -> Bool
$c/= :: CheckDomainAvailabilityResponse
-> CheckDomainAvailabilityResponse -> Bool
== :: CheckDomainAvailabilityResponse
-> CheckDomainAvailabilityResponse -> Bool
$c== :: CheckDomainAvailabilityResponse
-> CheckDomainAvailabilityResponse -> Bool
Prelude.Eq, ReadPrec [CheckDomainAvailabilityResponse]
ReadPrec CheckDomainAvailabilityResponse
Int -> ReadS CheckDomainAvailabilityResponse
ReadS [CheckDomainAvailabilityResponse]
(Int -> ReadS CheckDomainAvailabilityResponse)
-> ReadS [CheckDomainAvailabilityResponse]
-> ReadPrec CheckDomainAvailabilityResponse
-> ReadPrec [CheckDomainAvailabilityResponse]
-> Read CheckDomainAvailabilityResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CheckDomainAvailabilityResponse]
$creadListPrec :: ReadPrec [CheckDomainAvailabilityResponse]
readPrec :: ReadPrec CheckDomainAvailabilityResponse
$creadPrec :: ReadPrec CheckDomainAvailabilityResponse
readList :: ReadS [CheckDomainAvailabilityResponse]
$creadList :: ReadS [CheckDomainAvailabilityResponse]
readsPrec :: Int -> ReadS CheckDomainAvailabilityResponse
$creadsPrec :: Int -> ReadS CheckDomainAvailabilityResponse
Prelude.Read, Int -> CheckDomainAvailabilityResponse -> ShowS
[CheckDomainAvailabilityResponse] -> ShowS
CheckDomainAvailabilityResponse -> String
(Int -> CheckDomainAvailabilityResponse -> ShowS)
-> (CheckDomainAvailabilityResponse -> String)
-> ([CheckDomainAvailabilityResponse] -> ShowS)
-> Show CheckDomainAvailabilityResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CheckDomainAvailabilityResponse] -> ShowS
$cshowList :: [CheckDomainAvailabilityResponse] -> ShowS
show :: CheckDomainAvailabilityResponse -> String
$cshow :: CheckDomainAvailabilityResponse -> String
showsPrec :: Int -> CheckDomainAvailabilityResponse -> ShowS
$cshowsPrec :: Int -> CheckDomainAvailabilityResponse -> ShowS
Prelude.Show, (forall x.
CheckDomainAvailabilityResponse
-> Rep CheckDomainAvailabilityResponse x)
-> (forall x.
Rep CheckDomainAvailabilityResponse x
-> CheckDomainAvailabilityResponse)
-> Generic CheckDomainAvailabilityResponse
forall x.
Rep CheckDomainAvailabilityResponse x
-> CheckDomainAvailabilityResponse
forall x.
CheckDomainAvailabilityResponse
-> Rep CheckDomainAvailabilityResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CheckDomainAvailabilityResponse x
-> CheckDomainAvailabilityResponse
$cfrom :: forall x.
CheckDomainAvailabilityResponse
-> Rep CheckDomainAvailabilityResponse x
Prelude.Generic)
newCheckDomainAvailabilityResponse ::
Prelude.Int ->
DomainAvailability ->
CheckDomainAvailabilityResponse
newCheckDomainAvailabilityResponse :: Int -> DomainAvailability -> CheckDomainAvailabilityResponse
newCheckDomainAvailabilityResponse
Int
pHttpStatus_
DomainAvailability
pAvailability_ =
CheckDomainAvailabilityResponse' :: Int -> DomainAvailability -> CheckDomainAvailabilityResponse
CheckDomainAvailabilityResponse'
{ $sel:httpStatus:CheckDomainAvailabilityResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:availability:CheckDomainAvailabilityResponse' :: DomainAvailability
availability = DomainAvailability
pAvailability_
}
checkDomainAvailabilityResponse_httpStatus :: Lens.Lens' CheckDomainAvailabilityResponse Prelude.Int
checkDomainAvailabilityResponse_httpStatus :: (Int -> f Int)
-> CheckDomainAvailabilityResponse
-> f CheckDomainAvailabilityResponse
checkDomainAvailabilityResponse_httpStatus = (CheckDomainAvailabilityResponse -> Int)
-> (CheckDomainAvailabilityResponse
-> Int -> CheckDomainAvailabilityResponse)
-> Lens
CheckDomainAvailabilityResponse
CheckDomainAvailabilityResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckDomainAvailabilityResponse' {Int
httpStatus :: Int
$sel:httpStatus:CheckDomainAvailabilityResponse' :: CheckDomainAvailabilityResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CheckDomainAvailabilityResponse
s@CheckDomainAvailabilityResponse' {} Int
a -> CheckDomainAvailabilityResponse
s {$sel:httpStatus:CheckDomainAvailabilityResponse' :: Int
httpStatus = Int
a} :: CheckDomainAvailabilityResponse)
checkDomainAvailabilityResponse_availability :: Lens.Lens' CheckDomainAvailabilityResponse DomainAvailability
checkDomainAvailabilityResponse_availability :: (DomainAvailability -> f DomainAvailability)
-> CheckDomainAvailabilityResponse
-> f CheckDomainAvailabilityResponse
checkDomainAvailabilityResponse_availability = (CheckDomainAvailabilityResponse -> DomainAvailability)
-> (CheckDomainAvailabilityResponse
-> DomainAvailability -> CheckDomainAvailabilityResponse)
-> Lens
CheckDomainAvailabilityResponse
CheckDomainAvailabilityResponse
DomainAvailability
DomainAvailability
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CheckDomainAvailabilityResponse' {DomainAvailability
availability :: DomainAvailability
$sel:availability:CheckDomainAvailabilityResponse' :: CheckDomainAvailabilityResponse -> DomainAvailability
availability} -> DomainAvailability
availability) (\s :: CheckDomainAvailabilityResponse
s@CheckDomainAvailabilityResponse' {} DomainAvailability
a -> CheckDomainAvailabilityResponse
s {$sel:availability:CheckDomainAvailabilityResponse' :: DomainAvailability
availability = DomainAvailability
a} :: CheckDomainAvailabilityResponse)
instance
Prelude.NFData
CheckDomainAvailabilityResponse