コード例 #1
0
        /// <summary>
        /// Gets the headers for an object at the specified path.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DescribeObject service method.</param>
        ///
        /// <returns>The response from the DescribeObject service method, as returned by MediaStoreData.</returns>
        /// <exception cref="Amazon.MediaStoreData.Model.ContainerNotFoundException">
        /// The specified container was not found for the specified account.
        /// </exception>
        /// <exception cref="Amazon.MediaStoreData.Model.InternalServerErrorException">
        /// The service is temporarily unavailable.
        /// </exception>
        /// <exception cref="Amazon.MediaStoreData.Model.ObjectNotFoundException">
        /// Could not perform an operation on an object that does not exist.
        /// </exception>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DescribeObject">REST API Reference for DescribeObject Operation</seealso>
        public virtual DescribeObjectResponse DescribeObject(DescribeObjectRequest request)
        {
            var marshaller   = new DescribeObjectRequestMarshaller();
            var unmarshaller = DescribeObjectResponseUnmarshaller.Instance;

            return(Invoke <DescribeObjectRequest, DescribeObjectResponse>(request, marshaller, unmarshaller));
        }
コード例 #2
0
        public void DescribeObjectMarshallTest()
        {
            var operation = service_model.FindOperation("DescribeObject");

            var request    = InstantiateClassGenerator.Execute <DescribeObjectRequest>();
            var marshaller = new DescribeObjectRequestMarshaller();

            var internalRequest = marshaller.Marshall(request);

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

            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "Cache-Control",    "Cache-Control_Value"                                },
                    { "Content-Length",   long.MaxValue.ToString(CultureInfo.InvariantCulture) },
                    { "Content-Type",     "Content-Type_Value"                                 },
                    { "ETag",             "ETag_Value"                                         },
                    { "Last-Modified",    ValidatorUtils.GetTestDate(TimestampFormat.RFC822)   },
                    { "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 = DescribeObjectResponseUnmarshaller.Instance;
            var response = unmarshaller.Unmarshall(context)
                           as DescribeObjectResponse;

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
コード例 #3
0
        public void DescribeObject_ObjectNotFoundExceptionMarshallTest()
        {
            var operation = service_model.FindOperation("DescribeObject");

            var request         = InstantiateClassGenerator.Execute <DescribeObjectRequest>();
            var marshaller      = new DescribeObjectRequestMarshaller();
            var internalRequest = marshaller.Marshall(request);

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

            var exception   = operation.Exceptions.First(e => e.Name.Equals("ObjectNotFoundException"));
            var webResponse = new WebResponseData
            {
                Headers =
                {
                    { "Cache-Control",    "Cache-Control_Value"                                },
                    { "Content-Length",   long.MaxValue.ToString(CultureInfo.InvariantCulture) },
                    { "Content-Type",     "Content-Type_Value"                                 },
                    { "ETag",             "ETag_Value"                                         },
                    { "Last-Modified",    ValidatorUtils.GetTestDate(TimestampFormat.RFC822)   },
                    { "x-amzn-RequestId", Guid.NewGuid().ToString()                            },
                    { "x-amz-crc32",      "0"                                                  },
                    { "x-amzn-ErrorType", "ObjectNotFoundException"                            },
                }
            };

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

            InstantiateClassGenerator.ValidateObjectFullyInstantiated(response);
        }
コード例 #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeObject operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DescribeObject operation on AmazonMediaStoreDataClient.</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 EndDescribeObject
        ///         operation.</returns>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DescribeObject">REST API Reference for DescribeObject Operation</seealso>
        public virtual IAsyncResult BeginDescribeObject(DescribeObjectRequest request, AsyncCallback callback, object state)
        {
            var marshaller   = new DescribeObjectRequestMarshaller();
            var unmarshaller = DescribeObjectResponseUnmarshaller.Instance;

            return(BeginInvoke <DescribeObjectRequest>(request, marshaller, unmarshaller,
                                                       callback, state));
        }
コード例 #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the DescribeObject operation.
        /// </summary>
        ///
        /// <param name="request">Container for the necessary parameters to execute the DescribeObject 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>
        /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DescribeObject">REST API Reference for DescribeObject Operation</seealso>
        public virtual Task <DescribeObjectResponse> DescribeObjectAsync(DescribeObjectRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller   = new DescribeObjectRequestMarshaller();
            var unmarshaller = DescribeObjectResponseUnmarshaller.Instance;

            return(InvokeAsync <DescribeObjectRequest, DescribeObjectResponse>(request, marshaller,
                                                                               unmarshaller, cancellationToken));
        }