/// <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; }
/// <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; }
/// <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; }
/// <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)); } }); }