/* * 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 savingsplans-2019-06-28.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.SavingsPlans.Model; using Amazon.SavingsPlans.Model.Internal.MarshallTransformations; using Amazon.SavingsPlans.Internal; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Auth; using Amazon.Runtime.Internal.Transform; namespace Amazon.SavingsPlans { /// /// Implementation for accessing SavingsPlans /// /// Savings Plans are a pricing model that offer significant savings on AWS usage (for /// example, on Amazon EC2 instances). You commit to a consistent amount of usage, in /// USD per hour, for a term of 1 or 3 years, and receive a lower price for that usage. /// For more information, see the AWS /// Savings Plans User Guide. /// public partial class AmazonSavingsPlansClient : AmazonServiceClient, IAmazonSavingsPlans { private static IServiceMetadata serviceMetadata = new AmazonSavingsPlansMetadata(); #region Constructors /// /// Constructs AmazonSavingsPlansClient 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 AmazonSavingsPlansClient() : base(FallbackCredentialsFactory.GetCredentials(), new AmazonSavingsPlansConfig()) { } /// /// Constructs AmazonSavingsPlansClient 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 AmazonSavingsPlansClient(RegionEndpoint region) : base(FallbackCredentialsFactory.GetCredentials(), new AmazonSavingsPlansConfig{RegionEndpoint = region}) { } /// /// Constructs AmazonSavingsPlansClient 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 AmazonSavingsPlansClient Configuration Object public AmazonSavingsPlansClient(AmazonSavingsPlansConfig config) : base(FallbackCredentialsFactory.GetCredentials(config), config){} /// /// Constructs AmazonSavingsPlansClient with AWS Credentials /// /// AWS Credentials public AmazonSavingsPlansClient(AWSCredentials credentials) : this(credentials, new AmazonSavingsPlansConfig()) { } /// /// Constructs AmazonSavingsPlansClient with AWS Credentials /// /// AWS Credentials /// The region to connect. public AmazonSavingsPlansClient(AWSCredentials credentials, RegionEndpoint region) : this(credentials, new AmazonSavingsPlansConfig{RegionEndpoint = region}) { } /// /// Constructs AmazonSavingsPlansClient with AWS Credentials and an /// AmazonSavingsPlansClient Configuration object. /// /// AWS Credentials /// The AmazonSavingsPlansClient Configuration Object public AmazonSavingsPlansClient(AWSCredentials credentials, AmazonSavingsPlansConfig clientConfig) : base(credentials, clientConfig) { } /// /// Constructs AmazonSavingsPlansClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key public AmazonSavingsPlansClient(string awsAccessKeyId, string awsSecretAccessKey) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonSavingsPlansConfig()) { } /// /// Constructs AmazonSavingsPlansClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key /// The region to connect. public AmazonSavingsPlansClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonSavingsPlansConfig() {RegionEndpoint=region}) { } /// /// Constructs AmazonSavingsPlansClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSavingsPlansClient Configuration object. /// /// AWS Access Key ID /// AWS Secret Access Key /// The AmazonSavingsPlansClient Configuration Object public AmazonSavingsPlansClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonSavingsPlansConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, clientConfig) { } /// /// Constructs AmazonSavingsPlansClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key /// AWS Session Token public AmazonSavingsPlansClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonSavingsPlansConfig()) { } /// /// Constructs AmazonSavingsPlansClient 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 AmazonSavingsPlansClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonSavingsPlansConfig{RegionEndpoint = region}) { } /// /// Constructs AmazonSavingsPlansClient with AWS Access Key ID, AWS Secret Key and an /// AmazonSavingsPlansClient Configuration object. /// /// AWS Access Key ID /// AWS Secret Access Key /// AWS Session Token /// The AmazonSavingsPlansClient Configuration Object public AmazonSavingsPlansClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSavingsPlansConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig) { } #endregion #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 AmazonSavingsPlansEndpointResolver()); } /// /// 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 CreateSavingsPlan internal virtual CreateSavingsPlanResponse CreateSavingsPlan(CreateSavingsPlanRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = CreateSavingsPlanRequestMarshaller.Instance; options.ResponseUnmarshaller = CreateSavingsPlanResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Creates a Savings Plan. /// /// Container for the necessary parameters to execute the CreateSavingsPlan service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the CreateSavingsPlan service method, as returned by SavingsPlans. /// /// An unexpected error occurred. /// /// /// The specified resource was not found. /// /// /// A service quota has been exceeded. /// /// /// One of the input parameters is not valid. /// /// REST API Reference for CreateSavingsPlan Operation public virtual Task CreateSavingsPlanAsync(CreateSavingsPlanRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = CreateSavingsPlanRequestMarshaller.Instance; options.ResponseUnmarshaller = CreateSavingsPlanResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region DeleteQueuedSavingsPlan internal virtual DeleteQueuedSavingsPlanResponse DeleteQueuedSavingsPlan(DeleteQueuedSavingsPlanRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteQueuedSavingsPlanRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteQueuedSavingsPlanResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Deletes the queued purchase for the specified Savings Plan. /// /// Container for the necessary parameters to execute the DeleteQueuedSavingsPlan service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the DeleteQueuedSavingsPlan service method, as returned by SavingsPlans. /// /// An unexpected error occurred. /// /// /// The specified resource was not found. /// /// /// A service quota has been exceeded. /// /// /// One of the input parameters is not valid. /// /// REST API Reference for DeleteQueuedSavingsPlan Operation public virtual Task DeleteQueuedSavingsPlanAsync(DeleteQueuedSavingsPlanRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteQueuedSavingsPlanRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteQueuedSavingsPlanResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region DescribeSavingsPlanRates internal virtual DescribeSavingsPlanRatesResponse DescribeSavingsPlanRates(DescribeSavingsPlanRatesRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeSavingsPlanRatesRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeSavingsPlanRatesResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Describes the specified Savings Plans rates. /// /// Container for the necessary parameters to execute the DescribeSavingsPlanRates service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the DescribeSavingsPlanRates service method, as returned by SavingsPlans. /// /// The specified resource was not found. /// /// /// One of the input parameters is not valid. /// /// REST API Reference for DescribeSavingsPlanRates Operation public virtual Task DescribeSavingsPlanRatesAsync(DescribeSavingsPlanRatesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeSavingsPlanRatesRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeSavingsPlanRatesResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region DescribeSavingsPlans internal virtual DescribeSavingsPlansResponse DescribeSavingsPlans(DescribeSavingsPlansRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeSavingsPlansRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeSavingsPlansResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Describes the specified Savings Plans. /// /// Container for the necessary parameters to execute the DescribeSavingsPlans service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the DescribeSavingsPlans service method, as returned by SavingsPlans. /// /// An unexpected error occurred. /// /// /// One of the input parameters is not valid. /// /// REST API Reference for DescribeSavingsPlans Operation public virtual Task DescribeSavingsPlansAsync(DescribeSavingsPlansRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeSavingsPlansRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeSavingsPlansResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region DescribeSavingsPlansOfferingRates internal virtual DescribeSavingsPlansOfferingRatesResponse DescribeSavingsPlansOfferingRates(DescribeSavingsPlansOfferingRatesRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeSavingsPlansOfferingRatesRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeSavingsPlansOfferingRatesResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Describes the specified Savings Plans offering rates. /// /// Container for the necessary parameters to execute the DescribeSavingsPlansOfferingRates service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the DescribeSavingsPlansOfferingRates service method, as returned by SavingsPlans. /// /// An unexpected error occurred. /// /// /// One of the input parameters is not valid. /// /// REST API Reference for DescribeSavingsPlansOfferingRates Operation public virtual Task DescribeSavingsPlansOfferingRatesAsync(DescribeSavingsPlansOfferingRatesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeSavingsPlansOfferingRatesRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeSavingsPlansOfferingRatesResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region DescribeSavingsPlansOfferings internal virtual DescribeSavingsPlansOfferingsResponse DescribeSavingsPlansOfferings(DescribeSavingsPlansOfferingsRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeSavingsPlansOfferingsRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeSavingsPlansOfferingsResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Describes the specified Savings Plans offerings. /// /// Container for the necessary parameters to execute the DescribeSavingsPlansOfferings service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the DescribeSavingsPlansOfferings service method, as returned by SavingsPlans. /// /// An unexpected error occurred. /// /// /// One of the input parameters is not valid. /// /// REST API Reference for DescribeSavingsPlansOfferings Operation public virtual Task DescribeSavingsPlansOfferingsAsync(DescribeSavingsPlansOfferingsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeSavingsPlansOfferingsRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeSavingsPlansOfferingsResponseUnmarshaller.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 for the specified resource. /// /// 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 SavingsPlans. /// /// An unexpected error occurred. /// /// /// The specified resource was not found. /// /// /// One of the input parameters 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 TagResource internal virtual TagResourceResponse TagResource(TagResourceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = TagResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Adds the specified tags to the specified resource. /// /// 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 SavingsPlans. /// /// An unexpected error occurred. /// /// /// The specified resource was not found. /// /// /// A service quota has been exceeded. /// /// /// One of the input parameters 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 UntagResource internal virtual UntagResourceResponse UntagResource(UntagResourceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = UntagResourceRequestMarshaller.Instance; options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Removes the specified tags from the specified resource. /// /// 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 SavingsPlans. /// /// An unexpected error occurred. /// /// /// The specified resource was not found. /// /// /// One of the input parameters 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 } }