public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.AppStream.Model.CreateUserRequest(); if (cmdletContext.AuthenticationType != null) { request.AuthenticationType = cmdletContext.AuthenticationType; } if (cmdletContext.FirstName != null) { request.FirstName = cmdletContext.FirstName; } if (cmdletContext.LastName != null) { request.LastName = cmdletContext.LastName; } if (cmdletContext.MessageAction != null) { request.MessageAction = cmdletContext.MessageAction; } if (cmdletContext.UserName != null) { request.UserName = cmdletContext.UserName; } 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.AppStream.Model.CreateUserResponse CallAWSServiceOperation(IAmazonAppStream client, Amazon.AppStream.Model.CreateUserRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon AppStream", "CreateUser"); try { #if DESKTOP return(client.CreateUser(request)); #elif CORECLR return(client.CreateUserAsync(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; } }