/// <summary>
        /// Create a new metric.
        /// Documentation https://developers.google.com/cloudmonitoring/v2beta2/reference/metricDescriptors/create
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated CloudMonitoring service.</param>
        /// <param name="project">The project id. The value can be the numeric project ID or string-based project name.</param>
        /// <param name="body">A valid CloudMonitoring v2beta2 body.</param>
        /// <returns>MetricDescriptorResponse</returns>
        public static MetricDescriptor Create(CloudMonitoringService service, string project, MetricDescriptor body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Make the request.
                return(service.MetricDescriptors.Create(body, project).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request MetricDescriptors.Create failed.", ex);
            }
        }
        /// <summary>
        /// Delete an existing metric.
        /// Documentation https://developers.google.com/cloudmonitoring/v2beta2/reference/metricDescriptors/delete
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated CloudMonitoring service.</param>
        /// <param name="project">The project ID to which the metric belongs.</param>
        /// <param name="metric">Name of the metric.</param>
        /// <returns>DeleteMetricDescriptorResponseResponse</returns>
        public static DeleteMetricDescriptorResponse Delete(CloudMonitoringService service, string project, string metric)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (metric == null)
                {
                    throw new ArgumentNullException(metric);
                }

                // Make the request.
                return(service.MetricDescriptors.Delete(project, metric).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request MetricDescriptors.Delete failed.", ex);
            }
        }
        /// <summary>
        /// List metric descriptors that match the query. If the query is not set, then all of the metric descriptors will be returned. Large responses will be paginated, use the nextPageToken returned in the response to request subsequent pages of results by setting the pageToken query parameter to the value of the nextPageToken.
        /// Documentation https://developers.google.com/cloudmonitoring/v2beta2/reference/metricDescriptors/list
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated CloudMonitoring service.</param>
        /// <param name="project">The project id. The value can be the numeric project ID or string-based project name.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>ListMetricDescriptorsResponseResponse</returns>
        public static ListMetricDescriptorsResponse List(CloudMonitoringService service, string project, MetricDescriptorsListOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }

                // Building the initial request.
                var request = service.MetricDescriptors.List(project);

                // Applying optional parameters to the request.
                request = (MetricDescriptorsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request MetricDescriptors.List failed.", ex);
            }
        }