public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ApplicationInsights.Model.UpdateApplicationRequest(); if (cmdletContext.AutoConfigEnabled != null) { request.AutoConfigEnabled = cmdletContext.AutoConfigEnabled.Value; } if (cmdletContext.CWEMonitorEnabled != null) { request.CWEMonitorEnabled = cmdletContext.CWEMonitorEnabled.Value; } if (cmdletContext.OpsCenterEnabled != null) { request.OpsCenterEnabled = cmdletContext.OpsCenterEnabled.Value; } if (cmdletContext.OpsItemSNSTopicArn != null) { request.OpsItemSNSTopicArn = cmdletContext.OpsItemSNSTopicArn; } if (cmdletContext.RemoveSNSTopic != null) { request.RemoveSNSTopic = cmdletContext.RemoveSNSTopic.Value; } if (cmdletContext.ResourceGroupName != null) { request.ResourceGroupName = cmdletContext.ResourceGroupName; } 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.ApplicationInsights.Model.UpdateApplicationResponse CallAWSServiceOperation(IAmazonApplicationInsights client, Amazon.ApplicationInsights.Model.UpdateApplicationRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudWatch Application Insights", "UpdateApplication"); try { #if DESKTOP return(client.UpdateApplication(request)); #elif CORECLR return(client.UpdateApplicationAsync(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; } }