public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.ApplicationInsights.Model.CreateApplicationRequest(); if (cmdletContext.AutoConfigEnabled != null) { request.AutoConfigEnabled = cmdletContext.AutoConfigEnabled.Value; } if (cmdletContext.AutoCreate != null) { request.AutoCreate = cmdletContext.AutoCreate.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.ResourceGroupName != null) { request.ResourceGroupName = cmdletContext.ResourceGroupName; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } 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.CreateApplicationResponse CallAWSServiceOperation(IAmazonApplicationInsights client, Amazon.ApplicationInsights.Model.CreateApplicationRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon CloudWatch Application Insights", "CreateApplication"); try { #if DESKTOP return(client.CreateApplication(request)); #elif CORECLR return(client.CreateApplicationAsync(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; } }