private Amazon.MediaStore.Model.PutMetricPolicyResponse CallAWSServiceOperation(IAmazonMediaStore client, Amazon.MediaStore.Model.PutMetricPolicyRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS Elemental MediaStore", "PutMetricPolicy");
     try
     {
         #if DESKTOP
         return(client.PutMetricPolicy(request));
         #elif CORECLR
         return(client.PutMetricPolicyAsync(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.MediaStore.Model.PutMetricPolicyRequest();

            if (cmdletContext.ContainerName != null)
            {
                request.ContainerName = cmdletContext.ContainerName;
            }

            // populate MetricPolicy
            var requestMetricPolicyIsNull = true;

            request.MetricPolicy = new Amazon.MediaStore.Model.MetricPolicy();
            Amazon.MediaStore.ContainerLevelMetrics requestMetricPolicy_metricPolicy_ContainerLevelMetric = null;
            if (cmdletContext.MetricPolicy_ContainerLevelMetric != null)
            {
                requestMetricPolicy_metricPolicy_ContainerLevelMetric = cmdletContext.MetricPolicy_ContainerLevelMetric;
            }
            if (requestMetricPolicy_metricPolicy_ContainerLevelMetric != null)
            {
                request.MetricPolicy.ContainerLevelMetrics = requestMetricPolicy_metricPolicy_ContainerLevelMetric;
                requestMetricPolicyIsNull = false;
            }
            List <Amazon.MediaStore.Model.MetricPolicyRule> requestMetricPolicy_metricPolicy_MetricPolicyRule = null;

            if (cmdletContext.MetricPolicy_MetricPolicyRule != null)
            {
                requestMetricPolicy_metricPolicy_MetricPolicyRule = cmdletContext.MetricPolicy_MetricPolicyRule;
            }
            if (requestMetricPolicy_metricPolicy_MetricPolicyRule != null)
            {
                request.MetricPolicy.MetricPolicyRules = requestMetricPolicy_metricPolicy_MetricPolicyRule;
                requestMetricPolicyIsNull = false;
            }
            // determine if request.MetricPolicy should be set to null
            if (requestMetricPolicyIsNull)
            {
                request.MetricPolicy = null;
            }

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