コード例 #1
0
        private Table CreateTable()
        {
            CreateTableRequest createRequest = new CreateTableRequest()
                .WithTableName(this._tableName)
                .WithKeySchema(new KeySchema()
                    .WithHashKeyElement(new KeySchemaElement()
                        .WithAttributeName(ATTRIBUTE_SESSION_ID)
                        .WithAttributeType("S")))
                .WithProvisionedThroughput(new ProvisionedThroughput()
                    .WithReadCapacityUnits(this._initialReadUnits)
                    .WithWriteCapacityUnits(this._initialWriteUnits));
            createRequest.BeforeRequestEvent += this.UserAgentRequestEventHandler;

            CreateTableResponse response = this._ddbClient.CreateTable(createRequest);

            DescribeTableRequest descRequest = new DescribeTableRequest()
                .WithTableName(this._tableName);
            descRequest.BeforeRequestEvent += this.UserAgentRequestEventHandler;

            // Wait till table is active
            bool isActive = false;
            while (!isActive)
            {
                Thread.Sleep(DESCRIBE_INTERVAL);
                DescribeTableResponse descResponse = this._ddbClient.DescribeTable(descRequest);
                string tableStatus = descResponse.DescribeTableResult.Table.TableStatus;

                if (string.Equals(tableStatus, ACTIVE_STATUS, StringComparison.InvariantCultureIgnoreCase))
                    isActive = true;
            }

            Table table = Table.LoadTable(this._ddbClient, this._tableName, Table.DynamoDBConsumer.SessionStateProvider);
            return table;
        }
コード例 #2
0
 IAsyncResult invokeCreateTable(CreateTableRequest createTableRequest, AsyncCallback callback, object state, bool synchronized)
 {
     IRequest irequest = new CreateTableRequestMarshaller().Marshall(createTableRequest);
     var unmarshaller = CreateTableResponseUnmarshaller.GetInstance();
     AsyncResult result = new AsyncResult(irequest, callback, state, synchronized, signer, unmarshaller);
     Invoke(result);
     return result;
 }
コード例 #3
0
 /// <summary>
 /// Initiates the asynchronous execution of the CreateTable operation.
 /// <seealso cref="Amazon.DynamoDB.AmazonDynamoDB.CreateTable"/>
 /// </summary>
 /// 
 /// <param name="createTableRequest">Container for the necessary parameters to execute the CreateTable operation on AmazonDynamoDB.</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 EndCreateTable
 ///         operation.</returns>
 public IAsyncResult BeginCreateTable(CreateTableRequest createTableRequest, AsyncCallback callback, object state)
 {
     return invokeCreateTable(createTableRequest, callback, state, false);
 }
コード例 #4
0
 /// <summary>
 /// <para>Adds a new table to your account.</para> <para>The table name must be unique among those associated with the AWS Account issuing the
 /// request, and the AWS Region that receives the request (e.g. <c>us-east-1</c> ).</para> <para>The <c>CreateTable</c> operation triggers an
 /// asynchronous workflow to begin creating the table. Amazon DynamoDB immediately returns the state of the table ( <c>CREATING</c> ) until the
 /// table is in the <c>ACTIVE</c> state. Once the table is in the <c>ACTIVE</c> state, you can perform data plane operations.</para>
 /// </summary>
 /// 
 /// <param name="createTableRequest">Container for the necessary parameters to execute the CreateTable service method on AmazonDynamoDB.</param>
 /// 
 /// <returns>The response from the CreateTable service method, as returned by AmazonDynamoDB.</returns>
 /// 
 /// <exception cref="ResourceInUseException"/>
 /// <exception cref="LimitExceededException"/>
 /// <exception cref="InternalServerErrorException"/>
 public CreateTableResponse CreateTable(CreateTableRequest createTableRequest)
 {
     IAsyncResult asyncResult = invokeCreateTable(createTableRequest, null, null, true);
     return EndCreateTable(asyncResult);
 }
コード例 #5
0
 /// <summary>
 /// <para> The CreateTable operation adds a new table to your account. The table name must be unique among those associated with the AWS Account
 /// issuing the request, and the AWS Region that receives the request (e.g. us-east-1). The CreateTable operation triggers an asynchronous
 /// workflow to begin creating the table. Amazon DynamoDB immediately returns the state of the table (CREATING) until the table is in the ACTIVE
 /// state. Once the table is in the ACTIVE state, you can perform data plane operations. </para>
 /// </summary>
 /// 
 /// <param name="createTableRequest">Container for the necessary parameters to execute the CreateTable service method on AmazonDynamoDB.</param>
 /// 
 /// <returns>The response from the CreateTable service method, as returned by AmazonDynamoDB.</returns>
 /// 
 /// <exception cref="ResourceInUseException"/>
 /// <exception cref="LimitExceededException"/>
 /// <exception cref="InternalServerErrorException"/>
 public CreateTableResponse CreateTable(CreateTableRequest createTableRequest)
 {
     IRequest<CreateTableRequest> request = new CreateTableRequestMarshaller().Marshall(createTableRequest);
     CreateTableResponse response = Invoke<CreateTableRequest, CreateTableResponse> (request, this.signer, CreateTableResponseUnmarshaller.GetInstance());
     return response;
 }