/*
 * 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 sagemaker-edge-2020-09-23.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.SagemakerEdgeManager.Model;
using Amazon.SagemakerEdgeManager.Model.Internal.MarshallTransformations;
using Amazon.SagemakerEdgeManager.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.SagemakerEdgeManager
{
    /// 
    /// Implementation for accessing SagemakerEdgeManager
    ///
    /// SageMaker Edge Manager dataplane service for communicating with active agents.
    /// 
    public partial class AmazonSagemakerEdgeManagerClient : AmazonServiceClient, IAmazonSagemakerEdgeManager
    {
        private static IServiceMetadata serviceMetadata = new AmazonSagemakerEdgeManagerMetadata();
        #region Constructors
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient 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 AmazonSagemakerEdgeManagerClient()
            : base(FallbackCredentialsFactory.GetCredentials(), new AmazonSagemakerEdgeManagerConfig()) { }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient 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 AmazonSagemakerEdgeManagerClient(RegionEndpoint region)
            : base(FallbackCredentialsFactory.GetCredentials(), new AmazonSagemakerEdgeManagerConfig{RegionEndpoint = region}) { }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient 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 AmazonSagemakerEdgeManagerClient Configuration Object
        public AmazonSagemakerEdgeManagerClient(AmazonSagemakerEdgeManagerConfig config)
            : base(FallbackCredentialsFactory.GetCredentials(config), config){}
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient with AWS Credentials
        /// 
        /// AWS Credentials
        public AmazonSagemakerEdgeManagerClient(AWSCredentials credentials)
            : this(credentials, new AmazonSagemakerEdgeManagerConfig())
        {
        }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient with AWS Credentials
        /// 
        /// AWS Credentials
        /// The region to connect.
        public AmazonSagemakerEdgeManagerClient(AWSCredentials credentials, RegionEndpoint region)
            : this(credentials, new AmazonSagemakerEdgeManagerConfig{RegionEndpoint = region})
        {
        }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient with AWS Credentials and an
        /// AmazonSagemakerEdgeManagerClient Configuration object.
        /// 
        /// AWS Credentials
        /// The AmazonSagemakerEdgeManagerClient Configuration Object
        public AmazonSagemakerEdgeManagerClient(AWSCredentials credentials, AmazonSagemakerEdgeManagerConfig clientConfig)
            : base(credentials, clientConfig)
        {
        }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient with AWS Access Key ID and AWS Secret Key
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        public AmazonSagemakerEdgeManagerClient(string awsAccessKeyId, string awsSecretAccessKey)
            : this(awsAccessKeyId, awsSecretAccessKey, new AmazonSagemakerEdgeManagerConfig())
        {
        }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient with AWS Access Key ID and AWS Secret Key
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        /// The region to connect.
        public AmazonSagemakerEdgeManagerClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
            : this(awsAccessKeyId, awsSecretAccessKey, new AmazonSagemakerEdgeManagerConfig() {RegionEndpoint=region})
        {
        }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient with AWS Access Key ID, AWS Secret Key and an
        /// AmazonSagemakerEdgeManagerClient Configuration object. 
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        /// The AmazonSagemakerEdgeManagerClient Configuration Object
        public AmazonSagemakerEdgeManagerClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonSagemakerEdgeManagerConfig clientConfig)
            : base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
        {
        }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient with AWS Access Key ID and AWS Secret Key
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        /// AWS Session Token
        public AmazonSagemakerEdgeManagerClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
            : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonSagemakerEdgeManagerConfig())
        {
        }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient 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 AmazonSagemakerEdgeManagerClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
            : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonSagemakerEdgeManagerConfig{RegionEndpoint = region})
        {
        }
        /// 
        /// Constructs AmazonSagemakerEdgeManagerClient with AWS Access Key ID, AWS Secret Key and an
        /// AmazonSagemakerEdgeManagerClient Configuration object. 
        /// 
        /// AWS Access Key ID
        /// AWS Secret Access Key
        /// AWS Session Token
        /// The AmazonSagemakerEdgeManagerClient Configuration Object
        public AmazonSagemakerEdgeManagerClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonSagemakerEdgeManagerConfig clientConfig)
            : base(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, clientConfig)
        {
        }
        #endregion
        #region Overrides
        /// 
        /// Creates the signer for the service.
        /// 
        protected override AbstractAWSSigner CreateSigner()
        {
            return new AWS4Signer();
        }    
        /// 
        /// Customize the pipeline
        /// 
        /// 
        protected override void CustomizeRuntimePipeline(RuntimePipeline pipeline)
        {
            pipeline.RemoveHandler();
            pipeline.AddHandlerAfter(new AmazonSagemakerEdgeManagerEndpointResolver());
        }    
        /// 
        /// 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  GetDeployments
        /// 
        /// Use to get the active deployments from a device.
        /// 
        /// Container for the necessary parameters to execute the GetDeployments service method.
        /// 
        /// The response from the GetDeployments service method, as returned by SagemakerEdgeManager.
        /// 
        /// An internal failure occurred. Try your request again. If the problem persists, contact
        /// Amazon Web Services customer support.
        /// 
        /// REST API Reference for GetDeployments Operation
        public virtual GetDeploymentsResponse GetDeployments(GetDeploymentsRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = GetDeploymentsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetDeploymentsResponseUnmarshaller.Instance;
            return Invoke(request, options);
        }
        /// 
        /// Use to get the active deployments from a device.
        /// 
        /// Container for the necessary parameters to execute the GetDeployments service method.
        /// 
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// 
        /// 
        /// The response from the GetDeployments service method, as returned by SagemakerEdgeManager.
        /// 
        /// An internal failure occurred. Try your request again. If the problem persists, contact
        /// Amazon Web Services customer support.
        /// 
        /// REST API Reference for GetDeployments Operation
        public virtual Task GetDeploymentsAsync(GetDeploymentsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = GetDeploymentsRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetDeploymentsResponseUnmarshaller.Instance;
            
            return InvokeAsync(request, options, cancellationToken);
        }
        #endregion
        
        #region  GetDeviceRegistration
        /// 
        /// Use to check if a device is registered with SageMaker Edge Manager.
        /// 
        /// Container for the necessary parameters to execute the GetDeviceRegistration service method.
        /// 
        /// The response from the GetDeviceRegistration service method, as returned by SagemakerEdgeManager.
        /// 
        /// An internal failure occurred. Try your request again. If the problem persists, contact
        /// Amazon Web Services customer support.
        /// 
        /// REST API Reference for GetDeviceRegistration Operation
        public virtual GetDeviceRegistrationResponse GetDeviceRegistration(GetDeviceRegistrationRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = GetDeviceRegistrationRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetDeviceRegistrationResponseUnmarshaller.Instance;
            return Invoke(request, options);
        }
        /// 
        /// Use to check if a device is registered with SageMaker Edge Manager.
        /// 
        /// Container for the necessary parameters to execute the GetDeviceRegistration service method.
        /// 
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// 
        /// 
        /// The response from the GetDeviceRegistration service method, as returned by SagemakerEdgeManager.
        /// 
        /// An internal failure occurred. Try your request again. If the problem persists, contact
        /// Amazon Web Services customer support.
        /// 
        /// REST API Reference for GetDeviceRegistration Operation
        public virtual Task GetDeviceRegistrationAsync(GetDeviceRegistrationRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = GetDeviceRegistrationRequestMarshaller.Instance;
            options.ResponseUnmarshaller = GetDeviceRegistrationResponseUnmarshaller.Instance;
            
            return InvokeAsync(request, options, cancellationToken);
        }
        #endregion
        
        #region  SendHeartbeat
        /// 
        /// Use to get the current status of devices registered on SageMaker Edge Manager.
        /// 
        /// Container for the necessary parameters to execute the SendHeartbeat service method.
        /// 
        /// The response from the SendHeartbeat service method, as returned by SagemakerEdgeManager.
        /// 
        /// An internal failure occurred. Try your request again. If the problem persists, contact
        /// Amazon Web Services customer support.
        /// 
        /// REST API Reference for SendHeartbeat Operation
        public virtual SendHeartbeatResponse SendHeartbeat(SendHeartbeatRequest request)
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = SendHeartbeatRequestMarshaller.Instance;
            options.ResponseUnmarshaller = SendHeartbeatResponseUnmarshaller.Instance;
            return Invoke(request, options);
        }
        /// 
        /// Use to get the current status of devices registered on SageMaker Edge Manager.
        /// 
        /// Container for the necessary parameters to execute the SendHeartbeat service method.
        /// 
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// 
        /// 
        /// The response from the SendHeartbeat service method, as returned by SagemakerEdgeManager.
        /// 
        /// An internal failure occurred. Try your request again. If the problem persists, contact
        /// Amazon Web Services customer support.
        /// 
        /// REST API Reference for SendHeartbeat Operation
        public virtual Task SendHeartbeatAsync(SendHeartbeatRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var options = new InvokeOptions();
            options.RequestMarshaller = SendHeartbeatRequestMarshaller.Instance;
            options.ResponseUnmarshaller = SendHeartbeatResponseUnmarshaller.Instance;
            
            return InvokeAsync(request, options, cancellationToken);
        }
        #endregion
        
    }
}