Debian Codegraph @

gsuiteaddons/apiv1/g_suite_add_ons_client_example_test.go

raw
1 // Copyright 2025 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
17 package gsuiteaddons_test
18
19 import (
20 "context"
21
22 gsuiteaddons "cloud.google.com/go/gsuiteaddons/apiv1"
23 gsuiteaddonspb "cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb"
24 "google.golang.org/api/iterator"
25 )
26
27 func ExampleNewClient() {
28 ctx := context.Background()
29 // This snippet has been automatically generated and should be regarded as a code template only.
30 // It will require modifications to work:
31 // - It may require correct/in-range values for request initialization.
32 // - It may require specifying regional endpoints when creating the service client as shown in:
33 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
34 c, err := gsuiteaddons.NewClient(ctx)
35 if err != nil {
36 // TODO: Handle error.
37 }
38 defer c.Close()
39
40 // TODO: Use client.
41 _ = c
42 }
43
44 func ExampleNewRESTClient() {
45 ctx := context.Background()
46 // This snippet has been automatically generated and should be regarded as a code template only.
47 // It will require modifications to work:
48 // - It may require correct/in-range values for request initialization.
49 // - It may require specifying regional endpoints when creating the service client as shown in:
50 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
51 c, err := gsuiteaddons.NewRESTClient(ctx)
52 if err != nil {
53 // TODO: Handle error.
54 }
55 defer c.Close()
56
57 // TODO: Use client.
58 _ = c
59 }
60
61 func ExampleClient_CreateDeployment() {
62 ctx := context.Background()
63 // This snippet has been automatically generated and should be regarded as a code template only.
64 // It will require modifications to work:
65 // - It may require correct/in-range values for request initialization.
66 // - It may require specifying regional endpoints when creating the service client as shown in:
67 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
68 c, err := gsuiteaddons.NewClient(ctx)
69 if err != nil {
70 // TODO: Handle error.
71 }
72 defer c.Close()
73
74 req := &gsuiteaddonspb.CreateDeploymentRequest{
75 // TODO: Fill request struct fields.
76 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#CreateDeploymentRequest.
77 }
78 resp, err := c.CreateDeployment(ctx, req)
79 if err != nil {
80 // TODO: Handle error.
81 }
82 // TODO: Use resp.
83 _ = resp
84 }
85
86 func ExampleClient_DeleteDeployment() {
87 ctx := context.Background()
88 // This snippet has been automatically generated and should be regarded as a code template only.
89 // It will require modifications to work:
90 // - It may require correct/in-range values for request initialization.
91 // - It may require specifying regional endpoints when creating the service client as shown in:
92 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
93 c, err := gsuiteaddons.NewClient(ctx)
94 if err != nil {
95 // TODO: Handle error.
96 }
97 defer c.Close()
98
99 req := &gsuiteaddonspb.DeleteDeploymentRequest{
100 // TODO: Fill request struct fields.
101 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#DeleteDeploymentRequest.
102 }
103 err = c.DeleteDeployment(ctx, req)
104 if err != nil {
105 // TODO: Handle error.
106 }
107 }
108
109 func ExampleClient_GetAuthorization() {
110 ctx := context.Background()
111 // This snippet has been automatically generated and should be regarded as a code template only.
112 // It will require modifications to work:
113 // - It may require correct/in-range values for request initialization.
114 // - It may require specifying regional endpoints when creating the service client as shown in:
115 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
116 c, err := gsuiteaddons.NewClient(ctx)
117 if err != nil {
118 // TODO: Handle error.
119 }
120 defer c.Close()
121
122 req := &gsuiteaddonspb.GetAuthorizationRequest{
123 // TODO: Fill request struct fields.
124 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#GetAuthorizationRequest.
125 }
126 resp, err := c.GetAuthorization(ctx, req)
127 if err != nil {
128 // TODO: Handle error.
129 }
130 // TODO: Use resp.
131 _ = resp
132 }
133
134 func ExampleClient_GetDeployment() {
135 ctx := context.Background()
136 // This snippet has been automatically generated and should be regarded as a code template only.
137 // It will require modifications to work:
138 // - It may require correct/in-range values for request initialization.
139 // - It may require specifying regional endpoints when creating the service client as shown in:
140 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
141 c, err := gsuiteaddons.NewClient(ctx)
142 if err != nil {
143 // TODO: Handle error.
144 }
145 defer c.Close()
146
147 req := &gsuiteaddonspb.GetDeploymentRequest{
148 // TODO: Fill request struct fields.
149 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#GetDeploymentRequest.
150 }
151 resp, err := c.GetDeployment(ctx, req)
152 if err != nil {
153 // TODO: Handle error.
154 }
155 // TODO: Use resp.
156 _ = resp
157 }
158
159 func ExampleClient_GetInstallStatus() {
160 ctx := context.Background()
161 // This snippet has been automatically generated and should be regarded as a code template only.
162 // It will require modifications to work:
163 // - It may require correct/in-range values for request initialization.
164 // - It may require specifying regional endpoints when creating the service client as shown in:
165 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
166 c, err := gsuiteaddons.NewClient(ctx)
167 if err != nil {
168 // TODO: Handle error.
169 }
170 defer c.Close()
171
172 req := &gsuiteaddonspb.GetInstallStatusRequest{
173 // TODO: Fill request struct fields.
174 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#GetInstallStatusRequest.
175 }
176 resp, err := c.GetInstallStatus(ctx, req)
177 if err != nil {
178 // TODO: Handle error.
179 }
180 // TODO: Use resp.
181 _ = resp
182 }
183
184 func ExampleClient_InstallDeployment() {
185 ctx := context.Background()
186 // This snippet has been automatically generated and should be regarded as a code template only.
187 // It will require modifications to work:
188 // - It may require correct/in-range values for request initialization.
189 // - It may require specifying regional endpoints when creating the service client as shown in:
190 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
191 c, err := gsuiteaddons.NewClient(ctx)
192 if err != nil {
193 // TODO: Handle error.
194 }
195 defer c.Close()
196
197 req := &gsuiteaddonspb.InstallDeploymentRequest{
198 // TODO: Fill request struct fields.
199 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#InstallDeploymentRequest.
200 }
201 err = c.InstallDeployment(ctx, req)
202 if err != nil {
203 // TODO: Handle error.
204 }
205 }
206
207 func ExampleClient_ListDeployments() {
208 ctx := context.Background()
209 // This snippet has been automatically generated and should be regarded as a code template only.
210 // It will require modifications to work:
211 // - It may require correct/in-range values for request initialization.
212 // - It may require specifying regional endpoints when creating the service client as shown in:
213 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
214 c, err := gsuiteaddons.NewClient(ctx)
215 if err != nil {
216 // TODO: Handle error.
217 }
218 defer c.Close()
219
220 req := &gsuiteaddonspb.ListDeploymentsRequest{
221 // TODO: Fill request struct fields.
222 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#ListDeploymentsRequest.
223 }
224 it := c.ListDeployments(ctx, req)
225 for {
226 resp, err := it.Next()
227 if err == iterator.Done {
228 break
229 }
230 if err != nil {
231 // TODO: Handle error.
232 }
233 // TODO: Use resp.
234 _ = resp
235
236 // If you need to access the underlying RPC response,
237 // you can do so by casting the `Response` as below.
238 // Otherwise, remove this line. Only populated after
239 // first call to Next(). Not safe for concurrent access.
240 _ = it.Response.(*gsuiteaddonspb.ListDeploymentsResponse)
241 }
242 }
243
244 func ExampleClient_ReplaceDeployment() {
245 ctx := context.Background()
246 // This snippet has been automatically generated and should be regarded as a code template only.
247 // It will require modifications to work:
248 // - It may require correct/in-range values for request initialization.
249 // - It may require specifying regional endpoints when creating the service client as shown in:
250 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
251 c, err := gsuiteaddons.NewClient(ctx)
252 if err != nil {
253 // TODO: Handle error.
254 }
255 defer c.Close()
256
257 req := &gsuiteaddonspb.ReplaceDeploymentRequest{
258 // TODO: Fill request struct fields.
259 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#ReplaceDeploymentRequest.
260 }
261 resp, err := c.ReplaceDeployment(ctx, req)
262 if err != nil {
263 // TODO: Handle error.
264 }
265 // TODO: Use resp.
266 _ = resp
267 }
268
269 func ExampleClient_UninstallDeployment() {
270 ctx := context.Background()
271 // This snippet has been automatically generated and should be regarded as a code template only.
272 // It will require modifications to work:
273 // - It may require correct/in-range values for request initialization.
274 // - It may require specifying regional endpoints when creating the service client as shown in:
275 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
276 c, err := gsuiteaddons.NewClient(ctx)
277 if err != nil {
278 // TODO: Handle error.
279 }
280 defer c.Close()
281
282 req := &gsuiteaddonspb.UninstallDeploymentRequest{
283 // TODO: Fill request struct fields.
284 // See https://pkg.go.dev/cloud.google.com/go/gsuiteaddons/apiv1/gsuiteaddonspb#UninstallDeploymentRequest.
285 }
286 err = c.UninstallDeployment(ctx, req)
287 if err != nil {
288 // TODO: Handle error.
289 }
290 }