AWS SDK for C++  0.14.3
AWS SDK for C++
CloudSearchDomainClient.h
Go to the documentation of this file.
1 /*
2 * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15 #pragma once
28 #include <future>
29 #include <functional>
30 
31 namespace Aws
32 {
33 
34 namespace Http
35 {
36  class HttpClient;
37  class HttpClientFactory;
38 } // namespace Http
39 
40 namespace Utils
41 {
42  template< typename R, typename E> class Outcome;
43 
44 namespace Threading
45 {
46  class Executor;
47 } // namespace Threading
48 
49 namespace Json
50 {
51  class JsonValue;
52 } // namespace Json
53 } // namespace Utils
54 
55 namespace Auth
56 {
57  class AWSCredentials;
58  class AWSCredentialsProvider;
59 } // namespace Auth
60 
61 namespace Client
62 {
63  class RetryStrategy;
64 } // namespace Client
65 
66 namespace CloudSearchDomain
67 {
68 
69 namespace Model
70 {
71  class SearchRequest;
72  class SuggestRequest;
74 
78 
79  typedef std::future<SearchOutcome> SearchOutcomeCallable;
80  typedef std::future<SuggestOutcome> SuggestOutcomeCallable;
81  typedef std::future<UploadDocumentsOutcome> UploadDocumentsOutcomeCallable;
82 } // namespace Model
83 
85 
86  typedef std::function<void(const CloudSearchDomainClient*, const Model::SearchRequest&, const Model::SearchOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > SearchResponseReceivedHandler;
87  typedef std::function<void(const CloudSearchDomainClient*, const Model::SuggestRequest&, const Model::SuggestOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > SuggestResponseReceivedHandler;
88  typedef std::function<void(const CloudSearchDomainClient*, const Model::UploadDocumentsRequest&, const Model::UploadDocumentsOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > UploadDocumentsResponseReceivedHandler;
89 
103  {
104  public:
106 
112 
118 
123  CloudSearchDomainClient(const std::shared_ptr<Auth::AWSCredentialsProvider>& credentialsProvider,
124  const Client::ClientConfiguration& clientConfiguration = Client::ClientConfiguration());
125 
126  virtual ~CloudSearchDomainClient();
127 
149  virtual Model::SearchOutcome Search(const Model::SearchRequest& request) const;
150 
174  virtual Model::SearchOutcomeCallable SearchCallable(const Model::SearchRequest& request) const;
175 
199  virtual void SearchAsync(const Model::SearchRequest& request, const SearchResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
200 
218  virtual Model::SuggestOutcome Suggest(const Model::SuggestRequest& request) const;
219 
239  virtual Model::SuggestOutcomeCallable SuggestCallable(const Model::SuggestRequest& request) const;
240 
260  virtual void SuggestAsync(const Model::SuggestRequest& request, const SuggestResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
261 
285  virtual Model::UploadDocumentsOutcome UploadDocuments(const Model::UploadDocumentsRequest& request) const;
286 
312  virtual Model::UploadDocumentsOutcomeCallable UploadDocumentsCallable(const Model::UploadDocumentsRequest& request) const;
313 
339  virtual void UploadDocumentsAsync(const Model::UploadDocumentsRequest& request, const UploadDocumentsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const;
340 
341 
342  private:
343  void init(const Client::ClientConfiguration& clientConfiguration);
344 
346  void SearchAsyncHelper(const Model::SearchRequest& request, const SearchResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
347  void SuggestAsyncHelper(const Model::SuggestRequest& request, const SuggestResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
348  void UploadDocumentsAsyncHelper(const Model::UploadDocumentsRequest& request, const UploadDocumentsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const;
349 
350  Aws::String m_uri;
351  std::shared_ptr<Utils::Threading::Executor> m_executor;
352  };
353 
354 } // namespace CloudSearchDomain
355 } // namespace Aws
std::future< SuggestOutcome > SuggestOutcomeCallable
std::function< void(const CloudSearchDomainClient *, const Model::UploadDocumentsRequest &, const Model::UploadDocumentsOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > UploadDocumentsResponseReceivedHandler
Aws::Utils::Outcome< UploadDocumentsResult, Aws::Client::AWSError< CloudSearchDomainErrors > > UploadDocumentsOutcome
std::future< SearchOutcome > SearchOutcomeCallable
std::function< void(const CloudSearchDomainClient *, const Model::SuggestRequest &, const Model::SuggestOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > SuggestResponseReceivedHandler
std::future< UploadDocumentsOutcome > UploadDocumentsOutcomeCallable
#define AWS_CLOUDSEARCHDOMAIN_API
Aws::Utils::Outcome< SuggestResult, Aws::Client::AWSError< CloudSearchDomainErrors > > SuggestOutcome
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
Aws::Utils::Outcome< SearchResult, Aws::Client::AWSError< CloudSearchDomainErrors > > SearchOutcome
std::function< void(const CloudSearchDomainClient *, const Model::SearchRequest &, const Model::SearchOutcome &, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &) > SearchResponseReceivedHandler
JSON (JavaScript Object Notation).