...

Source file src/google.golang.org/api/tracing/v2/tracing-gen.go

Documentation: google.golang.org/api/tracing/v2

     1  // Copyright 2020 Google LLC.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package tracing provides access to the Google Tracing API.
     8  //
     9  // For product documentation, see: https://cloud.google.com/trace
    10  //
    11  // # Creating a client
    12  //
    13  // Usage example:
    14  //
    15  //	import "google.golang.org/api/tracing/v2"
    16  //	...
    17  //	ctx := context.Background()
    18  //	tracingService, err := tracing.NewService(ctx)
    19  //
    20  // In this example, Google Application Default Credentials are used for authentication.
    21  //
    22  // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    23  //
    24  // # Other authentication options
    25  //
    26  // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
    27  //
    28  //	tracingService, err := tracing.NewService(ctx, option.WithScopes(tracing.TraceReadonlyScope))
    29  //
    30  // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
    31  //
    32  //	tracingService, err := tracing.NewService(ctx, option.WithAPIKey("AIza..."))
    33  //
    34  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
    35  //
    36  //	config := &oauth2.Config{...}
    37  //	// ...
    38  //	token, err := config.Exchange(ctx, ...)
    39  //	tracingService, err := tracing.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    40  //
    41  // See https://godoc.org/google.golang.org/api/option/ for details on options.
    42  package tracing // import "google.golang.org/api/tracing/v2"
    43  
    44  import (
    45  	"bytes"
    46  	"context"
    47  	"encoding/json"
    48  	"errors"
    49  	"fmt"
    50  	"io"
    51  	"net/http"
    52  	"net/url"
    53  	"strconv"
    54  	"strings"
    55  
    56  	googleapi "google.golang.org/api/googleapi"
    57  	gensupport "google.golang.org/api/internal/gensupport"
    58  	option "google.golang.org/api/option"
    59  	htransport "google.golang.org/api/transport/http"
    60  )
    61  
    62  // Always reference these packages, just in case the auto-generated code
    63  // below doesn't.
    64  var _ = bytes.NewBuffer
    65  var _ = strconv.Itoa
    66  var _ = fmt.Sprintf
    67  var _ = json.NewDecoder
    68  var _ = io.Copy
    69  var _ = url.Parse
    70  var _ = gensupport.MarshalJSON
    71  var _ = googleapi.Version
    72  var _ = errors.New
    73  var _ = strings.Replace
    74  var _ = context.Canceled
    75  
    76  const apiId = "tracing:v2"
    77  const apiName = "tracing"
    78  const apiVersion = "v2"
    79  const basePath = "https://tracing.googleapis.com/"
    80  
    81  // OAuth2 scopes used by this API.
    82  const (
    83  	// View and manage your data across Google Cloud Platform services
    84  	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
    85  
    86  	// Write Trace data for a project or application
    87  	TraceAppendScope = "https://www.googleapis.com/auth/trace.append"
    88  
    89  	// Read Trace data for a project or application
    90  	TraceReadonlyScope = "https://www.googleapis.com/auth/trace.readonly"
    91  )
    92  
    93  // NewService creates a new Service.
    94  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
    95  	scopesOption := option.WithScopes(
    96  		"https://www.googleapis.com/auth/cloud-platform",
    97  		"https://www.googleapis.com/auth/trace.append",
    98  		"https://www.googleapis.com/auth/trace.readonly",
    99  	)
   100  	// NOTE: prepend, so we don't override user-specified scopes.
   101  	opts = append([]option.ClientOption{scopesOption}, opts...)
   102  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   103  	if err != nil {
   104  		return nil, err
   105  	}
   106  	s, err := New(client)
   107  	if err != nil {
   108  		return nil, err
   109  	}
   110  	if endpoint != "" {
   111  		s.BasePath = endpoint
   112  	}
   113  	return s, nil
   114  }
   115  
   116  // New creates a new Service. It uses the provided http.Client for requests.
   117  //
   118  // Deprecated: please use NewService instead.
   119  // To provide a custom HTTP client, use option.WithHTTPClient.
   120  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   121  func New(client *http.Client) (*Service, error) {
   122  	if client == nil {
   123  		return nil, errors.New("client is nil")
   124  	}
   125  	s := &Service{client: client, BasePath: basePath}
   126  	s.Projects = NewProjectsService(s)
   127  	return s, nil
   128  }
   129  
   130  type Service struct {
   131  	client    *http.Client
   132  	BasePath  string // API endpoint base URL
   133  	UserAgent string // optional additional User-Agent fragment
   134  
   135  	Projects *ProjectsService
   136  }
   137  
   138  func (s *Service) userAgent() string {
   139  	if s.UserAgent == "" {
   140  		return googleapi.UserAgent
   141  	}
   142  	return googleapi.UserAgent + " " + s.UserAgent
   143  }
   144  
   145  func NewProjectsService(s *Service) *ProjectsService {
   146  	rs := &ProjectsService{s: s}
   147  	rs.Traces = NewProjectsTracesService(s)
   148  	return rs
   149  }
   150  
   151  type ProjectsService struct {
   152  	s *Service
   153  
   154  	Traces *ProjectsTracesService
   155  }
   156  
   157  func NewProjectsTracesService(s *Service) *ProjectsTracesService {
   158  	rs := &ProjectsTracesService{s: s}
   159  	rs.Spans = NewProjectsTracesSpansService(s)
   160  	return rs
   161  }
   162  
   163  type ProjectsTracesService struct {
   164  	s *Service
   165  
   166  	Spans *ProjectsTracesSpansService
   167  }
   168  
   169  func NewProjectsTracesSpansService(s *Service) *ProjectsTracesSpansService {
   170  	rs := &ProjectsTracesSpansService{s: s}
   171  	return rs
   172  }
   173  
   174  type ProjectsTracesSpansService struct {
   175  	s *Service
   176  }
   177  
   178  // Annotation: Text annotation with a set of attributes. A maximum of 32
   179  // annotations are
   180  // allowed per Span.
   181  type Annotation struct {
   182  	// Attributes: A set of attributes on the annotation. A maximum of 4
   183  	// attributes are
   184  	// allowed per Annotation.
   185  	Attributes *Attributes `json:"attributes,omitempty"`
   186  
   187  	// Description: A user-supplied message describing the event. The
   188  	// maximum length for
   189  	// the description is 256 bytes.
   190  	Description *TruncatableString `json:"description,omitempty"`
   191  
   192  	// ForceSendFields is a list of field names (e.g. "Attributes") to
   193  	// unconditionally include in API requests. By default, fields with
   194  	// empty values are omitted from API requests. However, any non-pointer,
   195  	// non-interface field appearing in ForceSendFields will be sent to the
   196  	// server regardless of whether the field is empty or not. This may be
   197  	// used to include empty fields in Patch requests.
   198  	ForceSendFields []string `json:"-"`
   199  
   200  	// NullFields is a list of field names (e.g. "Attributes") to include in
   201  	// API requests with the JSON null value. By default, fields with empty
   202  	// values are omitted from API requests. However, any field with an
   203  	// empty value appearing in NullFields will be sent to the server as
   204  	// null. It is an error if a field in this list has a non-empty value.
   205  	// This may be used to include null fields in Patch requests.
   206  	NullFields []string `json:"-"`
   207  }
   208  
   209  func (s *Annotation) MarshalJSON() ([]byte, error) {
   210  	type NoMethod Annotation
   211  	raw := NoMethod(*s)
   212  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   213  }
   214  
   215  // AttributeValue: The allowed types for the value side of an attribute
   216  // key:value pair.
   217  type AttributeValue struct {
   218  	// BoolValue: A boolean value.
   219  	BoolValue bool `json:"boolValue,omitempty"`
   220  
   221  	// IntValue: An integer value.
   222  	IntValue int64 `json:"intValue,omitempty,string"`
   223  
   224  	// StringValue: A string value (up to 256 bytes).
   225  	StringValue *TruncatableString `json:"stringValue,omitempty"`
   226  
   227  	// ForceSendFields is a list of field names (e.g. "BoolValue") to
   228  	// unconditionally include in API requests. By default, fields with
   229  	// empty values are omitted from API requests. However, any non-pointer,
   230  	// non-interface field appearing in ForceSendFields will be sent to the
   231  	// server regardless of whether the field is empty or not. This may be
   232  	// used to include empty fields in Patch requests.
   233  	ForceSendFields []string `json:"-"`
   234  
   235  	// NullFields is a list of field names (e.g. "BoolValue") to include in
   236  	// API requests with the JSON null value. By default, fields with empty
   237  	// values are omitted from API requests. However, any field with an
   238  	// empty value appearing in NullFields will be sent to the server as
   239  	// null. It is an error if a field in this list has a non-empty value.
   240  	// This may be used to include null fields in Patch requests.
   241  	NullFields []string `json:"-"`
   242  }
   243  
   244  func (s *AttributeValue) MarshalJSON() ([]byte, error) {
   245  	type NoMethod AttributeValue
   246  	raw := NoMethod(*s)
   247  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   248  }
   249  
   250  // Attributes: Attributes of a span with a key:value format.
   251  type Attributes struct {
   252  	// AttributeMap: The maximum key length is 128 bytes (attributes are
   253  	// dropped if the
   254  	// key size is larger than the maximum allowed). The value can be a
   255  	// string
   256  	// (up to 256 bytes), integer, or boolean (true/false). Some common
   257  	// pair
   258  	// examples:
   259  	//
   260  	//     "/instance_id": "my-instance"
   261  	//     "/zone": "us-central1-a"
   262  	//     "/grpc/peer_address": "ip:port" (dns, etc.)
   263  	//     "/grpc/deadline": "Duration"
   264  	//     "/http/user_agent"
   265  	//     "/http/request_bytes": 300
   266  	//     "/http/response_bytes": 1200
   267  	//     "/http/url": google.com/apis
   268  	//     "abc.com/myattribute": true
   269  	AttributeMap map[string]AttributeValue `json:"attributeMap,omitempty"`
   270  
   271  	// DroppedAttributesCount: The number of dropped attributes after the
   272  	// maximum size was enforced. If
   273  	// 0 then no attributes were dropped.
   274  	DroppedAttributesCount int64 `json:"droppedAttributesCount,omitempty"`
   275  
   276  	// ForceSendFields is a list of field names (e.g. "AttributeMap") to
   277  	// unconditionally include in API requests. By default, fields with
   278  	// empty values are omitted from API requests. However, any non-pointer,
   279  	// non-interface field appearing in ForceSendFields will be sent to the
   280  	// server regardless of whether the field is empty or not. This may be
   281  	// used to include empty fields in Patch requests.
   282  	ForceSendFields []string `json:"-"`
   283  
   284  	// NullFields is a list of field names (e.g. "AttributeMap") to include
   285  	// in API requests with the JSON null value. By default, fields with
   286  	// empty values are omitted from API requests. However, any field with
   287  	// an empty value appearing in NullFields will be sent to the server as
   288  	// null. It is an error if a field in this list has a non-empty value.
   289  	// This may be used to include null fields in Patch requests.
   290  	NullFields []string `json:"-"`
   291  }
   292  
   293  func (s *Attributes) MarshalJSON() ([]byte, error) {
   294  	type NoMethod Attributes
   295  	raw := NoMethod(*s)
   296  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   297  }
   298  
   299  // BatchWriteSpansRequest: The request message for the `BatchWriteSpans`
   300  // method.
   301  type BatchWriteSpansRequest struct {
   302  	// Spans: A collection of spans.
   303  	Spans []*Span `json:"spans,omitempty"`
   304  
   305  	// ForceSendFields is a list of field names (e.g. "Spans") to
   306  	// unconditionally include in API requests. By default, fields with
   307  	// empty values are omitted from API requests. However, any non-pointer,
   308  	// non-interface field appearing in ForceSendFields will be sent to the
   309  	// server regardless of whether the field is empty or not. This may be
   310  	// used to include empty fields in Patch requests.
   311  	ForceSendFields []string `json:"-"`
   312  
   313  	// NullFields is a list of field names (e.g. "Spans") to include in API
   314  	// requests with the JSON null value. By default, fields with empty
   315  	// values are omitted from API requests. However, any field with an
   316  	// empty value appearing in NullFields will be sent to the server as
   317  	// null. It is an error if a field in this list has a non-empty value.
   318  	// This may be used to include null fields in Patch requests.
   319  	NullFields []string `json:"-"`
   320  }
   321  
   322  func (s *BatchWriteSpansRequest) MarshalJSON() ([]byte, error) {
   323  	type NoMethod BatchWriteSpansRequest
   324  	raw := NoMethod(*s)
   325  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   326  }
   327  
   328  // Empty: A generic empty message that you can re-use to avoid defining
   329  // duplicated
   330  // empty messages in your APIs. A typical example is to use it as the
   331  // request
   332  // or the response type of an API method. For instance:
   333  //
   334  //	service Foo {
   335  //	  rpc Bar(google.protobuf.Empty) returns
   336  //
   337  // (google.protobuf.Empty);
   338  //
   339  //	}
   340  //
   341  // The JSON representation for `Empty` is empty JSON object `{}`.
   342  type Empty struct {
   343  	// ServerResponse contains the HTTP response code and headers from the
   344  	// server.
   345  	googleapi.ServerResponse `json:"-"`
   346  }
   347  
   348  // Link: A pointer from this span to another span in a different `Trace`
   349  // within
   350  // the same service project or within a different service project.
   351  // Used
   352  // (for example) in batching operations, where a single batch
   353  // handler
   354  // processes multiple requests from different traces or when receives
   355  // a
   356  // request from a different service project.
   357  type Link struct {
   358  	// SpanId: `SPAN_ID` is a unique identifier for a span within a trace.
   359  	// It is a
   360  	// base16-encoded, case-insensitive string of a 8-bytes array and
   361  	// is
   362  	// required to be 16 char long.
   363  	SpanId string `json:"spanId,omitempty"`
   364  
   365  	// TraceId: `TRACE_ID` is a unique identifier for a trace within a
   366  	// project. It is
   367  	// a base16-encoded, case-insensitive string of a 16-bytes array and
   368  	// is
   369  	// required to be 32 char long.
   370  	TraceId string `json:"traceId,omitempty"`
   371  
   372  	// Type: The relationship of the current span relative to the linked
   373  	// span.
   374  	//
   375  	// Possible values:
   376  	//   "TYPE_UNSPECIFIED" - The relationship of the two spans is unknown.
   377  	//   "CHILD" - The current span is a child of the linked span.
   378  	//   "PARENT" - The current span is the parent of the linked span.
   379  	Type string `json:"type,omitempty"`
   380  
   381  	// ForceSendFields is a list of field names (e.g. "SpanId") to
   382  	// unconditionally include in API requests. By default, fields with
   383  	// empty values are omitted from API requests. However, any non-pointer,
   384  	// non-interface field appearing in ForceSendFields will be sent to the
   385  	// server regardless of whether the field is empty or not. This may be
   386  	// used to include empty fields in Patch requests.
   387  	ForceSendFields []string `json:"-"`
   388  
   389  	// NullFields is a list of field names (e.g. "SpanId") to include in API
   390  	// requests with the JSON null value. By default, fields with empty
   391  	// values are omitted from API requests. However, any field with an
   392  	// empty value appearing in NullFields will be sent to the server as
   393  	// null. It is an error if a field in this list has a non-empty value.
   394  	// This may be used to include null fields in Patch requests.
   395  	NullFields []string `json:"-"`
   396  }
   397  
   398  func (s *Link) MarshalJSON() ([]byte, error) {
   399  	type NoMethod Link
   400  	raw := NoMethod(*s)
   401  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   402  }
   403  
   404  // Links: A collection of links, which are references from this span to
   405  // a span
   406  // in the same or different trace.
   407  type Links struct {
   408  	// DroppedLinksCount: The number of dropped links after the maximum size
   409  	// was enforced. If
   410  	// 0 then no links were dropped.
   411  	DroppedLinksCount int64 `json:"droppedLinksCount,omitempty"`
   412  
   413  	// Link: A collection of links.
   414  	Link []*Link `json:"link,omitempty"`
   415  
   416  	// ForceSendFields is a list of field names (e.g. "DroppedLinksCount")
   417  	// to unconditionally include in API requests. By default, fields with
   418  	// empty values are omitted from API requests. However, any non-pointer,
   419  	// non-interface field appearing in ForceSendFields will be sent to the
   420  	// server regardless of whether the field is empty or not. This may be
   421  	// used to include empty fields in Patch requests.
   422  	ForceSendFields []string `json:"-"`
   423  
   424  	// NullFields is a list of field names (e.g. "DroppedLinksCount") to
   425  	// include in API requests with the JSON null value. By default, fields
   426  	// with empty values are omitted from API requests. However, any field
   427  	// with an empty value appearing in NullFields will be sent to the
   428  	// server as null. It is an error if a field in this list has a
   429  	// non-empty value. This may be used to include null fields in Patch
   430  	// requests.
   431  	NullFields []string `json:"-"`
   432  }
   433  
   434  func (s *Links) MarshalJSON() ([]byte, error) {
   435  	type NoMethod Links
   436  	raw := NoMethod(*s)
   437  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   438  }
   439  
   440  // ListSpansResponse: The response message for the `ListSpans` method.
   441  type ListSpansResponse struct {
   442  	// NextPageToken: If defined, indicates that there are more spans that
   443  	// match the request.
   444  	// Pass this as the value of `pageToken` in a subsequent request to
   445  	// retrieve
   446  	// additional spans.
   447  	NextPageToken string `json:"nextPageToken,omitempty"`
   448  
   449  	// Spans: The requested spans if there are any in the specified trace.
   450  	Spans []*Span `json:"spans,omitempty"`
   451  
   452  	// ServerResponse contains the HTTP response code and headers from the
   453  	// server.
   454  	googleapi.ServerResponse `json:"-"`
   455  
   456  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   457  	// unconditionally include in API requests. By default, fields with
   458  	// empty values are omitted from API requests. However, any non-pointer,
   459  	// non-interface field appearing in ForceSendFields will be sent to the
   460  	// server regardless of whether the field is empty or not. This may be
   461  	// used to include empty fields in Patch requests.
   462  	ForceSendFields []string `json:"-"`
   463  
   464  	// NullFields is a list of field names (e.g. "NextPageToken") to include
   465  	// in API requests with the JSON null value. By default, fields with
   466  	// empty values are omitted from API requests. However, any field with
   467  	// an empty value appearing in NullFields will be sent to the server as
   468  	// null. It is an error if a field in this list has a non-empty value.
   469  	// This may be used to include null fields in Patch requests.
   470  	NullFields []string `json:"-"`
   471  }
   472  
   473  func (s *ListSpansResponse) MarshalJSON() ([]byte, error) {
   474  	type NoMethod ListSpansResponse
   475  	raw := NoMethod(*s)
   476  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   477  }
   478  
   479  // ListTracesResponse: The response message for the `ListTraces` method.
   480  type ListTracesResponse struct {
   481  	// NextPageToken: If defined, indicates that there are more traces that
   482  	// match the request
   483  	// and that this value should be passed to the next request to
   484  	// continue
   485  	// retrieving additional traces.
   486  	NextPageToken string `json:"nextPageToken,omitempty"`
   487  
   488  	// Traces: List of trace records returned.
   489  	Traces []*Trace `json:"traces,omitempty"`
   490  
   491  	// ServerResponse contains the HTTP response code and headers from the
   492  	// server.
   493  	googleapi.ServerResponse `json:"-"`
   494  
   495  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
   496  	// unconditionally include in API requests. By default, fields with
   497  	// empty values are omitted from API requests. However, any non-pointer,
   498  	// non-interface field appearing in ForceSendFields will be sent to the
   499  	// server regardless of whether the field is empty or not. This may be
   500  	// used to include empty fields in Patch requests.
   501  	ForceSendFields []string `json:"-"`
   502  
   503  	// NullFields is a list of field names (e.g. "NextPageToken") to include
   504  	// in API requests with the JSON null value. By default, fields with
   505  	// empty values are omitted from API requests. However, any field with
   506  	// an empty value appearing in NullFields will be sent to the server as
   507  	// null. It is an error if a field in this list has a non-empty value.
   508  	// This may be used to include null fields in Patch requests.
   509  	NullFields []string `json:"-"`
   510  }
   511  
   512  func (s *ListTracesResponse) MarshalJSON() ([]byte, error) {
   513  	type NoMethod ListTracesResponse
   514  	raw := NoMethod(*s)
   515  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   516  }
   517  
   518  // Module: Binary module.
   519  type Module struct {
   520  	// BuildId: Build_id is a unique identifier for the module, usually a
   521  	// hash of its
   522  	// contents (up to 128 characters).
   523  	BuildId *TruncatableString `json:"buildId,omitempty"`
   524  
   525  	// Module: E.g. main binary, kernel modules, and dynamic libraries
   526  	// such as libc.so, sharedlib.so (up to 256 characters).
   527  	Module *TruncatableString `json:"module,omitempty"`
   528  
   529  	// ForceSendFields is a list of field names (e.g. "BuildId") to
   530  	// unconditionally include in API requests. By default, fields with
   531  	// empty values are omitted from API requests. However, any non-pointer,
   532  	// non-interface field appearing in ForceSendFields will be sent to the
   533  	// server regardless of whether the field is empty or not. This may be
   534  	// used to include empty fields in Patch requests.
   535  	ForceSendFields []string `json:"-"`
   536  
   537  	// NullFields is a list of field names (e.g. "BuildId") to include in
   538  	// API requests with the JSON null value. By default, fields with empty
   539  	// values are omitted from API requests. However, any field with an
   540  	// empty value appearing in NullFields will be sent to the server as
   541  	// null. It is an error if a field in this list has a non-empty value.
   542  	// This may be used to include null fields in Patch requests.
   543  	NullFields []string `json:"-"`
   544  }
   545  
   546  func (s *Module) MarshalJSON() ([]byte, error) {
   547  	type NoMethod Module
   548  	raw := NoMethod(*s)
   549  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   550  }
   551  
   552  // NetworkEvent: An event describing an RPC message sent/received on the
   553  // network. A
   554  // maximum of 128 network events are allowed per Span.
   555  type NetworkEvent struct {
   556  	// MessageId: An identifier for the message, which must be unique in
   557  	// this span.
   558  	MessageId uint64 `json:"messageId,omitempty,string"`
   559  
   560  	// MessageSize: The number of bytes sent or received.
   561  	MessageSize uint64 `json:"messageSize,omitempty,string"`
   562  
   563  	// Time: If available, this is the kernel time:
   564  	//
   565  	// *  For sent messages, this is the time at which the first bit was
   566  	// sent.
   567  	// *  For received messages, this is the time at which the last bit was
   568  	//    received.
   569  	Time string `json:"time,omitempty"`
   570  
   571  	// Type: Type of NetworkEvent. Indicates whether the RPC message was
   572  	// sent or
   573  	// received.
   574  	//
   575  	// Possible values:
   576  	//   "TYPE_UNSPECIFIED" - Unknown event type.
   577  	//   "SENT" - Indicates a sent RPC message.
   578  	//   "RECV" - Indicates a received RPC message.
   579  	Type string `json:"type,omitempty"`
   580  
   581  	// ForceSendFields is a list of field names (e.g. "MessageId") to
   582  	// unconditionally include in API requests. By default, fields with
   583  	// empty values are omitted from API requests. However, any non-pointer,
   584  	// non-interface field appearing in ForceSendFields will be sent to the
   585  	// server regardless of whether the field is empty or not. This may be
   586  	// used to include empty fields in Patch requests.
   587  	ForceSendFields []string `json:"-"`
   588  
   589  	// NullFields is a list of field names (e.g. "MessageId") to include in
   590  	// API requests with the JSON null value. By default, fields with empty
   591  	// values are omitted from API requests. However, any field with an
   592  	// empty value appearing in NullFields will be sent to the server as
   593  	// null. It is an error if a field in this list has a non-empty value.
   594  	// This may be used to include null fields in Patch requests.
   595  	NullFields []string `json:"-"`
   596  }
   597  
   598  func (s *NetworkEvent) MarshalJSON() ([]byte, error) {
   599  	type NoMethod NetworkEvent
   600  	raw := NoMethod(*s)
   601  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   602  }
   603  
   604  // Span: A span represents a single operation within a trace. Spans can
   605  // be nested
   606  // to form a trace tree. Often, a trace contains a root span
   607  // that
   608  // describes the end-to-end latency and, optionally, one or more
   609  // subspans for
   610  // its sub-operations. (A trace could alternatively contain multiple
   611  // root spans,
   612  // or none at all.) Spans do not need to be contiguous. There may be
   613  // gaps
   614  // and/or overlaps between spans in a trace.
   615  type Span struct {
   616  	// Attributes: A set of attributes on the span. A maximum of 32
   617  	// attributes are allowed per
   618  	// Span.
   619  	Attributes *Attributes `json:"attributes,omitempty"`
   620  
   621  	// DisplayName: Description of the operation in the span. It is
   622  	// sanitized and displayed in
   623  	// the Stackdriver Trace tool in the
   624  	// {% dynamic print site_values.console_name %}.
   625  	// The display_name may be a method name or some other per-call
   626  	// site
   627  	// name. For the same executable and the same call point, a best
   628  	// practice is
   629  	// to use a consistent operation name, which makes it easier to
   630  	// correlate
   631  	// cross-trace spans.
   632  	// The maximum length for the display_name is 128 bytes.
   633  	DisplayName *TruncatableString `json:"displayName,omitempty"`
   634  
   635  	// EndTime: End time of the span.
   636  	// On the client side, this is the local machine clock time at which the
   637  	// span
   638  	// execution was ended; on the server
   639  	// side, this is the time at which the server application handler
   640  	// stopped
   641  	// running.
   642  	EndTime string `json:"endTime,omitempty"`
   643  
   644  	// Links: A maximum of 128 links are allowed per Span.
   645  	Links *Links `json:"links,omitempty"`
   646  
   647  	// Name: The resource name of Span in the
   648  	// format
   649  	// `projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`.
   650  	// `TRACE_ID`
   651  	//  is a unique identifier for a trace within a project and is
   652  	// a
   653  	// base16-encoded, case-insensitive string and is required to be 32 char
   654  	// long.
   655  	// `SPAN_ID` is a unique identifier for a span within a trace. It is
   656  	// a
   657  	// base 16-encoded, case-insensitive string of a 8-bytes array and is
   658  	// required
   659  	// to be 16 char long.
   660  	Name string `json:"name,omitempty"`
   661  
   662  	// ParentSpanId: ID of parent span which is a base 16-encoded,
   663  	// case-insensitive string of
   664  	// a 8-bytes array and is required to be 16 char long. If this is a root
   665  	// span,
   666  	// the value must be empty.
   667  	ParentSpanId string `json:"parentSpanId,omitempty"`
   668  
   669  	// SpanId: Unique identifier for a span within a trace. It is a base
   670  	// 16-encoded,
   671  	// case-insensitive string of a 8-bytes array and is required.
   672  	SpanId string `json:"spanId,omitempty"`
   673  
   674  	// StackTrace: Stack trace captured at the start of the span.
   675  	StackTrace *StackTrace `json:"stackTrace,omitempty"`
   676  
   677  	// StartTime: Start time of the span.
   678  	// On the client side, this is the local machine clock time at which the
   679  	// span
   680  	// execution was started; on the server
   681  	// side, this is the time at which the server application handler
   682  	// started
   683  	// running.
   684  	StartTime string `json:"startTime,omitempty"`
   685  
   686  	// Status: An optional final status for this span.
   687  	Status *Status `json:"status,omitempty"`
   688  
   689  	// TimeEvents: A maximum of 32 annotations and 128 network events are
   690  	// allowed per Span.
   691  	TimeEvents *TimeEvents `json:"timeEvents,omitempty"`
   692  
   693  	// ServerResponse contains the HTTP response code and headers from the
   694  	// server.
   695  	googleapi.ServerResponse `json:"-"`
   696  
   697  	// ForceSendFields is a list of field names (e.g. "Attributes") to
   698  	// unconditionally include in API requests. By default, fields with
   699  	// empty values are omitted from API requests. However, any non-pointer,
   700  	// non-interface field appearing in ForceSendFields will be sent to the
   701  	// server regardless of whether the field is empty or not. This may be
   702  	// used to include empty fields in Patch requests.
   703  	ForceSendFields []string `json:"-"`
   704  
   705  	// NullFields is a list of field names (e.g. "Attributes") to include in
   706  	// API requests with the JSON null value. By default, fields with empty
   707  	// values are omitted from API requests. However, any field with an
   708  	// empty value appearing in NullFields will be sent to the server as
   709  	// null. It is an error if a field in this list has a non-empty value.
   710  	// This may be used to include null fields in Patch requests.
   711  	NullFields []string `json:"-"`
   712  }
   713  
   714  func (s *Span) MarshalJSON() ([]byte, error) {
   715  	type NoMethod Span
   716  	raw := NoMethod(*s)
   717  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   718  }
   719  
   720  // StackFrame: Represents a single stack frame in a stack trace.
   721  type StackFrame struct {
   722  	// ColumnNumber: Column number is important in JavaScript (anonymous
   723  	// functions).
   724  	// May not be available in some languages.
   725  	ColumnNumber int64 `json:"columnNumber,omitempty,string"`
   726  
   727  	// FileName: The filename of the file containing this frame (up to 256
   728  	// characters).
   729  	FileName *TruncatableString `json:"fileName,omitempty"`
   730  
   731  	// FunctionName: The fully-qualified name that uniquely identifies this
   732  	// function or
   733  	// method (up to 1024 characters).
   734  	FunctionName *TruncatableString `json:"functionName,omitempty"`
   735  
   736  	// LineNumber: Line number of the frame.
   737  	LineNumber int64 `json:"lineNumber,omitempty,string"`
   738  
   739  	// LoadModule: Binary module the code is loaded from.
   740  	LoadModule *Module `json:"loadModule,omitempty"`
   741  
   742  	// OriginalFunctionName: Used when the function name
   743  	// is
   744  	// [mangled](http://www.avabodh.com/cxxin/namemangling.html). May
   745  	// be
   746  	// fully-qualified (up to 1024 characters).
   747  	OriginalFunctionName *TruncatableString `json:"originalFunctionName,omitempty"`
   748  
   749  	// SourceVersion: The version of the deployed source code (up to 128
   750  	// characters).
   751  	SourceVersion *TruncatableString `json:"sourceVersion,omitempty"`
   752  
   753  	// ForceSendFields is a list of field names (e.g. "ColumnNumber") to
   754  	// unconditionally include in API requests. By default, fields with
   755  	// empty values are omitted from API requests. However, any non-pointer,
   756  	// non-interface field appearing in ForceSendFields will be sent to the
   757  	// server regardless of whether the field is empty or not. This may be
   758  	// used to include empty fields in Patch requests.
   759  	ForceSendFields []string `json:"-"`
   760  
   761  	// NullFields is a list of field names (e.g. "ColumnNumber") to include
   762  	// in API requests with the JSON null value. By default, fields with
   763  	// empty values are omitted from API requests. However, any field with
   764  	// an empty value appearing in NullFields will be sent to the server as
   765  	// null. It is an error if a field in this list has a non-empty value.
   766  	// This may be used to include null fields in Patch requests.
   767  	NullFields []string `json:"-"`
   768  }
   769  
   770  func (s *StackFrame) MarshalJSON() ([]byte, error) {
   771  	type NoMethod StackFrame
   772  	raw := NoMethod(*s)
   773  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   774  }
   775  
   776  // StackFrames: Represents collection of StackFrames that can be
   777  // truncated.
   778  type StackFrames struct {
   779  	// DroppedFramesCount: The number of dropped stack frames after the
   780  	// maximum size was enforced.
   781  	// If 0 then no frames were dropped.
   782  	DroppedFramesCount int64 `json:"droppedFramesCount,omitempty"`
   783  
   784  	// Frame: Stack frames in this stack trace.
   785  	Frame []*StackFrame `json:"frame,omitempty"`
   786  
   787  	// ForceSendFields is a list of field names (e.g. "DroppedFramesCount")
   788  	// to unconditionally include in API requests. By default, fields with
   789  	// empty values are omitted from API requests. However, any non-pointer,
   790  	// non-interface field appearing in ForceSendFields will be sent to the
   791  	// server regardless of whether the field is empty or not. This may be
   792  	// used to include empty fields in Patch requests.
   793  	ForceSendFields []string `json:"-"`
   794  
   795  	// NullFields is a list of field names (e.g. "DroppedFramesCount") to
   796  	// include in API requests with the JSON null value. By default, fields
   797  	// with empty values are omitted from API requests. However, any field
   798  	// with an empty value appearing in NullFields will be sent to the
   799  	// server as null. It is an error if a field in this list has a
   800  	// non-empty value. This may be used to include null fields in Patch
   801  	// requests.
   802  	NullFields []string `json:"-"`
   803  }
   804  
   805  func (s *StackFrames) MarshalJSON() ([]byte, error) {
   806  	type NoMethod StackFrames
   807  	raw := NoMethod(*s)
   808  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   809  }
   810  
   811  // StackTrace: StackTrace collected in a trace.
   812  type StackTrace struct {
   813  	// StackFrames: Stack frames in this stack trace. A maximum of 128
   814  	// frames are allowed.
   815  	StackFrames *StackFrames `json:"stackFrames,omitempty"`
   816  
   817  	// StackTraceHashId: The hash ID is used to conserve network bandwidth
   818  	// for duplicate
   819  	// stack traces within a single trace.
   820  	//
   821  	// Often multiple spans will have identical stack traces.
   822  	// The first occurrence of a stack trace should contain both
   823  	// the
   824  	// `stackFrame` content and a value in `stackTraceHashId`.
   825  	//
   826  	// Subsequent spans within the same request can refer
   827  	// to that stack trace by only setting `stackTraceHashId`.
   828  	StackTraceHashId uint64 `json:"stackTraceHashId,omitempty,string"`
   829  
   830  	// ForceSendFields is a list of field names (e.g. "StackFrames") to
   831  	// unconditionally include in API requests. By default, fields with
   832  	// empty values are omitted from API requests. However, any non-pointer,
   833  	// non-interface field appearing in ForceSendFields will be sent to the
   834  	// server regardless of whether the field is empty or not. This may be
   835  	// used to include empty fields in Patch requests.
   836  	ForceSendFields []string `json:"-"`
   837  
   838  	// NullFields is a list of field names (e.g. "StackFrames") to include
   839  	// in API requests with the JSON null value. By default, fields with
   840  	// empty values are omitted from API requests. However, any field with
   841  	// an empty value appearing in NullFields will be sent to the server as
   842  	// null. It is an error if a field in this list has a non-empty value.
   843  	// This may be used to include null fields in Patch requests.
   844  	NullFields []string `json:"-"`
   845  }
   846  
   847  func (s *StackTrace) MarshalJSON() ([]byte, error) {
   848  	type NoMethod StackTrace
   849  	raw := NoMethod(*s)
   850  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   851  }
   852  
   853  // Status: The `Status` type defines a logical error model that is
   854  // suitable for different
   855  // programming environments, including REST APIs and RPC APIs. It is
   856  // used by
   857  // [gRPC](https://github.com/grpc). The error model is designed to
   858  // be:
   859  //
   860  // - Simple to use and understand for most users
   861  // - Flexible enough to meet unexpected needs
   862  //
   863  // # Overview
   864  //
   865  // The `Status` message contains three pieces of data: error code, error
   866  // message,
   867  // and error details. The error code should be an enum value
   868  // of
   869  // google.rpc.Code, but it may accept additional error codes if needed.
   870  // The
   871  // error message should be a developer-facing English message that
   872  // helps
   873  // developers *understand* and *resolve* the error. If a localized
   874  // user-facing
   875  // error message is needed, put the localized message in the error
   876  // details or
   877  // localize it in the client. The optional error details may contain
   878  // arbitrary
   879  // information about the error. There is a predefined set of error
   880  // detail types
   881  // in the package `google.rpc` that can be used for common error
   882  // conditions.
   883  //
   884  // # Language mapping
   885  //
   886  // The `Status` message is the logical representation of the error
   887  // model, but it
   888  // is not necessarily the actual wire format. When the `Status` message
   889  // is
   890  // exposed in different client libraries and different wire protocols,
   891  // it can be
   892  // mapped differently. For example, it will likely be mapped to some
   893  // exceptions
   894  // in Java, but more likely mapped to some error codes in C.
   895  //
   896  // # Other uses
   897  //
   898  // The error model and the `Status` message can be used in a variety
   899  // of
   900  // environments, either with or without APIs, to provide a
   901  // consistent developer experience across different
   902  // environments.
   903  //
   904  // Example uses of this error model include:
   905  //
   906  // - Partial errors. If a service needs to return partial errors to the
   907  // client,
   908  //
   909  //	it may embed the `Status` in the normal response to indicate the
   910  //
   911  // partial
   912  //
   913  //	errors.
   914  //
   915  // - Workflow errors. A typical workflow has multiple steps. Each step
   916  // may
   917  //
   918  //	have a `Status` message for error reporting.
   919  //
   920  // - Batch operations. If a client uses batch request and batch
   921  // response, the
   922  //
   923  //	`Status` message should be used directly inside batch response,
   924  //
   925  // one for
   926  //
   927  //	each error sub-response.
   928  //
   929  // - Asynchronous operations. If an API call embeds asynchronous
   930  // operation
   931  //
   932  //	results in its response, the status of those operations should
   933  //
   934  // be
   935  //
   936  //	represented directly using the `Status` message.
   937  //
   938  // - Logging. If some API errors are stored in logs, the message
   939  // `Status` could
   940  //
   941  //	be used directly after any stripping needed for security/privacy
   942  //
   943  // reasons.
   944  type Status struct {
   945  	// Code: The status code, which should be an enum value of
   946  	// google.rpc.Code.
   947  	Code int64 `json:"code,omitempty"`
   948  
   949  	// Details: A list of messages that carry the error details.  There will
   950  	// be a
   951  	// common set of message types for APIs to use.
   952  	Details []googleapi.RawMessage `json:"details,omitempty"`
   953  
   954  	// Message: A developer-facing error message, which should be in
   955  	// English. Any
   956  	// user-facing error message should be localized and sent in
   957  	// the
   958  	// google.rpc.Status.details field, or localized by the client.
   959  	Message string `json:"message,omitempty"`
   960  
   961  	// ForceSendFields is a list of field names (e.g. "Code") to
   962  	// unconditionally include in API requests. By default, fields with
   963  	// empty values are omitted from API requests. However, any non-pointer,
   964  	// non-interface field appearing in ForceSendFields will be sent to the
   965  	// server regardless of whether the field is empty or not. This may be
   966  	// used to include empty fields in Patch requests.
   967  	ForceSendFields []string `json:"-"`
   968  
   969  	// NullFields is a list of field names (e.g. "Code") to include in API
   970  	// requests with the JSON null value. By default, fields with empty
   971  	// values are omitted from API requests. However, any field with an
   972  	// empty value appearing in NullFields will be sent to the server as
   973  	// null. It is an error if a field in this list has a non-empty value.
   974  	// This may be used to include null fields in Patch requests.
   975  	NullFields []string `json:"-"`
   976  }
   977  
   978  func (s *Status) MarshalJSON() ([]byte, error) {
   979  	type NoMethod Status
   980  	raw := NoMethod(*s)
   981  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
   982  }
   983  
   984  // TimeEvent: A time-stamped annotation in the Span.
   985  type TimeEvent struct {
   986  	// Annotation: One or more key:value pairs.
   987  	Annotation *Annotation `json:"annotation,omitempty"`
   988  
   989  	// NetworkEvent: An event describing an RPC message sent/received on the
   990  	// network.
   991  	NetworkEvent *NetworkEvent `json:"networkEvent,omitempty"`
   992  
   993  	// Time: The timestamp indicating the time the event occurred.
   994  	Time string `json:"time,omitempty"`
   995  
   996  	// ForceSendFields is a list of field names (e.g. "Annotation") to
   997  	// unconditionally include in API requests. By default, fields with
   998  	// empty values are omitted from API requests. However, any non-pointer,
   999  	// non-interface field appearing in ForceSendFields will be sent to the
  1000  	// server regardless of whether the field is empty or not. This may be
  1001  	// used to include empty fields in Patch requests.
  1002  	ForceSendFields []string `json:"-"`
  1003  
  1004  	// NullFields is a list of field names (e.g. "Annotation") to include in
  1005  	// API requests with the JSON null value. By default, fields with empty
  1006  	// values are omitted from API requests. However, any field with an
  1007  	// empty value appearing in NullFields will be sent to the server as
  1008  	// null. It is an error if a field in this list has a non-empty value.
  1009  	// This may be used to include null fields in Patch requests.
  1010  	NullFields []string `json:"-"`
  1011  }
  1012  
  1013  func (s *TimeEvent) MarshalJSON() ([]byte, error) {
  1014  	type NoMethod TimeEvent
  1015  	raw := NoMethod(*s)
  1016  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1017  }
  1018  
  1019  // TimeEvents: A collection of `TimeEvent`s. A `TimeEvent` is a
  1020  // time-stamped annotation
  1021  // on the span, consisting of either user-supplied key:value pairs,
  1022  // or
  1023  // details of an RPC message sent/received on the network.
  1024  type TimeEvents struct {
  1025  	// DroppedAnnotationsCount: The number of dropped annotations after the
  1026  	// maximum size was enforced. If
  1027  	// 0 then no annotations were dropped.
  1028  	DroppedAnnotationsCount int64 `json:"droppedAnnotationsCount,omitempty"`
  1029  
  1030  	// DroppedNetworkEventsCount: The number of dropped network events after
  1031  	// the maximum size was enforced.
  1032  	// If 0 then no annotations were dropped.
  1033  	DroppedNetworkEventsCount int64 `json:"droppedNetworkEventsCount,omitempty"`
  1034  
  1035  	// TimeEvent: A collection of `TimeEvent`s.
  1036  	TimeEvent []*TimeEvent `json:"timeEvent,omitempty"`
  1037  
  1038  	// ForceSendFields is a list of field names (e.g.
  1039  	// "DroppedAnnotationsCount") to unconditionally include in API
  1040  	// requests. By default, fields with empty values are omitted from API
  1041  	// requests. However, any non-pointer, non-interface field appearing in
  1042  	// ForceSendFields will be sent to the server regardless of whether the
  1043  	// field is empty or not. This may be used to include empty fields in
  1044  	// Patch requests.
  1045  	ForceSendFields []string `json:"-"`
  1046  
  1047  	// NullFields is a list of field names (e.g. "DroppedAnnotationsCount")
  1048  	// to include in API requests with the JSON null value. By default,
  1049  	// fields with empty values are omitted from API requests. However, any
  1050  	// field with an empty value appearing in NullFields will be sent to the
  1051  	// server as null. It is an error if a field in this list has a
  1052  	// non-empty value. This may be used to include null fields in Patch
  1053  	// requests.
  1054  	NullFields []string `json:"-"`
  1055  }
  1056  
  1057  func (s *TimeEvents) MarshalJSON() ([]byte, error) {
  1058  	type NoMethod TimeEvents
  1059  	raw := NoMethod(*s)
  1060  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1061  }
  1062  
  1063  // Trace: A trace describes how long it takes for an application to
  1064  // perform some
  1065  // operations. It consists of a set of spans, each representing
  1066  // an operation and including time information and operation details.
  1067  type Trace struct {
  1068  	// Name: The resource name of Trace in the
  1069  	// format
  1070  	// `projects/PROJECT_ID/traces/TRACE_ID`. `TRACE_ID` is a unique
  1071  	// identifier
  1072  	// for a trace within a project and is a base16-encoded,
  1073  	// case-insensitive
  1074  	// string and is required to be 32 char long.
  1075  	Name string `json:"name,omitempty"`
  1076  
  1077  	// ForceSendFields is a list of field names (e.g. "Name") to
  1078  	// unconditionally include in API requests. By default, fields with
  1079  	// empty values are omitted from API requests. However, any non-pointer,
  1080  	// non-interface field appearing in ForceSendFields will be sent to the
  1081  	// server regardless of whether the field is empty or not. This may be
  1082  	// used to include empty fields in Patch requests.
  1083  	ForceSendFields []string `json:"-"`
  1084  
  1085  	// NullFields is a list of field names (e.g. "Name") to include in API
  1086  	// requests with the JSON null value. By default, fields with empty
  1087  	// values are omitted from API requests. However, any field with an
  1088  	// empty value appearing in NullFields will be sent to the server as
  1089  	// null. It is an error if a field in this list has a non-empty value.
  1090  	// This may be used to include null fields in Patch requests.
  1091  	NullFields []string `json:"-"`
  1092  }
  1093  
  1094  func (s *Trace) MarshalJSON() ([]byte, error) {
  1095  	type NoMethod Trace
  1096  	raw := NoMethod(*s)
  1097  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1098  }
  1099  
  1100  // TruncatableString: Represents a string value that might be truncated.
  1101  type TruncatableString struct {
  1102  	// TruncatedCharacterCount: The number of characters truncated from the
  1103  	// original string value. If 0 it
  1104  	// means that the string value was not truncated.
  1105  	TruncatedCharacterCount int64 `json:"truncatedCharacterCount,omitempty"`
  1106  
  1107  	// Value: The truncated string value. E.g. for a string attribute this
  1108  	// may have up to
  1109  	// 256 bytes.
  1110  	Value string `json:"value,omitempty"`
  1111  
  1112  	// ForceSendFields is a list of field names (e.g.
  1113  	// "TruncatedCharacterCount") to unconditionally include in API
  1114  	// requests. By default, fields with empty values are omitted from API
  1115  	// requests. However, any non-pointer, non-interface field appearing in
  1116  	// ForceSendFields will be sent to the server regardless of whether the
  1117  	// field is empty or not. This may be used to include empty fields in
  1118  	// Patch requests.
  1119  	ForceSendFields []string `json:"-"`
  1120  
  1121  	// NullFields is a list of field names (e.g. "TruncatedCharacterCount")
  1122  	// to include in API requests with the JSON null value. By default,
  1123  	// fields with empty values are omitted from API requests. However, any
  1124  	// field with an empty value appearing in NullFields will be sent to the
  1125  	// server as null. It is an error if a field in this list has a
  1126  	// non-empty value. This may be used to include null fields in Patch
  1127  	// requests.
  1128  	NullFields []string `json:"-"`
  1129  }
  1130  
  1131  func (s *TruncatableString) MarshalJSON() ([]byte, error) {
  1132  	type NoMethod TruncatableString
  1133  	raw := NoMethod(*s)
  1134  	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1135  }
  1136  
  1137  // method id "tracing.projects.traces.batchWrite":
  1138  
  1139  type ProjectsTracesBatchWriteCall struct {
  1140  	s                      *Service
  1141  	name                   string
  1142  	batchwritespansrequest *BatchWriteSpansRequest
  1143  	urlParams_             gensupport.URLParams
  1144  	ctx_                   context.Context
  1145  	header_                http.Header
  1146  }
  1147  
  1148  // BatchWrite: Sends new spans to Stackdriver Trace or updates existing
  1149  // traces. If the
  1150  // name of a trace that you send matches that of an existing trace, new
  1151  // spans
  1152  // are added to the existing trace. Attempt to update existing spans
  1153  // results
  1154  // undefined behavior. If the name does not match, a new trace is
  1155  // created
  1156  // with given set of spans.
  1157  func (r *ProjectsTracesService) BatchWrite(name string, batchwritespansrequest *BatchWriteSpansRequest) *ProjectsTracesBatchWriteCall {
  1158  	c := &ProjectsTracesBatchWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1159  	c.name = name
  1160  	c.batchwritespansrequest = batchwritespansrequest
  1161  	return c
  1162  }
  1163  
  1164  // Fields allows partial responses to be retrieved. See
  1165  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1166  // for more information.
  1167  func (c *ProjectsTracesBatchWriteCall) Fields(s ...googleapi.Field) *ProjectsTracesBatchWriteCall {
  1168  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1169  	return c
  1170  }
  1171  
  1172  // Context sets the context to be used in this call's Do method. Any
  1173  // pending HTTP request will be aborted if the provided context is
  1174  // canceled.
  1175  func (c *ProjectsTracesBatchWriteCall) Context(ctx context.Context) *ProjectsTracesBatchWriteCall {
  1176  	c.ctx_ = ctx
  1177  	return c
  1178  }
  1179  
  1180  // Header returns an http.Header that can be modified by the caller to
  1181  // add HTTP headers to the request.
  1182  func (c *ProjectsTracesBatchWriteCall) Header() http.Header {
  1183  	if c.header_ == nil {
  1184  		c.header_ = make(http.Header)
  1185  	}
  1186  	return c.header_
  1187  }
  1188  
  1189  func (c *ProjectsTracesBatchWriteCall) doRequest(alt string) (*http.Response, error) {
  1190  	reqHeaders := make(http.Header)
  1191  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1192  	for k, v := range c.header_ {
  1193  		reqHeaders[k] = v
  1194  	}
  1195  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1196  	var body io.Reader = nil
  1197  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchwritespansrequest)
  1198  	if err != nil {
  1199  		return nil, err
  1200  	}
  1201  	reqHeaders.Set("Content-Type", "application/json")
  1202  	c.urlParams_.Set("alt", alt)
  1203  	c.urlParams_.Set("prettyPrint", "false")
  1204  	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}/traces:batchWrite")
  1205  	urls += "?" + c.urlParams_.Encode()
  1206  	req, err := http.NewRequest("POST", urls, body)
  1207  	if err != nil {
  1208  		return nil, err
  1209  	}
  1210  	req.Header = reqHeaders
  1211  	googleapi.Expand(req.URL, map[string]string{
  1212  		"name": c.name,
  1213  	})
  1214  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1215  }
  1216  
  1217  // Do executes the "tracing.projects.traces.batchWrite" call.
  1218  // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1219  // code is an error. Response headers are in either
  1220  // *Empty.ServerResponse.Header or (if a response was returned at all)
  1221  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1222  // check whether the returned error was because http.StatusNotModified
  1223  // was returned.
  1224  func (c *ProjectsTracesBatchWriteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1225  	gensupport.SetOptions(c.urlParams_, opts...)
  1226  	res, err := c.doRequest("json")
  1227  	if res != nil && res.StatusCode == http.StatusNotModified {
  1228  		if res.Body != nil {
  1229  			res.Body.Close()
  1230  		}
  1231  		return nil, &googleapi.Error{
  1232  			Code:   res.StatusCode,
  1233  			Header: res.Header,
  1234  		}
  1235  	}
  1236  	if err != nil {
  1237  		return nil, err
  1238  	}
  1239  	defer googleapi.CloseBody(res)
  1240  	if err := googleapi.CheckResponse(res); err != nil {
  1241  		return nil, err
  1242  	}
  1243  	ret := &Empty{
  1244  		ServerResponse: googleapi.ServerResponse{
  1245  			Header:         res.Header,
  1246  			HTTPStatusCode: res.StatusCode,
  1247  		},
  1248  	}
  1249  	target := &ret
  1250  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1251  		return nil, err
  1252  	}
  1253  	return ret, nil
  1254  	// {
  1255  	//   "description": "Sends new spans to Stackdriver Trace or updates existing traces. If the\nname of a trace that you send matches that of an existing trace, new spans\nare added to the existing trace. Attempt to update existing spans results\nundefined behavior. If the name does not match, a new trace is created\nwith given set of spans.",
  1256  	//   "flatPath": "v2/projects/{projectsId}/traces:batchWrite",
  1257  	//   "httpMethod": "POST",
  1258  	//   "id": "tracing.projects.traces.batchWrite",
  1259  	//   "parameterOrder": [
  1260  	//     "name"
  1261  	//   ],
  1262  	//   "parameters": {
  1263  	//     "name": {
  1264  	//       "description": "Name of the project where the spans belong to. Format is\n`projects/PROJECT_ID`.",
  1265  	//       "location": "path",
  1266  	//       "pattern": "^projects/[^/]+$",
  1267  	//       "required": true,
  1268  	//       "type": "string"
  1269  	//     }
  1270  	//   },
  1271  	//   "path": "v2/{+name}/traces:batchWrite",
  1272  	//   "request": {
  1273  	//     "$ref": "BatchWriteSpansRequest"
  1274  	//   },
  1275  	//   "response": {
  1276  	//     "$ref": "Empty"
  1277  	//   },
  1278  	//   "scopes": [
  1279  	//     "https://www.googleapis.com/auth/cloud-platform",
  1280  	//     "https://www.googleapis.com/auth/trace.append"
  1281  	//   ]
  1282  	// }
  1283  
  1284  }
  1285  
  1286  // method id "tracing.projects.traces.list":
  1287  
  1288  type ProjectsTracesListCall struct {
  1289  	s            *Service
  1290  	parent       string
  1291  	urlParams_   gensupport.URLParams
  1292  	ifNoneMatch_ string
  1293  	ctx_         context.Context
  1294  	header_      http.Header
  1295  }
  1296  
  1297  // List: Returns of a list of traces that match the specified filter
  1298  // conditions.
  1299  func (r *ProjectsTracesService) List(parent string) *ProjectsTracesListCall {
  1300  	c := &ProjectsTracesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1301  	c.parent = parent
  1302  	return c
  1303  }
  1304  
  1305  // EndTime sets the optional parameter "endTime": End of the time
  1306  // interval (inclusive) during which the trace data was
  1307  // collected from the application.
  1308  func (c *ProjectsTracesListCall) EndTime(endTime string) *ProjectsTracesListCall {
  1309  	c.urlParams_.Set("endTime", endTime)
  1310  	return c
  1311  }
  1312  
  1313  // Filter sets the optional parameter "filter": An optional filter for
  1314  // the request.
  1315  // Example:
  1316  // `version_label_key:a some_label:some_label_key`
  1317  // returns traces from version `a` and has `some_label` with
  1318  // `some_label_key`.
  1319  func (c *ProjectsTracesListCall) Filter(filter string) *ProjectsTracesListCall {
  1320  	c.urlParams_.Set("filter", filter)
  1321  	return c
  1322  }
  1323  
  1324  // OrderBy sets the optional parameter "orderBy": Field used to sort the
  1325  // returned traces.
  1326  // Can be one of the following:
  1327  //
  1328  // *   `trace_id`
  1329  // *   `name` (`name` field of root span in the trace)
  1330  // *   `duration` (difference between `end_time` and `start_time` fields
  1331  // of
  1332  //
  1333  //	the root span)
  1334  //
  1335  // *   `start` (`start_time` field of the root span)
  1336  //
  1337  // Descending order can be specified by appending `desc` to the sort
  1338  // field
  1339  // (for example, `name desc`).
  1340  //
  1341  // Only one sort field is permitted.
  1342  func (c *ProjectsTracesListCall) OrderBy(orderBy string) *ProjectsTracesListCall {
  1343  	c.urlParams_.Set("orderBy", orderBy)
  1344  	return c
  1345  }
  1346  
  1347  // PageSize sets the optional parameter "pageSize": Maximum number of
  1348  // traces to return. If not specified or <= 0, the
  1349  // implementation selects a reasonable value. The implementation
  1350  // may
  1351  // return fewer traces than the requested page size.
  1352  func (c *ProjectsTracesListCall) PageSize(pageSize int64) *ProjectsTracesListCall {
  1353  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  1354  	return c
  1355  }
  1356  
  1357  // PageToken sets the optional parameter "pageToken": Token identifying
  1358  // the page of results to return. If provided, use the
  1359  // value of the `next_page_token` field from a previous request.
  1360  func (c *ProjectsTracesListCall) PageToken(pageToken string) *ProjectsTracesListCall {
  1361  	c.urlParams_.Set("pageToken", pageToken)
  1362  	return c
  1363  }
  1364  
  1365  // StartTime sets the optional parameter "startTime": Start of the time
  1366  // interval (inclusive) during which the trace data was
  1367  // collected from the application.
  1368  func (c *ProjectsTracesListCall) StartTime(startTime string) *ProjectsTracesListCall {
  1369  	c.urlParams_.Set("startTime", startTime)
  1370  	return c
  1371  }
  1372  
  1373  // Fields allows partial responses to be retrieved. See
  1374  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1375  // for more information.
  1376  func (c *ProjectsTracesListCall) Fields(s ...googleapi.Field) *ProjectsTracesListCall {
  1377  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1378  	return c
  1379  }
  1380  
  1381  // IfNoneMatch sets the optional parameter which makes the operation
  1382  // fail if the object's ETag matches the given value. This is useful for
  1383  // getting updates only after the object has changed since the last
  1384  // request. Use googleapi.IsNotModified to check whether the response
  1385  // error from Do is the result of In-None-Match.
  1386  func (c *ProjectsTracesListCall) IfNoneMatch(entityTag string) *ProjectsTracesListCall {
  1387  	c.ifNoneMatch_ = entityTag
  1388  	return c
  1389  }
  1390  
  1391  // Context sets the context to be used in this call's Do method. Any
  1392  // pending HTTP request will be aborted if the provided context is
  1393  // canceled.
  1394  func (c *ProjectsTracesListCall) Context(ctx context.Context) *ProjectsTracesListCall {
  1395  	c.ctx_ = ctx
  1396  	return c
  1397  }
  1398  
  1399  // Header returns an http.Header that can be modified by the caller to
  1400  // add HTTP headers to the request.
  1401  func (c *ProjectsTracesListCall) Header() http.Header {
  1402  	if c.header_ == nil {
  1403  		c.header_ = make(http.Header)
  1404  	}
  1405  	return c.header_
  1406  }
  1407  
  1408  func (c *ProjectsTracesListCall) doRequest(alt string) (*http.Response, error) {
  1409  	reqHeaders := make(http.Header)
  1410  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1411  	for k, v := range c.header_ {
  1412  		reqHeaders[k] = v
  1413  	}
  1414  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1415  	if c.ifNoneMatch_ != "" {
  1416  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1417  	}
  1418  	var body io.Reader = nil
  1419  	c.urlParams_.Set("alt", alt)
  1420  	c.urlParams_.Set("prettyPrint", "false")
  1421  	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}/traces")
  1422  	urls += "?" + c.urlParams_.Encode()
  1423  	req, err := http.NewRequest("GET", urls, body)
  1424  	if err != nil {
  1425  		return nil, err
  1426  	}
  1427  	req.Header = reqHeaders
  1428  	googleapi.Expand(req.URL, map[string]string{
  1429  		"parent": c.parent,
  1430  	})
  1431  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1432  }
  1433  
  1434  // Do executes the "tracing.projects.traces.list" call.
  1435  // Exactly one of *ListTracesResponse or error will be non-nil. Any
  1436  // non-2xx status code is an error. Response headers are in either
  1437  // *ListTracesResponse.ServerResponse.Header or (if a response was
  1438  // returned at all) in error.(*googleapi.Error).Header. Use
  1439  // googleapi.IsNotModified to check whether the returned error was
  1440  // because http.StatusNotModified was returned.
  1441  func (c *ProjectsTracesListCall) Do(opts ...googleapi.CallOption) (*ListTracesResponse, error) {
  1442  	gensupport.SetOptions(c.urlParams_, opts...)
  1443  	res, err := c.doRequest("json")
  1444  	if res != nil && res.StatusCode == http.StatusNotModified {
  1445  		if res.Body != nil {
  1446  			res.Body.Close()
  1447  		}
  1448  		return nil, &googleapi.Error{
  1449  			Code:   res.StatusCode,
  1450  			Header: res.Header,
  1451  		}
  1452  	}
  1453  	if err != nil {
  1454  		return nil, err
  1455  	}
  1456  	defer googleapi.CloseBody(res)
  1457  	if err := googleapi.CheckResponse(res); err != nil {
  1458  		return nil, err
  1459  	}
  1460  	ret := &ListTracesResponse{
  1461  		ServerResponse: googleapi.ServerResponse{
  1462  			Header:         res.Header,
  1463  			HTTPStatusCode: res.StatusCode,
  1464  		},
  1465  	}
  1466  	target := &ret
  1467  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1468  		return nil, err
  1469  	}
  1470  	return ret, nil
  1471  	// {
  1472  	//   "description": "Returns of a list of traces that match the specified filter conditions.",
  1473  	//   "flatPath": "v2/projects/{projectsId}/traces",
  1474  	//   "httpMethod": "GET",
  1475  	//   "id": "tracing.projects.traces.list",
  1476  	//   "parameterOrder": [
  1477  	//     "parent"
  1478  	//   ],
  1479  	//   "parameters": {
  1480  	//     "endTime": {
  1481  	//       "description": "End of the time interval (inclusive) during which the trace data was\ncollected from the application.",
  1482  	//       "format": "google-datetime",
  1483  	//       "location": "query",
  1484  	//       "type": "string"
  1485  	//     },
  1486  	//     "filter": {
  1487  	//       "description": "An optional filter for the request.\nExample:\n`version_label_key:a some_label:some_label_key`\nreturns traces from version `a` and has `some_label` with `some_label_key`.",
  1488  	//       "location": "query",
  1489  	//       "type": "string"
  1490  	//     },
  1491  	//     "orderBy": {
  1492  	//       "description": "Field used to sort the returned traces. Optional.\nCan be one of the following:\n\n*   `trace_id`\n*   `name` (`name` field of root span in the trace)\n*   `duration` (difference between `end_time` and `start_time` fields of\n     the root span)\n*   `start` (`start_time` field of the root span)\n\nDescending order can be specified by appending `desc` to the sort field\n(for example, `name desc`).\n\nOnly one sort field is permitted.",
  1493  	//       "location": "query",
  1494  	//       "type": "string"
  1495  	//     },
  1496  	//     "pageSize": {
  1497  	//       "description": "Maximum number of traces to return. If not specified or \u003c= 0, the\nimplementation selects a reasonable value. The implementation may\nreturn fewer traces than the requested page size. Optional.",
  1498  	//       "format": "int32",
  1499  	//       "location": "query",
  1500  	//       "type": "integer"
  1501  	//     },
  1502  	//     "pageToken": {
  1503  	//       "description": "Token identifying the page of results to return. If provided, use the\nvalue of the `next_page_token` field from a previous request. Optional.",
  1504  	//       "location": "query",
  1505  	//       "type": "string"
  1506  	//     },
  1507  	//     "parent": {
  1508  	//       "description": "ID of the Cloud project where the trace data is stored which is\n`projects/PROJECT_ID`.",
  1509  	//       "location": "path",
  1510  	//       "pattern": "^projects/[^/]+$",
  1511  	//       "required": true,
  1512  	//       "type": "string"
  1513  	//     },
  1514  	//     "startTime": {
  1515  	//       "description": "Start of the time interval (inclusive) during which the trace data was\ncollected from the application.",
  1516  	//       "format": "google-datetime",
  1517  	//       "location": "query",
  1518  	//       "type": "string"
  1519  	//     }
  1520  	//   },
  1521  	//   "path": "v2/{+parent}/traces",
  1522  	//   "response": {
  1523  	//     "$ref": "ListTracesResponse"
  1524  	//   },
  1525  	//   "scopes": [
  1526  	//     "https://www.googleapis.com/auth/cloud-platform",
  1527  	//     "https://www.googleapis.com/auth/trace.readonly"
  1528  	//   ]
  1529  	// }
  1530  
  1531  }
  1532  
  1533  // Pages invokes f for each page of results.
  1534  // A non-nil error returned from f will halt the iteration.
  1535  // The provided context supersedes any context provided to the Context method.
  1536  func (c *ProjectsTracesListCall) Pages(ctx context.Context, f func(*ListTracesResponse) error) error {
  1537  	c.ctx_ = ctx
  1538  	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1539  	for {
  1540  		x, err := c.Do()
  1541  		if err != nil {
  1542  			return err
  1543  		}
  1544  		if err := f(x); err != nil {
  1545  			return err
  1546  		}
  1547  		if x.NextPageToken == "" {
  1548  			return nil
  1549  		}
  1550  		c.PageToken(x.NextPageToken)
  1551  	}
  1552  }
  1553  
  1554  // method id "tracing.projects.traces.listSpans":
  1555  
  1556  type ProjectsTracesListSpansCall struct {
  1557  	s            *Service
  1558  	parent       string
  1559  	urlParams_   gensupport.URLParams
  1560  	ifNoneMatch_ string
  1561  	ctx_         context.Context
  1562  	header_      http.Header
  1563  }
  1564  
  1565  // ListSpans: Returns a list of spans within a trace.
  1566  func (r *ProjectsTracesService) ListSpans(parent string) *ProjectsTracesListSpansCall {
  1567  	c := &ProjectsTracesListSpansCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1568  	c.parent = parent
  1569  	return c
  1570  }
  1571  
  1572  // PageToken sets the optional parameter "pageToken": Token identifying
  1573  // the page of results to return. If provided, use the
  1574  // value of the `nextPageToken` field from a previous request.
  1575  func (c *ProjectsTracesListSpansCall) PageToken(pageToken string) *ProjectsTracesListSpansCall {
  1576  	c.urlParams_.Set("pageToken", pageToken)
  1577  	return c
  1578  }
  1579  
  1580  // Fields allows partial responses to be retrieved. See
  1581  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1582  // for more information.
  1583  func (c *ProjectsTracesListSpansCall) Fields(s ...googleapi.Field) *ProjectsTracesListSpansCall {
  1584  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1585  	return c
  1586  }
  1587  
  1588  // IfNoneMatch sets the optional parameter which makes the operation
  1589  // fail if the object's ETag matches the given value. This is useful for
  1590  // getting updates only after the object has changed since the last
  1591  // request. Use googleapi.IsNotModified to check whether the response
  1592  // error from Do is the result of In-None-Match.
  1593  func (c *ProjectsTracesListSpansCall) IfNoneMatch(entityTag string) *ProjectsTracesListSpansCall {
  1594  	c.ifNoneMatch_ = entityTag
  1595  	return c
  1596  }
  1597  
  1598  // Context sets the context to be used in this call's Do method. Any
  1599  // pending HTTP request will be aborted if the provided context is
  1600  // canceled.
  1601  func (c *ProjectsTracesListSpansCall) Context(ctx context.Context) *ProjectsTracesListSpansCall {
  1602  	c.ctx_ = ctx
  1603  	return c
  1604  }
  1605  
  1606  // Header returns an http.Header that can be modified by the caller to
  1607  // add HTTP headers to the request.
  1608  func (c *ProjectsTracesListSpansCall) Header() http.Header {
  1609  	if c.header_ == nil {
  1610  		c.header_ = make(http.Header)
  1611  	}
  1612  	return c.header_
  1613  }
  1614  
  1615  func (c *ProjectsTracesListSpansCall) doRequest(alt string) (*http.Response, error) {
  1616  	reqHeaders := make(http.Header)
  1617  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1618  	for k, v := range c.header_ {
  1619  		reqHeaders[k] = v
  1620  	}
  1621  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1622  	if c.ifNoneMatch_ != "" {
  1623  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1624  	}
  1625  	var body io.Reader = nil
  1626  	c.urlParams_.Set("alt", alt)
  1627  	c.urlParams_.Set("prettyPrint", "false")
  1628  	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+parent}:listSpans")
  1629  	urls += "?" + c.urlParams_.Encode()
  1630  	req, err := http.NewRequest("GET", urls, body)
  1631  	if err != nil {
  1632  		return nil, err
  1633  	}
  1634  	req.Header = reqHeaders
  1635  	googleapi.Expand(req.URL, map[string]string{
  1636  		"parent": c.parent,
  1637  	})
  1638  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1639  }
  1640  
  1641  // Do executes the "tracing.projects.traces.listSpans" call.
  1642  // Exactly one of *ListSpansResponse or error will be non-nil. Any
  1643  // non-2xx status code is an error. Response headers are in either
  1644  // *ListSpansResponse.ServerResponse.Header or (if a response was
  1645  // returned at all) in error.(*googleapi.Error).Header. Use
  1646  // googleapi.IsNotModified to check whether the returned error was
  1647  // because http.StatusNotModified was returned.
  1648  func (c *ProjectsTracesListSpansCall) Do(opts ...googleapi.CallOption) (*ListSpansResponse, error) {
  1649  	gensupport.SetOptions(c.urlParams_, opts...)
  1650  	res, err := c.doRequest("json")
  1651  	if res != nil && res.StatusCode == http.StatusNotModified {
  1652  		if res.Body != nil {
  1653  			res.Body.Close()
  1654  		}
  1655  		return nil, &googleapi.Error{
  1656  			Code:   res.StatusCode,
  1657  			Header: res.Header,
  1658  		}
  1659  	}
  1660  	if err != nil {
  1661  		return nil, err
  1662  	}
  1663  	defer googleapi.CloseBody(res)
  1664  	if err := googleapi.CheckResponse(res); err != nil {
  1665  		return nil, err
  1666  	}
  1667  	ret := &ListSpansResponse{
  1668  		ServerResponse: googleapi.ServerResponse{
  1669  			Header:         res.Header,
  1670  			HTTPStatusCode: res.StatusCode,
  1671  		},
  1672  	}
  1673  	target := &ret
  1674  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1675  		return nil, err
  1676  	}
  1677  	return ret, nil
  1678  	// {
  1679  	//   "description": "Returns a list of spans within a trace.",
  1680  	//   "flatPath": "v2/projects/{projectsId}/traces/{tracesId}:listSpans",
  1681  	//   "httpMethod": "GET",
  1682  	//   "id": "tracing.projects.traces.listSpans",
  1683  	//   "parameterOrder": [
  1684  	//     "parent"
  1685  	//   ],
  1686  	//   "parameters": {
  1687  	//     "pageToken": {
  1688  	//       "description": "Token identifying the page of results to return. If provided, use the\nvalue of the `nextPageToken` field from a previous request. Optional.",
  1689  	//       "location": "query",
  1690  	//       "type": "string"
  1691  	//     },
  1692  	//     "parent": {
  1693  	//       "description": "ID of the trace for which to list child spans. Format is\n`projects/PROJECT_ID/traces/TRACE_ID`.",
  1694  	//       "location": "path",
  1695  	//       "pattern": "^projects/[^/]+/traces/[^/]+$",
  1696  	//       "required": true,
  1697  	//       "type": "string"
  1698  	//     }
  1699  	//   },
  1700  	//   "path": "v2/{+parent}:listSpans",
  1701  	//   "response": {
  1702  	//     "$ref": "ListSpansResponse"
  1703  	//   },
  1704  	//   "scopes": [
  1705  	//     "https://www.googleapis.com/auth/cloud-platform",
  1706  	//     "https://www.googleapis.com/auth/trace.readonly"
  1707  	//   ]
  1708  	// }
  1709  
  1710  }
  1711  
  1712  // Pages invokes f for each page of results.
  1713  // A non-nil error returned from f will halt the iteration.
  1714  // The provided context supersedes any context provided to the Context method.
  1715  func (c *ProjectsTracesListSpansCall) Pages(ctx context.Context, f func(*ListSpansResponse) error) error {
  1716  	c.ctx_ = ctx
  1717  	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  1718  	for {
  1719  		x, err := c.Do()
  1720  		if err != nil {
  1721  			return err
  1722  		}
  1723  		if err := f(x); err != nil {
  1724  			return err
  1725  		}
  1726  		if x.NextPageToken == "" {
  1727  			return nil
  1728  		}
  1729  		c.PageToken(x.NextPageToken)
  1730  	}
  1731  }
  1732  
  1733  // method id "tracing.projects.traces.spans.create":
  1734  
  1735  type ProjectsTracesSpansCreateCall struct {
  1736  	s          *Service
  1737  	nameid     string
  1738  	span       *Span
  1739  	urlParams_ gensupport.URLParams
  1740  	ctx_       context.Context
  1741  	header_    http.Header
  1742  }
  1743  
  1744  // Create: Creates a new Span.
  1745  func (r *ProjectsTracesSpansService) Create(nameid string, span *Span) *ProjectsTracesSpansCreateCall {
  1746  	c := &ProjectsTracesSpansCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1747  	c.nameid = nameid
  1748  	c.span = span
  1749  	return c
  1750  }
  1751  
  1752  // Fields allows partial responses to be retrieved. See
  1753  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1754  // for more information.
  1755  func (c *ProjectsTracesSpansCreateCall) Fields(s ...googleapi.Field) *ProjectsTracesSpansCreateCall {
  1756  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1757  	return c
  1758  }
  1759  
  1760  // Context sets the context to be used in this call's Do method. Any
  1761  // pending HTTP request will be aborted if the provided context is
  1762  // canceled.
  1763  func (c *ProjectsTracesSpansCreateCall) Context(ctx context.Context) *ProjectsTracesSpansCreateCall {
  1764  	c.ctx_ = ctx
  1765  	return c
  1766  }
  1767  
  1768  // Header returns an http.Header that can be modified by the caller to
  1769  // add HTTP headers to the request.
  1770  func (c *ProjectsTracesSpansCreateCall) Header() http.Header {
  1771  	if c.header_ == nil {
  1772  		c.header_ = make(http.Header)
  1773  	}
  1774  	return c.header_
  1775  }
  1776  
  1777  func (c *ProjectsTracesSpansCreateCall) doRequest(alt string) (*http.Response, error) {
  1778  	reqHeaders := make(http.Header)
  1779  	reqHeaders.Set("x-goog-api-client", "gl-go/1.13.7 gdcl/20200203")
  1780  	for k, v := range c.header_ {
  1781  		reqHeaders[k] = v
  1782  	}
  1783  	reqHeaders.Set("User-Agent", c.s.userAgent())
  1784  	var body io.Reader = nil
  1785  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.span)
  1786  	if err != nil {
  1787  		return nil, err
  1788  	}
  1789  	reqHeaders.Set("Content-Type", "application/json")
  1790  	c.urlParams_.Set("alt", alt)
  1791  	c.urlParams_.Set("prettyPrint", "false")
  1792  	urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  1793  	urls += "?" + c.urlParams_.Encode()
  1794  	req, err := http.NewRequest("PUT", urls, body)
  1795  	if err != nil {
  1796  		return nil, err
  1797  	}
  1798  	req.Header = reqHeaders
  1799  	googleapi.Expand(req.URL, map[string]string{
  1800  		"name": c.nameid,
  1801  	})
  1802  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1803  }
  1804  
  1805  // Do executes the "tracing.projects.traces.spans.create" call.
  1806  // Exactly one of *Span or error will be non-nil. Any non-2xx status
  1807  // code is an error. Response headers are in either
  1808  // *Span.ServerResponse.Header or (if a response was returned at all) in
  1809  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1810  // whether the returned error was because http.StatusNotModified was
  1811  // returned.
  1812  func (c *ProjectsTracesSpansCreateCall) Do(opts ...googleapi.CallOption) (*Span, error) {
  1813  	gensupport.SetOptions(c.urlParams_, opts...)
  1814  	res, err := c.doRequest("json")
  1815  	if res != nil && res.StatusCode == http.StatusNotModified {
  1816  		if res.Body != nil {
  1817  			res.Body.Close()
  1818  		}
  1819  		return nil, &googleapi.Error{
  1820  			Code:   res.StatusCode,
  1821  			Header: res.Header,
  1822  		}
  1823  	}
  1824  	if err != nil {
  1825  		return nil, err
  1826  	}
  1827  	defer googleapi.CloseBody(res)
  1828  	if err := googleapi.CheckResponse(res); err != nil {
  1829  		return nil, err
  1830  	}
  1831  	ret := &Span{
  1832  		ServerResponse: googleapi.ServerResponse{
  1833  			Header:         res.Header,
  1834  			HTTPStatusCode: res.StatusCode,
  1835  		},
  1836  	}
  1837  	target := &ret
  1838  	if err := gensupport.DecodeResponse(target, res); err != nil {
  1839  		return nil, err
  1840  	}
  1841  	return ret, nil
  1842  	// {
  1843  	//   "description": "Creates a new Span.",
  1844  	//   "flatPath": "v2/projects/{projectsId}/traces/{tracesId}/spans/{spansId}",
  1845  	//   "httpMethod": "PUT",
  1846  	//   "id": "tracing.projects.traces.spans.create",
  1847  	//   "parameterOrder": [
  1848  	//     "name"
  1849  	//   ],
  1850  	//   "parameters": {
  1851  	//     "name": {
  1852  	//       "description": "The resource name of Span in the format\n`projects/PROJECT_ID/traces/TRACE_ID/spans/SPAN_ID`.\n`TRACE_ID` is a unique identifier for a trace within a project and is a\nbase16-encoded, case-insensitive string and is required to be 32 char long.\n`SPAN_ID` is a unique identifier for a span within a trace. It is a\nbase 16-encoded, case-insensitive string of a 8-bytes array and is required\nto be 16 char long.",
  1853  	//       "location": "path",
  1854  	//       "pattern": "^projects/[^/]+/traces/[^/]+/spans/[^/]+$",
  1855  	//       "required": true,
  1856  	//       "type": "string"
  1857  	//     }
  1858  	//   },
  1859  	//   "path": "v2/{+name}",
  1860  	//   "request": {
  1861  	//     "$ref": "Span"
  1862  	//   },
  1863  	//   "response": {
  1864  	//     "$ref": "Span"
  1865  	//   },
  1866  	//   "scopes": [
  1867  	//     "https://www.googleapis.com/auth/cloud-platform",
  1868  	//     "https://www.googleapis.com/auth/trace.append"
  1869  	//   ]
  1870  	// }
  1871  
  1872  }
  1873  

View as plain text