/*
* 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 Amazon.DynamoDBv2.Model;
using Amazon.Runtime;
using Amazon.Util;
using System.Linq;
using System.Threading;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using Amazon.Runtime.Internal;
namespace Amazon.DynamoDBv2.DocumentModel
{
public partial class Table
{
#region PutItemAsync
///
/// Initiates the asynchronous execution of the PutItem operation.
///
///
/// Document 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.
public Task PutItemAsync(Document doc, CancellationToken cancellationToken = default(CancellationToken))
{
return PutItemHelperAsync(doc, null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the PutItem operation.
///
///
/// Document to save.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task PutItemAsync(Document doc, PutItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return PutItemHelperAsync(doc, config, cancellationToken);
}
#endregion
#region GetItemAsync
///
/// Initiates the asynchronous execution of the GetItem operation.
///
///
/// Hash key element of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task GetItemAsync(Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken))
{
return GetItemHelperAsync(MakeKey(hashKey, null), null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the GetItem operation.
///
///
/// Hash key element of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task GetItemAsync(Primitive hashKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return GetItemHelperAsync(MakeKey(hashKey, null), config, cancellationToken);
}
///
/// Initiates the asynchronous execution of the GetItem operation.
///
///
/// Hash key element of the document.
/// Range key element of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task GetItemAsync(Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken))
{
return GetItemHelperAsync(MakeKey(hashKey, rangeKey), null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the GetItem operation.
///
///
/// Hash key element of the document.
/// Range key element of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task GetItemAsync(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return GetItemHelperAsync(MakeKey(hashKey, rangeKey), config, cancellationToken);
}
///
/// Initiates the asynchronous execution of the GetItem operation.
///
///
/// Ley of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task GetItemAsync(IDictionary key, CancellationToken cancellationToken = default(CancellationToken))
{
return GetItemHelperAsync(MakeKey(key), null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the GetItem operation.
///
///
/// Ley of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task GetItemAsync(IDictionary key, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return GetItemHelperAsync(MakeKey(key), config, cancellationToken);
}
#endregion
#region UpdateItemAsync
///
/// Initiates the asynchronous execution of the UpdateItem operation.
///
///
/// Attributes to update.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task UpdateItemAsync(Document doc, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateHelperAsync(doc, null, null, null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the UpdateItem operation.
///
///
/// Attributes to update.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task UpdateItemAsync(Document doc, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateHelperAsync(doc, null, null, config, cancellationToken);
}
///
/// Initiates the asynchronous execution of the UpdateItem operation.
///
///
/// Attributes to update.
/// Key of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task UpdateItemAsync(Document doc, IDictionary key, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateHelperAsync(doc, MakeKey(key), null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the UpdateItem operation.
///
///
/// Attributes to update.
/// Key of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task UpdateItemAsync(Document doc, IDictionary key, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateHelperAsync(doc, MakeKey(key), config, cancellationToken);
}
///
/// Initiates the asynchronous execution of the UpdateItem operation.
///
///
/// Attributes to update.
/// Hash key element of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task UpdateItemAsync(Document doc, Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateHelperAsync(doc, hashKey, null, null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the UpdateItem operation.
///
///
/// Attributes to update.
/// Hash key element of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task UpdateItemAsync(Document doc, Primitive hashKey, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateHelperAsync(doc, hashKey, null, config, cancellationToken);
}
///
/// Initiates the asynchronous execution of the UpdateItem operation.
///
///
/// Attributes to update.
/// Hash key element of the document.
/// Range key element of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateHelperAsync(doc, hashKey, rangeKey, null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the UpdateItem operation.
///
///
/// Attributes to update.
/// Hash key element of the document.
/// Range key element of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return UpdateHelperAsync(doc, hashKey, rangeKey, config, cancellationToken);
}
#endregion
#region DeleteItemAsync
///
/// Initiates the asynchronous execution of the DeleteItem operation.
///
///
/// Document 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.
public Task DeleteItemAsync(Document document, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteHelperAsync(MakeKey(document), null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the DeleteItem operation.
///
///
/// Document to delete.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task DeleteItemAsync(Document document, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteHelperAsync(MakeKey(document), config, cancellationToken);
}
///
/// Initiates the asynchronous execution of the DeleteItem operation.
///
///
/// Hash key element of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task DeleteItemAsync(Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteHelperAsync(MakeKey(hashKey, null), null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the DeleteItem operation.
///
///
/// Hash key element of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task DeleteItemAsync(Primitive hashKey, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteHelperAsync(MakeKey(hashKey, null), config, cancellationToken);
}
///
/// Initiates the asynchronous execution of the DeleteItem operation.
///
///
/// Hash key element of the document.
/// Range key element of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task DeleteItemAsync(Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteHelperAsync(MakeKey(hashKey, rangeKey), null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the DeleteItem operation.
///
///
/// Hash key element of the document.
/// Range key element of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task DeleteItemAsync(Primitive hashKey, Primitive rangeKey, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteHelperAsync(MakeKey(hashKey, rangeKey), config, cancellationToken);
}
///
/// Initiates the asynchronous execution of the DeleteItem operation.
///
///
/// Key of the document.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task DeleteItemAsync(IDictionary key, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteHelperAsync(MakeKey(key), null, cancellationToken);
}
///
/// Initiates the asynchronous execution of the DeleteItem operation.
///
///
/// Key of the document.
/// Configuration to use.
/// Token which can be used to cancel the task.
/// A Task that can be used to poll or wait for results, or both.
public Task DeleteItemAsync(IDictionary key, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken))
{
return DeleteHelperAsync(MakeKey(key), config, cancellationToken);
}
#endregion
}
}