google-cloud-os_login-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/os_login/v1/os_login_service/client.rb +804 -0
- data/lib/google/cloud/os_login/v1/os_login_service/credentials.rb +52 -0
- data/lib/google/cloud/os_login/v1/os_login_service/paths.rb +81 -0
- data/lib/google/cloud/os_login/v1/os_login_service.rb +52 -0
- data/lib/google/cloud/os_login/v1/version.rb +28 -0
- data/lib/google/cloud/os_login/v1.rb +35 -0
- data/lib/google/cloud/oslogin/common/common_pb.rb +47 -0
- data/lib/google/cloud/oslogin/v1/oslogin_pb.rb +65 -0
- data/lib/google/cloud/oslogin/v1/oslogin_services_pb.rb +63 -0
- data/lib/google-cloud-os_login-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/oslogin/common/common.rb +99 -0
- data/proto_docs/google/cloud/oslogin/v1/oslogin.rb +140 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- metadata +179 -0
@@ -0,0 +1,804 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/oslogin/v1/oslogin_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module OsLogin
|
25
|
+
module V1
|
26
|
+
module OsLoginService
|
27
|
+
##
|
28
|
+
# Client for the OsLoginService service.
|
29
|
+
#
|
30
|
+
# Cloud OS Login API
|
31
|
+
#
|
32
|
+
# The Cloud OS Login API allows you to manage users and their associated SSH
|
33
|
+
# public keys for logging into virtual machines on Google Cloud Platform.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
include Paths
|
37
|
+
|
38
|
+
# @private
|
39
|
+
attr_reader :os_login_service_stub
|
40
|
+
|
41
|
+
##
|
42
|
+
# Configure the OsLoginService Client class.
|
43
|
+
#
|
44
|
+
# See {::Google::Cloud::OsLogin::V1::OsLoginService::Client::Configuration}
|
45
|
+
# for a description of the configuration fields.
|
46
|
+
#
|
47
|
+
# ## Example
|
48
|
+
#
|
49
|
+
# To modify the configuration for all OsLoginService clients:
|
50
|
+
#
|
51
|
+
# ::Google::Cloud::OsLogin::V1::OsLoginService::Client.configure do |config|
|
52
|
+
# config.timeout = 10.0
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Client client.
|
56
|
+
# @yieldparam config [Client::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Client::Configuration]
|
59
|
+
#
|
60
|
+
def self.configure
|
61
|
+
@configure ||= begin
|
62
|
+
namespace = ["Google", "Cloud", "OsLogin", "V1"]
|
63
|
+
parent_config = while namespace.any?
|
64
|
+
parent_name = namespace.join "::"
|
65
|
+
parent_const = const_get parent_name
|
66
|
+
break parent_const.configure if parent_const&.respond_to? :configure
|
67
|
+
namespace.pop
|
68
|
+
end
|
69
|
+
default_config = Client::Configuration.new parent_config
|
70
|
+
|
71
|
+
default_config.rpcs.delete_posix_account.timeout = 10.0
|
72
|
+
default_config.rpcs.delete_posix_account.retry_policy = {
|
73
|
+
initial_delay: 0.1,
|
74
|
+
max_delay: 60.0,
|
75
|
+
multiplier: 1.3,
|
76
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
77
|
+
}
|
78
|
+
|
79
|
+
default_config.rpcs.delete_ssh_public_key.timeout = 10.0
|
80
|
+
default_config.rpcs.delete_ssh_public_key.retry_policy = {
|
81
|
+
initial_delay: 0.1,
|
82
|
+
max_delay: 60.0,
|
83
|
+
multiplier: 1.3,
|
84
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
85
|
+
}
|
86
|
+
|
87
|
+
default_config.rpcs.get_login_profile.timeout = 10.0
|
88
|
+
default_config.rpcs.get_login_profile.retry_policy = {
|
89
|
+
initial_delay: 0.1,
|
90
|
+
max_delay: 60.0,
|
91
|
+
multiplier: 1.3,
|
92
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
93
|
+
}
|
94
|
+
|
95
|
+
default_config.rpcs.get_ssh_public_key.timeout = 10.0
|
96
|
+
default_config.rpcs.get_ssh_public_key.retry_policy = {
|
97
|
+
initial_delay: 0.1,
|
98
|
+
max_delay: 60.0,
|
99
|
+
multiplier: 1.3,
|
100
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
101
|
+
}
|
102
|
+
|
103
|
+
default_config.rpcs.import_ssh_public_key.timeout = 10.0
|
104
|
+
default_config.rpcs.import_ssh_public_key.retry_policy = {
|
105
|
+
initial_delay: 0.1,
|
106
|
+
max_delay: 60.0,
|
107
|
+
multiplier: 1.3,
|
108
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
109
|
+
}
|
110
|
+
|
111
|
+
default_config.rpcs.update_ssh_public_key.timeout = 10.0
|
112
|
+
default_config.rpcs.update_ssh_public_key.retry_policy = {
|
113
|
+
initial_delay: 0.1,
|
114
|
+
max_delay: 60.0,
|
115
|
+
multiplier: 1.3,
|
116
|
+
retry_codes: ["UNAVAILABLE", "DEADLINE_EXCEEDED"]
|
117
|
+
}
|
118
|
+
|
119
|
+
default_config
|
120
|
+
end
|
121
|
+
yield @configure if block_given?
|
122
|
+
@configure
|
123
|
+
end
|
124
|
+
|
125
|
+
##
|
126
|
+
# Configure the OsLoginService Client instance.
|
127
|
+
#
|
128
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
129
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
130
|
+
# should be made on {Client.configure}.
|
131
|
+
#
|
132
|
+
# See {::Google::Cloud::OsLogin::V1::OsLoginService::Client::Configuration}
|
133
|
+
# for a description of the configuration fields.
|
134
|
+
#
|
135
|
+
# @yield [config] Configure the Client client.
|
136
|
+
# @yieldparam config [Client::Configuration]
|
137
|
+
#
|
138
|
+
# @return [Client::Configuration]
|
139
|
+
#
|
140
|
+
def configure
|
141
|
+
yield @config if block_given?
|
142
|
+
@config
|
143
|
+
end
|
144
|
+
|
145
|
+
##
|
146
|
+
# Create a new OsLoginService client object.
|
147
|
+
#
|
148
|
+
# ## Examples
|
149
|
+
#
|
150
|
+
# To create a new OsLoginService client with the default
|
151
|
+
# configuration:
|
152
|
+
#
|
153
|
+
# client = ::Google::Cloud::OsLogin::V1::OsLoginService::Client.new
|
154
|
+
#
|
155
|
+
# To create a new OsLoginService client with a custom
|
156
|
+
# configuration:
|
157
|
+
#
|
158
|
+
# client = ::Google::Cloud::OsLogin::V1::OsLoginService::Client.new do |config|
|
159
|
+
# config.timeout = 10.0
|
160
|
+
# end
|
161
|
+
#
|
162
|
+
# @yield [config] Configure the OsLoginService client.
|
163
|
+
# @yieldparam config [Client::Configuration]
|
164
|
+
#
|
165
|
+
def initialize
|
166
|
+
# These require statements are intentionally placed here to initialize
|
167
|
+
# the gRPC module only when it's required.
|
168
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
169
|
+
require "gapic/grpc"
|
170
|
+
require "google/cloud/oslogin/v1/oslogin_services_pb"
|
171
|
+
|
172
|
+
# Create the configuration object
|
173
|
+
@config = Configuration.new Client.configure
|
174
|
+
|
175
|
+
# Yield the configuration if needed
|
176
|
+
yield @config if block_given?
|
177
|
+
|
178
|
+
# Create credentials
|
179
|
+
credentials = @config.credentials
|
180
|
+
credentials ||= Credentials.default scope: @config.scope
|
181
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
182
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
183
|
+
end
|
184
|
+
@quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
|
185
|
+
|
186
|
+
@os_login_service_stub = ::Gapic::ServiceStub.new(
|
187
|
+
::Google::Cloud::OsLogin::V1::OsLoginService::Stub,
|
188
|
+
credentials: credentials,
|
189
|
+
endpoint: @config.endpoint,
|
190
|
+
channel_args: @config.channel_args,
|
191
|
+
interceptors: @config.interceptors
|
192
|
+
)
|
193
|
+
end
|
194
|
+
|
195
|
+
# Service calls
|
196
|
+
|
197
|
+
##
|
198
|
+
# Deletes a POSIX account.
|
199
|
+
#
|
200
|
+
# @overload delete_posix_account(request, options = nil)
|
201
|
+
# Pass arguments to `delete_posix_account` via a request object, either of type
|
202
|
+
# {::Google::Cloud::OsLogin::V1::DeletePosixAccountRequest} or an equivalent Hash.
|
203
|
+
#
|
204
|
+
# @param request [::Google::Cloud::OsLogin::V1::DeletePosixAccountRequest, ::Hash]
|
205
|
+
# A request object representing the call parameters. Required. To specify no
|
206
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
207
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
208
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
209
|
+
#
|
210
|
+
# @overload delete_posix_account(name: nil)
|
211
|
+
# Pass arguments to `delete_posix_account` via keyword arguments. Note that at
|
212
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
213
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
214
|
+
#
|
215
|
+
# @param name [::String]
|
216
|
+
# Required. A reference to the POSIX account to update. POSIX accounts are identified
|
217
|
+
# by the project ID they are associated with. A reference to the POSIX
|
218
|
+
# account is in format `users/{user}/projects/{project}`.
|
219
|
+
#
|
220
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
221
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
222
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
223
|
+
#
|
224
|
+
# @return [::Google::Protobuf::Empty]
|
225
|
+
#
|
226
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
227
|
+
#
|
228
|
+
def delete_posix_account request, options = nil
|
229
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
230
|
+
|
231
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsLogin::V1::DeletePosixAccountRequest
|
232
|
+
|
233
|
+
# Converts hash and nil to an options object
|
234
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
235
|
+
|
236
|
+
# Customize the options with defaults
|
237
|
+
metadata = @config.rpcs.delete_posix_account.metadata.to_h
|
238
|
+
|
239
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
240
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
241
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
242
|
+
gapic_version: ::Google::Cloud::OsLogin::V1::VERSION
|
243
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
244
|
+
|
245
|
+
header_params = {
|
246
|
+
"name" => request.name
|
247
|
+
}
|
248
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
249
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
250
|
+
|
251
|
+
options.apply_defaults timeout: @config.rpcs.delete_posix_account.timeout,
|
252
|
+
metadata: metadata,
|
253
|
+
retry_policy: @config.rpcs.delete_posix_account.retry_policy
|
254
|
+
options.apply_defaults metadata: @config.metadata,
|
255
|
+
retry_policy: @config.retry_policy
|
256
|
+
|
257
|
+
@os_login_service_stub.call_rpc :delete_posix_account, request, options: options do |response, operation|
|
258
|
+
yield response, operation if block_given?
|
259
|
+
return response
|
260
|
+
end
|
261
|
+
rescue ::GRPC::BadStatus => e
|
262
|
+
raise ::Google::Cloud::Error.from_error(e)
|
263
|
+
end
|
264
|
+
|
265
|
+
##
|
266
|
+
# Deletes an SSH public key.
|
267
|
+
#
|
268
|
+
# @overload delete_ssh_public_key(request, options = nil)
|
269
|
+
# Pass arguments to `delete_ssh_public_key` via a request object, either of type
|
270
|
+
# {::Google::Cloud::OsLogin::V1::DeleteSshPublicKeyRequest} or an equivalent Hash.
|
271
|
+
#
|
272
|
+
# @param request [::Google::Cloud::OsLogin::V1::DeleteSshPublicKeyRequest, ::Hash]
|
273
|
+
# A request object representing the call parameters. Required. To specify no
|
274
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
275
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
276
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
277
|
+
#
|
278
|
+
# @overload delete_ssh_public_key(name: nil)
|
279
|
+
# Pass arguments to `delete_ssh_public_key` via keyword arguments. Note that at
|
280
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
281
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
282
|
+
#
|
283
|
+
# @param name [::String]
|
284
|
+
# Required. The fingerprint of the public key to update. Public keys are identified by
|
285
|
+
# their SHA-256 fingerprint. The fingerprint of the public key is in format
|
286
|
+
# `users/{user}/sshPublicKeys/{fingerprint}`.
|
287
|
+
#
|
288
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
289
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
290
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
291
|
+
#
|
292
|
+
# @return [::Google::Protobuf::Empty]
|
293
|
+
#
|
294
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
295
|
+
#
|
296
|
+
def delete_ssh_public_key request, options = nil
|
297
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
298
|
+
|
299
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsLogin::V1::DeleteSshPublicKeyRequest
|
300
|
+
|
301
|
+
# Converts hash and nil to an options object
|
302
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
303
|
+
|
304
|
+
# Customize the options with defaults
|
305
|
+
metadata = @config.rpcs.delete_ssh_public_key.metadata.to_h
|
306
|
+
|
307
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
308
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
309
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
310
|
+
gapic_version: ::Google::Cloud::OsLogin::V1::VERSION
|
311
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
312
|
+
|
313
|
+
header_params = {
|
314
|
+
"name" => request.name
|
315
|
+
}
|
316
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
317
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
318
|
+
|
319
|
+
options.apply_defaults timeout: @config.rpcs.delete_ssh_public_key.timeout,
|
320
|
+
metadata: metadata,
|
321
|
+
retry_policy: @config.rpcs.delete_ssh_public_key.retry_policy
|
322
|
+
options.apply_defaults metadata: @config.metadata,
|
323
|
+
retry_policy: @config.retry_policy
|
324
|
+
|
325
|
+
@os_login_service_stub.call_rpc :delete_ssh_public_key, request, options: options do |response, operation|
|
326
|
+
yield response, operation if block_given?
|
327
|
+
return response
|
328
|
+
end
|
329
|
+
rescue ::GRPC::BadStatus => e
|
330
|
+
raise ::Google::Cloud::Error.from_error(e)
|
331
|
+
end
|
332
|
+
|
333
|
+
##
|
334
|
+
# Retrieves the profile information used for logging in to a virtual machine
|
335
|
+
# on Google Compute Engine.
|
336
|
+
#
|
337
|
+
# @overload get_login_profile(request, options = nil)
|
338
|
+
# Pass arguments to `get_login_profile` via a request object, either of type
|
339
|
+
# {::Google::Cloud::OsLogin::V1::GetLoginProfileRequest} or an equivalent Hash.
|
340
|
+
#
|
341
|
+
# @param request [::Google::Cloud::OsLogin::V1::GetLoginProfileRequest, ::Hash]
|
342
|
+
# A request object representing the call parameters. Required. To specify no
|
343
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
344
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
345
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
346
|
+
#
|
347
|
+
# @overload get_login_profile(name: nil, project_id: nil, system_id: nil)
|
348
|
+
# Pass arguments to `get_login_profile` via keyword arguments. Note that at
|
349
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
350
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
351
|
+
#
|
352
|
+
# @param name [::String]
|
353
|
+
# Required. The unique ID for the user in format `users/{user}`.
|
354
|
+
# @param project_id [::String]
|
355
|
+
# The project ID of the Google Cloud Platform project.
|
356
|
+
# @param system_id [::String]
|
357
|
+
# A system ID for filtering the results of the request.
|
358
|
+
#
|
359
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
360
|
+
# @yieldparam response [::Google::Cloud::OsLogin::V1::LoginProfile]
|
361
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
362
|
+
#
|
363
|
+
# @return [::Google::Cloud::OsLogin::V1::LoginProfile]
|
364
|
+
#
|
365
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
366
|
+
#
|
367
|
+
def get_login_profile request, options = nil
|
368
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
369
|
+
|
370
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsLogin::V1::GetLoginProfileRequest
|
371
|
+
|
372
|
+
# Converts hash and nil to an options object
|
373
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
374
|
+
|
375
|
+
# Customize the options with defaults
|
376
|
+
metadata = @config.rpcs.get_login_profile.metadata.to_h
|
377
|
+
|
378
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
379
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
380
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
381
|
+
gapic_version: ::Google::Cloud::OsLogin::V1::VERSION
|
382
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
383
|
+
|
384
|
+
header_params = {
|
385
|
+
"name" => request.name
|
386
|
+
}
|
387
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
388
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
389
|
+
|
390
|
+
options.apply_defaults timeout: @config.rpcs.get_login_profile.timeout,
|
391
|
+
metadata: metadata,
|
392
|
+
retry_policy: @config.rpcs.get_login_profile.retry_policy
|
393
|
+
options.apply_defaults metadata: @config.metadata,
|
394
|
+
retry_policy: @config.retry_policy
|
395
|
+
|
396
|
+
@os_login_service_stub.call_rpc :get_login_profile, request, options: options do |response, operation|
|
397
|
+
yield response, operation if block_given?
|
398
|
+
return response
|
399
|
+
end
|
400
|
+
rescue ::GRPC::BadStatus => e
|
401
|
+
raise ::Google::Cloud::Error.from_error(e)
|
402
|
+
end
|
403
|
+
|
404
|
+
##
|
405
|
+
# Retrieves an SSH public key.
|
406
|
+
#
|
407
|
+
# @overload get_ssh_public_key(request, options = nil)
|
408
|
+
# Pass arguments to `get_ssh_public_key` via a request object, either of type
|
409
|
+
# {::Google::Cloud::OsLogin::V1::GetSshPublicKeyRequest} or an equivalent Hash.
|
410
|
+
#
|
411
|
+
# @param request [::Google::Cloud::OsLogin::V1::GetSshPublicKeyRequest, ::Hash]
|
412
|
+
# A request object representing the call parameters. Required. To specify no
|
413
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
414
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
415
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
416
|
+
#
|
417
|
+
# @overload get_ssh_public_key(name: nil)
|
418
|
+
# Pass arguments to `get_ssh_public_key` via keyword arguments. Note that at
|
419
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
420
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
421
|
+
#
|
422
|
+
# @param name [::String]
|
423
|
+
# Required. The fingerprint of the public key to retrieve. Public keys are identified
|
424
|
+
# by their SHA-256 fingerprint. The fingerprint of the public key is in
|
425
|
+
# format `users/{user}/sshPublicKeys/{fingerprint}`.
|
426
|
+
#
|
427
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
428
|
+
# @yieldparam response [::Google::Cloud::OsLogin::Common::SshPublicKey]
|
429
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
430
|
+
#
|
431
|
+
# @return [::Google::Cloud::OsLogin::Common::SshPublicKey]
|
432
|
+
#
|
433
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
434
|
+
#
|
435
|
+
def get_ssh_public_key request, options = nil
|
436
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
437
|
+
|
438
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsLogin::V1::GetSshPublicKeyRequest
|
439
|
+
|
440
|
+
# Converts hash and nil to an options object
|
441
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
442
|
+
|
443
|
+
# Customize the options with defaults
|
444
|
+
metadata = @config.rpcs.get_ssh_public_key.metadata.to_h
|
445
|
+
|
446
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
447
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
448
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
449
|
+
gapic_version: ::Google::Cloud::OsLogin::V1::VERSION
|
450
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
451
|
+
|
452
|
+
header_params = {
|
453
|
+
"name" => request.name
|
454
|
+
}
|
455
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
456
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
457
|
+
|
458
|
+
options.apply_defaults timeout: @config.rpcs.get_ssh_public_key.timeout,
|
459
|
+
metadata: metadata,
|
460
|
+
retry_policy: @config.rpcs.get_ssh_public_key.retry_policy
|
461
|
+
options.apply_defaults metadata: @config.metadata,
|
462
|
+
retry_policy: @config.retry_policy
|
463
|
+
|
464
|
+
@os_login_service_stub.call_rpc :get_ssh_public_key, request, options: options do |response, operation|
|
465
|
+
yield response, operation if block_given?
|
466
|
+
return response
|
467
|
+
end
|
468
|
+
rescue ::GRPC::BadStatus => e
|
469
|
+
raise ::Google::Cloud::Error.from_error(e)
|
470
|
+
end
|
471
|
+
|
472
|
+
##
|
473
|
+
# Adds an SSH public key and returns the profile information. Default POSIX
|
474
|
+
# account information is set when no username and UID exist as part of the
|
475
|
+
# login profile.
|
476
|
+
#
|
477
|
+
# @overload import_ssh_public_key(request, options = nil)
|
478
|
+
# Pass arguments to `import_ssh_public_key` via a request object, either of type
|
479
|
+
# {::Google::Cloud::OsLogin::V1::ImportSshPublicKeyRequest} or an equivalent Hash.
|
480
|
+
#
|
481
|
+
# @param request [::Google::Cloud::OsLogin::V1::ImportSshPublicKeyRequest, ::Hash]
|
482
|
+
# A request object representing the call parameters. Required. To specify no
|
483
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
484
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
485
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
486
|
+
#
|
487
|
+
# @overload import_ssh_public_key(parent: nil, ssh_public_key: nil, project_id: nil)
|
488
|
+
# Pass arguments to `import_ssh_public_key` via keyword arguments. Note that at
|
489
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
490
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
491
|
+
#
|
492
|
+
# @param parent [::String]
|
493
|
+
# Required. The unique ID for the user in format `users/{user}`.
|
494
|
+
# @param ssh_public_key [::Google::Cloud::OsLogin::Common::SshPublicKey, ::Hash]
|
495
|
+
# Optional. The SSH public key and expiration time.
|
496
|
+
# @param project_id [::String]
|
497
|
+
# The project ID of the Google Cloud Platform project.
|
498
|
+
#
|
499
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
500
|
+
# @yieldparam response [::Google::Cloud::OsLogin::V1::ImportSshPublicKeyResponse]
|
501
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
502
|
+
#
|
503
|
+
# @return [::Google::Cloud::OsLogin::V1::ImportSshPublicKeyResponse]
|
504
|
+
#
|
505
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
506
|
+
#
|
507
|
+
def import_ssh_public_key request, options = nil
|
508
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
509
|
+
|
510
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsLogin::V1::ImportSshPublicKeyRequest
|
511
|
+
|
512
|
+
# Converts hash and nil to an options object
|
513
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
514
|
+
|
515
|
+
# Customize the options with defaults
|
516
|
+
metadata = @config.rpcs.import_ssh_public_key.metadata.to_h
|
517
|
+
|
518
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
519
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
520
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
521
|
+
gapic_version: ::Google::Cloud::OsLogin::V1::VERSION
|
522
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
523
|
+
|
524
|
+
header_params = {
|
525
|
+
"parent" => request.parent
|
526
|
+
}
|
527
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
528
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
529
|
+
|
530
|
+
options.apply_defaults timeout: @config.rpcs.import_ssh_public_key.timeout,
|
531
|
+
metadata: metadata,
|
532
|
+
retry_policy: @config.rpcs.import_ssh_public_key.retry_policy
|
533
|
+
options.apply_defaults metadata: @config.metadata,
|
534
|
+
retry_policy: @config.retry_policy
|
535
|
+
|
536
|
+
@os_login_service_stub.call_rpc :import_ssh_public_key, request, options: options do |response, operation|
|
537
|
+
yield response, operation if block_given?
|
538
|
+
return response
|
539
|
+
end
|
540
|
+
rescue ::GRPC::BadStatus => e
|
541
|
+
raise ::Google::Cloud::Error.from_error(e)
|
542
|
+
end
|
543
|
+
|
544
|
+
##
|
545
|
+
# Updates an SSH public key and returns the profile information. This method
|
546
|
+
# supports patch semantics.
|
547
|
+
#
|
548
|
+
# @overload update_ssh_public_key(request, options = nil)
|
549
|
+
# Pass arguments to `update_ssh_public_key` via a request object, either of type
|
550
|
+
# {::Google::Cloud::OsLogin::V1::UpdateSshPublicKeyRequest} or an equivalent Hash.
|
551
|
+
#
|
552
|
+
# @param request [::Google::Cloud::OsLogin::V1::UpdateSshPublicKeyRequest, ::Hash]
|
553
|
+
# A request object representing the call parameters. Required. To specify no
|
554
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
555
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
556
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
557
|
+
#
|
558
|
+
# @overload update_ssh_public_key(name: nil, ssh_public_key: nil, update_mask: nil)
|
559
|
+
# Pass arguments to `update_ssh_public_key` via keyword arguments. Note that at
|
560
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
561
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
562
|
+
#
|
563
|
+
# @param name [::String]
|
564
|
+
# Required. The fingerprint of the public key to update. Public keys are identified by
|
565
|
+
# their SHA-256 fingerprint. The fingerprint of the public key is in format
|
566
|
+
# `users/{user}/sshPublicKeys/{fingerprint}`.
|
567
|
+
# @param ssh_public_key [::Google::Cloud::OsLogin::Common::SshPublicKey, ::Hash]
|
568
|
+
# Required. The SSH public key and expiration time.
|
569
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
570
|
+
# Mask to control which fields get updated. Updates all if not present.
|
571
|
+
#
|
572
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
573
|
+
# @yieldparam response [::Google::Cloud::OsLogin::Common::SshPublicKey]
|
574
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
575
|
+
#
|
576
|
+
# @return [::Google::Cloud::OsLogin::Common::SshPublicKey]
|
577
|
+
#
|
578
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
579
|
+
#
|
580
|
+
def update_ssh_public_key request, options = nil
|
581
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
582
|
+
|
583
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsLogin::V1::UpdateSshPublicKeyRequest
|
584
|
+
|
585
|
+
# Converts hash and nil to an options object
|
586
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
587
|
+
|
588
|
+
# Customize the options with defaults
|
589
|
+
metadata = @config.rpcs.update_ssh_public_key.metadata.to_h
|
590
|
+
|
591
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
592
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
593
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
594
|
+
gapic_version: ::Google::Cloud::OsLogin::V1::VERSION
|
595
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
596
|
+
|
597
|
+
header_params = {
|
598
|
+
"name" => request.name
|
599
|
+
}
|
600
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
601
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
602
|
+
|
603
|
+
options.apply_defaults timeout: @config.rpcs.update_ssh_public_key.timeout,
|
604
|
+
metadata: metadata,
|
605
|
+
retry_policy: @config.rpcs.update_ssh_public_key.retry_policy
|
606
|
+
options.apply_defaults metadata: @config.metadata,
|
607
|
+
retry_policy: @config.retry_policy
|
608
|
+
|
609
|
+
@os_login_service_stub.call_rpc :update_ssh_public_key, request, options: options do |response, operation|
|
610
|
+
yield response, operation if block_given?
|
611
|
+
return response
|
612
|
+
end
|
613
|
+
rescue ::GRPC::BadStatus => e
|
614
|
+
raise ::Google::Cloud::Error.from_error(e)
|
615
|
+
end
|
616
|
+
|
617
|
+
##
|
618
|
+
# Configuration class for the OsLoginService API.
|
619
|
+
#
|
620
|
+
# This class represents the configuration for OsLoginService,
|
621
|
+
# providing control over timeouts, retry behavior, logging, transport
|
622
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
623
|
+
# applied individually to specific RPCs. See
|
624
|
+
# {::Google::Cloud::OsLogin::V1::OsLoginService::Client::Configuration::Rpcs}
|
625
|
+
# for a list of RPCs that can be configured independently.
|
626
|
+
#
|
627
|
+
# Configuration can be applied globally to all clients, or to a single client
|
628
|
+
# on construction.
|
629
|
+
#
|
630
|
+
# # Examples
|
631
|
+
#
|
632
|
+
# To modify the global config, setting the timeout for delete_posix_account
|
633
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
634
|
+
#
|
635
|
+
# ::Google::Cloud::OsLogin::V1::OsLoginService::Client.configure do |config|
|
636
|
+
# config.timeout = 10.0
|
637
|
+
# config.rpcs.delete_posix_account.timeout = 20.0
|
638
|
+
# end
|
639
|
+
#
|
640
|
+
# To apply the above configuration only to a new client:
|
641
|
+
#
|
642
|
+
# client = ::Google::Cloud::OsLogin::V1::OsLoginService::Client.new do |config|
|
643
|
+
# config.timeout = 10.0
|
644
|
+
# config.rpcs.delete_posix_account.timeout = 20.0
|
645
|
+
# end
|
646
|
+
#
|
647
|
+
# @!attribute [rw] endpoint
|
648
|
+
# The hostname or hostname:port of the service endpoint.
|
649
|
+
# Defaults to `"oslogin.googleapis.com"`.
|
650
|
+
# @return [::String]
|
651
|
+
# @!attribute [rw] credentials
|
652
|
+
# Credentials to send with calls. You may provide any of the following types:
|
653
|
+
# * (`String`) The path to a service account key file in JSON format
|
654
|
+
# * (`Hash`) A service account key as a Hash
|
655
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
656
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
657
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
658
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
659
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
660
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
661
|
+
# * (`nil`) indicating no credentials
|
662
|
+
# @return [::Object]
|
663
|
+
# @!attribute [rw] scope
|
664
|
+
# The OAuth scopes
|
665
|
+
# @return [::Array<::String>]
|
666
|
+
# @!attribute [rw] lib_name
|
667
|
+
# The library name as recorded in instrumentation and logging
|
668
|
+
# @return [::String]
|
669
|
+
# @!attribute [rw] lib_version
|
670
|
+
# The library version as recorded in instrumentation and logging
|
671
|
+
# @return [::String]
|
672
|
+
# @!attribute [rw] channel_args
|
673
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
674
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
675
|
+
# @return [::Hash]
|
676
|
+
# @!attribute [rw] interceptors
|
677
|
+
# An array of interceptors that are run before calls are executed.
|
678
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
679
|
+
# @!attribute [rw] timeout
|
680
|
+
# The call timeout in seconds.
|
681
|
+
# @return [::Numeric]
|
682
|
+
# @!attribute [rw] metadata
|
683
|
+
# Additional gRPC headers to be sent with the call.
|
684
|
+
# @return [::Hash{::Symbol=>::String}]
|
685
|
+
# @!attribute [rw] retry_policy
|
686
|
+
# The retry policy. The value is a hash with the following keys:
|
687
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
688
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
689
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
690
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
691
|
+
# trigger a retry.
|
692
|
+
# @return [::Hash]
|
693
|
+
#
|
694
|
+
class Configuration
|
695
|
+
extend ::Gapic::Config
|
696
|
+
|
697
|
+
config_attr :endpoint, "oslogin.googleapis.com", String
|
698
|
+
config_attr :credentials, nil do |value|
|
699
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
700
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
701
|
+
allowed.any? { |klass| klass === value }
|
702
|
+
end
|
703
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
704
|
+
config_attr :lib_name, nil, ::String, nil
|
705
|
+
config_attr :lib_version, nil, ::String, nil
|
706
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
707
|
+
config_attr :interceptors, nil, ::Array, nil
|
708
|
+
config_attr :timeout, nil, ::Numeric, nil
|
709
|
+
config_attr :metadata, nil, ::Hash, nil
|
710
|
+
config_attr :retry_policy, nil, ::Hash, Proc, nil
|
711
|
+
|
712
|
+
# @private
|
713
|
+
def initialize parent_config = nil
|
714
|
+
@parent_config = parent_config unless parent_config.nil?
|
715
|
+
|
716
|
+
yield self if block_given?
|
717
|
+
end
|
718
|
+
|
719
|
+
##
|
720
|
+
# Configurations for individual RPCs
|
721
|
+
# @return [Rpcs]
|
722
|
+
#
|
723
|
+
def rpcs
|
724
|
+
@rpcs ||= begin
|
725
|
+
parent_rpcs = nil
|
726
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
727
|
+
Rpcs.new parent_rpcs
|
728
|
+
end
|
729
|
+
end
|
730
|
+
|
731
|
+
##
|
732
|
+
# Configuration RPC class for the OsLoginService API.
|
733
|
+
#
|
734
|
+
# Includes fields providing the configuration for each RPC in this service.
|
735
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
736
|
+
# the following configuration fields:
|
737
|
+
#
|
738
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
739
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
740
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
741
|
+
# include the following keys:
|
742
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
743
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
744
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
745
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
746
|
+
# trigger a retry.
|
747
|
+
#
|
748
|
+
class Rpcs
|
749
|
+
##
|
750
|
+
# RPC-specific configuration for `delete_posix_account`
|
751
|
+
# @return [::Gapic::Config::Method]
|
752
|
+
#
|
753
|
+
attr_reader :delete_posix_account
|
754
|
+
##
|
755
|
+
# RPC-specific configuration for `delete_ssh_public_key`
|
756
|
+
# @return [::Gapic::Config::Method]
|
757
|
+
#
|
758
|
+
attr_reader :delete_ssh_public_key
|
759
|
+
##
|
760
|
+
# RPC-specific configuration for `get_login_profile`
|
761
|
+
# @return [::Gapic::Config::Method]
|
762
|
+
#
|
763
|
+
attr_reader :get_login_profile
|
764
|
+
##
|
765
|
+
# RPC-specific configuration for `get_ssh_public_key`
|
766
|
+
# @return [::Gapic::Config::Method]
|
767
|
+
#
|
768
|
+
attr_reader :get_ssh_public_key
|
769
|
+
##
|
770
|
+
# RPC-specific configuration for `import_ssh_public_key`
|
771
|
+
# @return [::Gapic::Config::Method]
|
772
|
+
#
|
773
|
+
attr_reader :import_ssh_public_key
|
774
|
+
##
|
775
|
+
# RPC-specific configuration for `update_ssh_public_key`
|
776
|
+
# @return [::Gapic::Config::Method]
|
777
|
+
#
|
778
|
+
attr_reader :update_ssh_public_key
|
779
|
+
|
780
|
+
# @private
|
781
|
+
def initialize parent_rpcs = nil
|
782
|
+
delete_posix_account_config = parent_rpcs&.delete_posix_account if parent_rpcs&.respond_to? :delete_posix_account
|
783
|
+
@delete_posix_account = ::Gapic::Config::Method.new delete_posix_account_config
|
784
|
+
delete_ssh_public_key_config = parent_rpcs&.delete_ssh_public_key if parent_rpcs&.respond_to? :delete_ssh_public_key
|
785
|
+
@delete_ssh_public_key = ::Gapic::Config::Method.new delete_ssh_public_key_config
|
786
|
+
get_login_profile_config = parent_rpcs&.get_login_profile if parent_rpcs&.respond_to? :get_login_profile
|
787
|
+
@get_login_profile = ::Gapic::Config::Method.new get_login_profile_config
|
788
|
+
get_ssh_public_key_config = parent_rpcs&.get_ssh_public_key if parent_rpcs&.respond_to? :get_ssh_public_key
|
789
|
+
@get_ssh_public_key = ::Gapic::Config::Method.new get_ssh_public_key_config
|
790
|
+
import_ssh_public_key_config = parent_rpcs&.import_ssh_public_key if parent_rpcs&.respond_to? :import_ssh_public_key
|
791
|
+
@import_ssh_public_key = ::Gapic::Config::Method.new import_ssh_public_key_config
|
792
|
+
update_ssh_public_key_config = parent_rpcs&.update_ssh_public_key if parent_rpcs&.respond_to? :update_ssh_public_key
|
793
|
+
@update_ssh_public_key = ::Gapic::Config::Method.new update_ssh_public_key_config
|
794
|
+
|
795
|
+
yield self if block_given?
|
796
|
+
end
|
797
|
+
end
|
798
|
+
end
|
799
|
+
end
|
800
|
+
end
|
801
|
+
end
|
802
|
+
end
|
803
|
+
end
|
804
|
+
end
|