/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #pragma warning disable 1574 using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Amazon.DynamoDBv2.DocumentModel; using Amazon.DynamoDBv2.Model; namespace Amazon.DynamoDBv2.DataModel { /// /// Context interface for using the DataModel mode of DynamoDB. /// Used to interact with the service, save/load objects, etc. /// partial interface IDynamoDBContext { #region Save async /// /// Initiates the asynchronous execution of the Save operation. /// /// /// Type to save as. /// Object to save. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task SaveAsync(T value, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Save operation. /// /// /// Type to save as. /// Object to save. /// Overriding configuration. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task SaveAsync(T value, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Save operation. /// /// /// Type of the Object to save. /// Object to save. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task SaveAsync(Type valueType, object value, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Save operation. /// /// /// Type of the Object to save. /// Object to save. /// Overriding configuration. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task SaveAsync(Type valueType, object value, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region Load async /// /// Initiates the asynchronous execution of the Load operation. /// /// /// Type to populate. /// Hash key element of the target item. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task LoadAsync(object hashKey, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Load operation. /// /// /// Type to populate. /// Hash key element of the target item. /// Overriding configuration. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task LoadAsync(object hashKey, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Load operation. /// /// /// Type to populate. /// Hash key element of the target item. /// Range key element of the target item. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task LoadAsync(object hashKey, object rangeKey, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Load operation. /// /// /// Type to populate. /// Hash key element of the target item. /// Range key element of the target item. /// Overriding configuration. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task LoadAsync(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Load operation. /// /// /// Type to populate. /// Key of the target item. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task LoadAsync(T keyObject, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Load operation. /// /// /// Type to populate. /// Key of the target item. /// Overriding configuration. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task LoadAsync(T keyObject, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region Delete async /// /// Initiates the asynchronous execution of the Delete operation. /// /// /// Type of object. /// Object to delete. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task DeleteAsync(T value, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Delete operation. /// /// /// Type of object. /// Object to delete. /// Overriding configuration. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task DeleteAsync(T value, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Delete operation. /// /// /// Type of object. /// Hash key element of the object to delete. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task DeleteAsync(object hashKey, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Delete operation. /// /// /// Type of object. /// Hash key element of the object to delete. /// Config object which can be used to override that table used. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task DeleteAsync(object hashKey, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Delete operation. /// /// /// Type of object. /// Hash key element of the object to delete. /// Range key element of the object to delete. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task DeleteAsync(object hashKey, object rangeKey, CancellationToken cancellationToken = default(CancellationToken)); /// /// Initiates the asynchronous execution of the Delete operation. /// /// /// Type of object. /// Hash key element of the object to delete. /// Range key element of the object to delete. /// Config object which can be used to override that table used. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task DeleteAsync(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region BatchGet async /// /// Issues a batch-get request with multiple batches. /// /// Results are stored in the individual batches. /// /// /// Configured BatchGet objects /// /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task ExecuteBatchGetAsync(BatchGet[] batches, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region BatchWrite async /// /// Issues a batch-write request with multiple batches. /// /// /// Configured BatchWrite objects /// /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task ExecuteBatchWriteAsync(BatchWrite[] batches, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region TransactGet async /// /// Issues a transactional get request with multiple TransactGet objects. /// Results are stored in the individual TransactGet objects. /// /// Configured TransactGet objects. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task ExecuteTransactGetAsync(TransactGet[] transactionParts, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region TransactWrite async /// /// Issues a transactional write request with multiple TransactWrite objects. /// /// Configured TransactWrite objects. /// Token which can be used to cancel the task. /// A Task that can be used to poll or wait for results, or both. Task ExecuteTransactWriteAsync(TransactWrite[] transactionParts, CancellationToken cancellationToken = default(CancellationToken)); #endregion #region Scan async /// /// Configures an async Scan operation against DynamoDB, finding items /// that match the specified conditions. /// /// Type of object. /// /// Conditions that the results should meet. /// /// Config object which can be used to override that table used. /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch ScanAsync(IEnumerable conditions, DynamoDBOperationConfig operationConfig = null); /// /// Configures an async Scan operation against DynamoDB, finding items /// that match the specified conditions. /// /// Type of object. /// Scan request object. /// Config object which can be used to override the table used. /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch FromScanAsync(ScanOperationConfig scanConfig, DynamoDBOperationConfig operationConfig = null); #endregion #region Query async /// /// Configures an async Query operation against DynamoDB, finding items /// that match the specified hash primary key. /// /// Type of object. /// Hash key of the items to query. /// Config object which can be used to override the table used. /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch QueryAsync(object hashKeyValue, DynamoDBOperationConfig operationConfig = null); /// /// Configures an async Query operation against DynamoDB, finding items /// that match the specified range element condition for a hash-and-range primary key. /// /// Type of object. /// Hash key of the items to query. /// Operation of the condition. /// /// Value(s) of the condition. /// For all operations except QueryOperator.Between, values should be one value. /// For QueryOperator.Betwee, values should be two values. /// /// Config object which can be used to override the table used. /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch QueryAsync(object hashKeyValue, QueryOperator op, IEnumerable values, DynamoDBOperationConfig operationConfig = null); /// /// Configures an async Query operation against DynamoDB, finding items /// that match the specified conditions. /// /// Type of object. /// Query request object. /// Config object which can be used to override the table used. /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch FromQueryAsync(QueryOperationConfig queryConfig, DynamoDBOperationConfig operationConfig = null); #endregion } }