/*
* 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 iotsecuretunneling-2018-10-05.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.IoTSecureTunneling.Model;
using Amazon.IoTSecureTunneling.Model.Internal.MarshallTransformations;
using Amazon.IoTSecureTunneling.Internal;
using Amazon.Runtime;
using Amazon.Runtime.Internal;
using Amazon.Runtime.Internal.Auth;
using Amazon.Runtime.Internal.Transform;
namespace Amazon.IoTSecureTunneling
{
///
/// Implementation for accessing IoTSecureTunneling
///
/// IoT Secure Tunneling
///
/// IoT Secure Tunneling creates remote connections to devices deployed in the field.
///
///
///
/// For more information about how IoT Secure Tunneling works, see IoT
/// Secure Tunneling.
///
///
public partial class AmazonIoTSecureTunnelingClient : AmazonServiceClient, IAmazonIoTSecureTunneling
{
private static IServiceMetadata serviceMetadata = new AmazonIoTSecureTunnelingMetadata();
private IIoTSecureTunnelingPaginatorFactory _paginators;
///
/// Paginators for the service
///
public IIoTSecureTunnelingPaginatorFactory Paginators
{
get
{
if (this._paginators == null)
{
this._paginators = new IoTSecureTunnelingPaginatorFactory(this);
}
return this._paginators;
}
}
#region Constructors
///
/// Constructs AmazonIoTSecureTunnelingClient 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 AmazonIoTSecureTunnelingClient()
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonIoTSecureTunnelingConfig()) { }
///
/// Constructs AmazonIoTSecureTunnelingClient 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 AmazonIoTSecureTunnelingClient(RegionEndpoint region)
: base(FallbackCredentialsFactory.GetCredentials(), new AmazonIoTSecureTunnelingConfig{RegionEndpoint = region}) { }
///
/// Constructs AmazonIoTSecureTunnelingClient 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 AmazonIoTSecureTunnelingClient Configuration Object
public AmazonIoTSecureTunnelingClient(AmazonIoTSecureTunnelingConfig config)
: base(FallbackCredentialsFactory.GetCredentials(config), config){}
///
/// Constructs AmazonIoTSecureTunnelingClient with AWS Credentials
///
/// AWS Credentials
public AmazonIoTSecureTunnelingClient(AWSCredentials credentials)
: this(credentials, new AmazonIoTSecureTunnelingConfig())
{
}
///
/// Constructs AmazonIoTSecureTunnelingClient with AWS Credentials
///
/// AWS Credentials
/// The region to connect.
public AmazonIoTSecureTunnelingClient(AWSCredentials credentials, RegionEndpoint region)
: this(credentials, new AmazonIoTSecureTunnelingConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonIoTSecureTunnelingClient with AWS Credentials and an
/// AmazonIoTSecureTunnelingClient Configuration object.
///
/// AWS Credentials
/// The AmazonIoTSecureTunnelingClient Configuration Object
public AmazonIoTSecureTunnelingClient(AWSCredentials credentials, AmazonIoTSecureTunnelingConfig clientConfig)
: base(credentials, clientConfig)
{
}
///
/// Constructs AmazonIoTSecureTunnelingClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
public AmazonIoTSecureTunnelingClient(string awsAccessKeyId, string awsSecretAccessKey)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonIoTSecureTunnelingConfig())
{
}
///
/// Constructs AmazonIoTSecureTunnelingClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The region to connect.
public AmazonIoTSecureTunnelingClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, new AmazonIoTSecureTunnelingConfig() {RegionEndpoint=region})
{
}
///
/// Constructs AmazonIoTSecureTunnelingClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonIoTSecureTunnelingClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// The AmazonIoTSecureTunnelingClient Configuration Object
public AmazonIoTSecureTunnelingClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonIoTSecureTunnelingConfig clientConfig)
: base(awsAccessKeyId, awsSecretAccessKey, clientConfig)
{
}
///
/// Constructs AmazonIoTSecureTunnelingClient with AWS Access Key ID and AWS Secret Key
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
public AmazonIoTSecureTunnelingClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonIoTSecureTunnelingConfig())
{
}
///
/// Constructs AmazonIoTSecureTunnelingClient 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 AmazonIoTSecureTunnelingClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region)
: this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonIoTSecureTunnelingConfig{RegionEndpoint = region})
{
}
///
/// Constructs AmazonIoTSecureTunnelingClient with AWS Access Key ID, AWS Secret Key and an
/// AmazonIoTSecureTunnelingClient Configuration object.
///
/// AWS Access Key ID
/// AWS Secret Access Key
/// AWS Session Token
/// The AmazonIoTSecureTunnelingClient Configuration Object
public AmazonIoTSecureTunnelingClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonIoTSecureTunnelingConfig 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 AmazonIoTSecureTunnelingEndpointResolver());
}
///
/// 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 CloseTunnel
///
/// Closes a tunnel identified by the unique tunnel id. When a CloseTunnel
/// request is received, we close the WebSocket connections between the client and proxy
/// server so no data can be transmitted.
///
///
///
/// Requires permission to access the CloseTunnel
/// action.
///
///
/// Container for the necessary parameters to execute the CloseTunnel service method.
///
/// The response from the CloseTunnel service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for CloseTunnel Operation
public virtual CloseTunnelResponse CloseTunnel(CloseTunnelRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = CloseTunnelRequestMarshaller.Instance;
options.ResponseUnmarshaller = CloseTunnelResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Closes a tunnel identified by the unique tunnel id. When a CloseTunnel
/// request is received, we close the WebSocket connections between the client and proxy
/// server so no data can be transmitted.
///
///
///
/// Requires permission to access the CloseTunnel
/// action.
///
///
/// Container for the necessary parameters to execute the CloseTunnel service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the CloseTunnel service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for CloseTunnel Operation
public virtual Task CloseTunnelAsync(CloseTunnelRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = CloseTunnelRequestMarshaller.Instance;
options.ResponseUnmarshaller = CloseTunnelResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region DescribeTunnel
///
/// Gets information about a tunnel identified by the unique tunnel id.
///
///
///
/// Requires permission to access the DescribeTunnel
/// action.
///
///
/// Container for the necessary parameters to execute the DescribeTunnel service method.
///
/// The response from the DescribeTunnel service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for DescribeTunnel Operation
public virtual DescribeTunnelResponse DescribeTunnel(DescribeTunnelRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeTunnelRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeTunnelResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Gets information about a tunnel identified by the unique tunnel id.
///
///
///
/// Requires permission to access the DescribeTunnel
/// action.
///
///
/// Container for the necessary parameters to execute the DescribeTunnel service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the DescribeTunnel service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for DescribeTunnel Operation
public virtual Task DescribeTunnelAsync(DescribeTunnelRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = DescribeTunnelRequestMarshaller.Instance;
options.ResponseUnmarshaller = DescribeTunnelResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region ListTagsForResource
///
/// Lists the tags for the specified resource.
///
/// Container for the necessary parameters to execute the ListTagsForResource service method.
///
/// The response from the ListTagsForResource service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for ListTagsForResource Operation
public 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 IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// 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 ListTunnels
///
/// List all tunnels for an Amazon Web Services account. Tunnels are listed by creation
/// time in descending order, newer tunnels will be listed before older tunnels.
///
///
///
/// Requires permission to access the ListTunnels
/// action.
///
///
/// Container for the necessary parameters to execute the ListTunnels service method.
///
/// The response from the ListTunnels service method, as returned by IoTSecureTunneling.
/// REST API Reference for ListTunnels Operation
public virtual ListTunnelsResponse ListTunnels(ListTunnelsRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTunnelsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTunnelsResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// List all tunnels for an Amazon Web Services account. Tunnels are listed by creation
/// time in descending order, newer tunnels will be listed before older tunnels.
///
///
///
/// Requires permission to access the ListTunnels
/// action.
///
///
/// Container for the necessary parameters to execute the ListTunnels service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the ListTunnels service method, as returned by IoTSecureTunneling.
/// REST API Reference for ListTunnels Operation
public virtual Task ListTunnelsAsync(ListTunnelsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = ListTunnelsRequestMarshaller.Instance;
options.ResponseUnmarshaller = ListTunnelsResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region OpenTunnel
///
/// Creates a new tunnel, and returns two client access tokens for clients to use to connect
/// to the IoT Secure Tunneling proxy server.
///
///
///
/// Requires permission to access the OpenTunnel
/// action.
///
///
/// Container for the necessary parameters to execute the OpenTunnel service method.
///
/// The response from the OpenTunnel service method, as returned by IoTSecureTunneling.
///
/// Thrown when a tunnel limit is exceeded.
///
/// REST API Reference for OpenTunnel Operation
public virtual OpenTunnelResponse OpenTunnel(OpenTunnelRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = OpenTunnelRequestMarshaller.Instance;
options.ResponseUnmarshaller = OpenTunnelResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Creates a new tunnel, and returns two client access tokens for clients to use to connect
/// to the IoT Secure Tunneling proxy server.
///
///
///
/// Requires permission to access the OpenTunnel
/// action.
///
///
/// Container for the necessary parameters to execute the OpenTunnel service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the OpenTunnel service method, as returned by IoTSecureTunneling.
///
/// Thrown when a tunnel limit is exceeded.
///
/// REST API Reference for OpenTunnel Operation
public virtual Task OpenTunnelAsync(OpenTunnelRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = OpenTunnelRequestMarshaller.Instance;
options.ResponseUnmarshaller = OpenTunnelResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region RotateTunnelAccessToken
///
/// Revokes the current client access token (CAT) and returns new CAT for clients to use
/// when reconnecting to secure tunneling to access the same tunnel.
///
///
///
/// Requires permission to access the RotateTunnelAccessToken
/// action.
///
///
///
/// Rotating the CAT doesn't extend the tunnel duration. For example, say the tunnel duration
/// is 12 hours and the tunnel has already been open for 4 hours. When you rotate the
/// access tokens, the new tokens that are generated can only be used for the remaining
/// 8 hours.
///
///
///
/// Container for the necessary parameters to execute the RotateTunnelAccessToken service method.
///
/// The response from the RotateTunnelAccessToken service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for RotateTunnelAccessToken Operation
public virtual RotateTunnelAccessTokenResponse RotateTunnelAccessToken(RotateTunnelAccessTokenRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = RotateTunnelAccessTokenRequestMarshaller.Instance;
options.ResponseUnmarshaller = RotateTunnelAccessTokenResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Revokes the current client access token (CAT) and returns new CAT for clients to use
/// when reconnecting to secure tunneling to access the same tunnel.
///
///
///
/// Requires permission to access the RotateTunnelAccessToken
/// action.
///
///
///
/// Rotating the CAT doesn't extend the tunnel duration. For example, say the tunnel duration
/// is 12 hours and the tunnel has already been open for 4 hours. When you rotate the
/// access tokens, the new tokens that are generated can only be used for the remaining
/// 8 hours.
///
///
///
/// Container for the necessary parameters to execute the RotateTunnelAccessToken service method.
///
/// A cancellation token that can be used by other objects or threads to receive notice of cancellation.
///
///
/// The response from the RotateTunnelAccessToken service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for RotateTunnelAccessToken Operation
public virtual Task RotateTunnelAccessTokenAsync(RotateTunnelAccessTokenRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
{
var options = new InvokeOptions();
options.RequestMarshaller = RotateTunnelAccessTokenRequestMarshaller.Instance;
options.ResponseUnmarshaller = RotateTunnelAccessTokenResponseUnmarshaller.Instance;
return InvokeAsync(request, options, cancellationToken);
}
#endregion
#region TagResource
///
/// A resource tag.
///
/// Container for the necessary parameters to execute the TagResource service method.
///
/// The response from the TagResource service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for TagResource Operation
public virtual TagResourceResponse TagResource(TagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = TagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = TagResourceResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// A resource tag.
///
/// 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 IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// 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
///
/// Removes a tag from a resource.
///
/// Container for the necessary parameters to execute the UntagResource service method.
///
/// The response from the UntagResource service method, as returned by IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// REST API Reference for UntagResource Operation
public virtual UntagResourceResponse UntagResource(UntagResourceRequest request)
{
var options = new InvokeOptions();
options.RequestMarshaller = UntagResourceRequestMarshaller.Instance;
options.ResponseUnmarshaller = UntagResourceResponseUnmarshaller.Instance;
return Invoke(request, options);
}
///
/// Removes a tag from a 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 IoTSecureTunneling.
///
/// Thrown when an operation is attempted on a resource that does not exist.
///
/// 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
}
}