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 privateca_test
18
19import (
20	"context"
21
22	privateca "cloud.google.com/go/security/privateca/apiv1beta1"
23	"google.golang.org/api/iterator"
24	privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
25)
26
27func ExampleNewCertificateAuthorityClient() {
28	ctx := context.Background()
29	c, err := privateca.NewCertificateAuthorityClient(ctx)
30	if err != nil {
31		// TODO: Handle error.
32	}
33	// TODO: Use client.
34	_ = c
35}
36
37func ExampleCertificateAuthorityClient_CreateCertificate() {
38	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
39
40	ctx := context.Background()
41	c, err := privateca.NewCertificateAuthorityClient(ctx)
42	if err != nil {
43		// TODO: Handle error.
44	}
45
46	req := &privatecapb.CreateCertificateRequest{
47		// TODO: Fill request struct fields.
48	}
49	resp, err := c.CreateCertificate(ctx, req)
50	if err != nil {
51		// TODO: Handle error.
52	}
53	// TODO: Use resp.
54	_ = resp
55}
56
57func ExampleCertificateAuthorityClient_GetCertificate() {
58	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
59
60	ctx := context.Background()
61	c, err := privateca.NewCertificateAuthorityClient(ctx)
62	if err != nil {
63		// TODO: Handle error.
64	}
65
66	req := &privatecapb.GetCertificateRequest{
67		// TODO: Fill request struct fields.
68	}
69	resp, err := c.GetCertificate(ctx, req)
70	if err != nil {
71		// TODO: Handle error.
72	}
73	// TODO: Use resp.
74	_ = resp
75}
76
77func ExampleCertificateAuthorityClient_ListCertificates() {
78	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
79	// import "google.golang.org/api/iterator"
80
81	ctx := context.Background()
82	c, err := privateca.NewCertificateAuthorityClient(ctx)
83	if err != nil {
84		// TODO: Handle error.
85	}
86
87	req := &privatecapb.ListCertificatesRequest{
88		// TODO: Fill request struct fields.
89	}
90	it := c.ListCertificates(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 ExampleCertificateAuthorityClient_RevokeCertificate() {
105	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
106
107	ctx := context.Background()
108	c, err := privateca.NewCertificateAuthorityClient(ctx)
109	if err != nil {
110		// TODO: Handle error.
111	}
112
113	req := &privatecapb.RevokeCertificateRequest{
114		// TODO: Fill request struct fields.
115	}
116	resp, err := c.RevokeCertificate(ctx, req)
117	if err != nil {
118		// TODO: Handle error.
119	}
120	// TODO: Use resp.
121	_ = resp
122}
123
124func ExampleCertificateAuthorityClient_UpdateCertificate() {
125	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
126
127	ctx := context.Background()
128	c, err := privateca.NewCertificateAuthorityClient(ctx)
129	if err != nil {
130		// TODO: Handle error.
131	}
132
133	req := &privatecapb.UpdateCertificateRequest{
134		// TODO: Fill request struct fields.
135	}
136	resp, err := c.UpdateCertificate(ctx, req)
137	if err != nil {
138		// TODO: Handle error.
139	}
140	// TODO: Use resp.
141	_ = resp
142}
143
144func ExampleCertificateAuthorityClient_ActivateCertificateAuthority() {
145	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
146
147	ctx := context.Background()
148	c, err := privateca.NewCertificateAuthorityClient(ctx)
149	if err != nil {
150		// TODO: Handle error.
151	}
152
153	req := &privatecapb.ActivateCertificateAuthorityRequest{
154		// TODO: Fill request struct fields.
155	}
156	op, err := c.ActivateCertificateAuthority(ctx, req)
157	if err != nil {
158		// TODO: Handle error.
159	}
160
161	resp, err := op.Wait(ctx)
162	if err != nil {
163		// TODO: Handle error.
164	}
165	// TODO: Use resp.
166	_ = resp
167}
168
169func ExampleCertificateAuthorityClient_CreateCertificateAuthority() {
170	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
171
172	ctx := context.Background()
173	c, err := privateca.NewCertificateAuthorityClient(ctx)
174	if err != nil {
175		// TODO: Handle error.
176	}
177
178	req := &privatecapb.CreateCertificateAuthorityRequest{
179		// TODO: Fill request struct fields.
180	}
181	op, err := c.CreateCertificateAuthority(ctx, req)
182	if err != nil {
183		// TODO: Handle error.
184	}
185
186	resp, err := op.Wait(ctx)
187	if err != nil {
188		// TODO: Handle error.
189	}
190	// TODO: Use resp.
191	_ = resp
192}
193
194func ExampleCertificateAuthorityClient_DisableCertificateAuthority() {
195	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
196
197	ctx := context.Background()
198	c, err := privateca.NewCertificateAuthorityClient(ctx)
199	if err != nil {
200		// TODO: Handle error.
201	}
202
203	req := &privatecapb.DisableCertificateAuthorityRequest{
204		// TODO: Fill request struct fields.
205	}
206	op, err := c.DisableCertificateAuthority(ctx, req)
207	if err != nil {
208		// TODO: Handle error.
209	}
210
211	resp, err := op.Wait(ctx)
212	if err != nil {
213		// TODO: Handle error.
214	}
215	// TODO: Use resp.
216	_ = resp
217}
218
219func ExampleCertificateAuthorityClient_EnableCertificateAuthority() {
220	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
221
222	ctx := context.Background()
223	c, err := privateca.NewCertificateAuthorityClient(ctx)
224	if err != nil {
225		// TODO: Handle error.
226	}
227
228	req := &privatecapb.EnableCertificateAuthorityRequest{
229		// TODO: Fill request struct fields.
230	}
231	op, err := c.EnableCertificateAuthority(ctx, req)
232	if err != nil {
233		// TODO: Handle error.
234	}
235
236	resp, err := op.Wait(ctx)
237	if err != nil {
238		// TODO: Handle error.
239	}
240	// TODO: Use resp.
241	_ = resp
242}
243
244func ExampleCertificateAuthorityClient_FetchCertificateAuthorityCsr() {
245	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
246
247	ctx := context.Background()
248	c, err := privateca.NewCertificateAuthorityClient(ctx)
249	if err != nil {
250		// TODO: Handle error.
251	}
252
253	req := &privatecapb.FetchCertificateAuthorityCsrRequest{
254		// TODO: Fill request struct fields.
255	}
256	resp, err := c.FetchCertificateAuthorityCsr(ctx, req)
257	if err != nil {
258		// TODO: Handle error.
259	}
260	// TODO: Use resp.
261	_ = resp
262}
263
264func ExampleCertificateAuthorityClient_GetCertificateAuthority() {
265	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
266
267	ctx := context.Background()
268	c, err := privateca.NewCertificateAuthorityClient(ctx)
269	if err != nil {
270		// TODO: Handle error.
271	}
272
273	req := &privatecapb.GetCertificateAuthorityRequest{
274		// TODO: Fill request struct fields.
275	}
276	resp, err := c.GetCertificateAuthority(ctx, req)
277	if err != nil {
278		// TODO: Handle error.
279	}
280	// TODO: Use resp.
281	_ = resp
282}
283
284func ExampleCertificateAuthorityClient_ListCertificateAuthorities() {
285	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
286	// import "google.golang.org/api/iterator"
287
288	ctx := context.Background()
289	c, err := privateca.NewCertificateAuthorityClient(ctx)
290	if err != nil {
291		// TODO: Handle error.
292	}
293
294	req := &privatecapb.ListCertificateAuthoritiesRequest{
295		// TODO: Fill request struct fields.
296	}
297	it := c.ListCertificateAuthorities(ctx, req)
298	for {
299		resp, err := it.Next()
300		if err == iterator.Done {
301			break
302		}
303		if err != nil {
304			// TODO: Handle error.
305		}
306		// TODO: Use resp.
307		_ = resp
308	}
309}
310
311func ExampleCertificateAuthorityClient_RestoreCertificateAuthority() {
312	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
313
314	ctx := context.Background()
315	c, err := privateca.NewCertificateAuthorityClient(ctx)
316	if err != nil {
317		// TODO: Handle error.
318	}
319
320	req := &privatecapb.RestoreCertificateAuthorityRequest{
321		// TODO: Fill request struct fields.
322	}
323	op, err := c.RestoreCertificateAuthority(ctx, req)
324	if err != nil {
325		// TODO: Handle error.
326	}
327
328	resp, err := op.Wait(ctx)
329	if err != nil {
330		// TODO: Handle error.
331	}
332	// TODO: Use resp.
333	_ = resp
334}
335
336func ExampleCertificateAuthorityClient_ScheduleDeleteCertificateAuthority() {
337	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
338
339	ctx := context.Background()
340	c, err := privateca.NewCertificateAuthorityClient(ctx)
341	if err != nil {
342		// TODO: Handle error.
343	}
344
345	req := &privatecapb.ScheduleDeleteCertificateAuthorityRequest{
346		// TODO: Fill request struct fields.
347	}
348	op, err := c.ScheduleDeleteCertificateAuthority(ctx, req)
349	if err != nil {
350		// TODO: Handle error.
351	}
352
353	resp, err := op.Wait(ctx)
354	if err != nil {
355		// TODO: Handle error.
356	}
357	// TODO: Use resp.
358	_ = resp
359}
360
361func ExampleCertificateAuthorityClient_UpdateCertificateAuthority() {
362	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
363
364	ctx := context.Background()
365	c, err := privateca.NewCertificateAuthorityClient(ctx)
366	if err != nil {
367		// TODO: Handle error.
368	}
369
370	req := &privatecapb.UpdateCertificateAuthorityRequest{
371		// TODO: Fill request struct fields.
372	}
373	op, err := c.UpdateCertificateAuthority(ctx, req)
374	if err != nil {
375		// TODO: Handle error.
376	}
377
378	resp, err := op.Wait(ctx)
379	if err != nil {
380		// TODO: Handle error.
381	}
382	// TODO: Use resp.
383	_ = resp
384}
385
386func ExampleCertificateAuthorityClient_GetCertificateRevocationList() {
387	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
388
389	ctx := context.Background()
390	c, err := privateca.NewCertificateAuthorityClient(ctx)
391	if err != nil {
392		// TODO: Handle error.
393	}
394
395	req := &privatecapb.GetCertificateRevocationListRequest{
396		// TODO: Fill request struct fields.
397	}
398	resp, err := c.GetCertificateRevocationList(ctx, req)
399	if err != nil {
400		// TODO: Handle error.
401	}
402	// TODO: Use resp.
403	_ = resp
404}
405
406func ExampleCertificateAuthorityClient_ListCertificateRevocationLists() {
407	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
408	// import "google.golang.org/api/iterator"
409
410	ctx := context.Background()
411	c, err := privateca.NewCertificateAuthorityClient(ctx)
412	if err != nil {
413		// TODO: Handle error.
414	}
415
416	req := &privatecapb.ListCertificateRevocationListsRequest{
417		// TODO: Fill request struct fields.
418	}
419	it := c.ListCertificateRevocationLists(ctx, req)
420	for {
421		resp, err := it.Next()
422		if err == iterator.Done {
423			break
424		}
425		if err != nil {
426			// TODO: Handle error.
427		}
428		// TODO: Use resp.
429		_ = resp
430	}
431}
432
433func ExampleCertificateAuthorityClient_UpdateCertificateRevocationList() {
434	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
435
436	ctx := context.Background()
437	c, err := privateca.NewCertificateAuthorityClient(ctx)
438	if err != nil {
439		// TODO: Handle error.
440	}
441
442	req := &privatecapb.UpdateCertificateRevocationListRequest{
443		// TODO: Fill request struct fields.
444	}
445	op, err := c.UpdateCertificateRevocationList(ctx, req)
446	if err != nil {
447		// TODO: Handle error.
448	}
449
450	resp, err := op.Wait(ctx)
451	if err != nil {
452		// TODO: Handle error.
453	}
454	// TODO: Use resp.
455	_ = resp
456}
457
458func ExampleCertificateAuthorityClient_GetReusableConfig() {
459	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
460
461	ctx := context.Background()
462	c, err := privateca.NewCertificateAuthorityClient(ctx)
463	if err != nil {
464		// TODO: Handle error.
465	}
466
467	req := &privatecapb.GetReusableConfigRequest{
468		// TODO: Fill request struct fields.
469	}
470	resp, err := c.GetReusableConfig(ctx, req)
471	if err != nil {
472		// TODO: Handle error.
473	}
474	// TODO: Use resp.
475	_ = resp
476}
477
478func ExampleCertificateAuthorityClient_ListReusableConfigs() {
479	// import privatecapb "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1"
480	// import "google.golang.org/api/iterator"
481
482	ctx := context.Background()
483	c, err := privateca.NewCertificateAuthorityClient(ctx)
484	if err != nil {
485		// TODO: Handle error.
486	}
487
488	req := &privatecapb.ListReusableConfigsRequest{
489		// TODO: Fill request struct fields.
490	}
491	it := c.ListReusableConfigs(ctx, req)
492	for {
493		resp, err := it.Next()
494		if err == iterator.Done {
495			break
496		}
497		if err != nil {
498			// TODO: Handle error.
499		}
500		// TODO: Use resp.
501		_ = resp
502	}
503}
504