You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1291 lines
47 KiB

  1. // Copyright 2019 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. // Code generated file. DO NOT EDIT.
  5. // Package cloudtrace provides access to the Stackdriver Trace API.
  6. //
  7. // For product documentation, see: https://cloud.google.com/trace
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/cloudtrace/v2"
  14. // ...
  15. // ctx := context.Background()
  16. // cloudtraceService, err := cloudtrace.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // cloudtraceService, err := cloudtrace.NewService(ctx, option.WithScopes(cloudtrace.TraceAppendScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // cloudtraceService, err := cloudtrace.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // cloudtraceService, err := cloudtrace.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package cloudtrace // import "google.golang.org/api/cloudtrace/v2"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "cloudtrace:v2"
  71. const apiName = "cloudtrace"
  72. const apiVersion = "v2"
  73. const basePath = "https://cloudtrace.googleapis.com/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // View and manage your data across Google Cloud Platform services
  77. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  78. // Write Trace data for a project or application
  79. TraceAppendScope = "https://www.googleapis.com/auth/trace.append"
  80. )
  81. // NewService creates a new Service.
  82. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  83. scopesOption := option.WithScopes(
  84. "https://www.googleapis.com/auth/cloud-platform",
  85. "https://www.googleapis.com/auth/trace.append",
  86. )
  87. // NOTE: prepend, so we don't override user-specified scopes.
  88. opts = append([]option.ClientOption{scopesOption}, opts...)
  89. client, endpoint, err := htransport.NewClient(ctx, opts...)
  90. if err != nil {
  91. return nil, err
  92. }
  93. s, err := New(client)
  94. if err != nil {
  95. return nil, err
  96. }
  97. if endpoint != "" {
  98. s.BasePath = endpoint
  99. }
  100. return s, nil
  101. }
  102. // New creates a new Service. It uses the provided http.Client for requests.
  103. //
  104. // Deprecated: please use NewService instead.
  105. // To provide a custom HTTP client, use option.WithHTTPClient.
  106. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  107. func New(client *http.Client) (*Service, error) {
  108. if client == nil {
  109. return nil, errors.New("client is nil")
  110. }
  111. s := &Service{client: client, BasePath: basePath}
  112. s.Projects = NewProjectsService(s)
  113. return s, nil
  114. }
  115. type Service struct {
  116. client *http.Client
  117. BasePath string // API endpoint base URL
  118. UserAgent string // optional additional User-Agent fragment
  119. Projects *ProjectsService
  120. }
  121. func (s *Service) userAgent() string {
  122. if s.UserAgent == "" {
  123. return googleapi.UserAgent
  124. }
  125. return googleapi.UserAgent + " " + s.UserAgent
  126. }
  127. func NewProjectsService(s *Service) *ProjectsService {
  128. rs := &ProjectsService{s: s}
  129. rs.Traces = NewProjectsTracesService(s)
  130. return rs
  131. }
  132. type ProjectsService struct {
  133. s *Service
  134. Traces *ProjectsTracesService
  135. }
  136. func NewProjectsTracesService(s *Service) *ProjectsTracesService {
  137. rs := &ProjectsTracesService{s: s}
  138. rs.Spans = NewProjectsTracesSpansService(s)
  139. return rs
  140. }
  141. type ProjectsTracesService struct {
  142. s *Service
  143. Spans *ProjectsTracesSpansService
  144. }
  145. func NewProjectsTracesSpansService(s *Service) *ProjectsTracesSpansService {
  146. rs := &ProjectsTracesSpansService{s: s}
  147. return rs
  148. }
  149. type ProjectsTracesSpansService struct {
  150. s *Service
  151. }
  152. // Annotation: Text annotation with a set of attributes.
  153. type Annotation struct {
  154. // Attributes: A set of attributes on the annotation. You can have up to
  155. // 4 attributes
  156. // per Annotation.
  157. Attributes *Attributes `json:"attributes,omitempty"`
  158. // Description: A user-supplied message describing the event. The
  159. // maximum length for
  160. // the description is 256 bytes.
  161. Description *TruncatableString `json:"description,omitempty"`
  162. // ForceSendFields is a list of field names (e.g. "Attributes") to
  163. // unconditionally include in API requests. By default, fields with
  164. // empty values are omitted from API requests. However, any non-pointer,
  165. // non-interface field appearing in ForceSendFields will be sent to the
  166. // server regardless of whether the field is empty or not. This may be
  167. // used to include empty fields in Patch requests.
  168. ForceSendFields []string `json:"-"`
  169. // NullFields is a list of field names (e.g. "Attributes") to include in
  170. // API requests with the JSON null value. By default, fields with empty
  171. // values are omitted from API requests. However, any field with an
  172. // empty value appearing in NullFields will be sent to the server as
  173. // null. It is an error if a field in this list has a non-empty value.
  174. // This may be used to include null fields in Patch requests.
  175. NullFields []string `json:"-"`
  176. }
  177. func (s *Annotation) MarshalJSON() ([]byte, error) {
  178. type NoMethod Annotation
  179. raw := NoMethod(*s)
  180. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  181. }
  182. // AttributeValue: The allowed types for [VALUE] in a `[KEY]:[VALUE]`
  183. // attribute.
  184. type AttributeValue struct {
  185. // BoolValue: A Boolean value represented by `true` or `false`.
  186. BoolValue bool `json:"boolValue,omitempty"`
  187. // IntValue: A 64-bit signed integer.
  188. IntValue int64 `json:"intValue,omitempty,string"`
  189. // StringValue: A string up to 256 bytes long.
  190. StringValue *TruncatableString `json:"stringValue,omitempty"`
  191. // ForceSendFields is a list of field names (e.g. "BoolValue") to
  192. // unconditionally include in API requests. By default, fields with
  193. // empty values are omitted from API requests. However, any non-pointer,
  194. // non-interface field appearing in ForceSendFields will be sent to the
  195. // server regardless of whether the field is empty or not. This may be
  196. // used to include empty fields in Patch requests.
  197. ForceSendFields []string `json:"-"`
  198. // NullFields is a list of field names (e.g. "BoolValue") to include in
  199. // API requests with the JSON null value. By default, fields with empty
  200. // values are omitted from API requests. However, any field with an
  201. // empty value appearing in NullFields will be sent to the server as
  202. // null. It is an error if a field in this list has a non-empty value.
  203. // This may be used to include null fields in Patch requests.
  204. NullFields []string `json:"-"`
  205. }
  206. func (s *AttributeValue) MarshalJSON() ([]byte, error) {
  207. type NoMethod AttributeValue
  208. raw := NoMethod(*s)
  209. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  210. }
  211. // Attributes: A set of attributes, each in the format `[KEY]:[VALUE]`.
  212. type Attributes struct {
  213. // AttributeMap: The set of attributes. Each attribute's key can be up
  214. // to 128 bytes
  215. // long. The value can be a string up to 256 bytes, a signed 64-bit
  216. // integer,
  217. // or the Boolean values `true` and `false`. For example:
  218. //
  219. // "/instance_id": "my-instance"
  220. // "/http/user_agent": ""
  221. // "/http/request_bytes": 300
  222. // "abc.com/myattribute": true
  223. AttributeMap map[string]AttributeValue `json:"attributeMap,omitempty"`
  224. // DroppedAttributesCount: The number of attributes that were discarded.
  225. // Attributes can be discarded
  226. // because their keys are too long or because there are too many
  227. // attributes.
  228. // If this value is 0 then all attributes are valid.
  229. DroppedAttributesCount int64 `json:"droppedAttributesCount,omitempty"`
  230. // ForceSendFields is a list of field names (e.g. "AttributeMap") to
  231. // unconditionally include in API requests. By default, fields with
  232. // empty values are omitted from API requests. However, any non-pointer,
  233. // non-interface field appearing in ForceSendFields will be sent to the
  234. // server regardless of whether the field is empty or not. This may be
  235. // used to include empty fields in Patch requests.
  236. ForceSendFields []string `json:"-"`
  237. // NullFields is a list of field names (e.g. "AttributeMap") to include
  238. // in API requests with the JSON null value. By default, fields with
  239. // empty values are omitted from API requests. However, any field with
  240. // an empty value appearing in NullFields will be sent to the server as
  241. // null. It is an error if a field in this list has a non-empty value.
  242. // This may be used to include null fields in Patch requests.
  243. NullFields []string `json:"-"`
  244. }
  245. func (s *Attributes) MarshalJSON() ([]byte, error) {
  246. type NoMethod Attributes
  247. raw := NoMethod(*s)
  248. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  249. }
  250. // BatchWriteSpansRequest: The request message for the `BatchWriteSpans`
  251. // method.
  252. type BatchWriteSpansRequest struct {
  253. // Spans: A list of new spans. The span names must not match
  254. // existing
  255. // spans, or the results are undefined.
  256. Spans []*Span `json:"spans,omitempty"`
  257. // ForceSendFields is a list of field names (e.g. "Spans") to
  258. // unconditionally include in API requests. By default, fields with
  259. // empty values are omitted from API requests. However, any non-pointer,
  260. // non-interface field appearing in ForceSendFields will be sent to the
  261. // server regardless of whether the field is empty or not. This may be
  262. // used to include empty fields in Patch requests.
  263. ForceSendFields []string `json:"-"`
  264. // NullFields is a list of field names (e.g. "Spans") to include in API
  265. // requests with the JSON null value. By default, fields with empty
  266. // values are omitted from API requests. However, any field with an
  267. // empty value appearing in NullFields will be sent to the server as
  268. // null. It is an error if a field in this list has a non-empty value.
  269. // This may be used to include null fields in Patch requests.
  270. NullFields []string `json:"-"`
  271. }
  272. func (s *BatchWriteSpansRequest) MarshalJSON() ([]byte, error) {
  273. type NoMethod BatchWriteSpansRequest
  274. raw := NoMethod(*s)
  275. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  276. }
  277. // Empty: A generic empty message that you can re-use to avoid defining
  278. // duplicated
  279. // empty messages in your APIs. A typical example is to use it as the
  280. // request
  281. // or the response type of an API method. For instance:
  282. //
  283. // service Foo {
  284. // rpc Bar(google.protobuf.Empty) returns
  285. // (google.protobuf.Empty);
  286. // }
  287. //
  288. // The JSON representation for `Empty` is empty JSON object `{}`.
  289. type Empty struct {
  290. // ServerResponse contains the HTTP response code and headers from the
  291. // server.
  292. googleapi.ServerResponse `json:"-"`
  293. }
  294. // Link: A pointer from the current span to another span in the same
  295. // trace or in a
  296. // different trace. For example, this can be used in batching
  297. // operations,
  298. // where a single batch handler processes multiple requests from
  299. // different
  300. // traces or when the handler receives a request from a different
  301. // project.
  302. type Link struct {
  303. // Attributes: A set of attributes on the link. You have have up to 32
  304. // attributes per
  305. // link.
  306. Attributes *Attributes `json:"attributes,omitempty"`
  307. // SpanId: The [SPAN_ID] for a span within a trace.
  308. SpanId string `json:"spanId,omitempty"`
  309. // TraceId: The [TRACE_ID] for a trace within a project.
  310. TraceId string `json:"traceId,omitempty"`
  311. // Type: The relationship of the current span relative to the linked
  312. // span.
  313. //
  314. // Possible values:
  315. // "TYPE_UNSPECIFIED" - The relationship of the two spans is unknown.
  316. // "CHILD_LINKED_SPAN" - The linked span is a child of the current
  317. // span.
  318. // "PARENT_LINKED_SPAN" - The linked span is a parent of the current
  319. // span.
  320. Type string `json:"type,omitempty"`
  321. // ForceSendFields is a list of field names (e.g. "Attributes") to
  322. // unconditionally include in API requests. By default, fields with
  323. // empty values are omitted from API requests. However, any non-pointer,
  324. // non-interface field appearing in ForceSendFields will be sent to the
  325. // server regardless of whether the field is empty or not. This may be
  326. // used to include empty fields in Patch requests.
  327. ForceSendFields []string `json:"-"`
  328. // NullFields is a list of field names (e.g. "Attributes") to include in
  329. // API requests with the JSON null value. By default, fields with empty
  330. // values are omitted from API requests. However, any field with an
  331. // empty value appearing in NullFields will be sent to the server as
  332. // null. It is an error if a field in this list has a non-empty value.
  333. // This may be used to include null fields in Patch requests.
  334. NullFields []string `json:"-"`
  335. }
  336. func (s *Link) MarshalJSON() ([]byte, error) {
  337. type NoMethod Link
  338. raw := NoMethod(*s)
  339. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  340. }
  341. // Links: A collection of links, which are references from this span to
  342. // a span
  343. // in the same or different trace.
  344. type Links struct {
  345. // DroppedLinksCount: The number of dropped links after the maximum size
  346. // was enforced. If
  347. // this value is 0, then no links were dropped.
  348. DroppedLinksCount int64 `json:"droppedLinksCount,omitempty"`
  349. // Link: A collection of links.
  350. Link []*Link `json:"link,omitempty"`
  351. // ForceSendFields is a list of field names (e.g. "DroppedLinksCount")
  352. // to unconditionally include in API requests. By default, fields with
  353. // empty values are omitted from API requests. However, any non-pointer,
  354. // non-interface field appearing in ForceSendFields will be sent to the
  355. // server regardless of whether the field is empty or not. This may be
  356. // used to include empty fields in Patch requests.
  357. ForceSendFields []string `json:"-"`
  358. // NullFields is a list of field names (e.g. "DroppedLinksCount") to
  359. // include in API requests with the JSON null value. By default, fields
  360. // with empty values are omitted from API requests. However, any field
  361. // with an empty value appearing in NullFields will be sent to the
  362. // server as null. It is an error if a field in this list has a
  363. // non-empty value. This may be used to include null fields in Patch
  364. // requests.
  365. NullFields []string `json:"-"`
  366. }
  367. func (s *Links) MarshalJSON() ([]byte, error) {
  368. type NoMethod Links
  369. raw := NoMethod(*s)
  370. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  371. }
  372. // MessageEvent: An event describing a message sent/received between
  373. // Spans.
  374. type MessageEvent struct {
  375. // CompressedSizeBytes: The number of compressed bytes sent or received.
  376. // If missing assumed to
  377. // be the same size as uncompressed.
  378. CompressedSizeBytes int64 `json:"compressedSizeBytes,omitempty,string"`
  379. // Id: An identifier for the MessageEvent's message that can be used to
  380. // match
  381. // SENT and RECEIVED MessageEvents. It is recommended to be unique
  382. // within
  383. // a Span.
  384. Id int64 `json:"id,omitempty,string"`
  385. // Type: Type of MessageEvent. Indicates whether the message was sent
  386. // or
  387. // received.
  388. //
  389. // Possible values:
  390. // "TYPE_UNSPECIFIED" - Unknown event type.
  391. // "SENT" - Indicates a sent message.
  392. // "RECEIVED" - Indicates a received message.
  393. Type string `json:"type,omitempty"`
  394. // UncompressedSizeBytes: The number of uncompressed bytes sent or
  395. // received.
  396. UncompressedSizeBytes int64 `json:"uncompressedSizeBytes,omitempty,string"`
  397. // ForceSendFields is a list of field names (e.g. "CompressedSizeBytes")
  398. // to unconditionally include in API requests. By default, fields with
  399. // empty values are omitted from API requests. However, any non-pointer,
  400. // non-interface field appearing in ForceSendFields will be sent to the
  401. // server regardless of whether the field is empty or not. This may be
  402. // used to include empty fields in Patch requests.
  403. ForceSendFields []string `json:"-"`
  404. // NullFields is a list of field names (e.g. "CompressedSizeBytes") to
  405. // include in API requests with the JSON null value. By default, fields
  406. // with empty values are omitted from API requests. However, any field
  407. // with an empty value appearing in NullFields will be sent to the
  408. // server as null. It is an error if a field in this list has a
  409. // non-empty value. This may be used to include null fields in Patch
  410. // requests.
  411. NullFields []string `json:"-"`
  412. }
  413. func (s *MessageEvent) MarshalJSON() ([]byte, error) {
  414. type NoMethod MessageEvent
  415. raw := NoMethod(*s)
  416. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  417. }
  418. // Module: Binary module.
  419. type Module struct {
  420. // BuildId: A unique identifier for the module, usually a hash of
  421. // its
  422. // contents (up to 128 bytes).
  423. BuildId *TruncatableString `json:"buildId,omitempty"`
  424. // Module: For example: main binary, kernel modules, and dynamic
  425. // libraries
  426. // such as libc.so, sharedlib.so (up to 256 bytes).
  427. Module *TruncatableString `json:"module,omitempty"`
  428. // ForceSendFields is a list of field names (e.g. "BuildId") to
  429. // unconditionally include in API requests. By default, fields with
  430. // empty values are omitted from API requests. However, any non-pointer,
  431. // non-interface field appearing in ForceSendFields will be sent to the
  432. // server regardless of whether the field is empty or not. This may be
  433. // used to include empty fields in Patch requests.
  434. ForceSendFields []string `json:"-"`
  435. // NullFields is a list of field names (e.g. "BuildId") to include in
  436. // API requests with the JSON null value. By default, fields with empty
  437. // values are omitted from API requests. However, any field with an
  438. // empty value appearing in NullFields will be sent to the server as
  439. // null. It is an error if a field in this list has a non-empty value.
  440. // This may be used to include null fields in Patch requests.
  441. NullFields []string `json:"-"`
  442. }
  443. func (s *Module) MarshalJSON() ([]byte, error) {
  444. type NoMethod Module
  445. raw := NoMethod(*s)
  446. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  447. }
  448. // Span: A span represents a single operation within a trace. Spans can
  449. // be
  450. // nested to form a trace tree. Often, a trace contains a root span
  451. // that describes the end-to-end latency, and one or more subspans
  452. // for
  453. // its sub-operations. A trace can also contain multiple root spans,
  454. // or none at all. Spans do not need to be contiguous—there may
  455. // be
  456. // gaps or overlaps between spans in a trace.
  457. type Span struct {
  458. // Attributes: A set of attributes on the span. You can have up to 32
  459. // attributes per
  460. // span.
  461. Attributes *Attributes `json:"attributes,omitempty"`
  462. // ChildSpanCount: An optional number of child spans that were generated
  463. // while this span
  464. // was active. If set, allows implementation to detect missing child
  465. // spans.
  466. ChildSpanCount int64 `json:"childSpanCount,omitempty"`
  467. // DisplayName: A description of the span's operation (up to 128
  468. // bytes).
  469. // Stackdriver Trace displays the description in the
  470. // Google Cloud Platform Console.
  471. // For example, the display name can be a qualified method name or a
  472. // file name
  473. // and a line number where the operation is called. A best practice is
  474. // to use
  475. // the same display name within an application and at the same call
  476. // point.
  477. // This makes it easier to correlate spans in different traces.
  478. DisplayName *TruncatableString `json:"displayName,omitempty"`
  479. // EndTime: The end time of the span. On the client side, this is the
  480. // time kept by
  481. // the local machine where the span execution ends. On the server side,
  482. // this
  483. // is the time when the server application handler stops running.
  484. EndTime string `json:"endTime,omitempty"`
  485. // Links: Links associated with the span. You can have up to 128 links
  486. // per Span.
  487. Links *Links `json:"links,omitempty"`
  488. // Name: The resource name of the span in the following format:
  489. //
  490. // projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/SPAN_ID is a unique
  491. // identifier for a trace within a project;
  492. // it is a 32-character hexadecimal encoding of a 16-byte
  493. // array.
  494. //
  495. // [SPAN_ID] is a unique identifier for a span within a trace; it
  496. // is a 16-character hexadecimal encoding of an 8-byte array.
  497. Name string `json:"name,omitempty"`
  498. // ParentSpanId: The [SPAN_ID] of this span's parent span. If this is a
  499. // root span,
  500. // then this field must be empty.
  501. ParentSpanId string `json:"parentSpanId,omitempty"`
  502. // SameProcessAsParentSpan: (Optional) Set this parameter to indicate
  503. // whether this span is in
  504. // the same process as its parent. If you do not set this
  505. // parameter,
  506. // Stackdriver Trace is unable to take advantage of this
  507. // helpful
  508. // information.
  509. SameProcessAsParentSpan bool `json:"sameProcessAsParentSpan,omitempty"`
  510. // SpanId: The [SPAN_ID] portion of the span's resource name.
  511. SpanId string `json:"spanId,omitempty"`
  512. // StackTrace: Stack trace captured at the start of the span.
  513. StackTrace *StackTrace `json:"stackTrace,omitempty"`
  514. // StartTime: The start time of the span. On the client side, this is
  515. // the time kept by
  516. // the local machine where the span execution starts. On the server
  517. // side, this
  518. // is the time when the server's application handler starts running.
  519. StartTime string `json:"startTime,omitempty"`
  520. // Status: An optional final status for this span.
  521. Status *Status `json:"status,omitempty"`
  522. // TimeEvents: A set of time events. You can have up to 32 annotations
  523. // and 128 message
  524. // events per span.
  525. TimeEvents *TimeEvents `json:"timeEvents,omitempty"`
  526. // ServerResponse contains the HTTP response code and headers from the
  527. // server.
  528. googleapi.ServerResponse `json:"-"`
  529. // ForceSendFields is a list of field names (e.g. "Attributes") 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. // NullFields is a list of field names (e.g. "Attributes") to include in
  537. // API requests with the JSON null value. By default, fields with empty
  538. // values are omitted from API requests. However, any field with an
  539. // empty value appearing in NullFields will be sent to the server as
  540. // null. It is an error if a field in this list has a non-empty value.
  541. // This may be used to include null fields in Patch requests.
  542. NullFields []string `json:"-"`
  543. }
  544. func (s *Span) MarshalJSON() ([]byte, error) {
  545. type NoMethod Span
  546. raw := NoMethod(*s)
  547. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  548. }
  549. // StackFrame: Represents a single stack frame in a stack trace.
  550. type StackFrame struct {
  551. // ColumnNumber: The column number where the function call appears, if
  552. // available.
  553. // This is important in JavaScript because of its anonymous functions.
  554. ColumnNumber int64 `json:"columnNumber,omitempty,string"`
  555. // FileName: The name of the source file where the function call appears
  556. // (up to 256
  557. // bytes).
  558. FileName *TruncatableString `json:"fileName,omitempty"`
  559. // FunctionName: The fully-qualified name that uniquely identifies the
  560. // function or
  561. // method that is active in this frame (up to 1024 bytes).
  562. FunctionName *TruncatableString `json:"functionName,omitempty"`
  563. // LineNumber: The line number in `file_name` where the function call
  564. // appears.
  565. LineNumber int64 `json:"lineNumber,omitempty,string"`
  566. // LoadModule: The binary module from where the code was loaded.
  567. LoadModule *Module `json:"loadModule,omitempty"`
  568. // OriginalFunctionName: An un-mangled function name, if `function_name`
  569. // is
  570. // [mangled](http://www.avabodh.com/cxxin/namemangling.html). The name
  571. // can
  572. // be fully-qualified (up to 1024 bytes).
  573. OriginalFunctionName *TruncatableString `json:"originalFunctionName,omitempty"`
  574. // SourceVersion: The version of the deployed source code (up to 128
  575. // bytes).
  576. SourceVersion *TruncatableString `json:"sourceVersion,omitempty"`
  577. // ForceSendFields is a list of field names (e.g. "ColumnNumber") to
  578. // unconditionally include in API requests. By default, fields with
  579. // empty values are omitted from API requests. However, any non-pointer,
  580. // non-interface field appearing in ForceSendFields will be sent to the
  581. // server regardless of whether the field is empty or not. This may be
  582. // used to include empty fields in Patch requests.
  583. ForceSendFields []string `json:"-"`
  584. // NullFields is a list of field names (e.g. "ColumnNumber") to include
  585. // in API requests with the JSON null value. By default, fields with
  586. // empty values are omitted from API requests. However, any field with
  587. // an empty value appearing in NullFields will be sent to the server as
  588. // null. It is an error if a field in this list has a non-empty value.
  589. // This may be used to include null fields in Patch requests.
  590. NullFields []string `json:"-"`
  591. }
  592. func (s *StackFrame) MarshalJSON() ([]byte, error) {
  593. type NoMethod StackFrame
  594. raw := NoMethod(*s)
  595. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  596. }
  597. // StackFrames: A collection of stack frames, which can be truncated.
  598. type StackFrames struct {
  599. // DroppedFramesCount: The number of stack frames that were dropped
  600. // because there
  601. // were too many stack frames.
  602. // If this value is 0, then no stack frames were dropped.
  603. DroppedFramesCount int64 `json:"droppedFramesCount,omitempty"`
  604. // Frame: Stack frames in this call stack.
  605. Frame []*StackFrame `json:"frame,omitempty"`
  606. // ForceSendFields is a list of field names (e.g. "DroppedFramesCount")
  607. // to unconditionally include in API requests. By default, fields with
  608. // empty values are omitted from API requests. However, any non-pointer,
  609. // non-interface field appearing in ForceSendFields will be sent to the
  610. // server regardless of whether the field is empty or not. This may be
  611. // used to include empty fields in Patch requests.
  612. ForceSendFields []string `json:"-"`
  613. // NullFields is a list of field names (e.g. "DroppedFramesCount") to
  614. // include in API requests with the JSON null value. By default, fields
  615. // with empty values are omitted from API requests. However, any field
  616. // with an empty value appearing in NullFields will be sent to the
  617. // server as null. It is an error if a field in this list has a
  618. // non-empty value. This may be used to include null fields in Patch
  619. // requests.
  620. NullFields []string `json:"-"`
  621. }
  622. func (s *StackFrames) MarshalJSON() ([]byte, error) {
  623. type NoMethod StackFrames
  624. raw := NoMethod(*s)
  625. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  626. }
  627. // StackTrace: A call stack appearing in a trace.
  628. type StackTrace struct {
  629. // StackFrames: Stack frames in this stack trace. A maximum of 128
  630. // frames are allowed.
  631. StackFrames *StackFrames `json:"stackFrames,omitempty"`
  632. // StackTraceHashId: The hash ID is used to conserve network bandwidth
  633. // for duplicate
  634. // stack traces within a single trace.
  635. //
  636. // Often multiple spans will have identical stack traces.
  637. // The first occurrence of a stack trace should contain both
  638. // the
  639. // `stackFrame` content and a value in `stackTraceHashId`.
  640. //
  641. // Subsequent spans within the same request can refer
  642. // to that stack trace by only setting `stackTraceHashId`.
  643. StackTraceHashId int64 `json:"stackTraceHashId,omitempty,string"`
  644. // ForceSendFields is a list of field names (e.g. "StackFrames") to
  645. // unconditionally include in API requests. By default, fields with
  646. // empty values are omitted from API requests. However, any non-pointer,
  647. // non-interface field appearing in ForceSendFields will be sent to the
  648. // server regardless of whether the field is empty or not. This may be
  649. // used to include empty fields in Patch requests.
  650. ForceSendFields []string `json:"-"`
  651. // NullFields is a list of field names (e.g. "StackFrames") to include
  652. // in API requests with the JSON null value. By default, fields with
  653. // empty values are omitted from API requests. However, any field with
  654. // an empty value appearing in NullFields will be sent to the server as
  655. // null. It is an error if a field in this list has a non-empty value.
  656. // This may be used to include null fields in Patch requests.
  657. NullFields []string `json:"-"`
  658. }
  659. func (s *StackTrace) MarshalJSON() ([]byte, error) {
  660. type NoMethod StackTrace
  661. raw := NoMethod(*s)
  662. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  663. }
  664. // Status: The `Status` type defines a logical error model that is
  665. // suitable for different
  666. // programming environments, including REST APIs and RPC APIs. It is
  667. // used by
  668. // [gRPC](https://github.com/grpc). The error model is designed to
  669. // be:
  670. //
  671. // - Simple to use and understand for most users
  672. // - Flexible enough to meet unexpected needs
  673. //
  674. // # Overview
  675. //
  676. // The `Status` message contains three pieces of data: error code, error
  677. // message,
  678. // and error details. The error code should be an enum value
  679. // of
  680. // google.rpc.Code, but it may accept additional error codes if needed.
  681. // The
  682. // error message should be a developer-facing English message that
  683. // helps
  684. // developers *understand* and *resolve* the error. If a localized
  685. // user-facing
  686. // error message is needed, put the localized message in the error
  687. // details or
  688. // localize it in the client. The optional error details may contain
  689. // arbitrary
  690. // information about the error. There is a predefined set of error
  691. // detail types
  692. // in the package `google.rpc` that can be used for common error
  693. // conditions.
  694. //
  695. // # Language mapping
  696. //
  697. // The `Status` message is the logical representation of the error
  698. // model, but it
  699. // is not necessarily the actual wire format. When the `Status` message
  700. // is
  701. // exposed in different client libraries and different wire protocols,
  702. // it can be
  703. // mapped differently. For example, it will likely be mapped to some
  704. // exceptions
  705. // in Java, but more likely mapped to some error codes in C.
  706. //
  707. // # Other uses
  708. //
  709. // The error model and the `Status` message can be used in a variety
  710. // of
  711. // environments, either with or without APIs, to provide a
  712. // consistent developer experience across different
  713. // environments.
  714. //
  715. // Example uses of this error model include:
  716. //
  717. // - Partial errors. If a service needs to return partial errors to the
  718. // client,
  719. // it may embed the `Status` in the normal response to indicate the
  720. // partial
  721. // errors.
  722. //
  723. // - Workflow errors. A typical workflow has multiple steps. Each step
  724. // may
  725. // have a `Status` message for error reporting.
  726. //
  727. // - Batch operations. If a client uses batch request and batch
  728. // response, the
  729. // `Status` message should be used directly inside batch response,
  730. // one for
  731. // each error sub-response.
  732. //
  733. // - Asynchronous operations. If an API call embeds asynchronous
  734. // operation
  735. // results in its response, the status of those operations should
  736. // be
  737. // represented directly using the `Status` message.
  738. //
  739. // - Logging. If some API errors are stored in logs, the message
  740. // `Status` could
  741. // be used directly after any stripping needed for security/privacy
  742. // reasons.
  743. type Status struct {
  744. // Code: The status code, which should be an enum value of
  745. // google.rpc.Code.
  746. Code int64 `json:"code,omitempty"`
  747. // Details: A list of messages that carry the error details. There is a
  748. // common set of
  749. // message types for APIs to use.
  750. Details []googleapi.RawMessage `json:"details,omitempty"`
  751. // Message: A developer-facing error message, which should be in
  752. // English. Any
  753. // user-facing error message should be localized and sent in
  754. // the
  755. // google.rpc.Status.details field, or localized by the client.
  756. Message string `json:"message,omitempty"`
  757. // ForceSendFields is a list of field names (e.g. "Code") to
  758. // unconditionally include in API requests. By default, fields with
  759. // empty values are omitted from API requests. However, any non-pointer,
  760. // non-interface field appearing in ForceSendFields will be sent to the
  761. // server regardless of whether the field is empty or not. This may be
  762. // used to include empty fields in Patch requests.
  763. ForceSendFields []string `json:"-"`
  764. // NullFields is a list of field names (e.g. "Code") to include in API
  765. // requests with the JSON null value. By default, fields with empty
  766. // values are omitted from API requests. However, any field with an
  767. // empty value appearing in NullFields will be sent to the server as
  768. // null. It is an error if a field in this list has a non-empty value.
  769. // This may be used to include null fields in Patch requests.
  770. NullFields []string `json:"-"`
  771. }
  772. func (s *Status) MarshalJSON() ([]byte, error) {
  773. type NoMethod Status
  774. raw := NoMethod(*s)
  775. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  776. }
  777. // TimeEvent: A time-stamped annotation or message event in the Span.
  778. type TimeEvent struct {
  779. // Annotation: Text annotation with a set of attributes.
  780. Annotation *Annotation `json:"annotation,omitempty"`
  781. // MessageEvent: An event describing a message sent/received between
  782. // Spans.
  783. MessageEvent *MessageEvent `json:"messageEvent,omitempty"`
  784. // Time: The timestamp indicating the time the event occurred.
  785. Time string `json:"time,omitempty"`
  786. // ForceSendFields is a list of field names (e.g. "Annotation") to
  787. // unconditionally include in API requests. By default, fields with
  788. // empty values are omitted from API requests. However, any non-pointer,
  789. // non-interface field appearing in ForceSendFields will be sent to the
  790. // server regardless of whether the field is empty or not. This may be
  791. // used to include empty fields in Patch requests.
  792. ForceSendFields []string `json:"-"`
  793. // NullFields is a list of field names (e.g. "Annotation") to include in
  794. // API requests with the JSON null value. By default, fields with empty
  795. // values are omitted from API requests. However, any field with an
  796. // empty value appearing in NullFields will be sent to the server as
  797. // null. It is an error if a field in this list has a non-empty value.
  798. // This may be used to include null fields in Patch requests.
  799. NullFields []string `json:"-"`
  800. }
  801. func (s *TimeEvent) MarshalJSON() ([]byte, error) {
  802. type NoMethod TimeEvent
  803. raw := NoMethod(*s)
  804. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  805. }
  806. // TimeEvents: A collection of `TimeEvent`s. A `TimeEvent` is a
  807. // time-stamped annotation
  808. // on the span, consisting of either user-supplied key:value pairs,
  809. // or
  810. // details of a message sent/received between Spans.
  811. type TimeEvents struct {
  812. // DroppedAnnotationsCount: The number of dropped annotations in all the
  813. // included time events.
  814. // If the value is 0, then no annotations were dropped.
  815. DroppedAnnotationsCount int64 `json:"droppedAnnotationsCount,omitempty"`
  816. // DroppedMessageEventsCount: The number of dropped message events in
  817. // all the included time events.
  818. // If the value is 0, then no message events were dropped.
  819. DroppedMessageEventsCount int64 `json:"droppedMessageEventsCount,omitempty"`
  820. // TimeEvent: A collection of `TimeEvent`s.
  821. TimeEvent []*TimeEvent `json:"timeEvent,omitempty"`
  822. // ForceSendFields is a list of field names (e.g.
  823. // "DroppedAnnotationsCount") to unconditionally include in API
  824. // requests. By default, fields with empty values are omitted from API
  825. // requests. However, any non-pointer, non-interface field appearing in
  826. // ForceSendFields will be sent to the server regardless of whether the
  827. // field is empty or not. This may be used to include empty fields in
  828. // Patch requests.
  829. ForceSendFields []string `json:"-"`
  830. // NullFields is a list of field names (e.g. "DroppedAnnotationsCount")
  831. // to include in API requests with the JSON null value. By default,
  832. // fields with empty values are omitted from API requests. However, any
  833. // field with an empty value appearing in NullFields will be sent to the
  834. // server as null. It is an error if a field in this list has a
  835. // non-empty value. This may be used to include null fields in Patch
  836. // requests.
  837. NullFields []string `json:"-"`
  838. }
  839. func (s *TimeEvents) MarshalJSON() ([]byte, error) {
  840. type NoMethod TimeEvents
  841. raw := NoMethod(*s)
  842. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  843. }
  844. // TruncatableString: Represents a string that might be shortened to a
  845. // specified length.
  846. type TruncatableString struct {
  847. // TruncatedByteCount: The number of bytes removed from the original
  848. // string. If this
  849. // value is 0, then the string was not shortened.
  850. TruncatedByteCount int64 `json:"truncatedByteCount,omitempty"`
  851. // Value: The shortened string. For example, if the original string is
  852. // 500
  853. // bytes long and the limit of the string is 128 bytes, then
  854. // `value` contains the first 128 bytes of the 500-byte
  855. // string.
  856. //
  857. // Truncation always happens on a UTF8 character boundary. If there
  858. // are multi-byte characters in the string, then the length of
  859. // the
  860. // shortened string might be less than the size limit.
  861. Value string `json:"value,omitempty"`
  862. // ForceSendFields is a list of field names (e.g. "TruncatedByteCount")
  863. // to unconditionally include in API requests. By default, fields with
  864. // empty values are omitted from API requests. However, any non-pointer,
  865. // non-interface field appearing in ForceSendFields will be sent to the
  866. // server regardless of whether the field is empty or not. This may be
  867. // used to include empty fields in Patch requests.
  868. ForceSendFields []string `json:"-"`
  869. // NullFields is a list of field names (e.g. "TruncatedByteCount") to
  870. // include in API requests with the JSON null value. By default, fields
  871. // with empty values are omitted from API requests. However, any field
  872. // with an empty value appearing in NullFields will be sent to the
  873. // server as null. It is an error if a field in this list has a
  874. // non-empty value. This may be used to include null fields in Patch
  875. // requests.
  876. NullFields []string `json:"-"`
  877. }
  878. func (s *TruncatableString) MarshalJSON() ([]byte, error) {
  879. type NoMethod TruncatableString
  880. raw := NoMethod(*s)
  881. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  882. }
  883. // method id "cloudtrace.projects.traces.batchWrite":
  884. type ProjectsTracesBatchWriteCall struct {
  885. s *Service
  886. name string
  887. batchwritespansrequest *BatchWriteSpansRequest
  888. urlParams_ gensupport.URLParams
  889. ctx_ context.Context
  890. header_ http.Header
  891. }
  892. // BatchWrite: Sends new spans to new or existing traces. You cannot
  893. // update
  894. // existing spans.
  895. func (r *ProjectsTracesService) BatchWrite(name string, batchwritespansrequest *BatchWriteSpansRequest) *ProjectsTracesBatchWriteCall {
  896. c := &ProjectsTracesBatchWriteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  897. c.name = name
  898. c.batchwritespansrequest = batchwritespansrequest
  899. return c
  900. }
  901. // Fields allows partial responses to be retrieved. See
  902. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  903. // for more information.
  904. func (c *ProjectsTracesBatchWriteCall) Fields(s ...googleapi.Field) *ProjectsTracesBatchWriteCall {
  905. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  906. return c
  907. }
  908. // Context sets the context to be used in this call's Do method. Any
  909. // pending HTTP request will be aborted if the provided context is
  910. // canceled.
  911. func (c *ProjectsTracesBatchWriteCall) Context(ctx context.Context) *ProjectsTracesBatchWriteCall {
  912. c.ctx_ = ctx
  913. return c
  914. }
  915. // Header returns an http.Header that can be modified by the caller to
  916. // add HTTP headers to the request.
  917. func (c *ProjectsTracesBatchWriteCall) Header() http.Header {
  918. if c.header_ == nil {
  919. c.header_ = make(http.Header)
  920. }
  921. return c.header_
  922. }
  923. func (c *ProjectsTracesBatchWriteCall) doRequest(alt string) (*http.Response, error) {
  924. reqHeaders := make(http.Header)
  925. for k, v := range c.header_ {
  926. reqHeaders[k] = v
  927. }
  928. reqHeaders.Set("User-Agent", c.s.userAgent())
  929. var body io.Reader = nil
  930. body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchwritespansrequest)
  931. if err != nil {
  932. return nil, err
  933. }
  934. reqHeaders.Set("Content-Type", "application/json")
  935. c.urlParams_.Set("alt", alt)
  936. c.urlParams_.Set("prettyPrint", "false")
  937. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}/traces:batchWrite")
  938. urls += "?" + c.urlParams_.Encode()
  939. req, err := http.NewRequest("POST", urls, body)
  940. if err != nil {
  941. return nil, err
  942. }
  943. req.Header = reqHeaders
  944. googleapi.Expand(req.URL, map[string]string{
  945. "name": c.name,
  946. })
  947. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  948. }
  949. // Do executes the "cloudtrace.projects.traces.batchWrite" call.
  950. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  951. // code is an error. Response headers are in either
  952. // *Empty.ServerResponse.Header or (if a response was returned at all)
  953. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  954. // check whether the returned error was because http.StatusNotModified
  955. // was returned.
  956. func (c *ProjectsTracesBatchWriteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  957. gensupport.SetOptions(c.urlParams_, opts...)
  958. res, err := c.doRequest("json")
  959. if res != nil && res.StatusCode == http.StatusNotModified {
  960. if res.Body != nil {
  961. res.Body.Close()
  962. }
  963. return nil, &googleapi.Error{
  964. Code: res.StatusCode,
  965. Header: res.Header,
  966. }
  967. }
  968. if err != nil {
  969. return nil, err
  970. }
  971. defer googleapi.CloseBody(res)
  972. if err := googleapi.CheckResponse(res); err != nil {
  973. return nil, err
  974. }
  975. ret := &Empty{
  976. ServerResponse: googleapi.ServerResponse{
  977. Header: res.Header,
  978. HTTPStatusCode: res.StatusCode,
  979. },
  980. }
  981. target := &ret
  982. if err := gensupport.DecodeResponse(target, res); err != nil {
  983. return nil, err
  984. }
  985. return ret, nil
  986. // {
  987. // "description": "Sends new spans to new or existing traces. You cannot update\nexisting spans.",
  988. // "flatPath": "v2/projects/{projectsId}/traces:batchWrite",
  989. // "httpMethod": "POST",
  990. // "id": "cloudtrace.projects.traces.batchWrite",
  991. // "parameterOrder": [
  992. // "name"
  993. // ],
  994. // "parameters": {
  995. // "name": {
  996. // "description": "Required. The name of the project where the spans belong. The format is\n`projects/[PROJECT_ID]`.",
  997. // "location": "path",
  998. // "pattern": "^projects/[^/]+$",
  999. // "required": true,
  1000. // "type": "string"
  1001. // }
  1002. // },
  1003. // "path": "v2/{+name}/traces:batchWrite",
  1004. // "request": {
  1005. // "$ref": "BatchWriteSpansRequest"
  1006. // },
  1007. // "response": {
  1008. // "$ref": "Empty"
  1009. // },
  1010. // "scopes": [
  1011. // "https://www.googleapis.com/auth/cloud-platform",
  1012. // "https://www.googleapis.com/auth/trace.append"
  1013. // ]
  1014. // }
  1015. }
  1016. // method id "cloudtrace.projects.traces.spans.createSpan":
  1017. type ProjectsTracesSpansCreateSpanCall struct {
  1018. s *Service
  1019. nameid string
  1020. span *Span
  1021. urlParams_ gensupport.URLParams
  1022. ctx_ context.Context
  1023. header_ http.Header
  1024. }
  1025. // CreateSpan: Creates a new span.
  1026. func (r *ProjectsTracesSpansService) CreateSpan(nameid string, span *Span) *ProjectsTracesSpansCreateSpanCall {
  1027. c := &ProjectsTracesSpansCreateSpanCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1028. c.nameid = nameid
  1029. c.span = span
  1030. return c
  1031. }
  1032. // Fields allows partial responses to be retrieved. See
  1033. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1034. // for more information.
  1035. func (c *ProjectsTracesSpansCreateSpanCall) Fields(s ...googleapi.Field) *ProjectsTracesSpansCreateSpanCall {
  1036. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1037. return c
  1038. }
  1039. // Context sets the context to be used in this call's Do method. Any
  1040. // pending HTTP request will be aborted if the provided context is
  1041. // canceled.
  1042. func (c *ProjectsTracesSpansCreateSpanCall) Context(ctx context.Context) *ProjectsTracesSpansCreateSpanCall {
  1043. c.ctx_ = ctx
  1044. return c
  1045. }
  1046. // Header returns an http.Header that can be modified by the caller to
  1047. // add HTTP headers to the request.
  1048. func (c *ProjectsTracesSpansCreateSpanCall) Header() http.Header {
  1049. if c.header_ == nil {
  1050. c.header_ = make(http.Header)
  1051. }
  1052. return c.header_
  1053. }
  1054. func (c *ProjectsTracesSpansCreateSpanCall) doRequest(alt string) (*http.Response, error) {
  1055. reqHeaders := make(http.Header)
  1056. for k, v := range c.header_ {
  1057. reqHeaders[k] = v
  1058. }
  1059. reqHeaders.Set("User-Agent", c.s.userAgent())
  1060. var body io.Reader = nil
  1061. body, err := googleapi.WithoutDataWrapper.JSONReader(c.span)
  1062. if err != nil {
  1063. return nil, err
  1064. }
  1065. reqHeaders.Set("Content-Type", "application/json")
  1066. c.urlParams_.Set("alt", alt)
  1067. c.urlParams_.Set("prettyPrint", "false")
  1068. urls := googleapi.ResolveRelative(c.s.BasePath, "v2/{+name}")
  1069. urls += "?" + c.urlParams_.Encode()
  1070. req, err := http.NewRequest("POST", urls, body)
  1071. if err != nil {
  1072. return nil, err
  1073. }
  1074. req.Header = reqHeaders
  1075. googleapi.Expand(req.URL, map[string]string{
  1076. "name": c.nameid,
  1077. })
  1078. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1079. }
  1080. // Do executes the "cloudtrace.projects.traces.spans.createSpan" call.
  1081. // Exactly one of *Span or error will be non-nil. Any non-2xx status
  1082. // code is an error. Response headers are in either
  1083. // *Span.ServerResponse.Header or (if a response was returned at all) in
  1084. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1085. // whether the returned error was because http.StatusNotModified was
  1086. // returned.
  1087. func (c *ProjectsTracesSpansCreateSpanCall) Do(opts ...googleapi.CallOption) (*Span, error) {
  1088. gensupport.SetOptions(c.urlParams_, opts...)
  1089. res, err := c.doRequest("json")
  1090. if res != nil && res.StatusCode == http.StatusNotModified {
  1091. if res.Body != nil {
  1092. res.Body.Close()
  1093. }
  1094. return nil, &googleapi.Error{
  1095. Code: res.StatusCode,
  1096. Header: res.Header,
  1097. }
  1098. }
  1099. if err != nil {
  1100. return nil, err
  1101. }
  1102. defer googleapi.CloseBody(res)
  1103. if err := googleapi.CheckResponse(res); err != nil {
  1104. return nil, err
  1105. }
  1106. ret := &Span{
  1107. ServerResponse: googleapi.ServerResponse{
  1108. Header: res.Header,
  1109. HTTPStatusCode: res.StatusCode,
  1110. },
  1111. }
  1112. target := &ret
  1113. if err := gensupport.DecodeResponse(target, res); err != nil {
  1114. return nil, err
  1115. }
  1116. return ret, nil
  1117. // {
  1118. // "description": "Creates a new span.",
  1119. // "flatPath": "v2/projects/{projectsId}/traces/{tracesId}/spans/{spansId}",
  1120. // "httpMethod": "POST",
  1121. // "id": "cloudtrace.projects.traces.spans.createSpan",
  1122. // "parameterOrder": [
  1123. // "name"
  1124. // ],
  1125. // "parameters": {
  1126. // "name": {
  1127. // "description": "The resource name of the span in the following format:\n\n projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/SPAN_ID is a unique identifier for a trace within a project;\nit is a 32-character hexadecimal encoding of a 16-byte array.\n\n[SPAN_ID] is a unique identifier for a span within a trace; it\nis a 16-character hexadecimal encoding of an 8-byte array.",
  1128. // "location": "path",
  1129. // "pattern": "^projects/[^/]+/traces/[^/]+/spans/[^/]+$",
  1130. // "required": true,
  1131. // "type": "string"
  1132. // }
  1133. // },
  1134. // "path": "v2/{+name}",
  1135. // "request": {
  1136. // "$ref": "Span"
  1137. // },
  1138. // "response": {
  1139. // "$ref": "Span"
  1140. // },
  1141. // "scopes": [
  1142. // "https://www.googleapis.com/auth/cloud-platform",
  1143. // "https://www.googleapis.com/auth/trace.append"
  1144. // ]
  1145. // }
  1146. }