Ejemplo n.º 1
0
        public override async Task <DbDataReader> ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var provider         = new ListDataProvider();
            var tableDescription = await Context.GetTableDescriptionAsync(QueryInfo.TableName, cancellationToken);

            provider.AddColumn("IndexType", typeof(string));
            provider.AddColumn("IndexArn", typeof(string));
            provider.AddColumn("IndexName", typeof(string));
            provider.AddColumn("IndexSizeBytes", typeof(long));
            provider.AddColumn("ItemCount", typeof(long));
            provider.AddColumn("HashKeyName", typeof(string));
            provider.AddColumn("SortKeyName", typeof(string));
            provider.AddColumn("ProjectionType", typeof(string));
            provider.AddColumn("NonKeyAttributes", typeof(string));

            foreach (var localIndex in tableDescription.LocalSecondaryIndexes)
            {
                var hashKeyName = localIndex.KeySchema.First(schema => schema.KeyType == KeyType.HASH).AttributeName;
                var sortKeyName = localIndex.KeySchema.FirstOrDefault(schema => schema.KeyType == KeyType.RANGE)?.AttributeName;

                provider.AddRow(
                    "LOCAL",
                    localIndex.IndexArn,
                    localIndex.IndexName,
                    localIndex.IndexSizeBytes,
                    localIndex.ItemCount,
                    hashKeyName,
                    sortKeyName,
                    localIndex.Projection.ProjectionType.Value,
                    string.Join(", ", localIndex.Projection.NonKeyAttributes)
                    );
            }

            foreach (var globalIndex in tableDescription.GlobalSecondaryIndexes)
            {
                var hashKeyName = globalIndex.KeySchema.First(schema => schema.KeyType == KeyType.HASH).AttributeName;
                var sortKeyName = globalIndex.KeySchema.FirstOrDefault(schema => schema.KeyType == KeyType.RANGE)?.AttributeName;

                provider.AddRow(
                    "GLOBAL",
                    globalIndex.IndexArn,
                    globalIndex.IndexName,
                    globalIndex.IndexSizeBytes,
                    globalIndex.ItemCount,
                    hashKeyName,
                    sortKeyName,
                    globalIndex.Projection.ProjectionType.Value,
                    string.Join(", ", globalIndex.Projection.NonKeyAttributes)
                    );
            }

            return(new PrimarSqlDataReader(provider));
        }
Ejemplo n.º 2
0
        public override async Task <DbDataReader> ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var response = await Context.Client.ListTablesAsync(cancellationToken);

            var provider = new ListDataProvider();

            provider.AddColumn("name", typeof(string));

            foreach (string tableName in response.TableNames)
            {
                provider.AddRow(tableName);
            }

            return(new PrimarSqlDataReader(provider));
        }
Ejemplo n.º 3
0
        public override async Task <DbDataReader> ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var provider = new ListDataProvider();
            var response = await Context.Client.DescribeEndpointsAsync(new DescribeEndpointsRequest(), cancellationToken);

            provider.AddColumn("Address", typeof(string));
            provider.AddColumn("CachePeriodInMinutes", typeof(long));

            foreach (var endpoint in response.Endpoints)
            {
                provider.AddRow(endpoint.Address, endpoint.CachePeriodInMinutes);
            }

            return(new PrimarSqlDataReader(provider));
        }
Ejemplo n.º 4
0
        public override async Task <DbDataReader> ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var provider = new ListDataProvider();
            var response = await Context.Client.DescribeLimitsAsync(new DescribeLimitsRequest(), cancellationToken);

            provider.AddColumn("TableMaxReadCapacityUnits", typeof(long));
            provider.AddColumn("TableMaxWriteCapacityUnits", typeof(long));
            provider.AddColumn("AccountMaxReadCapacityUnits", typeof(long));
            provider.AddColumn("AccountMaxWriteCapacityUnits", typeof(long));

            provider.AddRow(
                response.TableMaxReadCapacityUnits,
                response.TableMaxWriteCapacityUnits,
                response.AccountMaxReadCapacityUnits,
                response.AccountMaxWriteCapacityUnits
                );

            return(new PrimarSqlDataReader(provider));
        }
Ejemplo n.º 5
0
        public override async Task <DbDataReader> ExecuteAsync(CancellationToken cancellationToken = default)
        {
            var provider         = new ListDataProvider();
            var tableDescription = await Context.GetTableDescriptionAsync(QueryInfo.TableName, cancellationToken);

            List <KeySchemaElement>    keySchema            = tableDescription.KeySchema;
            List <AttributeDefinition> attributeDefinitions = tableDescription.AttributeDefinitions;

            var hashKeyName = keySchema
                              .First(schema => schema.KeyType == KeyType.HASH)
                              .AttributeName;

            var sortKeyName = keySchema
                              .FirstOrDefault(schema => schema.KeyType == KeyType.RANGE)?
                              .AttributeName;

            var hashKeyType = attributeDefinitions
                              .First(definition => definition.AttributeName == hashKeyName)
                              .AttributeType
                              .Value;

            var sortKeyType = attributeDefinitions
                              .FirstOrDefault(definition => definition.AttributeName == sortKeyName)?
                              .AttributeType
                              .Value;

            provider.AddColumn("TableArn", typeof(string));
            provider.AddColumn("TableId", typeof(string));
            provider.AddColumn("TableName", typeof(string));
            provider.AddColumn("TableSizeBytes", typeof(long));
            provider.AddColumn("TableStatus", typeof(string));
            provider.AddColumn("LocalIndexCount", typeof(long));
            provider.AddColumn("GlobalIndexCount", typeof(long));
            provider.AddColumn("ItemCount", typeof(long));
            provider.AddColumn("CreationDateTime", typeof(DateTime));
            provider.AddColumn("HashKeyName", typeof(string));
            provider.AddColumn("HashKeyType", typeof(string));
            provider.AddColumn("SortKeyName", typeof(string));
            provider.AddColumn("SortKeyType", typeof(string));
            provider.AddColumn("BillingMode", typeof(string));
            provider.AddColumn("LastUpdateToPayPerRequestDateTime", typeof(DateTime));

            provider.AddRow(
                tableDescription.TableArn,
                tableDescription.TableId,
                tableDescription.TableName,
                tableDescription.TableSizeBytes,
                tableDescription.TableStatus.Value,
                tableDescription.LocalSecondaryIndexes.Count,
                tableDescription.GlobalSecondaryIndexes.Count,
                tableDescription.ItemCount,
                tableDescription.CreationDateTime,
                hashKeyName,
                hashKeyType,
                sortKeyName,
                sortKeyType,
                tableDescription.BillingModeSummary?.BillingMode.Value,
                tableDescription.BillingModeSummary?.LastUpdateToPayPerRequestDateTime
                );

            return(new PrimarSqlDataReader(provider));
        }