Contains the properties of a table.

 public DescribeTableResult WithTable(TableDescription table)
 {
     this.table = table;
     return this;
 }
 /// <summary>
 /// Sets the TableDescription property
 /// </summary>
 /// <param name="tableDescription">The value to set for the TableDescription property </param>
 /// <returns>this instance</returns>
 public DeleteTableResult WithTableDescription(TableDescription tableDescription)
 {
     this.tableDescription = tableDescription;
     return(this);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Sets the TableDescription property
 /// </summary>
 /// <param name="tableDescription">The value to set for the TableDescription property </param>
 /// <returns>this instance</returns>
 public CreateTableResult WithTableDescription(TableDescription tableDescription)
 {
     this.tableDescription = tableDescription;
     return this;
 }
 public DescribeTableResult WithTable(TableDescription table)
 {
     this.table = table;
     return(this);
 }
Exemplo n.º 5
0
        public virtual bool ValidateSchema(TableDescription tableDescription)
        {
            if (tableDescription == null)
            {
                _Default.LogMessageToPage("Null table description passed to validation method.");
                return false;
            }

            if (!tableDescription.TableStatus.Equals("ACTIVE"))
            {
                _Default.LogMessageToPage("Table is not active.");
                return false;
            }

            if (tableDescription.AttributeDefinitions == null || tableDescription.KeySchema == null)
            {
                _Default.LogMessageToPage("Schema doesn't match.");
                return false;
            }
            foreach (AttributeDefinition attributeDefinition in tableDescription.AttributeDefinitions)
            {
                // Confirm that the relevant attributes are both strings.
                switch (attributeDefinition.AttributeName)
                {
                    case "Key":
                    case "Bucket":
                        if (!attributeDefinition.AttributeType.Equals("S"))
                        {
                            // We have a matching attribute, but the type is wrong.
                            _Default.LogMessageToPage("{0} attribute is wrong type in attribute definition.", attributeDefinition.AttributeName);
                            return false;
                        }
                        break;
                }
            }
            // If we've gotten here, the attributes are good. Now check the key schema.
            if (tableDescription.KeySchema.Count != 2)
            {
                _Default.LogMessageToPage("Wrong number of elements in the key schema.");
                return false;
            }
            foreach (KeySchemaElement keySchemaElement in tableDescription.KeySchema)
            {
                switch (keySchemaElement.AttributeName)
                {
                    case "Key":
                        if (!keySchemaElement.KeyType.Equals("HASH"))
                        {
                            // We have a matching attribute, but the type is wrong.
                            _Default.LogMessageToPage("Key attribute is wrong type in key schema.");
                            return false;
                        }
                        break;
                    case "Bucket":
                        if (!keySchemaElement.KeyType.Equals("RANGE"))
                        {
                            // We have a matching attribute, but the type is wrong.
                            _Default.LogMessageToPage("Bucket attribute is wrong type in key schema.");
                            return false;
                        }
                        break;
                    default:
                        _Default.LogMessageToPage(String.Format("Unexpected attribute ({0}) in the key schema.", keySchemaElement.AttributeName));
                        return false;
                }

            }
            _Default.LogMessageToPage("Table schema is as expected.");
            // We've passed our checks.
            return true;
        }
 internal DynamoDbGlobalSecondaryIndexThroughput(
     TableDescription tableDescription,
     GlobalSecondaryIndexDescription indexDescription)
     : this(tableDescription.TableName, indexDescription)
 {
 }
 internal DynamoDbTableThroughput(TableDescription tableDescription)
     : this(tableDescription.TableName, tableDescription.ProvisionedThroughput)
 {
 }
Exemplo n.º 8
0
 /// <summary>
 ///     Validate the schema described by the tableDescription parameter. We expect the table to have
 ///     the following characteristics:
 ///     Schema - At least two attributes, "Key" and "Bucket" both of string types.
 ///     Hash Key - Single attribute named "Key" of type string.
 ///     Range Key - Single attribute named "Bucket" of type string.
 /// </summary>
 /// <param name="tableDescription">The table definition.</param>
 /// <remarks>
 ///     The purpose of this task is to gain experience working with complex data structures that are
 ///     a regular part of interacting with DynamoDB.
 /// </remarks>
 /// <returns>True if the schema matches what we expect, false if the schema was invalid or an exception was thrown.</returns>
 public override bool ValidateSchema(TableDescription tableDescription)
 {
     //TODO: Replace this call to the base class with your own method implementation.
     return base.ValidateSchema(tableDescription);
 }