private Amazon.SimpleSystemsManagement.Model.CreateOpsItemResponse CallAWSServiceOperation(IAmazonSimpleSystemsManagement client, Amazon.SimpleSystemsManagement.Model.CreateOpsItemRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Systems Manager", "CreateOpsItem"); try { #if DESKTOP return(client.CreateOpsItem(request)); #elif CORECLR return(client.CreateOpsItemAsync(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.SimpleSystemsManagement.Model.CreateOpsItemRequest(); if (cmdletContext.ActualEndTime != null) { request.ActualEndTime = cmdletContext.ActualEndTime.Value; } if (cmdletContext.ActualStartTime != null) { request.ActualStartTime = cmdletContext.ActualStartTime.Value; } if (cmdletContext.Category != null) { request.Category = cmdletContext.Category; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.Notification != null) { request.Notifications = cmdletContext.Notification; } if (cmdletContext.OperationalData != null) { request.OperationalData = cmdletContext.OperationalData; } if (cmdletContext.OpsItemType != null) { request.OpsItemType = cmdletContext.OpsItemType; } if (cmdletContext.PlannedEndTime != null) { request.PlannedEndTime = cmdletContext.PlannedEndTime.Value; } if (cmdletContext.PlannedStartTime != null) { request.PlannedStartTime = cmdletContext.PlannedStartTime.Value; } if (cmdletContext.Priority != null) { request.Priority = cmdletContext.Priority.Value; } if (cmdletContext.RelatedOpsItem != null) { request.RelatedOpsItems = cmdletContext.RelatedOpsItem; } if (cmdletContext.Severity != null) { request.Severity = cmdletContext.Severity; } if (cmdletContext.Source != null) { request.Source = cmdletContext.Source; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.Title != null) { request.Title = cmdletContext.Title; } 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); }