1// Copyright 2021 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 protoc-gen-go_gapic. DO NOT EDIT.
16
17package pubsub_test
18
19import (
20	"context"
21
22	pubsub "cloud.google.com/go/pubsub/apiv1"
23	"google.golang.org/api/iterator"
24	pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1"
25)
26
27func ExampleNewSchemaClient() {
28	ctx := context.Background()
29	c, err := pubsub.NewSchemaClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	// TODO: Use client.
34	_ = c
35}
36
37func ExampleSchemaClient_CreateSchema() {
38	// import pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1"
39
40	ctx := context.Background()
41	c, err := pubsub.NewSchemaClient(ctx)
42	if err != nil {
43		// TODO: Handle error.
44	}
45
46	req := &pubsubpb.CreateSchemaRequest{
47		// TODO: Fill request struct fields.
48	}
49	resp, err := c.CreateSchema(ctx, req)
50	if err != nil {
51		// TODO: Handle error.
52	}
53	// TODO: Use resp.
54	_ = resp
55}
56
57func ExampleSchemaClient_GetSchema() {
58	// import pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1"
59
60	ctx := context.Background()
61	c, err := pubsub.NewSchemaClient(ctx)
62	if err != nil {
63		// TODO: Handle error.
64	}
65
66	req := &pubsubpb.GetSchemaRequest{
67		// TODO: Fill request struct fields.
68	}
69	resp, err := c.GetSchema(ctx, req)
70	if err != nil {
71		// TODO: Handle error.
72	}
73	// TODO: Use resp.
74	_ = resp
75}
76
77func ExampleSchemaClient_ListSchemas() {
78	// import pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1"
79	// import "google.golang.org/api/iterator"
80
81	ctx := context.Background()
82	c, err := pubsub.NewSchemaClient(ctx)
83	if err != nil {
84		// TODO: Handle error.
85	}
86
87	req := &pubsubpb.ListSchemasRequest{
88		// TODO: Fill request struct fields.
89	}
90	it := c.ListSchemas(ctx, req)
91	for {
92		resp, err := it.Next()
93		if err == iterator.Done {
94			break
95		}
96		if err != nil {
97			// TODO: Handle error.
98		}
99		// TODO: Use resp.
100		_ = resp
101	}
102}
103
104func ExampleSchemaClient_DeleteSchema() {
105	ctx := context.Background()
106	c, err := pubsub.NewSchemaClient(ctx)
107	if err != nil {
108		// TODO: Handle error.
109	}
110
111	req := &pubsubpb.DeleteSchemaRequest{
112		// TODO: Fill request struct fields.
113	}
114	err = c.DeleteSchema(ctx, req)
115	if err != nil {
116		// TODO: Handle error.
117	}
118}
119
120func ExampleSchemaClient_ValidateSchema() {
121	// import pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1"
122
123	ctx := context.Background()
124	c, err := pubsub.NewSchemaClient(ctx)
125	if err != nil {
126		// TODO: Handle error.
127	}
128
129	req := &pubsubpb.ValidateSchemaRequest{
130		// TODO: Fill request struct fields.
131	}
132	resp, err := c.ValidateSchema(ctx, req)
133	if err != nil {
134		// TODO: Handle error.
135	}
136	// TODO: Use resp.
137	_ = resp
138}
139
140func ExampleSchemaClient_ValidateMessage() {
141	// import pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1"
142
143	ctx := context.Background()
144	c, err := pubsub.NewSchemaClient(ctx)
145	if err != nil {
146		// TODO: Handle error.
147	}
148
149	req := &pubsubpb.ValidateMessageRequest{
150		// TODO: Fill request struct fields.
151	}
152	resp, err := c.ValidateMessage(ctx, req)
153	if err != nil {
154		// TODO: Handle error.
155	}
156	// TODO: Use resp.
157	_ = resp
158}
159