/* * Copyright 2012-2013 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. */ using System; using System.Collections.Generic; using Amazon.DynamoDBv2.DocumentModel; using Amazon.DynamoDBv2.Model; using Amazon.Runtime; namespace Amazon.DynamoDBv2.DataModel { /// /// Context interface for using the DataModel mode of DynamoDB. /// Used to interact with the service, save/load objects, etc. /// public partial interface IDynamoDBContext { #region Factory Creates /// /// Creates a strongly-typed BatchWrite object, allowing /// a batch-write operation against DynamoDB. /// /// Type of objects to write /// Empty strongly-typed BatchWrite object /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void CreateBatchWriteAsync(AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = null); /// /// Creates a strongly-typed BatchWrite object, allowing /// a batch-write operation against DynamoDB. /// /// Type of objects to write /// Config object which can be used to override that table used. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void CreateBatchWriteAsync(DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = null); #endregion #region Save async /// /// Initiates the asynchronous execution of the Save operation. /// /// Type to save as. /// Object to save. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void SaveAsync(T value, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// Initiates the asynchronous execution of the Save operation. /// /// Type to save as. /// Object to save. /// Overriding configuration. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void SaveAsync(T value, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); #endregion #region Load async /// /// Initiates the asynchronous execution of the Load operation. /// /// Type to populate. /// Hash key element of the target item. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void LoadAsync(object hashKey, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void LoadAsync(object hashKey, object rangeKey, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// Initiates the asynchronous execution of the Load operation. /// /// Type to populate. /// Hash key element of the target item. /// Overriding configuration. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void LoadAsync(object hashKey, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void LoadAsync(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// Initiates the asynchronous execution of the Load operation. /// /// Type to populate. /// Key of the target item. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void LoadAsync(T keyObject, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// Initiates the asynchronous execution of the Load operation. /// /// Type to populate. /// Key of the target item. /// Overriding configuration. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void LoadAsync(T keyObject, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); #endregion #region Delete async /// /// Initiates the asynchronous execution of the Delete operation. /// /// Type of object. /// Object to delete. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void DeleteAsync(T value, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// Initiates the asynchronous execution of the Delete operation. /// /// Type of object. /// Object to delete. /// Overriding configuration. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void DeleteAsync(T value, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// Initiates the asynchronous execution of the Delete operation. /// /// Type of object. /// Hash key element of the object to delete. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void DeleteAsync(object hashKey, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void DeleteAsync(object hashKey, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void DeleteAsync(object hashKey, object rangeKey, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); /// /// 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void DeleteAsync(object hashKey, object rangeKey, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); #endregion #region BatchGet async /// /// Initiates the asynchronous execution of the ExecuteBatchGet operation. /// /// Configured BatchGet objects /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void ExecuteBatchGetAsync(BatchGet[] batches, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); #endregion #region BatchWrite async /// /// Initiates the asynchronous execution of the ExecuteBatchWrite operation. /// /// Configured BatchWrite objects /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void ExecuteBatchWriteAsync(BatchWrite[] batches, AmazonDynamoDBCallback callback, AsyncOptions asyncOptions = null); #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. /// /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch ScanAsync(params ScanCondition[] conditions); /// /// 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); /// /// Configures an async Scan operation against DynamoDB, finding items /// that match the specified conditions. /// /// Type of object. /// Scan request object. /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch FromScanAsync(ScanOperationConfig scanConfig); /// /// 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); /// /// 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void ScanAsync(IEnumerable conditions, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void FromScanAsync(ScanOperationConfig scanConfig, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = 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. /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch QueryAsync(object hashKeyValue); /// /// 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); /// /// 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.Between, values should be two values. /// /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch QueryAsync(object hashKeyValue, QueryOperator op, params object[] values); /// /// 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.Between, 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); /// /// Configures an async Query operation against DynamoDB, finding items /// that match the specified conditions. /// /// Type of object. /// Query request object. /// AsyncSearch which can be used to retrieve DynamoDB data. AsyncSearch FromQueryAsync(QueryOperationConfig queryConfig); /// /// 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); /// /// Configures an async Query operation against DynamoDB, finding items /// that match the specified conditions. /// /// Type of object. /// Query request object. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void FromQueryAsync(QueryOperationConfig queryConfig, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void FromQueryAsync(QueryOperationConfig queryConfig, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = null); /// /// 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void QueryAsync(object hashKeyValue, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = null); /// /// 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. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void QueryAsync(object hashKeyValue, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = 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.Between, values should be two values. /// /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void QueryAsync(object hashKeyValue, QueryOperator op, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = null, params object[] values); /// /// 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.Between, values should be two values. /// /// Config object which can be used to override the table used. /// The callback that will be invoked when the asynchronous operation completes. /// An instance of AsyncOptions that specifies how the async method should be executed. void QueryAsync(object hashKeyValue, QueryOperator op, IEnumerable values, DynamoDBOperationConfig operationConfig, AmazonDynamoDBCallback> callback, AsyncOptions asyncOptions = null); #endregion } }