private Amazon.WorkDocs.Model.CreateUserResponse CallAWSServiceOperation(IAmazonWorkDocs client, Amazon.WorkDocs.Model.CreateUserRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon WorkDocs", "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; } }
public object Execute(ExecutorContext context) { var cmdletContext = context as CmdletContext; // create request var request = new Amazon.WorkDocs.Model.CreateUserRequest(); if (cmdletContext.AuthenticationToken != null) { request.AuthenticationToken = cmdletContext.AuthenticationToken; } if (cmdletContext.EmailAddress != null) { request.EmailAddress = cmdletContext.EmailAddress; } if (cmdletContext.GivenName != null) { request.GivenName = cmdletContext.GivenName; } if (cmdletContext.OrganizationId != null) { request.OrganizationId = cmdletContext.OrganizationId; } if (cmdletContext.Password != null) { request.Password = cmdletContext.Password; } // populate StorageRule var requestStorageRuleIsNull = true; request.StorageRule = new Amazon.WorkDocs.Model.StorageRuleType(); System.Int64?requestStorageRule_storageRule_StorageAllocatedInByte = null; if (cmdletContext.StorageRule_StorageAllocatedInByte != null) { requestStorageRule_storageRule_StorageAllocatedInByte = cmdletContext.StorageRule_StorageAllocatedInByte.Value; } if (requestStorageRule_storageRule_StorageAllocatedInByte != null) { request.StorageRule.StorageAllocatedInBytes = requestStorageRule_storageRule_StorageAllocatedInByte.Value; requestStorageRuleIsNull = false; } Amazon.WorkDocs.StorageType requestStorageRule_storageRule_StorageType = null; if (cmdletContext.StorageRule_StorageType != null) { requestStorageRule_storageRule_StorageType = cmdletContext.StorageRule_StorageType; } if (requestStorageRule_storageRule_StorageType != null) { request.StorageRule.StorageType = requestStorageRule_storageRule_StorageType; requestStorageRuleIsNull = false; } // determine if request.StorageRule should be set to null if (requestStorageRuleIsNull) { request.StorageRule = null; } if (cmdletContext.Surname != null) { request.Surname = cmdletContext.Surname; } if (cmdletContext.TimeZoneId != null) { request.TimeZoneId = cmdletContext.TimeZoneId; } 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); }