예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IndexProvision"/> class.
 /// </summary>
 /// <param name="indexName">The name of the global secondary index.</param>
 /// <param name="throughput">The provisioned throughput if the global secondary index.</param>
 public IndexProvision(string indexName, ProvisionedThroughput throughput)
 {
     DynamoValidator.ThrowIfIndexNameIsNotValid(indexName);
     Validator.ThrowIfNull(throughput, nameof(throughput));
     IndexName  = indexName;
     Throughput = throughput;
 }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GlobalSecondaryIndex"/> class.
        /// </summary>
        /// <param name="indexName">The name of the secondary global index.</param>
        /// <param name="partitionKey">The partition key of a table or index.</param>
        /// <param name="setup">The <see cref="GlobalSecondaryIndexOptions" /> which need to be configured.</param>
        public GlobalSecondaryIndex(string indexName, PartitionKey partitionKey, Action <GlobalSecondaryIndexOptions> setup = null) : base(indexName, partitionKey)
        {
            DynamoValidator.ThrowIfIndexNameIsNotValid(indexName);
            var options = setup.ConfigureOptions();

            SortKey    = options.SortKey;
            Projection = options.Projection;
            Throughput = options.Throughput;
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SecondaryIndex"/> class.
        /// </summary>
        /// <param name="indexName">The name of the secondary local index.</param>
        /// <param name="sortKey">The sort key of the table.</param>
        /// <param name="setup">The <see cref="SecondaryIndexOptions" /> which need to be configured.</param>
        public SecondaryIndex(string indexName, SortKey sortKey, Action <SecondaryIndexOptions> setup = null) : base()
        {
            DynamoValidator.ThrowIfIndexNameIsNotValid(indexName);
            var options = setup.ConfigureOptions();

            SortKey    = sortKey;
            Projection = options.Projection;
            IndexName  = indexName;
        }
예제 #4
0
 /// <summary>
 /// Adds the specified name to this collection.
 /// </summary>
 /// <param name="indexName">The name of the message attribute.</param>
 public override void Add(string indexName)
 {
     Add(indexName, () =>
     {
         DynamoValidator.ThrowIfIndexNameIsNotValid(indexName, nameof(indexName));
         if (Contains(indexName))
         {
             throw new ArgumentException("IndexName has already been added.", nameof(indexName));
         }
         if (Count >= MaximumCollectionSize)
         {
             throw new ArgumentException("Unable to add index name; cannot exceed a maximum of {0} index names.".FormatWith(MaximumCollectionSize));
         }
     });
 }
예제 #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Key"/> class.
 /// </summary>
 /// <param name="keyName">The name of the key of a table or index.</param>
 /// <param name="keyType">The data type of the key of a table or index.</param>
 protected Key(string keyName, AttributeType keyType)
 {
     DynamoValidator.ThrowIfAttributeNameIsNotValid(keyName);
     Name = keyName;
     Type = keyType;
 }