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
- 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 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 ¶
func (c *ProjectsTraceSinksCreateCall) Context(ctx context.Context) *ProjectsTraceSinksCreateCall
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 ¶
func (c *ProjectsTraceSinksCreateCall) Do(opts ...googleapi.CallOption) (*TraceSink, error)
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 ¶
func (c *ProjectsTraceSinksCreateCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksCreateCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*ProjectsTraceSinksCreateCall) Header ¶
func (c *ProjectsTraceSinksCreateCall) Header() http.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 ¶
func (c *ProjectsTraceSinksDeleteCall) Context(ctx context.Context) *ProjectsTraceSinksDeleteCall
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 ¶
func (c *ProjectsTraceSinksDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error)
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 ¶
func (c *ProjectsTraceSinksDeleteCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksDeleteCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*ProjectsTraceSinksDeleteCall) Header ¶
func (c *ProjectsTraceSinksDeleteCall) Header() http.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 ¶
func (c *ProjectsTraceSinksGetCall) Context(ctx context.Context) *ProjectsTraceSinksGetCall
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 ¶
func (c *ProjectsTraceSinksGetCall) Do(opts ...googleapi.CallOption) (*TraceSink, error)
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 ¶
func (c *ProjectsTraceSinksGetCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*ProjectsTraceSinksGetCall) Header ¶
func (c *ProjectsTraceSinksGetCall) Header() http.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 ¶
func (c *ProjectsTraceSinksListCall) Context(ctx context.Context) *ProjectsTraceSinksListCall
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 ¶
func (c *ProjectsTraceSinksListCall) Do(opts ...googleapi.CallOption) (*ListTraceSinksResponse, error)
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 ¶
func (c *ProjectsTraceSinksListCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*ProjectsTraceSinksListCall) Header ¶
func (c *ProjectsTraceSinksListCall) Header() http.Header
Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.
func (*ProjectsTraceSinksListCall) IfNoneMatch ¶
func (c *ProjectsTraceSinksListCall) IfNoneMatch(entityTag string) *ProjectsTraceSinksListCall
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 ¶
func (c *ProjectsTraceSinksListCall) PageSize(pageSize int64) *ProjectsTraceSinksListCall
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 ¶
func (c *ProjectsTraceSinksListCall) PageToken(pageToken string) *ProjectsTraceSinksListCall
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 ¶
func (c *ProjectsTraceSinksListCall) Pages(ctx context.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.
type ProjectsTraceSinksPatchCall ¶
type ProjectsTraceSinksPatchCall struct {
// contains filtered or unexported fields
}
func (*ProjectsTraceSinksPatchCall) Context ¶
func (c *ProjectsTraceSinksPatchCall) Context(ctx context.Context) *ProjectsTraceSinksPatchCall
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 ¶
func (c *ProjectsTraceSinksPatchCall) Do(opts ...googleapi.CallOption) (*TraceSink, error)
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 ¶
func (c *ProjectsTraceSinksPatchCall) Fields(s ...googleapi.Field) *ProjectsTraceSinksPatchCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.
func (*ProjectsTraceSinksPatchCall) Header ¶
func (c *ProjectsTraceSinksPatchCall) Header() http.Header
Header returns an http.Header that can be modified by the caller to add HTTP headers to the request.
func (*ProjectsTraceSinksPatchCall) UpdateMask ¶
func (c *ProjectsTraceSinksPatchCall) UpdateMask(updateMask string) *ProjectsTraceSinksPatchCall
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 ¶
func (r *ProjectsTraceSinksService) Create(parent string, tracesink *TraceSink) *ProjectsTraceSinksCreateCall
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 ¶
func (r *ProjectsTraceSinksService) Delete(nameid string) *ProjectsTraceSinksDeleteCall
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 ¶
func (r *ProjectsTraceSinksService) Get(name string) *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(parent string) *ProjectsTraceSinksListCall
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 ¶
func (r *ProjectsTraceSinksService) Patch(nameid string, tracesink *TraceSink) *ProjectsTraceSinksPatchCall
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
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 ¶
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.