cloudtrace
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
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
- type Empty
- type ListTraceSinksResponse
- type OutputConfig
- type ProjectsService
- type ProjectsTraceSinksCreateCall
- func (c *ProjectsTraceSinksCreateCall) Context(ctx context.Context) *ProjectsTraceSinksCreateCall
- func (c *ProjectsTraceSinksCreateCall) Do(opts ...googleapi.CallOption) (*TraceSink, error)
- func (c *ProjectsTraceSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksCreateCall
- func (c *ProjectsTraceSinksCreateCall) Header() http.Header
- type ProjectsTraceSinksDeleteCall
- func (c *ProjectsTraceSinksDeleteCall) Context(ctx context.Context) *ProjectsTraceSinksDeleteCall
- func (c *ProjectsTraceSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error)
- func (c *ProjectsTraceSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksDeleteCall
- func (c *ProjectsTraceSinksDeleteCall) Header() http.Header
- type ProjectsTraceSinksGetCall
- func (c *ProjectsTraceSinksGetCall) Context(ctx context.Context) *ProjectsTraceSinksGetCall
- func (c *ProjectsTraceSinksGetCall) Do(opts ...googleapi.CallOption) (*TraceSink, error)
- func (c *ProjectsTraceSinksGetCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksGetCall
- func (c *ProjectsTraceSinksGetCall) Header() http.Header
- func (c *ProjectsTraceSinksGetCall) IfNoneMatch(entityTag string) *ProjectsTraceSinksGetCall
- type ProjectsTraceSinksListCall
- func (c *ProjectsTraceSinksListCall) Context(ctx context.Context) *ProjectsTraceSinksListCall
- func (c *ProjectsTraceSinksListCall) Do(opts ...googleapi.CallOption) (*ListTraceSinksResponse, error)
- func (c *ProjectsTraceSinksListCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksListCall
- func (c *ProjectsTraceSinksListCall) Header() http.Header
- func (c *ProjectsTraceSinksListCall) IfNoneMatch(entityTag string) *ProjectsTraceSinksListCall
- func (c *ProjectsTraceSinksListCall) PageSize(pageSize int64) *ProjectsTraceSinksListCall
- func (c *ProjectsTraceSinksListCall) PageToken(pageToken string) *ProjectsTraceSinksListCall
- func (c *ProjectsTraceSinksListCall) Pages(ctx context.Context, f func(*ListTraceSinksResponse) error) error
- type ProjectsTraceSinksPatchCall
- func (c *ProjectsTraceSinksPatchCall) Context(ctx context.Context) *ProjectsTraceSinksPatchCall
- func (c *ProjectsTraceSinksPatchCall) Do(opts ...googleapi.CallOption) (*TraceSink, error)
- func (c *ProjectsTraceSinksPatchCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksPatchCall
- func (c *ProjectsTraceSinksPatchCall) Header() http.Header
- func (c *ProjectsTraceSinksPatchCall) UpdateMask(updateMask string) *ProjectsTraceSinksPatchCall
- type ProjectsTraceSinksService
- func (r *ProjectsTraceSinksService) Create(parent string, tracesink *TraceSink) *ProjectsTraceSinksCreateCall
- func (r *ProjectsTraceSinksService) Delete(nameid string) *ProjectsTraceSinksDeleteCall
- func (r *ProjectsTraceSinksService) Get(name string) *ProjectsTraceSinksGetCall
- func (r *ProjectsTraceSinksService) List(parent string) *ProjectsTraceSinksListCall
- func (r *ProjectsTraceSinksService) Patch(nameid string, tracesink *TraceSink) *ProjectsTraceSinksPatchCall
- type Service
- type TraceSink
Constants¶
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¶
func (c *ProjectsTraceSinksCreateCall) Context(ctxcontext.Context) *ProjectsTraceSinksCreateCall
Context sets the context to be used in this call's Do method.
func (*ProjectsTraceSinksCreateCall)Do¶
func (c *ProjectsTraceSinksCreateCall) Do(opts ...googleapi.CallOption) (*TraceSink,error)
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¶
func (c *ProjectsTraceSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksCreateCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*ProjectsTraceSinksCreateCall)Header¶
func (c *ProjectsTraceSinksCreateCall) Header()http.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¶
func (c *ProjectsTraceSinksDeleteCall) Context(ctxcontext.Context) *ProjectsTraceSinksDeleteCall
Context sets the context to be used in this call's Do method.
func (*ProjectsTraceSinksDeleteCall)Do¶
func (c *ProjectsTraceSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty,error)
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¶
func (c *ProjectsTraceSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksDeleteCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*ProjectsTraceSinksDeleteCall)Header¶
func (c *ProjectsTraceSinksDeleteCall) Header()http.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¶
func (c *ProjectsTraceSinksGetCall) Context(ctxcontext.Context) *ProjectsTraceSinksGetCall
Context sets the context to be used in this call's Do method.
func (*ProjectsTraceSinksGetCall)Do¶
func (c *ProjectsTraceSinksGetCall) Do(opts ...googleapi.CallOption) (*TraceSink,error)
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¶
func (c *ProjectsTraceSinksGetCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksGetCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*ProjectsTraceSinksGetCall)Header¶
func (c *ProjectsTraceSinksGetCall) Header()http.Header
Header returns a http.Header that can be modified by the caller to addheaders to the request.
func (*ProjectsTraceSinksGetCall)IfNoneMatch¶
func (c *ProjectsTraceSinksGetCall) IfNoneMatch(entityTagstring) *ProjectsTraceSinksGetCall
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¶
func (c *ProjectsTraceSinksListCall) Context(ctxcontext.Context) *ProjectsTraceSinksListCall
Context sets the context to be used in this call's Do method.
func (*ProjectsTraceSinksListCall)Do¶
func (c *ProjectsTraceSinksListCall) Do(opts ...googleapi.CallOption) (*ListTraceSinksResponse,error)
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¶
func (c *ProjectsTraceSinksListCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksListCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*ProjectsTraceSinksListCall)Header¶
func (c *ProjectsTraceSinksListCall) Header()http.Header
Header returns a http.Header that can be modified by the caller to addheaders to the request.
func (*ProjectsTraceSinksListCall)IfNoneMatch¶
func (c *ProjectsTraceSinksListCall) IfNoneMatch(entityTagstring) *ProjectsTraceSinksListCall
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¶
func (c *ProjectsTraceSinksListCall) PageSize(pageSizeint64) *ProjectsTraceSinksListCall
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¶
func (c *ProjectsTraceSinksListCall) PageToken(pageTokenstring) *ProjectsTraceSinksListCall
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¶
func (c *ProjectsTraceSinksListCall) Pages(ctxcontext.Context, f func(*ListTraceSinksResponse)error)error
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¶
func (c *ProjectsTraceSinksPatchCall) Context(ctxcontext.Context) *ProjectsTraceSinksPatchCall
Context sets the context to be used in this call's Do method.
func (*ProjectsTraceSinksPatchCall)Do¶
func (c *ProjectsTraceSinksPatchCall) Do(opts ...googleapi.CallOption) (*TraceSink,error)
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¶
func (c *ProjectsTraceSinksPatchCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksPatchCall
Fields allows partial responses to be retrieved. Seehttps://developers.google.com/gdata/docs/2.0/basics#PartialResponse for moredetails.
func (*ProjectsTraceSinksPatchCall)Header¶
func (c *ProjectsTraceSinksPatchCall) Header()http.Header
Header returns a http.Header that can be modified by the caller to addheaders to the request.
func (*ProjectsTraceSinksPatchCall)UpdateMask¶
func (c *ProjectsTraceSinksPatchCall) UpdateMask(updateMaskstring) *ProjectsTraceSinksPatchCall
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¶
func (r *ProjectsTraceSinksService) Create(parentstring, tracesink *TraceSink) *ProjectsTraceSinksCreateCall
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¶
func (r *ProjectsTraceSinksService) Delete(nameidstring) *ProjectsTraceSinksDeleteCall
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¶
func (r *ProjectsTraceSinksService) Get(namestring) *ProjectsTraceSinksGetCall
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¶
func (r *ProjectsTraceSinksService) List(parentstring) *ProjectsTraceSinksListCall
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¶
func (r *ProjectsTraceSinksService) Patch(nameidstring, tracesink *TraceSink) *ProjectsTraceSinksPatchCall
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
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¶
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.