/*
* 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.
*/
/*
* Do not modify this file. This file is generated from the rbin-2021-06-15.normal.json service model.
*/
using System;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Net;
using Amazon.RecycleBin.Model;
using Amazon.RecycleBin.Model.Internal.MarshallTransformations;
using Amazon.RecycleBin.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.RecycleBin
{
///
/// Implementation for accessing RecycleBin
///
/// This is the Recycle Bin API Reference. This documentation provides descriptions
/// and syntax for each of the actions and data types in Recycle Bin.
///
///
///
/// Recycle Bin is a resource recovery feature that enables you to restore accidentally
/// deleted snapshots and EBS-backed AMIs. When using Recycle Bin, if your resources are
/// deleted, they are retained in the Recycle Bin for a time period that you specify.
///
///
///
/// You can restore a resource from the Recycle Bin at any time before its retention period
/// expires. After you restore a resource from the Recycle Bin, the resource is removed
/// from the Recycle Bin, and you can then use it in the same way you use any other resource
/// of that type in your account. If the retention period expires and the resource is
/// not restored, the resource is permanently deleted from the Recycle Bin and is no longer
/// available for recovery. For more information about Recycle Bin, see
/// Recycle Bin in the Amazon Elastic Compute Cloud User Guide.
///
///
public partial class AmazonRecycleBinClient : AmazonServiceClient, IAmazonRecycleBin
{
private static IServiceMetadata serviceMetadata = new AmazonRecycleBinMetadata();
#region Constructors
///
/// Constructs AmazonRecycleBinClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
public AmazonRecycleBinClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonRecycleBinConfig()) { }
///
/// Constructs AmazonRecycleBinClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
/// The region to connect.
public AmazonRecycleBinClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonRecycleBinConfig{RegionEndpoint = region}) { }
///
/// Constructs AmazonRecycleBinClient with the credentials loaded from the application's
/// default configuration, and if unsuccessful from the Instance Profile service on an EC2 instance.
///
/// Example App.config with credentials set.
///
/// <?xml version="1.0" encoding="utf-8" ?>
/// <configuration>
/// <appSettings>
/// <add key="AWSProfileName" value="AWS Default"/>
/// </appSettings>
/// </configuration>
///
///
///
/// The AmazonRecycleBinClient Configuration Object
public AmazonRecycleBinClient(AmazonRecycleBinConfig config)
: base(FallbackCredentialsFactory.GetCredentials(config), config){}
///
/// Constructs AmazonRecycleBinClient with AWS Credentials
///
/// AWS Credentials
public AmazonRecycleBinClient(AWSCredentials credentials)
: this(credentials, new AmazonRecycleBinConfig())
{
}
///
/// Constructs AmazonRecycleBinClient with AWS Credentials
///
/// AWS Credentials
/// The region to connect.
public AmazonRecycleBinClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonRecycleBinConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonRecycleBinClient with AWS Credentials and an
/// AmazonRecycleBinClient Configuration object.
///
/// AWS Credentials
/// The AmazonRecycleBinClient Configuration Object
public AmazonRecycleBinClient(AWSCredentials credentials, AmazonRecycleBinConfig clientConfig)
: base(credentials, clientConfig)
{
}
///
/// Constructs AmazonRecycleBinClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
public AmazonRecycleBinClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonRecycleBinConfig())
{
}
///
/// Constructs AmazonRecycleBinClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The region to connect.
public AmazonRecycleBinClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonRecycleBinConfig() {RegionEndpoint=region})
{
}
///
/// Constructs AmazonRecycleBinClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonRecycleBinClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The AmazonRecycleBinClient Configuration Object
public AmazonRecycleBinClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonRecycleBinConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
///
/// Constructs AmazonRecycleBinClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
public AmazonRecycleBinClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonRecycleBinConfig())
{
}
///
/// Constructs AmazonRecycleBinClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
/// The region to connect.
public AmazonRecycleBinClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonRecycleBinConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonRecycleBinClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonRecycleBinClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
/// The AmazonRecycleBinClient Configuration Object
public AmazonRecycleBinClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonRecycleBinConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
{
}
#endregion
#if AWS_ASYNC_ENUMERABLES_API
private IRecycleBinPaginatorFactory _paginators;
///
/// Paginators for the service
///
public IRecycleBinPaginatorFactory Paginators
{
get
{
if (this._paginators == null)
{
this._paginators = new RecycleBinPaginatorFactory(this);
}
return this._paginators;
}
}
#endif
#region Overrides
///
/// Creates the signer for the service.
///
protected override AbstractAWSSigner CreateSigner()
{
return new AWS4Signer();
}
///
/// Customizes the runtime pipeline.
///
/// Runtime pipeline for the current client.
protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
{
pipeline.RemoveHandler();
pipeline.AddHandlerAfter(new AmazonRecycleBinEndpointResolver());
}
///
/// Capture metadata for the service.
///
protected override IServiceMetadata ServiceMetadata
{
get
{
return serviceMetadata;
}
}
#endregion
#region Dispose
///
/// Disposes the service client.
///
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
#endregion
#region CreateRule
internal virtual CreateRuleResponse CreateRule(CreateRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRuleResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Creates a Recycle Bin retention rule. For more information, see
/// Create Recycle Bin retention rules in the Amazon Elastic Compute Cloud User
/// Guide.
///
/// Container for the necessary parameters to execute the CreateRule service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the CreateRule service method, as returned by RecycleBin.
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The request would cause a service quota for the number of tags per resource to be
/// exceeded.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for CreateRule Operation
public virtual Task CreateRuleAsync(CreateRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CreateRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = CreateRuleResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region DeleteRule
internal virtual DeleteRuleResponse DeleteRule(DeleteRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRuleResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Deletes a Recycle Bin retention rule. For more information, see
/// Delete Recycle Bin retention rules in the Amazon Elastic Compute Cloud User
/// Guide.
///
/// Container for the necessary parameters to execute the DeleteRule service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the DeleteRule service method, as returned by RecycleBin.
///
/// The specified retention rule lock request can't be completed.
///
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The specified resource was not found.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for DeleteRule Operation
public virtual Task DeleteRuleAsync(DeleteRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DeleteRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = DeleteRuleResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region GetRule
internal virtual GetRuleResponse GetRule(GetRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRuleResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Gets information about a Recycle Bin retention rule.
///
/// Container for the necessary parameters to execute the GetRule service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the GetRule service method, as returned by RecycleBin.
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The specified resource was not found.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for GetRule Operation
public virtual Task GetRuleAsync(GetRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = GetRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = GetRuleResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region ListRules
internal virtual ListRulesResponse ListRules(ListRulesRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRulesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Lists the Recycle Bin retention rules in the Region.
///
/// Container for the necessary parameters to execute the ListRules service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the ListRules service method, as returned by RecycleBin.
///
/// The service could not respond to the request due to an internal problem.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for ListRules Operation
public virtual Task ListRulesAsync(ListRulesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListRulesRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListRulesResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region ListTagsForResource
internal virtual ListTagsForResourceResponse ListTagsForResource(ListTagsForResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Lists the tags assigned to a retention rule.
///
/// Container for the necessary parameters to execute the ListTagsForResource service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the ListTagsForResource service method, as returned by RecycleBin.
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The specified resource was not found.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for ListTagsForResource Operation
public virtual Task ListTagsForResourceAsync(ListTagsForResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTagsForResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTagsForResourceResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region LockRule
internal virtual LockRuleResponse LockRule(LockRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = LockRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = LockRuleResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Locks a retention rule. A locked retention rule can't be modified or deleted.
///
/// Container for the necessary parameters to execute the LockRule service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the LockRule service method, as returned by RecycleBin.
///
/// The specified retention rule lock request can't be completed.
///
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The specified resource was not found.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for LockRule Operation
public virtual Task LockRuleAsync(LockRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = LockRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = LockRuleResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region TagResource
internal virtual TagResourceResponse TagResource(TagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Assigns tags to the specified retention rule.
///
/// Container for the necessary parameters to execute the TagResource service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the TagResource service method, as returned by RecycleBin.
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The specified resource was not found.
///
///
/// The request would cause a service quota for the number of tags per resource to be
/// exceeded.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for TagResource Operation
public virtual Task TagResourceAsync(TagResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region UnlockRule
internal virtual UnlockRuleResponse UnlockRule(UnlockRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UnlockRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = UnlockRuleResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Unlocks a retention rule. After a retention rule is unlocked, it can be modified or
/// deleted only after the unlock delay period expires.
///
/// Container for the necessary parameters to execute the UnlockRule service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the UnlockRule service method, as returned by RecycleBin.
///
/// The specified retention rule lock request can't be completed.
///
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The specified resource was not found.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for UnlockRule Operation
public virtual Task UnlockRuleAsync(UnlockRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UnlockRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = UnlockRuleResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region UntagResource
internal virtual UntagResourceResponse UntagResource(UntagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Unassigns a tag from a retention rule.
///
/// Container for the necessary parameters to execute the UntagResource service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the UntagResource service method, as returned by RecycleBin.
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The specified resource was not found.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for UntagResource Operation
public virtual Task UntagResourceAsync(UntagResourceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region UpdateRule
internal virtual UpdateRuleResponse UpdateRule(UpdateRuleRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRuleResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Updates an existing Recycle Bin retention rule. You can update a retention rule's
/// description, resource tags, and retention period at any time after creation. You can't
/// update a retention rule's resource type after creation. For more information, see
///
/// Update Recycle Bin retention rules in the Amazon Elastic Compute Cloud User
/// Guide.
///
/// Container for the necessary parameters to execute the UpdateRule service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the UpdateRule service method, as returned by RecycleBin.
///
/// The specified retention rule lock request can't be completed.
///
///
/// The service could not respond to the request due to an internal problem.
///
///
/// The specified resource was not found.
///
///
/// One or more of the parameters in the request is not valid.
///
/// REST API Reference for UpdateRule Operation
public virtual Task UpdateRuleAsync(UpdateRuleRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = UpdateRuleRequestMarshaller.Instance;
options.ResponseUnmarshaller = UpdateRuleResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
}
}