/* * 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 iot1click-devices-2018-05-14.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.IoT1ClickDevicesService.Model; using Amazon.IoT1ClickDevicesService.Model.Internal.MarshallTransformations; using Amazon.IoT1ClickDevicesService.Internal; using Amazon.Runtime; using Amazon.Runtime.Internal; using Amazon.Runtime.Internal.Auth; using Amazon.Runtime.Internal.Transform; namespace Amazon.IoT1ClickDevicesService { /// /// Implementation for accessing IoT1ClickDevicesService /// /// Describes all of the AWS IoT 1-Click device-related API operations for the service. /// Also provides sample requests, responses, and errors for the supported web services /// protocols. /// public partial class AmazonIoT1ClickDevicesServiceClient : AmazonServiceClient, IAmazonIoT1ClickDevicesService { private static IServiceMetadata serviceMetadata = new AmazonIoT1ClickDevicesServiceMetadata(); #region Constructors /// /// Constructs AmazonIoT1ClickDevicesServiceClient 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 AmazonIoT1ClickDevicesServiceClient() : base(FallbackCredentialsFactory.GetCredentials(), new AmazonIoT1ClickDevicesServiceConfig()) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient 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 AmazonIoT1ClickDevicesServiceClient(RegionEndpoint region) : base(FallbackCredentialsFactory.GetCredentials(), new AmazonIoT1ClickDevicesServiceConfig{RegionEndpoint = region}) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient 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 AmazonIoT1ClickDevicesServiceClient Configuration Object public AmazonIoT1ClickDevicesServiceClient(AmazonIoT1ClickDevicesServiceConfig config) : base(FallbackCredentialsFactory.GetCredentials(config), config){} /// /// Constructs AmazonIoT1ClickDevicesServiceClient with AWS Credentials /// /// AWS Credentials public AmazonIoT1ClickDevicesServiceClient(AWSCredentials credentials) : this(credentials, new AmazonIoT1ClickDevicesServiceConfig()) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient with AWS Credentials /// /// AWS Credentials /// The region to connect. public AmazonIoT1ClickDevicesServiceClient(AWSCredentials credentials, RegionEndpoint region) : this(credentials, new AmazonIoT1ClickDevicesServiceConfig{RegionEndpoint = region}) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient with AWS Credentials and an /// AmazonIoT1ClickDevicesServiceClient Configuration object. /// /// AWS Credentials /// The AmazonIoT1ClickDevicesServiceClient Configuration Object public AmazonIoT1ClickDevicesServiceClient(AWSCredentials credentials, AmazonIoT1ClickDevicesServiceConfig clientConfig) : base(credentials, clientConfig) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key public AmazonIoT1ClickDevicesServiceClient(string awsAccessKeyId, string awsSecretAccessKey) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonIoT1ClickDevicesServiceConfig()) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key /// The region to connect. public AmazonIoT1ClickDevicesServiceClient(string awsAccessKeyId, string awsSecretAccessKey, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, new AmazonIoT1ClickDevicesServiceConfig() {RegionEndpoint=region}) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient with AWS Access Key ID, AWS Secret Key and an /// AmazonIoT1ClickDevicesServiceClient Configuration object. /// /// AWS Access Key ID /// AWS Secret Access Key /// The AmazonIoT1ClickDevicesServiceClient Configuration Object public AmazonIoT1ClickDevicesServiceClient(string awsAccessKeyId, string awsSecretAccessKey, AmazonIoT1ClickDevicesServiceConfig clientConfig) : base(awsAccessKeyId, awsSecretAccessKey, clientConfig) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient with AWS Access Key ID and AWS Secret Key /// /// AWS Access Key ID /// AWS Secret Access Key /// AWS Session Token public AmazonIoT1ClickDevicesServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonIoT1ClickDevicesServiceConfig()) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient 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 AmazonIoT1ClickDevicesServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, RegionEndpoint region) : this(awsAccessKeyId, awsSecretAccessKey, awsSessionToken, new AmazonIoT1ClickDevicesServiceConfig{RegionEndpoint = region}) { } /// /// Constructs AmazonIoT1ClickDevicesServiceClient with AWS Access Key ID, AWS Secret Key and an /// AmazonIoT1ClickDevicesServiceClient Configuration object. /// /// AWS Access Key ID /// AWS Secret Access Key /// AWS Session Token /// The AmazonIoT1ClickDevicesServiceClient Configuration Object public AmazonIoT1ClickDevicesServiceClient(string awsAccessKeyId, string awsSecretAccessKey, string awsSessionToken, AmazonIoT1ClickDevicesServiceConfig 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 AmazonIoT1ClickDevicesServiceEndpointResolver()); } /// /// 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 ClaimDevicesByClaimCode internal virtual ClaimDevicesByClaimCodeResponse ClaimDevicesByClaimCode(ClaimDevicesByClaimCodeRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ClaimDevicesByClaimCodeRequestMarshaller.Instance; options.ResponseUnmarshaller = ClaimDevicesByClaimCodeResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Adds device(s) to your account (i.e., claim one or more devices) if and only if you /// received a claim code with the device(s). /// /// Container for the necessary parameters to execute the ClaimDevicesByClaimCode service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the ClaimDevicesByClaimCode service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// REST API Reference for ClaimDevicesByClaimCode Operation public virtual Task ClaimDevicesByClaimCodeAsync(ClaimDevicesByClaimCodeRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ClaimDevicesByClaimCodeRequestMarshaller.Instance; options.ResponseUnmarshaller = ClaimDevicesByClaimCodeResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region DescribeDevice internal virtual DescribeDeviceResponse DescribeDevice(DescribeDeviceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeDeviceRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeDeviceResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Given a device ID, returns a DescribeDeviceResponse object describing the details /// of the device. /// /// Container for the necessary parameters to execute the DescribeDevice service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the DescribeDevice service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// REST API Reference for DescribeDevice Operation public virtual Task DescribeDeviceAsync(DescribeDeviceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DescribeDeviceRequestMarshaller.Instance; options.ResponseUnmarshaller = DescribeDeviceResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region FinalizeDeviceClaim internal virtual FinalizeDeviceClaimResponse FinalizeDeviceClaim(FinalizeDeviceClaimRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = FinalizeDeviceClaimRequestMarshaller.Instance; options.ResponseUnmarshaller = FinalizeDeviceClaimResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Given a device ID, finalizes the claim request for the associated device. /// /// /// /// Claiming a device consists of initiating a claim, then publishing a device event, /// and finalizing the claim. For a device of type button, a device event can be published /// by simply clicking the device. /// /// /// /// Container for the necessary parameters to execute the FinalizeDeviceClaim service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the FinalizeDeviceClaim service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// REST API Reference for FinalizeDeviceClaim Operation public virtual Task FinalizeDeviceClaimAsync(FinalizeDeviceClaimRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = FinalizeDeviceClaimRequestMarshaller.Instance; options.ResponseUnmarshaller = FinalizeDeviceClaimResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region GetDeviceMethods internal virtual GetDeviceMethodsResponse GetDeviceMethods(GetDeviceMethodsRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = GetDeviceMethodsRequestMarshaller.Instance; options.ResponseUnmarshaller = GetDeviceMethodsResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Given a device ID, returns the invokable methods associated with the device. /// /// Container for the necessary parameters to execute the GetDeviceMethods service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the GetDeviceMethods service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// REST API Reference for GetDeviceMethods Operation public virtual Task GetDeviceMethodsAsync(GetDeviceMethodsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = GetDeviceMethodsRequestMarshaller.Instance; options.ResponseUnmarshaller = GetDeviceMethodsResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region InitiateDeviceClaim internal virtual InitiateDeviceClaimResponse InitiateDeviceClaim(InitiateDeviceClaimRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = InitiateDeviceClaimRequestMarshaller.Instance; options.ResponseUnmarshaller = InitiateDeviceClaimResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Given a device ID, initiates a claim request for the associated device. /// /// /// /// Claiming a device consists of initiating a claim, then publishing a device event, /// and finalizing the claim. For a device of type button, a device event can be published /// by simply clicking the device. /// /// /// /// Container for the necessary parameters to execute the InitiateDeviceClaim service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the InitiateDeviceClaim service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// /// /// /// REST API Reference for InitiateDeviceClaim Operation public virtual Task InitiateDeviceClaimAsync(InitiateDeviceClaimRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = InitiateDeviceClaimRequestMarshaller.Instance; options.ResponseUnmarshaller = InitiateDeviceClaimResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region InvokeDeviceMethod internal virtual InvokeDeviceMethodResponse InvokeDeviceMethod(InvokeDeviceMethodRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = InvokeDeviceMethodRequestMarshaller.Instance; options.ResponseUnmarshaller = InvokeDeviceMethodResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Given a device ID, issues a request to invoke a named device method (with possible /// parameters). See the "Example POST" code snippet below. /// /// Container for the necessary parameters to execute the InvokeDeviceMethod service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the InvokeDeviceMethod service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// /// REST API Reference for InvokeDeviceMethod Operation public virtual Task InvokeDeviceMethodAsync(InvokeDeviceMethodRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = InvokeDeviceMethodRequestMarshaller.Instance; options.ResponseUnmarshaller = InvokeDeviceMethodResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region ListDeviceEvents internal virtual ListDeviceEventsResponse ListDeviceEvents(ListDeviceEventsRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListDeviceEventsRequestMarshaller.Instance; options.ResponseUnmarshaller = ListDeviceEventsResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Using a device ID, returns a DeviceEventsResponse object containing an array of events /// for the device. /// /// Container for the necessary parameters to execute the ListDeviceEvents service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the ListDeviceEvents service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// /// /// /// REST API Reference for ListDeviceEvents Operation public virtual Task ListDeviceEventsAsync(ListDeviceEventsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListDeviceEventsRequestMarshaller.Instance; options.ResponseUnmarshaller = ListDeviceEventsResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion #region ListDevices internal virtual ListDevicesResponse ListDevices(ListDevicesRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = ListDevicesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListDevicesResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Lists the 1-Click compatible devices associated with your AWS account. /// /// Container for the necessary parameters to execute the ListDevices service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the ListDevices service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// REST API Reference for ListDevices Operation public virtual Task ListDevicesAsync(ListDevicesRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = ListDevicesRequestMarshaller.Instance; options.ResponseUnmarshaller = ListDevicesResponseUnmarshaller.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 associated with the specified resource ARN. /// /// 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 IoT1ClickDevicesService. /// /// /// /// /// /// /// 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 or updates the tags associated with the resource ARN. See AWS /// IoT 1-Click Service Limits for the maximum number of tags allowed per 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 IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// 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 UnclaimDevice internal virtual UnclaimDeviceResponse UnclaimDevice(UnclaimDeviceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = UnclaimDeviceRequestMarshaller.Instance; options.ResponseUnmarshaller = UnclaimDeviceResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Disassociates a device from your AWS account using its device ID. /// /// Container for the necessary parameters to execute the UnclaimDevice service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the UnclaimDevice service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// REST API Reference for UnclaimDevice Operation public virtual Task UnclaimDeviceAsync(UnclaimDeviceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = UnclaimDeviceRequestMarshaller.Instance; options.ResponseUnmarshaller = UnclaimDeviceResponseUnmarshaller.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); } /// /// Using tag keys, deletes the tags (key/value pairs) associated with the specified resource /// ARN. /// /// 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 IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// 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 UpdateDeviceState internal virtual UpdateDeviceStateResponse UpdateDeviceState(UpdateDeviceStateRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = UpdateDeviceStateRequestMarshaller.Instance; options.ResponseUnmarshaller = UpdateDeviceStateResponseUnmarshaller.Instance; return Invoke(request, options); } /// /// Using a Boolean value (true or false), this operation enables or disables the device /// given a device ID. /// /// Container for the necessary parameters to execute the UpdateDeviceState service method. /// /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// /// /// The response from the UpdateDeviceState service method, as returned by IoT1ClickDevicesService. /// /// /// /// /// /// /// /// /// /// REST API Reference for UpdateDeviceState Operation public virtual Task UpdateDeviceStateAsync(UpdateDeviceStateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = UpdateDeviceStateRequestMarshaller.Instance; options.ResponseUnmarshaller = UpdateDeviceStateResponseUnmarshaller.Instance; return InvokeAsync(request, options, cancellationToken); } #endregion } }