public void GetMediaMarshallTest() { var operation = service_model.FindOperation("GetMedia"); var request = InstantiateClassGenerator.Execute <GetMediaRequest>(); var marshaller = new GetMediaRequestMarshaller(); var internalRequest = marshaller.Marshall(request); TestTools.RequestValidator.Validate("GetMedia", request, internalRequest, service_model); var webResponse = new WebResponseData { Headers = { { "Content-Type", "Content-Type_Value" }, { "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 = GetMediaResponseUnmarshaller.Instance; var response = unmarshaller.Unmarshall(context) as GetMediaResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
public void GetMedia_ClientLimitExceededExceptionMarshallTest() { var operation = service_model.FindOperation("GetMedia"); var request = InstantiateClassGenerator.Execute <GetMediaRequest>(); var marshaller = new GetMediaRequestMarshaller(); var internalRequest = marshaller.Marshall(request); TestTools.RequestValidator.Validate("GetMedia", request, internalRequest, service_model); var exception = operation.Exceptions.First(e => e.Name.Equals("ClientLimitExceededException")); var webResponse = new WebResponseData { Headers = { { "Content-Type", "Content-Type_Value" }, { "x-amzn-RequestId", Guid.NewGuid().ToString() }, { "x-amz-crc32", "0" }, { "x-amzn-ErrorType", "ClientLimitExceededException" }, } }; 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 = GetMediaResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
/// <summary> /// Use this API to retrieve media content from a Kinesis video stream. In the request, /// you identify stream name or stream Amazon Resource Name (ARN), and the starting chunk. /// Kinesis Video Streams then returns a stream of chunks in order by fragment number. /// /// <note> /// <para> /// You must first call the <code>GetDataEndpoint</code> API to get an endpoint to which /// you can then send the <code>GetMedia</code> requests. /// </para> /// </note> /// <para> /// When you put media data (fragments) on a stream, Kinesis Video Streams stores each /// incoming fragment and related metadata in what is called a "chunk." For more information, /// see . The <code>GetMedia</code> API returns a stream of these chunks starting from /// the chunk that you specify in the request. /// </para> /// /// <para> /// The following limits apply when using the <code>GetMedia</code> API: /// </para> /// <ul> <li> /// <para> /// A client can call <code>GetMedia</code> up to five times per second per stream. /// </para> /// </li> <li> /// <para> /// Kinesis Video Streams sends media data at a rate of up to 25 megabytes per second /// (or 200 megabits per second) during a <code>GetMedia</code> session. /// </para> /// </li> </ul> /// </summary> /// <param name="request">Container for the necessary parameters to execute the GetMedia service method.</param> /// /// <returns>The response from the GetMedia service method, as returned by KinesisVideoMedia.</returns> /// <exception cref="Amazon.KinesisVideoMedia.Model.ClientLimitExceededException"> /// Kinesis Video Streams has throttled the request because you have exceeded the limit /// of allowed client calls. Try making the call later. /// </exception> /// <exception cref="Amazon.KinesisVideoMedia.Model.ConnectionLimitExceededException"> /// Kinesis Video Streams has throttled the request because you have exceeded the limit /// of allowed client connections. /// </exception> /// <exception cref="Amazon.KinesisVideoMedia.Model.InvalidArgumentException"> /// The value for this input parameter is invalid. /// </exception> /// <exception cref="Amazon.KinesisVideoMedia.Model.InvalidEndpointException"> /// Status Code: 400, Caller used wrong endpoint to write data to a stream. On receiving /// such an exception, the user must call <code>GetDataEndpoint</code> with <code>AccessMode</code> /// set to "READ" and use the endpoint Kinesis Video returns in the next <code>GetMedia</code> /// call. /// </exception> /// <exception cref="Amazon.KinesisVideoMedia.Model.NotAuthorizedException"> /// Status Code: 403, The caller is not authorized to perform an operation on the given /// stream, or the token has expired. /// </exception> /// <exception cref="Amazon.KinesisVideoMedia.Model.ResourceNotFoundException"> /// Status Code: 404, The stream with the given name does not exist. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kinesis-video-media-2017-09-30/GetMedia">REST API Reference for GetMedia Operation</seealso> public virtual GetMediaResponse GetMedia(GetMediaRequest request) { var marshaller = new GetMediaRequestMarshaller(); var unmarshaller = GetMediaResponseUnmarshaller.Instance; return(Invoke <GetMediaRequest, GetMediaResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Initiates the asynchronous execution of the GetMedia operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetMedia operation on AmazonKinesisVideoMediaClient.</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 EndGetMedia /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/kinesis-video-media-2017-09-30/GetMedia">REST API Reference for GetMedia Operation</seealso> public virtual IAsyncResult BeginGetMedia(GetMediaRequest request, AsyncCallback callback, object state) { var marshaller = new GetMediaRequestMarshaller(); var unmarshaller = GetMediaResponseUnmarshaller.Instance; return(BeginInvoke <GetMediaRequest>(request, marshaller, unmarshaller, callback, state)); }
/// <summary> /// Initiates the asynchronous execution of the GetMedia operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the GetMedia 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/kinesis-video-media-2017-09-30/GetMedia">REST API Reference for GetMedia Operation</seealso> public virtual Task <GetMediaResponse> GetMediaAsync(GetMediaRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new GetMediaRequestMarshaller(); var unmarshaller = GetMediaResponseUnmarshaller.Instance; return(InvokeAsync <GetMediaRequest, GetMediaResponse>(request, marshaller, unmarshaller, cancellationToken)); }