public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.Greengrass.Model.UpdateThingRuntimeConfigurationRequest(); // populate TelemetryConfiguration var requestTelemetryConfigurationIsNull = true; request.TelemetryConfiguration = new Amazon.Greengrass.Model.TelemetryConfigurationUpdate(); Amazon.Greengrass.Telemetry requestTelemetryConfiguration_telemetryConfiguration_Telemetry = null; if (cmdletContext.TelemetryConfiguration_Telemetry != null) { requestTelemetryConfiguration_telemetryConfiguration_Telemetry = cmdletContext.TelemetryConfiguration_Telemetry; } if (requestTelemetryConfiguration_telemetryConfiguration_Telemetry != null) { request.TelemetryConfiguration.Telemetry = requestTelemetryConfiguration_telemetryConfiguration_Telemetry; requestTelemetryConfigurationIsNull = false; } // determine if request.TelemetryConfiguration should be set to null if (requestTelemetryConfigurationIsNull) { request.TelemetryConfiguration = null; } 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); }
private Amazon.Greengrass.Model.UpdateThingRuntimeConfigurationResponse CallAWSServiceOperation(IAmazonGreengrass client, Amazon.Greengrass.Model.UpdateThingRuntimeConfigurationRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Greengrass", "UpdateThingRuntimeConfiguration"); try { #if DESKTOP return(client.UpdateThingRuntimeConfiguration(request)); #elif CORECLR return(client.UpdateThingRuntimeConfigurationAsync(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; } }