{-# 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.SageMaker.GetSearchSuggestions
(
GetSearchSuggestions (..),
newGetSearchSuggestions,
getSearchSuggestions_suggestionQuery,
getSearchSuggestions_resource,
GetSearchSuggestionsResponse (..),
newGetSearchSuggestionsResponse,
getSearchSuggestionsResponse_propertyNameSuggestions,
getSearchSuggestionsResponse_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.SageMaker.Types
data GetSearchSuggestions = GetSearchSuggestions'
{
GetSearchSuggestions -> Maybe SuggestionQuery
suggestionQuery :: Prelude.Maybe SuggestionQuery,
GetSearchSuggestions -> ResourceType
resource :: ResourceType
}
deriving (GetSearchSuggestions -> GetSearchSuggestions -> Bool
(GetSearchSuggestions -> GetSearchSuggestions -> Bool)
-> (GetSearchSuggestions -> GetSearchSuggestions -> Bool)
-> Eq GetSearchSuggestions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSearchSuggestions -> GetSearchSuggestions -> Bool
$c/= :: GetSearchSuggestions -> GetSearchSuggestions -> Bool
== :: GetSearchSuggestions -> GetSearchSuggestions -> Bool
$c== :: GetSearchSuggestions -> GetSearchSuggestions -> Bool
Prelude.Eq, ReadPrec [GetSearchSuggestions]
ReadPrec GetSearchSuggestions
Int -> ReadS GetSearchSuggestions
ReadS [GetSearchSuggestions]
(Int -> ReadS GetSearchSuggestions)
-> ReadS [GetSearchSuggestions]
-> ReadPrec GetSearchSuggestions
-> ReadPrec [GetSearchSuggestions]
-> Read GetSearchSuggestions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSearchSuggestions]
$creadListPrec :: ReadPrec [GetSearchSuggestions]
readPrec :: ReadPrec GetSearchSuggestions
$creadPrec :: ReadPrec GetSearchSuggestions
readList :: ReadS [GetSearchSuggestions]
$creadList :: ReadS [GetSearchSuggestions]
readsPrec :: Int -> ReadS GetSearchSuggestions
$creadsPrec :: Int -> ReadS GetSearchSuggestions
Prelude.Read, Int -> GetSearchSuggestions -> ShowS
[GetSearchSuggestions] -> ShowS
GetSearchSuggestions -> String
(Int -> GetSearchSuggestions -> ShowS)
-> (GetSearchSuggestions -> String)
-> ([GetSearchSuggestions] -> ShowS)
-> Show GetSearchSuggestions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSearchSuggestions] -> ShowS
$cshowList :: [GetSearchSuggestions] -> ShowS
show :: GetSearchSuggestions -> String
$cshow :: GetSearchSuggestions -> String
showsPrec :: Int -> GetSearchSuggestions -> ShowS
$cshowsPrec :: Int -> GetSearchSuggestions -> ShowS
Prelude.Show, (forall x. GetSearchSuggestions -> Rep GetSearchSuggestions x)
-> (forall x. Rep GetSearchSuggestions x -> GetSearchSuggestions)
-> Generic GetSearchSuggestions
forall x. Rep GetSearchSuggestions x -> GetSearchSuggestions
forall x. GetSearchSuggestions -> Rep GetSearchSuggestions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSearchSuggestions x -> GetSearchSuggestions
$cfrom :: forall x. GetSearchSuggestions -> Rep GetSearchSuggestions x
Prelude.Generic)
newGetSearchSuggestions ::
ResourceType ->
GetSearchSuggestions
newGetSearchSuggestions :: ResourceType -> GetSearchSuggestions
newGetSearchSuggestions ResourceType
pResource_ =
GetSearchSuggestions' :: Maybe SuggestionQuery -> ResourceType -> GetSearchSuggestions
GetSearchSuggestions'
{ $sel:suggestionQuery:GetSearchSuggestions' :: Maybe SuggestionQuery
suggestionQuery =
Maybe SuggestionQuery
forall a. Maybe a
Prelude.Nothing,
$sel:resource:GetSearchSuggestions' :: ResourceType
resource = ResourceType
pResource_
}
getSearchSuggestions_suggestionQuery :: Lens.Lens' GetSearchSuggestions (Prelude.Maybe SuggestionQuery)
getSearchSuggestions_suggestionQuery :: (Maybe SuggestionQuery -> f (Maybe SuggestionQuery))
-> GetSearchSuggestions -> f GetSearchSuggestions
getSearchSuggestions_suggestionQuery = (GetSearchSuggestions -> Maybe SuggestionQuery)
-> (GetSearchSuggestions
-> Maybe SuggestionQuery -> GetSearchSuggestions)
-> Lens
GetSearchSuggestions
GetSearchSuggestions
(Maybe SuggestionQuery)
(Maybe SuggestionQuery)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSearchSuggestions' {Maybe SuggestionQuery
suggestionQuery :: Maybe SuggestionQuery
$sel:suggestionQuery:GetSearchSuggestions' :: GetSearchSuggestions -> Maybe SuggestionQuery
suggestionQuery} -> Maybe SuggestionQuery
suggestionQuery) (\s :: GetSearchSuggestions
s@GetSearchSuggestions' {} Maybe SuggestionQuery
a -> GetSearchSuggestions
s {$sel:suggestionQuery:GetSearchSuggestions' :: Maybe SuggestionQuery
suggestionQuery = Maybe SuggestionQuery
a} :: GetSearchSuggestions)
getSearchSuggestions_resource :: Lens.Lens' GetSearchSuggestions ResourceType
getSearchSuggestions_resource :: (ResourceType -> f ResourceType)
-> GetSearchSuggestions -> f GetSearchSuggestions
getSearchSuggestions_resource = (GetSearchSuggestions -> ResourceType)
-> (GetSearchSuggestions -> ResourceType -> GetSearchSuggestions)
-> Lens
GetSearchSuggestions GetSearchSuggestions ResourceType ResourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSearchSuggestions' {ResourceType
resource :: ResourceType
$sel:resource:GetSearchSuggestions' :: GetSearchSuggestions -> ResourceType
resource} -> ResourceType
resource) (\s :: GetSearchSuggestions
s@GetSearchSuggestions' {} ResourceType
a -> GetSearchSuggestions
s {$sel:resource:GetSearchSuggestions' :: ResourceType
resource = ResourceType
a} :: GetSearchSuggestions)
instance Core.AWSRequest GetSearchSuggestions where
type
AWSResponse GetSearchSuggestions =
GetSearchSuggestionsResponse
request :: GetSearchSuggestions -> Request GetSearchSuggestions
request = Service -> GetSearchSuggestions -> Request GetSearchSuggestions
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetSearchSuggestions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSearchSuggestions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetSearchSuggestions))
-> Logger
-> Service
-> Proxy GetSearchSuggestions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSearchSuggestions)))
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 [PropertyNameSuggestion]
-> Int -> GetSearchSuggestionsResponse
GetSearchSuggestionsResponse'
(Maybe [PropertyNameSuggestion]
-> Int -> GetSearchSuggestionsResponse)
-> Either String (Maybe [PropertyNameSuggestion])
-> Either String (Int -> GetSearchSuggestionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Key -> Either String (Maybe (Maybe [PropertyNameSuggestion]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"PropertyNameSuggestions"
Either String (Maybe (Maybe [PropertyNameSuggestion]))
-> Maybe [PropertyNameSuggestion]
-> Either String (Maybe [PropertyNameSuggestion])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [PropertyNameSuggestion]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Int -> GetSearchSuggestionsResponse)
-> Either String Int -> Either String GetSearchSuggestionsResponse
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 GetSearchSuggestions
instance Prelude.NFData GetSearchSuggestions
instance Core.ToHeaders GetSearchSuggestions where
toHeaders :: GetSearchSuggestions -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetSearchSuggestions -> 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
"SageMaker.GetSearchSuggestions" ::
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 GetSearchSuggestions where
toJSON :: GetSearchSuggestions -> Value
toJSON GetSearchSuggestions' {Maybe SuggestionQuery
ResourceType
resource :: ResourceType
suggestionQuery :: Maybe SuggestionQuery
$sel:resource:GetSearchSuggestions' :: GetSearchSuggestions -> ResourceType
$sel:suggestionQuery:GetSearchSuggestions' :: GetSearchSuggestions -> Maybe SuggestionQuery
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"SuggestionQuery" Key -> SuggestionQuery -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..=)
(SuggestionQuery -> Pair) -> Maybe SuggestionQuery -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SuggestionQuery
suggestionQuery,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Key
"Resource" Key -> ResourceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= ResourceType
resource)
]
)
instance Core.ToPath GetSearchSuggestions where
toPath :: GetSearchSuggestions -> ByteString
toPath = ByteString -> GetSearchSuggestions -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetSearchSuggestions where
toQuery :: GetSearchSuggestions -> QueryString
toQuery = QueryString -> GetSearchSuggestions -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetSearchSuggestionsResponse = GetSearchSuggestionsResponse'
{
GetSearchSuggestionsResponse -> Maybe [PropertyNameSuggestion]
propertyNameSuggestions :: Prelude.Maybe [PropertyNameSuggestion],
GetSearchSuggestionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetSearchSuggestionsResponse
-> GetSearchSuggestionsResponse -> Bool
(GetSearchSuggestionsResponse
-> GetSearchSuggestionsResponse -> Bool)
-> (GetSearchSuggestionsResponse
-> GetSearchSuggestionsResponse -> Bool)
-> Eq GetSearchSuggestionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSearchSuggestionsResponse
-> GetSearchSuggestionsResponse -> Bool
$c/= :: GetSearchSuggestionsResponse
-> GetSearchSuggestionsResponse -> Bool
== :: GetSearchSuggestionsResponse
-> GetSearchSuggestionsResponse -> Bool
$c== :: GetSearchSuggestionsResponse
-> GetSearchSuggestionsResponse -> Bool
Prelude.Eq, ReadPrec [GetSearchSuggestionsResponse]
ReadPrec GetSearchSuggestionsResponse
Int -> ReadS GetSearchSuggestionsResponse
ReadS [GetSearchSuggestionsResponse]
(Int -> ReadS GetSearchSuggestionsResponse)
-> ReadS [GetSearchSuggestionsResponse]
-> ReadPrec GetSearchSuggestionsResponse
-> ReadPrec [GetSearchSuggestionsResponse]
-> Read GetSearchSuggestionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSearchSuggestionsResponse]
$creadListPrec :: ReadPrec [GetSearchSuggestionsResponse]
readPrec :: ReadPrec GetSearchSuggestionsResponse
$creadPrec :: ReadPrec GetSearchSuggestionsResponse
readList :: ReadS [GetSearchSuggestionsResponse]
$creadList :: ReadS [GetSearchSuggestionsResponse]
readsPrec :: Int -> ReadS GetSearchSuggestionsResponse
$creadsPrec :: Int -> ReadS GetSearchSuggestionsResponse
Prelude.Read, Int -> GetSearchSuggestionsResponse -> ShowS
[GetSearchSuggestionsResponse] -> ShowS
GetSearchSuggestionsResponse -> String
(Int -> GetSearchSuggestionsResponse -> ShowS)
-> (GetSearchSuggestionsResponse -> String)
-> ([GetSearchSuggestionsResponse] -> ShowS)
-> Show GetSearchSuggestionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSearchSuggestionsResponse] -> ShowS
$cshowList :: [GetSearchSuggestionsResponse] -> ShowS
show :: GetSearchSuggestionsResponse -> String
$cshow :: GetSearchSuggestionsResponse -> String
showsPrec :: Int -> GetSearchSuggestionsResponse -> ShowS
$cshowsPrec :: Int -> GetSearchSuggestionsResponse -> ShowS
Prelude.Show, (forall x.
GetSearchSuggestionsResponse -> Rep GetSearchSuggestionsResponse x)
-> (forall x.
Rep GetSearchSuggestionsResponse x -> GetSearchSuggestionsResponse)
-> Generic GetSearchSuggestionsResponse
forall x.
Rep GetSearchSuggestionsResponse x -> GetSearchSuggestionsResponse
forall x.
GetSearchSuggestionsResponse -> Rep GetSearchSuggestionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSearchSuggestionsResponse x -> GetSearchSuggestionsResponse
$cfrom :: forall x.
GetSearchSuggestionsResponse -> Rep GetSearchSuggestionsResponse x
Prelude.Generic)
newGetSearchSuggestionsResponse ::
Prelude.Int ->
GetSearchSuggestionsResponse
newGetSearchSuggestionsResponse :: Int -> GetSearchSuggestionsResponse
newGetSearchSuggestionsResponse Int
pHttpStatus_ =
GetSearchSuggestionsResponse' :: Maybe [PropertyNameSuggestion]
-> Int -> GetSearchSuggestionsResponse
GetSearchSuggestionsResponse'
{ $sel:propertyNameSuggestions:GetSearchSuggestionsResponse' :: Maybe [PropertyNameSuggestion]
propertyNameSuggestions =
Maybe [PropertyNameSuggestion]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetSearchSuggestionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getSearchSuggestionsResponse_propertyNameSuggestions :: Lens.Lens' GetSearchSuggestionsResponse (Prelude.Maybe [PropertyNameSuggestion])
getSearchSuggestionsResponse_propertyNameSuggestions :: (Maybe [PropertyNameSuggestion]
-> f (Maybe [PropertyNameSuggestion]))
-> GetSearchSuggestionsResponse -> f GetSearchSuggestionsResponse
getSearchSuggestionsResponse_propertyNameSuggestions = (GetSearchSuggestionsResponse -> Maybe [PropertyNameSuggestion])
-> (GetSearchSuggestionsResponse
-> Maybe [PropertyNameSuggestion] -> GetSearchSuggestionsResponse)
-> Lens
GetSearchSuggestionsResponse
GetSearchSuggestionsResponse
(Maybe [PropertyNameSuggestion])
(Maybe [PropertyNameSuggestion])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSearchSuggestionsResponse' {Maybe [PropertyNameSuggestion]
propertyNameSuggestions :: Maybe [PropertyNameSuggestion]
$sel:propertyNameSuggestions:GetSearchSuggestionsResponse' :: GetSearchSuggestionsResponse -> Maybe [PropertyNameSuggestion]
propertyNameSuggestions} -> Maybe [PropertyNameSuggestion]
propertyNameSuggestions) (\s :: GetSearchSuggestionsResponse
s@GetSearchSuggestionsResponse' {} Maybe [PropertyNameSuggestion]
a -> GetSearchSuggestionsResponse
s {$sel:propertyNameSuggestions:GetSearchSuggestionsResponse' :: Maybe [PropertyNameSuggestion]
propertyNameSuggestions = Maybe [PropertyNameSuggestion]
a} :: GetSearchSuggestionsResponse) ((Maybe [PropertyNameSuggestion]
-> f (Maybe [PropertyNameSuggestion]))
-> GetSearchSuggestionsResponse -> f GetSearchSuggestionsResponse)
-> ((Maybe [PropertyNameSuggestion]
-> f (Maybe [PropertyNameSuggestion]))
-> Maybe [PropertyNameSuggestion]
-> f (Maybe [PropertyNameSuggestion]))
-> (Maybe [PropertyNameSuggestion]
-> f (Maybe [PropertyNameSuggestion]))
-> GetSearchSuggestionsResponse
-> f GetSearchSuggestionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[PropertyNameSuggestion]
[PropertyNameSuggestion]
[PropertyNameSuggestion]
[PropertyNameSuggestion]
-> Iso
(Maybe [PropertyNameSuggestion])
(Maybe [PropertyNameSuggestion])
(Maybe [PropertyNameSuggestion])
(Maybe [PropertyNameSuggestion])
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
[PropertyNameSuggestion]
[PropertyNameSuggestion]
[PropertyNameSuggestion]
[PropertyNameSuggestion]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getSearchSuggestionsResponse_httpStatus :: Lens.Lens' GetSearchSuggestionsResponse Prelude.Int
getSearchSuggestionsResponse_httpStatus :: (Int -> f Int)
-> GetSearchSuggestionsResponse -> f GetSearchSuggestionsResponse
getSearchSuggestionsResponse_httpStatus = (GetSearchSuggestionsResponse -> Int)
-> (GetSearchSuggestionsResponse
-> Int -> GetSearchSuggestionsResponse)
-> Lens
GetSearchSuggestionsResponse GetSearchSuggestionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSearchSuggestionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSearchSuggestionsResponse' :: GetSearchSuggestionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSearchSuggestionsResponse
s@GetSearchSuggestionsResponse' {} Int
a -> GetSearchSuggestionsResponse
s {$sel:httpStatus:GetSearchSuggestionsResponse' :: Int
httpStatus = Int
a} :: GetSearchSuggestionsResponse)
instance Prelude.NFData GetSearchSuggestionsResponse