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 iampb "google.golang.org/genproto/googleapis/iam/v1" 25 pubsubpb "google.golang.org/genproto/googleapis/pubsub/v1" 26) 27 28func ExampleNewSchemaClient() { 29 ctx := context.Background() 30 c, err := pubsub.NewSchemaClient(ctx) 31 if err != nil { 32 // TODO: Handle error. 33 } 34 defer c.Close() 35 36 // TODO: Use client. 37 _ = c 38} 39 40func ExampleSchemaClient_CreateSchema() { 41 ctx := context.Background() 42 c, err := pubsub.NewSchemaClient(ctx) 43 if err != nil { 44 // TODO: Handle error. 45 } 46 defer c.Close() 47 48 req := &pubsubpb.CreateSchemaRequest{ 49 // TODO: Fill request struct fields. 50 } 51 resp, err := c.CreateSchema(ctx, req) 52 if err != nil { 53 // TODO: Handle error. 54 } 55 // TODO: Use resp. 56 _ = resp 57} 58 59func ExampleSchemaClient_GetSchema() { 60 ctx := context.Background() 61 c, err := pubsub.NewSchemaClient(ctx) 62 if err != nil { 63 // TODO: Handle error. 64 } 65 defer c.Close() 66 67 req := &pubsubpb.GetSchemaRequest{ 68 // TODO: Fill request struct fields. 69 } 70 resp, err := c.GetSchema(ctx, req) 71 if err != nil { 72 // TODO: Handle error. 73 } 74 // TODO: Use resp. 75 _ = resp 76} 77 78func ExampleSchemaClient_ListSchemas() { 79 ctx := context.Background() 80 c, err := pubsub.NewSchemaClient(ctx) 81 if err != nil { 82 // TODO: Handle error. 83 } 84 defer c.Close() 85 86 req := &pubsubpb.ListSchemasRequest{ 87 // TODO: Fill request struct fields. 88 } 89 it := c.ListSchemas(ctx, req) 90 for { 91 resp, err := it.Next() 92 if err == iterator.Done { 93 break 94 } 95 if err != nil { 96 // TODO: Handle error. 97 } 98 // TODO: Use resp. 99 _ = resp 100 } 101} 102 103func ExampleSchemaClient_DeleteSchema() { 104 ctx := context.Background() 105 c, err := pubsub.NewSchemaClient(ctx) 106 if err != nil { 107 // TODO: Handle error. 108 } 109 defer c.Close() 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 ctx := context.Background() 122 c, err := pubsub.NewSchemaClient(ctx) 123 if err != nil { 124 // TODO: Handle error. 125 } 126 defer c.Close() 127 128 req := &pubsubpb.ValidateSchemaRequest{ 129 // TODO: Fill request struct fields. 130 } 131 resp, err := c.ValidateSchema(ctx, req) 132 if err != nil { 133 // TODO: Handle error. 134 } 135 // TODO: Use resp. 136 _ = resp 137} 138 139func ExampleSchemaClient_ValidateMessage() { 140 ctx := context.Background() 141 c, err := pubsub.NewSchemaClient(ctx) 142 if err != nil { 143 // TODO: Handle error. 144 } 145 defer c.Close() 146 147 req := &pubsubpb.ValidateMessageRequest{ 148 // TODO: Fill request struct fields. 149 } 150 resp, err := c.ValidateMessage(ctx, req) 151 if err != nil { 152 // TODO: Handle error. 153 } 154 // TODO: Use resp. 155 _ = resp 156} 157 158func ExampleSchemaClient_GetIamPolicy() { 159 ctx := context.Background() 160 c, err := pubsub.NewSchemaClient(ctx) 161 if err != nil { 162 // TODO: Handle error. 163 } 164 defer c.Close() 165 166 req := &iampb.GetIamPolicyRequest{ 167 // TODO: Fill request struct fields. 168 } 169 resp, err := c.GetIamPolicy(ctx, req) 170 if err != nil { 171 // TODO: Handle error. 172 } 173 // TODO: Use resp. 174 _ = resp 175} 176 177func ExampleSchemaClient_SetIamPolicy() { 178 ctx := context.Background() 179 c, err := pubsub.NewSchemaClient(ctx) 180 if err != nil { 181 // TODO: Handle error. 182 } 183 defer c.Close() 184 185 req := &iampb.SetIamPolicyRequest{ 186 // TODO: Fill request struct fields. 187 } 188 resp, err := c.SetIamPolicy(ctx, req) 189 if err != nil { 190 // TODO: Handle error. 191 } 192 // TODO: Use resp. 193 _ = resp 194} 195 196func ExampleSchemaClient_TestIamPermissions() { 197 ctx := context.Background() 198 c, err := pubsub.NewSchemaClient(ctx) 199 if err != nil { 200 // TODO: Handle error. 201 } 202 defer c.Close() 203 204 req := &iampb.TestIamPermissionsRequest{ 205 // TODO: Fill request struct fields. 206 } 207 resp, err := c.TestIamPermissions(ctx, req) 208 if err != nil { 209 // TODO: Handle error. 210 } 211 // TODO: Use resp. 212 _ = resp 213} 214