private Amazon.IoT.Model.UpdateFleetMetricResponse CallAWSServiceOperation(IAmazonIoT client, Amazon.IoT.Model.UpdateFleetMetricRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "AWS IoT", "UpdateFleetMetric");
     try
     {
         #if DESKTOP
         return(client.UpdateFleetMetric(request));
         #elif CORECLR
         return(client.UpdateFleetMetricAsync(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.IoT.Model.UpdateFleetMetricRequest();

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

            // populate AggregationType
            var requestAggregationTypeIsNull = true;

            request.AggregationType = new Amazon.IoT.Model.AggregationType();
            Amazon.IoT.AggregationTypeName requestAggregationType_aggregationType_Name = null;
            if (cmdletContext.AggregationType_Name != null)
            {
                requestAggregationType_aggregationType_Name = cmdletContext.AggregationType_Name;
            }
            if (requestAggregationType_aggregationType_Name != null)
            {
                request.AggregationType.Name = requestAggregationType_aggregationType_Name;
                requestAggregationTypeIsNull = false;
            }
            List <System.String> requestAggregationType_aggregationType_Value = null;

            if (cmdletContext.AggregationType_Value != null)
            {
                requestAggregationType_aggregationType_Value = cmdletContext.AggregationType_Value;
            }
            if (requestAggregationType_aggregationType_Value != null)
            {
                request.AggregationType.Values = requestAggregationType_aggregationType_Value;
                requestAggregationTypeIsNull   = false;
            }
            // determine if request.AggregationType should be set to null
            if (requestAggregationTypeIsNull)
            {
                request.AggregationType = null;
            }
            if (cmdletContext.Description != null)
            {
                request.Description = cmdletContext.Description;
            }
            if (cmdletContext.ExpectedVersion != null)
            {
                request.ExpectedVersion = cmdletContext.ExpectedVersion.Value;
            }
            if (cmdletContext.IndexName != null)
            {
                request.IndexName = cmdletContext.IndexName;
            }
            if (cmdletContext.MetricName != null)
            {
                request.MetricName = cmdletContext.MetricName;
            }
            if (cmdletContext.Period != null)
            {
                request.Period = cmdletContext.Period.Value;
            }
            if (cmdletContext.QueryString != null)
            {
                request.QueryString = cmdletContext.QueryString;
            }
            if (cmdletContext.QueryVersion != null)
            {
                request.QueryVersion = cmdletContext.QueryVersion;
            }
            if (cmdletContext.Unit != null)
            {
                request.Unit = cmdletContext.Unit;
            }

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