/// <summary> /// Uploads an object to the specified path. Object sizes are limited to 10 MB. /// </summary> /// <param name="request">Container for the necessary parameters to execute the PutObject service method.</param> /// /// <returns>The response from the PutObject 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> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/PutObject">REST API Reference for PutObject Operation</seealso> public virtual PutObjectResponse PutObject(PutObjectRequest request) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.Instance; return(Invoke <PutObjectRequest, PutObjectResponse>(request, marshaller, unmarshaller)); }
public void PutObjectMarshallTest() { var operation = service_model.FindOperation("PutObject"); var request = InstantiateClassGenerator.Execute <PutObjectRequest>(); var marshaller = new PutObjectRequestMarshaller(); var internalRequest = marshaller.Marshall(request); TestTools.RequestValidator.Validate("PutObject", 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 = PutObjectResponseUnmarshaller.Instance; var response = unmarshaller.Unmarshall(context) as PutObjectResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
public void PutObject_InternalServerErrorExceptionMarshallTest() { var operation = service_model.FindOperation("PutObject"); var request = InstantiateClassGenerator.Execute <PutObjectRequest>(); var marshaller = new PutObjectRequestMarshaller(); var internalRequest = marshaller.Marshall(request); TestTools.RequestValidator.Validate("PutObject", request, internalRequest, service_model); var exception = operation.Exceptions.First(e => e.Name.Equals("InternalServerErrorException")); var webResponse = new WebResponseData { Headers = { { "x-amzn-RequestId", Guid.NewGuid().ToString() }, { "x-amz-crc32", "0" }, { "x-amzn-ErrorType", "InternalServerErrorException" }, } }; 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 = PutObjectResponseUnmarshaller.Instance.UnmarshallException(context, null, System.Net.HttpStatusCode.OK); InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
/// <summary> /// Initiates the asynchronous execution of the PutObject operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutObject 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 EndPutObject /// operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/PutObject">REST API Reference for PutObject Operation</seealso> public virtual IAsyncResult BeginPutObject(PutObjectRequest request, AsyncCallback callback, object state) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.Instance; return(BeginInvoke <PutObjectRequest>(request, marshaller, unmarshaller, callback, state)); }
/// <summary> /// Initiates the asynchronous execution of the PutObject operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutObject 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/PutObject">REST API Reference for PutObject Operation</seealso> public virtual Task <PutObjectResponse> PutObjectAsync(PutObjectRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.Instance; return(InvokeAsync <PutObjectRequest, PutObjectResponse>(request, marshaller, unmarshaller, cancellationToken)); }
public IRequest Marshall(PutObjectRequestECS putObjectRequest) { var marshaller = new PutObjectRequestMarshaller(); var request = marshaller.Marshall(putObjectRequest); if (putObjectRequest.IsSetRange()) { request.Headers.Add(COMMON.HEADER_RANGE, "bytes=" + putObjectRequest.Range.ToString()); } if (putObjectRequest.IsSetEtagToMatch()) { request.Headers.Add(COMMON.HEADER_IF_MATCH, ECSTransforms.ToStringValue(putObjectRequest.EtagToMatch)); } if (putObjectRequest.IsSetEtagToNotMatch()) { request.Headers.Add(COMMON.HEADER_IF_NONE_MATCH, ECSTransforms.ToStringValue(putObjectRequest.EtagToNotMatch)); } if (putObjectRequest.IsSetModifiedSinceDate()) { request.Headers.Add(COMMON.HEADER_IF_MODIFIED_SINCE, ECSTransforms.ToStringValue(putObjectRequest.ModifiedSinceDate)); } if (putObjectRequest.IsSetUnmodifiedSinceDate()) { request.Headers.Add(COMMON.HEADER_IF_UNMODIFIED_SINCE, ECSTransforms.ToStringValue(putObjectRequest.UnmodifiedSinceDate)); } if (putObjectRequest.IsSetRetentionPeriod()) { request.Headers.Add(COMMON.EMC_RETENTION_PERIOD, ECSTransforms.ToStringValue(putObjectRequest.RetentionPeriod)); } if (putObjectRequest.IsSetRetentionPolicy()) { request.Headers.Add(COMMON.EMC_RETENTION_POLICY, ECSTransforms.ToStringValue(putObjectRequest.RetentionPolicy)); } return(request); }
/// <summary> /// Initiates the asynchronous execution of the PutObject operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutObject 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<PutObjectResponse> PutObjectAsync(PutObjectRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.Instance; return InvokeAsync<PutObjectRequest,PutObjectResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal PutObjectResponse PutObject(PutObjectRequest request) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.Instance; return Invoke<PutObjectRequest,PutObjectResponse>(request, marshaller, unmarshaller); }
IAsyncResult invokePutObject(PutObjectRequest putObjectRequest, AsyncCallback callback, object state, bool synchronized) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.GetInstance(); var result = Invoke<IRequest, PutObjectRequest>(putObjectRequest, callback, state, synchronized, marshaller, unmarshaller, this.signer); return result; }
/// <summary> /// Initiates the asynchronous execution of the PutObject operation. /// This API is supported only when AWSConfigs.HttpClient is set to AWSConfigs.HttpClientOption.UnityWebRequest, the default value for this configuration option is AWSConfigs.HttpClientOption.UnityWWW /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutObject operation on AmazonS3Client.</param> /// <param name="callback">An Action delegate that is invoked when the operation completes.</param> /// <param name="options">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> public void PutObjectAsync(PutObjectRequest request, AmazonServiceCallback<PutObjectRequest, PutObjectResponse> callback, AsyncOptions options = null) { if (AWSConfigs.HttpClient == AWSConfigs.HttpClientOption.UnityWWW) { throw new InvalidOperationException("PutObject is only allowed with AWSConfigs.HttpClientOption.UnityWebRequest API option"); } options = options == null?new AsyncOptions():options; var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<PutObjectRequest,PutObjectResponse> responseObject = new AmazonServiceResult<PutObjectRequest,PutObjectResponse>((PutObjectRequest)req, (PutObjectResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<PutObjectRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// Initiates the asynchronous execution of the PutObject operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutObject operation on AmazonS3Client.</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 EndPutObject /// operation.</returns> public IAsyncResult BeginPutObject(PutObjectRequest request, AsyncCallback callback, object state) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.Instance; return BeginInvoke<PutObjectRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// Initiates the asynchronous execution of the PutObject operation. /// <seealso cref="Amazon.S3.IAmazonS3.PutObject"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutObject 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<PutObjectResponse> PutObjectAsync(PutObjectRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.GetInstance(); return Invoke<IRequest, PutObjectRequest, PutObjectResponse>(request, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// <para>Adds an object to a bucket.</para> /// </summary> /// /// <param name="putObjectRequest">Container for the necessary parameters to execute the PutObject service method on AmazonS3.</param> /// /// <returns>The response from the PutObject service method, as returned by AmazonS3.</returns> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public async Task<PutObjectResponse> PutObjectAsync(PutObjectRequest putObjectRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutObjectRequestMarshaller(); var unmarshaller = PutObjectResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, PutObjectRequest, PutObjectResponse>(putObjectRequest, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }