Amazon AWS SDK Guide de l'utilisateur Page 52 : NuGet Package Manager Console
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// "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 · ·
Questions sur Amazon AWS SDK
Pas encore de questions sur ce manuel. Posez la première.
Produits connexes et manuels pour Logiciel Amazon AWS SDK
- Logiciel Amazon Redshift Manuel d'utilisateur
(24 pages) - Logiciel Amazon Redshift Manuel d'utilisateur
(11 pages) - Logiciel Amazon AWS SDK Guide de l'utilisateur
(73 pages)