@@ -2653,6 +2653,299 @@ def error_code(self):
2653
2653
# Done; return the response.
2654
2654
return response
2655
2655
2656
+ def perform_maintenance_unary (self ,
2657
+ request : Optional [Union [compute .PerformMaintenanceNodeGroupRequest , dict ]] = None ,
2658
+ * ,
2659
+ project : Optional [str ] = None ,
2660
+ zone : Optional [str ] = None ,
2661
+ node_group : Optional [str ] = None ,
2662
+ node_groups_perform_maintenance_request_resource : Optional [compute .NodeGroupsPerformMaintenanceRequest ] = None ,
2663
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
2664
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
2665
+ metadata : Sequence [Tuple [str , str ]] = (),
2666
+ ) -> compute .Operation :
2667
+ r"""Perform maintenance on a subset of nodes in the node
2668
+ group.
2669
+
2670
+ .. code-block:: python
2671
+
2672
+ # This snippet has been automatically generated and should be regarded as a
2673
+ # code template only.
2674
+ # It will require modifications to work:
2675
+ # - It may require correct/in-range values for request initialization.
2676
+ # - It may require specifying regional endpoints when creating the service
2677
+ # client as shown in:
2678
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2679
+ from google.cloud import compute_v1
2680
+
2681
+ def sample_perform_maintenance():
2682
+ # Create a client
2683
+ client = compute_v1.NodeGroupsClient()
2684
+
2685
+ # Initialize request argument(s)
2686
+ request = compute_v1.PerformMaintenanceNodeGroupRequest(
2687
+ node_group="node_group_value",
2688
+ project="project_value",
2689
+ zone="zone_value",
2690
+ )
2691
+
2692
+ # Make the request
2693
+ response = client.perform_maintenance(request=request)
2694
+
2695
+ # Handle the response
2696
+ print(response)
2697
+
2698
+ Args:
2699
+ request (Union[google.cloud.compute_v1.types.PerformMaintenanceNodeGroupRequest, dict]):
2700
+ The request object. A request message for
2701
+ NodeGroups.PerformMaintenance. See the
2702
+ method description for details.
2703
+ project (str):
2704
+ Project ID for this request.
2705
+ This corresponds to the ``project`` field
2706
+ on the ``request`` instance; if ``request`` is provided, this
2707
+ should not be set.
2708
+ zone (str):
2709
+ The name of the zone for this
2710
+ request.
2711
+
2712
+ This corresponds to the ``zone`` field
2713
+ on the ``request`` instance; if ``request`` is provided, this
2714
+ should not be set.
2715
+ node_group (str):
2716
+ Name of the node group scoping this
2717
+ request.
2718
+
2719
+ This corresponds to the ``node_group`` field
2720
+ on the ``request`` instance; if ``request`` is provided, this
2721
+ should not be set.
2722
+ node_groups_perform_maintenance_request_resource (google.cloud.compute_v1.types.NodeGroupsPerformMaintenanceRequest):
2723
+ The body resource for this request
2724
+ This corresponds to the ``node_groups_perform_maintenance_request_resource`` field
2725
+ on the ``request`` instance; if ``request`` is provided, this
2726
+ should not be set.
2727
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2728
+ should be retried.
2729
+ timeout (float): The timeout for this request.
2730
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
2731
+ sent along with the request as metadata.
2732
+
2733
+ Returns:
2734
+ google.api_core.extended_operation.ExtendedOperation:
2735
+ An object representing a extended
2736
+ long-running operation.
2737
+
2738
+ """
2739
+ # Create or coerce a protobuf request object.
2740
+ # - Quick check: If we got a request object, we should *not* have
2741
+ # gotten any keyword arguments that map to the request.
2742
+ has_flattened_params = any ([project , zone , node_group , node_groups_perform_maintenance_request_resource ])
2743
+ if request is not None and has_flattened_params :
2744
+ raise ValueError ('If the `request` argument is set, then none of '
2745
+ 'the individual field arguments should be set.' )
2746
+
2747
+ # - Use the request object if provided (there's no risk of modifying the input as
2748
+ # there are no flattened fields), or create one.
2749
+ if not isinstance (request , compute .PerformMaintenanceNodeGroupRequest ):
2750
+ request = compute .PerformMaintenanceNodeGroupRequest (request )
2751
+ # If we have keyword arguments corresponding to fields on the
2752
+ # request, apply these.
2753
+ if project is not None :
2754
+ request .project = project
2755
+ if zone is not None :
2756
+ request .zone = zone
2757
+ if node_group is not None :
2758
+ request .node_group = node_group
2759
+ if node_groups_perform_maintenance_request_resource is not None :
2760
+ request .node_groups_perform_maintenance_request_resource = node_groups_perform_maintenance_request_resource
2761
+
2762
+ # Wrap the RPC method; this adds retry and timeout information,
2763
+ # and friendly error handling.
2764
+ rpc = self ._transport ._wrapped_methods [self ._transport .perform_maintenance ]
2765
+
2766
+ # Certain fields should be provided within the metadata header;
2767
+ # add these here.
2768
+ metadata = tuple (metadata ) + (
2769
+ gapic_v1 .routing_header .to_grpc_metadata ((
2770
+ ("project" , request .project ),
2771
+ ("zone" , request .zone ),
2772
+ ("node_group" , request .node_group ),
2773
+ )),
2774
+ )
2775
+
2776
+ # Validate the universe domain.
2777
+ self ._validate_universe_domain ()
2778
+
2779
+ # Send the request.
2780
+ response = rpc (
2781
+ request ,
2782
+ retry = retry ,
2783
+ timeout = timeout ,
2784
+ metadata = metadata ,
2785
+ )
2786
+
2787
+ # Done; return the response.
2788
+ return response
2789
+
2790
+ def perform_maintenance (self ,
2791
+ request : Optional [Union [compute .PerformMaintenanceNodeGroupRequest , dict ]] = None ,
2792
+ * ,
2793
+ project : Optional [str ] = None ,
2794
+ zone : Optional [str ] = None ,
2795
+ node_group : Optional [str ] = None ,
2796
+ node_groups_perform_maintenance_request_resource : Optional [compute .NodeGroupsPerformMaintenanceRequest ] = None ,
2797
+ retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
2798
+ timeout : Union [float , object ] = gapic_v1 .method .DEFAULT ,
2799
+ metadata : Sequence [Tuple [str , str ]] = (),
2800
+ ) -> extended_operation .ExtendedOperation :
2801
+ r"""Perform maintenance on a subset of nodes in the node
2802
+ group.
2803
+
2804
+ .. code-block:: python
2805
+
2806
+ # This snippet has been automatically generated and should be regarded as a
2807
+ # code template only.
2808
+ # It will require modifications to work:
2809
+ # - It may require correct/in-range values for request initialization.
2810
+ # - It may require specifying regional endpoints when creating the service
2811
+ # client as shown in:
2812
+ # https://googleapis.dev/python/google-api-core/latest/client_options.html
2813
+ from google.cloud import compute_v1
2814
+
2815
+ def sample_perform_maintenance():
2816
+ # Create a client
2817
+ client = compute_v1.NodeGroupsClient()
2818
+
2819
+ # Initialize request argument(s)
2820
+ request = compute_v1.PerformMaintenanceNodeGroupRequest(
2821
+ node_group="node_group_value",
2822
+ project="project_value",
2823
+ zone="zone_value",
2824
+ )
2825
+
2826
+ # Make the request
2827
+ response = client.perform_maintenance(request=request)
2828
+
2829
+ # Handle the response
2830
+ print(response)
2831
+
2832
+ Args:
2833
+ request (Union[google.cloud.compute_v1.types.PerformMaintenanceNodeGroupRequest, dict]):
2834
+ The request object. A request message for
2835
+ NodeGroups.PerformMaintenance. See the
2836
+ method description for details.
2837
+ project (str):
2838
+ Project ID for this request.
2839
+ This corresponds to the ``project`` field
2840
+ on the ``request`` instance; if ``request`` is provided, this
2841
+ should not be set.
2842
+ zone (str):
2843
+ The name of the zone for this
2844
+ request.
2845
+
2846
+ This corresponds to the ``zone`` field
2847
+ on the ``request`` instance; if ``request`` is provided, this
2848
+ should not be set.
2849
+ node_group (str):
2850
+ Name of the node group scoping this
2851
+ request.
2852
+
2853
+ This corresponds to the ``node_group`` field
2854
+ on the ``request`` instance; if ``request`` is provided, this
2855
+ should not be set.
2856
+ node_groups_perform_maintenance_request_resource (google.cloud.compute_v1.types.NodeGroupsPerformMaintenanceRequest):
2857
+ The body resource for this request
2858
+ This corresponds to the ``node_groups_perform_maintenance_request_resource`` field
2859
+ on the ``request`` instance; if ``request`` is provided, this
2860
+ should not be set.
2861
+ retry (google.api_core.retry.Retry): Designation of what errors, if any,
2862
+ should be retried.
2863
+ timeout (float): The timeout for this request.
2864
+ metadata (Sequence[Tuple[str, str]]): Strings which should be
2865
+ sent along with the request as metadata.
2866
+
2867
+ Returns:
2868
+ google.api_core.extended_operation.ExtendedOperation:
2869
+ An object representing a extended
2870
+ long-running operation.
2871
+
2872
+ """
2873
+ # Create or coerce a protobuf request object.
2874
+ # - Quick check: If we got a request object, we should *not* have
2875
+ # gotten any keyword arguments that map to the request.
2876
+ has_flattened_params = any ([project , zone , node_group , node_groups_perform_maintenance_request_resource ])
2877
+ if request is not None and has_flattened_params :
2878
+ raise ValueError ('If the `request` argument is set, then none of '
2879
+ 'the individual field arguments should be set.' )
2880
+
2881
+ # - Use the request object if provided (there's no risk of modifying the input as
2882
+ # there are no flattened fields), or create one.
2883
+ if not isinstance (request , compute .PerformMaintenanceNodeGroupRequest ):
2884
+ request = compute .PerformMaintenanceNodeGroupRequest (request )
2885
+ # If we have keyword arguments corresponding to fields on the
2886
+ # request, apply these.
2887
+ if project is not None :
2888
+ request .project = project
2889
+ if zone is not None :
2890
+ request .zone = zone
2891
+ if node_group is not None :
2892
+ request .node_group = node_group
2893
+ if node_groups_perform_maintenance_request_resource is not None :
2894
+ request .node_groups_perform_maintenance_request_resource = node_groups_perform_maintenance_request_resource
2895
+
2896
+ # Wrap the RPC method; this adds retry and timeout information,
2897
+ # and friendly error handling.
2898
+ rpc = self ._transport ._wrapped_methods [self ._transport .perform_maintenance ]
2899
+
2900
+ # Certain fields should be provided within the metadata header;
2901
+ # add these here.
2902
+ metadata = tuple (metadata ) + (
2903
+ gapic_v1 .routing_header .to_grpc_metadata ((
2904
+ ("project" , request .project ),
2905
+ ("zone" , request .zone ),
2906
+ ("node_group" , request .node_group ),
2907
+ )),
2908
+ )
2909
+
2910
+ # Validate the universe domain.
2911
+ self ._validate_universe_domain ()
2912
+
2913
+ # Send the request.
2914
+ response = rpc (
2915
+ request ,
2916
+ retry = retry ,
2917
+ timeout = timeout ,
2918
+ metadata = metadata ,
2919
+ )
2920
+
2921
+ operation_service = self ._transport ._zone_operations_client
2922
+ operation_request = compute .GetZoneOperationRequest ()
2923
+ operation_request .project = request .project
2924
+ operation_request .zone = request .zone
2925
+ operation_request .operation = response .name
2926
+
2927
+ get_operation = functools .partial (operation_service .get , operation_request )
2928
+ # Cancel is not part of extended operations yet.
2929
+ cancel_operation = lambda : None
2930
+
2931
+ # Note: this class is an implementation detail to provide a uniform
2932
+ # set of names for certain fields in the extended operation proto message.
2933
+ # See google.api_core.extended_operation.ExtendedOperation for details
2934
+ # on these properties and the expected interface.
2935
+ class _CustomOperation (extended_operation .ExtendedOperation ):
2936
+ @property
2937
+ def error_message (self ):
2938
+ return self ._extended_operation .http_error_message
2939
+
2940
+ @property
2941
+ def error_code (self ):
2942
+ return self ._extended_operation .http_error_status_code
2943
+
2944
+ response = _CustomOperation .make (get_operation , cancel_operation , response )
2945
+
2946
+ # Done; return the response.
2947
+ return response
2948
+
2656
2949
def set_iam_policy (self ,
2657
2950
request : Optional [Union [compute .SetIamPolicyNodeGroupRequest , dict ]] = None ,
2658
2951
* ,
0 commit comments