Debian Codegraph @

oslogin/apiv1/os_login_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 oslogin_test
18
19 import (
20 "context"
21
22 oslogin "cloud.google.com/go/oslogin/apiv1"
23 osloginpb "cloud.google.com/go/oslogin/apiv1/osloginpb"
24 )
25
26 func ExampleNewClient() {
27 ctx := context.Background()
28 // This snippet has been automatically generated and should be regarded as a code template only.
29 // It will require modifications to work:
30 // - It may require correct/in-range values for request initialization.
31 // - It may require specifying regional endpoints when creating the service client as shown in:
32 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
33 c, err := oslogin.NewClient(ctx)
34 if err != nil {
35 // TODO: Handle error.
36 }
37 defer c.Close()
38
39 // TODO: Use client.
40 _ = c
41 }
42
43 func ExampleNewRESTClient() {
44 ctx := context.Background()
45 // This snippet has been automatically generated and should be regarded as a code template only.
46 // It will require modifications to work:
47 // - It may require correct/in-range values for request initialization.
48 // - It may require specifying regional endpoints when creating the service client as shown in:
49 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
50 c, err := oslogin.NewRESTClient(ctx)
51 if err != nil {
52 // TODO: Handle error.
53 }
54 defer c.Close()
55
56 // TODO: Use client.
57 _ = c
58 }
59
60 func ExampleClient_CreateSshPublicKey() {
61 ctx := context.Background()
62 // This snippet has been automatically generated and should be regarded as a code template only.
63 // It will require modifications to work:
64 // - It may require correct/in-range values for request initialization.
65 // - It may require specifying regional endpoints when creating the service client as shown in:
66 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
67 c, err := oslogin.NewClient(ctx)
68 if err != nil {
69 // TODO: Handle error.
70 }
71 defer c.Close()
72
73 req := &osloginpb.CreateSshPublicKeyRequest{
74 // TODO: Fill request struct fields.
75 // See https://pkg.go.dev/cloud.google.com/go/oslogin/apiv1/osloginpb#CreateSshPublicKeyRequest.
76 }
77 resp, err := c.CreateSshPublicKey(ctx, req)
78 if err != nil {
79 // TODO: Handle error.
80 }
81 // TODO: Use resp.
82 _ = resp
83 }
84
85 func ExampleClient_DeletePosixAccount() {
86 ctx := context.Background()
87 // This snippet has been automatically generated and should be regarded as a code template only.
88 // It will require modifications to work:
89 // - It may require correct/in-range values for request initialization.
90 // - It may require specifying regional endpoints when creating the service client as shown in:
91 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
92 c, err := oslogin.NewClient(ctx)
93 if err != nil {
94 // TODO: Handle error.
95 }
96 defer c.Close()
97
98 req := &osloginpb.DeletePosixAccountRequest{
99 // TODO: Fill request struct fields.
100 // See https://pkg.go.dev/cloud.google.com/go/oslogin/apiv1/osloginpb#DeletePosixAccountRequest.
101 }
102 err = c.DeletePosixAccount(ctx, req)
103 if err != nil {
104 // TODO: Handle error.
105 }
106 }
107
108 func ExampleClient_DeleteSshPublicKey() {
109 ctx := context.Background()
110 // This snippet has been automatically generated and should be regarded as a code template only.
111 // It will require modifications to work:
112 // - It may require correct/in-range values for request initialization.
113 // - It may require specifying regional endpoints when creating the service client as shown in:
114 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
115 c, err := oslogin.NewClient(ctx)
116 if err != nil {
117 // TODO: Handle error.
118 }
119 defer c.Close()
120
121 req := &osloginpb.DeleteSshPublicKeyRequest{
122 // TODO: Fill request struct fields.
123 // See https://pkg.go.dev/cloud.google.com/go/oslogin/apiv1/osloginpb#DeleteSshPublicKeyRequest.
124 }
125 err = c.DeleteSshPublicKey(ctx, req)
126 if err != nil {
127 // TODO: Handle error.
128 }
129 }
130
131 func ExampleClient_GetLoginProfile() {
132 ctx := context.Background()
133 // This snippet has been automatically generated and should be regarded as a code template only.
134 // It will require modifications to work:
135 // - It may require correct/in-range values for request initialization.
136 // - It may require specifying regional endpoints when creating the service client as shown in:
137 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
138 c, err := oslogin.NewClient(ctx)
139 if err != nil {
140 // TODO: Handle error.
141 }
142 defer c.Close()
143
144 req := &osloginpb.GetLoginProfileRequest{
145 // TODO: Fill request struct fields.
146 // See https://pkg.go.dev/cloud.google.com/go/oslogin/apiv1/osloginpb#GetLoginProfileRequest.
147 }
148 resp, err := c.GetLoginProfile(ctx, req)
149 if err != nil {
150 // TODO: Handle error.
151 }
152 // TODO: Use resp.
153 _ = resp
154 }
155
156 func ExampleClient_GetSshPublicKey() {
157 ctx := context.Background()
158 // This snippet has been automatically generated and should be regarded as a code template only.
159 // It will require modifications to work:
160 // - It may require correct/in-range values for request initialization.
161 // - It may require specifying regional endpoints when creating the service client as shown in:
162 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
163 c, err := oslogin.NewClient(ctx)
164 if err != nil {
165 // TODO: Handle error.
166 }
167 defer c.Close()
168
169 req := &osloginpb.GetSshPublicKeyRequest{
170 // TODO: Fill request struct fields.
171 // See https://pkg.go.dev/cloud.google.com/go/oslogin/apiv1/osloginpb#GetSshPublicKeyRequest.
172 }
173 resp, err := c.GetSshPublicKey(ctx, req)
174 if err != nil {
175 // TODO: Handle error.
176 }
177 // TODO: Use resp.
178 _ = resp
179 }
180
181 func ExampleClient_ImportSshPublicKey() {
182 ctx := context.Background()
183 // This snippet has been automatically generated and should be regarded as a code template only.
184 // It will require modifications to work:
185 // - It may require correct/in-range values for request initialization.
186 // - It may require specifying regional endpoints when creating the service client as shown in:
187 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
188 c, err := oslogin.NewClient(ctx)
189 if err != nil {
190 // TODO: Handle error.
191 }
192 defer c.Close()
193
194 req := &osloginpb.ImportSshPublicKeyRequest{
195 // TODO: Fill request struct fields.
196 // See https://pkg.go.dev/cloud.google.com/go/oslogin/apiv1/osloginpb#ImportSshPublicKeyRequest.
197 }
198 resp, err := c.ImportSshPublicKey(ctx, req)
199 if err != nil {
200 // TODO: Handle error.
201 }
202 // TODO: Use resp.
203 _ = resp
204 }
205
206 func ExampleClient_UpdateSshPublicKey() {
207 ctx := context.Background()
208 // This snippet has been automatically generated and should be regarded as a code template only.
209 // It will require modifications to work:
210 // - It may require correct/in-range values for request initialization.
211 // - It may require specifying regional endpoints when creating the service client as shown in:
212 // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
213 c, err := oslogin.NewClient(ctx)
214 if err != nil {
215 // TODO: Handle error.
216 }
217 defer c.Close()
218
219 req := &osloginpb.UpdateSshPublicKeyRequest{
220 // TODO: Fill request struct fields.
221 // See https://pkg.go.dev/cloud.google.com/go/oslogin/apiv1/osloginpb#UpdateSshPublicKeyRequest.
222 }
223 resp, err := c.UpdateSshPublicKey(ctx, req)
224 if err != nil {
225 // TODO: Handle error.
226 }
227 // TODO: Use resp.
228 _ = resp
229 }