Movatterモバイル変換


[0]ホーム

URL:


cloudtrace

package
v0.257.0Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2025 License:BSD-3-ClauseImports:18Imported by:0

Details

Repository

github.com/googleapis/google-api-go-client

Links

Documentation

Overview

Package cloudtrace provides access to the Cloud Trace API.

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

Library status

These client libraries are officially supported by Google. However, thislibrary is considered complete and is in maintenance mode. This meansthat we will address critical bugs and security issues but will not addany new features.

When possible, we recommend using our newer[Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)that are still actively being worked and iterated on.

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 forauthentication. For information on how to create and obtain ApplicationDefault Credentials, seehttps://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, usegoogle.golang.org/api/option.WithScopes:

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

To use an API key for authentication (note: some APIs do not support APIkeys), usegoogle.golang.org/api/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 OAuthflow, usegoogle.golang.org/api/option.WithTokenSource:

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

Seegoogle.golang.org/api/option.ClientOption for details on options.

Index

Constants

View Source
const (// See, edit, configure, and delete your Google Cloud data and see the email// address for your Google Account.CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"// Write Trace data for a project or applicationTraceAppendScope = "https://www.googleapis.com/auth/trace.append"// Read Trace data for a project or applicationTraceReadonlyScope = "https://www.googleapis.com/auth/trace.readonly")

OAuth2 scopes used by this API.

Variables

This section is empty.

Functions

This section is empty.

Types

typeEmpty

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 definingduplicated empty messages in your APIs. A typical example is to use it asthe request or the response type of an API method. For instance: service Foo{ rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }

typeListTraceSinksResponse

type ListTraceSinksResponse struct {// NextPageToken: A paginated response where more pages might be available has// `next_page_token` set. To get the next set of results, call the same method// again using the value of `next_page_token` as `page_token`.NextPageTokenstring `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 or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.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. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

ListTraceSinksResponse: Result returned from `ListTraceSinks`.

func (ListTraceSinksResponse)MarshalJSON

func (sListTraceSinksResponse) MarshalJSON() ([]byte,error)

typeOutputConfig

type OutputConfig struct {// Destination: Required. The destination for writing trace data. Supported// formats include:// "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"Destinationstring `json:"destination,omitempty"`// ForceSendFields is a list of field names (e.g. "Destination") to// unconditionally include in API requests. By default, fields with empty or// default values are omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.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. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

OutputConfig: OutputConfig contains a destination for writing trace data.

func (OutputConfig)MarshalJSON

func (sOutputConfig) MarshalJSON() ([]byte,error)

typeProjectsService

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

funcNewProjectsService

func NewProjectsService(s *Service) *ProjectsService

typeProjectsTraceSinksCreateCall

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

func (*ProjectsTraceSinksCreateCall)Context

Context sets the context to be used in this call's Do method.

func (*ProjectsTraceSinksCreateCall)Do

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

func (*ProjectsTraceSinksCreateCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.

func (*ProjectsTraceSinksCreateCall)Header

Header returns a http.Header that can be modified by the caller to addheaders to the request.

typeProjectsTraceSinksDeleteCall

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

func (*ProjectsTraceSinksDeleteCall)Context

Context sets the context to be used in this call's Do method.

func (*ProjectsTraceSinksDeleteCall)Do

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

func (*ProjectsTraceSinksDeleteCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.

func (*ProjectsTraceSinksDeleteCall)Header

Header returns a http.Header that can be modified by the caller to addheaders to the request.

typeProjectsTraceSinksGetCall

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

func (*ProjectsTraceSinksGetCall)Context

Context sets the context to be used in this call's Do method.

func (*ProjectsTraceSinksGetCall)Do

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

func (*ProjectsTraceSinksGetCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.

func (*ProjectsTraceSinksGetCall)Header

Header returns a http.Header that can be modified by the caller to addheaders to the request.

func (*ProjectsTraceSinksGetCall)IfNoneMatch

IfNoneMatch sets an optional parameter which makes the operation fail if theobject's ETag matches the given value. This is useful for getting updatesonly after the object has changed since the last request.

typeProjectsTraceSinksListCall

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

func (*ProjectsTraceSinksListCall)Context

Context sets the context to be used in this call's Do method.

func (*ProjectsTraceSinksListCall)Do

Do executes the "cloudtrace.projects.traceSinks.list" call.Any non-2xx status code is an error. Response headers are in either*ListTraceSinksResponse.ServerResponse.Header or (if a response was returnedat all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified tocheck whether the returned error was because http.StatusNotModified wasreturned.

func (*ProjectsTraceSinksListCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.

func (*ProjectsTraceSinksListCall)Header

Header returns a http.Header that can be modified by the caller to addheaders to the request.

func (*ProjectsTraceSinksListCall)IfNoneMatch

IfNoneMatch sets an optional parameter which makes the operation fail if theobject's ETag matches the given value. This is useful for getting updatesonly after the object has changed since the last request.

func (*ProjectsTraceSinksListCall)PageSize

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

func (*ProjectsTraceSinksListCall)PageToken

PageToken sets the optional parameter "pageToken": If present, then retrievethe next batch of results from the preceding call to this method.`page_token` must be the value of `next_page_token` from the previousresponse. The values of other method parameters should be identical to thosein 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.

typeProjectsTraceSinksPatchCall

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

func (*ProjectsTraceSinksPatchCall)Context

Context sets the context to be used in this call's Do method.

func (*ProjectsTraceSinksPatchCall)Do

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

func (*ProjectsTraceSinksPatchCall)Fields

Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.

func (*ProjectsTraceSinksPatchCall)Header

Header returns a http.Header that can be modified by the caller to addheaders to the request.

func (*ProjectsTraceSinksPatchCall)UpdateMask

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

typeProjectsTraceSinksService

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

funcNewProjectsTraceSinksService

func NewProjectsTraceSinksService(s *Service) *ProjectsTraceSinksService

func (*ProjectsTraceSinksService)Create

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

  • parent: The resource in which to create the sink (currently only projectsinks 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 parentresource 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 onlyproject parent resources are supported): "projects/[PROJECT_ID]".

func (*ProjectsTraceSinksService)Patch

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

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

typeService

type Service struct {BasePathstring// API endpoint base URLUserAgentstring// optional additional User-Agent fragmentProjects *ProjectsService// contains filtered or unexported fields}

funcNewdeprecated

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.

funcNewService

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

NewService creates a new Service.

typeTraceSink

type TraceSink struct {// Name: Identifier. The canonical sink resource name, unique within the// project. Must be of the form:// projects/[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.Namestring `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_service_ac// count_for_a_resource). To create tables and to write data, this account// needs 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"WriterIdentitystring `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 or default values are// omitted from API requests. See//https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more// details.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. See//https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.NullFields []string `json:"-"`}

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

func (TraceSink)MarshalJSON

func (sTraceSink) MarshalJSON() ([]byte,error)

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp