google-cloud-orchestration-airflow-service-v1 0.3.1 → 0.5.0

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