{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:suggestionQuery:GetSearchSuggestions' :: Maybe SuggestionQuery
suggestionQuery =
forall a. Maybe a
Prelude.Nothing,
$sel:resource:GetSearchSuggestions' :: ResourceType
resource = ResourceType
pResource_
}
getSearchSuggestions_suggestionQuery :: Lens.Lens' GetSearchSuggestions (Prelude.Maybe SuggestionQuery)
getSearchSuggestions_suggestionQuery :: Lens' GetSearchSuggestions (Maybe SuggestionQuery)
getSearchSuggestions_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 :: Lens' GetSearchSuggestions ResourceType
getSearchSuggestions_resource = 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 :: (Service -> Service)
-> GetSearchSuggestions -> Request GetSearchSuggestions
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetSearchSuggestions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSearchSuggestions)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [PropertyNameSuggestion]
-> Int -> GetSearchSuggestionsResponse
GetSearchSuggestionsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"PropertyNameSuggestions"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetSearchSuggestions where
hashWithSalt :: Int -> GetSearchSuggestions -> Int
hashWithSalt Int
_salt GetSearchSuggestions' {Maybe SuggestionQuery
ResourceType
resource :: ResourceType
suggestionQuery :: Maybe SuggestionQuery
$sel:resource:GetSearchSuggestions' :: GetSearchSuggestions -> ResourceType
$sel:suggestionQuery:GetSearchSuggestions' :: GetSearchSuggestions -> Maybe SuggestionQuery
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SuggestionQuery
suggestionQuery
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceType
resource
instance Prelude.NFData GetSearchSuggestions where
rnf :: GetSearchSuggestions -> ()
rnf GetSearchSuggestions' {Maybe SuggestionQuery
ResourceType
resource :: ResourceType
suggestionQuery :: Maybe SuggestionQuery
$sel:resource:GetSearchSuggestions' :: GetSearchSuggestions -> ResourceType
$sel:suggestionQuery:GetSearchSuggestions' :: GetSearchSuggestions -> Maybe SuggestionQuery
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SuggestionQuery
suggestionQuery
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf ResourceType
resource
instance Data.ToHeaders GetSearchSuggestions where
toHeaders :: GetSearchSuggestions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"SageMaker.GetSearchSuggestions" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"SuggestionQuery" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SuggestionQuery
suggestionQuery,
forall a. a -> Maybe a
Prelude.Just (Key
"Resource" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ResourceType
resource)
]
)
instance Data.ToPath GetSearchSuggestions where
toPath :: GetSearchSuggestions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetSearchSuggestions where
toQuery :: GetSearchSuggestions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
{ $sel:propertyNameSuggestions:GetSearchSuggestionsResponse' :: Maybe [PropertyNameSuggestion]
propertyNameSuggestions =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetSearchSuggestionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getSearchSuggestionsResponse_propertyNameSuggestions :: Lens.Lens' GetSearchSuggestionsResponse (Prelude.Maybe [PropertyNameSuggestion])
getSearchSuggestionsResponse_propertyNameSuggestions :: Lens' GetSearchSuggestionsResponse (Maybe [PropertyNameSuggestion])
getSearchSuggestionsResponse_propertyNameSuggestions = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 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 :: Lens' GetSearchSuggestionsResponse Int
getSearchSuggestionsResponse_httpStatus = 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 where
rnf :: GetSearchSuggestionsResponse -> ()
rnf GetSearchSuggestionsResponse' {Int
Maybe [PropertyNameSuggestion]
httpStatus :: Int
propertyNameSuggestions :: Maybe [PropertyNameSuggestion]
$sel:httpStatus:GetSearchSuggestionsResponse' :: GetSearchSuggestionsResponse -> Int
$sel:propertyNameSuggestions:GetSearchSuggestionsResponse' :: GetSearchSuggestionsResponse -> Maybe [PropertyNameSuggestion]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [PropertyNameSuggestion]
propertyNameSuggestions
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus