Exemple #1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IoT.Model.DetachThingPrincipalRequest();

            if (cmdletContext.Principal != null)
            {
                request.Principal = cmdletContext.Principal;
            }
            if (cmdletContext.ThingName != null)
            {
                request.ThingName = cmdletContext.ThingName;
            }

            CmdletOutput output;

            // issue call
            var client = Client ?? CreateClient(_CurrentCredentials, _RegionEndpoint);

            try
            {
                var    response       = CallAWSServiceOperation(client, request);
                object pipelineOutput = null;
                pipelineOutput = cmdletContext.Select(response, this);
                output         = new CmdletOutput
                {
                    PipelineOutput  = pipelineOutput,
                    ServiceResponse = response
                };
            }
            catch (Exception e)
            {
                output = new CmdletOutput {
                    ErrorResponse = e
                };
            }

            return(output);
        }
Exemple #2
0
        /// <summary>
        /// Initiates the asynchronous execution of the DetachThingPrincipal operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DetachThingPrincipal operation.</param>
        /// <param name="cancellationToken">
        ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
        /// </param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task<DetachThingPrincipalResponse> DetachThingPrincipalAsync(DetachThingPrincipalRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new DetachThingPrincipalRequestMarshaller();
            var unmarshaller = DetachThingPrincipalResponseUnmarshaller.Instance;

            return InvokeAsync<DetachThingPrincipalRequest,DetachThingPrincipalResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Exemple #3
0
 /// <summary>
 /// Detaches the specified principal from the specified thing.
 /// </summary>
 /// <param name="thingName">The name of the thing.</param>
 /// <param name="principal">The principal.</param>
 /// <param name="cancellationToken">
 ///     A cancellation token that can be used by other objects or threads to receive notice of cancellation.
 /// </param>
 /// 
 /// <returns>The response from the DetachThingPrincipal service method, as returned by IoT.</returns>
 /// <exception cref="Amazon.IoT.Model.InternalFailureException">
 /// An unexpected error has occurred.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.InvalidRequestException">
 /// The request is not valid.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException">
 /// The specified resource does not exist.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ServiceUnavailableException">
 /// The service is temporarily unavailable.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ThrottlingException">
 /// The rate exceeds the limit.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.UnauthorizedException">
 /// You are not authorized to perform this operation.
 /// </exception>
 public Task<DetachThingPrincipalResponse> DetachThingPrincipalAsync(string thingName, string principal, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
 {
     var request = new DetachThingPrincipalRequest();
     request.ThingName = thingName;
     request.Principal = principal;
     return DetachThingPrincipalAsync(request, cancellationToken);
 }
Exemple #4
0
        /// <summary>
        /// Detaches the specified principal from the specified thing.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the DetachThingPrincipal service method.</param>
        /// 
        /// <returns>The response from the DetachThingPrincipal service method, as returned by IoT.</returns>
        /// <exception cref="Amazon.IoT.Model.InternalFailureException">
        /// An unexpected error has occurred.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.InvalidRequestException">
        /// The request is not valid.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException">
        /// The specified resource does not exist.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.ServiceUnavailableException">
        /// The service is temporarily unavailable.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.ThrottlingException">
        /// The rate exceeds the limit.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.UnauthorizedException">
        /// You are not authorized to perform this operation.
        /// </exception>
        public DetachThingPrincipalResponse DetachThingPrincipal(DetachThingPrincipalRequest request)
        {
            var marshaller = new DetachThingPrincipalRequestMarshaller();
            var unmarshaller = DetachThingPrincipalResponseUnmarshaller.Instance;

            return Invoke<DetachThingPrincipalRequest,DetachThingPrincipalResponse>(request, marshaller, unmarshaller);
        }
Exemple #5
0
 /// <summary>
 /// Detaches the specified principal from the specified thing.
 /// </summary>
 /// <param name="thingName">The name of the thing.</param>
 /// <param name="principal">The principal.</param>
 /// 
 /// <returns>The response from the DetachThingPrincipal service method, as returned by IoT.</returns>
 /// <exception cref="Amazon.IoT.Model.InternalFailureException">
 /// An unexpected error has occurred.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.InvalidRequestException">
 /// The request is not valid.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ResourceNotFoundException">
 /// The specified resource does not exist.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ServiceUnavailableException">
 /// The service is temporarily unavailable.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.ThrottlingException">
 /// The rate exceeds the limit.
 /// </exception>
 /// <exception cref="Amazon.IoT.Model.UnauthorizedException">
 /// You are not authorized to perform this operation.
 /// </exception>
 public DetachThingPrincipalResponse DetachThingPrincipal(string thingName, string principal)
 {
     var request = new DetachThingPrincipalRequest();
     request.ThingName = thingName;
     request.Principal = principal;
     return DetachThingPrincipal(request);
 }
        /// <summary>
        /// Initiates the asynchronous execution of the DetachThingPrincipal operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the DetachThingPrincipal operation on AmazonIoTClient.</param>
        /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param>
        /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback
        ///          procedure using the AsyncState property.</param>
        /// 
        /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDetachThingPrincipal
        ///         operation.</returns>
        public IAsyncResult BeginDetachThingPrincipal(DetachThingPrincipalRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new DetachThingPrincipalRequestMarshaller();
            var unmarshaller = DetachThingPrincipalResponseUnmarshaller.Instance;

            return BeginInvoke<DetachThingPrincipalRequest>(request, marshaller, unmarshaller,
                callback, state);
        }
Exemple #7
0
 private Amazon.IoT.Model.DetachThingPrincipalResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.DetachThingPrincipalRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "DetachThingPrincipal");
     try
     {
         #if DESKTOP
         return(client.DetachThingPrincipal(request));
         #elif CORECLR
         return(client.DetachThingPrincipalAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }