private Amazon.Chime.Model.CreateProxySessionResponse CallAWSServiceOperation(IAmazonChime client, Amazon.Chime.Model.CreateProxySessionRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Chime", "CreateProxySession");
     try
     {
         #if DESKTOP
         return(client.CreateProxySession(request));
         #elif CORECLR
         return(client.CreateProxySessionAsync(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.Chime.Model.CreateProxySessionRequest();

            if (cmdletContext.Capability != null)
            {
                request.Capabilities = cmdletContext.Capability;
            }
            if (cmdletContext.ExpiryMinute != null)
            {
                request.ExpiryMinutes = cmdletContext.ExpiryMinute.Value;
            }
            if (cmdletContext.GeoMatchLevel != null)
            {
                request.GeoMatchLevel = cmdletContext.GeoMatchLevel;
            }

            // populate GeoMatchParams
            var requestGeoMatchParamsIsNull = true;

            request.GeoMatchParams = new Amazon.Chime.Model.GeoMatchParams();
            System.String requestGeoMatchParams_geoMatchParams_AreaCode = null;
            if (cmdletContext.GeoMatchParams_AreaCode != null)
            {
                requestGeoMatchParams_geoMatchParams_AreaCode = cmdletContext.GeoMatchParams_AreaCode;
            }
            if (requestGeoMatchParams_geoMatchParams_AreaCode != null)
            {
                request.GeoMatchParams.AreaCode = requestGeoMatchParams_geoMatchParams_AreaCode;
                requestGeoMatchParamsIsNull     = false;
            }
            System.String requestGeoMatchParams_geoMatchParams_Country = null;
            if (cmdletContext.GeoMatchParams_Country != null)
            {
                requestGeoMatchParams_geoMatchParams_Country = cmdletContext.GeoMatchParams_Country;
            }
            if (requestGeoMatchParams_geoMatchParams_Country != null)
            {
                request.GeoMatchParams.Country = requestGeoMatchParams_geoMatchParams_Country;
                requestGeoMatchParamsIsNull    = false;
            }
            // determine if request.GeoMatchParams should be set to null
            if (requestGeoMatchParamsIsNull)
            {
                request.GeoMatchParams = null;
            }
            if (cmdletContext.Name != null)
            {
                request.Name = cmdletContext.Name;
            }
            if (cmdletContext.NumberSelectionBehavior != null)
            {
                request.NumberSelectionBehavior = cmdletContext.NumberSelectionBehavior;
            }
            if (cmdletContext.ParticipantPhoneNumber != null)
            {
                request.ParticipantPhoneNumbers = cmdletContext.ParticipantPhoneNumber;
            }
            if (cmdletContext.VoiceConnectorId != null)
            {
                request.VoiceConnectorId = cmdletContext.VoiceConnectorId;
            }

            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);
        }