/*
 * 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 migrationhub-config-2019-06-30.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.MigrationHubConfig.Model;
using Amazon.MigrationHubConfig.Model.Internal.MarshallTransformations;
using Amazon.MigrationHubConfig.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.MigrationHubConfig
{
    /// 
    /// Implementation for accessing MigrationHubConfig
    ///
    /// The AWS Migration Hub home region APIs are available specifically for working with
    /// your Migration Hub home region. You can use these APIs to determine a home region,
    /// as well as to create and work with controls that describe the home region.
    /// 
    ///   -  
    /// 
    /// You must make API calls for write actions (create, notify, associate, disassociate,
    /// import, or put) while in your home region, or a 
HomeRegionNotSetException
    /// error is returned.
    /// 
    ///    -  
    /// 
    /// API calls for read actions (list, describe, stop, and delete) are permitted outside
    /// of your home region.
    /// 
    ///  
  -  
    /// 
    /// If you call a write API outside the home region, an 
InvalidInputException
    /// is returned.
    /// 
    ///    -  
    /// 
    /// You can call 
GetHomeRegion action to obtain the account's Migration Hub
    /// home region.
    /// 
    ///    
 
    /// 
    /// For specific API usage, see the sections that follow in this AWS Migration Hub Home
    /// Region API reference. 
    /// 
    /// 
    public partial class AmazonMigrationHubConfigClient : AmazonServiceClient, IAmazonMigrationHubConfig
    {
        private static IServiceMetadata serviceMetadata = new AmazonMigrationHubConfigMetadata();
        
        #region Constructors
        /// 
        /// Constructs AmazonMigrationHubConfigClient 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 AmazonMigrationHubConfigClient()
            : base(FallbackCredentialsFactory.GetCredentials(), new AmazonMigrationHubConfigConfig()) { }
        /// 
        /// Constructs AmazonMigrationHubConfigClient 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 AmazonMigrationHubConfigClient(RegionEndpoint region)
            : base(FallbackCredentialsFactory.GetCredentials(), new AmazonMigrationHubConfigConfig{RegionEndpoint = region}) { }
        /// 
        /// Constructs AmazonMigrationHubConfigClient 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 AmazonMigrationHubConfigClient Configuration Object
        public AmazonMigrationHubConfigClient(AmazonMigrationHubConfigConfig config)
            : base(FallbackCredentialsFactory.GetCredentials(config), config){}
        /// 
        /// Constructs AmazonMigrationHubConfigClient with AWS Credentials
        /// 
        /// AWS Credentials
        public AmazonMigrationHubConfigClient(AWSCredentials credentials)
            : this(credentials, new AmazonMigrationHubConfigConfig())
        {
        }
        /// 
        /// Constructs AmazonMigrationHubConfigClient with AWS Credentials
        /// 
        /// AWS Credentials
        /// The region to connect.
        public AmazonMigrationHubConfigClient(AWSCredentials credentials, RegionEndpoint region)
            : this(credentials, new AmazonMigrationHubConfigConfig{RegionEndpoint = region})
        {
        }
        /// 
        /// Constructs AmazonMigrationHubConfigClient with AWS Credentials and an
        /// AmazonMigrationHubConfigClient Configuration object.
        /// 
        /// AWS Credentials
        /// The AmazonMigrationHubConfigClient Configuration Object
        public AmazonMigrationHubConfigClient(AWSCredentials credentials, AmazonMigrationHubConfigConfig clientConfig)
            : base(credentials, clientConfig)
        {
        }
        /// 
        /// Constructs AmazonMigrationHubConfigClient with AWS Access Key ID and AWS Secret Key
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        public AmazonMigrationHubConfigClient(string awsAccessKeyId, string awsSecretAccessKey)
            : this(awsAccessKeyId, awsSecretAccessKey, new AmazonMigrationHubConfigConfig())
        {
        }
        /// 
        /// Constructs AmazonMigrationHubConfigClient with AWS Access Key ID and AWS Secret Key
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        /// The region to connect.
        public AmazonMigrationHubConfigClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
            : this(awsAccessKeyId, awsSecretAccessKey, new AmazonMigrationHubConfigConfig() {RegionEndpoint=region})
        {
        }
        /// 
        /// Constructs AmazonMigrationHubConfigClient with AWS Access Key ID, AWS Secret Key and an
        /// AmazonMigrationHubConfigClient Configuration object. 
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        /// The AmazonMigrationHubConfigClient Configuration Object
        public AmazonMigrationHubConfigClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonMigrationHubConfigConfig clientConfig)
            : base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
        {
        }
        /// 
        /// Constructs AmazonMigrationHubConfigClient with AWS Access Key ID and AWS Secret Key
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        /// AWS Session Token
        public AmazonMigrationHubConfigClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
            : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonMigrationHubConfigConfig())
        {
        }
        /// 
        /// Constructs AmazonMigrationHubConfigClient 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 AmazonMigrationHubConfigClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
            : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonMigrationHubConfigConfig{RegionEndpoint = region})
        {
        }
        /// 
        /// Constructs AmazonMigrationHubConfigClient with AWS Access Key ID, AWS Secret Key and an
        /// AmazonMigrationHubConfigClient Configuration object. 
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        /// AWS Session Token
        /// The AmazonMigrationHubConfigClient Configuration Object
        public AmazonMigrationHubConfigClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonMigrationHubConfigConfig clientConfig)
            : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
        {
        }
        #endregion
#if AWS_ASYNC_ENUMERABLES_API
        private IMigrationHubConfigPaginatorFactory _paginators;
        /// 
        /// Paginators for the service
        /// 
        public IMigrationHubConfigPaginatorFactory Paginators 
        {
            get 
            {
                if (this._paginators == null) 
                {
                    this._paginators = new MigrationHubConfigPaginatorFactory(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 AmazonMigrationHubConfigEndpointResolver());
        }
        /// 
        /// 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  CreateHomeRegionControl
        internal virtual CreateHomeRegionControlResponse CreateHomeRegionControl(CreateHomeRegionControlRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = CreateHomeRegionControlRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateHomeRegionControlResponseUnmarshaller.Instance;
            return Invoke(request, options);
        }
        /// 
        /// This API sets up the home region for the calling account only.
        /// 
        /// Container for the necessary parameters to execute the CreateHomeRegionControl service method.
        /// 
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// 
        /// 
        /// The response from the CreateHomeRegionControl service method, as returned by MigrationHubConfig.
        /// 
        /// You do not have sufficient access to perform this action.
        /// 
        /// 
        /// Exception raised to indicate that authorization of an action was successful, when
        /// the DryRun flag is set to true.
        /// 
        /// 
        /// Exception raised when an internal, configuration, or dependency error is encountered.
        /// 
        /// 
        /// Exception raised when the provided input violates a policy constraint or is entered
        /// in the wrong format or data type.
        /// 
        /// 
        /// Exception raised when a request fails due to temporary unavailability of the service.
        /// 
        /// 
        /// The request was denied due to request throttling.
        /// 
        /// REST API Reference for CreateHomeRegionControl Operation
        public virtual Task CreateHomeRegionControlAsync(CreateHomeRegionControlRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = CreateHomeRegionControlRequestMarshaller.Instance;
            options.ResponseUnmarshaller = CreateHomeRegionControlResponseUnmarshaller.Instance;
            return InvokeAsync(request, options, cancellationToken);
        }
        #endregion
        
        #region  DescribeHomeRegionControls
        internal virtual DescribeHomeRegionControlsResponse DescribeHomeRegionControls(DescribeHomeRegionControlsRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = DescribeHomeRegionControlsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DescribeHomeRegionControlsResponseUnmarshaller.Instance;
            return Invoke(request, options);
        }
        /// 
        /// This API permits filtering on the ControlId and HomeRegion
        /// fields.
        /// 
        /// Container for the necessary parameters to execute the DescribeHomeRegionControls service method.
        /// 
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// 
        /// 
        /// The response from the DescribeHomeRegionControls service method, as returned by MigrationHubConfig.
        /// 
        /// You do not have sufficient access to perform this action.
        /// 
        /// 
        /// Exception raised when an internal, configuration, or dependency error is encountered.
        /// 
        /// 
        /// Exception raised when the provided input violates a policy constraint or is entered
        /// in the wrong format or data type.
        /// 
        /// 
        /// Exception raised when a request fails due to temporary unavailability of the service.
        /// 
        /// 
        /// The request was denied due to request throttling.
        /// 
        /// REST API Reference for DescribeHomeRegionControls Operation
        public virtual Task DescribeHomeRegionControlsAsync(DescribeHomeRegionControlsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = DescribeHomeRegionControlsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = DescribeHomeRegionControlsResponseUnmarshaller.Instance;
            return InvokeAsync(request, options, cancellationToken);
        }
        #endregion
        
        #region  GetHomeRegion
        internal virtual GetHomeRegionResponse GetHomeRegion(GetHomeRegionRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = GetHomeRegionRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetHomeRegionResponseUnmarshaller.Instance;
            return Invoke(request, options);
        }
        /// 
        /// Returns the calling account’s home region, if configured. This API is used by other
        /// AWS services to determine the regional endpoint for calling AWS Application Discovery
        /// Service and Migration Hub. You must call GetHomeRegion at least once
        /// before you call any other AWS Application Discovery Service and AWS Migration Hub
        /// APIs, to obtain the account's Migration Hub home region.
        /// 
        /// Container for the necessary parameters to execute the GetHomeRegion service method.
        /// 
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// 
        /// 
        /// The response from the GetHomeRegion service method, as returned by MigrationHubConfig.
        /// 
        /// You do not have sufficient access to perform this action.
        /// 
        /// 
        /// Exception raised when an internal, configuration, or dependency error is encountered.
        /// 
        /// 
        /// Exception raised when the provided input violates a policy constraint or is entered
        /// in the wrong format or data type.
        /// 
        /// 
        /// Exception raised when a request fails due to temporary unavailability of the service.
        /// 
        /// 
        /// The request was denied due to request throttling.
        /// 
        /// REST API Reference for GetHomeRegion Operation
        public virtual Task GetHomeRegionAsync(GetHomeRegionRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = GetHomeRegionRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetHomeRegionResponseUnmarshaller.Instance;
            return InvokeAsync(request, options, cancellationToken);
        }
        #endregion
        
    }
}