internal UpdateTableResponse UpdateTable(UpdateTableRequest request) { var marshaller = new UpdateTableRequestMarshaller(); var unmarshaller = UpdateTableResponseUnmarshaller.Instance; return Invoke<UpdateTableRequest,UpdateTableResponse>(request, marshaller, unmarshaller); }
/// <summary> /// Initiates the asynchronous execution of the UpdateTable operation. /// <seealso cref="Amazon.DynamoDBv2.AmazonDynamoDB.UpdateTable"/> /// </summary> /// /// <param name="updateTableRequest">Container for the necessary parameters to execute the UpdateTable operation on AmazonDynamoDBv2.</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 EndUpdateTable /// operation.</returns> public IAsyncResult BeginUpdateTable(UpdateTableRequest updateTableRequest, AsyncCallback callback, object state) { return invokeUpdateTable(updateTableRequest, callback, state, false); }
/// <summary> /// <para>Updates the provisioned throughput for the given table. Setting the throughput for a table helps you manage performance and is part of /// the provisioned throughput feature of Amazon DynamoDB.</para> <para>The provisioned throughput values can be upgraded or downgraded based on /// the maximums and minimums listed in the Limits section in the <i>Amazon DynamoDB Developer Guide</i> .</para> <para>The table must be in /// the <c>ACTIVE</c> state for this operation to succeed. <i>UpdateTable</i> is an asynchronous operation; while executing the operation, the /// table is in the <c>UPDATING</c> state. While the table is in the <c>UPDATING</c> state, the table still has the provisioned throughput from /// before the call. The new provisioned throughput setting is in effect only when the table returns to the <c>ACTIVE</c> state after the /// <i>UpdateTable</i> operation. </para> <para>You cannot add, modify or delete local secondary indexes using <i>UpdateTable</i> . Local /// secondary indexes can only be defined at table creation time.</para> /// </summary> /// /// <param name="updateTableRequest">Container for the necessary parameters to execute the UpdateTable service method on /// AmazonDynamoDBv2.</param> /// /// <returns>The response from the UpdateTable service method, as returned by AmazonDynamoDBv2.</returns> /// /// <exception cref="ResourceInUseException"/> /// <exception cref="ResourceNotFoundException"/> /// <exception cref="LimitExceededException"/> /// <exception cref="InternalServerErrorException"/> public UpdateTableResponse UpdateTable(UpdateTableRequest updateTableRequest) { IAsyncResult asyncResult = invokeUpdateTable(updateTableRequest, null, null, true); return EndUpdateTable(asyncResult); }
/// <summary> /// Updates the provisioned throughput for the given table, or manages the global secondary /// indexes on the table. /// /// /// <para> /// You can increase or decrease the table's provisioned throughput values within the /// maximums and minimums listed in the <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html">Limits</a> /// section in the <i>Amazon DynamoDB Developer Guide</i>. /// </para> /// /// <para> /// In addition, you can use <i>UpdateTable</i> to add, modify or delete global secondary /// indexes on the table. For more information, see <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html">Managing /// Global Secondary Indexes</a> in the <i>Amazon DynamoDB Developer Guide</i>. /// </para> /// /// <para> /// The table must be in the <code>ACTIVE</code> state for <i>UpdateTable</i> to succeed. /// <i>UpdateTable</i> is an asynchronous operation; while executing the operation, the /// table is in the <code>UPDATING</code> state. While the table is in the <code>UPDATING</code> /// state, the table still has the provisioned throughput from before the call. The table's /// new provisioned throughput settings go into effect when the table returns to the <code>ACTIVE</code> /// state; at that point, the <i>UpdateTable</i> operation is complete. /// </para> /// </summary> /// <param name="tableName">The name of the table to be updated.</param> /// <param name="provisionedThroughput">A property of UpdateTableRequest used to execute the UpdateTable service method.</param> /// /// <returns>The response from the UpdateTable service method, as returned by DynamoDB.</returns> /// <exception cref="Amazon.DynamoDBv2.Model.InternalServerErrorException"> /// An error occurred on the server side. /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.LimitExceededException"> /// The number of concurrent table requests (cumulative number of tables in the <code>CREATING</code>, /// <code>DELETING</code> or <code>UPDATING</code> state) exceeds the maximum allowed /// of 10. /// /// /// <para> /// Also, for tables with secondary indexes, only one of those tables can be in the <code>CREATING</code> /// state at any point in time. Do not attempt to create more than one such table simultaneously. /// </para> /// /// <para> /// The total limit of tables in the <code>ACTIVE</code> state is 250. /// </para> /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.ResourceInUseException"> /// The operation conflicts with the resource's availability. For example, you attempted /// to recreate an existing table, or tried to delete a table currently in the <code>CREATING</code> /// state. /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.ResourceNotFoundException"> /// The operation tried to access a nonexistent table or index. The resource might not /// be specified correctly, or its status might not be <code>ACTIVE</code>. /// </exception> public UpdateTableResponse UpdateTable(string tableName, ProvisionedThroughput provisionedThroughput) { var request = new UpdateTableRequest(); request.TableName = tableName; request.ProvisionedThroughput = provisionedThroughput; return UpdateTable(request); }
IAsyncResult invokeUpdateTable(UpdateTableRequest updateTableRequest, AsyncCallback callback, object state, bool synchronized) { IRequest irequest = new UpdateTableRequestMarshaller().Marshall(updateTableRequest); var unmarshaller = UpdateTableResponseUnmarshaller.GetInstance(); AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller); Invoke(result); return result; }
/// <summary> /// Initiates the asynchronous execution of the UpdateTable operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateTable 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 UpdateTableAsync(UpdateTableRequest request, AmazonServiceCallback<UpdateTableRequest, UpdateTableResponse> callback, AsyncOptions options = null) { options = options == null?new AsyncOptions():options; var marshaller = new UpdateTableRequestMarshaller(); var unmarshaller = UpdateTableResponseUnmarshaller.Instance; Action<AmazonWebServiceRequest, AmazonWebServiceResponse, Exception, AsyncOptions> callbackHelper = null; if(callback !=null ) callbackHelper = (AmazonWebServiceRequest req, AmazonWebServiceResponse res, Exception ex, AsyncOptions ao) => { AmazonServiceResult<UpdateTableRequest,UpdateTableResponse> responseObject = new AmazonServiceResult<UpdateTableRequest,UpdateTableResponse>((UpdateTableRequest)req, (UpdateTableResponse)res, ex , ao.State); callback(responseObject); }; BeginInvoke<UpdateTableRequest>(request, marshaller, unmarshaller, options, callbackHelper); }
/// <summary> /// <para>Updates the provisioned throughput for the given table. Setting the throughput for a table helps you manage performance and is part of /// the provisioned throughput feature of DynamoDB.</para> <para>The provisioned throughput values can be upgraded or downgraded based on the /// maximums and minimums listed in the <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html">Limits</a> /// section in the Amazon DynamoDB Developer Guide.</para> <para>The table must be in the <c>ACTIVE</c> state for this operation to succeed. /// <i>UpdateTable</i> is an asynchronous operation; while executing the operation, the table is in the <c>UPDATING</c> state. While the table /// is in the <c>UPDATING</c> state, the table still has the provisioned throughput from before the call. The new provisioned throughput setting /// is in effect only when the table returns to the <c>ACTIVE</c> state after the <i>UpdateTable</i> operation. </para> <para>You cannot add, /// modify or delete indexes using <i>UpdateTable</i> . Indexes can only be defined at table creation time.</para> /// </summary> /// /// <param name="updateTableRequest">Container for the necessary parameters to execute the UpdateTable service method on /// AmazonDynamoDBv2.</param> /// /// <returns>The response from the UpdateTable service method, as returned by AmazonDynamoDBv2.</returns> /// /// <exception cref="T:Amazon.DynamoDBv2.Model.ResourceInUseException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.ResourceNotFoundException" /> /// <exception cref="T:Amazon.DynamoDBv2.Model.LimitExceededException" /> /// <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<UpdateTableResponse> UpdateTableAsync(UpdateTableRequest updateTableRequest, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateTableRequestMarshaller(); var unmarshaller = UpdateTableResponseUnmarshaller.GetInstance(); return Invoke<IRequest, UpdateTableRequest, UpdateTableResponse>(updateTableRequest, marshaller, unmarshaller, signer, cancellationToken); }
private Amazon.DynamoDBv2.Model.UpdateTableResponse CallAWSServiceOperation(IAmazonDynamoDB client, Amazon.DynamoDBv2.Model.UpdateTableRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon DynamoDB", "UpdateTable"); try { #if DESKTOP return(client.UpdateTable(request)); #elif CORECLR return(client.UpdateTableAsync(request).GetAwaiter().GetResult()); #else #error "Unknown build edition" #endif } catch (AmazonServiceException exc) { var webException = exc.InnerException as System.Net.WebException; if (webException != null) { throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException); } throw; } }
/// <summary> /// Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB /// Streams settings for a given table. /// /// /// <para> /// You can only perform one of the following operations at once: /// </para> /// <ul> <li> /// <para> /// Modify the provisioned throughput settings of the table. /// </para> /// </li> <li> /// <para> /// Enable or disable Streams on the table. /// </para> /// </li> <li> /// <para> /// Remove a global secondary index from the table. /// </para> /// </li> <li> /// <para> /// Create a new global secondary index on the table. Once the index begins backfilling, /// you can use <i>UpdateTable</i> to perform other operations. /// </para> /// </li> </ul> /// <para> /// <i>UpdateTable</i> is an asynchronous operation; while it is executing, the table /// status changes from <code>ACTIVE</code> to <code>UPDATING</code>. While it is <code>UPDATING</code>, /// you cannot issue another <i>UpdateTable</i> request. When the table returns to the /// <code>ACTIVE</code> state, the <i>UpdateTable</i> operation is complete. /// </para> /// </summary> /// <param name="tableName">The name of the table to be updated.</param> /// <param name="provisionedThroughput">A property of UpdateTableRequest used to execute the UpdateTable service method.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the UpdateTable service method, as returned by DynamoDB.</returns> /// <exception cref="Amazon.DynamoDBv2.Model.InternalServerErrorException"> /// An error occurred on the server side. /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.LimitExceededException"> /// The number of concurrent table requests (cumulative number of tables in the <code>CREATING</code>, /// <code>DELETING</code> or <code>UPDATING</code> state) exceeds the maximum allowed /// of 10. /// /// /// <para> /// Also, for tables with secondary indexes, only one of those tables can be in the <code>CREATING</code> /// state at any point in time. Do not attempt to create more than one such table simultaneously. /// </para> /// /// <para> /// The total limit of tables in the <code>ACTIVE</code> state is 250. /// </para> /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.ResourceInUseException"> /// The operation conflicts with the resource's availability. For example, you attempted /// to recreate an existing table, or tried to delete a table currently in the <code>CREATING</code> /// state. /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.ResourceNotFoundException"> /// The operation tried to access a nonexistent table or index. The resource might not /// be specified correctly, or its status might not be <code>ACTIVE</code>. /// </exception> public Task<UpdateTableResponse> UpdateTableAsync(string tableName, ProvisionedThroughput provisionedThroughput, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new UpdateTableRequest(); request.TableName = tableName; request.ProvisionedThroughput = provisionedThroughput; return UpdateTableAsync(request, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the UpdateTable operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateTable 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 EndUpdateTable /// operation.</returns> public IAsyncResult BeginUpdateTable(UpdateTableRequest request, AsyncCallback callback, object state) { var marshaller = new UpdateTableRequestMarshaller(); var unmarshaller = UpdateTableResponseUnmarshaller.Instance; return BeginInvoke<UpdateTableRequest>(request, marshaller, unmarshaller, callback, state); }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.DynamoDBv2.Model.UpdateTableRequest(); if (cmdletContext.AttributeDefinition != null) { request.AttributeDefinitions = cmdletContext.AttributeDefinition; } if (cmdletContext.BillingMode != null) { request.BillingMode = cmdletContext.BillingMode; } if (cmdletContext.GlobalSecondaryIndexUpdate != null) { request.GlobalSecondaryIndexUpdates = cmdletContext.GlobalSecondaryIndexUpdate; } // populate ProvisionedThroughput var requestProvisionedThroughputIsNull = true; request.ProvisionedThroughput = new Amazon.DynamoDBv2.Model.ProvisionedThroughput(); System.Int64?requestProvisionedThroughput_readCapacity = null; if (cmdletContext.ReadCapacity != null) { requestProvisionedThroughput_readCapacity = cmdletContext.ReadCapacity.Value; } if (requestProvisionedThroughput_readCapacity != null) { request.ProvisionedThroughput.ReadCapacityUnits = requestProvisionedThroughput_readCapacity.Value; requestProvisionedThroughputIsNull = false; } System.Int64?requestProvisionedThroughput_writeCapacity = null; if (cmdletContext.WriteCapacity != null) { requestProvisionedThroughput_writeCapacity = cmdletContext.WriteCapacity.Value; } if (requestProvisionedThroughput_writeCapacity != null) { request.ProvisionedThroughput.WriteCapacityUnits = requestProvisionedThroughput_writeCapacity.Value; requestProvisionedThroughputIsNull = false; } // determine if request.ProvisionedThroughput should be set to null if (requestProvisionedThroughputIsNull) { request.ProvisionedThroughput = null; } if (cmdletContext.ReplicaUpdate != null) { request.ReplicaUpdates = cmdletContext.ReplicaUpdate; } // populate SSESpecification var requestSSESpecificationIsNull = true; request.SSESpecification = new Amazon.DynamoDBv2.Model.SSESpecification(); System.Boolean?requestSSESpecification_sSESpecification_Enabled = null; if (cmdletContext.SSESpecification_Enabled != null) { requestSSESpecification_sSESpecification_Enabled = cmdletContext.SSESpecification_Enabled.Value; } if (requestSSESpecification_sSESpecification_Enabled != null) { request.SSESpecification.Enabled = requestSSESpecification_sSESpecification_Enabled.Value; requestSSESpecificationIsNull = false; } System.String requestSSESpecification_sSESpecification_KMSMasterKeyId = null; if (cmdletContext.SSESpecification_KMSMasterKeyId != null) { requestSSESpecification_sSESpecification_KMSMasterKeyId = cmdletContext.SSESpecification_KMSMasterKeyId; } if (requestSSESpecification_sSESpecification_KMSMasterKeyId != null) { request.SSESpecification.KMSMasterKeyId = requestSSESpecification_sSESpecification_KMSMasterKeyId; requestSSESpecificationIsNull = false; } Amazon.DynamoDBv2.SSEType requestSSESpecification_sSESpecification_SSEType = null; if (cmdletContext.SSESpecification_SSEType != null) { requestSSESpecification_sSESpecification_SSEType = cmdletContext.SSESpecification_SSEType; } if (requestSSESpecification_sSESpecification_SSEType != null) { request.SSESpecification.SSEType = requestSSESpecification_sSESpecification_SSEType; requestSSESpecificationIsNull = false; } // determine if request.SSESpecification should be set to null if (requestSSESpecificationIsNull) { request.SSESpecification = null; } // populate StreamSpecification var requestStreamSpecificationIsNull = true; request.StreamSpecification = new Amazon.DynamoDBv2.Model.StreamSpecification(); System.Boolean?requestStreamSpecification_streamSpecification_StreamEnabled = null; if (cmdletContext.StreamSpecification_StreamEnabled != null) { requestStreamSpecification_streamSpecification_StreamEnabled = cmdletContext.StreamSpecification_StreamEnabled.Value; } if (requestStreamSpecification_streamSpecification_StreamEnabled != null) { request.StreamSpecification.StreamEnabled = requestStreamSpecification_streamSpecification_StreamEnabled.Value; requestStreamSpecificationIsNull = false; } Amazon.DynamoDBv2.StreamViewType requestStreamSpecification_streamSpecification_StreamViewType = null; if (cmdletContext.StreamSpecification_StreamViewType != null) { requestStreamSpecification_streamSpecification_StreamViewType = cmdletContext.StreamSpecification_StreamViewType; } if (requestStreamSpecification_streamSpecification_StreamViewType != null) { request.StreamSpecification.StreamViewType = requestStreamSpecification_streamSpecification_StreamViewType; requestStreamSpecificationIsNull = false; } // determine if request.StreamSpecification should be set to null if (requestStreamSpecificationIsNull) { request.StreamSpecification = null; } if (cmdletContext.TableClass != null) { request.TableClass = cmdletContext.TableClass; } if (cmdletContext.TableName != null) { request.TableName = cmdletContext.TableName; } CmdletOutput output; // issue call var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint); try { var response = CallAWSServiceOperation(client, request); object pipelineOutput = null; pipelineOutput = cmdletContext.Select(response, this); output = new CmdletOutput { PipelineOutput = pipelineOutput, ServiceResponse = response }; } catch (Exception e) { output = new CmdletOutput { ErrorResponse = e }; } return(output); }
internal UpdateTableResponse UpdateTable(UpdateTableRequest request) { var task = UpdateTableAsync(request); try { return task.Result; } catch(AggregateException e) { throw e.InnerException; } }
/// <summary> /// Initiates the asynchronous execution of the UpdateTable operation. /// <seealso cref="Amazon.DynamoDBv2.IAmazonDynamoDB.UpdateTable"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateTable 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<UpdateTableResponse> UpdateTableAsync(UpdateTableRequest request, CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateTableRequestMarshaller(); var unmarshaller = UpdateTableResponseUnmarshaller.GetInstance(); var response = await Invoke<IRequest, UpdateTableRequest, UpdateTableResponse>(request, marshaller, unmarshaller, signer, cancellationToken) .ConfigureAwait(continueOnCapturedContext: false); return response; }
public void DataPlaneSamples() { { #region CreateTable Sample // Create a client AmazonDynamoDBClient client = new AmazonDynamoDBClient(); // Define table schema: // Table has a hash-key "Author" and a range-key "Title" List<KeySchemaElement> schema = new List<KeySchemaElement> { new KeySchemaElement { AttributeName = "Author", KeyType = "HASH" }, new KeySchemaElement { AttributeName = "Title", KeyType = "RANGE" } }; // Define key attributes: // The key attributes "Author" and "Title" are string types List<AttributeDefinition> definitions = new List<AttributeDefinition> { new AttributeDefinition { AttributeName = "Author", AttributeType = "S" }, new AttributeDefinition { AttributeName = "Title", AttributeType = "S" } }; // Define table throughput: // Table has capacity of 20 reads and 50 writes ProvisionedThroughput throughput = new ProvisionedThroughput { ReadCapacityUnits = 20, WriteCapacityUnits = 50 }; // Configure the CreateTable request CreateTableRequest request = new CreateTableRequest { TableName = "SampleTable", KeySchema = schema, ProvisionedThroughput = throughput, AttributeDefinitions = definitions }; // View new table properties TableDescription tableDescription = client.CreateTable(request).TableDescription; Console.WriteLine("Table name: {0}", tableDescription.TableName); Console.WriteLine("Creation time: {0}", tableDescription.CreationDateTime); Console.WriteLine("Item count: {0}", tableDescription.ItemCount); Console.WriteLine("Table size (bytes): {0}", tableDescription.TableSizeBytes); Console.WriteLine("Table status: {0}", tableDescription.TableStatus); // List table key schema List<KeySchemaElement> tableSchema = tableDescription.KeySchema; for (int i = 0; i < tableSchema.Count; i++) { KeySchemaElement element = tableSchema[i]; Console.WriteLine("Key: Name = {0}, KeyType = {1}", element.AttributeName, element.KeyType); } // List attribute definitions List<AttributeDefinition> attributeDefinitions = tableDescription.AttributeDefinitions; for (int i = 0; i < attributeDefinitions.Count; i++) { AttributeDefinition definition = attributeDefinitions[i]; Console.WriteLine("Attribute: Name = {0}, Type = {1}", definition.AttributeName, definition.AttributeType); } Console.WriteLine("Throughput: Reads = {0}, Writes = {1}", tableDescription.ProvisionedThroughput.ReadCapacityUnits, tableDescription.ProvisionedThroughput.WriteCapacityUnits); #endregion } { #region DescribeTable Sample // Create a client AmazonDynamoDBClient client = new AmazonDynamoDBClient(); // Create DescribeTable request DescribeTableRequest request = new DescribeTableRequest { TableName = "SampleTable" }; // Issue DescribeTable request and retrieve the table description TableDescription tableDescription = client.DescribeTable(request).Table; // View new table properties Console.WriteLine("Table name: {0}", tableDescription.TableName); Console.WriteLine("Creation time: {0}", tableDescription.CreationDateTime); Console.WriteLine("Item count: {0}", tableDescription.ItemCount); Console.WriteLine("Table size (bytes): {0}", tableDescription.TableSizeBytes); Console.WriteLine("Table status: {0}", tableDescription.TableStatus); // List table key schema List<KeySchemaElement> tableSchema = tableDescription.KeySchema; for (int i = 0; i < tableSchema.Count; i++) { KeySchemaElement element = tableSchema[i]; Console.WriteLine("Key: Name = {0}, KeyType = {1}", element.AttributeName, element.KeyType); } // List attribute definitions List<AttributeDefinition> attributeDefinitions = tableDescription.AttributeDefinitions; for (int i = 0; i < attributeDefinitions.Count; i++) { AttributeDefinition definition = attributeDefinitions[i]; Console.WriteLine("Attribute: Name = {0}, Type = {1}", definition.AttributeName, definition.AttributeType); } Console.WriteLine("Throughput: Reads = {0}, Writes = {1}", tableDescription.ProvisionedThroughput.ReadCapacityUnits, tableDescription.ProvisionedThroughput.WriteCapacityUnits); #endregion } { #region ListTables Paging Sample // Create a client AmazonDynamoDBClient client = new AmazonDynamoDBClient(); string startTableName = null; do { // Configure ListTables request with the marker value ListTablesRequest request = new ListTablesRequest { ExclusiveStartTableName = startTableName, }; // Issue call ListTablesResult result = client.ListTables(request); // List retrieved tables List<string> tables = result.TableNames; Console.WriteLine("Retrieved tables: {0}", string.Join(", ", tables)); // Update marker value from the result startTableName = result.LastEvaluatedTableName; } while (!string.IsNullOrEmpty(startTableName)); // Test marker value #endregion } { #region ListTables NonPaging Sample // Create a client AmazonDynamoDBClient client = new AmazonDynamoDBClient(); // Issue call ListTablesResult result = client.ListTables(); // List retrieved tables List<string> tables = result.TableNames; Console.WriteLine("Retrieved tables: {0}", string.Join(", ", tables)); #endregion } TableUtils.WaitUntilTableActive("SampleTable", TestClient); { #region UpdateTable Sample // Create a client AmazonDynamoDBClient client = new AmazonDynamoDBClient(); // Define new table throughput: // Table will now have capacity of 40 reads and 50 writes ProvisionedThroughput throughput = new ProvisionedThroughput { ReadCapacityUnits = 40, WriteCapacityUnits = 50 }; // Compose the UpdateTable request UpdateTableRequest request = new UpdateTableRequest { TableName = "SampleTable", ProvisionedThroughput = throughput }; // View new table properties TableDescription tableDescription = client.UpdateTable(request).TableDescription; Console.WriteLine("Table name: {0}", tableDescription.TableName); Console.WriteLine("Throughput: Reads = {0}, Writes = {1}", tableDescription.ProvisionedThroughput.ReadCapacityUnits, tableDescription.ProvisionedThroughput.WriteCapacityUnits); #endregion } TableUtils.WaitUntilTableActive("SampleTable", TestClient); { #region DeleteTable Sample // Create a client AmazonDynamoDBClient client = new AmazonDynamoDBClient(); // Configure the DeleteTable request DeleteTableRequest request = new DeleteTableRequest { TableName = "SampleTable" }; // Issue DeleteTable request and retrieve the table description TableDescription tableDescription = client.DeleteTable(request).TableDescription; Console.WriteLine("Table name: {0}", tableDescription.TableName); Console.WriteLine("Table status: {0}", tableDescription.TableStatus); #endregion } }
/// <summary> /// Initiates the asynchronous execution of the UpdateTable operation. /// <seealso cref="Amazon.DynamoDBv2.IAmazonDynamoDB"/> /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateTable 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<UpdateTableResponse> UpdateTableAsync(UpdateTableRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new UpdateTableRequestMarshaller(); var unmarshaller = UpdateTableResponseUnmarshaller.Instance; return InvokeAsync<UpdateTableRequest,UpdateTableResponse>(request, marshaller, unmarshaller, cancellationToken); }
internal UpdateTableResponse UpdateTable(UpdateTableRequest request) { var task = UpdateTableAsync(request); try { return task.Result; } catch(AggregateException e) { ExceptionDispatchInfo.Capture(e.InnerException).Throw(); return null; } }
void UpdateTableListener() { resultText.text = ("\n*** Updating table ***\n"); var request = new UpdateTableRequest() { TableName = @"ProductCatalog", ProvisionedThroughput = new ProvisionedThroughput() { ReadCapacityUnits = 10, WriteCapacityUnits = 10 } }; Client.UpdateTableAsync(request, (result) => { if (result.Exception != null) { resultText.text += result.Exception.Message; return; } var response = result.Response; var table = response.TableDescription; resultText.text += ("Table " + table.TableName + " Updated ! \n Allow a few seconds to reflect !"); }); }
/// <summary> /// Updates the provisioned throughput for the given table, or manages the global secondary /// indexes on the table. /// /// /// <para> /// You can increase or decrease the table's provisioned throughput values within the /// maximums and minimums listed in the <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html">Limits</a> /// section in the <i>Amazon DynamoDB Developer Guide</i>. /// </para> /// /// <para> /// In addition, you can use <i>UpdateTable</i> to add, modify or delete global secondary /// indexes on the table. For more information, see <a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.OnlineOps.html">Managing /// Global Secondary Indexes</a> in the <i>Amazon DynamoDB Developer Guide</i>. /// </para> /// /// <para> /// The table must be in the <code>ACTIVE</code> state for <i>UpdateTable</i> to succeed. /// <i>UpdateTable</i> is an asynchronous operation; while executing the operation, the /// table is in the <code>UPDATING</code> state. While the table is in the <code>UPDATING</code> /// state, the table still has the provisioned throughput from before the call. The table's /// new provisioned throughput settings go into effect when the table returns to the <code>ACTIVE</code> /// state; at that point, the <i>UpdateTable</i> operation is complete. /// </para> /// </summary> /// <param name="tableName">The name of the table to be updated.</param> /// <param name="provisionedThroughput">A property of UpdateTableRequest used to execute the UpdateTable service method.</param> /// /// <returns>The response from the UpdateTable service method, as returned by DynamoDB.</returns> /// <exception cref="Amazon.DynamoDBv2.Model.InternalServerErrorException"> /// An error occurred on the server side. /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.LimitExceededException"> /// The number of concurrent table requests (cumulative number of tables in the <code>CREATING</code>, /// <code>DELETING</code> or <code>UPDATING</code> state) exceeds the maximum allowed /// of 10. /// /// /// <para> /// Also, for tables with secondary indexes, only one of those tables can be in the <code>CREATING</code> /// state at any point in time. Do not attempt to create more than one such table simultaneously. /// </para> /// /// <para> /// The total limit of tables in the <code>ACTIVE</code> state is 250. /// </para> /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.ResourceInUseException"> /// The operation conflicts with the resource's availability. For example, you attempted /// to recreate an existing table, or tried to delete a table currently in the <code>CREATING</code> /// state. /// </exception> /// <exception cref="Amazon.DynamoDBv2.Model.ResourceNotFoundException"> /// The operation tried to access a nonexistent table or index. The resource might not /// be specified correctly, or its status might not be <code>ACTIVE</code>. /// </exception> public void UpdateTableAsync(string tableName, ProvisionedThroughput provisionedThroughput, AmazonServiceCallback<UpdateTableRequest, UpdateTableResponse> callback, AsyncOptions options = null) { var request = new UpdateTableRequest(); request.TableName = tableName; request.ProvisionedThroughput = provisionedThroughput; UpdateTableAsync(request, callback, options); }