Amazon AWS SDK Guide de l'utilisateur Page 52 : NuGet Package Manager Console

/ 155
Table des matières
// "HASH" = hash key, "RANGE" = range key.
KeyType = "HASH"
},
new KeySchemaElement
{
AttributeName = "Type",
KeyType = "RANGE"
},
},
ProvisionedThroughput = new ProvisionedThroughput
{
ReadCapacityUnits = 10,
WriteCapacityUnits = 5
},
};
var response = client.CreateTable(request);
Console.WriteLine("Table created with request ID: " +
response.ResponseMetadata.RequestId);
In the preceding example, the table is created through the
AmazonDynamoDBClient
class's
CreateTable
method. The
CreateTable
method uses an instance of the
CreateTableRequest
class containing
characteristics such as required item attribute names, primary key definition, and throughput capacity.
The
CreateTable
method returns an instance of the
CreateTableResponse
class.
Before you begin modifying a table, you should make sure that the table is ready. The following example
shows how to use the low-level model to verify that a table in DynamoDB is ready:
// using Amazon.DynamoDBv2;
// using Amazon.DynamoDBv2.Model;
var client = new AmazonDynamoDBClient();
var status = "";
do
{
// Wait 5 seconds before checking (again).
System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));
try
{
var response = client.DescribeTable(new DescribeTableRequest
{
TableName = "AnimalsInventory"
});
Console.WriteLine("Table = {0}, Status = {1}",
response.Table.TableName,
response.Table.TableStatus);
status = response.Table.TableStatus;
}
catch (ResourceNotFoundException)
{
// DescribeTable is eventually consistent. So you might
//
get resource not found.
Version v2.0.0
48
AWS SDK for .NET Developer Guide
Programming Models

Fichier PDF · ·

Imprimer

Imprimer le document

Partage

Questions sur Amazon AWS SDK

Pas encore de questions sur ce manuel. Posez la première.

Poser une question

Nous répondons à partir du manuel et indiquons la page. La question est publiée sur le site après vérification.

Toutes les questions et réponses ›

Produits connexes et manuels pour Logiciel Amazon AWS SDK