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.
- checksums.yaml +4 -4
- data/.yardopts +2 -1
- data/AUTHENTICATION.md +51 -54
- data/LICENSE.md +203 -0
- data/MIGRATING.md +323 -0
- data/README.md +36 -24
- data/lib/{google/cloud/os_login/v1/doc/google/protobuf/empty.rb → google-cloud-os_login.rb} +4 -14
- data/lib/google/cloud/os_login.rb +88 -117
- data/lib/google/cloud/os_login/version.rb +6 -2
- metadata +74 -61
- data/LICENSE +0 -201
- data/lib/google/cloud/os_login/v1.rb +0 -148
- data/lib/google/cloud/os_login/v1/credentials.rb +0 -42
- data/lib/google/cloud/os_login/v1/doc/google/cloud/oslogin/common/common.rb +0 -89
- data/lib/google/cloud/os_login/v1/doc/google/cloud/oslogin/v1/oslogin.rb +0 -103
- data/lib/google/cloud/os_login/v1/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/os_login/v1/os_login_service_client.rb +0 -506
- data/lib/google/cloud/os_login/v1/os_login_service_client_config.json +0 -56
- data/lib/google/cloud/os_login/v1beta.rb +0 -148
- data/lib/google/cloud/os_login/v1beta/credentials.rb +0 -44
- data/lib/google/cloud/os_login/v1beta/doc/google/cloud/oslogin/common.rb +0 -67
- data/lib/google/cloud/os_login/v1beta/doc/google/cloud/oslogin/common/common.rb +0 -89
- data/lib/google/cloud/os_login/v1beta/doc/google/cloud/oslogin/v1beta/oslogin.rb +0 -103
- data/lib/google/cloud/os_login/v1beta/doc/google/protobuf/empty.rb +0 -29
- data/lib/google/cloud/os_login/v1beta/doc/google/protobuf/field_mask.rb +0 -222
- data/lib/google/cloud/os_login/v1beta/os_login_service_client.rb +0 -511
- data/lib/google/cloud/os_login/v1beta/os_login_service_client_config.json +0 -56
- data/lib/google/cloud/oslogin/common/common_pb.rb +0 -40
- data/lib/google/cloud/oslogin/v1/oslogin_pb.rb +0 -65
- data/lib/google/cloud/oslogin/v1/oslogin_services_pb.rb +0 -65
- data/lib/google/cloud/oslogin/v1beta/oslogin_pb.rb +0 -65
- data/lib/google/cloud/oslogin/v1beta/oslogin_services_pb.rb +0 -65
@@ -1,29 +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
|
-
# A generic empty message that you can re-use to avoid defining duplicated
|
19
|
-
# empty messages in your APIs. A typical example is to use it as the request
|
20
|
-
# or the response type of an API method. For instance:
|
21
|
-
#
|
22
|
-
# service Foo {
|
23
|
-
# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
24
|
-
# }
|
25
|
-
#
|
26
|
-
# The JSON representation for `Empty` is empty JSON object `{}`.
|
27
|
-
class Empty; end
|
28
|
-
end
|
29
|
-
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,511 +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/v1beta/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/v1beta/oslogin_pb"
|
29
|
-
require "google/cloud/os_login/v1beta/credentials"
|
30
|
-
require "google/cloud/os_login/version"
|
31
|
-
|
32
|
-
module Google
|
33
|
-
module Cloud
|
34
|
-
module OsLogin
|
35
|
-
module V1beta
|
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::V1beta::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/cloud-platform.read-only",
|
63
|
-
"https://www.googleapis.com/auth/compute",
|
64
|
-
"https://www.googleapis.com/auth/compute.readonly"
|
65
|
-
].freeze
|
66
|
-
|
67
|
-
|
68
|
-
FINGERPRINT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
69
|
-
"users/{user}/sshPublicKeys/{fingerprint}"
|
70
|
-
)
|
71
|
-
|
72
|
-
private_constant :FINGERPRINT_PATH_TEMPLATE
|
73
|
-
|
74
|
-
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
75
|
-
"users/{user}/projects/{project}"
|
76
|
-
)
|
77
|
-
|
78
|
-
private_constant :PROJECT_PATH_TEMPLATE
|
79
|
-
|
80
|
-
USER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
81
|
-
"users/{user}"
|
82
|
-
)
|
83
|
-
|
84
|
-
private_constant :USER_PATH_TEMPLATE
|
85
|
-
|
86
|
-
# Returns a fully-qualified fingerprint resource name string.
|
87
|
-
# @param user [String]
|
88
|
-
# @param fingerprint [String]
|
89
|
-
# @return [String]
|
90
|
-
def self.fingerprint_path user, fingerprint
|
91
|
-
FINGERPRINT_PATH_TEMPLATE.render(
|
92
|
-
:"user" => user,
|
93
|
-
:"fingerprint" => fingerprint
|
94
|
-
)
|
95
|
-
end
|
96
|
-
|
97
|
-
# Returns a fully-qualified project resource name string.
|
98
|
-
# @param user [String]
|
99
|
-
# @param project [String]
|
100
|
-
# @return [String]
|
101
|
-
def self.project_path user, project
|
102
|
-
PROJECT_PATH_TEMPLATE.render(
|
103
|
-
:"user" => user,
|
104
|
-
:"project" => project
|
105
|
-
)
|
106
|
-
end
|
107
|
-
|
108
|
-
# Returns a fully-qualified user resource name string.
|
109
|
-
# @param user [String]
|
110
|
-
# @return [String]
|
111
|
-
def self.user_path user
|
112
|
-
USER_PATH_TEMPLATE.render(
|
113
|
-
:"user" => user
|
114
|
-
)
|
115
|
-
end
|
116
|
-
|
117
|
-
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
118
|
-
# Provides the means for authenticating requests made by the client. This parameter can
|
119
|
-
# be many types.
|
120
|
-
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
121
|
-
# authenticating requests made by this client.
|
122
|
-
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
123
|
-
# credentials for this client.
|
124
|
-
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
125
|
-
# credentials for this client.
|
126
|
-
# A `GRPC::Core::Channel` will be used to make calls through.
|
127
|
-
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
128
|
-
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
129
|
-
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
130
|
-
# metadata for requests, generally, to give OAuth credentials.
|
131
|
-
# @param scopes [Array<String>]
|
132
|
-
# The OAuth scopes for this service. This parameter is ignored if
|
133
|
-
# an updater_proc is supplied.
|
134
|
-
# @param client_config [Hash]
|
135
|
-
# A Hash for call options for each method. See
|
136
|
-
# Google::Gax#construct_settings for the structure of
|
137
|
-
# this data. Falls back to the default config if not specified
|
138
|
-
# or the specified config is missing data points.
|
139
|
-
# @param timeout [Numeric]
|
140
|
-
# The default timeout, in seconds, for calls made through this client.
|
141
|
-
# @param metadata [Hash]
|
142
|
-
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
143
|
-
# @param service_address [String]
|
144
|
-
# Override for the service hostname, or `nil` to leave as the default.
|
145
|
-
# @param service_port [Integer]
|
146
|
-
# Override for the service port, or `nil` to leave as the default.
|
147
|
-
# @param exception_transformer [Proc]
|
148
|
-
# An optional proc that intercepts any exceptions raised during an API call to inject
|
149
|
-
# custom error handling.
|
150
|
-
def initialize \
|
151
|
-
credentials: nil,
|
152
|
-
scopes: ALL_SCOPES,
|
153
|
-
client_config: {},
|
154
|
-
timeout: DEFAULT_TIMEOUT,
|
155
|
-
metadata: nil,
|
156
|
-
service_address: nil,
|
157
|
-
service_port: nil,
|
158
|
-
exception_transformer: nil,
|
159
|
-
lib_name: nil,
|
160
|
-
lib_version: ""
|
161
|
-
# These require statements are intentionally placed here to initialize
|
162
|
-
# the gRPC module only when it's required.
|
163
|
-
# See https://github.com/googleapis/toolkit/issues/446
|
164
|
-
require "google/gax/grpc"
|
165
|
-
require "google/cloud/oslogin/v1beta/oslogin_services_pb"
|
166
|
-
|
167
|
-
credentials ||= Google::Cloud::OsLogin::V1beta::Credentials.default
|
168
|
-
|
169
|
-
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
170
|
-
updater_proc = Google::Cloud::OsLogin::V1beta::Credentials.new(credentials).updater_proc
|
171
|
-
end
|
172
|
-
if credentials.is_a?(GRPC::Core::Channel)
|
173
|
-
channel = credentials
|
174
|
-
end
|
175
|
-
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
176
|
-
chan_creds = credentials
|
177
|
-
end
|
178
|
-
if credentials.is_a?(Proc)
|
179
|
-
updater_proc = credentials
|
180
|
-
end
|
181
|
-
if credentials.is_a?(Google::Auth::Credentials)
|
182
|
-
updater_proc = credentials.updater_proc
|
183
|
-
end
|
184
|
-
|
185
|
-
package_version = Google::Cloud::OsLogin::VERSION
|
186
|
-
|
187
|
-
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
188
|
-
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
189
|
-
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
190
|
-
google_api_client << " grpc/#{GRPC::VERSION}"
|
191
|
-
google_api_client.freeze
|
192
|
-
|
193
|
-
headers = { :"x-goog-api-client" => google_api_client }
|
194
|
-
if credentials.respond_to?(:quota_project_id) && credentials.quota_project_id
|
195
|
-
headers[:"x-goog-user-project"] = credentials.quota_project_id
|
196
|
-
end
|
197
|
-
headers.merge!(metadata) unless metadata.nil?
|
198
|
-
client_config_file = Pathname.new(__dir__).join(
|
199
|
-
"os_login_service_client_config.json"
|
200
|
-
)
|
201
|
-
defaults = client_config_file.open do |f|
|
202
|
-
Google::Gax.construct_settings(
|
203
|
-
"google.cloud.oslogin.v1beta.OsLoginService",
|
204
|
-
JSON.parse(f.read),
|
205
|
-
client_config,
|
206
|
-
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
207
|
-
timeout,
|
208
|
-
errors: Google::Gax::Grpc::API_ERRORS,
|
209
|
-
metadata: headers
|
210
|
-
)
|
211
|
-
end
|
212
|
-
|
213
|
-
# Allow overriding the service path/port in subclasses.
|
214
|
-
service_path = service_address || self.class::SERVICE_ADDRESS
|
215
|
-
port = service_port || self.class::DEFAULT_SERVICE_PORT
|
216
|
-
interceptors = self.class::GRPC_INTERCEPTORS
|
217
|
-
@os_login_service_stub = Google::Gax::Grpc.create_stub(
|
218
|
-
service_path,
|
219
|
-
port,
|
220
|
-
chan_creds: chan_creds,
|
221
|
-
channel: channel,
|
222
|
-
updater_proc: updater_proc,
|
223
|
-
scopes: scopes,
|
224
|
-
interceptors: interceptors,
|
225
|
-
&Google::Cloud::OsLogin::V1beta::OsLoginService::Stub.method(:new)
|
226
|
-
)
|
227
|
-
|
228
|
-
@delete_posix_account = Google::Gax.create_api_call(
|
229
|
-
@os_login_service_stub.method(:delete_posix_account),
|
230
|
-
defaults["delete_posix_account"],
|
231
|
-
exception_transformer: exception_transformer,
|
232
|
-
params_extractor: proc do |request|
|
233
|
-
{'name' => request.name}
|
234
|
-
end
|
235
|
-
)
|
236
|
-
@delete_ssh_public_key = Google::Gax.create_api_call(
|
237
|
-
@os_login_service_stub.method(:delete_ssh_public_key),
|
238
|
-
defaults["delete_ssh_public_key"],
|
239
|
-
exception_transformer: exception_transformer,
|
240
|
-
params_extractor: proc do |request|
|
241
|
-
{'name' => request.name}
|
242
|
-
end
|
243
|
-
)
|
244
|
-
@get_login_profile = Google::Gax.create_api_call(
|
245
|
-
@os_login_service_stub.method(:get_login_profile),
|
246
|
-
defaults["get_login_profile"],
|
247
|
-
exception_transformer: exception_transformer,
|
248
|
-
params_extractor: proc do |request|
|
249
|
-
{'name' => request.name}
|
250
|
-
end
|
251
|
-
)
|
252
|
-
@get_ssh_public_key = Google::Gax.create_api_call(
|
253
|
-
@os_login_service_stub.method(:get_ssh_public_key),
|
254
|
-
defaults["get_ssh_public_key"],
|
255
|
-
exception_transformer: exception_transformer,
|
256
|
-
params_extractor: proc do |request|
|
257
|
-
{'name' => request.name}
|
258
|
-
end
|
259
|
-
)
|
260
|
-
@import_ssh_public_key = Google::Gax.create_api_call(
|
261
|
-
@os_login_service_stub.method(:import_ssh_public_key),
|
262
|
-
defaults["import_ssh_public_key"],
|
263
|
-
exception_transformer: exception_transformer,
|
264
|
-
params_extractor: proc do |request|
|
265
|
-
{'parent' => request.parent}
|
266
|
-
end
|
267
|
-
)
|
268
|
-
@update_ssh_public_key = Google::Gax.create_api_call(
|
269
|
-
@os_login_service_stub.method(:update_ssh_public_key),
|
270
|
-
defaults["update_ssh_public_key"],
|
271
|
-
exception_transformer: exception_transformer,
|
272
|
-
params_extractor: proc do |request|
|
273
|
-
{'name' => request.name}
|
274
|
-
end
|
275
|
-
)
|
276
|
-
end
|
277
|
-
|
278
|
-
# Service calls
|
279
|
-
|
280
|
-
# Deletes a POSIX account.
|
281
|
-
#
|
282
|
-
# @param name [String]
|
283
|
-
# Required. A reference to the POSIX account to update. POSIX accounts are identified
|
284
|
-
# by the project ID they are associated with. A reference to the POSIX
|
285
|
-
# account is in format `users/{user}/projects/{project}`.
|
286
|
-
# @param options [Google::Gax::CallOptions]
|
287
|
-
# Overrides the default settings for this call, e.g, timeout,
|
288
|
-
# retries, etc.
|
289
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
290
|
-
# @yieldparam result []
|
291
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
292
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
293
|
-
# @example
|
294
|
-
# require "google/cloud/os_login"
|
295
|
-
#
|
296
|
-
# os_login_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
297
|
-
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.project_path("[USER]", "[PROJECT]")
|
298
|
-
# os_login_client.delete_posix_account(formatted_name)
|
299
|
-
|
300
|
-
def delete_posix_account \
|
301
|
-
name,
|
302
|
-
options: nil,
|
303
|
-
&block
|
304
|
-
req = {
|
305
|
-
name: name
|
306
|
-
}.delete_if { |_, v| v.nil? }
|
307
|
-
req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1beta::DeletePosixAccountRequest)
|
308
|
-
@delete_posix_account.call(req, options, &block)
|
309
|
-
nil
|
310
|
-
end
|
311
|
-
|
312
|
-
# Deletes an SSH public key.
|
313
|
-
#
|
314
|
-
# @param name [String]
|
315
|
-
# Required. The fingerprint of the public key to update. Public keys are identified by
|
316
|
-
# their SHA-256 fingerprint. The fingerprint of the public key is in format
|
317
|
-
# `users/{user}/sshPublicKeys/{fingerprint}`.
|
318
|
-
# @param options [Google::Gax::CallOptions]
|
319
|
-
# Overrides the default settings for this call, e.g, timeout,
|
320
|
-
# retries, etc.
|
321
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
322
|
-
# @yieldparam result []
|
323
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
324
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
325
|
-
# @example
|
326
|
-
# require "google/cloud/os_login"
|
327
|
-
#
|
328
|
-
# os_login_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
329
|
-
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.fingerprint_path("[USER]", "[FINGERPRINT]")
|
330
|
-
# os_login_client.delete_ssh_public_key(formatted_name)
|
331
|
-
|
332
|
-
def delete_ssh_public_key \
|
333
|
-
name,
|
334
|
-
options: nil,
|
335
|
-
&block
|
336
|
-
req = {
|
337
|
-
name: name
|
338
|
-
}.delete_if { |_, v| v.nil? }
|
339
|
-
req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1beta::DeleteSshPublicKeyRequest)
|
340
|
-
@delete_ssh_public_key.call(req, options, &block)
|
341
|
-
nil
|
342
|
-
end
|
343
|
-
|
344
|
-
# Retrieves the profile information used for logging in to a virtual machine
|
345
|
-
# on Google Compute Engine.
|
346
|
-
#
|
347
|
-
# @param name [String]
|
348
|
-
# Required. The unique ID for the user in format `users/{user}`.
|
349
|
-
# @param project_id [String]
|
350
|
-
# The project ID of the Google Cloud Platform project.
|
351
|
-
# @param system_id [String]
|
352
|
-
# A system ID for filtering the results of the request.
|
353
|
-
# @param options [Google::Gax::CallOptions]
|
354
|
-
# Overrides the default settings for this call, e.g, timeout,
|
355
|
-
# retries, etc.
|
356
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
357
|
-
# @yieldparam result [Google::Cloud::OsLogin::V1beta::LoginProfile]
|
358
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
359
|
-
# @return [Google::Cloud::OsLogin::V1beta::LoginProfile]
|
360
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
361
|
-
# @example
|
362
|
-
# require "google/cloud/os_login"
|
363
|
-
#
|
364
|
-
# os_login_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
365
|
-
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.user_path("[USER]")
|
366
|
-
# response = os_login_client.get_login_profile(formatted_name)
|
367
|
-
|
368
|
-
def get_login_profile \
|
369
|
-
name,
|
370
|
-
project_id: nil,
|
371
|
-
system_id: nil,
|
372
|
-
options: nil,
|
373
|
-
&block
|
374
|
-
req = {
|
375
|
-
name: name,
|
376
|
-
project_id: project_id,
|
377
|
-
system_id: system_id
|
378
|
-
}.delete_if { |_, v| v.nil? }
|
379
|
-
req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1beta::GetLoginProfileRequest)
|
380
|
-
@get_login_profile.call(req, options, &block)
|
381
|
-
end
|
382
|
-
|
383
|
-
# Retrieves an SSH public key.
|
384
|
-
#
|
385
|
-
# @param name [String]
|
386
|
-
# Required. The fingerprint of the public key to retrieve. Public keys are identified
|
387
|
-
# by their SHA-256 fingerprint. The fingerprint of the public key is in
|
388
|
-
# format `users/{user}/sshPublicKeys/{fingerprint}`.
|
389
|
-
# @param options [Google::Gax::CallOptions]
|
390
|
-
# Overrides the default settings for this call, e.g, timeout,
|
391
|
-
# retries, etc.
|
392
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
393
|
-
# @yieldparam result [Google::Cloud::OsLogin::Common::SshPublicKey]
|
394
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
395
|
-
# @return [Google::Cloud::OsLogin::Common::SshPublicKey]
|
396
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
397
|
-
# @example
|
398
|
-
# require "google/cloud/os_login"
|
399
|
-
#
|
400
|
-
# os_login_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
401
|
-
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.fingerprint_path("[USER]", "[FINGERPRINT]")
|
402
|
-
# response = os_login_client.get_ssh_public_key(formatted_name)
|
403
|
-
|
404
|
-
def get_ssh_public_key \
|
405
|
-
name,
|
406
|
-
options: nil,
|
407
|
-
&block
|
408
|
-
req = {
|
409
|
-
name: name
|
410
|
-
}.delete_if { |_, v| v.nil? }
|
411
|
-
req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1beta::GetSshPublicKeyRequest)
|
412
|
-
@get_ssh_public_key.call(req, options, &block)
|
413
|
-
end
|
414
|
-
|
415
|
-
# Adds an SSH public key and returns the profile information. Default POSIX
|
416
|
-
# account information is set when no username and UID exist as part of the
|
417
|
-
# login profile.
|
418
|
-
#
|
419
|
-
# @param parent [String]
|
420
|
-
# The unique ID for the user in format `users/{user}`.
|
421
|
-
# @param ssh_public_key [Google::Cloud::OsLogin::Common::SshPublicKey | Hash]
|
422
|
-
# Required. The SSH public key and expiration time.
|
423
|
-
# A hash of the same form as `Google::Cloud::OsLogin::Common::SshPublicKey`
|
424
|
-
# can also be provided.
|
425
|
-
# @param project_id [String]
|
426
|
-
# The project ID of the Google Cloud Platform project.
|
427
|
-
# @param options [Google::Gax::CallOptions]
|
428
|
-
# Overrides the default settings for this call, e.g, timeout,
|
429
|
-
# retries, etc.
|
430
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
431
|
-
# @yieldparam result [Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyResponse]
|
432
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
433
|
-
# @return [Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyResponse]
|
434
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
435
|
-
# @example
|
436
|
-
# require "google/cloud/os_login"
|
437
|
-
#
|
438
|
-
# os_login_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
439
|
-
# formatted_parent = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.user_path("[USER]")
|
440
|
-
#
|
441
|
-
# # TODO: Initialize `ssh_public_key`:
|
442
|
-
# ssh_public_key = {}
|
443
|
-
# response = os_login_client.import_ssh_public_key(formatted_parent, ssh_public_key)
|
444
|
-
|
445
|
-
def import_ssh_public_key \
|
446
|
-
parent,
|
447
|
-
ssh_public_key,
|
448
|
-
project_id: nil,
|
449
|
-
options: nil,
|
450
|
-
&block
|
451
|
-
req = {
|
452
|
-
parent: parent,
|
453
|
-
ssh_public_key: ssh_public_key,
|
454
|
-
project_id: project_id
|
455
|
-
}.delete_if { |_, v| v.nil? }
|
456
|
-
req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1beta::ImportSshPublicKeyRequest)
|
457
|
-
@import_ssh_public_key.call(req, options, &block)
|
458
|
-
end
|
459
|
-
|
460
|
-
# Updates an SSH public key and returns the profile information. This method
|
461
|
-
# supports patch semantics.
|
462
|
-
#
|
463
|
-
# @param name [String]
|
464
|
-
# Required. The fingerprint of the public key to update. Public keys are identified by
|
465
|
-
# their SHA-256 fingerprint. The fingerprint of the public key is in format
|
466
|
-
# `users/{user}/sshPublicKeys/{fingerprint}`.
|
467
|
-
# @param ssh_public_key [Google::Cloud::OsLogin::Common::SshPublicKey | Hash]
|
468
|
-
# Required. The SSH public key and expiration time.
|
469
|
-
# A hash of the same form as `Google::Cloud::OsLogin::Common::SshPublicKey`
|
470
|
-
# can also be provided.
|
471
|
-
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
472
|
-
# Mask to control which fields get updated. Updates all if not present.
|
473
|
-
# A hash of the same form as `Google::Protobuf::FieldMask`
|
474
|
-
# can also be provided.
|
475
|
-
# @param options [Google::Gax::CallOptions]
|
476
|
-
# Overrides the default settings for this call, e.g, timeout,
|
477
|
-
# retries, etc.
|
478
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
479
|
-
# @yieldparam result [Google::Cloud::OsLogin::Common::SshPublicKey]
|
480
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
481
|
-
# @return [Google::Cloud::OsLogin::Common::SshPublicKey]
|
482
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
483
|
-
# @example
|
484
|
-
# require "google/cloud/os_login"
|
485
|
-
#
|
486
|
-
# os_login_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
487
|
-
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.fingerprint_path("[USER]", "[FINGERPRINT]")
|
488
|
-
#
|
489
|
-
# # TODO: Initialize `ssh_public_key`:
|
490
|
-
# ssh_public_key = {}
|
491
|
-
# response = os_login_client.update_ssh_public_key(formatted_name, ssh_public_key)
|
492
|
-
|
493
|
-
def update_ssh_public_key \
|
494
|
-
name,
|
495
|
-
ssh_public_key,
|
496
|
-
update_mask: nil,
|
497
|
-
options: nil,
|
498
|
-
&block
|
499
|
-
req = {
|
500
|
-
name: name,
|
501
|
-
ssh_public_key: ssh_public_key,
|
502
|
-
update_mask: update_mask
|
503
|
-
}.delete_if { |_, v| v.nil? }
|
504
|
-
req = Google::Gax::to_proto(req, Google::Cloud::OsLogin::V1beta::UpdateSshPublicKeyRequest)
|
505
|
-
@update_ssh_public_key.call(req, options, &block)
|
506
|
-
end
|
507
|
-
end
|
508
|
-
end
|
509
|
-
end
|
510
|
-
end
|
511
|
-
end
|