google-cloud-os_login 0.7.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -54
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +323 -0
  6. data/README.md +36 -24
  7. data/lib/{google/cloud/os_login/v1/doc/google/protobuf/empty.rb → google-cloud-os_login.rb} +4 -14
  8. data/lib/google/cloud/os_login.rb +88 -117
  9. data/lib/google/cloud/os_login/version.rb +6 -2
  10. metadata +74 -61
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/os_login/v1.rb +0 -148
  13. data/lib/google/cloud/os_login/v1/credentials.rb +0 -42
  14. data/lib/google/cloud/os_login/v1/doc/google/cloud/oslogin/common/common.rb +0 -89
  15. data/lib/google/cloud/os_login/v1/doc/google/cloud/oslogin/v1/oslogin.rb +0 -103
  16. data/lib/google/cloud/os_login/v1/doc/google/protobuf/field_mask.rb +0 -222
  17. data/lib/google/cloud/os_login/v1/os_login_service_client.rb +0 -506
  18. data/lib/google/cloud/os_login/v1/os_login_service_client_config.json +0 -56
  19. data/lib/google/cloud/os_login/v1beta.rb +0 -148
  20. data/lib/google/cloud/os_login/v1beta/credentials.rb +0 -44
  21. data/lib/google/cloud/os_login/v1beta/doc/google/cloud/oslogin/common.rb +0 -67
  22. data/lib/google/cloud/os_login/v1beta/doc/google/cloud/oslogin/common/common.rb +0 -89
  23. data/lib/google/cloud/os_login/v1beta/doc/google/cloud/oslogin/v1beta/oslogin.rb +0 -103
  24. data/lib/google/cloud/os_login/v1beta/doc/google/protobuf/empty.rb +0 -29
  25. data/lib/google/cloud/os_login/v1beta/doc/google/protobuf/field_mask.rb +0 -222
  26. data/lib/google/cloud/os_login/v1beta/os_login_service_client.rb +0 -511
  27. data/lib/google/cloud/os_login/v1beta/os_login_service_client_config.json +0 -56
  28. data/lib/google/cloud/oslogin/common/common_pb.rb +0 -40
  29. data/lib/google/cloud/oslogin/v1/oslogin_pb.rb +0 -65
  30. data/lib/google/cloud/oslogin/v1/oslogin_services_pb.rb +0 -65
  31. data/lib/google/cloud/oslogin/v1beta/oslogin_pb.rb +0 -65
  32. data/lib/google/cloud/oslogin/v1beta/oslogin_services_pb.rb +0 -65
@@ -1,103 +0,0 @@
1
- # Copyright 2020 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
-
16
- module Google
17
- module Cloud
18
- module OsLogin
19
- module V1
20
- # The user profile information used for logging in to a virtual machine on
21
- # Google Compute Engine.
22
- # @!attribute [rw] name
23
- # @return [String]
24
- # Required. A unique user ID.
25
- # @!attribute [rw] posix_accounts
26
- # @return [Array<Google::Cloud::OsLogin::Common::PosixAccount>]
27
- # The list of POSIX accounts associated with the user.
28
- # @!attribute [rw] ssh_public_keys
29
- # @return [Hash{String => Google::Cloud::OsLogin::Common::SshPublicKey}]
30
- # A map from SSH public key fingerprint to the associated key object.
31
- class LoginProfile; end
32
-
33
- # A request message for deleting a POSIX account entry.
34
- # @!attribute [rw] name
35
- # @return [String]
36
- # Required. A reference to the POSIX account to update. POSIX accounts are identified
37
- # by the project ID they are associated with. A reference to the POSIX
38
- # account is in format `users/{user}/projects/{project}`.
39
- class DeletePosixAccountRequest; end
40
-
41
- # A request message for deleting an SSH public key.
42
- # @!attribute [rw] name
43
- # @return [String]
44
- # Required. The fingerprint of the public key to update. Public keys are identified by
45
- # their SHA-256 fingerprint. The fingerprint of the public key is in format
46
- # `users/{user}/sshPublicKeys/{fingerprint}`.
47
- class DeleteSshPublicKeyRequest; end
48
-
49
- # A request message for retrieving the login profile information for a user.
50
- # @!attribute [rw] name
51
- # @return [String]
52
- # Required. The unique ID for the user in format `users/{user}`.
53
- # @!attribute [rw] project_id
54
- # @return [String]
55
- # The project ID of the Google Cloud Platform project.
56
- # @!attribute [rw] system_id
57
- # @return [String]
58
- # A system ID for filtering the results of the request.
59
- class GetLoginProfileRequest; end
60
-
61
- # A request message for retrieving an SSH public key.
62
- # @!attribute [rw] name
63
- # @return [String]
64
- # Required. The fingerprint of the public key to retrieve. Public keys are identified
65
- # by their SHA-256 fingerprint. The fingerprint of the public key is in
66
- # format `users/{user}/sshPublicKeys/{fingerprint}`.
67
- class GetSshPublicKeyRequest; end
68
-
69
- # A request message for importing an SSH public key.
70
- # @!attribute [rw] parent
71
- # @return [String]
72
- # Required. The unique ID for the user in format `users/{user}`.
73
- # @!attribute [rw] ssh_public_key
74
- # @return [Google::Cloud::OsLogin::Common::SshPublicKey]
75
- # Optional. The SSH public key and expiration time.
76
- # @!attribute [rw] project_id
77
- # @return [String]
78
- # The project ID of the Google Cloud Platform project.
79
- class ImportSshPublicKeyRequest; end
80
-
81
- # A response message for importing an SSH public key.
82
- # @!attribute [rw] login_profile
83
- # @return [Google::Cloud::OsLogin::V1::LoginProfile]
84
- # The login profile information for the user.
85
- class ImportSshPublicKeyResponse; end
86
-
87
- # A request message for updating an SSH public key.
88
- # @!attribute [rw] name
89
- # @return [String]
90
- # Required. The fingerprint of the public key to update. Public keys are identified by
91
- # their SHA-256 fingerprint. The fingerprint of the public key is in format
92
- # `users/{user}/sshPublicKeys/{fingerprint}`.
93
- # @!attribute [rw] ssh_public_key
94
- # @return [Google::Cloud::OsLogin::Common::SshPublicKey]
95
- # Required. The SSH public key and expiration time.
96
- # @!attribute [rw] update_mask
97
- # @return [Google::Protobuf::FieldMask]
98
- # Mask to control which fields get updated. Updates all if not present.
99
- class UpdateSshPublicKeyRequest; end
100
- end
101
- end
102
- end
103
- end
@@ -1,222 +0,0 @@
1
- # Copyright 2020 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
-
16
- module Google
17
- module Protobuf
18
- # `FieldMask` represents a set of symbolic field paths, for example:
19
- #
20
- # paths: "f.a"
21
- # paths: "f.b.d"
22
- #
23
- # Here `f` represents a field in some root message, `a` and `b`
24
- # fields in the message found in `f`, and `d` a field found in the
25
- # message in `f.b`.
26
- #
27
- # Field masks are used to specify a subset of fields that should be
28
- # returned by a get operation or modified by an update operation.
29
- # Field masks also have a custom JSON encoding (see below).
30
- #
31
- # = Field Masks in Projections
32
- #
33
- # When used in the context of a projection, a response message or
34
- # sub-message is filtered by the API to only contain those fields as
35
- # specified in the mask. For example, if the mask in the previous
36
- # example is applied to a response message as follows:
37
- #
38
- # f {
39
- # a : 22
40
- # b {
41
- # d : 1
42
- # x : 2
43
- # }
44
- # y : 13
45
- # }
46
- # z: 8
47
- #
48
- # The result will not contain specific values for fields x,y and z
49
- # (their value will be set to the default, and omitted in proto text
50
- # output):
51
- #
52
- #
53
- # f {
54
- # a : 22
55
- # b {
56
- # d : 1
57
- # }
58
- # }
59
- #
60
- # A repeated field is not allowed except at the last position of a
61
- # paths string.
62
- #
63
- # If a FieldMask object is not present in a get operation, the
64
- # operation applies to all fields (as if a FieldMask of all fields
65
- # had been specified).
66
- #
67
- # Note that a field mask does not necessarily apply to the
68
- # top-level response message. In case of a REST get operation, the
69
- # field mask applies directly to the response, but in case of a REST
70
- # list operation, the mask instead applies to each individual message
71
- # in the returned resource list. In case of a REST custom method,
72
- # other definitions may be used. Where the mask applies will be
73
- # clearly documented together with its declaration in the API. In
74
- # any case, the effect on the returned resource/resources is required
75
- # behavior for APIs.
76
- #
77
- # = Field Masks in Update Operations
78
- #
79
- # A field mask in update operations specifies which fields of the
80
- # targeted resource are going to be updated. The API is required
81
- # to only change the values of the fields as specified in the mask
82
- # and leave the others untouched. If a resource is passed in to
83
- # describe the updated values, the API ignores the values of all
84
- # fields not covered by the mask.
85
- #
86
- # If a repeated field is specified for an update operation, new values will
87
- # be appended to the existing repeated field in the target resource. Note that
88
- # a repeated field is only allowed in the last position of a `paths` string.
89
- #
90
- # If a sub-message is specified in the last position of the field mask for an
91
- # update operation, then new value will be merged into the existing sub-message
92
- # in the target resource.
93
- #
94
- # For example, given the target message:
95
- #
96
- # f {
97
- # b {
98
- # d: 1
99
- # x: 2
100
- # }
101
- # c: [1]
102
- # }
103
- #
104
- # And an update message:
105
- #
106
- # f {
107
- # b {
108
- # d: 10
109
- # }
110
- # c: [2]
111
- # }
112
- #
113
- # then if the field mask is:
114
- #
115
- # paths: ["f.b", "f.c"]
116
- #
117
- # then the result will be:
118
- #
119
- # f {
120
- # b {
121
- # d: 10
122
- # x: 2
123
- # }
124
- # c: [1, 2]
125
- # }
126
- #
127
- # An implementation may provide options to override this default behavior for
128
- # repeated and message fields.
129
- #
130
- # In order to reset a field's value to the default, the field must
131
- # be in the mask and set to the default value in the provided resource.
132
- # Hence, in order to reset all fields of a resource, provide a default
133
- # instance of the resource and set all fields in the mask, or do
134
- # not provide a mask as described below.
135
- #
136
- # If a field mask is not present on update, the operation applies to
137
- # all fields (as if a field mask of all fields has been specified).
138
- # Note that in the presence of schema evolution, this may mean that
139
- # fields the client does not know and has therefore not filled into
140
- # the request will be reset to their default. If this is unwanted
141
- # behavior, a specific service may require a client to always specify
142
- # a field mask, producing an error if not.
143
- #
144
- # As with get operations, the location of the resource which
145
- # describes the updated values in the request message depends on the
146
- # operation kind. In any case, the effect of the field mask is
147
- # required to be honored by the API.
148
- #
149
- # == Considerations for HTTP REST
150
- #
151
- # The HTTP kind of an update operation which uses a field mask must
152
- # be set to PATCH instead of PUT in order to satisfy HTTP semantics
153
- # (PUT must only be used for full updates).
154
- #
155
- # = JSON Encoding of Field Masks
156
- #
157
- # In JSON, a field mask is encoded as a single string where paths are
158
- # separated by a comma. Fields name in each path are converted
159
- # to/from lower-camel naming conventions.
160
- #
161
- # As an example, consider the following message declarations:
162
- #
163
- # message Profile {
164
- # User user = 1;
165
- # Photo photo = 2;
166
- # }
167
- # message User {
168
- # string display_name = 1;
169
- # string address = 2;
170
- # }
171
- #
172
- # In proto a field mask for `Profile` may look as such:
173
- #
174
- # mask {
175
- # paths: "user.display_name"
176
- # paths: "photo"
177
- # }
178
- #
179
- # In JSON, the same mask is represented as below:
180
- #
181
- # {
182
- # mask: "user.displayName,photo"
183
- # }
184
- #
185
- # = Field Masks and Oneof Fields
186
- #
187
- # Field masks treat fields in oneofs just as regular fields. Consider the
188
- # following message:
189
- #
190
- # message SampleMessage {
191
- # oneof test_oneof {
192
- # string name = 4;
193
- # SubMessage sub_message = 9;
194
- # }
195
- # }
196
- #
197
- # The field mask can be:
198
- #
199
- # mask {
200
- # paths: "name"
201
- # }
202
- #
203
- # Or:
204
- #
205
- # mask {
206
- # paths: "sub_message"
207
- # }
208
- #
209
- # Note that oneof type names ("test_oneof" in this case) cannot be used in
210
- # paths.
211
- #
212
- # == Field Mask Verification
213
- #
214
- # The implementation of any API method which has a FieldMask type field in the
215
- # request should verify the included field paths, and return an
216
- # `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
217
- # @!attribute [rw] paths
218
- # @return [Array<String>]
219
- # The set of field mask paths.
220
- class FieldMask; end
221
- end
222
- end
@@ -1,506 +0,0 @@
1
- # Copyright 2020 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
- # EDITING INSTRUCTIONS
16
- # This file was generated from the file
17
- # https://github.com/googleapis/googleapis/blob/master/google/cloud/oslogin/v1/oslogin.proto,
18
- # and updates to that file get reflected here through a refresh process.
19
- # For the short term, the refresh process will only be runnable by Google
20
- # engineers.
21
-
22
-
23
- require "json"
24
- require "pathname"
25
-
26
- require "google/gax"
27
-
28
- require "google/cloud/oslogin/v1/oslogin_pb"
29
- require "google/cloud/os_login/v1/credentials"
30
- require "google/cloud/os_login/version"
31
-
32
- module Google
33
- module Cloud
34
- module OsLogin
35
- module V1
36
- # Cloud OS Login API
37
- #
38
- # The Cloud OS Login API allows you to manage users and their associated SSH
39
- # public keys for logging into virtual machines on Google Cloud Platform.
40
- #
41
- # @!attribute [r] os_login_service_stub
42
- # @return [Google::Cloud::OsLogin::V1::OsLoginService::Stub]
43
- class OsLoginServiceClient
44
- # @private
45
- attr_reader :os_login_service_stub
46
-
47
- # The default address of the service.
48
- SERVICE_ADDRESS = "oslogin.googleapis.com".freeze
49
-
50
- # The default port of the service.
51
- DEFAULT_SERVICE_PORT = 443
52
-
53
- # The default set of gRPC interceptors.
54
- GRPC_INTERCEPTORS = []
55
-
56
- DEFAULT_TIMEOUT = 30
57
-
58
- # The scopes needed to make gRPC calls to all of the methods defined in
59
- # this service.
60
- ALL_SCOPES = [
61
- "https://www.googleapis.com/auth/cloud-platform",
62
- "https://www.googleapis.com/auth/compute"
63
- ].freeze
64
-
65
-
66
- POSIX_ACCOUNT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
67
- "users/{user}/projects/{project}"
68
- )
69
-
70
- private_constant :POSIX_ACCOUNT_PATH_TEMPLATE
71
-
72
- SSH_PUBLIC_KEY_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
73
- "users/{user}/sshPublicKeys/{fingerprint}"
74
- )
75
-
76
- private_constant :SSH_PUBLIC_KEY_PATH_TEMPLATE
77
-
78
- USER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
79
- "users/{user}"
80
- )
81
-
82
- private_constant :USER_PATH_TEMPLATE
83
-
84
- # Returns a fully-qualified posix_account resource name string.
85
- # @param user [String]
86
- # @param project [String]
87
- # @return [String]
88
- def self.posix_account_path user, project
89
- POSIX_ACCOUNT_PATH_TEMPLATE.render(
90
- :"user" => user,
91
- :"project" => project
92
- )
93
- end
94
-
95
- # Returns a fully-qualified ssh_public_key resource name string.
96
- # @param user [String]
97
- # @param fingerprint [String]
98
- # @return [String]
99
- def self.ssh_public_key_path user, fingerprint
100
- SSH_PUBLIC_KEY_PATH_TEMPLATE.render(
101
- :"user" => user,
102
- :"fingerprint" => fingerprint
103
- )
104
- end
105
-
106
- # Returns a fully-qualified user resource name string.
107
- # @param user [String]
108
- # @return [String]
109
- def self.user_path user
110
- USER_PATH_TEMPLATE.render(
111
- :"user" => user
112
- )
113
- end
114
-
115
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
116
- # Provides the means for authenticating requests made by the client. This parameter can
117
- # be many types.
118
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
119
- # authenticating requests made by this client.
120
- # A `String` will be treated as the path to the keyfile to be used for the construction of
121
- # credentials for this client.
122
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
123
- # credentials for this client.
124
- # A `GRPC::Core::Channel` will be used to make calls through.
125
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
126
- # should already be composed with a `GRPC::Core::CallCredentials` object.
127
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
128
- # metadata for requests, generally, to give OAuth credentials.
129
- # @param scopes [Array<String>]
130
- # The OAuth scopes for this service. This parameter is ignored if
131
- # an updater_proc is supplied.
132
- # @param client_config [Hash]
133
- # A Hash for call options for each method. See
134
- # Google::Gax#construct_settings for the structure of
135
- # this data. Falls back to the default config if not specified
136
- # or the specified config is missing data points.
137
- # @param timeout [Numeric]
138
- # The default timeout, in seconds, for calls made through this client.
139
- # @param metadata [Hash]
140
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
141
- # @param service_address [String]
142
- # Override for the service hostname, or `nil` to leave as the default.
143
- # @param service_port [Integer]
144
- # Override for the service port, or `nil` to leave as the default.
145
- # @param exception_transformer [Proc]
146
- # An optional proc that intercepts any exceptions raised during an API call to inject
147
- # custom error handling.
148
- def initialize \
149
- credentials: nil,
150
- scopes: ALL_SCOPES,
151
- client_config: {},
152
- timeout: DEFAULT_TIMEOUT,
153
- metadata: nil,
154
- service_address: nil,
155
- service_port: nil,
156
- exception_transformer: nil,
157
- lib_name: nil,
158
- lib_version: ""
159
- # These require statements are intentionally placed here to initialize
160
- # the gRPC module only when it's required.
161
- # See https://github.com/googleapis/toolkit/issues/446
162
- require "google/gax/grpc"
163
- require "google/cloud/oslogin/v1/oslogin_services_pb"
164
-
165
- credentials ||= Google::Cloud::OsLogin::V1::Credentials.default
166
-
167
- if credentials.is_a?(String) || credentials.is_a?(Hash)
168
- updater_proc = Google::Cloud::OsLogin::V1::Credentials.new(credentials).updater_proc
169
- end
170
- if credentials.is_a?(GRPC::Core::Channel)
171
- channel = credentials
172
- end
173
- if credentials.is_a?(GRPC::Core::ChannelCredentials)
174
- chan_creds = credentials
175
- end
176
- if credentials.is_a?(Proc)
177
- updater_proc = credentials
178
- end
179
- if credentials.is_a?(Google::Auth::Credentials)
180
- updater_proc = credentials.updater_proc
181
- end
182
-
183
- package_version = Google::Cloud::OsLogin::VERSION
184
-
185
- google_api_client = "gl-ruby/#{RUBY_VERSION}"
186
- google_api_client << " #{lib_name}/#{lib_version}" if lib_name
187
- google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
188
- google_api_client << " grpc/#{GRPC::VERSION}"
189
- google_api_client.freeze
190
-
191
- headers = { :"x-goog-api-client" => google_api_client }
192
- if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
193
- headers[:"x-goog-user-project"] = credentials.quota_project_id
194
- end
195
- headers.merge!(metadata) unless metadata.nil?
196
- client_config_file = Pathname.new(__dir__).join(
197
- "os_login_service_client_config.json"
198
- )
199
- defaults = client_config_file.open do |f|
200
- Google::Gax.construct_settings(
201
- "google.cloud.oslogin.v1.OsLoginService",
202
- JSON.parse(f.read),
203
- client_config,
204
- Google::Gax::Grpc::STATUS_CODE_NAMES,
205
- timeout,
206
- errors: Google::Gax::Grpc::API_ERRORS,
207
- metadata: headers
208
- )
209
- end
210
-
211
- # Allow overriding the service path/port in subclasses.
212
- service_path = service_address || self.class::SERVICE_ADDRESS
213
- port = service_port || self.class::DEFAULT_SERVICE_PORT
214
- interceptors = self.class::GRPC_INTERCEPTORS
215
- @os_login_service_stub = Google::Gax::Grpc.create_stub(
216
- service_path,
217
- port,
218
- chan_creds: chan_creds,
219
- channel: channel,
220
- updater_proc: updater_proc,
221
- scopes: scopes,
222
- interceptors: interceptors,
223
- &Google::Cloud::OsLogin::V1::OsLoginService::Stub.method(:new)
224
- )
225
-
226
- @delete_posix_account = Google::Gax.create_api_call(
227
- @os_login_service_stub.method(:delete_posix_account),
228
- defaults["delete_posix_account"],
229
- exception_transformer: exception_transformer,
230
- params_extractor: proc do |request|
231
- {'name' => request.name}
232
- end
233
- )
234
- @delete_ssh_public_key = Google::Gax.create_api_call(
235
- @os_login_service_stub.method(:delete_ssh_public_key),
236
- defaults["delete_ssh_public_key"],
237
- exception_transformer: exception_transformer,
238
- params_extractor: proc do |request|
239
- {'name' => request.name}
240
- end
241
- )
242
- @get_login_profile = Google::Gax.create_api_call(
243
- @os_login_service_stub.method(:get_login_profile),
244
- defaults["get_login_profile"],
245
- exception_transformer: exception_transformer,
246
- params_extractor: proc do |request|
247
- {'name' => request.name}
248
- end
249
- )
250
- @get_ssh_public_key = Google::Gax.create_api_call(
251
- @os_login_service_stub.method(:get_ssh_public_key),
252
- defaults["get_ssh_public_key"],
253
- exception_transformer: exception_transformer,
254
- params_extractor: proc do |request|
255
- {'name' => request.name}
256
- end
257
- )
258
- @import_ssh_public_key = Google::Gax.create_api_call(
259
- @os_login_service_stub.method(:import_ssh_public_key),
260
- defaults["import_ssh_public_key"],
261
- exception_transformer: exception_transformer,
262
- params_extractor: proc do |request|
263
- {'parent' => request.parent}
264
- end
265
- )
266
- @update_ssh_public_key = Google::Gax.create_api_call(
267
- @os_login_service_stub.method(:update_ssh_public_key),
268
- defaults["update_ssh_public_key"],
269
- exception_transformer: exception_transformer,
270
- params_extractor: proc do |request|
271
- {'name' => request.name}
272
- end
273
- )
274
- end
275
-
276
- # Service calls
277
-
278
- # Deletes a POSIX account.
279
- #
280
- # @param name [String]
281
- # Required. A reference to the POSIX account to update. POSIX accounts are identified
282
- # by the project ID they are associated with. A reference to the POSIX
283
- # account is in format `users/{user}/projects/{project}`.
284
- # @param options [Google::Gax::CallOptions]
285
- # Overrides the default settings for this call, e.g, timeout,
286
- # retries, etc.
287
- # @yield [result, operation] Access the result along with the RPC operation
288
- # @yieldparam result []
289
- # @yieldparam operation [GRPC::ActiveCall::Operation]
290
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
291
- # @example
292
- # require "google/cloud/os_login"
293
- #
294
- # os_login_client = Google::Cloud::OsLogin.new(version: :v1)
295
- # formatted_name = Google::Cloud::OsLogin::V1::OsLoginServiceClient.posix_account_path("[USER]", "[PROJECT]")
296
- # os_login_client.delete_posix_account(formatted_name)
297
-
298
- def delete_posix_account \
299
- name,
300
- options: nil,
301
- &block
302
- req = {
303
- name: name
304
- }.delete_if { |_, v| v.nil? }
305
- req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1::DeletePosixAccountRequest)
306
- @delete_posix_account.call(req, options, &block)
307
- nil
308
- end
309
-
310
- # Deletes an SSH public key.
311
- #
312
- # @param name [String]
313
- # Required. The fingerprint of the public key to update. Public keys are identified by
314
- # their SHA-256 fingerprint. The fingerprint of the public key is in format
315
- # `users/{user}/sshPublicKeys/{fingerprint}`.
316
- # @param options [Google::Gax::CallOptions]
317
- # Overrides the default settings for this call, e.g, timeout,
318
- # retries, etc.
319
- # @yield [result, operation] Access the result along with the RPC operation
320
- # @yieldparam result []
321
- # @yieldparam operation [GRPC::ActiveCall::Operation]
322
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
323
- # @example
324
- # require "google/cloud/os_login"
325
- #
326
- # os_login_client = Google::Cloud::OsLogin.new(version: :v1)
327
- # formatted_name = Google::Cloud::OsLogin::V1::OsLoginServiceClient.ssh_public_key_path("[USER]", "[FINGERPRINT]")
328
- # os_login_client.delete_ssh_public_key(formatted_name)
329
-
330
- def delete_ssh_public_key \
331
- name,
332
- options: nil,
333
- &block
334
- req = {
335
- name: name
336
- }.delete_if { |_, v| v.nil? }
337
- req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1::DeleteSshPublicKeyRequest)
338
- @delete_ssh_public_key.call(req, options, &block)
339
- nil
340
- end
341
-
342
- # Retrieves the profile information used for logging in to a virtual machine
343
- # on Google Compute Engine.
344
- #
345
- # @param name [String]
346
- # Required. The unique ID for the user in format `users/{user}`.
347
- # @param project_id [String]
348
- # The project ID of the Google Cloud Platform project.
349
- # @param system_id [String]
350
- # A system ID for filtering the results of the request.
351
- # @param options [Google::Gax::CallOptions]
352
- # Overrides the default settings for this call, e.g, timeout,
353
- # retries, etc.
354
- # @yield [result, operation] Access the result along with the RPC operation
355
- # @yieldparam result [Google::Cloud::OsLogin::V1::LoginProfile]
356
- # @yieldparam operation [GRPC::ActiveCall::Operation]
357
- # @return [Google::Cloud::OsLogin::V1::LoginProfile]
358
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
359
- # @example
360
- # require "google/cloud/os_login"
361
- #
362
- # os_login_client = Google::Cloud::OsLogin.new(version: :v1)
363
- # formatted_name = Google::Cloud::OsLogin::V1::OsLoginServiceClient.user_path("[USER]")
364
- # response = os_login_client.get_login_profile(formatted_name)
365
-
366
- def get_login_profile \
367
- name,
368
- project_id: nil,
369
- system_id: nil,
370
- options: nil,
371
- &block
372
- req = {
373
- name: name,
374
- project_id: project_id,
375
- system_id: system_id
376
- }.delete_if { |_, v| v.nil? }
377
- req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1::GetLoginProfileRequest)
378
- @get_login_profile.call(req, options, &block)
379
- end
380
-
381
- # Retrieves an SSH public key.
382
- #
383
- # @param name [String]
384
- # Required. The fingerprint of the public key to retrieve. Public keys are identified
385
- # by their SHA-256 fingerprint. The fingerprint of the public key is in
386
- # format `users/{user}/sshPublicKeys/{fingerprint}`.
387
- # @param options [Google::Gax::CallOptions]
388
- # Overrides the default settings for this call, e.g, timeout,
389
- # retries, etc.
390
- # @yield [result, operation] Access the result along with the RPC operation
391
- # @yieldparam result [Google::Cloud::OsLogin::Common::SshPublicKey]
392
- # @yieldparam operation [GRPC::ActiveCall::Operation]
393
- # @return [Google::Cloud::OsLogin::Common::SshPublicKey]
394
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
395
- # @example
396
- # require "google/cloud/os_login"
397
- #
398
- # os_login_client = Google::Cloud::OsLogin.new(version: :v1)
399
- # formatted_name = Google::Cloud::OsLogin::V1::OsLoginServiceClient.ssh_public_key_path("[USER]", "[FINGERPRINT]")
400
- # response = os_login_client.get_ssh_public_key(formatted_name)
401
-
402
- def get_ssh_public_key \
403
- name,
404
- options: nil,
405
- &block
406
- req = {
407
- name: name
408
- }.delete_if { |_, v| v.nil? }
409
- req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1::GetSshPublicKeyRequest)
410
- @get_ssh_public_key.call(req, options, &block)
411
- end
412
-
413
- # Adds an SSH public key and returns the profile information. Default POSIX
414
- # account information is set when no username and UID exist as part of the
415
- # login profile.
416
- #
417
- # @param parent [String]
418
- # Required. The unique ID for the user in format `users/{user}`.
419
- # @param ssh_public_key [Google::Cloud::OsLogin::Common::SshPublicKey | Hash]
420
- # Optional. The SSH public key and expiration time.
421
- # A hash of the same form as `Google::Cloud::OsLogin::Common::SshPublicKey`
422
- # can also be provided.
423
- # @param project_id [String]
424
- # The project ID of the Google Cloud Platform project.
425
- # @param options [Google::Gax::CallOptions]
426
- # Overrides the default settings for this call, e.g, timeout,
427
- # retries, etc.
428
- # @yield [result, operation] Access the result along with the RPC operation
429
- # @yieldparam result [Google::Cloud::OsLogin::V1::ImportSshPublicKeyResponse]
430
- # @yieldparam operation [GRPC::ActiveCall::Operation]
431
- # @return [Google::Cloud::OsLogin::V1::ImportSshPublicKeyResponse]
432
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
433
- # @example
434
- # require "google/cloud/os_login"
435
- #
436
- # os_login_client = Google::Cloud::OsLogin.new(version: :v1)
437
- # formatted_parent = Google::Cloud::OsLogin::V1::OsLoginServiceClient.user_path("[USER]")
438
- # response = os_login_client.import_ssh_public_key(formatted_parent)
439
-
440
- def import_ssh_public_key \
441
- parent,
442
- ssh_public_key: nil,
443
- project_id: nil,
444
- options: nil,
445
- &block
446
- req = {
447
- parent: parent,
448
- ssh_public_key: ssh_public_key,
449
- project_id: project_id
450
- }.delete_if { |_, v| v.nil? }
451
- req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1::ImportSshPublicKeyRequest)
452
- @import_ssh_public_key.call(req, options, &block)
453
- end
454
-
455
- # Updates an SSH public key and returns the profile information. This method
456
- # supports patch semantics.
457
- #
458
- # @param name [String]
459
- # Required. The fingerprint of the public key to update. Public keys are identified by
460
- # their SHA-256 fingerprint. The fingerprint of the public key is in format
461
- # `users/{user}/sshPublicKeys/{fingerprint}`.
462
- # @param ssh_public_key [Google::Cloud::OsLogin::Common::SshPublicKey | Hash]
463
- # Required. The SSH public key and expiration time.
464
- # A hash of the same form as `Google::Cloud::OsLogin::Common::SshPublicKey`
465
- # can also be provided.
466
- # @param update_mask [Google::Protobuf::FieldMask | Hash]
467
- # Mask to control which fields get updated. Updates all if not present.
468
- # A hash of the same form as `Google::Protobuf::FieldMask`
469
- # can also be provided.
470
- # @param options [Google::Gax::CallOptions]
471
- # Overrides the default settings for this call, e.g, timeout,
472
- # retries, etc.
473
- # @yield [result, operation] Access the result along with the RPC operation
474
- # @yieldparam result [Google::Cloud::OsLogin::Common::SshPublicKey]
475
- # @yieldparam operation [GRPC::ActiveCall::Operation]
476
- # @return [Google::Cloud::OsLogin::Common::SshPublicKey]
477
- # @raise [Google::Gax::GaxError] if the RPC is aborted.
478
- # @example
479
- # require "google/cloud/os_login"
480
- #
481
- # os_login_client = Google::Cloud::OsLogin.new(version: :v1)
482
- # formatted_name = Google::Cloud::OsLogin::V1::OsLoginServiceClient.ssh_public_key_path("[USER]", "[FINGERPRINT]")
483
- #
484
- # # TODO: Initialize `ssh_public_key`:
485
- # ssh_public_key = {}
486
- # response = os_login_client.update_ssh_public_key(formatted_name, ssh_public_key)
487
-
488
- def update_ssh_public_key \
489
- name,
490
- ssh_public_key,
491
- update_mask: nil,
492
- options: nil,
493
- &block
494
- req = {
495
- name: name,
496
- ssh_public_key: ssh_public_key,
497
- update_mask: update_mask
498
- }.delete_if { |_, v| v.nil? }
499
- req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1::UpdateSshPublicKeyRequest)
500
- @update_ssh_public_key.call(req, options, &block)
501
- end
502
- end
503
- end
504
- end
505
- end
506
- end