github.com/timstclair/heapster@v0.20.0-alpha1/Godeps/_workspace/src/google.golang.org/api/cloudmonitoring/v2beta2/cloudmonitoring-gen.go (about)

     1  // Package cloudmonitoring provides access to the Cloud Monitoring API.
     2  //
     3  // See https://cloud.google.com/monitoring/v2beta2/
     4  //
     5  // Usage example:
     6  //
     7  //   import "google.golang.org/api/cloudmonitoring/v2beta2"
     8  //   ...
     9  //   cloudmonitoringService, err := cloudmonitoring.New(oauthHttpClient)
    10  package cloudmonitoring
    11  
    12  import (
    13  	"bytes"
    14  	"encoding/json"
    15  	"errors"
    16  	"fmt"
    17  	context "golang.org/x/net/context"
    18  	ctxhttp "golang.org/x/net/context/ctxhttp"
    19  	gensupport "google.golang.org/api/gensupport"
    20  	googleapi "google.golang.org/api/googleapi"
    21  	"io"
    22  	"net/http"
    23  	"net/url"
    24  	"strconv"
    25  	"strings"
    26  )
    27  
    28  // Always reference these packages, just in case the auto-generated code
    29  // below doesn't.
    30  var _ = bytes.NewBuffer
    31  var _ = strconv.Itoa
    32  var _ = fmt.Sprintf
    33  var _ = json.NewDecoder
    34  var _ = io.Copy
    35  var _ = url.Parse
    36  var _ = gensupport.MarshalJSON
    37  var _ = googleapi.Version
    38  var _ = errors.New
    39  var _ = strings.Replace
    40  var _ = context.Canceled
    41  var _ = ctxhttp.Do
    42  
    43  const apiId = "cloudmonitoring:v2beta2"
    44  const apiName = "cloudmonitoring"
    45  const apiVersion = "v2beta2"
    46  const basePath = "https://www.googleapis.com/cloudmonitoring/v2beta2/projects/"
    47  
    48  // OAuth2 scopes used by this API.
    49  const (
    50  	// View and manage your data across Google Cloud Platform services
    51  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
    52  
    53  	// View and write monitoring data for all of your Google and third-party
    54  	// Cloud and API projects
    55  	MonitoringScope = "https://www.googleapis.com/auth/monitoring"
    56  )
    57  
    58  func New(client *http.Client) (*Service, error) {
    59  	if client == nil {
    60  		return nil, errors.New("client is nil")
    61  	}
    62  	s := &Service{client: client, BasePath: basePath}
    63  	s.MetricDescriptors = NewMetricDescriptorsService(s)
    64  	s.Timeseries = NewTimeseriesService(s)
    65  	s.TimeseriesDescriptors = NewTimeseriesDescriptorsService(s)
    66  	return s, nil
    67  }
    68  
    69  type Service struct {
    70  	client    *http.Client
    71  	BasePath  string // API endpoint base URL
    72  	UserAgent string // optional additional User-Agent fragment
    73  
    74  	MetricDescriptors *MetricDescriptorsService
    75  
    76  	Timeseries *TimeseriesService
    77  
    78  	TimeseriesDescriptors *TimeseriesDescriptorsService
    79  }
    80  
    81  func (s *Service) userAgent() string {
    82  	if s.UserAgent == "" {
    83  		return googleapi.UserAgent
    84  	}
    85  	return googleapi.UserAgent + " " + s.UserAgent
    86  }
    87  
    88  func NewMetricDescriptorsService(s *Service) *MetricDescriptorsService {
    89  	rs := &MetricDescriptorsService{s: s}
    90  	return rs
    91  }
    92  
    93  type MetricDescriptorsService struct {
    94  	s *Service
    95  }
    96  
    97  func NewTimeseriesService(s *Service) *TimeseriesService {
    98  	rs := &TimeseriesService{s: s}
    99  	return rs
   100  }
   101  
   102  type TimeseriesService struct {
   103  	s *Service
   104  }
   105  
   106  func NewTimeseriesDescriptorsService(s *Service) *TimeseriesDescriptorsService {
   107  	rs := &TimeseriesDescriptorsService{s: s}
   108  	return rs
   109  }
   110  
   111  type TimeseriesDescriptorsService struct {
   112  	s *Service
   113  }
   114  
   115  // DeleteMetricDescriptorResponse: The response of
   116  // cloudmonitoring.metricDescriptors.delete.
   117  type DeleteMetricDescriptorResponse struct {
   118  	// Kind: Identifies what kind of resource this is. Value: the fixed
   119  	// string "cloudmonitoring#deleteMetricDescriptorResponse".
   120  	Kind string `json:"kind,omitempty"`
   121  
   122  	// ServerResponse contains the HTTP response code and headers from the
   123  	// server.
   124  	googleapi.ServerResponse `json:"-"`
   125  
   126  	// ForceSendFields is a list of field names (e.g. "Kind") to
   127  	// unconditionally include in API requests. By default, fields with
   128  	// empty values are omitted from API requests. However, any non-pointer,
   129  	// non-interface field appearing in ForceSendFields will be sent to the
   130  	// server regardless of whether the field is empty or not. This may be
   131  	// used to include empty fields in Patch requests.
   132  	ForceSendFields []string `json:"-"`
   133  }
   134  
   135  func (s *DeleteMetricDescriptorResponse) MarshalJSON() ([]byte, error) {
   136  	type noMethod DeleteMetricDescriptorResponse
   137  	raw := noMethod(*s)
   138  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   139  }
   140  
   141  // ListMetricDescriptorsRequest: The request of
   142  // cloudmonitoring.metricDescriptors.list.
   143  type ListMetricDescriptorsRequest struct {
   144  	// Kind: Identifies what kind of resource this is. Value: the fixed
   145  	// string "cloudmonitoring#listMetricDescriptorsRequest".
   146  	Kind string `json:"kind,omitempty"`
   147  
   148  	// ForceSendFields is a list of field names (e.g. "Kind") to
   149  	// unconditionally include in API requests. By default, fields with
   150  	// empty values are omitted from API requests. However, any non-pointer,
   151  	// non-interface field appearing in ForceSendFields will be sent to the
   152  	// server regardless of whether the field is empty or not. This may be
   153  	// used to include empty fields in Patch requests.
   154  	ForceSendFields []string `json:"-"`
   155  }
   156  
   157  func (s *ListMetricDescriptorsRequest) MarshalJSON() ([]byte, error) {
   158  	type noMethod ListMetricDescriptorsRequest
   159  	raw := noMethod(*s)
   160  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   161  }
   162  
   163  // ListMetricDescriptorsResponse: The response of
   164  // cloudmonitoring.metricDescriptors.list.
   165  type ListMetricDescriptorsResponse struct {
   166  	// Kind: Identifies what kind of resource this is. Value: the fixed
   167  	// string "cloudmonitoring#listMetricDescriptorsResponse".
   168  	Kind string `json:"kind,omitempty"`
   169  
   170  	// Metrics: The returned metric descriptors.
   171  	Metrics []*MetricDescriptor `json:"metrics,omitempty"`
   172  
   173  	// NextPageToken: Pagination token. If present, indicates that
   174  	// additional results are available for retrieval. To access the results
   175  	// past the pagination limit, pass this value to the pageToken query
   176  	// parameter.
   177  	NextPageToken string `json:"nextPageToken,omitempty"`
   178  
   179  	// ServerResponse contains the HTTP response code and headers from the
   180  	// server.
   181  	googleapi.ServerResponse `json:"-"`
   182  
   183  	// ForceSendFields is a list of field names (e.g. "Kind") to
   184  	// unconditionally include in API requests. By default, fields with
   185  	// empty values are omitted from API requests. However, any non-pointer,
   186  	// non-interface field appearing in ForceSendFields will be sent to the
   187  	// server regardless of whether the field is empty or not. This may be
   188  	// used to include empty fields in Patch requests.
   189  	ForceSendFields []string `json:"-"`
   190  }
   191  
   192  func (s *ListMetricDescriptorsResponse) MarshalJSON() ([]byte, error) {
   193  	type noMethod ListMetricDescriptorsResponse
   194  	raw := noMethod(*s)
   195  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   196  }
   197  
   198  // ListTimeseriesDescriptorsRequest: The request of
   199  // cloudmonitoring.timeseriesDescriptors.list
   200  type ListTimeseriesDescriptorsRequest struct {
   201  	// Kind: Identifies what kind of resource this is. Value: the fixed
   202  	// string "cloudmonitoring#listTimeseriesDescriptorsRequest".
   203  	Kind string `json:"kind,omitempty"`
   204  
   205  	// ForceSendFields is a list of field names (e.g. "Kind") to
   206  	// unconditionally include in API requests. By default, fields with
   207  	// empty values are omitted from API requests. However, any non-pointer,
   208  	// non-interface field appearing in ForceSendFields will be sent to the
   209  	// server regardless of whether the field is empty or not. This may be
   210  	// used to include empty fields in Patch requests.
   211  	ForceSendFields []string `json:"-"`
   212  }
   213  
   214  func (s *ListTimeseriesDescriptorsRequest) MarshalJSON() ([]byte, error) {
   215  	type noMethod ListTimeseriesDescriptorsRequest
   216  	raw := noMethod(*s)
   217  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   218  }
   219  
   220  // ListTimeseriesDescriptorsResponse: The response of
   221  // cloudmonitoring.timeseriesDescriptors.list
   222  type ListTimeseriesDescriptorsResponse struct {
   223  	// Kind: Identifies what kind of resource this is. Value: the fixed
   224  	// string "cloudmonitoring#listTimeseriesDescriptorsResponse".
   225  	Kind string `json:"kind,omitempty"`
   226  
   227  	// NextPageToken: Pagination token. If present, indicates that
   228  	// additional results are available for retrieval. To access the results
   229  	// past the pagination limit, set this value to the pageToken query
   230  	// parameter.
   231  	NextPageToken string `json:"nextPageToken,omitempty"`
   232  
   233  	// Oldest: The oldest timestamp of the interval of this query, as an RFC
   234  	// 3339 string.
   235  	Oldest string `json:"oldest,omitempty"`
   236  
   237  	// Timeseries: The returned time series descriptors.
   238  	Timeseries []*TimeseriesDescriptor `json:"timeseries,omitempty"`
   239  
   240  	// Youngest: The youngest timestamp of the interval of this query, as an
   241  	// RFC 3339 string.
   242  	Youngest string `json:"youngest,omitempty"`
   243  
   244  	// ServerResponse contains the HTTP response code and headers from the
   245  	// server.
   246  	googleapi.ServerResponse `json:"-"`
   247  
   248  	// ForceSendFields is a list of field names (e.g. "Kind") to
   249  	// unconditionally include in API requests. By default, fields with
   250  	// empty values are omitted from API requests. However, any non-pointer,
   251  	// non-interface field appearing in ForceSendFields will be sent to the
   252  	// server regardless of whether the field is empty or not. This may be
   253  	// used to include empty fields in Patch requests.
   254  	ForceSendFields []string `json:"-"`
   255  }
   256  
   257  func (s *ListTimeseriesDescriptorsResponse) MarshalJSON() ([]byte, error) {
   258  	type noMethod ListTimeseriesDescriptorsResponse
   259  	raw := noMethod(*s)
   260  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   261  }
   262  
   263  // ListTimeseriesRequest: The request of cloudmonitoring.timeseries.list
   264  type ListTimeseriesRequest struct {
   265  	// Kind: Identifies what kind of resource this is. Value: the fixed
   266  	// string "cloudmonitoring#listTimeseriesRequest".
   267  	Kind string `json:"kind,omitempty"`
   268  
   269  	// ForceSendFields is a list of field names (e.g. "Kind") to
   270  	// unconditionally include in API requests. By default, fields with
   271  	// empty values are omitted from API requests. However, any non-pointer,
   272  	// non-interface field appearing in ForceSendFields will be sent to the
   273  	// server regardless of whether the field is empty or not. This may be
   274  	// used to include empty fields in Patch requests.
   275  	ForceSendFields []string `json:"-"`
   276  }
   277  
   278  func (s *ListTimeseriesRequest) MarshalJSON() ([]byte, error) {
   279  	type noMethod ListTimeseriesRequest
   280  	raw := noMethod(*s)
   281  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   282  }
   283  
   284  // ListTimeseriesResponse: The response of
   285  // cloudmonitoring.timeseries.list
   286  type ListTimeseriesResponse struct {
   287  	// Kind: Identifies what kind of resource this is. Value: the fixed
   288  	// string "cloudmonitoring#listTimeseriesResponse".
   289  	Kind string `json:"kind,omitempty"`
   290  
   291  	// NextPageToken: Pagination token. If present, indicates that
   292  	// additional results are available for retrieval. To access the results
   293  	// past the pagination limit, set the pageToken query parameter to this
   294  	// value. All of the points of a time series will be returned before
   295  	// returning any point of the subsequent time series.
   296  	NextPageToken string `json:"nextPageToken,omitempty"`
   297  
   298  	// Oldest: The oldest timestamp of the interval of this query as an RFC
   299  	// 3339 string.
   300  	Oldest string `json:"oldest,omitempty"`
   301  
   302  	// Timeseries: The returned time series.
   303  	Timeseries []*Timeseries `json:"timeseries,omitempty"`
   304  
   305  	// Youngest: The youngest timestamp of the interval of this query as an
   306  	// RFC 3339 string.
   307  	Youngest string `json:"youngest,omitempty"`
   308  
   309  	// ServerResponse contains the HTTP response code and headers from the
   310  	// server.
   311  	googleapi.ServerResponse `json:"-"`
   312  
   313  	// ForceSendFields is a list of field names (e.g. "Kind") to
   314  	// unconditionally include in API requests. By default, fields with
   315  	// empty values are omitted from API requests. However, any non-pointer,
   316  	// non-interface field appearing in ForceSendFields will be sent to the
   317  	// server regardless of whether the field is empty or not. This may be
   318  	// used to include empty fields in Patch requests.
   319  	ForceSendFields []string `json:"-"`
   320  }
   321  
   322  func (s *ListTimeseriesResponse) MarshalJSON() ([]byte, error) {
   323  	type noMethod ListTimeseriesResponse
   324  	raw := noMethod(*s)
   325  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   326  }
   327  
   328  // MetricDescriptor: A metricDescriptor defines the name, label keys,
   329  // and data type of a particular metric.
   330  type MetricDescriptor struct {
   331  	// Description: Description of this metric.
   332  	Description string `json:"description,omitempty"`
   333  
   334  	// Labels: Labels defined for this metric.
   335  	Labels []*MetricDescriptorLabelDescriptor `json:"labels,omitempty"`
   336  
   337  	// Name: The name of this metric.
   338  	Name string `json:"name,omitempty"`
   339  
   340  	// Project: The project ID to which the metric belongs.
   341  	Project string `json:"project,omitempty"`
   342  
   343  	// TypeDescriptor: Type description for this metric.
   344  	TypeDescriptor *MetricDescriptorTypeDescriptor `json:"typeDescriptor,omitempty"`
   345  
   346  	// ServerResponse contains the HTTP response code and headers from the
   347  	// server.
   348  	googleapi.ServerResponse `json:"-"`
   349  
   350  	// ForceSendFields is a list of field names (e.g. "Description") to
   351  	// unconditionally include in API requests. By default, fields with
   352  	// empty values are omitted from API requests. However, any non-pointer,
   353  	// non-interface field appearing in ForceSendFields will be sent to the
   354  	// server regardless of whether the field is empty or not. This may be
   355  	// used to include empty fields in Patch requests.
   356  	ForceSendFields []string `json:"-"`
   357  }
   358  
   359  func (s *MetricDescriptor) MarshalJSON() ([]byte, error) {
   360  	type noMethod MetricDescriptor
   361  	raw := noMethod(*s)
   362  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   363  }
   364  
   365  // MetricDescriptorLabelDescriptor: A label in a metric is a description
   366  // of this metric, including the key of this description (what the
   367  // description is), and the value for this description.
   368  type MetricDescriptorLabelDescriptor struct {
   369  	// Description: Label description.
   370  	Description string `json:"description,omitempty"`
   371  
   372  	// Key: Label key.
   373  	Key string `json:"key,omitempty"`
   374  
   375  	// ForceSendFields is a list of field names (e.g. "Description") to
   376  	// unconditionally include in API requests. By default, fields with
   377  	// empty values are omitted from API requests. However, any non-pointer,
   378  	// non-interface field appearing in ForceSendFields will be sent to the
   379  	// server regardless of whether the field is empty or not. This may be
   380  	// used to include empty fields in Patch requests.
   381  	ForceSendFields []string `json:"-"`
   382  }
   383  
   384  func (s *MetricDescriptorLabelDescriptor) MarshalJSON() ([]byte, error) {
   385  	type noMethod MetricDescriptorLabelDescriptor
   386  	raw := noMethod(*s)
   387  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   388  }
   389  
   390  // MetricDescriptorTypeDescriptor: A type in a metric contains
   391  // information about how the metric is collected and what its data
   392  // points look like.
   393  type MetricDescriptorTypeDescriptor struct {
   394  	// MetricType: The method of collecting data for the metric. See Metric
   395  	// types.
   396  	MetricType string `json:"metricType,omitempty"`
   397  
   398  	// ValueType: The data type of of individual points in the metric's time
   399  	// series. See Metric value types.
   400  	ValueType string `json:"valueType,omitempty"`
   401  
   402  	// ForceSendFields is a list of field names (e.g. "MetricType") to
   403  	// unconditionally include in API requests. By default, fields with
   404  	// empty values are omitted from API requests. However, any non-pointer,
   405  	// non-interface field appearing in ForceSendFields will be sent to the
   406  	// server regardless of whether the field is empty or not. This may be
   407  	// used to include empty fields in Patch requests.
   408  	ForceSendFields []string `json:"-"`
   409  }
   410  
   411  func (s *MetricDescriptorTypeDescriptor) MarshalJSON() ([]byte, error) {
   412  	type noMethod MetricDescriptorTypeDescriptor
   413  	raw := noMethod(*s)
   414  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   415  }
   416  
   417  // Point: Point is a single point in a time series. It consists of a
   418  // start time, an end time, and a value.
   419  type Point struct {
   420  	// BoolValue: The value of this data point. Either "true" or "false".
   421  	BoolValue *bool `json:"boolValue,omitempty"`
   422  
   423  	// DistributionValue: The value of this data point as a distribution. A
   424  	// distribution value can contain a list of buckets and/or an
   425  	// underflowBucket and an overflowBucket. The values of these points can
   426  	// be used to create a histogram.
   427  	DistributionValue *PointDistribution `json:"distributionValue,omitempty"`
   428  
   429  	// DoubleValue: The value of this data point as a double-precision
   430  	// floating-point number.
   431  	DoubleValue *float64 `json:"doubleValue,omitempty"`
   432  
   433  	// End: The interval [start, end] is the time period to which the
   434  	// point's value applies. For gauge metrics, whose values are
   435  	// instantaneous measurements, this interval should be empty (start
   436  	// should equal end). For cumulative metrics (of which deltas and rates
   437  	// are special cases), the interval should be non-empty. Both start and
   438  	// end are RFC 3339 strings.
   439  	End string `json:"end,omitempty"`
   440  
   441  	// Int64Value: The value of this data point as a 64-bit integer.
   442  	Int64Value *int64 `json:"int64Value,omitempty,string"`
   443  
   444  	// Start: The interval [start, end] is the time period to which the
   445  	// point's value applies. For gauge metrics, whose values are
   446  	// instantaneous measurements, this interval should be empty (start
   447  	// should equal end). For cumulative metrics (of which deltas and rates
   448  	// are special cases), the interval should be non-empty. Both start and
   449  	// end are RFC 3339 strings.
   450  	Start string `json:"start,omitempty"`
   451  
   452  	// StringValue: The value of this data point in string format.
   453  	StringValue *string `json:"stringValue,omitempty"`
   454  
   455  	// ForceSendFields is a list of field names (e.g. "BoolValue") to
   456  	// unconditionally include in API requests. By default, fields with
   457  	// empty values are omitted from API requests. However, any non-pointer,
   458  	// non-interface field appearing in ForceSendFields will be sent to the
   459  	// server regardless of whether the field is empty or not. This may be
   460  	// used to include empty fields in Patch requests.
   461  	ForceSendFields []string `json:"-"`
   462  }
   463  
   464  func (s *Point) MarshalJSON() ([]byte, error) {
   465  	type noMethod Point
   466  	raw := noMethod(*s)
   467  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   468  }
   469  
   470  // PointDistribution: Distribution data point value type. When writing
   471  // distribution points, try to be consistent with the boundaries of your
   472  // buckets. If you must modify the bucket boundaries, then do so by
   473  // merging, partitioning, or appending rather than skewing them.
   474  type PointDistribution struct {
   475  	// Buckets: The finite buckets.
   476  	Buckets []*PointDistributionBucket `json:"buckets,omitempty"`
   477  
   478  	// OverflowBucket: The overflow bucket.
   479  	OverflowBucket *PointDistributionOverflowBucket `json:"overflowBucket,omitempty"`
   480  
   481  	// UnderflowBucket: The underflow bucket.
   482  	UnderflowBucket *PointDistributionUnderflowBucket `json:"underflowBucket,omitempty"`
   483  
   484  	// ForceSendFields is a list of field names (e.g. "Buckets") to
   485  	// unconditionally include in API requests. By default, fields with
   486  	// empty values are omitted from API requests. However, any non-pointer,
   487  	// non-interface field appearing in ForceSendFields will be sent to the
   488  	// server regardless of whether the field is empty or not. This may be
   489  	// used to include empty fields in Patch requests.
   490  	ForceSendFields []string `json:"-"`
   491  }
   492  
   493  func (s *PointDistribution) MarshalJSON() ([]byte, error) {
   494  	type noMethod PointDistribution
   495  	raw := noMethod(*s)
   496  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   497  }
   498  
   499  // PointDistributionBucket: The histogram's bucket. Buckets that form
   500  // the histogram of a distribution value. If the upper bound of a
   501  // bucket, say U1, does not equal the lower bound of the next bucket,
   502  // say L2, this means that there is no event in [U1, L2).
   503  type PointDistributionBucket struct {
   504  	// Count: The number of events whose values are in the interval defined
   505  	// by this bucket.
   506  	Count int64 `json:"count,omitempty,string"`
   507  
   508  	// LowerBound: The lower bound of the value interval of this bucket
   509  	// (inclusive).
   510  	LowerBound float64 `json:"lowerBound,omitempty"`
   511  
   512  	// UpperBound: The upper bound of the value interval of this bucket
   513  	// (exclusive).
   514  	UpperBound float64 `json:"upperBound,omitempty"`
   515  
   516  	// ForceSendFields is a list of field names (e.g. "Count") to
   517  	// unconditionally include in API requests. By default, fields with
   518  	// empty values are omitted from API requests. However, any non-pointer,
   519  	// non-interface field appearing in ForceSendFields will be sent to the
   520  	// server regardless of whether the field is empty or not. This may be
   521  	// used to include empty fields in Patch requests.
   522  	ForceSendFields []string `json:"-"`
   523  }
   524  
   525  func (s *PointDistributionBucket) MarshalJSON() ([]byte, error) {
   526  	type noMethod PointDistributionBucket
   527  	raw := noMethod(*s)
   528  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   529  }
   530  
   531  // PointDistributionOverflowBucket: The overflow bucket is a special
   532  // bucket that does not have the upperBound field; it includes all of
   533  // the events that are no less than its lower bound.
   534  type PointDistributionOverflowBucket struct {
   535  	// Count: The number of events whose values are in the interval defined
   536  	// by this bucket.
   537  	Count int64 `json:"count,omitempty,string"`
   538  
   539  	// LowerBound: The lower bound of the value interval of this bucket
   540  	// (inclusive).
   541  	LowerBound float64 `json:"lowerBound,omitempty"`
   542  
   543  	// ForceSendFields is a list of field names (e.g. "Count") to
   544  	// unconditionally include in API requests. By default, fields with
   545  	// empty values are omitted from API requests. However, any non-pointer,
   546  	// non-interface field appearing in ForceSendFields will be sent to the
   547  	// server regardless of whether the field is empty or not. This may be
   548  	// used to include empty fields in Patch requests.
   549  	ForceSendFields []string `json:"-"`
   550  }
   551  
   552  func (s *PointDistributionOverflowBucket) MarshalJSON() ([]byte, error) {
   553  	type noMethod PointDistributionOverflowBucket
   554  	raw := noMethod(*s)
   555  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   556  }
   557  
   558  // PointDistributionUnderflowBucket: The underflow bucket is a special
   559  // bucket that does not have the lowerBound field; it includes all of
   560  // the events that are less than its upper bound.
   561  type PointDistributionUnderflowBucket struct {
   562  	// Count: The number of events whose values are in the interval defined
   563  	// by this bucket.
   564  	Count int64 `json:"count,omitempty,string"`
   565  
   566  	// UpperBound: The upper bound of the value interval of this bucket
   567  	// (exclusive).
   568  	UpperBound float64 `json:"upperBound,omitempty"`
   569  
   570  	// ForceSendFields is a list of field names (e.g. "Count") to
   571  	// unconditionally include in API requests. By default, fields with
   572  	// empty values are omitted from API requests. However, any non-pointer,
   573  	// non-interface field appearing in ForceSendFields will be sent to the
   574  	// server regardless of whether the field is empty or not. This may be
   575  	// used to include empty fields in Patch requests.
   576  	ForceSendFields []string `json:"-"`
   577  }
   578  
   579  func (s *PointDistributionUnderflowBucket) MarshalJSON() ([]byte, error) {
   580  	type noMethod PointDistributionUnderflowBucket
   581  	raw := noMethod(*s)
   582  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   583  }
   584  
   585  // Timeseries: The monitoring data is organized as metrics and stored as
   586  // data points that are recorded over time. Each data point represents
   587  // information like the CPU utilization of your virtual machine. A
   588  // historical record of these data points is called a time series.
   589  type Timeseries struct {
   590  	// Points: The data points of this time series. The points are listed in
   591  	// order of their end timestamp, from younger to older.
   592  	Points []*Point `json:"points,omitempty"`
   593  
   594  	// TimeseriesDesc: The descriptor of this time series.
   595  	TimeseriesDesc *TimeseriesDescriptor `json:"timeseriesDesc,omitempty"`
   596  
   597  	// ForceSendFields is a list of field names (e.g. "Points") to
   598  	// unconditionally include in API requests. By default, fields with
   599  	// empty values are omitted from API requests. However, any non-pointer,
   600  	// non-interface field appearing in ForceSendFields will be sent to the
   601  	// server regardless of whether the field is empty or not. This may be
   602  	// used to include empty fields in Patch requests.
   603  	ForceSendFields []string `json:"-"`
   604  }
   605  
   606  func (s *Timeseries) MarshalJSON() ([]byte, error) {
   607  	type noMethod Timeseries
   608  	raw := noMethod(*s)
   609  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   610  }
   611  
   612  // TimeseriesDescriptor: TimeseriesDescriptor identifies a single time
   613  // series.
   614  type TimeseriesDescriptor struct {
   615  	// Labels: The label's name.
   616  	Labels map[string]string `json:"labels,omitempty"`
   617  
   618  	// Metric: The name of the metric.
   619  	Metric string `json:"metric,omitempty"`
   620  
   621  	// Project: The Developers Console project number to which this time
   622  	// series belongs.
   623  	Project string `json:"project,omitempty"`
   624  
   625  	// ForceSendFields is a list of field names (e.g. "Labels") to
   626  	// unconditionally include in API requests. By default, fields with
   627  	// empty values are omitted from API requests. However, any non-pointer,
   628  	// non-interface field appearing in ForceSendFields will be sent to the
   629  	// server regardless of whether the field is empty or not. This may be
   630  	// used to include empty fields in Patch requests.
   631  	ForceSendFields []string `json:"-"`
   632  }
   633  
   634  func (s *TimeseriesDescriptor) MarshalJSON() ([]byte, error) {
   635  	type noMethod TimeseriesDescriptor
   636  	raw := noMethod(*s)
   637  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   638  }
   639  
   640  type TimeseriesDescriptorLabel struct {
   641  	// Key: The label's name.
   642  	Key string `json:"key,omitempty"`
   643  
   644  	// Value: The label's value.
   645  	Value string `json:"value,omitempty"`
   646  
   647  	// ForceSendFields is a list of field names (e.g. "Key") to
   648  	// unconditionally include in API requests. By default, fields with
   649  	// empty values are omitted from API requests. However, any non-pointer,
   650  	// non-interface field appearing in ForceSendFields will be sent to the
   651  	// server regardless of whether the field is empty or not. This may be
   652  	// used to include empty fields in Patch requests.
   653  	ForceSendFields []string `json:"-"`
   654  }
   655  
   656  func (s *TimeseriesDescriptorLabel) MarshalJSON() ([]byte, error) {
   657  	type noMethod TimeseriesDescriptorLabel
   658  	raw := noMethod(*s)
   659  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   660  }
   661  
   662  // TimeseriesPoint: When writing time series, TimeseriesPoint should be
   663  // used instead of Timeseries, to enforce single point for each time
   664  // series in the timeseries.write request.
   665  type TimeseriesPoint struct {
   666  	// Point: The data point in this time series snapshot.
   667  	Point *Point `json:"point,omitempty"`
   668  
   669  	// TimeseriesDesc: The descriptor of this time series.
   670  	TimeseriesDesc *TimeseriesDescriptor `json:"timeseriesDesc,omitempty"`
   671  
   672  	// ForceSendFields is a list of field names (e.g. "Point") to
   673  	// unconditionally include in API requests. By default, fields with
   674  	// empty values are omitted from API requests. However, any non-pointer,
   675  	// non-interface field appearing in ForceSendFields will be sent to the
   676  	// server regardless of whether the field is empty or not. This may be
   677  	// used to include empty fields in Patch requests.
   678  	ForceSendFields []string `json:"-"`
   679  }
   680  
   681  func (s *TimeseriesPoint) MarshalJSON() ([]byte, error) {
   682  	type noMethod TimeseriesPoint
   683  	raw := noMethod(*s)
   684  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   685  }
   686  
   687  // WriteTimeseriesRequest: The request of
   688  // cloudmonitoring.timeseries.write
   689  type WriteTimeseriesRequest struct {
   690  	// CommonLabels: The label's name.
   691  	CommonLabels map[string]string `json:"commonLabels,omitempty"`
   692  
   693  	// Timeseries: Provide time series specific labels and the data points
   694  	// for each time series. The labels in timeseries and the common_labels
   695  	// should form a complete list of labels that required by the metric.
   696  	Timeseries []*TimeseriesPoint `json:"timeseries,omitempty"`
   697  
   698  	// ForceSendFields is a list of field names (e.g. "CommonLabels") to
   699  	// unconditionally include in API requests. By default, fields with
   700  	// empty values are omitted from API requests. However, any non-pointer,
   701  	// non-interface field appearing in ForceSendFields will be sent to the
   702  	// server regardless of whether the field is empty or not. This may be
   703  	// used to include empty fields in Patch requests.
   704  	ForceSendFields []string `json:"-"`
   705  }
   706  
   707  func (s *WriteTimeseriesRequest) MarshalJSON() ([]byte, error) {
   708  	type noMethod WriteTimeseriesRequest
   709  	raw := noMethod(*s)
   710  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   711  }
   712  
   713  // WriteTimeseriesResponse: The response of
   714  // cloudmonitoring.timeseries.write
   715  type WriteTimeseriesResponse struct {
   716  	// Kind: Identifies what kind of resource this is. Value: the fixed
   717  	// string "cloudmonitoring#writeTimeseriesResponse".
   718  	Kind string `json:"kind,omitempty"`
   719  
   720  	// ServerResponse contains the HTTP response code and headers from the
   721  	// server.
   722  	googleapi.ServerResponse `json:"-"`
   723  
   724  	// ForceSendFields is a list of field names (e.g. "Kind") to
   725  	// unconditionally include in API requests. By default, fields with
   726  	// empty values are omitted from API requests. However, any non-pointer,
   727  	// non-interface field appearing in ForceSendFields will be sent to the
   728  	// server regardless of whether the field is empty or not. This may be
   729  	// used to include empty fields in Patch requests.
   730  	ForceSendFields []string `json:"-"`
   731  }
   732  
   733  func (s *WriteTimeseriesResponse) MarshalJSON() ([]byte, error) {
   734  	type noMethod WriteTimeseriesResponse
   735  	raw := noMethod(*s)
   736  	return gensupport.MarshalJSON(raw, s.ForceSendFields)
   737  }
   738  
   739  // method id "cloudmonitoring.metricDescriptors.create":
   740  
   741  type MetricDescriptorsCreateCall struct {
   742  	s                *Service
   743  	project          string
   744  	metricdescriptor *MetricDescriptor
   745  	urlParams_       gensupport.URLParams
   746  	ctx_             context.Context
   747  }
   748  
   749  // Create: Create a new metric.
   750  func (r *MetricDescriptorsService) Create(project string, metricdescriptor *MetricDescriptor) *MetricDescriptorsCreateCall {
   751  	c := &MetricDescriptorsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   752  	c.project = project
   753  	c.metricdescriptor = metricdescriptor
   754  	return c
   755  }
   756  
   757  // QuotaUser sets the optional parameter "quotaUser": Available to use
   758  // for quota purposes for server-side applications. Can be any arbitrary
   759  // string assigned to a user, but should not exceed 40 characters.
   760  // Overrides userIp if both are provided.
   761  func (c *MetricDescriptorsCreateCall) QuotaUser(quotaUser string) *MetricDescriptorsCreateCall {
   762  	c.urlParams_.Set("quotaUser", quotaUser)
   763  	return c
   764  }
   765  
   766  // UserIP sets the optional parameter "userIp": IP address of the site
   767  // where the request originates. Use this if you want to enforce
   768  // per-user limits.
   769  func (c *MetricDescriptorsCreateCall) UserIP(userIP string) *MetricDescriptorsCreateCall {
   770  	c.urlParams_.Set("userIp", userIP)
   771  	return c
   772  }
   773  
   774  // Fields allows partial responses to be retrieved. See
   775  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   776  // for more information.
   777  func (c *MetricDescriptorsCreateCall) Fields(s ...googleapi.Field) *MetricDescriptorsCreateCall {
   778  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   779  	return c
   780  }
   781  
   782  // Context sets the context to be used in this call's Do method. Any
   783  // pending HTTP request will be aborted if the provided context is
   784  // canceled.
   785  func (c *MetricDescriptorsCreateCall) Context(ctx context.Context) *MetricDescriptorsCreateCall {
   786  	c.ctx_ = ctx
   787  	return c
   788  }
   789  
   790  func (c *MetricDescriptorsCreateCall) doRequest(alt string) (*http.Response, error) {
   791  	var body io.Reader = nil
   792  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.metricdescriptor)
   793  	if err != nil {
   794  		return nil, err
   795  	}
   796  	ctype := "application/json"
   797  	c.urlParams_.Set("alt", alt)
   798  	urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/metricDescriptors")
   799  	urls += "?" + c.urlParams_.Encode()
   800  	req, _ := http.NewRequest("POST", urls, body)
   801  	googleapi.Expand(req.URL, map[string]string{
   802  		"project": c.project,
   803  	})
   804  	req.Header.Set("Content-Type", ctype)
   805  	req.Header.Set("User-Agent", c.s.userAgent())
   806  	if c.ctx_ != nil {
   807  		return ctxhttp.Do(c.ctx_, c.s.client, req)
   808  	}
   809  	return c.s.client.Do(req)
   810  }
   811  
   812  // Do executes the "cloudmonitoring.metricDescriptors.create" call.
   813  // Exactly one of *MetricDescriptor or error will be non-nil. Any
   814  // non-2xx status code is an error. Response headers are in either
   815  // *MetricDescriptor.ServerResponse.Header or (if a response was
   816  // returned at all) in error.(*googleapi.Error).Header. Use
   817  // googleapi.IsNotModified to check whether the returned error was
   818  // because http.StatusNotModified was returned.
   819  func (c *MetricDescriptorsCreateCall) Do() (*MetricDescriptor, error) {
   820  	res, err := c.doRequest("json")
   821  	if res != nil && res.StatusCode == http.StatusNotModified {
   822  		if res.Body != nil {
   823  			res.Body.Close()
   824  		}
   825  		return nil, &googleapi.Error{
   826  			Code:   res.StatusCode,
   827  			Header: res.Header,
   828  		}
   829  	}
   830  	if err != nil {
   831  		return nil, err
   832  	}
   833  	defer googleapi.CloseBody(res)
   834  	if err := googleapi.CheckResponse(res); err != nil {
   835  		return nil, err
   836  	}
   837  	ret := &MetricDescriptor{
   838  		ServerResponse: googleapi.ServerResponse{
   839  			Header:         res.Header,
   840  			HTTPStatusCode: res.StatusCode,
   841  		},
   842  	}
   843  	if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
   844  		return nil, err
   845  	}
   846  	return ret, nil
   847  	// {
   848  	//   "description": "Create a new metric.",
   849  	//   "httpMethod": "POST",
   850  	//   "id": "cloudmonitoring.metricDescriptors.create",
   851  	//   "parameterOrder": [
   852  	//     "project"
   853  	//   ],
   854  	//   "parameters": {
   855  	//     "project": {
   856  	//       "description": "The project id. The value can be the numeric project ID or string-based project name.",
   857  	//       "location": "path",
   858  	//       "required": true,
   859  	//       "type": "string"
   860  	//     }
   861  	//   },
   862  	//   "path": "{project}/metricDescriptors",
   863  	//   "request": {
   864  	//     "$ref": "MetricDescriptor"
   865  	//   },
   866  	//   "response": {
   867  	//     "$ref": "MetricDescriptor"
   868  	//   },
   869  	//   "scopes": [
   870  	//     "https://www.googleapis.com/auth/cloud-platform",
   871  	//     "https://www.googleapis.com/auth/monitoring"
   872  	//   ]
   873  	// }
   874  
   875  }
   876  
   877  // method id "cloudmonitoring.metricDescriptors.delete":
   878  
   879  type MetricDescriptorsDeleteCall struct {
   880  	s          *Service
   881  	project    string
   882  	metric     string
   883  	urlParams_ gensupport.URLParams
   884  	ctx_       context.Context
   885  }
   886  
   887  // Delete: Delete an existing metric.
   888  func (r *MetricDescriptorsService) Delete(project string, metric string) *MetricDescriptorsDeleteCall {
   889  	c := &MetricDescriptorsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   890  	c.project = project
   891  	c.metric = metric
   892  	return c
   893  }
   894  
   895  // QuotaUser sets the optional parameter "quotaUser": Available to use
   896  // for quota purposes for server-side applications. Can be any arbitrary
   897  // string assigned to a user, but should not exceed 40 characters.
   898  // Overrides userIp if both are provided.
   899  func (c *MetricDescriptorsDeleteCall) QuotaUser(quotaUser string) *MetricDescriptorsDeleteCall {
   900  	c.urlParams_.Set("quotaUser", quotaUser)
   901  	return c
   902  }
   903  
   904  // UserIP sets the optional parameter "userIp": IP address of the site
   905  // where the request originates. Use this if you want to enforce
   906  // per-user limits.
   907  func (c *MetricDescriptorsDeleteCall) UserIP(userIP string) *MetricDescriptorsDeleteCall {
   908  	c.urlParams_.Set("userIp", userIP)
   909  	return c
   910  }
   911  
   912  // Fields allows partial responses to be retrieved. See
   913  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
   914  // for more information.
   915  func (c *MetricDescriptorsDeleteCall) Fields(s ...googleapi.Field) *MetricDescriptorsDeleteCall {
   916  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   917  	return c
   918  }
   919  
   920  // Context sets the context to be used in this call's Do method. Any
   921  // pending HTTP request will be aborted if the provided context is
   922  // canceled.
   923  func (c *MetricDescriptorsDeleteCall) Context(ctx context.Context) *MetricDescriptorsDeleteCall {
   924  	c.ctx_ = ctx
   925  	return c
   926  }
   927  
   928  func (c *MetricDescriptorsDeleteCall) doRequest(alt string) (*http.Response, error) {
   929  	var body io.Reader = nil
   930  	c.urlParams_.Set("alt", alt)
   931  	urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/metricDescriptors/{metric}")
   932  	urls += "?" + c.urlParams_.Encode()
   933  	req, _ := http.NewRequest("DELETE", urls, body)
   934  	googleapi.Expand(req.URL, map[string]string{
   935  		"project": c.project,
   936  		"metric":  c.metric,
   937  	})
   938  	req.Header.Set("User-Agent", c.s.userAgent())
   939  	if c.ctx_ != nil {
   940  		return ctxhttp.Do(c.ctx_, c.s.client, req)
   941  	}
   942  	return c.s.client.Do(req)
   943  }
   944  
   945  // Do executes the "cloudmonitoring.metricDescriptors.delete" call.
   946  // Exactly one of *DeleteMetricDescriptorResponse or error will be
   947  // non-nil. Any non-2xx status code is an error. Response headers are in
   948  // either *DeleteMetricDescriptorResponse.ServerResponse.Header or (if a
   949  // response was returned at all) in error.(*googleapi.Error).Header. Use
   950  // googleapi.IsNotModified to check whether the returned error was
   951  // because http.StatusNotModified was returned.
   952  func (c *MetricDescriptorsDeleteCall) Do() (*DeleteMetricDescriptorResponse, error) {
   953  	res, err := c.doRequest("json")
   954  	if res != nil && res.StatusCode == http.StatusNotModified {
   955  		if res.Body != nil {
   956  			res.Body.Close()
   957  		}
   958  		return nil, &googleapi.Error{
   959  			Code:   res.StatusCode,
   960  			Header: res.Header,
   961  		}
   962  	}
   963  	if err != nil {
   964  		return nil, err
   965  	}
   966  	defer googleapi.CloseBody(res)
   967  	if err := googleapi.CheckResponse(res); err != nil {
   968  		return nil, err
   969  	}
   970  	ret := &DeleteMetricDescriptorResponse{
   971  		ServerResponse: googleapi.ServerResponse{
   972  			Header:         res.Header,
   973  			HTTPStatusCode: res.StatusCode,
   974  		},
   975  	}
   976  	if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
   977  		return nil, err
   978  	}
   979  	return ret, nil
   980  	// {
   981  	//   "description": "Delete an existing metric.",
   982  	//   "httpMethod": "DELETE",
   983  	//   "id": "cloudmonitoring.metricDescriptors.delete",
   984  	//   "parameterOrder": [
   985  	//     "project",
   986  	//     "metric"
   987  	//   ],
   988  	//   "parameters": {
   989  	//     "metric": {
   990  	//       "description": "Name of the metric.",
   991  	//       "location": "path",
   992  	//       "required": true,
   993  	//       "type": "string"
   994  	//     },
   995  	//     "project": {
   996  	//       "description": "The project ID to which the metric belongs.",
   997  	//       "location": "path",
   998  	//       "required": true,
   999  	//       "type": "string"
  1000  	//     }
  1001  	//   },
  1002  	//   "path": "{project}/metricDescriptors/{metric}",
  1003  	//   "response": {
  1004  	//     "$ref": "DeleteMetricDescriptorResponse"
  1005  	//   },
  1006  	//   "scopes": [
  1007  	//     "https://www.googleapis.com/auth/cloud-platform",
  1008  	//     "https://www.googleapis.com/auth/monitoring"
  1009  	//   ]
  1010  	// }
  1011  
  1012  }
  1013  
  1014  // method id "cloudmonitoring.metricDescriptors.list":
  1015  
  1016  type MetricDescriptorsListCall struct {
  1017  	s                            *Service
  1018  	project                      string
  1019  	listmetricdescriptorsrequest *ListMetricDescriptorsRequest
  1020  	urlParams_                   gensupport.URLParams
  1021  	ifNoneMatch_                 string
  1022  	ctx_                         context.Context
  1023  }
  1024  
  1025  // List: List metric descriptors that match the query. If the query is
  1026  // not set, then all of the metric descriptors will be returned. Large
  1027  // responses will be paginated, use the nextPageToken returned in the
  1028  // response to request subsequent pages of results by setting the
  1029  // pageToken query parameter to the value of the nextPageToken.
  1030  func (r *MetricDescriptorsService) List(project string, listmetricdescriptorsrequest *ListMetricDescriptorsRequest) *MetricDescriptorsListCall {
  1031  	c := &MetricDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1032  	c.project = project
  1033  	c.listmetricdescriptorsrequest = listmetricdescriptorsrequest
  1034  	return c
  1035  }
  1036  
  1037  // Count sets the optional parameter "count": Maximum number of metric
  1038  // descriptors per page. Used for pagination. If not specified, count =
  1039  // 100.
  1040  func (c *MetricDescriptorsListCall) Count(count int64) *MetricDescriptorsListCall {
  1041  	c.urlParams_.Set("count", fmt.Sprint(count))
  1042  	return c
  1043  }
  1044  
  1045  // PageToken sets the optional parameter "pageToken": The pagination
  1046  // token, which is used to page through large result sets. Set this
  1047  // value to the value of the nextPageToken to retrieve the next page of
  1048  // results.
  1049  func (c *MetricDescriptorsListCall) PageToken(pageToken string) *MetricDescriptorsListCall {
  1050  	c.urlParams_.Set("pageToken", pageToken)
  1051  	return c
  1052  }
  1053  
  1054  // Query sets the optional parameter "query": The query used to search
  1055  // against existing metrics. Separate keywords with a space; the service
  1056  // joins all keywords with AND, meaning that all keywords must match for
  1057  // a metric to be returned. If this field is omitted, all metrics are
  1058  // returned. If an empty string is passed with this field, no metrics
  1059  // are returned.
  1060  func (c *MetricDescriptorsListCall) Query(query string) *MetricDescriptorsListCall {
  1061  	c.urlParams_.Set("query", query)
  1062  	return c
  1063  }
  1064  
  1065  // QuotaUser sets the optional parameter "quotaUser": Available to use
  1066  // for quota purposes for server-side applications. Can be any arbitrary
  1067  // string assigned to a user, but should not exceed 40 characters.
  1068  // Overrides userIp if both are provided.
  1069  func (c *MetricDescriptorsListCall) QuotaUser(quotaUser string) *MetricDescriptorsListCall {
  1070  	c.urlParams_.Set("quotaUser", quotaUser)
  1071  	return c
  1072  }
  1073  
  1074  // UserIP sets the optional parameter "userIp": IP address of the site
  1075  // where the request originates. Use this if you want to enforce
  1076  // per-user limits.
  1077  func (c *MetricDescriptorsListCall) UserIP(userIP string) *MetricDescriptorsListCall {
  1078  	c.urlParams_.Set("userIp", userIP)
  1079  	return c
  1080  }
  1081  
  1082  // Fields allows partial responses to be retrieved. See
  1083  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1084  // for more information.
  1085  func (c *MetricDescriptorsListCall) Fields(s ...googleapi.Field) *MetricDescriptorsListCall {
  1086  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1087  	return c
  1088  }
  1089  
  1090  // IfNoneMatch sets the optional parameter which makes the operation
  1091  // fail if the object's ETag matches the given value. This is useful for
  1092  // getting updates only after the object has changed since the last
  1093  // request. Use googleapi.IsNotModified to check whether the response
  1094  // error from Do is the result of In-None-Match.
  1095  func (c *MetricDescriptorsListCall) IfNoneMatch(entityTag string) *MetricDescriptorsListCall {
  1096  	c.ifNoneMatch_ = entityTag
  1097  	return c
  1098  }
  1099  
  1100  // Context sets the context to be used in this call's Do method. Any
  1101  // pending HTTP request will be aborted if the provided context is
  1102  // canceled.
  1103  func (c *MetricDescriptorsListCall) Context(ctx context.Context) *MetricDescriptorsListCall {
  1104  	c.ctx_ = ctx
  1105  	return c
  1106  }
  1107  
  1108  func (c *MetricDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  1109  	var body io.Reader = nil
  1110  	c.urlParams_.Set("alt", alt)
  1111  	urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/metricDescriptors")
  1112  	urls += "?" + c.urlParams_.Encode()
  1113  	req, _ := http.NewRequest("GET", urls, body)
  1114  	googleapi.Expand(req.URL, map[string]string{
  1115  		"project": c.project,
  1116  	})
  1117  	req.Header.Set("User-Agent", c.s.userAgent())
  1118  	if c.ifNoneMatch_ != "" {
  1119  		req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1120  	}
  1121  	if c.ctx_ != nil {
  1122  		return ctxhttp.Do(c.ctx_, c.s.client, req)
  1123  	}
  1124  	return c.s.client.Do(req)
  1125  }
  1126  
  1127  // Do executes the "cloudmonitoring.metricDescriptors.list" call.
  1128  // Exactly one of *ListMetricDescriptorsResponse or error will be
  1129  // non-nil. Any non-2xx status code is an error. Response headers are in
  1130  // either *ListMetricDescriptorsResponse.ServerResponse.Header or (if a
  1131  // response was returned at all) in error.(*googleapi.Error).Header. Use
  1132  // googleapi.IsNotModified to check whether the returned error was
  1133  // because http.StatusNotModified was returned.
  1134  func (c *MetricDescriptorsListCall) Do() (*ListMetricDescriptorsResponse, error) {
  1135  	res, err := c.doRequest("json")
  1136  	if res != nil && res.StatusCode == http.StatusNotModified {
  1137  		if res.Body != nil {
  1138  			res.Body.Close()
  1139  		}
  1140  		return nil, &googleapi.Error{
  1141  			Code:   res.StatusCode,
  1142  			Header: res.Header,
  1143  		}
  1144  	}
  1145  	if err != nil {
  1146  		return nil, err
  1147  	}
  1148  	defer googleapi.CloseBody(res)
  1149  	if err := googleapi.CheckResponse(res); err != nil {
  1150  		return nil, err
  1151  	}
  1152  	ret := &ListMetricDescriptorsResponse{
  1153  		ServerResponse: googleapi.ServerResponse{
  1154  			Header:         res.Header,
  1155  			HTTPStatusCode: res.StatusCode,
  1156  		},
  1157  	}
  1158  	if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1159  		return nil, err
  1160  	}
  1161  	return ret, nil
  1162  	// {
  1163  	//   "description": "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.",
  1164  	//   "httpMethod": "GET",
  1165  	//   "id": "cloudmonitoring.metricDescriptors.list",
  1166  	//   "parameterOrder": [
  1167  	//     "project"
  1168  	//   ],
  1169  	//   "parameters": {
  1170  	//     "count": {
  1171  	//       "default": "100",
  1172  	//       "description": "Maximum number of metric descriptors per page. Used for pagination. If not specified, count = 100.",
  1173  	//       "format": "int32",
  1174  	//       "location": "query",
  1175  	//       "maximum": "1000",
  1176  	//       "minimum": "1",
  1177  	//       "type": "integer"
  1178  	//     },
  1179  	//     "pageToken": {
  1180  	//       "description": "The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.",
  1181  	//       "location": "query",
  1182  	//       "type": "string"
  1183  	//     },
  1184  	//     "project": {
  1185  	//       "description": "The project id. The value can be the numeric project ID or string-based project name.",
  1186  	//       "location": "path",
  1187  	//       "required": true,
  1188  	//       "type": "string"
  1189  	//     },
  1190  	//     "query": {
  1191  	//       "description": "The query used to search against existing metrics. Separate keywords with a space; the service joins all keywords with AND, meaning that all keywords must match for a metric to be returned. If this field is omitted, all metrics are returned. If an empty string is passed with this field, no metrics are returned.",
  1192  	//       "location": "query",
  1193  	//       "type": "string"
  1194  	//     }
  1195  	//   },
  1196  	//   "path": "{project}/metricDescriptors",
  1197  	//   "request": {
  1198  	//     "$ref": "ListMetricDescriptorsRequest"
  1199  	//   },
  1200  	//   "response": {
  1201  	//     "$ref": "ListMetricDescriptorsResponse"
  1202  	//   },
  1203  	//   "scopes": [
  1204  	//     "https://www.googleapis.com/auth/cloud-platform",
  1205  	//     "https://www.googleapis.com/auth/monitoring"
  1206  	//   ]
  1207  	// }
  1208  
  1209  }
  1210  
  1211  // method id "cloudmonitoring.timeseries.list":
  1212  
  1213  type TimeseriesListCall struct {
  1214  	s                     *Service
  1215  	project               string
  1216  	metric                string
  1217  	listtimeseriesrequest *ListTimeseriesRequest
  1218  	urlParams_            gensupport.URLParams
  1219  	ifNoneMatch_          string
  1220  	ctx_                  context.Context
  1221  }
  1222  
  1223  // List: List the data points of the time series that match the metric
  1224  // and labels values and that have data points in the interval. Large
  1225  // responses are paginated; use the nextPageToken returned in the
  1226  // response to request subsequent pages of results by setting the
  1227  // pageToken query parameter to the value of the nextPageToken.
  1228  func (r *TimeseriesService) List(project string, metric string, youngest string, listtimeseriesrequest *ListTimeseriesRequest) *TimeseriesListCall {
  1229  	c := &TimeseriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1230  	c.project = project
  1231  	c.metric = metric
  1232  	c.urlParams_.Set("youngest", youngest)
  1233  	c.listtimeseriesrequest = listtimeseriesrequest
  1234  	return c
  1235  }
  1236  
  1237  // Aggregator sets the optional parameter "aggregator": The aggregation
  1238  // function that will reduce the data points in each window to a single
  1239  // point. This parameter is only valid for non-cumulative metrics with a
  1240  // value type of INT64 or DOUBLE.
  1241  //
  1242  // Possible values:
  1243  //   "max"
  1244  //   "mean"
  1245  //   "min"
  1246  //   "sum"
  1247  func (c *TimeseriesListCall) Aggregator(aggregator string) *TimeseriesListCall {
  1248  	c.urlParams_.Set("aggregator", aggregator)
  1249  	return c
  1250  }
  1251  
  1252  // Count sets the optional parameter "count": Maximum number of data
  1253  // points per page, which is used for pagination of results.
  1254  func (c *TimeseriesListCall) Count(count int64) *TimeseriesListCall {
  1255  	c.urlParams_.Set("count", fmt.Sprint(count))
  1256  	return c
  1257  }
  1258  
  1259  // Labels sets the optional parameter "labels": A collection of labels
  1260  // for the matching time series, which are represented as:
  1261  // - key==value: key equals the value
  1262  // - key=~value: key regex matches the value
  1263  // - key!=value: key does not equal the value
  1264  // - key!~value: key regex does not match the value  For example, to
  1265  // list all of the time series descriptors for the region us-central1,
  1266  // you could
  1267  // specify:
  1268  // label=cloud.googleapis.com%2Flocation=~us-central1.*
  1269  func (c *TimeseriesListCall) Labels(labels ...string) *TimeseriesListCall {
  1270  	c.urlParams_.SetMulti("labels", append([]string{}, labels...))
  1271  	return c
  1272  }
  1273  
  1274  // Oldest sets the optional parameter "oldest": Start of the time
  1275  // interval (exclusive), which is expressed as an RFC 3339 timestamp. If
  1276  // neither oldest nor timespan is specified, the default time interval
  1277  // will be (youngest - 4 hours, youngest]
  1278  func (c *TimeseriesListCall) Oldest(oldest string) *TimeseriesListCall {
  1279  	c.urlParams_.Set("oldest", oldest)
  1280  	return c
  1281  }
  1282  
  1283  // PageToken sets the optional parameter "pageToken": The pagination
  1284  // token, which is used to page through large result sets. Set this
  1285  // value to the value of the nextPageToken to retrieve the next page of
  1286  // results.
  1287  func (c *TimeseriesListCall) PageToken(pageToken string) *TimeseriesListCall {
  1288  	c.urlParams_.Set("pageToken", pageToken)
  1289  	return c
  1290  }
  1291  
  1292  // QuotaUser sets the optional parameter "quotaUser": Available to use
  1293  // for quota purposes for server-side applications. Can be any arbitrary
  1294  // string assigned to a user, but should not exceed 40 characters.
  1295  // Overrides userIp if both are provided.
  1296  func (c *TimeseriesListCall) QuotaUser(quotaUser string) *TimeseriesListCall {
  1297  	c.urlParams_.Set("quotaUser", quotaUser)
  1298  	return c
  1299  }
  1300  
  1301  // Timespan sets the optional parameter "timespan": Length of the time
  1302  // interval to query, which is an alternative way to declare the
  1303  // interval: (youngest - timespan, youngest]. The timespan and oldest
  1304  // parameters should not be used together. Units:
  1305  // - s: second
  1306  // - m: minute
  1307  // - h: hour
  1308  // - d: day
  1309  // - w: week  Examples: 2s, 3m, 4w. Only one unit is allowed, for
  1310  // example: 2w3d is not allowed; you should use 17d instead.
  1311  //
  1312  // If neither oldest nor timespan is specified, the default time
  1313  // interval will be (youngest - 4 hours, youngest].
  1314  func (c *TimeseriesListCall) Timespan(timespan string) *TimeseriesListCall {
  1315  	c.urlParams_.Set("timespan", timespan)
  1316  	return c
  1317  }
  1318  
  1319  // UserIP sets the optional parameter "userIp": IP address of the site
  1320  // where the request originates. Use this if you want to enforce
  1321  // per-user limits.
  1322  func (c *TimeseriesListCall) UserIP(userIP string) *TimeseriesListCall {
  1323  	c.urlParams_.Set("userIp", userIP)
  1324  	return c
  1325  }
  1326  
  1327  // Window sets the optional parameter "window": The sampling window. At
  1328  // most one data point will be returned for each window in the requested
  1329  // time interval. This parameter is only valid for non-cumulative metric
  1330  // types. Units:
  1331  // - m: minute
  1332  // - h: hour
  1333  // - d: day
  1334  // - w: week  Examples: 3m, 4w. Only one unit is allowed, for example:
  1335  // 2w3d is not allowed; you should use 17d instead.
  1336  func (c *TimeseriesListCall) Window(window string) *TimeseriesListCall {
  1337  	c.urlParams_.Set("window", window)
  1338  	return c
  1339  }
  1340  
  1341  // Fields allows partial responses to be retrieved. See
  1342  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1343  // for more information.
  1344  func (c *TimeseriesListCall) Fields(s ...googleapi.Field) *TimeseriesListCall {
  1345  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1346  	return c
  1347  }
  1348  
  1349  // IfNoneMatch sets the optional parameter which makes the operation
  1350  // fail if the object's ETag matches the given value. This is useful for
  1351  // getting updates only after the object has changed since the last
  1352  // request. Use googleapi.IsNotModified to check whether the response
  1353  // error from Do is the result of In-None-Match.
  1354  func (c *TimeseriesListCall) IfNoneMatch(entityTag string) *TimeseriesListCall {
  1355  	c.ifNoneMatch_ = entityTag
  1356  	return c
  1357  }
  1358  
  1359  // Context sets the context to be used in this call's Do method. Any
  1360  // pending HTTP request will be aborted if the provided context is
  1361  // canceled.
  1362  func (c *TimeseriesListCall) Context(ctx context.Context) *TimeseriesListCall {
  1363  	c.ctx_ = ctx
  1364  	return c
  1365  }
  1366  
  1367  func (c *TimeseriesListCall) doRequest(alt string) (*http.Response, error) {
  1368  	var body io.Reader = nil
  1369  	c.urlParams_.Set("alt", alt)
  1370  	urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/timeseries/{metric}")
  1371  	urls += "?" + c.urlParams_.Encode()
  1372  	req, _ := http.NewRequest("GET", urls, body)
  1373  	googleapi.Expand(req.URL, map[string]string{
  1374  		"project": c.project,
  1375  		"metric":  c.metric,
  1376  	})
  1377  	req.Header.Set("User-Agent", c.s.userAgent())
  1378  	if c.ifNoneMatch_ != "" {
  1379  		req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1380  	}
  1381  	if c.ctx_ != nil {
  1382  		return ctxhttp.Do(c.ctx_, c.s.client, req)
  1383  	}
  1384  	return c.s.client.Do(req)
  1385  }
  1386  
  1387  // Do executes the "cloudmonitoring.timeseries.list" call.
  1388  // Exactly one of *ListTimeseriesResponse or error will be non-nil. Any
  1389  // non-2xx status code is an error. Response headers are in either
  1390  // *ListTimeseriesResponse.ServerResponse.Header or (if a response was
  1391  // returned at all) in error.(*googleapi.Error).Header. Use
  1392  // googleapi.IsNotModified to check whether the returned error was
  1393  // because http.StatusNotModified was returned.
  1394  func (c *TimeseriesListCall) Do() (*ListTimeseriesResponse, error) {
  1395  	res, err := c.doRequest("json")
  1396  	if res != nil && res.StatusCode == http.StatusNotModified {
  1397  		if res.Body != nil {
  1398  			res.Body.Close()
  1399  		}
  1400  		return nil, &googleapi.Error{
  1401  			Code:   res.StatusCode,
  1402  			Header: res.Header,
  1403  		}
  1404  	}
  1405  	if err != nil {
  1406  		return nil, err
  1407  	}
  1408  	defer googleapi.CloseBody(res)
  1409  	if err := googleapi.CheckResponse(res); err != nil {
  1410  		return nil, err
  1411  	}
  1412  	ret := &ListTimeseriesResponse{
  1413  		ServerResponse: googleapi.ServerResponse{
  1414  			Header:         res.Header,
  1415  			HTTPStatusCode: res.StatusCode,
  1416  		},
  1417  	}
  1418  	if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1419  		return nil, err
  1420  	}
  1421  	return ret, nil
  1422  	// {
  1423  	//   "description": "List the data points of the time series that match the metric and labels values and that have data points in the interval. Large responses are 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.",
  1424  	//   "httpMethod": "GET",
  1425  	//   "id": "cloudmonitoring.timeseries.list",
  1426  	//   "parameterOrder": [
  1427  	//     "project",
  1428  	//     "metric",
  1429  	//     "youngest"
  1430  	//   ],
  1431  	//   "parameters": {
  1432  	//     "aggregator": {
  1433  	//       "description": "The aggregation function that will reduce the data points in each window to a single point. This parameter is only valid for non-cumulative metrics with a value type of INT64 or DOUBLE.",
  1434  	//       "enum": [
  1435  	//         "max",
  1436  	//         "mean",
  1437  	//         "min",
  1438  	//         "sum"
  1439  	//       ],
  1440  	//       "enumDescriptions": [
  1441  	//         "",
  1442  	//         "",
  1443  	//         "",
  1444  	//         ""
  1445  	//       ],
  1446  	//       "location": "query",
  1447  	//       "type": "string"
  1448  	//     },
  1449  	//     "count": {
  1450  	//       "default": "6000",
  1451  	//       "description": "Maximum number of data points per page, which is used for pagination of results.",
  1452  	//       "format": "int32",
  1453  	//       "location": "query",
  1454  	//       "maximum": "12000",
  1455  	//       "minimum": "1",
  1456  	//       "type": "integer"
  1457  	//     },
  1458  	//     "labels": {
  1459  	//       "description": "A collection of labels for the matching time series, which are represented as:  \n- key==value: key equals the value \n- key=~value: key regex matches the value \n- key!=value: key does not equal the value \n- key!~value: key regex does not match the value  For example, to list all of the time series descriptors for the region us-central1, you could specify:\nlabel=cloud.googleapis.com%2Flocation=~us-central1.*",
  1460  	//       "location": "query",
  1461  	//       "pattern": "(.+?)(==|=~|!=|!~)(.+)",
  1462  	//       "repeated": true,
  1463  	//       "type": "string"
  1464  	//     },
  1465  	//     "metric": {
  1466  	//       "description": "Metric names are protocol-free URLs as listed in the Supported Metrics page. For example, compute.googleapis.com/instance/disk/read_ops_count.",
  1467  	//       "location": "path",
  1468  	//       "required": true,
  1469  	//       "type": "string"
  1470  	//     },
  1471  	//     "oldest": {
  1472  	//       "description": "Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest]",
  1473  	//       "location": "query",
  1474  	//       "type": "string"
  1475  	//     },
  1476  	//     "pageToken": {
  1477  	//       "description": "The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.",
  1478  	//       "location": "query",
  1479  	//       "type": "string"
  1480  	//     },
  1481  	//     "project": {
  1482  	//       "description": "The project ID to which this time series belongs. The value can be the numeric project ID or string-based project name.",
  1483  	//       "location": "path",
  1484  	//       "required": true,
  1485  	//       "type": "string"
  1486  	//     },
  1487  	//     "timespan": {
  1488  	//       "description": "Length of the time interval to query, which is an alternative way to declare the interval: (youngest - timespan, youngest]. The timespan and oldest parameters should not be used together. Units:  \n- s: second \n- m: minute \n- h: hour \n- d: day \n- w: week  Examples: 2s, 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.\n\nIf neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest].",
  1489  	//       "location": "query",
  1490  	//       "pattern": "[0-9]+[smhdw]?",
  1491  	//       "type": "string"
  1492  	//     },
  1493  	//     "window": {
  1494  	//       "description": "The sampling window. At most one data point will be returned for each window in the requested time interval. This parameter is only valid for non-cumulative metric types. Units:  \n- m: minute \n- h: hour \n- d: day \n- w: week  Examples: 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.",
  1495  	//       "location": "query",
  1496  	//       "pattern": "[0-9]+[mhdw]?",
  1497  	//       "type": "string"
  1498  	//     },
  1499  	//     "youngest": {
  1500  	//       "description": "End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.",
  1501  	//       "location": "query",
  1502  	//       "required": true,
  1503  	//       "type": "string"
  1504  	//     }
  1505  	//   },
  1506  	//   "path": "{project}/timeseries/{metric}",
  1507  	//   "request": {
  1508  	//     "$ref": "ListTimeseriesRequest"
  1509  	//   },
  1510  	//   "response": {
  1511  	//     "$ref": "ListTimeseriesResponse"
  1512  	//   },
  1513  	//   "scopes": [
  1514  	//     "https://www.googleapis.com/auth/cloud-platform",
  1515  	//     "https://www.googleapis.com/auth/monitoring"
  1516  	//   ]
  1517  	// }
  1518  
  1519  }
  1520  
  1521  // method id "cloudmonitoring.timeseries.write":
  1522  
  1523  type TimeseriesWriteCall struct {
  1524  	s                      *Service
  1525  	project                string
  1526  	writetimeseriesrequest *WriteTimeseriesRequest
  1527  	urlParams_             gensupport.URLParams
  1528  	ctx_                   context.Context
  1529  }
  1530  
  1531  // Write: Put data points to one or more time series for one or more
  1532  // metrics. If a time series does not exist, a new time series will be
  1533  // created. It is not allowed to write a time series point that is older
  1534  // than the existing youngest point of that time series. Points that are
  1535  // older than the existing youngest point of that time series will be
  1536  // discarded silently. Therefore, users should make sure that points of
  1537  // a time series are written sequentially in the order of their end
  1538  // time.
  1539  func (r *TimeseriesService) Write(project string, writetimeseriesrequest *WriteTimeseriesRequest) *TimeseriesWriteCall {
  1540  	c := &TimeseriesWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1541  	c.project = project
  1542  	c.writetimeseriesrequest = writetimeseriesrequest
  1543  	return c
  1544  }
  1545  
  1546  // QuotaUser sets the optional parameter "quotaUser": Available to use
  1547  // for quota purposes for server-side applications. Can be any arbitrary
  1548  // string assigned to a user, but should not exceed 40 characters.
  1549  // Overrides userIp if both are provided.
  1550  func (c *TimeseriesWriteCall) QuotaUser(quotaUser string) *TimeseriesWriteCall {
  1551  	c.urlParams_.Set("quotaUser", quotaUser)
  1552  	return c
  1553  }
  1554  
  1555  // UserIP sets the optional parameter "userIp": IP address of the site
  1556  // where the request originates. Use this if you want to enforce
  1557  // per-user limits.
  1558  func (c *TimeseriesWriteCall) UserIP(userIP string) *TimeseriesWriteCall {
  1559  	c.urlParams_.Set("userIp", userIP)
  1560  	return c
  1561  }
  1562  
  1563  // Fields allows partial responses to be retrieved. See
  1564  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1565  // for more information.
  1566  func (c *TimeseriesWriteCall) Fields(s ...googleapi.Field) *TimeseriesWriteCall {
  1567  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1568  	return c
  1569  }
  1570  
  1571  // Context sets the context to be used in this call's Do method. Any
  1572  // pending HTTP request will be aborted if the provided context is
  1573  // canceled.
  1574  func (c *TimeseriesWriteCall) Context(ctx context.Context) *TimeseriesWriteCall {
  1575  	c.ctx_ = ctx
  1576  	return c
  1577  }
  1578  
  1579  func (c *TimeseriesWriteCall) doRequest(alt string) (*http.Response, error) {
  1580  	var body io.Reader = nil
  1581  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.writetimeseriesrequest)
  1582  	if err != nil {
  1583  		return nil, err
  1584  	}
  1585  	ctype := "application/json"
  1586  	c.urlParams_.Set("alt", alt)
  1587  	urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/timeseries:write")
  1588  	urls += "?" + c.urlParams_.Encode()
  1589  	req, _ := http.NewRequest("POST", urls, body)
  1590  	googleapi.Expand(req.URL, map[string]string{
  1591  		"project": c.project,
  1592  	})
  1593  	req.Header.Set("Content-Type", ctype)
  1594  	req.Header.Set("User-Agent", c.s.userAgent())
  1595  	if c.ctx_ != nil {
  1596  		return ctxhttp.Do(c.ctx_, c.s.client, req)
  1597  	}
  1598  	return c.s.client.Do(req)
  1599  }
  1600  
  1601  // Do executes the "cloudmonitoring.timeseries.write" call.
  1602  // Exactly one of *WriteTimeseriesResponse or error will be non-nil. Any
  1603  // non-2xx status code is an error. Response headers are in either
  1604  // *WriteTimeseriesResponse.ServerResponse.Header or (if a response was
  1605  // returned at all) in error.(*googleapi.Error).Header. Use
  1606  // googleapi.IsNotModified to check whether the returned error was
  1607  // because http.StatusNotModified was returned.
  1608  func (c *TimeseriesWriteCall) Do() (*WriteTimeseriesResponse, error) {
  1609  	res, err := c.doRequest("json")
  1610  	if res != nil && res.StatusCode == http.StatusNotModified {
  1611  		if res.Body != nil {
  1612  			res.Body.Close()
  1613  		}
  1614  		return nil, &googleapi.Error{
  1615  			Code:   res.StatusCode,
  1616  			Header: res.Header,
  1617  		}
  1618  	}
  1619  	if err != nil {
  1620  		return nil, err
  1621  	}
  1622  	defer googleapi.CloseBody(res)
  1623  	if err := googleapi.CheckResponse(res); err != nil {
  1624  		return nil, err
  1625  	}
  1626  	ret := &WriteTimeseriesResponse{
  1627  		ServerResponse: googleapi.ServerResponse{
  1628  			Header:         res.Header,
  1629  			HTTPStatusCode: res.StatusCode,
  1630  		},
  1631  	}
  1632  	if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1633  		return nil, err
  1634  	}
  1635  	return ret, nil
  1636  	// {
  1637  	//   "description": "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.",
  1638  	//   "httpMethod": "POST",
  1639  	//   "id": "cloudmonitoring.timeseries.write",
  1640  	//   "parameterOrder": [
  1641  	//     "project"
  1642  	//   ],
  1643  	//   "parameters": {
  1644  	//     "project": {
  1645  	//       "description": "The project ID. The value can be the numeric project ID or string-based project name.",
  1646  	//       "location": "path",
  1647  	//       "required": true,
  1648  	//       "type": "string"
  1649  	//     }
  1650  	//   },
  1651  	//   "path": "{project}/timeseries:write",
  1652  	//   "request": {
  1653  	//     "$ref": "WriteTimeseriesRequest"
  1654  	//   },
  1655  	//   "response": {
  1656  	//     "$ref": "WriteTimeseriesResponse"
  1657  	//   },
  1658  	//   "scopes": [
  1659  	//     "https://www.googleapis.com/auth/cloud-platform",
  1660  	//     "https://www.googleapis.com/auth/monitoring"
  1661  	//   ]
  1662  	// }
  1663  
  1664  }
  1665  
  1666  // method id "cloudmonitoring.timeseriesDescriptors.list":
  1667  
  1668  type TimeseriesDescriptorsListCall struct {
  1669  	s                                *Service
  1670  	project                          string
  1671  	metric                           string
  1672  	listtimeseriesdescriptorsrequest *ListTimeseriesDescriptorsRequest
  1673  	urlParams_                       gensupport.URLParams
  1674  	ifNoneMatch_                     string
  1675  	ctx_                             context.Context
  1676  }
  1677  
  1678  // List: List the descriptors of the time series that match the metric
  1679  // and labels values and that have data points in the interval. Large
  1680  // responses are paginated; use the nextPageToken returned in the
  1681  // response to request subsequent pages of results by setting the
  1682  // pageToken query parameter to the value of the nextPageToken.
  1683  func (r *TimeseriesDescriptorsService) List(project string, metric string, youngest string, listtimeseriesdescriptorsrequest *ListTimeseriesDescriptorsRequest) *TimeseriesDescriptorsListCall {
  1684  	c := &TimeseriesDescriptorsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1685  	c.project = project
  1686  	c.metric = metric
  1687  	c.urlParams_.Set("youngest", youngest)
  1688  	c.listtimeseriesdescriptorsrequest = listtimeseriesdescriptorsrequest
  1689  	return c
  1690  }
  1691  
  1692  // Aggregator sets the optional parameter "aggregator": The aggregation
  1693  // function that will reduce the data points in each window to a single
  1694  // point. This parameter is only valid for non-cumulative metrics with a
  1695  // value type of INT64 or DOUBLE.
  1696  //
  1697  // Possible values:
  1698  //   "max"
  1699  //   "mean"
  1700  //   "min"
  1701  //   "sum"
  1702  func (c *TimeseriesDescriptorsListCall) Aggregator(aggregator string) *TimeseriesDescriptorsListCall {
  1703  	c.urlParams_.Set("aggregator", aggregator)
  1704  	return c
  1705  }
  1706  
  1707  // Count sets the optional parameter "count": Maximum number of time
  1708  // series descriptors per page. Used for pagination. If not specified,
  1709  // count = 100.
  1710  func (c *TimeseriesDescriptorsListCall) Count(count int64) *TimeseriesDescriptorsListCall {
  1711  	c.urlParams_.Set("count", fmt.Sprint(count))
  1712  	return c
  1713  }
  1714  
  1715  // Labels sets the optional parameter "labels": A collection of labels
  1716  // for the matching time series, which are represented as:
  1717  // - key==value: key equals the value
  1718  // - key=~value: key regex matches the value
  1719  // - key!=value: key does not equal the value
  1720  // - key!~value: key regex does not match the value  For example, to
  1721  // list all of the time series descriptors for the region us-central1,
  1722  // you could
  1723  // specify:
  1724  // label=cloud.googleapis.com%2Flocation=~us-central1.*
  1725  func (c *TimeseriesDescriptorsListCall) Labels(labels ...string) *TimeseriesDescriptorsListCall {
  1726  	c.urlParams_.SetMulti("labels", append([]string{}, labels...))
  1727  	return c
  1728  }
  1729  
  1730  // Oldest sets the optional parameter "oldest": Start of the time
  1731  // interval (exclusive), which is expressed as an RFC 3339 timestamp. If
  1732  // neither oldest nor timespan is specified, the default time interval
  1733  // will be (youngest - 4 hours, youngest]
  1734  func (c *TimeseriesDescriptorsListCall) Oldest(oldest string) *TimeseriesDescriptorsListCall {
  1735  	c.urlParams_.Set("oldest", oldest)
  1736  	return c
  1737  }
  1738  
  1739  // PageToken sets the optional parameter "pageToken": The pagination
  1740  // token, which is used to page through large result sets. Set this
  1741  // value to the value of the nextPageToken to retrieve the next page of
  1742  // results.
  1743  func (c *TimeseriesDescriptorsListCall) PageToken(pageToken string) *TimeseriesDescriptorsListCall {
  1744  	c.urlParams_.Set("pageToken", pageToken)
  1745  	return c
  1746  }
  1747  
  1748  // QuotaUser sets the optional parameter "quotaUser": Available to use
  1749  // for quota purposes for server-side applications. Can be any arbitrary
  1750  // string assigned to a user, but should not exceed 40 characters.
  1751  // Overrides userIp if both are provided.
  1752  func (c *TimeseriesDescriptorsListCall) QuotaUser(quotaUser string) *TimeseriesDescriptorsListCall {
  1753  	c.urlParams_.Set("quotaUser", quotaUser)
  1754  	return c
  1755  }
  1756  
  1757  // Timespan sets the optional parameter "timespan": Length of the time
  1758  // interval to query, which is an alternative way to declare the
  1759  // interval: (youngest - timespan, youngest]. The timespan and oldest
  1760  // parameters should not be used together. Units:
  1761  // - s: second
  1762  // - m: minute
  1763  // - h: hour
  1764  // - d: day
  1765  // - w: week  Examples: 2s, 3m, 4w. Only one unit is allowed, for
  1766  // example: 2w3d is not allowed; you should use 17d instead.
  1767  //
  1768  // If neither oldest nor timespan is specified, the default time
  1769  // interval will be (youngest - 4 hours, youngest].
  1770  func (c *TimeseriesDescriptorsListCall) Timespan(timespan string) *TimeseriesDescriptorsListCall {
  1771  	c.urlParams_.Set("timespan", timespan)
  1772  	return c
  1773  }
  1774  
  1775  // UserIP sets the optional parameter "userIp": IP address of the site
  1776  // where the request originates. Use this if you want to enforce
  1777  // per-user limits.
  1778  func (c *TimeseriesDescriptorsListCall) UserIP(userIP string) *TimeseriesDescriptorsListCall {
  1779  	c.urlParams_.Set("userIp", userIP)
  1780  	return c
  1781  }
  1782  
  1783  // Window sets the optional parameter "window": The sampling window. At
  1784  // most one data point will be returned for each window in the requested
  1785  // time interval. This parameter is only valid for non-cumulative metric
  1786  // types. Units:
  1787  // - m: minute
  1788  // - h: hour
  1789  // - d: day
  1790  // - w: week  Examples: 3m, 4w. Only one unit is allowed, for example:
  1791  // 2w3d is not allowed; you should use 17d instead.
  1792  func (c *TimeseriesDescriptorsListCall) Window(window string) *TimeseriesDescriptorsListCall {
  1793  	c.urlParams_.Set("window", window)
  1794  	return c
  1795  }
  1796  
  1797  // Fields allows partial responses to be retrieved. See
  1798  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1799  // for more information.
  1800  func (c *TimeseriesDescriptorsListCall) Fields(s ...googleapi.Field) *TimeseriesDescriptorsListCall {
  1801  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1802  	return c
  1803  }
  1804  
  1805  // IfNoneMatch sets the optional parameter which makes the operation
  1806  // fail if the object's ETag matches the given value. This is useful for
  1807  // getting updates only after the object has changed since the last
  1808  // request. Use googleapi.IsNotModified to check whether the response
  1809  // error from Do is the result of In-None-Match.
  1810  func (c *TimeseriesDescriptorsListCall) IfNoneMatch(entityTag string) *TimeseriesDescriptorsListCall {
  1811  	c.ifNoneMatch_ = entityTag
  1812  	return c
  1813  }
  1814  
  1815  // Context sets the context to be used in this call's Do method. Any
  1816  // pending HTTP request will be aborted if the provided context is
  1817  // canceled.
  1818  func (c *TimeseriesDescriptorsListCall) Context(ctx context.Context) *TimeseriesDescriptorsListCall {
  1819  	c.ctx_ = ctx
  1820  	return c
  1821  }
  1822  
  1823  func (c *TimeseriesDescriptorsListCall) doRequest(alt string) (*http.Response, error) {
  1824  	var body io.Reader = nil
  1825  	c.urlParams_.Set("alt", alt)
  1826  	urls := googleapi.ResolveRelative(c.s.BasePath, "{project}/timeseriesDescriptors/{metric}")
  1827  	urls += "?" + c.urlParams_.Encode()
  1828  	req, _ := http.NewRequest("GET", urls, body)
  1829  	googleapi.Expand(req.URL, map[string]string{
  1830  		"project": c.project,
  1831  		"metric":  c.metric,
  1832  	})
  1833  	req.Header.Set("User-Agent", c.s.userAgent())
  1834  	if c.ifNoneMatch_ != "" {
  1835  		req.Header.Set("If-None-Match", c.ifNoneMatch_)
  1836  	}
  1837  	if c.ctx_ != nil {
  1838  		return ctxhttp.Do(c.ctx_, c.s.client, req)
  1839  	}
  1840  	return c.s.client.Do(req)
  1841  }
  1842  
  1843  // Do executes the "cloudmonitoring.timeseriesDescriptors.list" call.
  1844  // Exactly one of *ListTimeseriesDescriptorsResponse or error will be
  1845  // non-nil. Any non-2xx status code is an error. Response headers are in
  1846  // either *ListTimeseriesDescriptorsResponse.ServerResponse.Header or
  1847  // (if a response was returned at all) in
  1848  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1849  // whether the returned error was because http.StatusNotModified was
  1850  // returned.
  1851  func (c *TimeseriesDescriptorsListCall) Do() (*ListTimeseriesDescriptorsResponse, error) {
  1852  	res, err := c.doRequest("json")
  1853  	if res != nil && res.StatusCode == http.StatusNotModified {
  1854  		if res.Body != nil {
  1855  			res.Body.Close()
  1856  		}
  1857  		return nil, &googleapi.Error{
  1858  			Code:   res.StatusCode,
  1859  			Header: res.Header,
  1860  		}
  1861  	}
  1862  	if err != nil {
  1863  		return nil, err
  1864  	}
  1865  	defer googleapi.CloseBody(res)
  1866  	if err := googleapi.CheckResponse(res); err != nil {
  1867  		return nil, err
  1868  	}
  1869  	ret := &ListTimeseriesDescriptorsResponse{
  1870  		ServerResponse: googleapi.ServerResponse{
  1871  			Header:         res.Header,
  1872  			HTTPStatusCode: res.StatusCode,
  1873  		},
  1874  	}
  1875  	if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
  1876  		return nil, err
  1877  	}
  1878  	return ret, nil
  1879  	// {
  1880  	//   "description": "List the descriptors of the time series that match the metric and labels values and that have data points in the interval. Large responses are 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.",
  1881  	//   "httpMethod": "GET",
  1882  	//   "id": "cloudmonitoring.timeseriesDescriptors.list",
  1883  	//   "parameterOrder": [
  1884  	//     "project",
  1885  	//     "metric",
  1886  	//     "youngest"
  1887  	//   ],
  1888  	//   "parameters": {
  1889  	//     "aggregator": {
  1890  	//       "description": "The aggregation function that will reduce the data points in each window to a single point. This parameter is only valid for non-cumulative metrics with a value type of INT64 or DOUBLE.",
  1891  	//       "enum": [
  1892  	//         "max",
  1893  	//         "mean",
  1894  	//         "min",
  1895  	//         "sum"
  1896  	//       ],
  1897  	//       "enumDescriptions": [
  1898  	//         "",
  1899  	//         "",
  1900  	//         "",
  1901  	//         ""
  1902  	//       ],
  1903  	//       "location": "query",
  1904  	//       "type": "string"
  1905  	//     },
  1906  	//     "count": {
  1907  	//       "default": "100",
  1908  	//       "description": "Maximum number of time series descriptors per page. Used for pagination. If not specified, count = 100.",
  1909  	//       "format": "int32",
  1910  	//       "location": "query",
  1911  	//       "maximum": "1000",
  1912  	//       "minimum": "1",
  1913  	//       "type": "integer"
  1914  	//     },
  1915  	//     "labels": {
  1916  	//       "description": "A collection of labels for the matching time series, which are represented as:  \n- key==value: key equals the value \n- key=~value: key regex matches the value \n- key!=value: key does not equal the value \n- key!~value: key regex does not match the value  For example, to list all of the time series descriptors for the region us-central1, you could specify:\nlabel=cloud.googleapis.com%2Flocation=~us-central1.*",
  1917  	//       "location": "query",
  1918  	//       "pattern": "(.+?)(==|=~|!=|!~)(.+)",
  1919  	//       "repeated": true,
  1920  	//       "type": "string"
  1921  	//     },
  1922  	//     "metric": {
  1923  	//       "description": "Metric names are protocol-free URLs as listed in the Supported Metrics page. For example, compute.googleapis.com/instance/disk/read_ops_count.",
  1924  	//       "location": "path",
  1925  	//       "required": true,
  1926  	//       "type": "string"
  1927  	//     },
  1928  	//     "oldest": {
  1929  	//       "description": "Start of the time interval (exclusive), which is expressed as an RFC 3339 timestamp. If neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest]",
  1930  	//       "location": "query",
  1931  	//       "type": "string"
  1932  	//     },
  1933  	//     "pageToken": {
  1934  	//       "description": "The pagination token, which is used to page through large result sets. Set this value to the value of the nextPageToken to retrieve the next page of results.",
  1935  	//       "location": "query",
  1936  	//       "type": "string"
  1937  	//     },
  1938  	//     "project": {
  1939  	//       "description": "The project ID to which this time series belongs. The value can be the numeric project ID or string-based project name.",
  1940  	//       "location": "path",
  1941  	//       "required": true,
  1942  	//       "type": "string"
  1943  	//     },
  1944  	//     "timespan": {
  1945  	//       "description": "Length of the time interval to query, which is an alternative way to declare the interval: (youngest - timespan, youngest]. The timespan and oldest parameters should not be used together. Units:  \n- s: second \n- m: minute \n- h: hour \n- d: day \n- w: week  Examples: 2s, 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.\n\nIf neither oldest nor timespan is specified, the default time interval will be (youngest - 4 hours, youngest].",
  1946  	//       "location": "query",
  1947  	//       "pattern": "[0-9]+[smhdw]?",
  1948  	//       "type": "string"
  1949  	//     },
  1950  	//     "window": {
  1951  	//       "description": "The sampling window. At most one data point will be returned for each window in the requested time interval. This parameter is only valid for non-cumulative metric types. Units:  \n- m: minute \n- h: hour \n- d: day \n- w: week  Examples: 3m, 4w. Only one unit is allowed, for example: 2w3d is not allowed; you should use 17d instead.",
  1952  	//       "location": "query",
  1953  	//       "pattern": "[0-9]+[mhdw]?",
  1954  	//       "type": "string"
  1955  	//     },
  1956  	//     "youngest": {
  1957  	//       "description": "End of the time interval (inclusive), which is expressed as an RFC 3339 timestamp.",
  1958  	//       "location": "query",
  1959  	//       "required": true,
  1960  	//       "type": "string"
  1961  	//     }
  1962  	//   },
  1963  	//   "path": "{project}/timeseriesDescriptors/{metric}",
  1964  	//   "request": {
  1965  	//     "$ref": "ListTimeseriesDescriptorsRequest"
  1966  	//   },
  1967  	//   "response": {
  1968  	//     "$ref": "ListTimeseriesDescriptorsResponse"
  1969  	//   },
  1970  	//   "scopes": [
  1971  	//     "https://www.googleapis.com/auth/cloud-platform",
  1972  	//     "https://www.googleapis.com/auth/monitoring"
  1973  	//   ]
  1974  	// }
  1975  
  1976  }