cloudtrace

package
v0.48.1-0...-67a0a95 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package cloudtrace provides access to the Cloud Trace API.

For product documentation, see: https://cloud.google.com/trace

Creating a client

Usage example:

import "google.golang.org/api/cloudtrace/v2beta1"
...
ctx := context.Background()
cloudtraceService, err := cloudtrace.NewService(ctx)

In this example, Google Application Default Credentials are used for authentication.

For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.

Other authentication options

By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:

cloudtraceService, err := cloudtrace.NewService(ctx, option.WithScopes(cloudtrace.TraceReadonlyScope))

To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:

cloudtraceService, err := cloudtrace.NewService(ctx, option.WithAPIKey("AIza..."))

To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:

config := &oauth2.Config{...}
// ...
token, err := config.Exchange(ctx, ...)
cloudtraceService, err := cloudtrace.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))

See https://godoc.org/google.golang.org/api/option/ for details on options.

Index

Constants

View Source
const (
	// See, edit, configure, and delete your Google Cloud Platform data
	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"

	// Write Trace data for a project or application
	TraceAppendScope = "https://www.googleapis.com/auth/trace.append"

	// Read Trace data for a project or application
	TraceReadonlyScope = "https://www.googleapis.com/auth/trace.readonly"
)

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

This section is empty.

Types

type Empty

type Empty struct {
	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`
}

Empty: A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON object `{}`.

type ListTraceSinksResponse

type ListTraceSinksResponse struct {
	// NextPageToken: If there might be more results than appear in this
	// response, then `nextPageToken` is included. To get the next set of
	// results, call the same method again using the value of
	// `nextPageToken` as `pageToken`.
	NextPageToken string `json:"nextPageToken,omitempty"`

	// Sinks: A list of sinks.
	Sinks []*TraceSink `json:"sinks,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "NextPageToken") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

ListTraceSinksResponse: Result returned from `ListTraceSinks`.

func (*ListTraceSinksResponse) MarshalJSON

func (s *ListTraceSinksResponse) MarshalJSON() ([]byte, error)

type OutputConfig

type OutputConfig struct {
	// Destination: The destination for writing trace data. Currently only
	// BigQuery is supported. E.g.:
	// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
	Destination string `json:"destination,omitempty"`

	// ForceSendFields is a list of field names (e.g. "Destination") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Destination") to include
	// in API requests with the JSON null value. By default, fields with
	// empty values are omitted from API requests. However, any field with
	// an empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

OutputConfig: OutputConfig contains a destination for writing trace data.

func (*OutputConfig) MarshalJSON

func (s *OutputConfig) MarshalJSON() ([]byte, error)

type ProjectsService

type ProjectsService struct {
	TraceSinks *ProjectsTraceSinksService
	// contains filtered or unexported fields
}

func NewProjectsService

func NewProjectsService(s *Service) *ProjectsService

type ProjectsTraceSinksCreateCall

type ProjectsTraceSinksCreateCall struct {
	// contains filtered or unexported fields
}

func (*ProjectsTraceSinksCreateCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ProjectsTraceSinksCreateCall) Do

Do executes the "cloudtrace.projects.traceSinks.create" call. Exactly one of *TraceSink or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *TraceSink.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ProjectsTraceSinksCreateCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ProjectsTraceSinksCreateCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type ProjectsTraceSinksDeleteCall

type ProjectsTraceSinksDeleteCall struct {
	// contains filtered or unexported fields
}

func (*ProjectsTraceSinksDeleteCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ProjectsTraceSinksDeleteCall) Do

Do executes the "cloudtrace.projects.traceSinks.delete" call. Exactly one of *Empty or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *Empty.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ProjectsTraceSinksDeleteCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ProjectsTraceSinksDeleteCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

type ProjectsTraceSinksGetCall

type ProjectsTraceSinksGetCall struct {
	// contains filtered or unexported fields
}

func (*ProjectsTraceSinksGetCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ProjectsTraceSinksGetCall) Do

Do executes the "cloudtrace.projects.traceSinks.get" call. Exactly one of *TraceSink or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *TraceSink.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ProjectsTraceSinksGetCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ProjectsTraceSinksGetCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*ProjectsTraceSinksGetCall) IfNoneMatch

func (c *ProjectsTraceSinksGetCall) IfNoneMatch(entityTag string) *ProjectsTraceSinksGetCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

type ProjectsTraceSinksListCall

type ProjectsTraceSinksListCall struct {
	// contains filtered or unexported fields
}

func (*ProjectsTraceSinksListCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ProjectsTraceSinksListCall) Do

Do executes the "cloudtrace.projects.traceSinks.list" call. Exactly one of *ListTraceSinksResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *ListTraceSinksResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ProjectsTraceSinksListCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ProjectsTraceSinksListCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*ProjectsTraceSinksListCall) IfNoneMatch

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*ProjectsTraceSinksListCall) PageSize

PageSize sets the optional parameter "pageSize": The maximum number of results to return from this request. Non-positive values are ignored. The presence of `nextPageToken` in the response indicates that more results might be available.

func (*ProjectsTraceSinksListCall) PageToken

PageToken sets the optional parameter "pageToken": If present, then retrieve the next batch of results from the preceding call to this method. `pageToken` must be the value of `nextPageToken` from the previous response. The values of other method parameters should be identical to those in the previous call.

func (*ProjectsTraceSinksListCall) Pages

Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.

type ProjectsTraceSinksPatchCall

type ProjectsTraceSinksPatchCall struct {
	// contains filtered or unexported fields
}

func (*ProjectsTraceSinksPatchCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*ProjectsTraceSinksPatchCall) Do

Do executes the "cloudtrace.projects.traceSinks.patch" call. Exactly one of *TraceSink or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *TraceSink.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*ProjectsTraceSinksPatchCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*ProjectsTraceSinksPatchCall) Header

Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.

func (*ProjectsTraceSinksPatchCall) UpdateMask

UpdateMask sets the optional parameter "updateMask": Required. Field mask that specifies the fields in `trace_sink` that are to be updated. A sink field is overwritten if, and only if, it is in the update mask. `name` and `writer_identity` fields cannot be updated. An empty updateMask is considered an error. For a detailed `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask Example: `updateMask=output_config`.

type ProjectsTraceSinksService

type ProjectsTraceSinksService struct {
	// contains filtered or unexported fields
}

func NewProjectsTraceSinksService

func NewProjectsTraceSinksService(s *Service) *ProjectsTraceSinksService

func (*ProjectsTraceSinksService) Create

Create: Creates a sink that exports trace spans to a destination. The export of newly-ingested traces begins immediately, unless the sink's `writer_identity` is not permitted to write to the destination. A sink can export traces only from the resource owning the sink (the 'parent').

  • parent: The resource in which to create the sink (currently only project sinks are supported): "projects/[PROJECT_ID]" Examples: "projects/my-trace-project", "projects/123456789".

func (*ProjectsTraceSinksService) Delete

Delete: Deletes a sink.

  • name: The full resource name of the sink to delete, including the parent resource and the sink identifier: "projects/[PROJECT_NUMBER]/traceSinks/[SINK_ID]" Example: "projects/12345/traceSinks/my-sink-id".

func (*ProjectsTraceSinksService) Get

Get: Get a trace sink by name under the parent resource (GCP project).

  • name: The resource name of the sink: "projects/[PROJECT_NUMBER]/traceSinks/[SINK_ID]" Example: "projects/12345/traceSinks/my-sink-id".

func (*ProjectsTraceSinksService) List

List: List all sinks for the parent resource (GCP project).

  • parent: The parent resource whose sinks are to be listed (currently only project parent resources are supported): "projects/[PROJECT_ID]".

func (*ProjectsTraceSinksService) Patch

Patch: Updates a sink. This method updates fields in the existing sink according to the provided update mask. The sink's name cannot be changed nor any output-only fields (e.g. the writer_identity).

  • name: The full resource name of the sink to update, including the parent resource and the sink identifier: "projects/[PROJECT_NUMBER]/traceSinks/[SINK_ID]" Example: "projects/12345/traceSinks/my-sink-id".

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Projects *ProjectsService
	// contains filtered or unexported fields
}

func New deprecated

func New(client *http.Client) (*Service, error)

New creates a new Service. It uses the provided http.Client for requests.

Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.

func NewService

func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error)

NewService creates a new Service.

type TraceSink

type TraceSink struct {
	// Name: Required. The canonical sink resource name, unique within the
	// project. Must be of the form:
	// project/[PROJECT_NUMBER]/traceSinks/[SINK_ID]. E.g.:
	// "projects/12345/traceSinks/my-project-trace-sink". Sink identifiers
	// are limited to 256 characters and can include only the following
	// characters: upper and lower-case alphanumeric characters,
	// underscores, hyphens, and periods.
	Name string `json:"name,omitempty"`

	// OutputConfig: Required. The export destination.
	OutputConfig *OutputConfig `json:"outputConfig,omitempty"`

	// WriterIdentity: Output only. A service account name for exporting the
	// data. This field is set by sinks.create and sinks.update. The service
	// account will need to be granted write access to the destination
	// specified in the output configuration, see Granting access for a
	// resource
	// (/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_ser
	// vice_account_for_a_resource). To create tables and write data this
	// account will need the dataEditor role. Read more about roles in the
	// BigQuery documentation
	// (https://cloud.google.com/bigquery/docs/access-control). E.g.:
	// "service-00000001@00000002.iam.gserviceaccount.com"
	WriterIdentity string `json:"writerIdentity,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Name") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`

	// NullFields is a list of field names (e.g. "Name") to include in API
	// requests with the JSON null value. By default, fields with empty
	// values are omitted from API requests. However, any field with an
	// empty value appearing in NullFields will be sent to the server as
	// null. It is an error if a field in this list has a non-empty value.
	// This may be used to include null fields in Patch requests.
	NullFields []string `json:"-"`
}

TraceSink: Describes a sink used to export traces to a BigQuery dataset. The sink must be created within a project.

func (*TraceSink) MarshalJSON

func (s *TraceSink) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL