google-cloud-orchestration-airflow-service-v1 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -602,6 +602,221 @@ module Google
602
602
  raise ::Google::Cloud::Error.from_error(e)
603
603
  end
604
604
 
605
+ ##
606
+ # Executes Airflow CLI command.
607
+ #
608
+ # @overload execute_airflow_command(request, options = nil)
609
+ # Pass arguments to `execute_airflow_command` via a request object, either of type
610
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandRequest} or an equivalent Hash.
611
+ #
612
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandRequest, ::Hash]
613
+ # A request object representing the call parameters. Required. To specify no
614
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
615
+ # @param options [::Gapic::CallOptions, ::Hash]
616
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
617
+ #
618
+ # @overload execute_airflow_command(environment: nil, command: nil, subcommand: nil, parameters: nil)
619
+ # Pass arguments to `execute_airflow_command` via keyword arguments. Note that at
620
+ # least one keyword argument is required. To specify no parameters, or to keep all
621
+ # the default parameter values, pass an empty Hash as a request object (see above).
622
+ #
623
+ # @param environment [::String]
624
+ # The resource name of the environment in the form:
625
+ # "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}".
626
+ # @param command [::String]
627
+ # Airflow command.
628
+ # @param subcommand [::String]
629
+ # Airflow subcommand.
630
+ # @param parameters [::Array<::String>]
631
+ # Parameters for the Airflow command/subcommand as an array of arguments.
632
+ # It may contain positional arguments like `["my-dag-id"]`, key-value
633
+ # parameters like `["--foo=bar"]` or `["--foo","bar"]`,
634
+ # or other flags like `["-f"]`.
635
+ # @yield [result, operation] Access the result along with the TransportOperation object
636
+ # @yieldparam result [::Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandResponse]
637
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
638
+ #
639
+ # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandResponse]
640
+ #
641
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
642
+ def execute_airflow_command request, options = nil
643
+ raise ::ArgumentError, "request must be provided" if request.nil?
644
+
645
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::ExecuteAirflowCommandRequest
646
+
647
+ # Converts hash and nil to an options object
648
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
649
+
650
+ # Customize the options with defaults
651
+ call_metadata = @config.rpcs.execute_airflow_command.metadata.to_h
652
+
653
+ # Set x-goog-api-client and x-goog-user-project headers
654
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
655
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
656
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION,
657
+ transports_version_send: [:rest]
658
+
659
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
660
+
661
+ options.apply_defaults timeout: @config.rpcs.execute_airflow_command.timeout,
662
+ metadata: call_metadata,
663
+ retry_policy: @config.rpcs.execute_airflow_command.retry_policy
664
+
665
+ options.apply_defaults timeout: @config.timeout,
666
+ metadata: @config.metadata,
667
+ retry_policy: @config.retry_policy
668
+
669
+ @environments_stub.execute_airflow_command request, options do |result, operation|
670
+ yield result, operation if block_given?
671
+ return result
672
+ end
673
+ rescue ::Gapic::Rest::Error => e
674
+ raise ::Google::Cloud::Error.from_error(e)
675
+ end
676
+
677
+ ##
678
+ # Stops Airflow CLI command execution.
679
+ #
680
+ # @overload stop_airflow_command(request, options = nil)
681
+ # Pass arguments to `stop_airflow_command` via a request object, either of type
682
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandRequest} or an equivalent Hash.
683
+ #
684
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandRequest, ::Hash]
685
+ # A request object representing the call parameters. Required. To specify no
686
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
687
+ # @param options [::Gapic::CallOptions, ::Hash]
688
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
689
+ #
690
+ # @overload stop_airflow_command(environment: nil, execution_id: nil, pod: nil, pod_namespace: nil, force: nil)
691
+ # Pass arguments to `stop_airflow_command` via keyword arguments. Note that at
692
+ # least one keyword argument is required. To specify no parameters, or to keep all
693
+ # the default parameter values, pass an empty Hash as a request object (see above).
694
+ #
695
+ # @param environment [::String]
696
+ # The resource name of the environment in the form:
697
+ # "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}".
698
+ # @param execution_id [::String]
699
+ # The unique ID of the command execution.
700
+ # @param pod [::String]
701
+ # The name of the pod where the command is executed.
702
+ # @param pod_namespace [::String]
703
+ # The namespace of the pod where the command is executed.
704
+ # @param force [::Boolean]
705
+ # If true, the execution is terminated forcefully (SIGKILL). If false, the
706
+ # execution is stopped gracefully, giving it time for cleanup.
707
+ # @yield [result, operation] Access the result along with the TransportOperation object
708
+ # @yieldparam result [::Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandResponse]
709
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
710
+ #
711
+ # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandResponse]
712
+ #
713
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
714
+ def stop_airflow_command request, options = nil
715
+ raise ::ArgumentError, "request must be provided" if request.nil?
716
+
717
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::StopAirflowCommandRequest
718
+
719
+ # Converts hash and nil to an options object
720
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
721
+
722
+ # Customize the options with defaults
723
+ call_metadata = @config.rpcs.stop_airflow_command.metadata.to_h
724
+
725
+ # Set x-goog-api-client and x-goog-user-project headers
726
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
727
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
728
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION,
729
+ transports_version_send: [:rest]
730
+
731
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
732
+
733
+ options.apply_defaults timeout: @config.rpcs.stop_airflow_command.timeout,
734
+ metadata: call_metadata,
735
+ retry_policy: @config.rpcs.stop_airflow_command.retry_policy
736
+
737
+ options.apply_defaults timeout: @config.timeout,
738
+ metadata: @config.metadata,
739
+ retry_policy: @config.retry_policy
740
+
741
+ @environments_stub.stop_airflow_command request, options do |result, operation|
742
+ yield result, operation if block_given?
743
+ return result
744
+ end
745
+ rescue ::Gapic::Rest::Error => e
746
+ raise ::Google::Cloud::Error.from_error(e)
747
+ end
748
+
749
+ ##
750
+ # Polls Airflow CLI command execution and fetches logs.
751
+ #
752
+ # @overload poll_airflow_command(request, options = nil)
753
+ # Pass arguments to `poll_airflow_command` via a request object, either of type
754
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandRequest} or an equivalent Hash.
755
+ #
756
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandRequest, ::Hash]
757
+ # A request object representing the call parameters. Required. To specify no
758
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
759
+ # @param options [::Gapic::CallOptions, ::Hash]
760
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
761
+ #
762
+ # @overload poll_airflow_command(environment: nil, execution_id: nil, pod: nil, pod_namespace: nil, next_line_number: nil)
763
+ # Pass arguments to `poll_airflow_command` via keyword arguments. Note that at
764
+ # least one keyword argument is required. To specify no parameters, or to keep all
765
+ # the default parameter values, pass an empty Hash as a request object (see above).
766
+ #
767
+ # @param environment [::String]
768
+ # The resource name of the environment in the form:
769
+ # "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}"
770
+ # @param execution_id [::String]
771
+ # The unique ID of the command execution.
772
+ # @param pod [::String]
773
+ # The name of the pod where the command is executed.
774
+ # @param pod_namespace [::String]
775
+ # The namespace of the pod where the command is executed.
776
+ # @param next_line_number [::Integer]
777
+ # Line number from which new logs should be fetched.
778
+ # @yield [result, operation] Access the result along with the TransportOperation object
779
+ # @yieldparam result [::Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandResponse]
780
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
781
+ #
782
+ # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandResponse]
783
+ #
784
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
785
+ def poll_airflow_command request, options = nil
786
+ raise ::ArgumentError, "request must be provided" if request.nil?
787
+
788
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::PollAirflowCommandRequest
789
+
790
+ # Converts hash and nil to an options object
791
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
792
+
793
+ # Customize the options with defaults
794
+ call_metadata = @config.rpcs.poll_airflow_command.metadata.to_h
795
+
796
+ # Set x-goog-api-client and x-goog-user-project headers
797
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
798
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
799
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION,
800
+ transports_version_send: [:rest]
801
+
802
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
803
+
804
+ options.apply_defaults timeout: @config.rpcs.poll_airflow_command.timeout,
805
+ metadata: call_metadata,
806
+ retry_policy: @config.rpcs.poll_airflow_command.retry_policy
807
+
808
+ options.apply_defaults timeout: @config.timeout,
809
+ metadata: @config.metadata,
810
+ retry_policy: @config.retry_policy
811
+
812
+ @environments_stub.poll_airflow_command request, options do |result, operation|
813
+ yield result, operation if block_given?
814
+ return result
815
+ end
816
+ rescue ::Gapic::Rest::Error => e
817
+ raise ::Google::Cloud::Error.from_error(e)
818
+ end
819
+
605
820
  ##
606
821
  # Creates a snapshots of a Cloud Composer environment.
607
822
  #
@@ -754,6 +969,133 @@ module Google
754
969
  raise ::Google::Cloud::Error.from_error(e)
755
970
  end
756
971
 
972
+ ##
973
+ # Triggers database failover (only for highly resilient environments).
974
+ #
975
+ # @overload database_failover(request, options = nil)
976
+ # Pass arguments to `database_failover` via a request object, either of type
977
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::DatabaseFailoverRequest} or an equivalent Hash.
978
+ #
979
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::DatabaseFailoverRequest, ::Hash]
980
+ # A request object representing the call parameters. Required. To specify no
981
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
982
+ # @param options [::Gapic::CallOptions, ::Hash]
983
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
984
+ #
985
+ # @overload database_failover(environment: nil)
986
+ # Pass arguments to `database_failover` via keyword arguments. Note that at
987
+ # least one keyword argument is required. To specify no parameters, or to keep all
988
+ # the default parameter values, pass an empty Hash as a request object (see above).
989
+ #
990
+ # @param environment [::String]
991
+ # Target environment:
992
+ # "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}"
993
+ # @yield [result, operation] Access the result along with the TransportOperation object
994
+ # @yieldparam result [::Gapic::Operation]
995
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
996
+ #
997
+ # @return [::Gapic::Operation]
998
+ #
999
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1000
+ def database_failover request, options = nil
1001
+ raise ::ArgumentError, "request must be provided" if request.nil?
1002
+
1003
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::DatabaseFailoverRequest
1004
+
1005
+ # Converts hash and nil to an options object
1006
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1007
+
1008
+ # Customize the options with defaults
1009
+ call_metadata = @config.rpcs.database_failover.metadata.to_h
1010
+
1011
+ # Set x-goog-api-client and x-goog-user-project headers
1012
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1013
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1014
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION,
1015
+ transports_version_send: [:rest]
1016
+
1017
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1018
+
1019
+ options.apply_defaults timeout: @config.rpcs.database_failover.timeout,
1020
+ metadata: call_metadata,
1021
+ retry_policy: @config.rpcs.database_failover.retry_policy
1022
+
1023
+ options.apply_defaults timeout: @config.timeout,
1024
+ metadata: @config.metadata,
1025
+ retry_policy: @config.retry_policy
1026
+
1027
+ @environments_stub.database_failover request, options do |result, operation|
1028
+ result = ::Gapic::Operation.new result, @operations_client, options: options
1029
+ yield result, operation if block_given?
1030
+ return result
1031
+ end
1032
+ rescue ::Gapic::Rest::Error => e
1033
+ raise ::Google::Cloud::Error.from_error(e)
1034
+ end
1035
+
1036
+ ##
1037
+ # Fetches database properties.
1038
+ #
1039
+ # @overload fetch_database_properties(request, options = nil)
1040
+ # Pass arguments to `fetch_database_properties` via a request object, either of type
1041
+ # {::Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesRequest} or an equivalent Hash.
1042
+ #
1043
+ # @param request [::Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesRequest, ::Hash]
1044
+ # A request object representing the call parameters. Required. To specify no
1045
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1046
+ # @param options [::Gapic::CallOptions, ::Hash]
1047
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1048
+ #
1049
+ # @overload fetch_database_properties(environment: nil)
1050
+ # Pass arguments to `fetch_database_properties` via keyword arguments. Note that at
1051
+ # least one keyword argument is required. To specify no parameters, or to keep all
1052
+ # the default parameter values, pass an empty Hash as a request object (see above).
1053
+ #
1054
+ # @param environment [::String]
1055
+ # Required. The resource name of the environment, in the form:
1056
+ # "projects/\\{projectId}/locations/\\{locationId}/environments/\\{environmentId}"
1057
+ # @yield [result, operation] Access the result along with the TransportOperation object
1058
+ # @yieldparam result [::Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesResponse]
1059
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1060
+ #
1061
+ # @return [::Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesResponse]
1062
+ #
1063
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1064
+ def fetch_database_properties request, options = nil
1065
+ raise ::ArgumentError, "request must be provided" if request.nil?
1066
+
1067
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Orchestration::Airflow::Service::V1::FetchDatabasePropertiesRequest
1068
+
1069
+ # Converts hash and nil to an options object
1070
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1071
+
1072
+ # Customize the options with defaults
1073
+ call_metadata = @config.rpcs.fetch_database_properties.metadata.to_h
1074
+
1075
+ # Set x-goog-api-client and x-goog-user-project headers
1076
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1077
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1078
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION,
1079
+ transports_version_send: [:rest]
1080
+
1081
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1082
+
1083
+ options.apply_defaults timeout: @config.rpcs.fetch_database_properties.timeout,
1084
+ metadata: call_metadata,
1085
+ retry_policy: @config.rpcs.fetch_database_properties.retry_policy
1086
+
1087
+ options.apply_defaults timeout: @config.timeout,
1088
+ metadata: @config.metadata,
1089
+ retry_policy: @config.retry_policy
1090
+
1091
+ @environments_stub.fetch_database_properties request, options do |result, operation|
1092
+ yield result, operation if block_given?
1093
+ return result
1094
+ end
1095
+ rescue ::Gapic::Rest::Error => e
1096
+ raise ::Google::Cloud::Error.from_error(e)
1097
+ end
1098
+
757
1099
  ##
758
1100
  # Configuration class for the Environments REST API.
759
1101
  #
@@ -905,6 +1247,21 @@ module Google
905
1247
  #
906
1248
  attr_reader :delete_environment
907
1249
  ##
1250
+ # RPC-specific configuration for `execute_airflow_command`
1251
+ # @return [::Gapic::Config::Method]
1252
+ #
1253
+ attr_reader :execute_airflow_command
1254
+ ##
1255
+ # RPC-specific configuration for `stop_airflow_command`
1256
+ # @return [::Gapic::Config::Method]
1257
+ #
1258
+ attr_reader :stop_airflow_command
1259
+ ##
1260
+ # RPC-specific configuration for `poll_airflow_command`
1261
+ # @return [::Gapic::Config::Method]
1262
+ #
1263
+ attr_reader :poll_airflow_command
1264
+ ##
908
1265
  # RPC-specific configuration for `save_snapshot`
909
1266
  # @return [::Gapic::Config::Method]
910
1267
  #
@@ -914,6 +1271,16 @@ module Google
914
1271
  # @return [::Gapic::Config::Method]
915
1272
  #
916
1273
  attr_reader :load_snapshot
1274
+ ##
1275
+ # RPC-specific configuration for `database_failover`
1276
+ # @return [::Gapic::Config::Method]
1277
+ #
1278
+ attr_reader :database_failover
1279
+ ##
1280
+ # RPC-specific configuration for `fetch_database_properties`
1281
+ # @return [::Gapic::Config::Method]
1282
+ #
1283
+ attr_reader :fetch_database_properties
917
1284
 
918
1285
  # @private
919
1286
  def initialize parent_rpcs = nil
@@ -927,10 +1294,20 @@ module Google
927
1294
  @update_environment = ::Gapic::Config::Method.new update_environment_config
928
1295
  delete_environment_config = parent_rpcs.delete_environment if parent_rpcs.respond_to? :delete_environment
929
1296
  @delete_environment = ::Gapic::Config::Method.new delete_environment_config
1297
+ execute_airflow_command_config = parent_rpcs.execute_airflow_command if parent_rpcs.respond_to? :execute_airflow_command
1298
+ @execute_airflow_command = ::Gapic::Config::Method.new execute_airflow_command_config
1299
+ stop_airflow_command_config = parent_rpcs.stop_airflow_command if parent_rpcs.respond_to? :stop_airflow_command
1300
+ @stop_airflow_command = ::Gapic::Config::Method.new stop_airflow_command_config
1301
+ poll_airflow_command_config = parent_rpcs.poll_airflow_command if parent_rpcs.respond_to? :poll_airflow_command
1302
+ @poll_airflow_command = ::Gapic::Config::Method.new poll_airflow_command_config
930
1303
  save_snapshot_config = parent_rpcs.save_snapshot if parent_rpcs.respond_to? :save_snapshot
931
1304
  @save_snapshot = ::Gapic::Config::Method.new save_snapshot_config
932
1305
  load_snapshot_config = parent_rpcs.load_snapshot if parent_rpcs.respond_to? :load_snapshot
933
1306
  @load_snapshot = ::Gapic::Config::Method.new load_snapshot_config
1307
+ database_failover_config = parent_rpcs.database_failover if parent_rpcs.respond_to? :database_failover
1308
+ @database_failover = ::Gapic::Config::Method.new database_failover_config
1309
+ fetch_database_properties_config = parent_rpcs.fetch_database_properties if parent_rpcs.respond_to? :fetch_database_properties
1310
+ @fetch_database_properties = ::Gapic::Config::Method.new fetch_database_properties_config
934
1311
 
935
1312
  yield self if block_given?
936
1313
  end