/// <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);
            }
        }
        /// <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>
        /// Put data points to one or more time series for one or more metrics. If a time series does not exist, a new time series will be created. It is not allowed to write a time series point that is older than the existing youngest point of that time series. Points that are older than the existing youngest point of that time series will be discarded silently. Therefore, users should make sure that points of a time series are written sequentially in the order of their end time.
        /// Documentation https://developers.google.com/cloudmonitoring/v2beta2/reference/timeseries/write
        /// 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>WriteTimeseriesResponseResponse</returns>
        public static WriteTimeseriesResponse Write(CloudmonitoringService service, string project, WriteTimeseriesRequest 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.Timeseries.Write(body, project).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Timeseries.Write failed.", ex);
            }
        }