Skip to content

Commit

Permalink
feat: A new method CheckUpgrade is added to service Environments (#…
Browse files Browse the repository at this point in the history
…27323)

feat: A new field `satisfies_pzi` is added to message `.google.cloud.orchestration.airflow.service.v1.Environment`
feat: A new message `CheckUpgradeRequest` is added
feat: A new field `airflow_metadata_retention_config` is added to message `.google.cloud.orchestration.airflow.service.v1.DataRetentionConfig`
feat: A new message `AirflowMetadataRetentionPolicyConfig` is added
docs: A comment for field `maintenance_window` in message `.google.cloud.orchestration.airflow.service.v1.EnvironmentConfig` is changed
docs: A comment for message `WorkloadsConfig` is changed
docs: A comment for field `storage_mode` in message `.google.cloud.orchestration.airflow.service.v1.TaskLogsRetentionConfig` is changed
  • Loading branch information
gcf-owl-bot[bot] authored Sep 18, 2024
1 parent ed1528f commit 772df36
Show file tree
Hide file tree
Showing 12 changed files with 615 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"proto_docs/google/rpc/status.rb",
"proto_docs/google/type/date.rb",
"snippets/Gemfile",
"snippets/environments/check_upgrade.rb",
"snippets/environments/create_environment.rb",
"snippets/environments/create_user_workloads_config_map.rb",
"snippets/environments/create_user_workloads_secret.rb",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@
"list_workloads"
]
},
"CheckUpgrade": {
"methods": [
"check_upgrade"
]
},
"CreateUserWorkloadsSecret": {
"methods": [
"create_user_workloads_secret"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,129 @@ def list_workloads request, options = nil
raise ::Google::Cloud::Error.from_error(e)
end

##
# Check if an upgrade operation on the environment will succeed.
#
# In case of problems detailed info can be found in the returned Operation.
#
# @overload check_upgrade(request, options = nil)
# Pass arguments to `check_upgrade` via a request object, either of type
# {::Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
#
# @overload check_upgrade(environment: nil, image_version: nil)
# Pass arguments to `check_upgrade` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param environment [::String]
# Required. The resource name of the environment to check upgrade for, in the
# form:
# "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}"
# @param image_version [::String]
# Optional. The version of the software running in the environment.
# This encapsulates both the version of Cloud Composer functionality and the
# version of Apache Airflow. It must match the regular expression
# `composer-([0-9]+(\.[0-9]+\.[0-9]+(-preview\.[0-9]+)?)?|latest)-airflow-([0-9]+(\.[0-9]+(\.[0-9]+)?)?)`.
# When used as input, the server also checks if the provided version is
# supported and denies the request for an unsupported version.
#
# The Cloud Composer portion of the image version is a full
# [semantic version](https://semver.org), or an alias in the form of major
# version number or `latest`. When an alias is provided, the server replaces
# it with the current Cloud Composer version that satisfies the alias.
#
# The Apache Airflow portion of the image version is a full semantic version
# that points to one of the supported Apache Airflow versions, or an alias in
# the form of only major or major.minor versions specified. When an alias is
# provided, the server replaces it with the latest Apache Airflow version
# that satisfies the alias and is supported in the given Cloud Composer
# version.
#
# In all cases, the resolved image version is stored in the same field.
#
# See also [version
# list](/composer/docs/concepts/versioning/composer-versions) and [versioning
# overview](/composer/docs/concepts/versioning/composer-versioning-overview).
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Gapic::Operation]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
# @return [::Gapic::Operation]
#
# @raise [::Google::Cloud::Error] if the RPC is aborted.
#
# @example Basic example
# require "google/cloud/orchestration/airflow/service/v1"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest.new
#
# # Call the check_upgrade method.
# result = client.check_upgrade request
#
# # The returned object is of type Gapic::Operation. You can use it to
# # check the status of an operation, cancel it, or wait for results.
# # Here is how to wait for a response.
# result.wait_until_done! timeout: 60
# if result.response?
# p result.response
# else
# puts "No response received."
# end
#
def check_upgrade request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
metadata = @config.rpcs.check_upgrade.metadata.to_h

# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

header_params = {}
if request.environment
header_params["environment"] = request.environment
end

request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
metadata[:"x-goog-request-params"] ||= request_params_header

options.apply_defaults timeout: @config.rpcs.check_upgrade.timeout,
metadata: metadata,
retry_policy: @config.rpcs.check_upgrade.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@environments_stub.call_rpc :check_upgrade, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
return response
end
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Creates a user workloads Secret.
#
Expand Down Expand Up @@ -2689,6 +2812,11 @@ class Rpcs
#
attr_reader :list_workloads
##
# RPC-specific configuration for `check_upgrade`
# @return [::Gapic::Config::Method]
#
attr_reader :check_upgrade
##
# RPC-specific configuration for `create_user_workloads_secret`
# @return [::Gapic::Config::Method]
#
Expand Down Expand Up @@ -2779,6 +2907,8 @@ def initialize parent_rpcs = nil
@poll_airflow_command = ::Gapic::Config::Method.new poll_airflow_command_config
list_workloads_config = parent_rpcs.list_workloads if parent_rpcs.respond_to? :list_workloads
@list_workloads = ::Gapic::Config::Method.new list_workloads_config
check_upgrade_config = parent_rpcs.check_upgrade if parent_rpcs.respond_to? :check_upgrade
@check_upgrade = ::Gapic::Config::Method.new check_upgrade_config
create_user_workloads_secret_config = parent_rpcs.create_user_workloads_secret if parent_rpcs.respond_to? :create_user_workloads_secret
@create_user_workloads_secret = ::Gapic::Config::Method.new create_user_workloads_secret_config
get_user_workloads_secret_config = parent_rpcs.get_user_workloads_secret if parent_rpcs.respond_to? :get_user_workloads_secret
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1101,6 +1101,122 @@ def list_workloads request, options = nil
raise ::Google::Cloud::Error.from_error(e)
end

##
# Check if an upgrade operation on the environment will succeed.
#
# In case of problems detailed info can be found in the returned Operation.
#
# @overload check_upgrade(request, options = nil)
# Pass arguments to `check_upgrade` via a request object, either of type
# {::Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest, ::Hash]
# A request object representing the call parameters. Required. To specify no
# parameters, or to keep all the default parameter values, pass an empty Hash.
# @param options [::Gapic::CallOptions, ::Hash]
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
#
# @overload check_upgrade(environment: nil, image_version: nil)
# Pass arguments to `check_upgrade` via keyword arguments. Note that at
# least one keyword argument is required. To specify no parameters, or to keep all
# the default parameter values, pass an empty Hash as a request object (see above).
#
# @param environment [::String]
# Required. The resource name of the environment to check upgrade for, in the
# form:
# "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}"
# @param image_version [::String]
# Optional. The version of the software running in the environment.
# This encapsulates both the version of Cloud Composer functionality and the
# version of Apache Airflow. It must match the regular expression
# `composer-([0-9]+(\.[0-9]+\.[0-9]+(-preview\.[0-9]+)?)?|latest)-airflow-([0-9]+(\.[0-9]+(\.[0-9]+)?)?)`.
# When used as input, the server also checks if the provided version is
# supported and denies the request for an unsupported version.
#
# The Cloud Composer portion of the image version is a full
# [semantic version](https://semver.org), or an alias in the form of major
# version number or `latest`. When an alias is provided, the server replaces
# it with the current Cloud Composer version that satisfies the alias.
#
# The Apache Airflow portion of the image version is a full semantic version
# that points to one of the supported Apache Airflow versions, or an alias in
# the form of only major or major.minor versions specified. When an alias is
# provided, the server replaces it with the latest Apache Airflow version
# that satisfies the alias and is supported in the given Cloud Composer
# version.
#
# In all cases, the resolved image version is stored in the same field.
#
# See also [version
# list](/composer/docs/concepts/versioning/composer-versions) and [versioning
# overview](/composer/docs/concepts/versioning/composer-versioning-overview).
# @yield [result, operation] Access the result along with the TransportOperation object
# @yieldparam result [::Gapic::Operation]
# @yieldparam operation [::Gapic::Rest::TransportOperation]
#
# @return [::Gapic::Operation]
#
# @raise [::Google::Cloud::Error] if the REST call is aborted.
#
# @example Basic example
# require "google/cloud/orchestration/airflow/service/v1"
#
# # Create a client object. The client can be reused for multiple calls.
# client = Google::Cloud::Orchestration::Airflow::Service::V1::Environments::Rest::Client.new
#
# # Create a request. To set request fields, pass in keyword arguments.
# request = Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest.new
#
# # Call the check_upgrade method.
# result = client.check_upgrade request
#
# # The returned object is of type Gapic::Operation. You can use it to
# # check the status of an operation, cancel it, or wait for results.
# # Here is how to wait for a response.
# result.wait_until_done! timeout: 60
# if result.response?
# p result.response
# else
# puts "No response received."
# end
#
def check_upgrade request, options = nil
raise ::ArgumentError, "request must be provided" if request.nil?

request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::CheckUpgradeRequest

# Converts hash and nil to an options object
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

# Customize the options with defaults
call_metadata = @config.rpcs.check_upgrade.metadata.to_h

# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
lib_name: @config.lib_name, lib_version: @config.lib_version,
gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION,
transports_version_send: [:rest]

call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id

options.apply_defaults timeout: @config.rpcs.check_upgrade.timeout,
metadata: call_metadata,
retry_policy: @config.rpcs.check_upgrade.retry_policy

options.apply_defaults timeout: @config.timeout,
metadata: @config.metadata,
retry_policy: @config.retry_policy

@environments_stub.check_upgrade request, options do |result, operation|
result = ::Gapic::Operation.new result, @operations_client, options: options
yield result, operation if block_given?
return result
end
rescue ::Gapic::Rest::Error => e
raise ::Google::Cloud::Error.from_error(e)
end

##
# Creates a user workloads Secret.
#
Expand Down Expand Up @@ -2501,6 +2617,11 @@ class Rpcs
#
attr_reader :list_workloads
##
# RPC-specific configuration for `check_upgrade`
# @return [::Gapic::Config::Method]
#
attr_reader :check_upgrade
##
# RPC-specific configuration for `create_user_workloads_secret`
# @return [::Gapic::Config::Method]
#
Expand Down Expand Up @@ -2591,6 +2712,8 @@ def initialize parent_rpcs = nil
@poll_airflow_command = ::Gapic::Config::Method.new poll_airflow_command_config
list_workloads_config = parent_rpcs.list_workloads if parent_rpcs.respond_to? :list_workloads
@list_workloads = ::Gapic::Config::Method.new list_workloads_config
check_upgrade_config = parent_rpcs.check_upgrade if parent_rpcs.respond_to? :check_upgrade
@check_upgrade = ::Gapic::Config::Method.new check_upgrade_config
create_user_workloads_secret_config = parent_rpcs.create_user_workloads_secret if parent_rpcs.respond_to? :create_user_workloads_secret
@create_user_workloads_secret = ::Gapic::Config::Method.new create_user_workloads_secret_config
get_user_workloads_secret_config = parent_rpcs.get_user_workloads_secret if parent_rpcs.respond_to? :get_user_workloads_secret
Expand Down
Loading

0 comments on commit 772df36

Please sign in to comment.