private Amazon.SSMContacts.Model.CreateContactResponse CallAWSServiceOperation(IAmazonSSMContacts client, Amazon.SSMContacts.Model.CreateContactRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS System Manager Contacts", "CreateContact"); try { #if DESKTOP return(client.CreateContact(request)); #elif CORECLR return(client.CreateContactAsync(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.SSMContacts.Model.CreateContactRequest(); if (cmdletContext.Alias != null) { request.Alias = cmdletContext.Alias; } if (cmdletContext.DisplayName != null) { request.DisplayName = cmdletContext.DisplayName; } if (cmdletContext.IdempotencyToken != null) { request.IdempotencyToken = cmdletContext.IdempotencyToken; } // populate Plan var requestPlanIsNull = true; request.Plan = new Amazon.SSMContacts.Model.Plan(); List <Amazon.SSMContacts.Model.Stage> requestPlan_plan_Stage = null; if (cmdletContext.Plan_Stage != null) { requestPlan_plan_Stage = cmdletContext.Plan_Stage; } if (requestPlan_plan_Stage != null) { request.Plan.Stages = requestPlan_plan_Stage; requestPlanIsNull = false; } // determine if request.Plan should be set to null if (requestPlanIsNull) { request.Plan = null; } if (cmdletContext.Tag != null) { request.Tags = cmdletContext.Tag; } if (cmdletContext.Type != null) { request.Type = cmdletContext.Type; } 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); }