public void Search_SearchExceptionMarshallTest()
        {
            var operation = service_model.FindOperation("Search");

            var request         = InstantiateClassGenerator.Execute <SearchRequest>();
            var marshaller      = new SearchRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);

            TestTools.RequestValidator.Validate("Search", request, internalRequest, service_model);

            var exception   = operation.Exceptions.First(e => e.Name.Equals("SearchException"));
            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       },
                    { "x-amzn-ErrorType", "SearchException"         },
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, exception).Execute();

            webResponse.Headers["Content-Length"] = UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString();
            var context  = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), true, webResponse, true);
            var response = SearchResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK);

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Retrieves a list of documents that match the specified search criteria. How you specify
        /// the search criteria depends on which query parser you use. Amazon CloudSearch supports
        /// four query parsers:
        ///
        ///  <ul> <li><code>simple</code>: search all <code>text</code> and <code>text-array</code>
        /// fields for the specified string. Search for phrases, individual terms, and prefixes.
        /// </li> <li><code>structured</code>: search specific fields, construct compound queries
        /// using Boolean operators, and use advanced features such as term boosting and proximity
        /// searching.</li> <li><code>lucene</code>: specify search criteria using the Apache
        /// Lucene query parser syntax.</li> <li><code>dismax</code>: specify search criteria
        /// using the simplified subset of the Apache Lucene query parser syntax defined by the
        /// DisMax query parser.</li> </ul>
        /// <para>
        /// For more information, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching.html">Searching
        /// Your Data</a> in the <i>Amazon CloudSearch Developer Guide</i>.
        /// </para>
        ///
        /// <para>
        /// The endpoint for submitting <code>Search</code> requests is domain-specific. You submit
        /// search requests to a domain's search endpoint. To get the search endpoint for your
        /// domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code>
        /// action. A domain's endpoints are also displayed on the domain dashboard in the Amazon
        /// CloudSearch console.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the Search service method.</param>
        ///
        /// <returns>The response from the Search service method, as returned by CloudSearchDomain.</returns>
        /// <exception cref="Amazon.CloudSearchDomain.Model.SearchException">
        /// Information about any problems encountered while processing a search request.
        /// </exception>
        public virtual SearchResponse Search(SearchRequest request)
        {
            var marshaller   = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return(Invoke <SearchRequest, SearchResponse>(request, marshaller, unmarshaller));
        }
        public void SearchMarshallTest()
        {
            var operation = service_model.FindOperation("Search");

            var request    = InstantiateClassGenerator.Execute <SearchRequest>();
            var marshaller = new SearchRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

            TestTools.RequestValidator.Validate("Search", request, internalRequest, service_model);

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "x-amzn-RequestId", Guid.NewGuid().ToString() },
                    { "x-amz-crc32",      "0"                       }
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();

            webResponse.Headers["Content-Length"] = UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString();
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = SearchResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                           as SearchResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Initiates the asynchronous execution of the Search operation.
        /// <seealso cref="Amazon.CloudSearchDomain.IAmazonCloudSearchDomain"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the Search operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task <SearchResponse> SearchAsync(SearchRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return(Invoke <IRequest, SearchRequest, SearchResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
        public void SearchMarshallTest()
        {
            var operation = service_model.FindOperation("Search");

            var request = InstantiateClassGenerator.Execute<SearchRequest>();
            var marshaller = new SearchRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            RequestValidator.Validate("Search", request, internalRequest, service_model);            

            var webResponse = new WebResponseData
            {
                Headers = {
                    {"x-amzn-RequestId", Guid.NewGuid().ToString()},
                    {"x-amz-crc32","0"}
                }
            };

            var payloadResponse = new JsonSampleGenerator(service_model, operation.ResponseStructure).Execute();
            webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(payloadResponse).Length.ToString());
            var context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(payloadResponse), false, webResponse);
            ResponseUnmarshaller unmarshaller = SearchResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                as SearchResponse;   
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);               
        }
        IAsyncResult invokeSearch(SearchRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller   = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return(Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer));
        }
Exemplo n.º 7
0
        /// <summary>
        /// Initiates the asynchronous execution of the Search operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the Search operation on AmazonCloudSearchDomainClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        ///
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndSearch
        ///         operation.</returns>
        public virtual IAsyncResult BeginSearch(SearchRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return(BeginInvoke <SearchRequest>(request, marshaller, unmarshaller,
                                               callback, state));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the Search operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the Search operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public virtual Task <SearchResponse> SearchAsync(SearchRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return(InvokeAsync <SearchRequest, SearchResponse>(request, marshaller,
                                                               unmarshaller, cancellationToken));
        }
        /// <summary>
        /// Initiates the asynchronous execution of the Search operation.
        /// <seealso cref="Amazon.CloudSearchDomain.IAmazonCloudSearchDomain"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the Search operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<SearchResponse> SearchAsync(SearchRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return InvokeAsync<SearchRequest,SearchResponse>(request, marshaller,
                unmarshaller, cancellationToken);
        }
        /// <summary>
        /// Retrieves a list of documents that match the specified search criteria. How you specify
        /// the search criteria depends on which query parser you use. Amazon CloudSearch supports
        /// four query parsers:
        /// 
        ///  <ul> <li> <code>simple</code>: search all <code>text</code> and <code>text-array</code>
        /// fields for the specified string. Search for phrases, individual terms, and prefixes.
        /// </li> <li> <code>structured</code>: search specific fields, construct compound queries
        /// using Boolean operators, and use advanced features such as term boosting and proximity
        /// searching.</li> <li> <code>lucene</code>: specify search criteria using the Apache
        /// Lucene query parser syntax.</li> <li> <code>dismax</code>: specify search criteria
        /// using the simplified subset of the Apache Lucene query parser syntax defined by the
        /// DisMax query parser.</li> </ul> 
        /// <para>
        /// For more information, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching.html">Searching
        /// Your Data</a> in the <i>Amazon CloudSearch Developer Guide</i>.
        /// </para>
        ///  
        /// <para>
        /// The endpoint for submitting <code>Search</code> requests is domain-specific. You submit
        /// search requests to a domain's search endpoint. To get the search endpoint for your
        /// domain, use the Amazon CloudSearch configuration service <code>DescribeDomains</code>
        /// action. A domain's endpoints are also displayed on the domain dashboard in the Amazon
        /// CloudSearch console. 
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the Search service method.</param>
        /// 
        /// <returns>The response from the Search service method, as returned by CloudSearchDomain.</returns>
        /// <exception cref="SearchException">
        /// Information about any problems encountered while processing a search request.
        /// </exception>
        public SearchResponse Search(SearchRequest request)
        {
            var marshaller = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return Invoke<SearchRequest,SearchResponse>(request, marshaller, unmarshaller);
        }
        /// <summary>
        /// Initiates the asynchronous execution of the Search operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the Search operation on AmazonCloudSearchDomainClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndSearch
        ///         operation.</returns>
        public IAsyncResult BeginSearch(SearchRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return BeginInvoke<SearchRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
        IAsyncResult invokeSearch(SearchRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new SearchRequestMarshaller();
            var unmarshaller = SearchResponseUnmarshaller.Instance;

            return Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer);
        }