google-cloud-os_login 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +39 -2
- data/lib/google/cloud/os_login.rb +34 -4
- data/lib/google/cloud/os_login/v1.rb +134 -0
- data/lib/google/cloud/os_login/v1/credentials.rb +43 -0
- data/lib/google/cloud/os_login/v1/doc/google/cloud/oslogin/common/common.rb +66 -0
- data/lib/google/cloud/os_login/v1/doc/google/cloud/oslogin/v1/oslogin.rb +111 -0
- data/lib/google/cloud/os_login/v1/doc/google/protobuf/empty.rb +28 -0
- data/lib/google/cloud/os_login/v1/doc/google/protobuf/field_mask.rb +223 -0
- data/lib/google/cloud/os_login/v1/doc/overview.rb +79 -0
- data/lib/google/cloud/os_login/v1/os_login_service_client.rb +473 -0
- data/lib/google/cloud/os_login/v1/os_login_service_client_config.json +56 -0
- data/lib/google/cloud/os_login/v1beta.rb +62 -28
- data/lib/google/cloud/os_login/v1beta/credentials.rb +43 -0
- data/lib/google/cloud/os_login/v1beta/doc/google/cloud/oslogin/common/common.rb +66 -0
- data/lib/google/cloud/os_login/v1beta/doc/google/cloud/oslogin/v1beta/oslogin.rb +2 -2
- data/lib/google/cloud/os_login/v1beta/doc/google/protobuf/empty.rb +28 -0
- data/lib/google/cloud/os_login/v1beta/doc/google/protobuf/field_mask.rb +1 -1
- data/lib/google/cloud/os_login/v1beta/doc/overview.rb +27 -2
- data/lib/google/cloud/os_login/v1beta/os_login_service_client.rb +82 -38
- data/lib/google/cloud/oslogin/{common_pb.rb → common/common_pb.rb} +1 -1
- data/lib/google/cloud/oslogin/v1/oslogin_pb.rb +59 -0
- data/lib/google/cloud/oslogin/v1/oslogin_services_pb.rb +62 -0
- data/lib/google/cloud/oslogin/v1beta/oslogin_pb.rb +1 -1
- metadata +53 -12
- data/lib/google/cloud/os_login/credentials.rb +0 -33
@@ -0,0 +1,56 @@
|
|
1
|
+
{
|
2
|
+
"interfaces": {
|
3
|
+
"google.cloud.oslogin.v1.OsLoginService": {
|
4
|
+
"retry_codes": {
|
5
|
+
"idempotent": [
|
6
|
+
"DEADLINE_EXCEEDED",
|
7
|
+
"UNAVAILABLE"
|
8
|
+
],
|
9
|
+
"non_idempotent": []
|
10
|
+
},
|
11
|
+
"retry_params": {
|
12
|
+
"default": {
|
13
|
+
"initial_retry_delay_millis": 100,
|
14
|
+
"retry_delay_multiplier": 1.3,
|
15
|
+
"max_retry_delay_millis": 60000,
|
16
|
+
"initial_rpc_timeout_millis": 10000,
|
17
|
+
"rpc_timeout_multiplier": 1.0,
|
18
|
+
"max_rpc_timeout_millis": 10000,
|
19
|
+
"total_timeout_millis": 600000
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"methods": {
|
23
|
+
"DeletePosixAccount": {
|
24
|
+
"timeout_millis": 10000,
|
25
|
+
"retry_codes_name": "idempotent",
|
26
|
+
"retry_params_name": "default"
|
27
|
+
},
|
28
|
+
"DeleteSshPublicKey": {
|
29
|
+
"timeout_millis": 10000,
|
30
|
+
"retry_codes_name": "idempotent",
|
31
|
+
"retry_params_name": "default"
|
32
|
+
},
|
33
|
+
"GetLoginProfile": {
|
34
|
+
"timeout_millis": 10000,
|
35
|
+
"retry_codes_name": "idempotent",
|
36
|
+
"retry_params_name": "default"
|
37
|
+
},
|
38
|
+
"GetSshPublicKey": {
|
39
|
+
"timeout_millis": 10000,
|
40
|
+
"retry_codes_name": "idempotent",
|
41
|
+
"retry_params_name": "default"
|
42
|
+
},
|
43
|
+
"ImportSshPublicKey": {
|
44
|
+
"timeout_millis": 10000,
|
45
|
+
"retry_codes_name": "idempotent",
|
46
|
+
"retry_params_name": "default"
|
47
|
+
},
|
48
|
+
"UpdateSshPublicKey": {
|
49
|
+
"timeout_millis": 10000,
|
50
|
+
"retry_codes_name": "idempotent",
|
51
|
+
"retry_params_name": "default"
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -16,34 +16,59 @@ require "google/cloud/os_login/v1beta/os_login_service_client"
|
|
16
16
|
|
17
17
|
module Google
|
18
18
|
module Cloud
|
19
|
-
# rubocop:disable LineLength
|
20
|
-
|
21
|
-
##
|
22
|
-
# # Ruby Client for Google Cloud OS Login API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
23
|
-
#
|
24
|
-
# [Google Cloud OS Login API][Product Documentation]:
|
25
|
-
# Manages OS login configuration for Google account users.
|
26
|
-
# - [Product Documentation][]
|
27
|
-
#
|
28
|
-
# ## Quick Start
|
29
|
-
# In order to use this library, you first need to go through the following
|
30
|
-
# steps:
|
31
|
-
#
|
32
|
-
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
33
|
-
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
34
|
-
# 3. [Enable the Google Cloud OS Login API.](https://console.cloud.google.com/apis/api/oslogin)
|
35
|
-
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
36
|
-
#
|
37
|
-
# ### Next Steps
|
38
|
-
# - Read the [Google Cloud OS Login API Product documentation][Product Documentation]
|
39
|
-
# to learn more about the product and see How-to Guides.
|
40
|
-
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
41
|
-
# to see the full list of Cloud APIs that we cover.
|
42
|
-
#
|
43
|
-
# [Product Documentation]: https://cloud.google.com/compute/docs/oslogin/rest/
|
44
|
-
#
|
45
|
-
#
|
46
19
|
module OsLogin
|
20
|
+
# rubocop:disable LineLength
|
21
|
+
|
22
|
+
##
|
23
|
+
# # Ruby Client for Google Cloud OS Login API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
24
|
+
#
|
25
|
+
# [Google Cloud OS Login API][Product Documentation]:
|
26
|
+
# Manages OS login configuration for Google account users.
|
27
|
+
# - [Product Documentation][]
|
28
|
+
#
|
29
|
+
# ## Quick Start
|
30
|
+
# In order to use this library, you first need to go through the following
|
31
|
+
# steps:
|
32
|
+
#
|
33
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
35
|
+
# 3. [Enable the Google Cloud OS Login API.](https://console.cloud.google.com/apis/library/oslogin.googleapis.com)
|
36
|
+
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
|
+
#
|
38
|
+
# ### Next Steps
|
39
|
+
# - Read the [Google Cloud OS Login API Product documentation][Product Documentation]
|
40
|
+
# to learn more about the product and see How-to Guides.
|
41
|
+
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
42
|
+
# to see the full list of Cloud APIs that we cover.
|
43
|
+
#
|
44
|
+
# [Product Documentation]: https://cloud.google.com/compute/docs/oslogin/rest/
|
45
|
+
#
|
46
|
+
# ## Enabling Logging
|
47
|
+
#
|
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-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
50
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
51
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
52
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
53
|
+
#
|
54
|
+
# Configuring a Ruby stdlib logger:
|
55
|
+
#
|
56
|
+
# ```ruby
|
57
|
+
# require "logger"
|
58
|
+
#
|
59
|
+
# module MyLogger
|
60
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
61
|
+
# def logger
|
62
|
+
# LOGGER
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
#
|
66
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
67
|
+
# module GRPC
|
68
|
+
# extend MyLogger
|
69
|
+
# end
|
70
|
+
# ```
|
71
|
+
#
|
47
72
|
module V1beta
|
48
73
|
# rubocop:enable LineLength
|
49
74
|
|
@@ -77,11 +102,18 @@ module Google
|
|
77
102
|
# or the specified config is missing data points.
|
78
103
|
# @param timeout [Numeric]
|
79
104
|
# The default timeout, in seconds, for calls made through this client.
|
105
|
+
# @param metadata [Hash]
|
106
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
107
|
+
# @param exception_transformer [Proc]
|
108
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
109
|
+
# custom error handling.
|
80
110
|
def self.new \
|
81
111
|
credentials: nil,
|
82
112
|
scopes: nil,
|
83
113
|
client_config: nil,
|
84
114
|
timeout: nil,
|
115
|
+
metadata: nil,
|
116
|
+
exception_transformer: nil,
|
85
117
|
lib_name: nil,
|
86
118
|
lib_version: nil
|
87
119
|
kwargs = {
|
@@ -89,6 +121,8 @@ module Google
|
|
89
121
|
scopes: scopes,
|
90
122
|
client_config: client_config,
|
91
123
|
timeout: timeout,
|
124
|
+
metadata: metadata,
|
125
|
+
exception_transformer: exception_transformer,
|
92
126
|
lib_name: lib_name,
|
93
127
|
lib_version: lib_version
|
94
128
|
}.select { |_, v| v != nil }
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright 2018 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
|
+
require "googleauth"
|
16
|
+
|
17
|
+
module Google
|
18
|
+
module Cloud
|
19
|
+
module OsLogin
|
20
|
+
module V1beta
|
21
|
+
class Credentials < Google::Auth::Credentials
|
22
|
+
SCOPE = [
|
23
|
+
"https://www.googleapis.com/auth/cloud-platform",
|
24
|
+
"https://www.googleapis.com/auth/cloud-platform.read-only",
|
25
|
+
"https://www.googleapis.com/auth/compute",
|
26
|
+
"https://www.googleapis.com/auth/compute.readonly"
|
27
|
+
].freeze
|
28
|
+
PATH_ENV_VARS = %w(OS_LOGIN_CREDENTIALS
|
29
|
+
OS_LOGIN_KEYFILE
|
30
|
+
GOOGLE_CLOUD_CREDENTIALS
|
31
|
+
GOOGLE_CLOUD_KEYFILE
|
32
|
+
GCLOUD_KEYFILE)
|
33
|
+
JSON_ENV_VARS = %w(OS_LOGIN_CREDENTIALS_JSON
|
34
|
+
OS_LOGIN_KEYFILE_JSON
|
35
|
+
GOOGLE_CLOUD_CREDENTIALS_JSON
|
36
|
+
GOOGLE_CLOUD_KEYFILE_JSON
|
37
|
+
GCLOUD_KEYFILE_JSON)
|
38
|
+
DEFAULT_PATHS = ["~/.config/gcloud/application_default_credentials.json"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# Copyright 2018 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
|
+
module Google
|
16
|
+
module Cloud
|
17
|
+
module Oslogin
|
18
|
+
module Common
|
19
|
+
# The POSIX account information associated with a Google account.
|
20
|
+
# @!attribute [rw] primary
|
21
|
+
# @return [true, false]
|
22
|
+
# Only one POSIX account can be marked as primary.
|
23
|
+
# @!attribute [rw] username
|
24
|
+
# @return [String]
|
25
|
+
# The username of the POSIX account.
|
26
|
+
# @!attribute [rw] uid
|
27
|
+
# @return [Integer]
|
28
|
+
# The user ID.
|
29
|
+
# @!attribute [rw] gid
|
30
|
+
# @return [Integer]
|
31
|
+
# The default group ID.
|
32
|
+
# @!attribute [rw] home_directory
|
33
|
+
# @return [String]
|
34
|
+
# The path to the home directory for this account.
|
35
|
+
# @!attribute [rw] shell
|
36
|
+
# @return [String]
|
37
|
+
# The path to the logic shell for this account.
|
38
|
+
# @!attribute [rw] gecos
|
39
|
+
# @return [String]
|
40
|
+
# The GECOS (user information) entry for this account.
|
41
|
+
# @!attribute [rw] system_id
|
42
|
+
# @return [String]
|
43
|
+
# System identifier for which account the username or uid applies to.
|
44
|
+
# By default, the empty value is used.
|
45
|
+
# @!attribute [rw] account_id
|
46
|
+
# @return [String]
|
47
|
+
# Output only. A POSIX account identifier.
|
48
|
+
class PosixAccount; end
|
49
|
+
|
50
|
+
# The SSH public key information associated with a Google account.
|
51
|
+
# @!attribute [rw] key
|
52
|
+
# @return [String]
|
53
|
+
# Public key text in SSH format, defined by
|
54
|
+
# <a href="https://www.ietf.org/rfc/rfc4253.txt" target="_blank">RFC4253</a>
|
55
|
+
# section 6.6.
|
56
|
+
# @!attribute [rw] expiration_time_usec
|
57
|
+
# @return [Integer]
|
58
|
+
# An expiration time in microseconds since epoch.
|
59
|
+
# @!attribute [rw] fingerprint
|
60
|
+
# @return [String]
|
61
|
+
# Output only. The SHA-256 fingerprint of the SSH public key.
|
62
|
+
class SshPublicKey; end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -20,7 +20,7 @@ module Google
|
|
20
20
|
#
|
21
21
|
# | Class | Description |
|
22
22
|
# | ----- | ----------- |
|
23
|
-
# | [OsLoginServiceClient][] |
|
23
|
+
# | [OsLoginServiceClient][] | Cloud OS Login API |
|
24
24
|
# | [Data Types][] | Data types for Google::Cloud::OsLogin::V1beta |
|
25
25
|
#
|
26
26
|
# [OsLoginServiceClient]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-os_login/latest/google/cloud/oslogin/v1beta/osloginserviceclient
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright 2018 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
|
+
module Google
|
16
|
+
module Protobuf
|
17
|
+
# A generic empty message that you can re-use to avoid defining duplicated
|
18
|
+
# empty messages in your APIs. A typical example is to use it as the request
|
19
|
+
# or the response type of an API method. For instance:
|
20
|
+
#
|
21
|
+
# service Foo {
|
22
|
+
# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
23
|
+
# }
|
24
|
+
#
|
25
|
+
# The JSON representation for +Empty+ is empty JSON object +{}+.
|
26
|
+
class Empty; end
|
27
|
+
end
|
28
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -29,7 +29,7 @@ module Google
|
|
29
29
|
#
|
30
30
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
31
31
|
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
32
|
-
# 3. [Enable the Google Cloud OS Login API.](https://console.cloud.google.com/apis/
|
32
|
+
# 3. [Enable the Google Cloud OS Login API.](https://console.cloud.google.com/apis/library/oslogin.googleapis.com)
|
33
33
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
34
34
|
#
|
35
35
|
# ### Installation
|
@@ -45,6 +45,31 @@ module Google
|
|
45
45
|
#
|
46
46
|
# [Product Documentation]: https://cloud.google.com/compute/docs/oslogin/rest/
|
47
47
|
#
|
48
|
+
# ## Enabling Logging
|
49
|
+
#
|
50
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
51
|
+
# The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
|
52
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
53
|
+
# that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
54
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
55
|
+
#
|
56
|
+
# Configuring a Ruby stdlib logger:
|
57
|
+
#
|
58
|
+
# ```ruby
|
59
|
+
# require "logger"
|
60
|
+
#
|
61
|
+
# module MyLogger
|
62
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
63
|
+
# def logger
|
64
|
+
# LOGGER
|
65
|
+
# end
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
69
|
+
# module GRPC
|
70
|
+
# extend MyLogger
|
71
|
+
# end
|
72
|
+
# ```
|
48
73
|
#
|
49
74
|
module OsLogin
|
50
75
|
module V1beta
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2018 Google LLC
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -18,9 +18,6 @@
|
|
18
18
|
# and updates to that file get reflected here through a refresh process.
|
19
19
|
# For the short term, the refresh process will only be runnable by Google
|
20
20
|
# engineers.
|
21
|
-
#
|
22
|
-
# The only allowed edits are to method and file documentation. A 3-way
|
23
|
-
# merge preserves those additions if the generated source changes.
|
24
21
|
|
25
22
|
require "json"
|
26
23
|
require "pathname"
|
@@ -28,7 +25,7 @@ require "pathname"
|
|
28
25
|
require "google/gax"
|
29
26
|
|
30
27
|
require "google/cloud/oslogin/v1beta/oslogin_pb"
|
31
|
-
require "google/cloud/os_login/credentials"
|
28
|
+
require "google/cloud/os_login/v1beta/credentials"
|
32
29
|
|
33
30
|
module Google
|
34
31
|
module Cloud
|
@@ -50,6 +47,9 @@ module Google
|
|
50
47
|
# The default port of the service.
|
51
48
|
DEFAULT_SERVICE_PORT = 443
|
52
49
|
|
50
|
+
# The default set of gRPC interceptors.
|
51
|
+
GRPC_INTERCEPTORS = []
|
52
|
+
|
53
53
|
DEFAULT_TIMEOUT = 30
|
54
54
|
|
55
55
|
# The scopes needed to make gRPC calls to all of the methods defined in
|
@@ -135,11 +135,18 @@ module Google
|
|
135
135
|
# or the specified config is missing data points.
|
136
136
|
# @param timeout [Numeric]
|
137
137
|
# The default timeout, in seconds, for calls made through this client.
|
138
|
+
# @param metadata [Hash]
|
139
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
140
|
+
# @param exception_transformer [Proc]
|
141
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
142
|
+
# custom error handling.
|
138
143
|
def initialize \
|
139
144
|
credentials: nil,
|
140
145
|
scopes: ALL_SCOPES,
|
141
146
|
client_config: {},
|
142
147
|
timeout: DEFAULT_TIMEOUT,
|
148
|
+
metadata: nil,
|
149
|
+
exception_transformer: nil,
|
143
150
|
lib_name: nil,
|
144
151
|
lib_version: ""
|
145
152
|
# These require statements are intentionally placed here to initialize
|
@@ -148,10 +155,10 @@ module Google
|
|
148
155
|
require "google/gax/grpc"
|
149
156
|
require "google/cloud/oslogin/v1beta/oslogin_services_pb"
|
150
157
|
|
151
|
-
credentials ||= Google::Cloud::OsLogin::Credentials.default
|
158
|
+
credentials ||= Google::Cloud::OsLogin::V1beta::Credentials.default
|
152
159
|
|
153
160
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
154
|
-
updater_proc = Google::Cloud::OsLogin::Credentials.new(credentials).updater_proc
|
161
|
+
updater_proc = Google::Cloud::OsLogin::V1beta::Credentials.new(credentials).updater_proc
|
155
162
|
end
|
156
163
|
if credentials.is_a?(GRPC::Core::Channel)
|
157
164
|
channel = credentials
|
@@ -175,6 +182,7 @@ module Google
|
|
175
182
|
google_api_client.freeze
|
176
183
|
|
177
184
|
headers = { :"x-goog-api-client" => google_api_client }
|
185
|
+
headers.merge!(metadata) unless metadata.nil?
|
178
186
|
client_config_file = Pathname.new(__dir__).join(
|
179
187
|
"os_login_service_client_config.json"
|
180
188
|
)
|
@@ -186,13 +194,14 @@ module Google
|
|
186
194
|
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
187
195
|
timeout,
|
188
196
|
errors: Google::Gax::Grpc::API_ERRORS,
|
189
|
-
|
197
|
+
metadata: headers
|
190
198
|
)
|
191
199
|
end
|
192
200
|
|
193
201
|
# Allow overriding the service path/port in subclasses.
|
194
202
|
service_path = self.class::SERVICE_ADDRESS
|
195
203
|
port = self.class::DEFAULT_SERVICE_PORT
|
204
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
196
205
|
@os_login_service_stub = Google::Gax::Grpc.create_stub(
|
197
206
|
service_path,
|
198
207
|
port,
|
@@ -200,32 +209,39 @@ module Google
|
|
200
209
|
channel: channel,
|
201
210
|
updater_proc: updater_proc,
|
202
211
|
scopes: scopes,
|
212
|
+
interceptors: interceptors,
|
203
213
|
&Google::Cloud::Oslogin::V1beta::OsLoginService::Stub.method(:new)
|
204
214
|
)
|
205
215
|
|
206
216
|
@delete_posix_account = Google::Gax.create_api_call(
|
207
217
|
@os_login_service_stub.method(:delete_posix_account),
|
208
|
-
defaults["delete_posix_account"]
|
218
|
+
defaults["delete_posix_account"],
|
219
|
+
exception_transformer: exception_transformer
|
209
220
|
)
|
210
221
|
@delete_ssh_public_key = Google::Gax.create_api_call(
|
211
222
|
@os_login_service_stub.method(:delete_ssh_public_key),
|
212
|
-
defaults["delete_ssh_public_key"]
|
223
|
+
defaults["delete_ssh_public_key"],
|
224
|
+
exception_transformer: exception_transformer
|
213
225
|
)
|
214
226
|
@get_login_profile = Google::Gax.create_api_call(
|
215
227
|
@os_login_service_stub.method(:get_login_profile),
|
216
|
-
defaults["get_login_profile"]
|
228
|
+
defaults["get_login_profile"],
|
229
|
+
exception_transformer: exception_transformer
|
217
230
|
)
|
218
231
|
@get_ssh_public_key = Google::Gax.create_api_call(
|
219
232
|
@os_login_service_stub.method(:get_ssh_public_key),
|
220
|
-
defaults["get_ssh_public_key"]
|
233
|
+
defaults["get_ssh_public_key"],
|
234
|
+
exception_transformer: exception_transformer
|
221
235
|
)
|
222
236
|
@import_ssh_public_key = Google::Gax.create_api_call(
|
223
237
|
@os_login_service_stub.method(:import_ssh_public_key),
|
224
|
-
defaults["import_ssh_public_key"]
|
238
|
+
defaults["import_ssh_public_key"],
|
239
|
+
exception_transformer: exception_transformer
|
225
240
|
)
|
226
241
|
@update_ssh_public_key = Google::Gax.create_api_call(
|
227
242
|
@os_login_service_stub.method(:update_ssh_public_key),
|
228
|
-
defaults["update_ssh_public_key"]
|
243
|
+
defaults["update_ssh_public_key"],
|
244
|
+
exception_transformer: exception_transformer
|
229
245
|
)
|
230
246
|
end
|
231
247
|
|
@@ -240,22 +256,26 @@ module Google
|
|
240
256
|
# @param options [Google::Gax::CallOptions]
|
241
257
|
# Overrides the default settings for this call, e.g, timeout,
|
242
258
|
# retries, etc.
|
259
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
260
|
+
# @yieldparam result []
|
261
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
243
262
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
244
263
|
# @example
|
245
|
-
# require "google/cloud/os_login
|
264
|
+
# require "google/cloud/os_login"
|
246
265
|
#
|
247
|
-
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new
|
266
|
+
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
248
267
|
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.project_path("[USER]", "[PROJECT]")
|
249
268
|
# os_login_service_client.delete_posix_account(formatted_name)
|
250
269
|
|
251
270
|
def delete_posix_account \
|
252
271
|
name,
|
253
|
-
options: nil
|
272
|
+
options: nil,
|
273
|
+
&block
|
254
274
|
req = {
|
255
275
|
name: name
|
256
276
|
}.delete_if { |_, v| v.nil? }
|
257
277
|
req = Google::Gax::to_proto(req, Google::Cloud::Oslogin::V1beta::DeletePosixAccountRequest)
|
258
|
-
@delete_posix_account.call(req, options)
|
278
|
+
@delete_posix_account.call(req, options, &block)
|
259
279
|
nil
|
260
280
|
end
|
261
281
|
|
@@ -268,22 +288,26 @@ module Google
|
|
268
288
|
# @param options [Google::Gax::CallOptions]
|
269
289
|
# Overrides the default settings for this call, e.g, timeout,
|
270
290
|
# retries, etc.
|
291
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
292
|
+
# @yieldparam result []
|
293
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
271
294
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
272
295
|
# @example
|
273
|
-
# require "google/cloud/os_login
|
296
|
+
# require "google/cloud/os_login"
|
274
297
|
#
|
275
|
-
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new
|
298
|
+
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
276
299
|
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.fingerprint_path("[USER]", "[FINGERPRINT]")
|
277
300
|
# os_login_service_client.delete_ssh_public_key(formatted_name)
|
278
301
|
|
279
302
|
def delete_ssh_public_key \
|
280
303
|
name,
|
281
|
-
options: nil
|
304
|
+
options: nil,
|
305
|
+
&block
|
282
306
|
req = {
|
283
307
|
name: name
|
284
308
|
}.delete_if { |_, v| v.nil? }
|
285
309
|
req = Google::Gax::to_proto(req, Google::Cloud::Oslogin::V1beta::DeleteSshPublicKeyRequest)
|
286
|
-
@delete_ssh_public_key.call(req, options)
|
310
|
+
@delete_ssh_public_key.call(req, options, &block)
|
287
311
|
nil
|
288
312
|
end
|
289
313
|
|
@@ -295,23 +319,27 @@ module Google
|
|
295
319
|
# @param options [Google::Gax::CallOptions]
|
296
320
|
# Overrides the default settings for this call, e.g, timeout,
|
297
321
|
# retries, etc.
|
322
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
323
|
+
# @yieldparam result [Google::Cloud::Oslogin::V1beta::LoginProfile]
|
324
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
298
325
|
# @return [Google::Cloud::Oslogin::V1beta::LoginProfile]
|
299
326
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
300
327
|
# @example
|
301
|
-
# require "google/cloud/os_login
|
328
|
+
# require "google/cloud/os_login"
|
302
329
|
#
|
303
|
-
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new
|
330
|
+
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
304
331
|
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.user_path("[USER]")
|
305
332
|
# response = os_login_service_client.get_login_profile(formatted_name)
|
306
333
|
|
307
334
|
def get_login_profile \
|
308
335
|
name,
|
309
|
-
options: nil
|
336
|
+
options: nil,
|
337
|
+
&block
|
310
338
|
req = {
|
311
339
|
name: name
|
312
340
|
}.delete_if { |_, v| v.nil? }
|
313
341
|
req = Google::Gax::to_proto(req, Google::Cloud::Oslogin::V1beta::GetLoginProfileRequest)
|
314
|
-
@get_login_profile.call(req, options)
|
342
|
+
@get_login_profile.call(req, options, &block)
|
315
343
|
end
|
316
344
|
|
317
345
|
# Retrieves an SSH public key.
|
@@ -323,23 +351,27 @@ module Google
|
|
323
351
|
# @param options [Google::Gax::CallOptions]
|
324
352
|
# Overrides the default settings for this call, e.g, timeout,
|
325
353
|
# retries, etc.
|
354
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
355
|
+
# @yieldparam result [Google::Cloud::Oslogin::Common::SshPublicKey]
|
356
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
326
357
|
# @return [Google::Cloud::Oslogin::Common::SshPublicKey]
|
327
358
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
328
359
|
# @example
|
329
|
-
# require "google/cloud/os_login
|
360
|
+
# require "google/cloud/os_login"
|
330
361
|
#
|
331
|
-
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new
|
362
|
+
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
332
363
|
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.fingerprint_path("[USER]", "[FINGERPRINT]")
|
333
364
|
# response = os_login_service_client.get_ssh_public_key(formatted_name)
|
334
365
|
|
335
366
|
def get_ssh_public_key \
|
336
367
|
name,
|
337
|
-
options: nil
|
368
|
+
options: nil,
|
369
|
+
&block
|
338
370
|
req = {
|
339
371
|
name: name
|
340
372
|
}.delete_if { |_, v| v.nil? }
|
341
373
|
req = Google::Gax::to_proto(req, Google::Cloud::Oslogin::V1beta::GetSshPublicKeyRequest)
|
342
|
-
@get_ssh_public_key.call(req, options)
|
374
|
+
@get_ssh_public_key.call(req, options, &block)
|
343
375
|
end
|
344
376
|
|
345
377
|
# Adds an SSH public key and returns the profile information. Default POSIX
|
@@ -357,13 +389,18 @@ module Google
|
|
357
389
|
# @param options [Google::Gax::CallOptions]
|
358
390
|
# Overrides the default settings for this call, e.g, timeout,
|
359
391
|
# retries, etc.
|
392
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
393
|
+
# @yieldparam result [Google::Cloud::Oslogin::V1beta::ImportSshPublicKeyResponse]
|
394
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
360
395
|
# @return [Google::Cloud::Oslogin::V1beta::ImportSshPublicKeyResponse]
|
361
396
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
362
397
|
# @example
|
363
|
-
# require "google/cloud/os_login
|
398
|
+
# require "google/cloud/os_login"
|
364
399
|
#
|
365
|
-
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new
|
400
|
+
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
366
401
|
# formatted_parent = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.user_path("[USER]")
|
402
|
+
#
|
403
|
+
# # TODO: Initialize +ssh_public_key+:
|
367
404
|
# ssh_public_key = {}
|
368
405
|
# response = os_login_service_client.import_ssh_public_key(formatted_parent, ssh_public_key)
|
369
406
|
|
@@ -371,14 +408,15 @@ module Google
|
|
371
408
|
parent,
|
372
409
|
ssh_public_key,
|
373
410
|
project_id: nil,
|
374
|
-
options: nil
|
411
|
+
options: nil,
|
412
|
+
&block
|
375
413
|
req = {
|
376
414
|
parent: parent,
|
377
415
|
ssh_public_key: ssh_public_key,
|
378
416
|
project_id: project_id
|
379
417
|
}.delete_if { |_, v| v.nil? }
|
380
418
|
req = Google::Gax::to_proto(req, Google::Cloud::Oslogin::V1beta::ImportSshPublicKeyRequest)
|
381
|
-
@import_ssh_public_key.call(req, options)
|
419
|
+
@import_ssh_public_key.call(req, options, &block)
|
382
420
|
end
|
383
421
|
|
384
422
|
# Updates an SSH public key and returns the profile information. This method
|
@@ -399,13 +437,18 @@ module Google
|
|
399
437
|
# @param options [Google::Gax::CallOptions]
|
400
438
|
# Overrides the default settings for this call, e.g, timeout,
|
401
439
|
# retries, etc.
|
440
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
441
|
+
# @yieldparam result [Google::Cloud::Oslogin::Common::SshPublicKey]
|
442
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
402
443
|
# @return [Google::Cloud::Oslogin::Common::SshPublicKey]
|
403
444
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
404
445
|
# @example
|
405
|
-
# require "google/cloud/os_login
|
446
|
+
# require "google/cloud/os_login"
|
406
447
|
#
|
407
|
-
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new
|
448
|
+
# os_login_service_client = Google::Cloud::OsLogin::V1beta.new(version: :v1beta)
|
408
449
|
# formatted_name = Google::Cloud::OsLogin::V1beta::OsLoginServiceClient.fingerprint_path("[USER]", "[FINGERPRINT]")
|
450
|
+
#
|
451
|
+
# # TODO: Initialize +ssh_public_key+:
|
409
452
|
# ssh_public_key = {}
|
410
453
|
# response = os_login_service_client.update_ssh_public_key(formatted_name, ssh_public_key)
|
411
454
|
|
@@ -413,14 +456,15 @@ module Google
|
|
413
456
|
name,
|
414
457
|
ssh_public_key,
|
415
458
|
update_mask: nil,
|
416
|
-
options: nil
|
459
|
+
options: nil,
|
460
|
+
&block
|
417
461
|
req = {
|
418
462
|
name: name,
|
419
463
|
ssh_public_key: ssh_public_key,
|
420
464
|
update_mask: update_mask
|
421
465
|
}.delete_if { |_, v| v.nil? }
|
422
466
|
req = Google::Gax::to_proto(req, Google::Cloud::Oslogin::V1beta::UpdateSshPublicKeyRequest)
|
423
|
-
@update_ssh_public_key.call(req, options)
|
467
|
+
@update_ssh_public_key.call(req, options, &block)
|
424
468
|
end
|
425
469
|
end
|
426
470
|
end
|