google-cloud-dataproc 0.10.0 → 1.0.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.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -2
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +310 -0
  6. data/README.md +33 -44
  7. data/lib/{google/cloud/dataproc/v1/doc/google/protobuf/empty.rb → google-cloud-dataproc.rb} +4 -14
  8. data/lib/google/cloud/dataproc.rb +167 -305
  9. data/lib/google/cloud/dataproc/version.rb +6 -2
  10. metadata +97 -100
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/dataproc/v1.rb +0 -371
  13. data/lib/google/cloud/dataproc/v1/autoscaling_policies_pb.rb +0 -80
  14. data/lib/google/cloud/dataproc/v1/autoscaling_policies_services_pb.rb +0 -59
  15. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service_client.rb +0 -494
  16. data/lib/google/cloud/dataproc/v1/autoscaling_policy_service_client_config.json +0 -51
  17. data/lib/google/cloud/dataproc/v1/cluster_controller_client.rb +0 -824
  18. data/lib/google/cloud/dataproc/v1/cluster_controller_client_config.json +0 -59
  19. data/lib/google/cloud/dataproc/v1/clusters_pb.rb +0 -234
  20. data/lib/google/cloud/dataproc/v1/clusters_services_pb.rb +0 -69
  21. data/lib/google/cloud/dataproc/v1/credentials.rb +0 -41
  22. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/autoscaling_policies.rb +0 -238
  23. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/clusters.rb +0 -819
  24. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/jobs.rb +0 -759
  25. data/lib/google/cloud/dataproc/v1/doc/google/cloud/dataproc/v1/workflow_templates.rb +0 -566
  26. data/lib/google/cloud/dataproc/v1/doc/google/longrunning/operations.rb +0 -51
  27. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/any.rb +0 -131
  28. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/duration.rb +0 -91
  29. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/field_mask.rb +0 -222
  30. data/lib/google/cloud/dataproc/v1/doc/google/protobuf/timestamp.rb +0 -113
  31. data/lib/google/cloud/dataproc/v1/doc/google/rpc/status.rb +0 -39
  32. data/lib/google/cloud/dataproc/v1/job_controller_client.rb +0 -592
  33. data/lib/google/cloud/dataproc/v1/job_controller_client_config.json +0 -59
  34. data/lib/google/cloud/dataproc/v1/jobs_pb.rb +0 -273
  35. data/lib/google/cloud/dataproc/v1/jobs_services_pb.rb +0 -61
  36. data/lib/google/cloud/dataproc/v1/operations_pb.rb +0 -45
  37. data/lib/google/cloud/dataproc/v1/shared_pb.rb +0 -26
  38. data/lib/google/cloud/dataproc/v1/workflow_template_service_client.rb +0 -770
  39. data/lib/google/cloud/dataproc/v1/workflow_template_service_client_config.json +0 -64
  40. data/lib/google/cloud/dataproc/v1/workflow_templates_pb.rb +0 -184
  41. data/lib/google/cloud/dataproc/v1/workflow_templates_services_pb.rb +0 -105
  42. data/lib/google/cloud/dataproc/v1beta2.rb +0 -371
  43. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_pb.rb +0 -80
  44. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policies_services_pb.rb +0 -59
  45. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service_client.rb +0 -494
  46. data/lib/google/cloud/dataproc/v1beta2/autoscaling_policy_service_client_config.json +0 -51
  47. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client.rb +0 -833
  48. data/lib/google/cloud/dataproc/v1beta2/cluster_controller_client_config.json +0 -59
  49. data/lib/google/cloud/dataproc/v1beta2/clusters_pb.rb +0 -241
  50. data/lib/google/cloud/dataproc/v1beta2/clusters_services_pb.rb +0 -69
  51. data/lib/google/cloud/dataproc/v1beta2/credentials.rb +0 -41
  52. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/autoscaling_policies.rb +0 -238
  53. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/clusters.rb +0 -841
  54. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/jobs.rb +0 -728
  55. data/lib/google/cloud/dataproc/v1beta2/doc/google/cloud/dataproc/v1beta2/workflow_templates.rb +0 -579
  56. data/lib/google/cloud/dataproc/v1beta2/doc/google/longrunning/operations.rb +0 -51
  57. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/any.rb +0 -131
  58. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/duration.rb +0 -91
  59. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/empty.rb +0 -29
  60. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/field_mask.rb +0 -222
  61. data/lib/google/cloud/dataproc/v1beta2/doc/google/protobuf/timestamp.rb +0 -113
  62. data/lib/google/cloud/dataproc/v1beta2/doc/google/rpc/status.rb +0 -39
  63. data/lib/google/cloud/dataproc/v1beta2/job_controller_client.rb +0 -592
  64. data/lib/google/cloud/dataproc/v1beta2/job_controller_client_config.json +0 -59
  65. data/lib/google/cloud/dataproc/v1beta2/jobs_pb.rb +0 -261
  66. data/lib/google/cloud/dataproc/v1beta2/jobs_services_pb.rb +0 -61
  67. data/lib/google/cloud/dataproc/v1beta2/operations_pb.rb +0 -44
  68. data/lib/google/cloud/dataproc/v1beta2/shared_pb.rb +0 -30
  69. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client.rb +0 -778
  70. data/lib/google/cloud/dataproc/v1beta2/workflow_template_service_client_config.json +0 -64
  71. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_pb.rb +0 -186
  72. data/lib/google/cloud/dataproc/v1beta2/workflow_templates_services_pb.rb +0 -105
data/README.md CHANGED
@@ -1,64 +1,53 @@
1
- # Ruby Client for Google Cloud Dataproc API
1
+ # Ruby Client for the Cloud Dataproc API
2
+
3
+ API Client library for the Cloud Dataproc API
2
4
 
3
- [Google Cloud Dataproc API][Product Documentation]:
4
5
  Manages Hadoop-based clusters and jobs on Google Cloud Platform.
5
- - [Client Library Documentation][]
6
- - [Product Documentation][]
7
6
 
8
- ## Quick Start
9
- In order to use this library, you first need to go through the following
10
- steps:
7
+ Actual client classes for the various versions of this API are defined in
8
+ _versioned_ client gems, with names of the form `google-cloud-dataproc-v*`.
9
+ The gem `google-cloud-dataproc` is a convenience wrapper library that brings the
10
+ verisoned gems in as dependencies, and provides high-level methods for
11
+ constructing clients.
11
12
 
12
- 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
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/library/dataproc.googleapis.com)
15
- 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-dataproc/latest/file.AUTHENTICATION.html)
13
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-dataproc/latest)
14
+ for this library, google-cloud-dataproc, to see the convenience methods for
15
+ constructing client objects. Reference documentation for the client objects
16
+ themselves can be found in the client library documentation for the versioned
17
+ client gems:
18
+ [google-cloud-dataproc-v1](https://googleapis.dev/ruby/google-cloud-dataproc-v1/latest),
19
+ [google-cloud-dataproc-v1beta2](https://googleapis.dev/ruby/google-cloud-dataproc-v1beta2/latest).
20
+
21
+ See also the [Product Documentation](https://cloud.google.com/dataproc)
22
+ for more usage information.
23
+
24
+ ## Quick Start
16
25
 
17
- ### Installation
18
26
  ```
19
27
  $ gem install google-cloud-dataproc
20
28
  ```
21
29
 
22
- ### Preview
23
- #### ClusterControllerClient
24
- ```rb
25
- require "google/cloud/dataproc"
26
-
27
- cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new
28
- project_id_2 = project_id
29
- region = "global"
30
+ In order to use this library, you first need to go through the following steps:
30
31
 
31
- # Iterate over all results.
32
- cluster_controller_client.list_clusters(project_id_2, region).each do |element|
33
- # Process element.
34
- end
35
-
36
- # Or iterate over results one page at a time.
37
- cluster_controller_client.list_clusters(project_id_2, region).each_page do |page|
38
- # Process each page at a time.
39
- page.each do |element|
40
- # Process element.
41
- end
42
- end
43
- ```
32
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
33
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
34
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/dataproc.googleapis.com)
35
+ 1. {file:AUTHENTICATION.md Set up authentication.}
44
36
 
45
- ### Next Steps
46
- - Read the [Client Library Documentation][] for Google Cloud Dataproc API
47
- to see other available methods on the client.
48
- - Read the [Google Cloud Dataproc API Product documentation][Product Documentation]
49
- to learn more about the product and see How-to Guides.
50
- - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
51
- to see the full list of Cloud APIs that we cover.
37
+ ## Migrating from 0.x versions
52
38
 
53
- [Client Library Documentation]: https://googleapis.dev/ruby/google-cloud-dataproc/latest
54
- [Product Documentation]: https://cloud.google.com/dataproc
39
+ The 1.0 release of the google-cloud-dataproc client is a significant upgrade
40
+ based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
41
+ and includes substantial interface changes. Existing code written for earlier
42
+ versions of this library will likely require updates to use this version.
43
+ See the {file:MIGRATING.md MIGRATING.md} document for more information.
55
44
 
56
45
  ## Enabling Logging
57
46
 
58
47
  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,
48
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
60
49
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
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)
50
+ that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
62
51
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
63
52
 
64
53
  Configuring a Ruby stdlib logger:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,18 +14,6 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
15
18
 
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
19
+ require "google/cloud/dataproc" unless defined? Google::Cloud::Dataproc::VERSION
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,328 +14,188 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # Require this file early so that the version constant gets defined before
20
+ # requiring "google/cloud". This is because google-cloud-core will load the
21
+ # entrypoint (gem name) file, which in turn re-requires this file (hence
22
+ # causing a require cycle) unless the version constant is already defined.
23
+ require "google/cloud/dataproc/version"
15
24
 
16
- require "google/gax"
17
- require "pathname"
25
+ require "googleauth"
26
+ gem "google-cloud-core"
27
+ require "google/cloud" unless defined? ::Google::Cloud.new
28
+ require "google/cloud/config"
29
+
30
+ # Set the default configuration
31
+ ::Google::Cloud.configure.add_config! :dataproc do |config|
32
+ config.add_field! :credentials, nil, match: [::String, ::Hash, ::Google::Auth::Credentials]
33
+ config.add_field! :lib_name, nil, match: ::String
34
+ config.add_field! :lib_version, nil, match: ::String
35
+ config.add_field! :interceptors, nil, match: ::Array
36
+ config.add_field! :timeout, nil, match: ::Numeric
37
+ config.add_field! :metadata, nil, match: ::Hash
38
+ config.add_field! :retry_policy, nil, match: [::Hash, ::Proc]
39
+ end
18
40
 
19
41
  module Google
20
42
  module Cloud
21
- # rubocop:disable LineLength
22
-
23
- ##
24
- # # Ruby Client for Google Cloud Dataproc API
25
- #
26
- # [Google Cloud Dataproc API][Product Documentation]:
27
- # Manages Hadoop-based clusters and jobs on Google Cloud Platform.
28
- # - [Product Documentation][]
29
- #
30
- # ## Quick Start
31
- # In order to use this library, you first need to go through the following
32
- # steps:
33
- #
34
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
35
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
36
- # 3. [Enable the Google Cloud Dataproc API.](https://console.cloud.google.com/apis/library/dataproc.googleapis.com)
37
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-dataproc/latest/file.AUTHENTICATION.html)
38
- #
39
- # ### Installation
40
- # ```
41
- # $ gem install google-cloud-dataproc
42
- # ```
43
- #
44
- # ### Preview
45
- # #### ClusterControllerClient
46
- # ```rb
47
- # require "google/cloud/dataproc"
48
- #
49
- # cluster_controller_client = Google::Cloud::Dataproc::ClusterController.new
50
- # project_id_2 = project_id
51
- # region = "global"
52
- #
53
- # # Iterate over all results.
54
- # cluster_controller_client.list_clusters(project_id_2, region).each do |element|
55
- # # Process element.
56
- # end
57
- #
58
- # # Or iterate over results one page at a time.
59
- # cluster_controller_client.list_clusters(project_id_2, region).each_page do |page|
60
- # # Process each page at a time.
61
- # page.each do |element|
62
- # # Process element.
63
- # end
64
- # end
65
- # ```
66
- #
67
- # ### Next Steps
68
- # - Read the [Google Cloud Dataproc API Product documentation][Product Documentation]
69
- # to learn more about the product and see How-to Guides.
70
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
71
- # to see the full list of Cloud APIs that we cover.
72
- #
73
- # [Product Documentation]: https://cloud.google.com/dataproc
74
- #
75
- # ## Enabling Logging
76
- #
77
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
78
- # 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,
79
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
80
- # 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)
81
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
82
- #
83
- # Configuring a Ruby stdlib logger:
84
- #
85
- # ```ruby
86
- # require "logger"
87
- #
88
- # module MyLogger
89
- # LOGGER = Logger.new $stderr, level: Logger::WARN
90
- # def logger
91
- # LOGGER
92
- # end
93
- # end
94
- #
95
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
96
- # module GRPC
97
- # extend MyLogger
98
- # end
99
- # ```
100
- #
101
43
  module Dataproc
102
- # rubocop:enable LineLength
103
-
104
- FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("dataproc"))
44
+ ##
45
+ # Create a new client object for AutoscalingPolicyService.
46
+ #
47
+ # By default, this returns an instance of
48
+ # [Google::Cloud::Dataproc::V1::AutoscalingPolicyService::Client](https://googleapis.dev/ruby/google-cloud-dataproc-v1/latest/Google/Cloud/Dataproc/V1/AutoscalingPolicyService/Client.html)
49
+ # for version V1 of the API.
50
+ # However, you can specify specify a different API version by passing it in the
51
+ # `version` parameter. If the AutoscalingPolicyService service is
52
+ # supported by that API version, and the corresponding gem is available, the
53
+ # appropriate versioned client will be returned.
54
+ #
55
+ # ## About AutoscalingPolicyService
56
+ #
57
+ # The API interface for managing autoscaling policies in the
58
+ # Dataproc API.
59
+ #
60
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
61
+ # Defaults to `:v1`.
62
+ # @return [AutoscalingPolicyService::Client] A client object for the specified version.
63
+ #
64
+ def self.autoscaling_policy_service version: :v1, &block
65
+ require "google/cloud/dataproc/#{version.to_s.downcase}"
105
66
 
106
- AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
107
- .select { |file| File.directory?(file) }
108
- .select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
109
- .select { |dir| File.exist?(dir + ".rb") }
110
- .map { |dir| File.basename(dir) }
67
+ package_name = Google::Cloud::Dataproc
68
+ .constants
69
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
70
+ .first
71
+ package_module = Google::Cloud::Dataproc.const_get package_name
72
+ package_module.const_get(:AutoscalingPolicyService).const_get(:Client).new(&block)
73
+ end
111
74
 
112
- module AutoscalingPolicyService
113
- ##
114
- # The API interface for managing autoscaling policies in the
115
- # Cloud Dataproc API.
116
- #
117
- # @param version [Symbol, String]
118
- # The major version of the service to be used. By default :v1
119
- # is used.
120
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
121
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
122
- # Provides the means for authenticating requests made by the client. This parameter can
123
- # be many types.
124
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
125
- # authenticating requests made by this client.
126
- # A `String` will be treated as the path to the keyfile to be used for the construction of
127
- # credentials for this client.
128
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
129
- # credentials for this client.
130
- # A `GRPC::Core::Channel` will be used to make calls through.
131
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
132
- # should already be composed with a `GRPC::Core::CallCredentials` object.
133
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
134
- # metadata for requests, generally, to give OAuth credentials.
135
- # @param scopes [Array<String>]
136
- # The OAuth scopes for this service. This parameter is ignored if
137
- # an updater_proc is supplied.
138
- # @param client_config [Hash]
139
- # A Hash for call options for each method. See
140
- # Google::Gax#construct_settings for the structure of
141
- # this data. Falls back to the default config if not specified
142
- # or the specified config is missing data points.
143
- # @param timeout [Numeric]
144
- # The default timeout, in seconds, for calls made through this client.
145
- # @param metadata [Hash]
146
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
147
- # @param service_address [String]
148
- # Override for the service hostname, or `nil` to leave as the default.
149
- # @param service_port [Integer]
150
- # Override for the service port, or `nil` to leave as the default.
151
- # @param exception_transformer [Proc]
152
- # An optional proc that intercepts any exceptions raised during an API call to inject
153
- # custom error handling.
154
- def self.new(*args, version: :v1, **kwargs)
155
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
156
- raise "The version: #{version} is not available. The available versions " \
157
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
158
- end
75
+ ##
76
+ # Create a new client object for ClusterController.
77
+ #
78
+ # By default, this returns an instance of
79
+ # [Google::Cloud::Dataproc::V1::ClusterController::Client](https://googleapis.dev/ruby/google-cloud-dataproc-v1/latest/Google/Cloud/Dataproc/V1/ClusterController/Client.html)
80
+ # for version V1 of the API.
81
+ # However, you can specify specify a different API version by passing it in the
82
+ # `version` parameter. If the ClusterController service is
83
+ # supported by that API version, and the corresponding gem is available, the
84
+ # appropriate versioned client will be returned.
85
+ #
86
+ # ## About ClusterController
87
+ #
88
+ # The ClusterControllerService provides methods to manage clusters
89
+ # of Compute Engine instances.
90
+ #
91
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
92
+ # Defaults to `:v1`.
93
+ # @return [ClusterController::Client] A client object for the specified version.
94
+ #
95
+ def self.cluster_controller version: :v1, &block
96
+ require "google/cloud/dataproc/#{version.to_s.downcase}"
159
97
 
160
- require "#{FILE_DIR}/#{version.to_s.downcase}"
161
- version_module = Google::Cloud::Dataproc
162
- .constants
163
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
164
- .first
165
- Google::Cloud::Dataproc.const_get(version_module)::AutoscalingPolicyService.new(*args, **kwargs)
166
- end
98
+ package_name = Google::Cloud::Dataproc
99
+ .constants
100
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
101
+ .first
102
+ package_module = Google::Cloud::Dataproc.const_get package_name
103
+ package_module.const_get(:ClusterController).const_get(:Client).new(&block)
167
104
  end
168
105
 
169
- module ClusterController
170
- ##
171
- # The ClusterControllerService provides methods to manage clusters
172
- # of Compute Engine instances.
173
- #
174
- # @param version [Symbol, String]
175
- # The major version of the service to be used. By default :v1
176
- # is used.
177
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
178
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
179
- # Provides the means for authenticating requests made by the client. This parameter can
180
- # be many types.
181
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
182
- # authenticating requests made by this client.
183
- # A `String` will be treated as the path to the keyfile to be used for the construction of
184
- # credentials for this client.
185
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
186
- # credentials for this client.
187
- # A `GRPC::Core::Channel` will be used to make calls through.
188
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
189
- # should already be composed with a `GRPC::Core::CallCredentials` object.
190
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
191
- # metadata for requests, generally, to give OAuth credentials.
192
- # @param scopes [Array<String>]
193
- # The OAuth scopes for this service. This parameter is ignored if
194
- # an updater_proc is supplied.
195
- # @param client_config [Hash]
196
- # A Hash for call options for each method. See
197
- # Google::Gax#construct_settings for the structure of
198
- # this data. Falls back to the default config if not specified
199
- # or the specified config is missing data points.
200
- # @param timeout [Numeric]
201
- # The default timeout, in seconds, for calls made through this client.
202
- # @param metadata [Hash]
203
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
204
- # @param service_address [String]
205
- # Override for the service hostname, or `nil` to leave as the default.
206
- # @param service_port [Integer]
207
- # Override for the service port, or `nil` to leave as the default.
208
- # @param exception_transformer [Proc]
209
- # An optional proc that intercepts any exceptions raised during an API call to inject
210
- # custom error handling.
211
- def self.new(*args, version: :v1, **kwargs)
212
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
213
- raise "The version: #{version} is not available. The available versions " \
214
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
215
- end
106
+ ##
107
+ # Create a new client object for JobController.
108
+ #
109
+ # By default, this returns an instance of
110
+ # [Google::Cloud::Dataproc::V1::JobController::Client](https://googleapis.dev/ruby/google-cloud-dataproc-v1/latest/Google/Cloud/Dataproc/V1/JobController/Client.html)
111
+ # for version V1 of the API.
112
+ # However, you can specify specify a different API version by passing it in the
113
+ # `version` parameter. If the JobController service is
114
+ # supported by that API version, and the corresponding gem is available, the
115
+ # appropriate versioned client will be returned.
116
+ #
117
+ # ## About JobController
118
+ #
119
+ # The JobController provides methods to manage jobs.
120
+ #
121
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
122
+ # Defaults to `:v1`.
123
+ # @return [JobController::Client] A client object for the specified version.
124
+ #
125
+ def self.job_controller version: :v1, &block
126
+ require "google/cloud/dataproc/#{version.to_s.downcase}"
216
127
 
217
- require "#{FILE_DIR}/#{version.to_s.downcase}"
218
- version_module = Google::Cloud::Dataproc
219
- .constants
220
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
221
- .first
222
- Google::Cloud::Dataproc.const_get(version_module)::ClusterController.new(*args, **kwargs)
223
- end
128
+ package_name = Google::Cloud::Dataproc
129
+ .constants
130
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
131
+ .first
132
+ package_module = Google::Cloud::Dataproc.const_get package_name
133
+ package_module.const_get(:JobController).const_get(:Client).new(&block)
224
134
  end
225
135
 
226
- module JobController
227
- ##
228
- # The JobController provides methods to manage jobs.
229
- #
230
- # @param version [Symbol, String]
231
- # The major version of the service to be used. By default :v1
232
- # is used.
233
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
234
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
235
- # Provides the means for authenticating requests made by the client. This parameter can
236
- # be many types.
237
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
238
- # authenticating requests made by this client.
239
- # A `String` will be treated as the path to the keyfile to be used for the construction of
240
- # credentials for this client.
241
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
242
- # credentials for this client.
243
- # A `GRPC::Core::Channel` will be used to make calls through.
244
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
245
- # should already be composed with a `GRPC::Core::CallCredentials` object.
246
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
247
- # metadata for requests, generally, to give OAuth credentials.
248
- # @param scopes [Array<String>]
249
- # The OAuth scopes for this service. This parameter is ignored if
250
- # an updater_proc is supplied.
251
- # @param client_config [Hash]
252
- # A Hash for call options for each method. See
253
- # Google::Gax#construct_settings for the structure of
254
- # this data. Falls back to the default config if not specified
255
- # or the specified config is missing data points.
256
- # @param timeout [Numeric]
257
- # The default timeout, in seconds, for calls made through this client.
258
- # @param metadata [Hash]
259
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
260
- # @param service_address [String]
261
- # Override for the service hostname, or `nil` to leave as the default.
262
- # @param service_port [Integer]
263
- # Override for the service port, or `nil` to leave as the default.
264
- # @param exception_transformer [Proc]
265
- # An optional proc that intercepts any exceptions raised during an API call to inject
266
- # custom error handling.
267
- def self.new(*args, version: :v1, **kwargs)
268
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
269
- raise "The version: #{version} is not available. The available versions " \
270
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
271
- end
136
+ ##
137
+ # Create a new client object for WorkflowTemplateService.
138
+ #
139
+ # By default, this returns an instance of
140
+ # [Google::Cloud::Dataproc::V1::WorkflowTemplateService::Client](https://googleapis.dev/ruby/google-cloud-dataproc-v1/latest/Google/Cloud/Dataproc/V1/WorkflowTemplateService/Client.html)
141
+ # for version V1 of the API.
142
+ # However, you can specify specify a different API version by passing it in the
143
+ # `version` parameter. If the WorkflowTemplateService service is
144
+ # supported by that API version, and the corresponding gem is available, the
145
+ # appropriate versioned client will be returned.
146
+ #
147
+ # ## About WorkflowTemplateService
148
+ #
149
+ # The API interface for managing Workflow Templates in the
150
+ # Dataproc API.
151
+ #
152
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
153
+ # Defaults to `:v1`.
154
+ # @return [WorkflowTemplateService::Client] A client object for the specified version.
155
+ #
156
+ def self.workflow_template_service version: :v1, &block
157
+ require "google/cloud/dataproc/#{version.to_s.downcase}"
272
158
 
273
- require "#{FILE_DIR}/#{version.to_s.downcase}"
274
- version_module = Google::Cloud::Dataproc
275
- .constants
276
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
277
- .first
278
- Google::Cloud::Dataproc.const_get(version_module)::JobController.new(*args, **kwargs)
279
- end
159
+ package_name = Google::Cloud::Dataproc
160
+ .constants
161
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
162
+ .first
163
+ package_module = Google::Cloud::Dataproc.const_get package_name
164
+ package_module.const_get(:WorkflowTemplateService).const_get(:Client).new(&block)
280
165
  end
281
166
 
282
- module WorkflowTemplateService
283
- ##
284
- # The API interface for managing Workflow Templates in the
285
- # Dataproc API.
286
- #
287
- # @param version [Symbol, String]
288
- # The major version of the service to be used. By default :v1
289
- # is used.
290
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
291
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
292
- # Provides the means for authenticating requests made by the client. This parameter can
293
- # be many types.
294
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
295
- # authenticating requests made by this client.
296
- # A `String` will be treated as the path to the keyfile to be used for the construction of
297
- # credentials for this client.
298
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
299
- # credentials for this client.
300
- # A `GRPC::Core::Channel` will be used to make calls through.
301
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
302
- # should already be composed with a `GRPC::Core::CallCredentials` object.
303
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
304
- # metadata for requests, generally, to give OAuth credentials.
305
- # @param scopes [Array<String>]
306
- # The OAuth scopes for this service. This parameter is ignored if
307
- # an updater_proc is supplied.
308
- # @param client_config [Hash]
309
- # A Hash for call options for each method. See
310
- # Google::Gax#construct_settings for the structure of
311
- # this data. Falls back to the default config if not specified
312
- # or the specified config is missing data points.
313
- # @param timeout [Numeric]
314
- # The default timeout, in seconds, for calls made through this client.
315
- # @param metadata [Hash]
316
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
317
- # @param service_address [String]
318
- # Override for the service hostname, or `nil` to leave as the default.
319
- # @param service_port [Integer]
320
- # Override for the service port, or `nil` to leave as the default.
321
- # @param exception_transformer [Proc]
322
- # An optional proc that intercepts any exceptions raised during an API call to inject
323
- # custom error handling.
324
- def self.new(*args, version: :v1, **kwargs)
325
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
326
- raise "The version: #{version} is not available. The available versions " \
327
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
328
- end
167
+ ##
168
+ # Configure the google-cloud-dataproc library.
169
+ #
170
+ # The following configuration parameters are supported:
171
+ #
172
+ # * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
173
+ # The path to the keyfile as a String, the contents of the keyfile as a
174
+ # Hash, or a Google::Auth::Credentials object.
175
+ # * `lib_name` (*type:* `String`) -
176
+ # The library name as recorded in instrumentation and logging.
177
+ # * `lib_version` (*type:* `String`) -
178
+ # The library version as recorded in instrumentation and logging.
179
+ # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
180
+ # An array of interceptors that are run before calls are executed.
181
+ # * `timeout` (*type:* `Integer`) -
182
+ # Default timeout in milliseconds.
183
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) -
184
+ # Additional gRPC headers to be sent with the call.
185
+ # * `retry_policy` (*type:* `Hash`) -
186
+ # The retry policy. The value is a hash with the following keys:
187
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
188
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
189
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
190
+ # * `:retry_codes` (*type:* `Array<String>`) -
191
+ # The error codes that should trigger a retry.
192
+ #
193
+ # @return [::Google::Cloud::Config] The default configuration used by this library
194
+ #
195
+ def self.configure
196
+ yield ::Google::Cloud.configure.dataproc if block_given?
329
197
 
330
- require "#{FILE_DIR}/#{version.to_s.downcase}"
331
- version_module = Google::Cloud::Dataproc
332
- .constants
333
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
334
- .first
335
- Google::Cloud::Dataproc.const_get(version_module)::WorkflowTemplateService.new(*args, **kwargs)
336
- end
198
+ ::Google::Cloud.configure.dataproc
337
199
  end
338
200
  end
339
201
  end