| 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 talent_test |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
|
| 22 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 23 |
talent "cloud.google.com/go/talent/apiv4beta1" |
| 24 |
talentpb "cloud.google.com/go/talent/apiv4beta1/talentpb" |
| 25 |
"google.golang.org/api/iterator" |
| 26 |
) |
| 27 |
|
| 28 |
func ExampleNewTenantClient() { |
| 29 |
ctx := context.Background() |
| 30 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 31 |
// It will require modifications to work: |
| 32 |
// - It may require correct/in-range values for request initialization. |
| 33 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 34 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 35 |
c, err := talent.NewTenantClient(ctx) |
| 36 |
if err != nil { |
| 37 |
// TODO: Handle error. |
| 38 |
} |
| 39 |
defer c.Close() |
| 40 |
|
| 41 |
// TODO: Use client. |
| 42 |
_ = c |
| 43 |
} |
| 44 |
|
| 45 |
func ExampleNewTenantRESTClient() { |
| 46 |
ctx := context.Background() |
| 47 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 48 |
// It will require modifications to work: |
| 49 |
// - It may require correct/in-range values for request initialization. |
| 50 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 51 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 52 |
c, err := talent.NewTenantRESTClient(ctx) |
| 53 |
if err != nil { |
| 54 |
// TODO: Handle error. |
| 55 |
} |
| 56 |
defer c.Close() |
| 57 |
|
| 58 |
// TODO: Use client. |
| 59 |
_ = c |
| 60 |
} |
| 61 |
|
| 62 |
func ExampleTenantClient_CreateTenant() { |
| 63 |
ctx := context.Background() |
| 64 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 65 |
// It will require modifications to work: |
| 66 |
// - It may require correct/in-range values for request initialization. |
| 67 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 68 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 69 |
c, err := talent.NewTenantClient(ctx) |
| 70 |
if err != nil { |
| 71 |
// TODO: Handle error. |
| 72 |
} |
| 73 |
defer c.Close() |
| 74 |
|
| 75 |
req := &talentpb.CreateTenantRequest{ |
| 76 |
// TODO: Fill request struct fields. |
| 77 |
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4beta1/talentpb#CreateTenantRequest. |
| 78 |
} |
| 79 |
resp, err := c.CreateTenant(ctx, req) |
| 80 |
if err != nil { |
| 81 |
// TODO: Handle error. |
| 82 |
} |
| 83 |
// TODO: Use resp. |
| 84 |
_ = resp |
| 85 |
} |
| 86 |
|
| 87 |
func ExampleTenantClient_DeleteTenant() { |
| 88 |
ctx := context.Background() |
| 89 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 90 |
// It will require modifications to work: |
| 91 |
// - It may require correct/in-range values for request initialization. |
| 92 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 93 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 94 |
c, err := talent.NewTenantClient(ctx) |
| 95 |
if err != nil { |
| 96 |
// TODO: Handle error. |
| 97 |
} |
| 98 |
defer c.Close() |
| 99 |
|
| 100 |
req := &talentpb.DeleteTenantRequest{ |
| 101 |
// TODO: Fill request struct fields. |
| 102 |
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4beta1/talentpb#DeleteTenantRequest. |
| 103 |
} |
| 104 |
err = c.DeleteTenant(ctx, req) |
| 105 |
if err != nil { |
| 106 |
// TODO: Handle error. |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
func ExampleTenantClient_GetTenant() { |
| 111 |
ctx := context.Background() |
| 112 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 113 |
// It will require modifications to work: |
| 114 |
// - It may require correct/in-range values for request initialization. |
| 115 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 116 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 117 |
c, err := talent.NewTenantClient(ctx) |
| 118 |
if err != nil { |
| 119 |
// TODO: Handle error. |
| 120 |
} |
| 121 |
defer c.Close() |
| 122 |
|
| 123 |
req := &talentpb.GetTenantRequest{ |
| 124 |
// TODO: Fill request struct fields. |
| 125 |
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4beta1/talentpb#GetTenantRequest. |
| 126 |
} |
| 127 |
resp, err := c.GetTenant(ctx, req) |
| 128 |
if err != nil { |
| 129 |
// TODO: Handle error. |
| 130 |
} |
| 131 |
// TODO: Use resp. |
| 132 |
_ = resp |
| 133 |
} |
| 134 |
|
| 135 |
func ExampleTenantClient_ListTenants() { |
| 136 |
ctx := context.Background() |
| 137 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 138 |
// It will require modifications to work: |
| 139 |
// - It may require correct/in-range values for request initialization. |
| 140 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 141 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 142 |
c, err := talent.NewTenantClient(ctx) |
| 143 |
if err != nil { |
| 144 |
// TODO: Handle error. |
| 145 |
} |
| 146 |
defer c.Close() |
| 147 |
|
| 148 |
req := &talentpb.ListTenantsRequest{ |
| 149 |
// TODO: Fill request struct fields. |
| 150 |
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4beta1/talentpb#ListTenantsRequest. |
| 151 |
} |
| 152 |
it := c.ListTenants(ctx, req) |
| 153 |
for { |
| 154 |
resp, err := it.Next() |
| 155 |
if err == iterator.Done { |
| 156 |
break |
| 157 |
} |
| 158 |
if err != nil { |
| 159 |
// TODO: Handle error. |
| 160 |
} |
| 161 |
// TODO: Use resp. |
| 162 |
_ = resp |
| 163 |
|
| 164 |
// If you need to access the underlying RPC response, |
| 165 |
// you can do so by casting the `Response` as below. |
| 166 |
// Otherwise, remove this line. Only populated after |
| 167 |
// first call to Next(). Not safe for concurrent access. |
| 168 |
_ = it.Response.(*talentpb.ListTenantsResponse) |
| 169 |
} |
| 170 |
} |
| 171 |
|
| 172 |
func ExampleTenantClient_UpdateTenant() { |
| 173 |
ctx := context.Background() |
| 174 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 175 |
// It will require modifications to work: |
| 176 |
// - It may require correct/in-range values for request initialization. |
| 177 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 178 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 179 |
c, err := talent.NewTenantClient(ctx) |
| 180 |
if err != nil { |
| 181 |
// TODO: Handle error. |
| 182 |
} |
| 183 |
defer c.Close() |
| 184 |
|
| 185 |
req := &talentpb.UpdateTenantRequest{ |
| 186 |
// TODO: Fill request struct fields. |
| 187 |
// See https://pkg.go.dev/cloud.google.com/go/talent/apiv4beta1/talentpb#UpdateTenantRequest. |
| 188 |
} |
| 189 |
resp, err := c.UpdateTenant(ctx, req) |
| 190 |
if err != nil { |
| 191 |
// TODO: Handle error. |
| 192 |
} |
| 193 |
// TODO: Use resp. |
| 194 |
_ = resp |
| 195 |
} |
| 196 |
|
| 197 |
func ExampleTenantClient_GetOperation() { |
| 198 |
ctx := context.Background() |
| 199 |
// This snippet has been automatically generated and should be regarded as a code template only. |
| 200 |
// It will require modifications to work: |
| 201 |
// - It may require correct/in-range values for request initialization. |
| 202 |
// - It may require specifying regional endpoints when creating the service client as shown in: |
| 203 |
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options |
| 204 |
c, err := talent.NewTenantClient(ctx) |
| 205 |
if err != nil { |
| 206 |
// TODO: Handle error. |
| 207 |
} |
| 208 |
defer c.Close() |
| 209 |
|
| 210 |
req := &longrunningpb.GetOperationRequest{ |
| 211 |
// TODO: Fill request struct fields. |
| 212 |
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest. |
| 213 |
} |
| 214 |
resp, err := c.GetOperation(ctx, req) |
| 215 |
if err != nil { |
| 216 |
// TODO: Handle error. |
| 217 |
} |
| 218 |
// TODO: Use resp. |
| 219 |
_ = resp |
| 220 |
} |