private Amazon.IoT.Model.SetLoggingOptionsResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.SetLoggingOptionsRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "SetLoggingOptions");
     try
     {
         #if DESKTOP
         return(client.SetLoggingOptions(request));
         #elif CORECLR
         return(client.SetLoggingOptionsAsync(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;
     }
 }
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.IoT.Model.SetLoggingOptionsRequest();


            // populate LoggingOptionsPayload
            var requestLoggingOptionsPayloadIsNull = true;

            request.LoggingOptionsPayload = new Amazon.IoT.Model.LoggingOptionsPayload();
            Amazon.IoT.LogLevel requestLoggingOptionsPayload_loggingOptionsPayload_LogLevel = null;
            if (cmdletContext.LoggingOptionsPayload_LogLevel != null)
            {
                requestLoggingOptionsPayload_loggingOptionsPayload_LogLevel = cmdletContext.LoggingOptionsPayload_LogLevel;
            }
            if (requestLoggingOptionsPayload_loggingOptionsPayload_LogLevel != null)
            {
                request.LoggingOptionsPayload.LogLevel = requestLoggingOptionsPayload_loggingOptionsPayload_LogLevel;
                requestLoggingOptionsPayloadIsNull     = false;
            }
            System.String requestLoggingOptionsPayload_loggingOptionsPayload_RoleArn = null;
            if (cmdletContext.LoggingOptionsPayload_RoleArn != null)
            {
                requestLoggingOptionsPayload_loggingOptionsPayload_RoleArn = cmdletContext.LoggingOptionsPayload_RoleArn;
            }
            if (requestLoggingOptionsPayload_loggingOptionsPayload_RoleArn != null)
            {
                request.LoggingOptionsPayload.RoleArn = requestLoggingOptionsPayload_loggingOptionsPayload_RoleArn;
                requestLoggingOptionsPayloadIsNull    = false;
            }
            // determine if request.LoggingOptionsPayload should be set to null
            if (requestLoggingOptionsPayloadIsNull)
            {
                request.LoggingOptionsPayload = null;
            }

            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);
        }
Пример #3
0
        /// <summary>
        /// Sets the logging options.
        /// </summary>
        /// <param name="request">Container for the necessary parameters to execute the SetLoggingOptions service method.</param>
        /// 
        /// <returns>The response from the SetLoggingOptions service method, as returned by IoT.</returns>
        /// <exception cref="Amazon.IoT.Model.InternalException">
        /// An unexpected error has occurred.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.InvalidRequestException">
        /// The request is not valid.
        /// </exception>
        /// <exception cref="Amazon.IoT.Model.ServiceUnavailableException">
        /// The service is temporarily unavailable.
        /// </exception>
        public SetLoggingOptionsResponse SetLoggingOptions(SetLoggingOptionsRequest request)
        {
            var marshaller = new SetLoggingOptionsRequestMarshaller();
            var unmarshaller = SetLoggingOptionsResponseUnmarshaller.Instance;

            return Invoke<SetLoggingOptionsRequest,SetLoggingOptionsResponse>(request, marshaller, unmarshaller);
        }
Пример #4
0
        /// <summary>
        /// Initiates the asynchronous execution of the SetLoggingOptions operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetLoggingOptions 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<SetLoggingOptionsResponse> SetLoggingOptionsAsync(SetLoggingOptionsRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken))
        {
            var marshaller = new SetLoggingOptionsRequestMarshaller();
            var unmarshaller = SetLoggingOptionsResponseUnmarshaller.Instance;

            return InvokeAsync<SetLoggingOptionsRequest,SetLoggingOptionsResponse>(request, marshaller, 
                unmarshaller, cancellationToken);
        }
Пример #5
0
        /// <summary>
        /// Initiates the asynchronous execution of the SetLoggingOptions operation.
        /// </summary>
        /// 
        /// <param name="request">Container for the necessary parameters to execute the SetLoggingOptions 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 EndSetLoggingOptions
        ///         operation.</returns>
        public IAsyncResult BeginSetLoggingOptions(SetLoggingOptionsRequest request, AsyncCallback callback, object state)
        {
            var marshaller = new SetLoggingOptionsRequestMarshaller();
            var unmarshaller = SetLoggingOptionsResponseUnmarshaller.Instance;

            return BeginInvoke<SetLoggingOptionsRequest>(request, marshaller, unmarshaller,
                callback, state);
        }