コード例 #1
0
        public void UploadDocuments_DocumentServiceExceptionMarshallTest()
        {
            var operation = service_model.FindOperation("UploadDocuments");

            var request         = InstantiateClassGenerator.Execute <UploadDocumentsRequest>();
            var marshaller      = new UploadDocumentsRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);

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

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

            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 = UploadDocumentsResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK);

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
コード例 #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the UploadDocuments operation.
        /// <seealso cref="Amazon.CloudSearchDomain.IAmazonCloudSearchDomain"/>
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the UploadDocuments 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 <UploadDocumentsResponse> UploadDocumentsAsync(UploadDocumentsRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

            return(Invoke <IRequest, UploadDocumentsRequest, UploadDocumentsResponse>(request, marshaller, unmarshaller, signer, cancellationToken));
        }
コード例 #3
0
        public void UploadDocumentsMarshallTest()
        {
            var operation = service_model.FindOperation("UploadDocuments");

            var request    = InstantiateClassGenerator.Execute <UploadDocumentsRequest>();
            var marshaller = new UploadDocumentsRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

            TestTools.RequestValidator.Validate("UploadDocuments", 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 = UploadDocumentsResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                           as UploadDocumentsResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
コード例 #4
0
        /// <summary>
        /// Posts a batch of documents to a search domain for indexing. A document batch is a
        /// collection of add and delete operations that represent the documents you want to add,
        /// update, or delete from your domain. Batches can be described in either JSON or XML.
        /// Each item that you want Amazon CloudSearch to return as a search result (such as a
        /// product) is represented as a document. Every document has a unique ID and one or more
        /// fields that contain the data that you want to search and return in results. Individual
        /// documents cannot contain more than 1 MB of data. The entire batch cannot exceed 5
        /// MB. To get the best possible upload performance, group add and delete operations in
        /// batches that are close the 5 MB limit. Submitting a large volume of single-document
        /// batches can overload a domain's document service.
        ///
        ///
        /// <para>
        /// The endpoint for submitting <code>UploadDocuments</code> requests is domain-specific.
        /// To get the document 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>
        ///
        /// <para>
        /// For more information about formatting your data for Amazon CloudSearch, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/preparing-data.html">Preparing
        /// Your Data</a> in the <i>Amazon CloudSearch Developer Guide</i>. For more information
        /// about uploading data for indexing, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/uploading-data.html">Uploading
        /// Data</a> in the <i>Amazon CloudSearch Developer Guide</i>.
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the UploadDocuments service method.</param>
        ///
        /// <returns>The response from the UploadDocuments service method, as returned by CloudSearchDomain.</returns>
        /// <exception cref="Amazon.CloudSearchDomain.Model.DocumentServiceException">
        /// Information about any problems encountered while processing an upload request.
        /// </exception>
        public virtual UploadDocumentsResponse UploadDocuments(UploadDocumentsRequest request)
        {
            var marshaller   = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

            return(Invoke <UploadDocumentsRequest, UploadDocumentsResponse>(request, marshaller, unmarshaller));
        }
コード例 #5
0
        IAsyncResult invokeUploadDocuments(UploadDocumentsRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller   = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

            return(Invoke(request, callback, state, synchronized, marshaller, unmarshaller, signer));
        }
コード例 #6
0
        /// <summary>
        /// Initiates the asynchronous execution of the UploadDocuments operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the UploadDocuments 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 EndUploadDocuments
        ///         operation.</returns>
        public virtual IAsyncResult BeginUploadDocuments(UploadDocumentsRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

            return(BeginInvoke <UploadDocumentsRequest>(request, marshaller, unmarshaller,
                                                        callback, state));
        }
コード例 #7
0
        /// <summary>
        /// Initiates the asynchronous execution of the UploadDocuments operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the UploadDocuments 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 <UploadDocumentsResponse> UploadDocumentsAsync(UploadDocumentsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

            return(InvokeAsync <UploadDocumentsRequest, UploadDocumentsResponse>(request, marshaller,
                                                                                 unmarshaller, cancellationToken));
        }
コード例 #8
0
        /// <summary>
        /// Initiates the asynchronous execution of the UploadDocuments operation.
        /// <seealso cref="Amazon.CloudSearchDomain.IAmazonCloudSearchDomain"/>
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the UploadDocuments 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<UploadDocumentsResponse> UploadDocumentsAsync(UploadDocumentsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

            return InvokeAsync<UploadDocumentsRequest,UploadDocumentsResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
コード例 #9
0
        /// <summary>
        /// Posts a batch of documents to a search domain for indexing. A document batch is a
        /// collection of add and delete operations that represent the documents you want to add,
        /// update, or delete from your domain. Batches can be described in either JSON or XML.
        /// Each item that you want Amazon CloudSearch to return as a search result (such as a
        /// product) is represented as a document. Every document has a unique ID and one or more
        /// fields that contain the data that you want to search and return in results. Individual
        /// documents cannot contain more than 1 MB of data. The entire batch cannot exceed 5
        /// MB. To get the best possible upload performance, group add and delete operations in
        /// batches that are close the 5 MB limit. Submitting a large volume of single-document
        /// batches can overload a domain's document service. 
        /// 
        ///  
        /// <para>
        /// The endpoint for submitting <code>UploadDocuments</code> requests is domain-specific.
        /// To get the document 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>
        ///  
        /// <para>
        /// For more information about formatting your data for Amazon CloudSearch, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/preparing-data.html">Preparing
        /// Your Data</a> in the <i>Amazon CloudSearch Developer Guide</i>. For more information
        /// about uploading data for indexing, see <a href="http://docs.aws.amazon.com/cloudsearch/latest/developerguide/uploading-data.html">Uploading
        /// Data</a> in the <i>Amazon CloudSearch Developer Guide</i>. 
        /// </para>
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the UploadDocuments service method.</param>
        /// 
        /// <returns>The response from the UploadDocuments service method, as returned by CloudSearchDomain.</returns>
        /// <exception cref="DocumentServiceException">
        /// Information about any problems encountered while processing an upload request.
        /// </exception>
        public UploadDocumentsResponse UploadDocuments(UploadDocumentsRequest request)
        {
            var marshaller = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

            return Invoke<UploadDocumentsRequest,UploadDocumentsResponse>(request, marshaller, unmarshaller);
        }
コード例 #10
0
        public void UploadDocumentsMarshallTest()
        {
            var operation = service_model.FindOperation("UploadDocuments");

            var request = InstantiateClassGenerator.Execute<UploadDocumentsRequest>();
            var marshaller = new UploadDocumentsRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);
            RequestValidator.Validate("UploadDocuments", 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 = UploadDocumentsResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                as UploadDocumentsResponse;   
            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);               
        }
コード例 #11
0
        /// <summary>
        /// Initiates the asynchronous execution of the UploadDocuments operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the UploadDocuments 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 EndUploadDocuments
        ///         operation.</returns>
        public IAsyncResult BeginUploadDocuments(UploadDocumentsRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

            return BeginInvoke<UploadDocumentsRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
コード例 #12
0
        IAsyncResult invokeUploadDocuments(UploadDocumentsRequest request, AsyncCallback callback, object state, bool synchronized)
        {
            var marshaller = new UploadDocumentsRequestMarshaller();
            var unmarshaller = UploadDocumentsResponseUnmarshaller.Instance;

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