private Amazon.WorkMail.Model.CreateMobileDeviceAccessRuleResponse CallAWSServiceOperation(IAmazonWorkMail client, Amazon.WorkMail.Model.CreateMobileDeviceAccessRuleRequest request) { Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon WorkMail", "CreateMobileDeviceAccessRule"); try { #if DESKTOP return(client.CreateMobileDeviceAccessRule(request)); #elif CORECLR return(client.CreateMobileDeviceAccessRuleAsync(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.WorkMail.Model.CreateMobileDeviceAccessRuleRequest(); if (cmdletContext.ClientToken != null) { request.ClientToken = cmdletContext.ClientToken; } if (cmdletContext.Description != null) { request.Description = cmdletContext.Description; } if (cmdletContext.DeviceModel != null) { request.DeviceModels = cmdletContext.DeviceModel; } if (cmdletContext.DeviceOperatingSystem != null) { request.DeviceOperatingSystems = cmdletContext.DeviceOperatingSystem; } if (cmdletContext.DeviceType != null) { request.DeviceTypes = cmdletContext.DeviceType; } if (cmdletContext.DeviceUserAgent != null) { request.DeviceUserAgents = cmdletContext.DeviceUserAgent; } if (cmdletContext.Effect != null) { request.Effect = cmdletContext.Effect; } if (cmdletContext.Name != null) { request.Name = cmdletContext.Name; } if (cmdletContext.NotDeviceModel != null) { request.NotDeviceModels = cmdletContext.NotDeviceModel; } if (cmdletContext.NotDeviceOperatingSystem != null) { request.NotDeviceOperatingSystems = cmdletContext.NotDeviceOperatingSystem; } if (cmdletContext.NotDeviceType != null) { request.NotDeviceTypes = cmdletContext.NotDeviceType; } if (cmdletContext.NotDeviceUserAgent != null) { request.NotDeviceUserAgents = cmdletContext.NotDeviceUserAgent; } if (cmdletContext.OrganizationId != null) { request.OrganizationId = cmdletContext.OrganizationId; } 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); }