google-cloud-orchestration-airflow-service-v1 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +167 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google/cloud/orchestration/airflow/service/v1/environments/client.rb +818 -0
  7. data/lib/google/cloud/orchestration/airflow/service/v1/environments/credentials.rb +51 -0
  8. data/lib/google/cloud/orchestration/airflow/service/v1/environments/operations.rb +668 -0
  9. data/lib/google/cloud/orchestration/airflow/service/v1/environments/paths.rb +56 -0
  10. data/lib/google/cloud/orchestration/airflow/service/v1/environments.rb +54 -0
  11. data/lib/google/cloud/orchestration/airflow/service/v1/environments_pb.rb +173 -0
  12. data/lib/google/cloud/orchestration/airflow/service/v1/environments_services_pb.rb +57 -0
  13. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions/client.rb +380 -0
  14. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions/credentials.rb +51 -0
  15. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions.rb +52 -0
  16. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions_pb.rb +46 -0
  17. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions_services_pb.rb +49 -0
  18. data/lib/google/cloud/orchestration/airflow/service/v1/operations_pb.rb +50 -0
  19. data/lib/google/cloud/orchestration/airflow/service/v1/version.rb +32 -0
  20. data/lib/google/cloud/orchestration/airflow/service/v1.rb +43 -0
  21. data/lib/google-cloud-orchestration-airflow-service-v1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/field_behavior.rb +71 -0
  24. data/proto_docs/google/api/resource.rb +283 -0
  25. data/proto_docs/google/cloud/orchestration/airflow/service/v1/environments.rb +762 -0
  26. data/proto_docs/google/cloud/orchestration/airflow/service/v1/image_versions.rb +88 -0
  27. data/proto_docs/google/cloud/orchestration/airflow/service/v1/operations.rb +94 -0
  28. data/proto_docs/google/longrunning/operations.rb +164 -0
  29. data/proto_docs/google/protobuf/any.rb +141 -0
  30. data/proto_docs/google/protobuf/duration.rb +98 -0
  31. data/proto_docs/google/protobuf/empty.rb +36 -0
  32. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  33. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  34. data/proto_docs/google/rpc/status.rb +46 -0
  35. data/proto_docs/google/type/date.rb +53 -0
  36. metadata +228 -0
@@ -0,0 +1,818 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/orchestration/airflow/service/v1/environments_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Orchestration
25
+ module Airflow
26
+ module Service
27
+ module V1
28
+ module Environments
29
+ ##
30
+ # Client for the Environments service.
31
+ #
32
+ # Managed Apache Airflow Environments.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :environments_stub
39
+
40
+ ##
41
+ # Configure the Environments Client class.
42
+ #
43
+ # See {::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all Environments clients
49
+ # ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "Orchestration", "Airflow", "Service", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config
70
+ end
71
+ yield @configure if block_given?
72
+ @configure
73
+ end
74
+
75
+ ##
76
+ # Configure the Environments Client instance.
77
+ #
78
+ # The configuration is set to the derived mode, meaning that values can be changed,
79
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
80
+ # should be made on {Client.configure}.
81
+ #
82
+ # See {::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client::Configuration}
83
+ # for a description of the configuration fields.
84
+ #
85
+ # @yield [config] Configure the Client client.
86
+ # @yieldparam config [Client::Configuration]
87
+ #
88
+ # @return [Client::Configuration]
89
+ #
90
+ def configure
91
+ yield @config if block_given?
92
+ @config
93
+ end
94
+
95
+ ##
96
+ # Create a new Environments client object.
97
+ #
98
+ # @example
99
+ #
100
+ # # Create a client using the default configuration
101
+ # client = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client.new
102
+ #
103
+ # # Create a client using a custom configuration
104
+ # client = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client.new do |config|
105
+ # config.timeout = 10.0
106
+ # end
107
+ #
108
+ # @yield [config] Configure the Environments client.
109
+ # @yieldparam config [Client::Configuration]
110
+ #
111
+ def initialize
112
+ # These require statements are intentionally placed here to initialize
113
+ # the gRPC module only when it's required.
114
+ # See https://github.com/googleapis/toolkit/issues/446
115
+ require "gapic/grpc"
116
+ require "google/cloud/orchestration/airflow/service/v1/environments_services_pb"
117
+
118
+ # Create the configuration object
119
+ @config = Configuration.new Client.configure
120
+
121
+ # Yield the configuration if needed
122
+ yield @config if block_given?
123
+
124
+ # Create credentials
125
+ credentials = @config.credentials
126
+ # Use self-signed JWT if the endpoint is unchanged from default,
127
+ # but only if the default endpoint does not have a region prefix.
128
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ !@config.endpoint.split(".").first.include?("-")
130
+ credentials ||= Credentials.default scope: @config.scope,
131
+ enable_self_signed_jwt: enable_self_signed_jwt
132
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
+ credentials = Credentials.new credentials, scope: @config.scope
134
+ end
135
+ @quota_project_id = @config.quota_project
136
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
137
+
138
+ @operations_client = Operations.new do |config|
139
+ config.credentials = credentials
140
+ config.endpoint = @config.endpoint
141
+ end
142
+
143
+ @environments_stub = ::Gapic::ServiceStub.new(
144
+ ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Stub,
145
+ credentials: credentials,
146
+ endpoint: @config.endpoint,
147
+ channel_args: @config.channel_args,
148
+ interceptors: @config.interceptors
149
+ )
150
+ end
151
+
152
+ ##
153
+ # Get the associated client for long-running operations.
154
+ #
155
+ # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Operations]
156
+ #
157
+ attr_reader :operations_client
158
+
159
+ # Service calls
160
+
161
+ ##
162
+ # Create a new environment.
163
+ #
164
+ # @overload create_environment(request, options = nil)
165
+ # Pass arguments to `create_environment` via a request object, either of type
166
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::CreateEnvironmentRequest} or an equivalent Hash.
167
+ #
168
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::CreateEnvironmentRequest, ::Hash]
169
+ # A request object representing the call parameters. Required. To specify no
170
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
171
+ # @param options [::Gapic::CallOptions, ::Hash]
172
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
173
+ #
174
+ # @overload create_environment(parent: nil, environment: nil)
175
+ # Pass arguments to `create_environment` via keyword arguments. Note that at
176
+ # least one keyword argument is required. To specify no parameters, or to keep all
177
+ # the default parameter values, pass an empty Hash as a request object (see above).
178
+ #
179
+ # @param parent [::String]
180
+ # The parent must be of the form
181
+ # "projects/\\{projectId}/locations/\\{locationId}".
182
+ # @param environment [::Google::Cloud::Orchestration::Airflow::Service::V1::Environment, ::Hash]
183
+ # The environment to create.
184
+ #
185
+ # @yield [response, operation] Access the result along with the RPC operation
186
+ # @yieldparam response [::Gapic::Operation]
187
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
188
+ #
189
+ # @return [::Gapic::Operation]
190
+ #
191
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
192
+ #
193
+ def create_environment request, options = nil
194
+ raise ::ArgumentError, "request must be provided" if request.nil?
195
+
196
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::CreateEnvironmentRequest
197
+
198
+ # Converts hash and nil to an options object
199
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
200
+
201
+ # Customize the options with defaults
202
+ metadata = @config.rpcs.create_environment.metadata.to_h
203
+
204
+ # Set x-goog-api-client and x-goog-user-project headers
205
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
206
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
207
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
208
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
209
+
210
+ header_params = {
211
+ "parent" => request.parent
212
+ }
213
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
214
+ metadata[:"x-goog-request-params"] ||= request_params_header
215
+
216
+ options.apply_defaults timeout: @config.rpcs.create_environment.timeout,
217
+ metadata: metadata,
218
+ retry_policy: @config.rpcs.create_environment.retry_policy
219
+
220
+ options.apply_defaults timeout: @config.timeout,
221
+ metadata: @config.metadata,
222
+ retry_policy: @config.retry_policy
223
+
224
+ @environments_stub.call_rpc :create_environment, request, options: options do |response, operation|
225
+ response = ::Gapic::Operation.new response, @operations_client, options: options
226
+ yield response, operation if block_given?
227
+ return response
228
+ end
229
+ rescue ::GRPC::BadStatus => e
230
+ raise ::Google::Cloud::Error.from_error(e)
231
+ end
232
+
233
+ ##
234
+ # Get an existing environment.
235
+ #
236
+ # @overload get_environment(request, options = nil)
237
+ # Pass arguments to `get_environment` via a request object, either of type
238
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::GetEnvironmentRequest} or an equivalent Hash.
239
+ #
240
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::GetEnvironmentRequest, ::Hash]
241
+ # A request object representing the call parameters. Required. To specify no
242
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
243
+ # @param options [::Gapic::CallOptions, ::Hash]
244
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
245
+ #
246
+ # @overload get_environment(name: nil)
247
+ # Pass arguments to `get_environment` via keyword arguments. Note that at
248
+ # least one keyword argument is required. To specify no parameters, or to keep all
249
+ # the default parameter values, pass an empty Hash as a request object (see above).
250
+ #
251
+ # @param name [::String]
252
+ # The resource name of the environment to get, in the form:
253
+ # "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}"
254
+ #
255
+ # @yield [response, operation] Access the result along with the RPC operation
256
+ # @yieldparam response [::Google::Cloud::Orchestration::Airflow::Service::V1::Environment]
257
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
258
+ #
259
+ # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::Environment]
260
+ #
261
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
262
+ #
263
+ def get_environment request, options = nil
264
+ raise ::ArgumentError, "request must be provided" if request.nil?
265
+
266
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::GetEnvironmentRequest
267
+
268
+ # Converts hash and nil to an options object
269
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
270
+
271
+ # Customize the options with defaults
272
+ metadata = @config.rpcs.get_environment.metadata.to_h
273
+
274
+ # Set x-goog-api-client and x-goog-user-project headers
275
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
276
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
277
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
278
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
279
+
280
+ header_params = {
281
+ "name" => request.name
282
+ }
283
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
284
+ metadata[:"x-goog-request-params"] ||= request_params_header
285
+
286
+ options.apply_defaults timeout: @config.rpcs.get_environment.timeout,
287
+ metadata: metadata,
288
+ retry_policy: @config.rpcs.get_environment.retry_policy
289
+
290
+ options.apply_defaults timeout: @config.timeout,
291
+ metadata: @config.metadata,
292
+ retry_policy: @config.retry_policy
293
+
294
+ @environments_stub.call_rpc :get_environment, request, options: options do |response, operation|
295
+ yield response, operation if block_given?
296
+ return response
297
+ end
298
+ rescue ::GRPC::BadStatus => e
299
+ raise ::Google::Cloud::Error.from_error(e)
300
+ end
301
+
302
+ ##
303
+ # List environments.
304
+ #
305
+ # @overload list_environments(request, options = nil)
306
+ # Pass arguments to `list_environments` via a request object, either of type
307
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsRequest} or an equivalent Hash.
308
+ #
309
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsRequest, ::Hash]
310
+ # A request object representing the call parameters. Required. To specify no
311
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
312
+ # @param options [::Gapic::CallOptions, ::Hash]
313
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
314
+ #
315
+ # @overload list_environments(parent: nil, page_size: nil, page_token: nil)
316
+ # Pass arguments to `list_environments` via keyword arguments. Note that at
317
+ # least one keyword argument is required. To specify no parameters, or to keep all
318
+ # the default parameter values, pass an empty Hash as a request object (see above).
319
+ #
320
+ # @param parent [::String]
321
+ # List environments in the given project and location, in the form:
322
+ # "projects/\\{projectId}/locations/\\{locationId}"
323
+ # @param page_size [::Integer]
324
+ # The maximum number of environments to return.
325
+ # @param page_token [::String]
326
+ # The next_page_token value returned from a previous List request, if any.
327
+ #
328
+ # @yield [response, operation] Access the result along with the RPC operation
329
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Orchestration::Airflow::Service::V1::Environment>]
330
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
331
+ #
332
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Orchestration::Airflow::Service::V1::Environment>]
333
+ #
334
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
335
+ #
336
+ def list_environments request, options = nil
337
+ raise ::ArgumentError, "request must be provided" if request.nil?
338
+
339
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::ListEnvironmentsRequest
340
+
341
+ # Converts hash and nil to an options object
342
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
343
+
344
+ # Customize the options with defaults
345
+ metadata = @config.rpcs.list_environments.metadata.to_h
346
+
347
+ # Set x-goog-api-client and x-goog-user-project headers
348
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
349
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
350
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
351
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
352
+
353
+ header_params = {
354
+ "parent" => request.parent
355
+ }
356
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
357
+ metadata[:"x-goog-request-params"] ||= request_params_header
358
+
359
+ options.apply_defaults timeout: @config.rpcs.list_environments.timeout,
360
+ metadata: metadata,
361
+ retry_policy: @config.rpcs.list_environments.retry_policy
362
+
363
+ options.apply_defaults timeout: @config.timeout,
364
+ metadata: @config.metadata,
365
+ retry_policy: @config.retry_policy
366
+
367
+ @environments_stub.call_rpc :list_environments, request, options: options do |response, operation|
368
+ response = ::Gapic::PagedEnumerable.new @environments_stub, :list_environments, request, response, operation, options
369
+ yield response, operation if block_given?
370
+ return response
371
+ end
372
+ rescue ::GRPC::BadStatus => e
373
+ raise ::Google::Cloud::Error.from_error(e)
374
+ end
375
+
376
+ ##
377
+ # Update an environment.
378
+ #
379
+ # @overload update_environment(request, options = nil)
380
+ # Pass arguments to `update_environment` via a request object, either of type
381
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::UpdateEnvironmentRequest} or an equivalent Hash.
382
+ #
383
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::UpdateEnvironmentRequest, ::Hash]
384
+ # A request object representing the call parameters. Required. To specify no
385
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
386
+ # @param options [::Gapic::CallOptions, ::Hash]
387
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
388
+ #
389
+ # @overload update_environment(name: nil, environment: nil, update_mask: nil)
390
+ # Pass arguments to `update_environment` via keyword arguments. Note that at
391
+ # least one keyword argument is required. To specify no parameters, or to keep all
392
+ # the default parameter values, pass an empty Hash as a request object (see above).
393
+ #
394
+ # @param name [::String]
395
+ # The relative resource name of the environment to update, in the form:
396
+ # "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}"
397
+ # @param environment [::Google::Cloud::Orchestration::Airflow::Service::V1::Environment, ::Hash]
398
+ # A patch environment. Fields specified by the `updateMask` will be copied
399
+ # from the patch environment into the environment under update.
400
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
401
+ # Required. A comma-separated list of paths, relative to `Environment`, of
402
+ # fields to update.
403
+ # For example, to set the version of scikit-learn to install in the
404
+ # environment to 0.19.0 and to remove an existing installation of
405
+ # numpy, the `updateMask` parameter would include the following two
406
+ # `paths` values: "config.softwareConfig.pypiPackages.scikit-learn" and
407
+ # "config.softwareConfig.pypiPackages.numpy". The included patch
408
+ # environment would specify the scikit-learn version as follows:
409
+ #
410
+ # {
411
+ # "config":{
412
+ # "softwareConfig":{
413
+ # "pypiPackages":{
414
+ # "scikit-learn":"==0.19.0"
415
+ # }
416
+ # }
417
+ # }
418
+ # }
419
+ #
420
+ # Note that in the above example, any existing PyPI packages
421
+ # other than scikit-learn and numpy will be unaffected.
422
+ #
423
+ # Only one update type may be included in a single request's `updateMask`.
424
+ # For example, one cannot update both the PyPI packages and
425
+ # labels in the same request. However, it is possible to update multiple
426
+ # members of a map field simultaneously in the same request. For example,
427
+ # to set the labels "label1" and "label2" while clearing "label3" (assuming
428
+ # it already exists), one can
429
+ # provide the paths "labels.label1", "labels.label2", and "labels.label3"
430
+ # and populate the patch environment as follows:
431
+ #
432
+ # {
433
+ # "labels":{
434
+ # "label1":"new-label1-value"
435
+ # "label2":"new-label2-value"
436
+ # }
437
+ # }
438
+ #
439
+ # Note that in the above example, any existing labels that are not
440
+ # included in the `updateMask` will be unaffected.
441
+ #
442
+ # It is also possible to replace an entire map field by providing the
443
+ # map field's path in the `updateMask`. The new value of the field will
444
+ # be that which is provided in the patch environment. For example, to
445
+ # delete all pre-existing user-specified PyPI packages and
446
+ # install botocore at version 1.7.14, the `updateMask` would contain
447
+ # the path "config.softwareConfig.pypiPackages", and
448
+ # the patch environment would be the following:
449
+ #
450
+ # {
451
+ # "config":{
452
+ # "softwareConfig":{
453
+ # "pypiPackages":{
454
+ # "botocore":"==1.7.14"
455
+ # }
456
+ # }
457
+ # }
458
+ # }
459
+ #
460
+ # **Note:** Only the following fields can be updated:
461
+ #
462
+ # * `config.softwareConfig.pypiPackages`
463
+ # * Replace all custom custom PyPI packages. If a replacement
464
+ # package map is not included in `environment`, all custom
465
+ # PyPI packages are cleared. It is an error to provide both
466
+ # this mask and a mask specifying an individual package.
467
+ # * `config.softwareConfig.pypiPackages.`packagename
468
+ # * Update the custom PyPI package *packagename*,
469
+ # preserving other packages. To delete the package, include it in
470
+ # `updateMask`, and omit the mapping for it in
471
+ # `environment.config.softwareConfig.pypiPackages`. It is an error
472
+ # to provide both a mask of this form and the
473
+ # `config.softwareConfig.pypiPackages` mask.
474
+ # * `labels`
475
+ # * Replace all environment labels. If a replacement labels map is not
476
+ # included in `environment`, all labels are cleared. It is an error to
477
+ # provide both this mask and a mask specifying one or more individual
478
+ # labels.
479
+ # * `labels.`labelName
480
+ # * Set the label named *labelName*, while preserving other
481
+ # labels. To delete the label, include it in `updateMask` and omit its
482
+ # mapping in `environment.labels`. It is an error to provide both a
483
+ # mask of this form and the `labels` mask.
484
+ # * `config.nodeCount`
485
+ # * Horizontally scale the number of nodes in the environment. An integer
486
+ # greater than or equal to 3 must be provided in the `config.nodeCount`
487
+ # field.
488
+ # * `config.webServerNetworkAccessControl`
489
+ # * Replace the environment's current `WebServerNetworkAccessControl`.
490
+ # * `config.databaseConfig`
491
+ # * Replace the environment's current `DatabaseConfig`.
492
+ # * `config.webServerConfig`
493
+ # * Replace the environment's current `WebServerConfig`.
494
+ # * `config.softwareConfig.airflowConfigOverrides`
495
+ # * Replace all Apache Airflow config overrides. If a replacement config
496
+ # overrides map is not included in `environment`, all config overrides
497
+ # are cleared.
498
+ # It is an error to provide both this mask and a mask specifying one or
499
+ # more individual config overrides.
500
+ # * `config.softwareConfig.airflowConfigOverrides.`section-name
501
+ # * Override the Apache Airflow config property *name* in the
502
+ # section named *section*, preserving other properties. To
503
+ # delete the property override, include it in `updateMask` and omit its
504
+ # mapping in
505
+ # `environment.config.softwareConfig.airflowConfigOverrides`.
506
+ # It is an error to provide both a mask of this form and the
507
+ # `config.softwareConfig.airflowConfigOverrides` mask.
508
+ # * `config.softwareConfig.envVariables`
509
+ # * Replace all environment variables. If a replacement environment
510
+ # variable map is not included in `environment`, all custom environment
511
+ # variables are cleared.
512
+ # It is an error to provide both this mask and a mask specifying one or
513
+ # more individual environment variables.
514
+ #
515
+ # @yield [response, operation] Access the result along with the RPC operation
516
+ # @yieldparam response [::Gapic::Operation]
517
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
518
+ #
519
+ # @return [::Gapic::Operation]
520
+ #
521
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
522
+ #
523
+ def update_environment request, options = nil
524
+ raise ::ArgumentError, "request must be provided" if request.nil?
525
+
526
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::UpdateEnvironmentRequest
527
+
528
+ # Converts hash and nil to an options object
529
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
530
+
531
+ # Customize the options with defaults
532
+ metadata = @config.rpcs.update_environment.metadata.to_h
533
+
534
+ # Set x-goog-api-client and x-goog-user-project headers
535
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
536
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
537
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
538
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
539
+
540
+ header_params = {
541
+ "name" => request.name
542
+ }
543
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
544
+ metadata[:"x-goog-request-params"] ||= request_params_header
545
+
546
+ options.apply_defaults timeout: @config.rpcs.update_environment.timeout,
547
+ metadata: metadata,
548
+ retry_policy: @config.rpcs.update_environment.retry_policy
549
+
550
+ options.apply_defaults timeout: @config.timeout,
551
+ metadata: @config.metadata,
552
+ retry_policy: @config.retry_policy
553
+
554
+ @environments_stub.call_rpc :update_environment, request, options: options do |response, operation|
555
+ response = ::Gapic::Operation.new response, @operations_client, options: options
556
+ yield response, operation if block_given?
557
+ return response
558
+ end
559
+ rescue ::GRPC::BadStatus => e
560
+ raise ::Google::Cloud::Error.from_error(e)
561
+ end
562
+
563
+ ##
564
+ # Delete an environment.
565
+ #
566
+ # @overload delete_environment(request, options = nil)
567
+ # Pass arguments to `delete_environment` via a request object, either of type
568
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::DeleteEnvironmentRequest} or an equivalent Hash.
569
+ #
570
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::DeleteEnvironmentRequest, ::Hash]
571
+ # A request object representing the call parameters. Required. To specify no
572
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
573
+ # @param options [::Gapic::CallOptions, ::Hash]
574
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
575
+ #
576
+ # @overload delete_environment(name: nil)
577
+ # Pass arguments to `delete_environment` via keyword arguments. Note that at
578
+ # least one keyword argument is required. To specify no parameters, or to keep all
579
+ # the default parameter values, pass an empty Hash as a request object (see above).
580
+ #
581
+ # @param name [::String]
582
+ # The environment to delete, in the form:
583
+ # "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}"
584
+ #
585
+ # @yield [response, operation] Access the result along with the RPC operation
586
+ # @yieldparam response [::Gapic::Operation]
587
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
588
+ #
589
+ # @return [::Gapic::Operation]
590
+ #
591
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
592
+ #
593
+ def delete_environment request, options = nil
594
+ raise ::ArgumentError, "request must be provided" if request.nil?
595
+
596
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::DeleteEnvironmentRequest
597
+
598
+ # Converts hash and nil to an options object
599
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
600
+
601
+ # Customize the options with defaults
602
+ metadata = @config.rpcs.delete_environment.metadata.to_h
603
+
604
+ # Set x-goog-api-client and x-goog-user-project headers
605
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
606
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
607
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
608
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
609
+
610
+ header_params = {
611
+ "name" => request.name
612
+ }
613
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
614
+ metadata[:"x-goog-request-params"] ||= request_params_header
615
+
616
+ options.apply_defaults timeout: @config.rpcs.delete_environment.timeout,
617
+ metadata: metadata,
618
+ retry_policy: @config.rpcs.delete_environment.retry_policy
619
+
620
+ options.apply_defaults timeout: @config.timeout,
621
+ metadata: @config.metadata,
622
+ retry_policy: @config.retry_policy
623
+
624
+ @environments_stub.call_rpc :delete_environment, request, options: options do |response, operation|
625
+ response = ::Gapic::Operation.new response, @operations_client, options: options
626
+ yield response, operation if block_given?
627
+ return response
628
+ end
629
+ rescue ::GRPC::BadStatus => e
630
+ raise ::Google::Cloud::Error.from_error(e)
631
+ end
632
+
633
+ ##
634
+ # Configuration class for the Environments API.
635
+ #
636
+ # This class represents the configuration for Environments,
637
+ # providing control over timeouts, retry behavior, logging, transport
638
+ # parameters, and other low-level controls. Certain parameters can also be
639
+ # applied individually to specific RPCs. See
640
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client::Configuration::Rpcs}
641
+ # for a list of RPCs that can be configured independently.
642
+ #
643
+ # Configuration can be applied globally to all clients, or to a single client
644
+ # on construction.
645
+ #
646
+ # @example
647
+ #
648
+ # # Modify the global config, setting the timeout for
649
+ # # create_environment to 20 seconds,
650
+ # # and all remaining timeouts to 10 seconds.
651
+ # ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client.configure do |config|
652
+ # config.timeout = 10.0
653
+ # config.rpcs.create_environment.timeout = 20.0
654
+ # end
655
+ #
656
+ # # Apply the above configuration only to a new client.
657
+ # client = ::Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client.new do |config|
658
+ # config.timeout = 10.0
659
+ # config.rpcs.create_environment.timeout = 20.0
660
+ # end
661
+ #
662
+ # @!attribute [rw] endpoint
663
+ # The hostname or hostname:port of the service endpoint.
664
+ # Defaults to `"composer.googleapis.com"`.
665
+ # @return [::String]
666
+ # @!attribute [rw] credentials
667
+ # Credentials to send with calls. You may provide any of the following types:
668
+ # * (`String`) The path to a service account key file in JSON format
669
+ # * (`Hash`) A service account key as a Hash
670
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
671
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
672
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
673
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
674
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
675
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
676
+ # * (`nil`) indicating no credentials
677
+ # @return [::Object]
678
+ # @!attribute [rw] scope
679
+ # The OAuth scopes
680
+ # @return [::Array<::String>]
681
+ # @!attribute [rw] lib_name
682
+ # The library name as recorded in instrumentation and logging
683
+ # @return [::String]
684
+ # @!attribute [rw] lib_version
685
+ # The library version as recorded in instrumentation and logging
686
+ # @return [::String]
687
+ # @!attribute [rw] channel_args
688
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
689
+ # `GRPC::Core::Channel` object is provided as the credential.
690
+ # @return [::Hash]
691
+ # @!attribute [rw] interceptors
692
+ # An array of interceptors that are run before calls are executed.
693
+ # @return [::Array<::GRPC::ClientInterceptor>]
694
+ # @!attribute [rw] timeout
695
+ # The call timeout in seconds.
696
+ # @return [::Numeric]
697
+ # @!attribute [rw] metadata
698
+ # Additional gRPC headers to be sent with the call.
699
+ # @return [::Hash{::Symbol=>::String}]
700
+ # @!attribute [rw] retry_policy
701
+ # The retry policy. The value is a hash with the following keys:
702
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
703
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
704
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
705
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
706
+ # trigger a retry.
707
+ # @return [::Hash]
708
+ # @!attribute [rw] quota_project
709
+ # A separate project against which to charge quota.
710
+ # @return [::String]
711
+ #
712
+ class Configuration
713
+ extend ::Gapic::Config
714
+
715
+ config_attr :endpoint, "composer.googleapis.com", ::String
716
+ config_attr :credentials, nil do |value|
717
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
718
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
719
+ allowed.any? { |klass| klass === value }
720
+ end
721
+ config_attr :scope, nil, ::String, ::Array, nil
722
+ config_attr :lib_name, nil, ::String, nil
723
+ config_attr :lib_version, nil, ::String, nil
724
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
725
+ config_attr :interceptors, nil, ::Array, nil
726
+ config_attr :timeout, nil, ::Numeric, nil
727
+ config_attr :metadata, nil, ::Hash, nil
728
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
729
+ config_attr :quota_project, nil, ::String, nil
730
+
731
+ # @private
732
+ def initialize parent_config = nil
733
+ @parent_config = parent_config unless parent_config.nil?
734
+
735
+ yield self if block_given?
736
+ end
737
+
738
+ ##
739
+ # Configurations for individual RPCs
740
+ # @return [Rpcs]
741
+ #
742
+ def rpcs
743
+ @rpcs ||= begin
744
+ parent_rpcs = nil
745
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
746
+ Rpcs.new parent_rpcs
747
+ end
748
+ end
749
+
750
+ ##
751
+ # Configuration RPC class for the Environments API.
752
+ #
753
+ # Includes fields providing the configuration for each RPC in this service.
754
+ # Each configuration object is of type `Gapic::Config::Method` and includes
755
+ # the following configuration fields:
756
+ #
757
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
758
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
759
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
760
+ # include the following keys:
761
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
762
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
763
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
764
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
765
+ # trigger a retry.
766
+ #
767
+ class Rpcs
768
+ ##
769
+ # RPC-specific configuration for `create_environment`
770
+ # @return [::Gapic::Config::Method]
771
+ #
772
+ attr_reader :create_environment
773
+ ##
774
+ # RPC-specific configuration for `get_environment`
775
+ # @return [::Gapic::Config::Method]
776
+ #
777
+ attr_reader :get_environment
778
+ ##
779
+ # RPC-specific configuration for `list_environments`
780
+ # @return [::Gapic::Config::Method]
781
+ #
782
+ attr_reader :list_environments
783
+ ##
784
+ # RPC-specific configuration for `update_environment`
785
+ # @return [::Gapic::Config::Method]
786
+ #
787
+ attr_reader :update_environment
788
+ ##
789
+ # RPC-specific configuration for `delete_environment`
790
+ # @return [::Gapic::Config::Method]
791
+ #
792
+ attr_reader :delete_environment
793
+
794
+ # @private
795
+ def initialize parent_rpcs = nil
796
+ create_environment_config = parent_rpcs.create_environment if parent_rpcs.respond_to? :create_environment
797
+ @create_environment = ::Gapic::Config::Method.new create_environment_config
798
+ get_environment_config = parent_rpcs.get_environment if parent_rpcs.respond_to? :get_environment
799
+ @get_environment = ::Gapic::Config::Method.new get_environment_config
800
+ list_environments_config = parent_rpcs.list_environments if parent_rpcs.respond_to? :list_environments
801
+ @list_environments = ::Gapic::Config::Method.new list_environments_config
802
+ update_environment_config = parent_rpcs.update_environment if parent_rpcs.respond_to? :update_environment
803
+ @update_environment = ::Gapic::Config::Method.new update_environment_config
804
+ delete_environment_config = parent_rpcs.delete_environment if parent_rpcs.respond_to? :delete_environment
805
+ @delete_environment = ::Gapic::Config::Method.new delete_environment_config
806
+
807
+ yield self if block_given?
808
+ end
809
+ end
810
+ end
811
+ end
812
+ end
813
+ end
814
+ end
815
+ end
816
+ end
817
+ end
818
+ end