1// Copyright 2019 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Code generated by gapic-generator. DO NOT EDIT.
16
17package trace_test
18
19import (
20	"context"
21
22	trace "cloud.google.com/go/trace/apiv1"
23	"google.golang.org/api/iterator"
24	cloudtracepb "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1"
25)
26
27func ExampleNewClient() {
28	ctx := context.Background()
29	c, err := trace.NewClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	// TODO: Use client.
34	_ = c
35}
36
37func ExampleClient_PatchTraces() {
38	ctx := context.Background()
39	c, err := trace.NewClient(ctx)
40	if err != nil {
41		// TODO: Handle error.
42	}
43
44	req := &cloudtracepb.PatchTracesRequest{
45		// TODO: Fill request struct fields.
46	}
47	err = c.PatchTraces(ctx, req)
48	if err != nil {
49		// TODO: Handle error.
50	}
51}
52
53func ExampleClient_GetTrace() {
54	ctx := context.Background()
55	c, err := trace.NewClient(ctx)
56	if err != nil {
57		// TODO: Handle error.
58	}
59
60	req := &cloudtracepb.GetTraceRequest{
61		// TODO: Fill request struct fields.
62	}
63	resp, err := c.GetTrace(ctx, req)
64	if err != nil {
65		// TODO: Handle error.
66	}
67	// TODO: Use resp.
68	_ = resp
69}
70
71func ExampleClient_ListTraces() {
72	ctx := context.Background()
73	c, err := trace.NewClient(ctx)
74	if err != nil {
75		// TODO: Handle error.
76	}
77
78	req := &cloudtracepb.ListTracesRequest{
79		// TODO: Fill request struct fields.
80	}
81	it := c.ListTraces(ctx, req)
82	for {
83		resp, err := it.Next()
84		if err == iterator.Done {
85			break
86		}
87		if err != nil {
88			// TODO: Handle error.
89		}
90		// TODO: Use resp.
91		_ = resp
92	}
93}
94