{-# 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.GetDomainSuggestions
(
GetDomainSuggestions (..),
newGetDomainSuggestions,
getDomainSuggestions_domainName,
getDomainSuggestions_suggestionCount,
getDomainSuggestions_onlyAvailable,
GetDomainSuggestionsResponse (..),
newGetDomainSuggestionsResponse,
getDomainSuggestionsResponse_suggestionsList,
getDomainSuggestionsResponse_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
data GetDomainSuggestions = GetDomainSuggestions'
{
GetDomainSuggestions -> Text
domainName :: Prelude.Text,
GetDomainSuggestions -> Int
suggestionCount :: Prelude.Int,
GetDomainSuggestions -> Bool
onlyAvailable :: Prelude.Bool
}
deriving (GetDomainSuggestions -> GetDomainSuggestions -> Bool
(GetDomainSuggestions -> GetDomainSuggestions -> Bool)
-> (GetDomainSuggestions -> GetDomainSuggestions -> Bool)
-> Eq GetDomainSuggestions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDomainSuggestions -> GetDomainSuggestions -> Bool
$c/= :: GetDomainSuggestions -> GetDomainSuggestions -> Bool
== :: GetDomainSuggestions -> GetDomainSuggestions -> Bool
$c== :: GetDomainSuggestions -> GetDomainSuggestions -> Bool
Prelude.Eq, ReadPrec [GetDomainSuggestions]
ReadPrec GetDomainSuggestions
Int -> ReadS GetDomainSuggestions
ReadS [GetDomainSuggestions]
(Int -> ReadS GetDomainSuggestions)
-> ReadS [GetDomainSuggestions]
-> ReadPrec GetDomainSuggestions
-> ReadPrec [GetDomainSuggestions]
-> Read GetDomainSuggestions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDomainSuggestions]
$creadListPrec :: ReadPrec [GetDomainSuggestions]
readPrec :: ReadPrec GetDomainSuggestions
$creadPrec :: ReadPrec GetDomainSuggestions
readList :: ReadS [GetDomainSuggestions]
$creadList :: ReadS [GetDomainSuggestions]
readsPrec :: Int -> ReadS GetDomainSuggestions
$creadsPrec :: Int -> ReadS GetDomainSuggestions
Prelude.Read, Int -> GetDomainSuggestions -> ShowS
[GetDomainSuggestions] -> ShowS
GetDomainSuggestions -> String
(Int -> GetDomainSuggestions -> ShowS)
-> (GetDomainSuggestions -> String)
-> ([GetDomainSuggestions] -> ShowS)
-> Show GetDomainSuggestions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDomainSuggestions] -> ShowS
$cshowList :: [GetDomainSuggestions] -> ShowS
show :: GetDomainSuggestions -> String
$cshow :: GetDomainSuggestions -> String
showsPrec :: Int -> GetDomainSuggestions -> ShowS
$cshowsPrec :: Int -> GetDomainSuggestions -> ShowS
Prelude.Show, (forall x. GetDomainSuggestions -> Rep GetDomainSuggestions x)
-> (forall x. Rep GetDomainSuggestions x -> GetDomainSuggestions)
-> Generic GetDomainSuggestions
forall x. Rep GetDomainSuggestions x -> GetDomainSuggestions
forall x. GetDomainSuggestions -> Rep GetDomainSuggestions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDomainSuggestions x -> GetDomainSuggestions
$cfrom :: forall x. GetDomainSuggestions -> Rep GetDomainSuggestions x
Prelude.Generic)
newGetDomainSuggestions ::
Prelude.Text ->
Prelude.Int ->
Prelude.Bool ->
GetDomainSuggestions
newGetDomainSuggestions :: Text -> Int -> Bool -> GetDomainSuggestions
newGetDomainSuggestions
Text
pDomainName_
Int
pSuggestionCount_
Bool
pOnlyAvailable_ =
GetDomainSuggestions' :: Text -> Int -> Bool -> GetDomainSuggestions
GetDomainSuggestions'
{ $sel:domainName:GetDomainSuggestions' :: Text
domainName = Text
pDomainName_,
$sel:suggestionCount:GetDomainSuggestions' :: Int
suggestionCount = Int
pSuggestionCount_,
$sel:onlyAvailable:GetDomainSuggestions' :: Bool
onlyAvailable = Bool
pOnlyAvailable_
}
getDomainSuggestions_domainName :: Lens.Lens' GetDomainSuggestions Prelude.Text
getDomainSuggestions_domainName :: (Text -> f Text) -> GetDomainSuggestions -> f GetDomainSuggestions
getDomainSuggestions_domainName = (GetDomainSuggestions -> Text)
-> (GetDomainSuggestions -> Text -> GetDomainSuggestions)
-> Lens GetDomainSuggestions GetDomainSuggestions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDomainSuggestions' {Text
domainName :: Text
$sel:domainName:GetDomainSuggestions' :: GetDomainSuggestions -> Text
domainName} -> Text
domainName) (\s :: GetDomainSuggestions
s@GetDomainSuggestions' {} Text
a -> GetDomainSuggestions
s {$sel:domainName:GetDomainSuggestions' :: Text
domainName = Text
a} :: GetDomainSuggestions)
getDomainSuggestions_suggestionCount :: Lens.Lens' GetDomainSuggestions Prelude.Int
getDomainSuggestions_suggestionCount :: (Int -> f Int) -> GetDomainSuggestions -> f GetDomainSuggestions
getDomainSuggestions_suggestionCount = (GetDomainSuggestions -> Int)
-> (GetDomainSuggestions -> Int -> GetDomainSuggestions)
-> Lens GetDomainSuggestions GetDomainSuggestions Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDomainSuggestions' {Int
suggestionCount :: Int
$sel:suggestionCount:GetDomainSuggestions' :: GetDomainSuggestions -> Int
suggestionCount} -> Int
suggestionCount) (\s :: GetDomainSuggestions
s@GetDomainSuggestions' {} Int
a -> GetDomainSuggestions
s {$sel:suggestionCount:GetDomainSuggestions' :: Int
suggestionCount = Int
a} :: GetDomainSuggestions)
getDomainSuggestions_onlyAvailable :: Lens.Lens' GetDomainSuggestions Prelude.Bool
getDomainSuggestions_onlyAvailable :: (Bool -> f Bool) -> GetDomainSuggestions -> f GetDomainSuggestions
getDomainSuggestions_onlyAvailable = (GetDomainSuggestions -> Bool)
-> (GetDomainSuggestions -> Bool -> GetDomainSuggestions)
-> Lens GetDomainSuggestions GetDomainSuggestions Bool Bool
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDomainSuggestions' {Bool
onlyAvailable :: Bool
$sel:onlyAvailable:GetDomainSuggestions' :: GetDomainSuggestions -> Bool
onlyAvailable} -> Bool
onlyAvailable) (\s :: GetDomainSuggestions
s@GetDomainSuggestions' {} Bool
a -> GetDomainSuggestions
s {$sel:onlyAvailable:GetDomainSuggestions' :: Bool
onlyAvailable = Bool
a} :: GetDomainSuggestions)
instance Core.AWSRequest GetDomainSuggestions where
type
AWSResponse GetDomainSuggestions =
GetDomainSuggestionsResponse
request :: GetDomainSuggestions -> Request GetDomainSuggestions
request = Service -> GetDomainSuggestions -> Request GetDomainSuggestions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetDomainSuggestions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDomainSuggestions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetDomainSuggestions))
-> Logger
-> Service
-> Proxy GetDomainSuggestions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDomainSuggestions)))
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 ->
Maybe [DomainSuggestion] -> Int -> GetDomainSuggestionsResponse
GetDomainSuggestionsResponse'
(Maybe [DomainSuggestion] -> Int -> GetDomainSuggestionsResponse)
-> Either String (Maybe [DomainSuggestion])
-> Either String (Int -> GetDomainSuggestionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [DomainSuggestion]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SuggestionsList"
Either String (Maybe (Maybe [DomainSuggestion]))
-> Maybe [DomainSuggestion]
-> Either String (Maybe [DomainSuggestion])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [DomainSuggestion]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> GetDomainSuggestionsResponse)
-> Either String Int -> Either String GetDomainSuggestionsResponse
forall (f :: * -> *) a b. Applicative f => 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 GetDomainSuggestions
instance Prelude.NFData GetDomainSuggestions
instance Core.ToHeaders GetDomainSuggestions where
toHeaders :: GetDomainSuggestions -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetDomainSuggestions -> 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.GetDomainSuggestions" ::
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 GetDomainSuggestions where
toJSON :: GetDomainSuggestions -> Value
toJSON GetDomainSuggestions' {Bool
Int
Text
onlyAvailable :: Bool
suggestionCount :: Int
domainName :: Text
$sel:onlyAvailable:GetDomainSuggestions' :: GetDomainSuggestions -> Bool
$sel:suggestionCount:GetDomainSuggestions' :: GetDomainSuggestions -> Int
$sel:domainName:GetDomainSuggestions' :: GetDomainSuggestions -> 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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"SuggestionCount" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Int
suggestionCount),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"OnlyAvailable" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Bool
onlyAvailable)
]
)
instance Core.ToPath GetDomainSuggestions where
toPath :: GetDomainSuggestions -> ByteString
toPath = ByteString -> GetDomainSuggestions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetDomainSuggestions where
toQuery :: GetDomainSuggestions -> QueryString
toQuery = QueryString -> GetDomainSuggestions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetDomainSuggestionsResponse = GetDomainSuggestionsResponse'
{
GetDomainSuggestionsResponse -> Maybe [DomainSuggestion]
suggestionsList :: Prelude.Maybe [DomainSuggestion],
GetDomainSuggestionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDomainSuggestionsResponse
-> GetDomainSuggestionsResponse -> Bool
(GetDomainSuggestionsResponse
-> GetDomainSuggestionsResponse -> Bool)
-> (GetDomainSuggestionsResponse
-> GetDomainSuggestionsResponse -> Bool)
-> Eq GetDomainSuggestionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDomainSuggestionsResponse
-> GetDomainSuggestionsResponse -> Bool
$c/= :: GetDomainSuggestionsResponse
-> GetDomainSuggestionsResponse -> Bool
== :: GetDomainSuggestionsResponse
-> GetDomainSuggestionsResponse -> Bool
$c== :: GetDomainSuggestionsResponse
-> GetDomainSuggestionsResponse -> Bool
Prelude.Eq, ReadPrec [GetDomainSuggestionsResponse]
ReadPrec GetDomainSuggestionsResponse
Int -> ReadS GetDomainSuggestionsResponse
ReadS [GetDomainSuggestionsResponse]
(Int -> ReadS GetDomainSuggestionsResponse)
-> ReadS [GetDomainSuggestionsResponse]
-> ReadPrec GetDomainSuggestionsResponse
-> ReadPrec [GetDomainSuggestionsResponse]
-> Read GetDomainSuggestionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDomainSuggestionsResponse]
$creadListPrec :: ReadPrec [GetDomainSuggestionsResponse]
readPrec :: ReadPrec GetDomainSuggestionsResponse
$creadPrec :: ReadPrec GetDomainSuggestionsResponse
readList :: ReadS [GetDomainSuggestionsResponse]
$creadList :: ReadS [GetDomainSuggestionsResponse]
readsPrec :: Int -> ReadS GetDomainSuggestionsResponse
$creadsPrec :: Int -> ReadS GetDomainSuggestionsResponse
Prelude.Read, Int -> GetDomainSuggestionsResponse -> ShowS
[GetDomainSuggestionsResponse] -> ShowS
GetDomainSuggestionsResponse -> String
(Int -> GetDomainSuggestionsResponse -> ShowS)
-> (GetDomainSuggestionsResponse -> String)
-> ([GetDomainSuggestionsResponse] -> ShowS)
-> Show GetDomainSuggestionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDomainSuggestionsResponse] -> ShowS
$cshowList :: [GetDomainSuggestionsResponse] -> ShowS
show :: GetDomainSuggestionsResponse -> String
$cshow :: GetDomainSuggestionsResponse -> String
showsPrec :: Int -> GetDomainSuggestionsResponse -> ShowS
$cshowsPrec :: Int -> GetDomainSuggestionsResponse -> ShowS
Prelude.Show, (forall x.
GetDomainSuggestionsResponse -> Rep GetDomainSuggestionsResponse x)
-> (forall x.
Rep GetDomainSuggestionsResponse x -> GetDomainSuggestionsResponse)
-> Generic GetDomainSuggestionsResponse
forall x.
Rep GetDomainSuggestionsResponse x -> GetDomainSuggestionsResponse
forall x.
GetDomainSuggestionsResponse -> Rep GetDomainSuggestionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDomainSuggestionsResponse x -> GetDomainSuggestionsResponse
$cfrom :: forall x.
GetDomainSuggestionsResponse -> Rep GetDomainSuggestionsResponse x
Prelude.Generic)
newGetDomainSuggestionsResponse ::
Prelude.Int ->
GetDomainSuggestionsResponse
newGetDomainSuggestionsResponse :: Int -> GetDomainSuggestionsResponse
newGetDomainSuggestionsResponse Int
pHttpStatus_ =
GetDomainSuggestionsResponse' :: Maybe [DomainSuggestion] -> Int -> GetDomainSuggestionsResponse
GetDomainSuggestionsResponse'
{ $sel:suggestionsList:GetDomainSuggestionsResponse' :: Maybe [DomainSuggestion]
suggestionsList =
Maybe [DomainSuggestion]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDomainSuggestionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDomainSuggestionsResponse_suggestionsList :: Lens.Lens' GetDomainSuggestionsResponse (Prelude.Maybe [DomainSuggestion])
getDomainSuggestionsResponse_suggestionsList :: (Maybe [DomainSuggestion] -> f (Maybe [DomainSuggestion]))
-> GetDomainSuggestionsResponse -> f GetDomainSuggestionsResponse
getDomainSuggestionsResponse_suggestionsList = (GetDomainSuggestionsResponse -> Maybe [DomainSuggestion])
-> (GetDomainSuggestionsResponse
-> Maybe [DomainSuggestion] -> GetDomainSuggestionsResponse)
-> Lens
GetDomainSuggestionsResponse
GetDomainSuggestionsResponse
(Maybe [DomainSuggestion])
(Maybe [DomainSuggestion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDomainSuggestionsResponse' {Maybe [DomainSuggestion]
suggestionsList :: Maybe [DomainSuggestion]
$sel:suggestionsList:GetDomainSuggestionsResponse' :: GetDomainSuggestionsResponse -> Maybe [DomainSuggestion]
suggestionsList} -> Maybe [DomainSuggestion]
suggestionsList) (\s :: GetDomainSuggestionsResponse
s@GetDomainSuggestionsResponse' {} Maybe [DomainSuggestion]
a -> GetDomainSuggestionsResponse
s {$sel:suggestionsList:GetDomainSuggestionsResponse' :: Maybe [DomainSuggestion]
suggestionsList = Maybe [DomainSuggestion]
a} :: GetDomainSuggestionsResponse) ((Maybe [DomainSuggestion] -> f (Maybe [DomainSuggestion]))
-> GetDomainSuggestionsResponse -> f GetDomainSuggestionsResponse)
-> ((Maybe [DomainSuggestion] -> f (Maybe [DomainSuggestion]))
-> Maybe [DomainSuggestion] -> f (Maybe [DomainSuggestion]))
-> (Maybe [DomainSuggestion] -> f (Maybe [DomainSuggestion]))
-> GetDomainSuggestionsResponse
-> f GetDomainSuggestionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[DomainSuggestion]
[DomainSuggestion]
[DomainSuggestion]
[DomainSuggestion]
-> Iso
(Maybe [DomainSuggestion])
(Maybe [DomainSuggestion])
(Maybe [DomainSuggestion])
(Maybe [DomainSuggestion])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[DomainSuggestion]
[DomainSuggestion]
[DomainSuggestion]
[DomainSuggestion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getDomainSuggestionsResponse_httpStatus :: Lens.Lens' GetDomainSuggestionsResponse Prelude.Int
getDomainSuggestionsResponse_httpStatus :: (Int -> f Int)
-> GetDomainSuggestionsResponse -> f GetDomainSuggestionsResponse
getDomainSuggestionsResponse_httpStatus = (GetDomainSuggestionsResponse -> Int)
-> (GetDomainSuggestionsResponse
-> Int -> GetDomainSuggestionsResponse)
-> Lens
GetDomainSuggestionsResponse GetDomainSuggestionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDomainSuggestionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDomainSuggestionsResponse' :: GetDomainSuggestionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDomainSuggestionsResponse
s@GetDomainSuggestionsResponse' {} Int
a -> GetDomainSuggestionsResponse
s {$sel:httpStatus:GetDomainSuggestionsResponse' :: Int
httpStatus = Int
a} :: GetDomainSuggestionsResponse)
instance Prelude.NFData GetDomainSuggestionsResponse