blob: f9ce18fca2bfb31977de74e4ae9ddaba7883565b [file] [log] [blame]
// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Code generated file. DO NOT EDIT.
// Package monitoring provides access to the Stackdriver Monitoring API.
//
// This package is DEPRECATED. Use package cloud.google.com/go/monitoring/apiv3 instead.
//
// For product documentation, see: https://cloud.google.com/monitoring/api/
//
// Creating a client
//
// Usage example:
//
// import "google.golang.org/api/monitoring/v1"
// ...
// ctx := context.Background()
// monitoringService, err := monitoring.NewService(ctx)
//
// In this example, Google Application Default Credentials are used for authentication.
//
// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
//
// Other authentication options
//
// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
//
// monitoringService, err := monitoring.NewService(ctx, option.WithAPIKey("AIza..."))
//
// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
//
// config := &oauth2.Config{...}
// // ...
// token, err := config.Exchange(ctx, ...)
// monitoringService, err := monitoring.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
//
// See https://godoc.org/google.golang.org/api/option/ for details on options.
package monitoring // import "google.golang.org/api/monitoring/v1"
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
googleapi "google.golang.org/api/googleapi"
gensupport "google.golang.org/api/internal/gensupport"
option "google.golang.org/api/option"
htransport "google.golang.org/api/transport/http"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = gensupport.MarshalJSON
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
var _ = context.Canceled
const apiId = "monitoring:v1"
const apiName = "monitoring"
const apiVersion = "v1"
const basePath = "https://monitoring.googleapis.com/"
// NewService creates a new Service.
func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
client, endpoint, err := htransport.NewClient(ctx, opts...)
if err != nil {
return nil, err
}
s, err := New(client)
if err != nil {
return nil, err
}
if endpoint != "" {
s.BasePath = endpoint
}
return s, nil
}
// New creates a new Service. It uses the provided http.Client for requests.
//
// Deprecated: please use NewService instead.
// To provide a custom HTTP client, use option.WithHTTPClient.
// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
UserAgent string // optional additional User-Agent fragment
}
func (s *Service) userAgent() string {
if s.UserAgent == "" {
return googleapi.UserAgent
}
return googleapi.UserAgent + " " + s.UserAgent
}
// DroppedLabels: A set of (label, value) pairs which were dropped
// during aggregation, attached to google.api.Distribution.Exemplars in
// google.api.Distribution values during aggregation.These values are
// used in combination with the label values that remain on the
// aggregated Distribution timeseries to construct the full label set
// for the exemplar values. The resulting full label set may be used to
// identify the specific task/job/instance (for example) which may be
// contributing to a long-tail, while allowing the storage savings of
// only storing aggregated distribution values for a large group.Note
// that there are no guarantees on ordering of the labels from
// exemplar-to-exemplar and from distribution-to-distribution in the
// same stream, and there may be duplicates. It is up to clients to
// resolve any ambiguities.
type DroppedLabels struct {
// Label: Map from label to its value, for all labels dropped in any
// aggregation.
Label map[string]string `json:"label,omitempty"`
// ForceSendFields is a list of field names (e.g. "Label") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Label") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *DroppedLabels) MarshalJSON() ([]byte, error) {
type NoMethod DroppedLabels
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Field: A single field of a message type.
type Field struct {
// Cardinality: The field cardinality.
//
// Possible values:
// "CARDINALITY_UNKNOWN" - For fields with unknown cardinality.
// "CARDINALITY_OPTIONAL" - For optional fields.
// "CARDINALITY_REQUIRED" - For required fields. Proto2 syntax only.
// "CARDINALITY_REPEATED" - For repeated fields.
Cardinality string `json:"cardinality,omitempty"`
// DefaultValue: The string value of the default value of this field.
// Proto2 syntax only.
DefaultValue string `json:"defaultValue,omitempty"`
// JsonName: The field JSON name.
JsonName string `json:"jsonName,omitempty"`
// Kind: The field type.
//
// Possible values:
// "TYPE_UNKNOWN" - Field type unknown.
// "TYPE_DOUBLE" - Field type double.
// "TYPE_FLOAT" - Field type float.
// "TYPE_INT64" - Field type int64.
// "TYPE_UINT64" - Field type uint64.
// "TYPE_INT32" - Field type int32.
// "TYPE_FIXED64" - Field type fixed64.
// "TYPE_FIXED32" - Field type fixed32.
// "TYPE_BOOL" - Field type bool.
// "TYPE_STRING" - Field type string.
// "TYPE_GROUP" - Field type group. Proto2 syntax only, and
// deprecated.
// "TYPE_MESSAGE" - Field type message.
// "TYPE_BYTES" - Field type bytes.
// "TYPE_UINT32" - Field type uint32.
// "TYPE_ENUM" - Field type enum.
// "TYPE_SFIXED32" - Field type sfixed32.
// "TYPE_SFIXED64" - Field type sfixed64.
// "TYPE_SINT32" - Field type sint32.
// "TYPE_SINT64" - Field type sint64.
Kind string `json:"kind,omitempty"`
// Name: The field name.
Name string `json:"name,omitempty"`
// Number: The field number.
Number int64 `json:"number,omitempty"`
// OneofIndex: The index of the field type in Type.oneofs, for message
// or enumeration types. The first type has index 1; zero means the type
// is not in the list.
OneofIndex int64 `json:"oneofIndex,omitempty"`
// Options: The protocol buffer options.
Options []*Option `json:"options,omitempty"`
// Packed: Whether to use alternative packed wire representation.
Packed bool `json:"packed,omitempty"`
// TypeUrl: The field type URL, without the scheme, for message or
// enumeration types. Example:
// "type.googleapis.com/google.protobuf.Timestamp".
TypeUrl string `json:"typeUrl,omitempty"`
// ForceSendFields is a list of field names (e.g. "Cardinality") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Cardinality") to include
// in API requests with the JSON null value. By default, fields with
// empty values are omitted from API requests. However, any field with
// an empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Field) MarshalJSON() ([]byte, error) {
type NoMethod Field
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Option: A protocol buffer option, which can be attached to a message,
// field, enumeration, etc.
type Option struct {
// Name: The option's name. For protobuf built-in options (options
// defined in descriptor.proto), this is the short name. For example,
// "map_entry". For custom options, it should be the fully-qualified
// name. For example, "google.api.http".
Name string `json:"name,omitempty"`
// Value: The option's value packed in an Any message. If the value is a
// primitive, the corresponding wrapper type defined in
// google/protobuf/wrappers.proto should be used. If the value is an
// enum, it should be stored as an int32 value using the
// google.protobuf.Int32Value type.
Value googleapi.RawMessage `json:"value,omitempty"`
// ForceSendFields is a list of field names (e.g. "Name") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Name") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Option) MarshalJSON() ([]byte, error) {
type NoMethod Option
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// SourceContext: SourceContext represents information about the source
// of a protobuf element, like the file in which it is defined.
type SourceContext struct {
// FileName: The path-qualified name of the .proto file that contained
// the associated protobuf element. For example:
// "google/protobuf/source_context.proto".
FileName string `json:"fileName,omitempty"`
// ForceSendFields is a list of field names (e.g. "FileName") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "FileName") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *SourceContext) MarshalJSON() ([]byte, error) {
type NoMethod SourceContext
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// SpanContext: The context of a span, attached to
// google.api.Distribution.Exemplars in google.api.Distribution values
// during aggregation.It contains the name of a span with format:
// projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID
type SpanContext struct {
// SpanName: The resource name of the span in the following
// format:
// projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]
// TRACE_
// ID is a unique identifier for a trace within a project; it is a
// 32-character hexadecimal encoding of a 16-byte array.SPAN_ID is a
// unique identifier for a span within a trace; it is a 16-character
// hexadecimal encoding of an 8-byte array.
SpanName string `json:"spanName,omitempty"`
// ForceSendFields is a list of field names (e.g. "SpanName") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "SpanName") to include in
// API requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *SpanContext) MarshalJSON() ([]byte, error) {
type NoMethod SpanContext
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}
// Type: A protocol buffer message type.
type Type struct {
// Fields: The list of fields.
Fields []*Field `json:"fields,omitempty"`
// Name: The fully qualified message name.
Name string `json:"name,omitempty"`
// Oneofs: The list of types appearing in oneof definitions in this
// type.
Oneofs []string `json:"oneofs,omitempty"`
// Options: The protocol buffer options.
Options []*Option `json:"options,omitempty"`
// SourceContext: The source context.
SourceContext *SourceContext `json:"sourceContext,omitempty"`
// Syntax: The source syntax.
//
// Possible values:
// "SYNTAX_PROTO2" - Syntax proto2.
// "SYNTAX_PROTO3" - Syntax proto3.
Syntax string `json:"syntax,omitempty"`
// ForceSendFields is a list of field names (e.g. "Fields") to
// unconditionally include in API requests. By default, fields with
// empty values are omitted from API requests. However, any non-pointer,
// non-interface field appearing in ForceSendFields will be sent to the
// server regardless of whether the field is empty or not. This may be
// used to include empty fields in Patch requests.
ForceSendFields []string `json:"-"`
// NullFields is a list of field names (e.g. "Fields") to include in API
// requests with the JSON null value. By default, fields with empty
// values are omitted from API requests. However, any field with an
// empty value appearing in NullFields will be sent to the server as
// null. It is an error if a field in this list has a non-empty value.
// This may be used to include null fields in Patch requests.
NullFields []string `json:"-"`
}
func (s *Type) MarshalJSON() ([]byte, error) {
type NoMethod Type
raw := NoMethod(*s)
return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
}