private Amazon.Organizations.Model.InviteAccountToOrganizationResponse CallAWSServiceOperation(IAmazonOrganizations client, Amazon.Organizations.Model.InviteAccountToOrganizationRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Organizations", "InviteAccountToOrganization"); try { #if DESKTOP return(client.InviteAccountToOrganization(request)); #elif CORECLR return(client.InviteAccountToOrganizationAsync(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.Organizations.Model.InviteAccountToOrganizationRequest(); if (cmdletContext.Note != null) { request.Notes = cmdletContext.Note; } // populate Target var requestTargetIsNull = true; request.Target = new Amazon.Organizations.Model.HandshakeParty(); System.String requestTarget_target_Id = null; if (cmdletContext.Target_Id != null) { requestTarget_target_Id = cmdletContext.Target_Id; } if (requestTarget_target_Id != null) { request.Target.Id = requestTarget_target_Id; requestTargetIsNull = false; } Amazon.Organizations.HandshakePartyType requestTarget_target_Type = null; if (cmdletContext.Target_Type != null) { requestTarget_target_Type = cmdletContext.Target_Type; } if (requestTarget_target_Type != null) { request.Target.Type = requestTarget_target_Type; requestTargetIsNull = false; } // determine if request.Target should be set to null if (requestTargetIsNull) { request.Target = null; } 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); }