lib/google/cloud/orchestration/airflow/service/v1/environments/rest/client.rb in google-cloud-orchestration-airflow-service-v1-1.0.1 vs lib/google/cloud/orchestration/airflow/service/v1/environments/rest/client.rb in google-cloud-orchestration-airflow-service-v1-1.1.0

- old
+ new

@@ -1100,10 +1100,126 @@ rescue ::Gapic::Rest::Error => e 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. # # This method is supported for Cloud Composer environments in versions # composer-3.*.*-airflow-*.*.* and newer. # @@ -2499,10 +2615,15 @@ # RPC-specific configuration for `list_workloads` # @return [::Gapic::Config::Method] # 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] # attr_reader :create_user_workloads_secret ## @@ -2589,9 +2710,11 @@ @stop_airflow_command = ::Gapic::Config::Method.new stop_airflow_command_config poll_airflow_command_config = parent_rpcs.poll_airflow_command if parent_rpcs.respond_to? :poll_airflow_command @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 @get_user_workloads_secret = ::Gapic::Config::Method.new get_user_workloads_secret_config list_user_workloads_secrets_config = parent_rpcs.list_user_workloads_secrets if parent_rpcs.respond_to? :list_user_workloads_secrets