internal PutItemResponse PutItem(PutItemRequest request) { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.Instance; return(Invoke <PutItemRequest, PutItemResponse>(request, marshaller, unmarshaller)); }
public void PutItemMarshallTest() { var request = InstantiateClassGenerator.Execute <PutItemRequest>(); var marshaller = new PutItemRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson <PutItemRequest>(request, jsonRequest); var webResponse = new WebResponseData { Headers = { { "x-amzn-RequestId", Guid.NewGuid().ToString() }, { "x-amz-crc32", "0" } } }; var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("PutItem").ResponseStructure).Execute(); webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()); UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse); var response = PutItemResponseUnmarshaller.Instance.Unmarshall(context) as PutItemResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
/// <summary> /// <para>Creates a new item, or replaces an old item with a new item. If an item already exists in the specified table with the same primary /// key, the new item completely replaces the existing item. You can perform a conditional put (insert a new item if one with the specified /// primary key doesn't exist), or replace an existing item if it has certain attribute values. </para> <para>In addition to putting an item, /// you can also return the item's attribute values in the same operation, using the <i>ReturnValues</i> parameter.</para> <para>When you add an /// item, the primary key attribute(s) are the only required attributes. Attribute values cannot be null. String and binary type attributes must /// have lengths greater than zero. Set type attributes cannot be empty. Requests with empty values will be rejected with a /// <i>ValidationException</i> .</para> <para>You can request that <i>PutItem</i> return either a copy of the old item (before the update) or a /// copy of the new item (after the update). For more information, see the <i>ReturnValues</i> description.</para> <para><b>NOTE:</b> To prevent /// a new item from replacing an existing item, use a conditional put operation with Exists set to false for the primary key attribute, or /// attributes. </para> <para>For more information about using this API, see <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html">Working with Items</a> in the Amazon DynamoDB /// Developer Guide.</para> /// </summary> /// /// <param name="putItemRequest">Container for the necessary parameters to execute the PutItem service method on AmazonDynamoDBv2.</param> /// /// <returns>The response from the PutItem service method, as returned by AmazonDynamoDBv2.</returns> /// /// <exception cref="T:Amazon.DynamoDBv2.Model.ItemCollectionSizeLimitExceededException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.ResourceNotFoundException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.ConditionalCheckFailedException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.ProvisionedThroughputExceededException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.InternalServerErrorException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task <PutItemResponse> PutItemAsync(PutItemRequest putItemRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.GetInstance(); return(Invoke <IRequest, PutItemRequest, PutItemResponse>(putItemRequest, marshaller, unmarshaller, signer, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the PutItem operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutItem 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 <PutItemResponse> PutItemAsync(PutItemRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.Instance; return(InvokeAsync <PutItemRequest, PutItemResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Initiates the asynchronous execution of the PutItem operation. /// <seealso cref="Amazon.DynamoDBv2.IAmazonDynamoDB"/> /// </summary> /// <param name="request">Container for the necessary parameters to execute the PutItem operation.</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>void</returns> public void PutItemAsync(PutItemRequest request, AmazonServiceCallback callback, object state) { if (!AmazonInitializer.IsInitialized) { throw new Exception("AWSPrefab is not added to the scene"); } ThreadPool.QueueUserWorkItem(new WaitCallback(delegate { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.Instance; Invoke(request, callback, state, marshaller, unmarshaller, signer); })); return; }
/// <summary> /// Initiates the asynchronous execution of the PutItem operation. /// <seealso cref="Amazon.DynamoDBv2.IAmazonDynamoDB"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutItem 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<PutItemResponse> PutItemAsync(PutItemRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.Instance; return InvokeAsync<PutItemRequest,PutItemResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal PutItemResponse PutItem(PutItemRequest request) { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.Instance; return Invoke<PutItemRequest,PutItemResponse>(request, marshaller, unmarshaller); }
public void PutItemMarshallTest() { var request = InstantiateClassGenerator.Execute<PutItemRequest>(); var marshaller = new PutItemRequestMarshaller(); var internalRequest = marshaller.Marshall(request); var jsonRequest = UTF8Encoding.UTF8.GetString(internalRequest.Content); Comparer.CompareObjectToJson<PutItemRequest>(request,jsonRequest); var webResponse = new WebResponseData { Headers = { {"x-amzn-RequestId", Guid.NewGuid().ToString()}, {"x-amz-crc32","0"} } }; var jsonResponse = new JsonSampleGenerator(service_model, service_model.FindOperation("PutItem").ResponseStructure).Execute(); webResponse.Headers.Add("Content-Length", UTF8Encoding.UTF8.GetBytes(jsonResponse).Length.ToString()); UnmarshallerContext context = new JsonUnmarshallerContext(Utils.CreateStreamFromString(jsonResponse), false, webResponse); var response = PutItemResponseUnmarshaller.Instance.Unmarshall(context) as PutItemResponse; InstantiateClassGenerator.ValidateObjectFullyInstantiated(response); }
IAsyncResult invokePutItem(PutItemRequest putItemRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new PutItemRequestMarshaller().Marshall(putItemRequest); var unmarshaller = PutItemResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// <para>Creates a new item, or replaces an old item with a new item. If an item already exists in the specified table with the same primary /// key, the new item completely replaces the existing item. You can perform a conditional put (insert a new item if one with the specified /// primary key doesn't exist), or replace an existing item if it has certain attribute values. </para> <para>In addition to putting an item, /// you can also return the item's attribute values in the same operation, using the <i>ReturnValues</i> parameter.</para> <para>When you add an /// item, the primary key attribute(s) are the only required attributes. Attribute values cannot be null. String and binary type attributes must /// have lengths greater than zero. Set type attributes cannot be empty. Requests with empty values will be rejected with a /// <i>ValidationException</i> .</para> <para>You can request that <i>PutItem</i> return either a copy of the old item (before the update) or a /// copy of the new item (after the update). For more information, see the <i>ReturnValues</i> description.</para> <para><b>NOTE:</b> To prevent /// a new item from replacing an existing item, use a conditional put operation with Exists set to false for the primary key attribute, or /// attributes. </para> <para>For more information about using this API, see <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/WorkingWithItems.html">Working with Items</a> in the Amazon DynamoDB /// Developer Guide.</para> /// </summary> /// /// <param name="putItemRequest">Container for the necessary parameters to execute the PutItem service method on AmazonDynamoDBv2.</param> /// /// <returns>The response from the PutItem service method, as returned by AmazonDynamoDBv2.</returns> /// /// <exception cref="T:Amazon.DynamoDBv2.Model.ItemCollectionSizeLimitExceededException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.ResourceNotFoundException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.ConditionalCheckFailedException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.ProvisionedThroughputExceededException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.InternalServerErrorException" /> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> public Task<PutItemResponse> PutItemAsync(PutItemRequest putItemRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.GetInstance(); return Invoke<IRequest, PutItemRequest, PutItemResponse>(putItemRequest, marshaller, unmarshaller, signer, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the PutItem operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutItem operation on AmazonDynamoDBClient.</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 EndPutItem /// operation.</returns> public IAsyncResult BeginPutItem(PutItemRequest request, AsyncCallback callback, object state) { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.Instance; return BeginInvoke<PutItemRequest>(request, marshaller, unmarshaller, callback, state); }
/// <summary> /// <para> Creates a new item, or replaces an old item with a new item (including all the attributes). If an item already exists in the /// specified table with the same primary key, the new item completely replaces the existing item. You can perform a conditional put (insert a /// new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values. </para> /// </summary> /// /// <param name="putItemRequest">Container for the necessary parameters to execute the PutItem service method on AmazonDynamoDB.</param> /// /// <returns>The response from the PutItem service method, as returned by AmazonDynamoDB.</returns> /// /// <exception cref="ProvisionedThroughputExceededException"/> /// <exception cref="ConditionalCheckFailedException"/> /// <exception cref="InternalServerErrorException"/> /// <exception cref="ResourceNotFoundException"/> public PutItemResponse PutItem(PutItemRequest putItemRequest) { IRequest<PutItemRequest> request = new PutItemRequestMarshaller().Marshall(putItemRequest); PutItemResponse response = Invoke<PutItemRequest, PutItemResponse> (request, this.signer, PutItemResponseUnmarshaller.GetInstance()); return response; }
/// <summary> /// Initiates the asynchronous execution of the PutItem operation. /// <seealso cref="Amazon.DynamoDBv2.IAmazonDynamoDB.PutItem"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutItem 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 async Task<PutItemResponse> PutItemAsync(PutItemRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, PutItemRequest, PutItemResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
/// <summary> /// Initiates the asynchronous execution of the PutItem operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the PutItem operation on AmazonDynamoDBClient.</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 PutItemAsync(PutItemRequest request, AmazonServiceCallback<PutItemRequest, PutItemResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new PutItemRequestMarshaller(); var unmarshaller = PutItemResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<PutItemRequest,PutItemResponse> responseObject = new AmazonServiceResult<PutItemRequest,PutItemResponse>((PutItemRequest)req, (PutItemResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<PutItemRequest>(request, marshaller, unmarshaller, options, callbackHelper); }