Esempio n. 1
0
 private Amazon.MediaTailor.Model.CreateSourceLocationResponse CallAWSServiceOperation(IAmazonMediaTailor client, Amazon.MediaTailor.Model.CreateSourceLocationRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaTailor", "CreateSourceLocation");
     try
     {
         #if DESKTOP
         return(client.CreateSourceLocation(request));
         #elif CORECLR
         return(client.CreateSourceLocationAsync(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;
     }
 }
Esempio n. 2
0
        public object Execute(ExecutorContext context)
        {
            var cmdletContext = context as CmdletContext;
            // create request
            var request = new Amazon.MediaTailor.Model.CreateSourceLocationRequest();


            // populate AccessConfiguration
            var requestAccessConfigurationIsNull = true;

            request.AccessConfiguration = new Amazon.MediaTailor.Model.AccessConfiguration();
            Amazon.MediaTailor.AccessType requestAccessConfiguration_accessConfiguration_AccessType = null;
            if (cmdletContext.AccessConfiguration_AccessType != null)
            {
                requestAccessConfiguration_accessConfiguration_AccessType = cmdletContext.AccessConfiguration_AccessType;
            }
            if (requestAccessConfiguration_accessConfiguration_AccessType != null)
            {
                request.AccessConfiguration.AccessType = requestAccessConfiguration_accessConfiguration_AccessType;
                requestAccessConfigurationIsNull       = false;
            }
            Amazon.MediaTailor.Model.SecretsManagerAccessTokenConfiguration requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration = null;

            // populate SecretsManagerAccessTokenConfiguration
            var requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfigurationIsNull = true;

            requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration = new Amazon.MediaTailor.Model.SecretsManagerAccessTokenConfiguration();
            System.String requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_HeaderName = null;
            if (cmdletContext.SecretsManagerAccessTokenConfiguration_HeaderName != null)
            {
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_HeaderName = cmdletContext.SecretsManagerAccessTokenConfiguration_HeaderName;
            }
            if (requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_HeaderName != null)
            {
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration.HeaderName = requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_HeaderName;
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfigurationIsNull      = false;
            }
            System.String requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_SecretArn = null;
            if (cmdletContext.SecretsManagerAccessTokenConfiguration_SecretArn != null)
            {
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_SecretArn = cmdletContext.SecretsManagerAccessTokenConfiguration_SecretArn;
            }
            if (requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_SecretArn != null)
            {
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration.SecretArn = requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_SecretArn;
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfigurationIsNull     = false;
            }
            System.String requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_SecretStringKey = null;
            if (cmdletContext.SecretsManagerAccessTokenConfiguration_SecretStringKey != null)
            {
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_SecretStringKey = cmdletContext.SecretsManagerAccessTokenConfiguration_SecretStringKey;
            }
            if (requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_SecretStringKey != null)
            {
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration.SecretStringKey = requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration_secretsManagerAccessTokenConfiguration_SecretStringKey;
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfigurationIsNull           = false;
            }
            // determine if requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration should be set to null
            if (requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfigurationIsNull)
            {
                requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration = null;
            }
            if (requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration != null)
            {
                request.AccessConfiguration.SecretsManagerAccessTokenConfiguration = requestAccessConfiguration_accessConfiguration_SecretsManagerAccessTokenConfiguration;
                requestAccessConfigurationIsNull = false;
            }
            // determine if request.AccessConfiguration should be set to null
            if (requestAccessConfigurationIsNull)
            {
                request.AccessConfiguration = null;
            }

            // populate DefaultSegmentDeliveryConfiguration
            var requestDefaultSegmentDeliveryConfigurationIsNull = true;

            request.DefaultSegmentDeliveryConfiguration = new Amazon.MediaTailor.Model.DefaultSegmentDeliveryConfiguration();
            System.String requestDefaultSegmentDeliveryConfiguration_defaultSegmentDeliveryConfiguration_BaseUrl = null;
            if (cmdletContext.DefaultSegmentDeliveryConfiguration_BaseUrl != null)
            {
                requestDefaultSegmentDeliveryConfiguration_defaultSegmentDeliveryConfiguration_BaseUrl = cmdletContext.DefaultSegmentDeliveryConfiguration_BaseUrl;
            }
            if (requestDefaultSegmentDeliveryConfiguration_defaultSegmentDeliveryConfiguration_BaseUrl != null)
            {
                request.DefaultSegmentDeliveryConfiguration.BaseUrl = requestDefaultSegmentDeliveryConfiguration_defaultSegmentDeliveryConfiguration_BaseUrl;
                requestDefaultSegmentDeliveryConfigurationIsNull    = false;
            }
            // determine if request.DefaultSegmentDeliveryConfiguration should be set to null
            if (requestDefaultSegmentDeliveryConfigurationIsNull)
            {
                request.DefaultSegmentDeliveryConfiguration = null;
            }

            // populate HttpConfiguration
            var requestHttpConfigurationIsNull = true;

            request.HttpConfiguration = new Amazon.MediaTailor.Model.HttpConfiguration();
            System.String requestHttpConfiguration_httpConfiguration_BaseUrl = null;
            if (cmdletContext.HttpConfiguration_BaseUrl != null)
            {
                requestHttpConfiguration_httpConfiguration_BaseUrl = cmdletContext.HttpConfiguration_BaseUrl;
            }
            if (requestHttpConfiguration_httpConfiguration_BaseUrl != null)
            {
                request.HttpConfiguration.BaseUrl = requestHttpConfiguration_httpConfiguration_BaseUrl;
                requestHttpConfigurationIsNull    = false;
            }
            // determine if request.HttpConfiguration should be set to null
            if (requestHttpConfigurationIsNull)
            {
                request.HttpConfiguration = null;
            }
            if (cmdletContext.SourceLocationName != null)
            {
                request.SourceLocationName = cmdletContext.SourceLocationName;
            }
            if (cmdletContext.Tag != null)
            {
                request.Tags = cmdletContext.Tag;
            }

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