Exemplo n.º 1
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.Chime.Model.PutVoiceConnectorEmergencyCallingConfigurationRequest();


            // populate EmergencyCallingConfiguration
            var requestEmergencyCallingConfigurationIsNull = true;

            request.EmergencyCallingConfiguration = new Amazon.Chime.Model.EmergencyCallingConfiguration();
            List <Amazon.Chime.Model.DNISEmergencyCallingConfiguration> requestEmergencyCallingConfiguration_emergencyCallingConfiguration_DNIS = null;

            if (cmdletContext.EmergencyCallingConfiguration_DNIS != null)
            {
                requestEmergencyCallingConfiguration_emergencyCallingConfiguration_DNIS = cmdletContext.EmergencyCallingConfiguration_DNIS;
            }
            if (requestEmergencyCallingConfiguration_emergencyCallingConfiguration_DNIS != null)
            {
                request.EmergencyCallingConfiguration.DNIS = requestEmergencyCallingConfiguration_emergencyCallingConfiguration_DNIS;
                requestEmergencyCallingConfigurationIsNull = false;
            }
            // determine if request.EmergencyCallingConfiguration should be set to null
            if (requestEmergencyCallingConfigurationIsNull)
            {
                request.EmergencyCallingConfiguration = null;
            }
            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);
        }
Exemplo n.º 2
0
 private Amazon.Chime.Model.PutVoiceConnectorEmergencyCallingConfigurationResponse CallAWSServiceOperation(IAmazonChime client, Amazon.Chime.Model.PutVoiceConnectorEmergencyCallingConfigurationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Chime", "PutVoiceConnectorEmergencyCallingConfiguration");
     try
     {
         #if DESKTOP
         return(client.PutVoiceConnectorEmergencyCallingConfiguration(request));
         #elif CORECLR
         return(client.PutVoiceConnectorEmergencyCallingConfigurationAsync(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;
     }
 }