google-cloud-os_login-v1 0.5.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95c9a8886cf78b0627b5b23e6e50096465085723d0b9955ca71d8661d9c4cc99
4
- data.tar.gz: 9a4280c321cb9b01dc44535f30e4527b07d1380b76839859c0b92d83b76315b4
3
+ metadata.gz: e4c709002d1b400fba3a1c212af14736200d8d09e07e25f0add825e5c5802a68
4
+ data.tar.gz: 9eeeeee9acc498e7b00abfca8ea376b974cf9a513c02f97049557f2a1d5f28a8
5
5
  SHA512:
6
- metadata.gz: 022b9962038ac1f2a0192fe67dc1fd4ad26d34620ecc75f3ebd03a4b7980cbecf9ed28ffa9d8d87c2895767d056b14ef3f42072b1570bd0e84fca100a7e61a94
7
- data.tar.gz: c262a3bb073ca57b5b0e1a65e6356ad3f2ec7c5858a9d83f52e2ea4189c7560b352d97f0b16ad22fbf513aaadd5121d1ee8d98a3d6a4f39b8a66cb367bd7d28d
6
+ metadata.gz: 6c74bca4bd419523a4a44f39bb76cb9a33f8c4dd5239d081a15237627448466c58274e62e429ee5cc134e71a4e83d478057529a87841ef99557acaa71e9e041a
7
+ data.tar.gz: 2913d6f6441c969cf2a6e48189b421cf9e4ba1c9e588f9c19bc78a00828db7f11bde22043e0b863b5491ddfa67470085dfa4285b548aace9c3b2b693bbc48d51
data/AUTHENTICATION.md CHANGED
@@ -114,7 +114,7 @@ credentials are discovered.
114
114
  To configure your system for this, simply:
115
115
 
116
116
  1. [Download and install the Cloud SDK](https://cloud.google.com/sdk)
117
- 2. Authenticate using OAuth 2.0 `$ gcloud auth login`
117
+ 2. Authenticate using OAuth 2.0 `$ gcloud auth application-default login`
118
118
  3. Write code as if already authenticated.
119
119
 
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Ruby Client for the Cloud OS Login V1 API
2
2
 
3
- API Client library for the Cloud OS Login V1 API
3
+ You can use OS Login to manage access to your VM instances using IAM roles.
4
4
 
5
5
  Use OS Login to manage SSH access to your instances using IAM without having to create and manage individual SSH keys. OS Login maintains a consistent Linux user identity across VM instances and is the recommended way to manage many users across multiple instances or projects.
6
6
 
@@ -33,8 +33,8 @@ In order to use this library, you first need to go through the following steps:
33
33
  require "google/cloud/os_login/v1"
34
34
 
35
35
  client = ::Google::Cloud::OsLogin::V1::OsLoginService::Client.new
36
- request = ::Google::Cloud::OsLogin::V1::DeletePosixAccountRequest.new # (request fields as keyword arguments...)
37
- response = client.delete_posix_account request
36
+ request = ::Google::Cloud::OsLogin::V1::CreateSshPublicKeyRequest.new # (request fields as keyword arguments...)
37
+ response = client.create_ssh_public_key request
38
38
  ```
39
39
 
40
40
  View the [Client Library Documentation](https://cloud.google.com/ruby/docs/reference/google-cloud-os_login-v1/latest)
@@ -46,7 +46,7 @@ for general usage information.
46
46
  ## Enabling Logging
47
47
 
48
48
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
49
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
50
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
51
51
  that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
52
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
@@ -177,6 +177,93 @@ module Google
177
177
 
178
178
  # Service calls
179
179
 
180
+ ##
181
+ # Create an SSH public key
182
+ #
183
+ # @overload create_ssh_public_key(request, options = nil)
184
+ # Pass arguments to `create_ssh_public_key` via a request object, either of type
185
+ # {::Google::Cloud::OsLogin::V1::CreateSshPublicKeyRequest} or an equivalent Hash.
186
+ #
187
+ # @param request [::Google::Cloud::OsLogin::V1::CreateSshPublicKeyRequest, ::Hash]
188
+ # A request object representing the call parameters. Required. To specify no
189
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
190
+ # @param options [::Gapic::CallOptions, ::Hash]
191
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
192
+ #
193
+ # @overload create_ssh_public_key(parent: nil, ssh_public_key: nil)
194
+ # Pass arguments to `create_ssh_public_key` via keyword arguments. Note that at
195
+ # least one keyword argument is required. To specify no parameters, or to keep all
196
+ # the default parameter values, pass an empty Hash as a request object (see above).
197
+ #
198
+ # @param parent [::String]
199
+ # Required. The unique ID for the user in format `users/{user}`.
200
+ # @param ssh_public_key [::Google::Cloud::OsLogin::Common::SshPublicKey, ::Hash]
201
+ # Required. The SSH public key and expiration time.
202
+ #
203
+ # @yield [response, operation] Access the result along with the RPC operation
204
+ # @yieldparam response [::Google::Cloud::OsLogin::Common::SshPublicKey]
205
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
206
+ #
207
+ # @return [::Google::Cloud::OsLogin::Common::SshPublicKey]
208
+ #
209
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
210
+ #
211
+ # @example Basic example
212
+ # require "google/cloud/os_login/v1"
213
+ #
214
+ # # Create a client object. The client can be reused for multiple calls.
215
+ # client = Google::Cloud::OsLogin::V1::OsLoginService::Client.new
216
+ #
217
+ # # Create a request. To set request fields, pass in keyword arguments.
218
+ # request = Google::Cloud::OsLogin::V1::CreateSshPublicKeyRequest.new
219
+ #
220
+ # # Call the create_ssh_public_key method.
221
+ # result = client.create_ssh_public_key request
222
+ #
223
+ # # The returned object is of type Google::Cloud::OsLogin::Common::SshPublicKey.
224
+ # p result
225
+ #
226
+ def create_ssh_public_key request, options = nil
227
+ raise ::ArgumentError, "request must be provided" if request.nil?
228
+
229
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OsLogin::V1::CreateSshPublicKeyRequest
230
+
231
+ # Converts hash and nil to an options object
232
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
233
+
234
+ # Customize the options with defaults
235
+ metadata = @config.rpcs.create_ssh_public_key.metadata.to_h
236
+
237
+ # Set x-goog-api-client and x-goog-user-project headers
238
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
239
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
240
+ gapic_version: ::Google::Cloud::OsLogin::V1::VERSION
241
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
242
+
243
+ header_params = {}
244
+ if request.parent
245
+ header_params["parent"] = request.parent
246
+ end
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.create_ssh_public_key.timeout,
252
+ metadata: metadata,
253
+ retry_policy: @config.rpcs.create_ssh_public_key.retry_policy
254
+
255
+ options.apply_defaults timeout: @config.timeout,
256
+ metadata: @config.metadata,
257
+ retry_policy: @config.retry_policy
258
+
259
+ @os_login_service_stub.call_rpc :create_ssh_public_key, request, options: options do |response, operation|
260
+ yield response, operation if block_given?
261
+ return response
262
+ end
263
+ rescue ::GRPC::BadStatus => e
264
+ raise ::Google::Cloud::Error.from_error(e)
265
+ end
266
+
180
267
  ##
181
268
  # Deletes a POSIX account.
182
269
  #
@@ -196,9 +283,9 @@ module Google
196
283
  # the default parameter values, pass an empty Hash as a request object (see above).
197
284
  #
198
285
  # @param name [::String]
199
- # Required. A reference to the POSIX account to update. POSIX accounts are identified
200
- # by the project ID they are associated with. A reference to the POSIX
201
- # account is in format `users/{user}/projects/{project}`.
286
+ # Required. A reference to the POSIX account to update. POSIX accounts are
287
+ # identified by the project ID they are associated with. A reference to the
288
+ # POSIX account is in format `users/{user}/projects/{project}`.
202
289
  #
203
290
  # @yield [response, operation] Access the result along with the RPC operation
204
291
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -283,9 +370,9 @@ module Google
283
370
  # the default parameter values, pass an empty Hash as a request object (see above).
284
371
  #
285
372
  # @param name [::String]
286
- # Required. The fingerprint of the public key to update. Public keys are identified by
287
- # their SHA-256 fingerprint. The fingerprint of the public key is in format
288
- # `users/{user}/sshPublicKeys/{fingerprint}`.
373
+ # Required. The fingerprint of the public key to update. Public keys are
374
+ # identified by their SHA-256 fingerprint. The fingerprint of the public key
375
+ # is in format `users/{user}/sshPublicKeys/{fingerprint}`.
289
376
  #
290
377
  # @yield [response, operation] Access the result along with the RPC operation
291
378
  # @yieldparam response [::Google::Protobuf::Empty]
@@ -460,9 +547,9 @@ module Google
460
547
  # the default parameter values, pass an empty Hash as a request object (see above).
461
548
  #
462
549
  # @param name [::String]
463
- # Required. The fingerprint of the public key to retrieve. Public keys are identified
464
- # by their SHA-256 fingerprint. The fingerprint of the public key is in
465
- # format `users/{user}/sshPublicKeys/{fingerprint}`.
550
+ # Required. The fingerprint of the public key to retrieve. Public keys are
551
+ # identified by their SHA-256 fingerprint. The fingerprint of the public key
552
+ # is in format `users/{user}/sshPublicKeys/{fingerprint}`.
466
553
  #
467
554
  # @yield [response, operation] Access the result along with the RPC operation
468
555
  # @yieldparam response [::Google::Cloud::OsLogin::Common::SshPublicKey]
@@ -639,9 +726,9 @@ module Google
639
726
  # the default parameter values, pass an empty Hash as a request object (see above).
640
727
  #
641
728
  # @param name [::String]
642
- # Required. The fingerprint of the public key to update. Public keys are identified by
643
- # their SHA-256 fingerprint. The fingerprint of the public key is in format
644
- # `users/{user}/sshPublicKeys/{fingerprint}`.
729
+ # Required. The fingerprint of the public key to update. Public keys are
730
+ # identified by their SHA-256 fingerprint. The fingerprint of the public key
731
+ # is in format `users/{user}/sshPublicKeys/{fingerprint}`.
645
732
  # @param ssh_public_key [::Google::Cloud::OsLogin::Common::SshPublicKey, ::Hash]
646
733
  # Required. The SSH public key and expiration time.
647
734
  # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
@@ -727,17 +814,17 @@ module Google
727
814
  # @example
728
815
  #
729
816
  # # Modify the global config, setting the timeout for
730
- # # delete_posix_account to 20 seconds,
817
+ # # create_ssh_public_key to 20 seconds,
731
818
  # # and all remaining timeouts to 10 seconds.
732
819
  # ::Google::Cloud::OsLogin::V1::OsLoginService::Client.configure do |config|
733
820
  # config.timeout = 10.0
734
- # config.rpcs.delete_posix_account.timeout = 20.0
821
+ # config.rpcs.create_ssh_public_key.timeout = 20.0
735
822
  # end
736
823
  #
737
824
  # # Apply the above configuration only to a new client.
738
825
  # client = ::Google::Cloud::OsLogin::V1::OsLoginService::Client.new do |config|
739
826
  # config.timeout = 10.0
740
- # config.rpcs.delete_posix_account.timeout = 20.0
827
+ # config.rpcs.create_ssh_public_key.timeout = 20.0
741
828
  # end
742
829
  #
743
830
  # @!attribute [rw] endpoint
@@ -846,6 +933,11 @@ module Google
846
933
  # trigger a retry.
847
934
  #
848
935
  class Rpcs
936
+ ##
937
+ # RPC-specific configuration for `create_ssh_public_key`
938
+ # @return [::Gapic::Config::Method]
939
+ #
940
+ attr_reader :create_ssh_public_key
849
941
  ##
850
942
  # RPC-specific configuration for `delete_posix_account`
851
943
  # @return [::Gapic::Config::Method]
@@ -879,6 +971,8 @@ module Google
879
971
 
880
972
  # @private
881
973
  def initialize parent_rpcs = nil
974
+ create_ssh_public_key_config = parent_rpcs.create_ssh_public_key if parent_rpcs.respond_to? :create_ssh_public_key
975
+ @create_ssh_public_key = ::Gapic::Config::Method.new create_ssh_public_key_config
882
976
  delete_posix_account_config = parent_rpcs.delete_posix_account if parent_rpcs.respond_to? :delete_posix_account
883
977
  @delete_posix_account = ::Gapic::Config::Method.new delete_posix_account_config
884
978
  delete_ssh_public_key_config = parent_rpcs.delete_ssh_public_key if parent_rpcs.respond_to? :delete_ssh_public_key
@@ -27,7 +27,9 @@ module Google
27
27
  class Credentials < ::Google::Auth::Credentials
28
28
  self.scope = [
29
29
  "https://www.googleapis.com/auth/cloud-platform",
30
- "https://www.googleapis.com/auth/compute"
30
+ "https://www.googleapis.com/auth/cloud-platform.read-only",
31
+ "https://www.googleapis.com/auth/compute",
32
+ "https://www.googleapis.com/auth/compute.readonly"
31
33
  ]
32
34
  self.env_vars = [
33
35
  "OS_LOGIN_CREDENTIALS",