google-cloud-dataproc 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/README.md +39 -2
- data/lib/google/cloud/dataproc.rb +38 -3
- data/lib/google/cloud/dataproc/v1.rb +96 -51
- data/lib/google/cloud/dataproc/v1/cluster_controller_client.rb +95 -31
- data/lib/google/cloud/dataproc/v1/credentials.rb +40 -0
- data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/clusters.rb +1 -14
- data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/jobs.rb +1 -14
- data/lib/google/cloud/dataproc/v1/doc/google/longrunning/operations.rb +92 -0
- data/lib/google/cloud/dataproc/v1/doc/google/protobuf/any.rb +1 -1
- data/lib/google/cloud/dataproc/v1/doc/google/protobuf/duration.rb +1 -1
- data/lib/google/cloud/dataproc/{credentials.rb → v1/doc/google/protobuf/empty.rb} +13 -15
- data/lib/google/cloud/dataproc/v1/doc/google/protobuf/field_mask.rb +1 -1
- data/lib/google/cloud/dataproc/v1/doc/google/protobuf/timestamp.rb +1 -1
- data/lib/google/cloud/dataproc/v1/doc/google/rpc/status.rb +1 -1
- data/lib/google/cloud/dataproc/v1/doc/overview.rb +28 -3
- data/lib/google/cloud/dataproc/v1/job_controller_client.rb +116 -38
- metadata +41 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82fffc37ffbdc3c80e4d201f3f065194c533932ca4c1b694da53d4e4aa5e1e0b
|
4
|
+
data.tar.gz: 6285efe037bddb8c0e8d6af7ea4dc683a8fbccd22077205ea5b3037c29254b53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10d3e25d19999182b465c3abef17e4168570e0f7cd6cc48eab36966e9045c90d8966cc6f116b4426741cc099f81e6ef8ad204a89c7e775a8a236f5931baa8e3e
|
7
|
+
data.tar.gz: 88b14bbe624b91520adc143757b246c53751d3aa9b35a99010c8fc30ae93e3f26150f86d85458161eb824c4b3ccbb4b9575f48675a1a2816090eb36455d21fb9
|
data/.yardopts
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Ruby Client for Google Cloud Dataproc API ([
|
1
|
+
# Ruby Client for Google Cloud Dataproc API ([Beta](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
2
2
|
|
3
3
|
[Google Cloud Dataproc API][Product Documentation]:
|
4
4
|
Manages Hadoop-based clusters and jobs on Google Cloud Platform.
|
@@ -11,7 +11,7 @@ steps:
|
|
11
11
|
|
12
12
|
1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
13
13
|
2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
14
|
-
3. [Enable the Google Cloud Dataproc API.](https://console.cloud.google.com/apis/
|
14
|
+
3. [Enable the Google Cloud Dataproc API.](https://console.cloud.google.com/apis/library/dataproc.googleapis.com)
|
15
15
|
4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
16
16
|
|
17
17
|
### Installation
|
@@ -52,3 +52,40 @@ end
|
|
52
52
|
|
53
53
|
[Client Library Documentation]: https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-dataproc/latest/google/cloud/dataproc/v1
|
54
54
|
[Product Documentation]: https://cloud.google.com/dataproc
|
55
|
+
|
56
|
+
## Enabling Logging
|
57
|
+
|
58
|
+
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
59
|
+
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,
|
60
|
+
or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
61
|
+
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)
|
62
|
+
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
63
|
+
|
64
|
+
Configuring a Ruby stdlib logger:
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
require "logger"
|
68
|
+
|
69
|
+
module MyLogger
|
70
|
+
LOGGER = Logger.new $stderr, level: Logger::WARN
|
71
|
+
def logger
|
72
|
+
LOGGER
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
77
|
+
module GRPC
|
78
|
+
extend MyLogger
|
79
|
+
end
|
80
|
+
```
|
81
|
+
|
82
|
+
## Supported Ruby Versions
|
83
|
+
|
84
|
+
This library is supported on Ruby 2.3+.
|
85
|
+
|
86
|
+
Google provides official support for Ruby versions that are actively supported
|
87
|
+
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
88
|
+
in security maintenance, and not end of life. Currently, this means Ruby 2.3
|
89
|
+
and later. Older versions of Ruby _may_ still work, but are unsupported and not
|
90
|
+
recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details
|
91
|
+
about the Ruby support schedule.
|
@@ -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
|
# rubocop:disable LineLength
|
21
21
|
|
22
22
|
##
|
23
|
-
# # Ruby Client for Google Cloud Dataproc API ([
|
23
|
+
# # Ruby Client for Google Cloud Dataproc API ([Beta](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
24
24
|
#
|
25
25
|
# [Google Cloud Dataproc API][Product Documentation]:
|
26
26
|
# Manages Hadoop-based clusters and jobs on Google Cloud Platform.
|
@@ -32,7 +32,7 @@ module Google
|
|
32
32
|
#
|
33
33
|
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
34
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 Dataproc API.](https://console.cloud.google.com/apis/
|
35
|
+
# 3. [Enable the Google Cloud Dataproc API.](https://console.cloud.google.com/apis/library/dataproc.googleapis.com)
|
36
36
|
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
37
|
#
|
38
38
|
# ### Preview
|
@@ -66,6 +66,31 @@ module Google
|
|
66
66
|
#
|
67
67
|
# [Product Documentation]: https://cloud.google.com/dataproc
|
68
68
|
#
|
69
|
+
# ## Enabling Logging
|
70
|
+
#
|
71
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
72
|
+
# 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,
|
73
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
74
|
+
# 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)
|
75
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
76
|
+
#
|
77
|
+
# Configuring a Ruby stdlib logger:
|
78
|
+
#
|
79
|
+
# ```ruby
|
80
|
+
# require "logger"
|
81
|
+
#
|
82
|
+
# module MyLogger
|
83
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
84
|
+
# def logger
|
85
|
+
# LOGGER
|
86
|
+
# end
|
87
|
+
# end
|
88
|
+
#
|
89
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
90
|
+
# module GRPC
|
91
|
+
# extend MyLogger
|
92
|
+
# end
|
93
|
+
# ```
|
69
94
|
#
|
70
95
|
module Dataproc
|
71
96
|
# rubocop:enable LineLength
|
@@ -111,6 +136,11 @@ module Google
|
|
111
136
|
# or the specified config is missing data points.
|
112
137
|
# @param timeout [Numeric]
|
113
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 exception_transformer [Proc]
|
142
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
143
|
+
# custom error handling.
|
114
144
|
def self.new(*args, version: :v1, **kwargs)
|
115
145
|
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
|
116
146
|
raise "The version: #{version} is not available. The available versions " \
|
@@ -158,6 +188,11 @@ module Google
|
|
158
188
|
# or the specified config is missing data points.
|
159
189
|
# @param timeout [Numeric]
|
160
190
|
# The default timeout, in seconds, for calls made through this client.
|
191
|
+
# @param metadata [Hash]
|
192
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
193
|
+
# @param exception_transformer [Proc]
|
194
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
195
|
+
# custom error handling.
|
161
196
|
def self.new(*args, version: :v1, **kwargs)
|
162
197
|
unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
|
163
198
|
raise "The version: #{version} is not available. The available versions " \
|
@@ -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.
|
@@ -14,60 +14,87 @@
|
|
14
14
|
|
15
15
|
require "google/cloud/dataproc/v1/cluster_controller_client"
|
16
16
|
require "google/cloud/dataproc/v1/job_controller_client"
|
17
|
+
require "google/cloud/dataproc/v1/operations_pb"
|
18
|
+
require "google/cloud/dataproc/v1/clusters_pb"
|
17
19
|
|
18
20
|
module Google
|
19
21
|
module Cloud
|
20
|
-
# rubocop:disable LineLength
|
21
|
-
|
22
|
-
##
|
23
|
-
# # Ruby Client for Google Cloud Dataproc API ([Alpha](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
24
|
-
#
|
25
|
-
# [Google Cloud Dataproc API][Product Documentation]:
|
26
|
-
# Manages Hadoop-based clusters and jobs on Google Cloud Platform.
|
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 Dataproc API.](https://console.cloud.google.com/apis/api/dataproc)
|
36
|
-
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
37
|
-
#
|
38
|
-
# ### Preview
|
39
|
-
# #### ClusterControllerClient
|
40
|
-
# ```rb
|
41
|
-
# require "google/cloud/dataproc/v1"
|
42
|
-
#
|
43
|
-
# cluster_controller_client = Google::Cloud::Dataproc::V1::ClusterController.new
|
44
|
-
# project_id_2 = project_id
|
45
|
-
# region = "global"
|
46
|
-
#
|
47
|
-
# # Iterate over all results.
|
48
|
-
# cluster_controller_client.list_clusters(project_id_2, region).each do |element|
|
49
|
-
# # Process element.
|
50
|
-
# end
|
51
|
-
#
|
52
|
-
# # Or iterate over results one page at a time.
|
53
|
-
# cluster_controller_client.list_clusters(project_id_2, region).each_page do |page|
|
54
|
-
# # Process each page at a time.
|
55
|
-
# page.each do |element|
|
56
|
-
# # Process element.
|
57
|
-
# end
|
58
|
-
# end
|
59
|
-
# ```
|
60
|
-
#
|
61
|
-
# ### Next Steps
|
62
|
-
# - Read the [Google Cloud Dataproc API Product documentation][Product Documentation]
|
63
|
-
# to learn more about the product and see How-to Guides.
|
64
|
-
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
65
|
-
# to see the full list of Cloud APIs that we cover.
|
66
|
-
#
|
67
|
-
# [Product Documentation]: https://cloud.google.com/dataproc
|
68
|
-
#
|
69
|
-
#
|
70
22
|
module Dataproc
|
23
|
+
# rubocop:disable LineLength
|
24
|
+
|
25
|
+
##
|
26
|
+
# # Ruby Client for Google Cloud Dataproc API ([Beta](https://github.com/GoogleCloudPlatform/google-cloud-ruby#versioning))
|
27
|
+
#
|
28
|
+
# [Google Cloud Dataproc API][Product Documentation]:
|
29
|
+
# Manages Hadoop-based clusters and jobs on Google Cloud Platform.
|
30
|
+
# - [Product Documentation][]
|
31
|
+
#
|
32
|
+
# ## Quick Start
|
33
|
+
# In order to use this library, you first need to go through the following
|
34
|
+
# steps:
|
35
|
+
#
|
36
|
+
# 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
|
37
|
+
# 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
|
38
|
+
# 3. [Enable the Google Cloud Dataproc API.](https://console.cloud.google.com/apis/library/dataproc.googleapis.com)
|
39
|
+
# 4. [Setup Authentication.](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud/master/guides/authentication)
|
40
|
+
#
|
41
|
+
# ### Preview
|
42
|
+
# #### ClusterControllerClient
|
43
|
+
# ```rb
|
44
|
+
# require "google/cloud/dataproc"
|
45
|
+
#
|
46
|
+
# cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
|
47
|
+
# project_id_2 = project_id
|
48
|
+
# region = "global"
|
49
|
+
#
|
50
|
+
# # Iterate over all results.
|
51
|
+
# cluster_controller_client.list_clusters(project_id_2, region).each do |element|
|
52
|
+
# # Process element.
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# # Or iterate over results one page at a time.
|
56
|
+
# cluster_controller_client.list_clusters(project_id_2, region).each_page do |page|
|
57
|
+
# # Process each page at a time.
|
58
|
+
# page.each do |element|
|
59
|
+
# # Process element.
|
60
|
+
# end
|
61
|
+
# end
|
62
|
+
# ```
|
63
|
+
#
|
64
|
+
# ### Next Steps
|
65
|
+
# - Read the [Google Cloud Dataproc API Product documentation][Product Documentation]
|
66
|
+
# to learn more about the product and see How-to Guides.
|
67
|
+
# - View this [repository's main README](https://github.com/GoogleCloudPlatform/google-cloud-ruby/blob/master/README.md)
|
68
|
+
# to see the full list of Cloud APIs that we cover.
|
69
|
+
#
|
70
|
+
# [Product Documentation]: https://cloud.google.com/dataproc
|
71
|
+
#
|
72
|
+
# ## Enabling Logging
|
73
|
+
#
|
74
|
+
# To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
75
|
+
# 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,
|
76
|
+
# or a [`Google::Cloud::Logging::Logger`](https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-logging/latest/google/cloud/logging/logger)
|
77
|
+
# 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)
|
78
|
+
# and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
79
|
+
#
|
80
|
+
# Configuring a Ruby stdlib logger:
|
81
|
+
#
|
82
|
+
# ```ruby
|
83
|
+
# require "logger"
|
84
|
+
#
|
85
|
+
# module MyLogger
|
86
|
+
# LOGGER = Logger.new $stderr, level: Logger::WARN
|
87
|
+
# def logger
|
88
|
+
# LOGGER
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
|
93
|
+
# module GRPC
|
94
|
+
# extend MyLogger
|
95
|
+
# end
|
96
|
+
# ```
|
97
|
+
#
|
71
98
|
module V1
|
72
99
|
# rubocop:enable LineLength
|
73
100
|
|
@@ -100,11 +127,18 @@ module Google
|
|
100
127
|
# or the specified config is missing data points.
|
101
128
|
# @param timeout [Numeric]
|
102
129
|
# The default timeout, in seconds, for calls made through this client.
|
130
|
+
# @param metadata [Hash]
|
131
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
132
|
+
# @param exception_transformer [Proc]
|
133
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
134
|
+
# custom error handling.
|
103
135
|
def self.new \
|
104
136
|
credentials: nil,
|
105
137
|
scopes: nil,
|
106
138
|
client_config: nil,
|
107
139
|
timeout: nil,
|
140
|
+
metadata: nil,
|
141
|
+
exception_transformer: nil,
|
108
142
|
lib_name: nil,
|
109
143
|
lib_version: nil
|
110
144
|
kwargs = {
|
@@ -112,6 +146,8 @@ module Google
|
|
112
146
|
scopes: scopes,
|
113
147
|
client_config: client_config,
|
114
148
|
timeout: timeout,
|
149
|
+
metadata: metadata,
|
150
|
+
exception_transformer: exception_transformer,
|
115
151
|
lib_name: lib_name,
|
116
152
|
lib_version: lib_version
|
117
153
|
}.select { |_, v| v != nil }
|
@@ -147,11 +183,18 @@ module Google
|
|
147
183
|
# or the specified config is missing data points.
|
148
184
|
# @param timeout [Numeric]
|
149
185
|
# The default timeout, in seconds, for calls made through this client.
|
186
|
+
# @param metadata [Hash]
|
187
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
188
|
+
# @param exception_transformer [Proc]
|
189
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
190
|
+
# custom error handling.
|
150
191
|
def self.new \
|
151
192
|
credentials: nil,
|
152
193
|
scopes: nil,
|
153
194
|
client_config: nil,
|
154
195
|
timeout: nil,
|
196
|
+
metadata: nil,
|
197
|
+
exception_transformer: nil,
|
155
198
|
lib_name: nil,
|
156
199
|
lib_version: nil
|
157
200
|
kwargs = {
|
@@ -159,6 +202,8 @@ module Google
|
|
159
202
|
scopes: scopes,
|
160
203
|
client_config: client_config,
|
161
204
|
timeout: timeout,
|
205
|
+
metadata: metadata,
|
206
|
+
exception_transformer: exception_transformer,
|
162
207
|
lib_name: lib_name,
|
163
208
|
lib_version: lib_version
|
164
209
|
}.select { |_, v| v != nil }
|
@@ -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"
|
@@ -30,7 +27,7 @@ require "google/gax/operation"
|
|
30
27
|
require "google/longrunning/operations_client"
|
31
28
|
|
32
29
|
require "google/cloud/dataproc/v1/clusters_pb"
|
33
|
-
require "google/cloud/dataproc/credentials"
|
30
|
+
require "google/cloud/dataproc/v1/credentials"
|
34
31
|
|
35
32
|
module Google
|
36
33
|
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
|
PAGE_DESCRIPTORS = {
|
@@ -67,8 +67,10 @@ module Google
|
|
67
67
|
"https://www.googleapis.com/auth/cloud-platform"
|
68
68
|
].freeze
|
69
69
|
|
70
|
+
# @private
|
70
71
|
class OperationsClient < Google::Longrunning::OperationsClient
|
71
|
-
SERVICE_ADDRESS = SERVICE_ADDRESS
|
72
|
+
self::SERVICE_ADDRESS = ClusterControllerClient::SERVICE_ADDRESS
|
73
|
+
self::GRPC_INTERCEPTORS = ClusterControllerClient::GRPC_INTERCEPTORS
|
72
74
|
end
|
73
75
|
|
74
76
|
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
@@ -95,11 +97,18 @@ module Google
|
|
95
97
|
# or the specified config is missing data points.
|
96
98
|
# @param timeout [Numeric]
|
97
99
|
# The default timeout, in seconds, for calls made through this client.
|
100
|
+
# @param metadata [Hash]
|
101
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
102
|
+
# @param exception_transformer [Proc]
|
103
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
104
|
+
# custom error handling.
|
98
105
|
def initialize \
|
99
106
|
credentials: nil,
|
100
107
|
scopes: ALL_SCOPES,
|
101
108
|
client_config: {},
|
102
109
|
timeout: DEFAULT_TIMEOUT,
|
110
|
+
metadata: nil,
|
111
|
+
exception_transformer: nil,
|
103
112
|
lib_name: nil,
|
104
113
|
lib_version: ""
|
105
114
|
# These require statements are intentionally placed here to initialize
|
@@ -108,7 +117,7 @@ module Google
|
|
108
117
|
require "google/gax/grpc"
|
109
118
|
require "google/cloud/dataproc/v1/clusters_services_pb"
|
110
119
|
|
111
|
-
credentials ||= Google::Cloud::Dataproc::Credentials.default
|
120
|
+
credentials ||= Google::Cloud::Dataproc::V1::Credentials.default
|
112
121
|
|
113
122
|
@operations_client = OperationsClient.new(
|
114
123
|
credentials: credentials,
|
@@ -120,7 +129,7 @@ module Google
|
|
120
129
|
)
|
121
130
|
|
122
131
|
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
123
|
-
updater_proc = Google::Cloud::Dataproc::Credentials.new(credentials).updater_proc
|
132
|
+
updater_proc = Google::Cloud::Dataproc::V1::Credentials.new(credentials).updater_proc
|
124
133
|
end
|
125
134
|
if credentials.is_a?(GRPC::Core::Channel)
|
126
135
|
channel = credentials
|
@@ -144,6 +153,7 @@ module Google
|
|
144
153
|
google_api_client.freeze
|
145
154
|
|
146
155
|
headers = { :"x-goog-api-client" => google_api_client }
|
156
|
+
headers.merge!(metadata) unless metadata.nil?
|
147
157
|
client_config_file = Pathname.new(__dir__).join(
|
148
158
|
"cluster_controller_client_config.json"
|
149
159
|
)
|
@@ -156,13 +166,14 @@ module Google
|
|
156
166
|
timeout,
|
157
167
|
page_descriptors: PAGE_DESCRIPTORS,
|
158
168
|
errors: Google::Gax::Grpc::API_ERRORS,
|
159
|
-
|
169
|
+
metadata: headers
|
160
170
|
)
|
161
171
|
end
|
162
172
|
|
163
173
|
# Allow overriding the service path/port in subclasses.
|
164
174
|
service_path = self.class::SERVICE_ADDRESS
|
165
175
|
port = self.class::DEFAULT_SERVICE_PORT
|
176
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
166
177
|
@cluster_controller_stub = Google::Gax::Grpc.create_stub(
|
167
178
|
service_path,
|
168
179
|
port,
|
@@ -170,32 +181,39 @@ module Google
|
|
170
181
|
channel: channel,
|
171
182
|
updater_proc: updater_proc,
|
172
183
|
scopes: scopes,
|
184
|
+
interceptors: interceptors,
|
173
185
|
&Google::Cloud::Dataproc::V1::ClusterController::Stub.method(:new)
|
174
186
|
)
|
175
187
|
|
176
188
|
@create_cluster = Google::Gax.create_api_call(
|
177
189
|
@cluster_controller_stub.method(:create_cluster),
|
178
|
-
defaults["create_cluster"]
|
190
|
+
defaults["create_cluster"],
|
191
|
+
exception_transformer: exception_transformer
|
179
192
|
)
|
180
193
|
@update_cluster = Google::Gax.create_api_call(
|
181
194
|
@cluster_controller_stub.method(:update_cluster),
|
182
|
-
defaults["update_cluster"]
|
195
|
+
defaults["update_cluster"],
|
196
|
+
exception_transformer: exception_transformer
|
183
197
|
)
|
184
198
|
@delete_cluster = Google::Gax.create_api_call(
|
185
199
|
@cluster_controller_stub.method(:delete_cluster),
|
186
|
-
defaults["delete_cluster"]
|
200
|
+
defaults["delete_cluster"],
|
201
|
+
exception_transformer: exception_transformer
|
187
202
|
)
|
188
203
|
@get_cluster = Google::Gax.create_api_call(
|
189
204
|
@cluster_controller_stub.method(:get_cluster),
|
190
|
-
defaults["get_cluster"]
|
205
|
+
defaults["get_cluster"],
|
206
|
+
exception_transformer: exception_transformer
|
191
207
|
)
|
192
208
|
@list_clusters = Google::Gax.create_api_call(
|
193
209
|
@cluster_controller_stub.method(:list_clusters),
|
194
|
-
defaults["list_clusters"]
|
210
|
+
defaults["list_clusters"],
|
211
|
+
exception_transformer: exception_transformer
|
195
212
|
)
|
196
213
|
@diagnose_cluster = Google::Gax.create_api_call(
|
197
214
|
@cluster_controller_stub.method(:diagnose_cluster),
|
198
|
-
defaults["diagnose_cluster"]
|
215
|
+
defaults["diagnose_cluster"],
|
216
|
+
exception_transformer: exception_transformer
|
199
217
|
)
|
200
218
|
end
|
201
219
|
|
@@ -218,11 +236,17 @@ module Google
|
|
218
236
|
# @return [Google::Gax::Operation]
|
219
237
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
220
238
|
# @example
|
221
|
-
# require "google/cloud/dataproc
|
239
|
+
# require "google/cloud/dataproc"
|
240
|
+
#
|
241
|
+
# cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
|
222
242
|
#
|
223
|
-
#
|
243
|
+
# # TODO: Initialize +project_id+:
|
224
244
|
# project_id = ''
|
245
|
+
#
|
246
|
+
# # TODO: Initialize +region+:
|
225
247
|
# region = ''
|
248
|
+
#
|
249
|
+
# # TODO: Initialize +cluster+:
|
226
250
|
# cluster = {}
|
227
251
|
#
|
228
252
|
# # Register a callback during the method call.
|
@@ -343,13 +367,23 @@ module Google
|
|
343
367
|
# @return [Google::Gax::Operation]
|
344
368
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
345
369
|
# @example
|
346
|
-
# require "google/cloud/dataproc
|
370
|
+
# require "google/cloud/dataproc"
|
371
|
+
#
|
372
|
+
# cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
|
347
373
|
#
|
348
|
-
#
|
374
|
+
# # TODO: Initialize +project_id+:
|
349
375
|
# project_id = ''
|
376
|
+
#
|
377
|
+
# # TODO: Initialize +region+:
|
350
378
|
# region = ''
|
379
|
+
#
|
380
|
+
# # TODO: Initialize +cluster_name+:
|
351
381
|
# cluster_name = ''
|
382
|
+
#
|
383
|
+
# # TODO: Initialize +cluster+:
|
352
384
|
# cluster = {}
|
385
|
+
#
|
386
|
+
# # TODO: Initialize +update_mask+:
|
353
387
|
# update_mask = {}
|
354
388
|
#
|
355
389
|
# # Register a callback during the method call.
|
@@ -420,11 +454,17 @@ module Google
|
|
420
454
|
# @return [Google::Gax::Operation]
|
421
455
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
422
456
|
# @example
|
423
|
-
# require "google/cloud/dataproc
|
457
|
+
# require "google/cloud/dataproc"
|
458
|
+
#
|
459
|
+
# cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
|
424
460
|
#
|
425
|
-
#
|
461
|
+
# # TODO: Initialize +project_id+:
|
426
462
|
# project_id = ''
|
463
|
+
#
|
464
|
+
# # TODO: Initialize +region+:
|
427
465
|
# region = ''
|
466
|
+
#
|
467
|
+
# # TODO: Initialize +cluster_name+:
|
428
468
|
# cluster_name = ''
|
429
469
|
#
|
430
470
|
# # Register a callback during the method call.
|
@@ -488,14 +528,23 @@ module Google
|
|
488
528
|
# @param options [Google::Gax::CallOptions]
|
489
529
|
# Overrides the default settings for this call, e.g, timeout,
|
490
530
|
# retries, etc.
|
531
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
532
|
+
# @yieldparam result [Google::Cloud::Dataproc::V1::Cluster]
|
533
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
491
534
|
# @return [Google::Cloud::Dataproc::V1::Cluster]
|
492
535
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
493
536
|
# @example
|
494
|
-
# require "google/cloud/dataproc
|
537
|
+
# require "google/cloud/dataproc"
|
538
|
+
#
|
539
|
+
# cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
|
495
540
|
#
|
496
|
-
#
|
541
|
+
# # TODO: Initialize +project_id+:
|
497
542
|
# project_id = ''
|
543
|
+
#
|
544
|
+
# # TODO: Initialize +region+:
|
498
545
|
# region = ''
|
546
|
+
#
|
547
|
+
# # TODO: Initialize +cluster_name+:
|
499
548
|
# cluster_name = ''
|
500
549
|
# response = cluster_controller_client.get_cluster(project_id, region, cluster_name)
|
501
550
|
|
@@ -503,14 +552,15 @@ module Google
|
|
503
552
|
project_id,
|
504
553
|
region,
|
505
554
|
cluster_name,
|
506
|
-
options: nil
|
555
|
+
options: nil,
|
556
|
+
&block
|
507
557
|
req = {
|
508
558
|
project_id: project_id,
|
509
559
|
region: region,
|
510
560
|
cluster_name: cluster_name
|
511
561
|
}.delete_if { |_, v| v.nil? }
|
512
562
|
req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::GetClusterRequest)
|
513
|
-
@get_cluster.call(req, options)
|
563
|
+
@get_cluster.call(req, options, &block)
|
514
564
|
end
|
515
565
|
|
516
566
|
# Lists all regions/{region}/clusters in a project.
|
@@ -549,6 +599,9 @@ module Google
|
|
549
599
|
# @param options [Google::Gax::CallOptions]
|
550
600
|
# Overrides the default settings for this call, e.g, timeout,
|
551
601
|
# retries, etc.
|
602
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
603
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::Cluster>]
|
604
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
552
605
|
# @return [Google::Gax::PagedEnumerable<Google::Cloud::Dataproc::V1::Cluster>]
|
553
606
|
# An enumerable of Google::Cloud::Dataproc::V1::Cluster instances.
|
554
607
|
# See Google::Gax::PagedEnumerable documentation for other
|
@@ -556,10 +609,14 @@ module Google
|
|
556
609
|
# object.
|
557
610
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
558
611
|
# @example
|
559
|
-
# require "google/cloud/dataproc
|
612
|
+
# require "google/cloud/dataproc"
|
613
|
+
#
|
614
|
+
# cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
|
560
615
|
#
|
561
|
-
#
|
616
|
+
# # TODO: Initialize +project_id+:
|
562
617
|
# project_id = ''
|
618
|
+
#
|
619
|
+
# # TODO: Initialize +region+:
|
563
620
|
# region = ''
|
564
621
|
#
|
565
622
|
# # Iterate over all results.
|
@@ -580,7 +637,8 @@ module Google
|
|
580
637
|
region,
|
581
638
|
filter: nil,
|
582
639
|
page_size: nil,
|
583
|
-
options: nil
|
640
|
+
options: nil,
|
641
|
+
&block
|
584
642
|
req = {
|
585
643
|
project_id: project_id,
|
586
644
|
region: region,
|
@@ -588,7 +646,7 @@ module Google
|
|
588
646
|
page_size: page_size
|
589
647
|
}.delete_if { |_, v| v.nil? }
|
590
648
|
req = Google::Gax::to_proto(req, Google::Cloud::Dataproc::V1::ListClustersRequest)
|
591
|
-
@list_clusters.call(req, options)
|
649
|
+
@list_clusters.call(req, options, &block)
|
592
650
|
end
|
593
651
|
|
594
652
|
# Gets cluster diagnostic information.
|
@@ -608,11 +666,17 @@ module Google
|
|
608
666
|
# @return [Google::Gax::Operation]
|
609
667
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
610
668
|
# @example
|
611
|
-
# require "google/cloud/dataproc
|
669
|
+
# require "google/cloud/dataproc"
|
670
|
+
#
|
671
|
+
# cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new(version: :v1)
|
612
672
|
#
|
613
|
-
#
|
673
|
+
# # TODO: Initialize +project_id+:
|
614
674
|
# project_id = ''
|
675
|
+
#
|
676
|
+
# # TODO: Initialize +region+:
|
615
677
|
# region = ''
|
678
|
+
#
|
679
|
+
# # TODO: Initialize +cluster_name+:
|
616
680
|
# cluster_name = ''
|
617
681
|
#
|
618
682
|
# # Register a callback during the method call.
|