
                            S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr  SSKJ	r	  SSK
Jr  SS	KJr  SS
KJr  S rS r S?S jrS rS rS rS rS rS\R.                  4S jrS\R.                  4S jrS\R.                  4S jrS\R.                  4S jrS\R.                  4S jrS@S\R.                  4S jjrS@S jrS rS r  S@S jr! S@S jr"S  r# S@S\R.                  4S! jjr$S\R.                  4S" jr%S\R.                  4S# jr& S@S\R.                  4S$ jjr'S@S% jr( S@S\R.                  4S& jjr)S\R.                  4S' jr*S@S( jr+S@S) jr, S@S* jr-S@S+ jr. S@S\R.                  4S, jjr/ S@S\R.                  4S- jjr0S@S. jr1S@S/ jr2S0 r3S1 r4S2 r5S3 r6S@S4 jr7S@S5 jr8S6 r9S7 r:S8 r;S9 r<S@S: jr=S@S; jr> S@S\R.                  4S< jjr?S\R.                  4S= jr@S\R.                  4S> jrAg)AzKHelpers for flags in commands for Anthos standalone clusters on bare metal.    )absolute_import)division)unicode_literals)arg_parsers)parser_arguments)concepts)cluster_flags)concept_parsers)presentation_specsc                  ,    [         R                  " SSS9$ )Nstandalone_clusterzcluster of the {resource}.name	help_textr    ResourceParameterAttributeConfig     Olib/googlecloudsdk/command_lib/container/bare_metal/standalone_cluster_flags.py StandaloneClusterAttributeConfigr      s    		2	2,
 r   c                      [         R                  " SS[        5       [        R                  " 5       [         R
                  S9$ )Nz8gkeonprem.projects.locations.bareMetalStandaloneClustersr   )resource_namebareMetalStandaloneClustersIdlocationsId
projectsId)r   ResourceSpecr   r	   LocationAttributeConfig DEFAULT_PROJECT_ATTRIBUTE_CONFIGr   r   r    GetStandaloneClusterResourceSpecr   $   s6    			@($D$F779::
 r   Nc                     U(       a  SOSn[         R                  R                  U[        5       SR	                  U5      UUS9R                  U 5        g)a  Adds a resource argument for an Anthos on bare metal standalone cluster.

Args:
  parser: The argparse parser to add the resource arg to.
  verb: str, the verb to describe the resource, such as 'to update'.
  positional: bool, whether the argument is positional or not.
  required: bool, whether the argument is required or not.
  flag_name_overrides: {str: str}, dict of attribute names to the desired flag
    name.
r   z	--clusterzstandalone cluster {}requiredflag_name_overridesN)r
   ConceptParserForResourcer   formatAddToParser)parserverb
positionalr"   r#   r   s         r   AddStandaloneClusterResourceArgr+   .   sP     ",	$++
&($$T*- ,  Kr   c                  ,    [         R                  " SSS9$ )z9Gets standalone cluster membership ID resource attribute.
membershipzj membership of the {resource}, in the form of projects/PROJECT/locations/LOCATION/memberships/MEMBERSHIP. r   r   r   r   r   ,StandaloneClusterMembershipIdAttributeConfigr.   E   s    		2	2J
 r   c                  ,    [         R                  " SSS9$ )z?Gets standalone cluster membership location resource attribute.locationz)Google Cloud location for the {resource}.r   r   r   r   r   2StandaloneClusterMembershipLocationAttributeConfigr1   P   s    		2	2;
 r   c                  ,    [         R                  " SSS9$ )z-Gets Google Cloud project resource attribute.projectz(Google Cloud project for the {resource}.r   r   r   r   r   1StandaloneClusterMembershipProjectAttributeConfigr4   X   s    		2	2:
 r   c                  b    [         R                  " SS[        5       [        5       [	        5       S9$ )Nz%gkehub.projects.locations.membershipsr-   )r   membershipsIdr   r   )r   r   r.   r1   r4   r   r   r   *GetStandaloneClusterMembershipResourceSpecr7   `   s-    			- @BDFBD
 r   c           	          UR                  S5      nUR                  S5      nU(       a  SOSn[        R                  R                  U[	        5       SUSSS.S	9R                  U 5        g
)zAdds a resource argument for a bare metal standalone cluster membership.

Args:
  parser: The argparse parser to add the resource arg to.
  **kwargs: Additional arguments like positional, required, etc.
r*   r"   r-   z--membershipzdmembership of the standalone cluster. Membership can be the membership ID or the full resource name.z--membership-projectz--membership-location)r3   r0   r!   N)getr
   r$   r%   r7   r'   )r(   kwargsr*   r"   r   s        r   )AddStandaloneClusterMembershipResourceArgr;   j   sl     zz,'*ZZ
#(#$++
026 +- ,  Kr   r(   c                 &    U R                  SSSS9  g)zAdds a flag for force standalone cluster operation when there are existing node pools.

Args:
  parser: The argparse parser to add the flag to.
z--force
store_truezIf set, the operation will also apply to the child node pools. This flag is required if the cluster has any associated node pools.actionhelpNadd_argumentr(   s    r   AddForceStandaloneClusterrD      s#     	L	  r   c                 &    U R                  SSSS9  g)zAdds a flag for the standalone cluster operation to return success and perform no action when there is no matching standalone cluster.

Args:
  parser: The argparse parser to add the flag to.
--allow-missingr=   zqIf set, and the Bare Metal standalone cluster is not found, the request will succeed but no action will be taken.r>   NrA   rC   s    r    AddAllowMissingStandaloneClusterrG      s"     	?	  r   c                     U R                  SSS9nUR                  S5      n[        R                  " [        R                  " S[        5       SSS0S	US
9/SS/0S9nUR                  U 5        g)zwAdds flags to specify standalone cluster version config type.

Args:
  parser: The argparse parser to add the flag to.
z Use cases for querying versions.Tmutexz<Upgrade an Anthos on bare metal standalone cluster use case.z--standalone-clusterz1Standalone cluster to query versions for upgrade.r0    F)r#   r"   groupz--standalone-cluster.locationz
--location)command_level_fallthroughsN)	add_groupr
   r$   r   ResourcePresentationSpecr   r'   )r(   config_type_groupupgrade_config
arg_parsers       r   AddStandaloneConfigTyperS      s     &&( '  %..D. ,,

5
5$.0A#-r"2"	 *L>"*  r   c                 &    U R                  SSSS9  g)ak  Adds a flag to enable allow missing in an update cluster request.

If set to true, and the standalone cluster is not found, the request will
create a new standalone cluster with the provided configuration. The user
must have both create and update permission to call Update with
allow_missing set to true.

Args:
  parser: The argparse parser to add the flag to.
rF   r=   zIf set, and the Anthos standalone cluster on bare metal is not found, the update request will try to create a new standalone cluster with the provided configuration.r>   NrA   rC   s    r   &AddAllowMissingUpdateStandaloneClusterrU      s"     	6	  r   c                 &    U R                  SSSS9  g)zAdds a flag to only validate the request without performing the operation.

Args:
  parser: The argparse parser to add the flag to.
z--validate-onlyr=   zMIf set, only validate the request, but do not actually perform the operation.r>   NrA   rC   s    r   AddValidationOnlyrW      s"     		  r   c                 4    U(       + nU R                  SUSS9  g)zAdds a flag to specify the Anthos on bare metal standalone cluster version.

Args:
  parser: The argparse parser to add the flag to.
  is_update: bool, whether the flag is for update command or not.
z	--versionzAAnthos on bare metal version for the standalone cluster resource.)r"   r@   NrA   )r(   	is_updater"   s      r   
AddVersionrZ      s'     ](N  r   c           
          U(       + nU R                  SUSS9nSnUR                  SU[        R                  " 5       SS9  UR                  SSS	[        R                  " [
        [
        S
.S/S9S9  g)zAdds flags to set the control plane node config.

Args:
  bare_metal_node_config_group: The parent mutex group to add the flags to.
  is_update: bool, whether the flag is for update command or not.
z#Populate control plane node config.T)r@   r"   rJ   a  
Path of the YAML/JSON file that contains the control plane node configs.

Examples:

  nodeConfigs:
  - nodeIP: 10.200.0.10
    labels:
      node1: label1
      node2: label2
  - nodeIP: 10.200.0.11
    labels:
      node3: label3
      node4: label4

List of supported fields in `nodeConfigs`

KEY           | VALUE                     | NOTE
--------------|---------------------------|---------------------------
nodeIP        | string                    | required, mutable
labels        | one or more key-val pairs | optional, mutable

z&--control-plane-node-configs-from-filer@   typehiddenz--control-plane-node-configsz!Control plane node configuration.appendnode-iplabelsra   specrequired_keysr@   r?   r]   NrN   rB   r   YAMLFileContentsArgDictstr)bare_metal_node_config_grouprY   r"   node_config_mutex_group.control_plane_node_configs_from_file_help_texts        r   _AddControlPlaneNodeConfigsrn      s     ](8BB084 C 40. &&.9'')	 '  &&$. #	 ' r   c                 N    U R                  SS[        R                  " 5       SS9  g)zAdds a flag to assign labels to nodes in a node pool.

Args:
  bare_metal_node_config_group: The parent group to add the flags to.
z--control-plane-node-labels	KEY=VALUEz(Labels assigned to nodes of a node pool.metavarr]   r@   NrB   r   ri   rk   s    r   _AddControlPlaneNodeLabelsru   0  s,     ++# 5	 , r   c                 N    U R                  SSS[        R                  " 5       S9  g)zAdds a flag to specify the node taint in the node pool.

Args:
  bare_metal_node_config_group: The parent group to add the flags to.
z--control-plane-node-taintsKEY=VALUE:EFFECTz;Node taint applied to every Kubernetes node in a node pool.rr   r@   r]   Nrs   rt   s    r   _AddControlPlaneNodeTaintsry   >  s,     ++# H 	 , r   c                     U(       + nU R                  SUS9nUR                  SUS9n[        XA5        [        U5        [        U5        g)zAdds a command group to set the node pool config.

Args:
  bare_metal_control_plane_node_pool_config_group: The argparse parser to add
    the flag to.
  is_update: bool, whether the flag is for update command or not.
zEAnthos on bare metal node pool configuration for control plane nodes.r@   r"   z@Anthos on bare metal node configuration for control plane nodes.N)rN   rn   ru   ry   )/bare_metal_control_plane_node_pool_config_grouprY   r"   !bare_metal_node_pool_config_grouprk   s        r   _AddNodePoolConfigr~   L  si     ](&U&_&_  '` '# "C!L!LM "M "
 :F9:9:r   c                 H    U(       + nU R                  SUS9n[        X15        g)zAdds a command group to set the control plane node pool config.

Args:
  bare_metal_control_plane_config_group: The argparse parser to add the flag
    to.
  is_update: bool, whether the flag is for update command or not.
zNAnthos on bare metal standalone cluster control plane node pool configuration.r{   N)rN   r~   )%bare_metal_control_plane_config_grouprY   r"   r|   s       r   _AddControlPlaneNodePoolConfigr   h  s7     ](4Y4c4c  5d 51 DPr   c                 N    U R                  SSS[        R                  " 5       S9  g)zAdds a flag to specify the API server args.

Args:
  bare_metal_control_plane_config_group: The parent group to add the flags to.
z--api-server-argsrp   z"API Server argument configuration.rx   Nrs   )r   s    r   _AddControlPlaneAPIServerArgsr   }  s,     (44/ 	 5 r   c                 ^    U(       + nU R                  SUS9n[        X15        [        U5        g)zAdds a command group to set the control plane config.

Args:
  parser: The argparse parser to add the flag to.
  is_update: bool, whether the flag is for update command or not.
zDAnthos on bare metal standalone cluster control plane configuration.r{   N)rN   r   r   )r(   rY   r"   r   s       r   AddControlPlaneConfigr     s?     ](*0*:*:
P	 +; +' !+   EFr   c                 .    U R                  S[        SS9  g)zqAdds a flag to specify the description of the resource.

Args:
  parser: The argparse parser to add the flag to.
z--descriptionzDescription for the resource.r]   r@   N)rB   rj   rC   s    r   AddDescriptionr     s     	C&E  r   c                 D    U R                  SS9nUR                  SSSS9  g)ztAdds a command group to set the cluster operations config.

Args:
  parser: The argparse parser to add the flag to.
zAAnthos on bare metal standalone cluster operations configuration.r@   z--enable-application-logsr=   zfWhether collection of application logs/metrics should be enabled (in addition to system logs/metrics).r>   NrN   rB   )r(   *bare_metal_cluster_operations_config_groups     r   AddClusterOperationsConfigr     s>     06/?/?N 0@ 0, -99!/	 : r   c                 |    U(       + nU R                  SS9nUR                  S[        R                  " 5       SSUS9  g)zAdds a command group to set the maintenance config.

Args:
  parser: The argparse parser to add the flag to.
  is_update: bool, whether the flag is for update command or not.
zBAnthos on bare metal standalone cluster maintenance configuration.r   z!--maintenance-address-cidr-blocksMAINTENANCE_ADDRESS_CIDR_BLOCKSz2IPv4 addresses to be placed into maintenance mode.)r]   rr   r@   r"   N)rN   rB   r   ArgList)r(   rY   r"   #bare_metal_maintenance_config_groups       r   AddMaintenanceConfigr     sQ     ]((.(8(8O )9 )% &22) /? 3 r   c                 T    U(       + nU R                  SS9nUR                  SSSUS9  g)zAdds flags to specify applied and managed RBAC policy.

Args:
  bare_metal_security_config_group: The parent group to add the flags to.
  is_update: bool, whether the flag is for update command or not.
zMCluster authorization configurations to bootstrap onto the standalone clusterr   z--admin-userszgUsers that will be granted the cluster-admin role on the cluster, providing full access to the cluster.r_   )r@   r?   r"   Nr   ) bare_metal_security_config_grouprY   r"   authorization_groups       r   _AddAuthorizationr     sL     ](8BB  C  ""3  # r   c                 8    U R                  SS9n[        X!5        g)zAdds a command group to set the security config.

Args:
  parser: The argparse parser to add the flag to.
  is_update: bool, whether the flag is for update command or not.
z?Anthos on bare metal standalone cluster security configuration.r   N)rN   r   )r(   rY   r   s      r   AddSecurityConfigr     s(     &,%5%5L &6 &" 4@r   c                 L    U R                  SS9nUR                  S[        SS9  g)zmAdds a command group to set the node access config.

Args:
  parser: The argparse parser to add the flag to.
zMAnthos on bare metal node access related settings for the standalone cluster.r   z--login-userz'User name used to access node machines.r   N)rN   rB   rj   )r(   #bare_metal_node_access_config_groups     r   AddNodeAccessConfigr      s=     )/(8(8 )9 )% &224 3 r   c                 v    U(       + nU R                  SUS9nUR                  SSSS9  UR                  SSSS9  g	)
zAdds a flag to specify the enablement of SR-IOV Config.

Args:
  sr_iov_config_group: The parent group to add the flags to.
  is_update: bool, True to add flags for update command, False to add flags
    for create command.
T)rJ   r"   z--enable-sr-iov-configr=   z$If set, install the SR-IOV operator.r>   z--disable-sr-iov-configz/If set, the SR-IOV operator won't be installed.Nr   )sr_iov_config_grouprY   r"   sr_iov_config_mutex_groups       r   _AddEnableSrIovConfigr     sb     ](1;;8 <  ((1 )  ((< ) r   c                 H    U(       + nU R                  SUS9n[        X15        g)zAdds a flag to specify the SR-IOV Config.

Args:
  bare_metal_network_config_group: The parent group to add the flags to.
  is_update: bool, True to add flags for update command, False to add flags
    for create command.
z=Anthos on bare metal standalone cluster SR-IOV configuration.r{   N)rN   r   )bare_metal_network_config_grouprY   r"   r   s       r   _AddSrIovConfigr   .  s3     ](7AAJ B 
 +7r   c           	      \    U(       + nU R                  SSU[        R                  " SS9SS9  g)zAdds a flag to specify the IPv4 address ranges used in the services in the cluster.

Args:
  bare_metal_island_mode_cidr_config_group: The parent group to add the flag
    to.
  is_update: bool, whether the flag is for update command or not.
z)--island-mode-service-address-cidr-blocksSERVICE_ADDRESS   )
min_lengthz3IPv4 address range for all services in the cluster.)rr   r"   r]   r@   N)rB   r   r   )(bare_metal_island_mode_cidr_config_grouprY   r"   s      r   _AddServiceAddressCIDRBlocksr   ?  s>     ](*771 A 8 r   c                 8    U R                  SS9n[        X!5        g)zAdds island mode CIDR config related flags.

Args:
  bare_metal_network_config_group: The parent group to add the flag to.
  is_update: bool, whether the flag is for update command or not.
z'Island mode CIDR network configuration.r   N)rN   r   )r   rY   r   s      r   _AddIslandModeCIDRConfigr   U  s,     &//8 0  +
 .r   c                 J    U(       + nU R                  SUSS9n[        X15        g)zAdds network mode config related flags.

Args:
  parser: The argparse parser to add the flag to.
  is_update: bool, whether the flag is for update command or not.
Tz$Populate one of the network configs.rJ   r"   r@   N)rN   r   )r(   rY   r"   network_config_mutex_groups       r   _AddNetworkModeConfigr   f  s5     ](%//1  0   5Ar   c                 ^    U(       + nU R                  SUS9n[        X15        [        X15        g)zAdds network config related flags.

Args:
  parser: The argparse parser to add the flag to.
  is_update: bool, whether the flag is for update command or not.
z>Anthos on bare metal standalone cluster network configuration.r{   N)rN   r   r   )r(   rY   r"   r   s       r   AddNetworkConfigr   y  s;     ]($*$4$4K %5 %!
 7C1=r   c                 :    U R                  SU(       + S[        S9  g)zAdds flags for ASN used by BGP LB load balancer of the cluster.

Args:
 bgp_lb_config_group: The parent group to add the flags to.
 is_update: bool, whether the flag is for update command or not.
z--bgp-lb-asnz2BGP autonomous system number (ASN) of the cluster.)r"   r@   r]   N)rB   int)bgp_lb_config_grouprY   s     r   _AddBGPLBAsnr     s%     ""}?	 # r   c                    U(       + nU R                  SSUS9nSnUR                  SU[        R                  " 5       SS9  UR                  SSS[        R                  " [
        [        [        R                  " S	S
9S.SS/S9S9  g)zAdds flags for peer configs used by BGP LB load balancer.

Args:
  bgp_lb_config_group: The parent group to add the flags to.
  is_update: bool, whether the flag is for update command or not.
zBGP LB peer configuration.Tr@   rJ   r"   a  
Path of the YAML/JSON file that contains the BGP LB peer configs.

Examples:

  bgpPeerConfigs:
  - asn: 1000
    controlPlaneNodes:
    - 10.200.0.14/32
    - 10.200.0.15/32
    ipAddress: 10.200.0.16/32
  - asn: 1001
    controlPlaneNodes:
    - 10.200.0.17/32
    - 10.200.0.18/32
    ipAddress: 10.200.0.19/32

List of supported fields in `bgpPeerConfigs`

KEY               | VALUE                 | NOTE
------------------|-----------------------|---------------------------
asn               | int                   | required, mutable
controlPlaneNodes | one or more IP ranges | optional, mutable
ipAddress         | valid IP address      | required, mutable

z--bgp-lb-peer-configs-from-filer\   z--bgp-lb-peer-configsr_   ;custom_delim_char)asn
ip-addresszcontrol-plane-nodesr   r   rc   rf   N)rN   rB   r   rh   ri   r   rj   r   )r   rY   r"   bgp_lb_peer_configs_mutex_group'bgp_lb_peer_configs_from_file_help_texts        r   _AddBGPLBPeerConfigsr     s     ]($7$A$A' %B %!
-)4 "..'2'')	 /  "..'%0%8%83%O
 -	 / r   c           
          U R                  SSS9nSnUR                  SU[        R                  " 5       SS9  UR                  SSS	[        R                  " [
        [
        S
.S/S9S9  g)zwAdds flags to set the BGP LB node config.

Args:
  bare_metal_bgp_lb_node_config: The parent group to add the flag to.
z*Populate BGP LB load balancer node config.Tr@   rJ   a  
Path of the YAML/JSON file that contains the BGP LB node configs.

Examples:

  nodeConfigs:
  - nodeIP: 10.200.0.10
    labels:
      node1: label1
      node2: label2
  - nodeIP: 10.200.0.11
    labels:
      node3: label3
      node4: label4

List of supported fields in `nodeConfigs`

KEY           | VALUE                     | NOTE
--------------|---------------------------|---------------------------
nodeIP        | string                    | required, mutable
labels        | one or more key-val pairs | optional, mutable

z---bgp-lb-load-balancer-node-configs-from-filer\   z#--bgp-lb-load-balancer-node-configsz(BGP LB load balancer node configuration.r_   r`   ra   rc   rf   Nrg   )bare_metal_bgp_lb_node_configrl   'bgp_lb_node_configs_from_file_help_texts      r   _AddBGPLBNodeConfigsr     s     :CC7t D -). &&52'')	 '  &&+5 #	 ' r   c                 N    U R                  SS[        R                  " 5       SS9  g)zAdds a flag to assign labels to nodes in a BGP LB node pool.

Args:
  bare_metal_bgp_lb_node_config: The parent group to add the flags to.
z"--bgp-lb-load-balancer-node-labelsrp   z/Labels assigned to nodes of a BGP LB node pool.rq   Nrs   r   s    r   _AddBGPLBNodeLabelsr     s,      ,,* <	 - r   c                 N    U R                  SSS[        R                  " 5       S9  g)zAdds a flag to specify the node taint in the BGP LB node pool.

Args:
 bare_metal_bgp_lb_node_config: The parent group to add the flags to.
z"--bgp-lb-load-balancer-node-taintsrw   z7Node taint applied to every node in a BGP LB node pool.rx   Nrs   r   s    r   _AddBGPLBNodeTaintsr     s,      ,,* D 	 - r   c                     U R                  SS9nUR                  SS9n[        U5        [        U5        [        U5        g)zAdds a command group to set the node pool config for BGP LB load balancer.

Args:
 bgp_lb_config_group: The argparse parser to add the flag to.
zLAnthos on bare metal node pool configuration for BGP LB load balancer nodes.r   zBGP LB Node Pool configuration.N)rN   r   r   r   )r   (bare_metal_bgp_lb_node_pool_config_groupr   s      r   _AddBGPLBNodePoolConfigr   '  s[     .A-J-J .K .* /880 9    453434r   c                 R   U(       + nU R                  SSUS9nSnUR                  SU[        R                  " 5       SS9  UR                  SSS[        R                  " [
        [        R                  " 5       [        R                  " 5       [        R                  " S	S
9S.SS/S9S9  g)zAdds flags for address pools used by BGP LB load balancer.

Args:
  bgp_lb_config_group: The parent group to add the flags to.
  is_update: bool, whether the flag is for update command or not.
z#BGP LB address pools configuration.Tr   a  
Path of the YAML/JSON file that contains the BGP LB address pools.

Examples:

  addressPools:
  - pool: pool-1
    addresses:
    - 10.200.0.14/32
    - 10.200.0.15/32
    avoidBuggyIPs: True
    manualAssign: True
  - pool: pool-2
    addresses:
    - 10.200.0.16/32
    avoidBuggyIPs: False
    manualAssign: False

List of supported fields in `addressPools`

KEY           | VALUE                 | NOTE
--------------|-----------------------|---------------------------
pool          | string                | required, mutable
addresses     | one or more IP ranges | required, mutable
avoidBuggyIPs | bool                  | optional, mutable, defaults to False
manualAssign  | bool                  | optional, mutable, defaults to False

z --bgp-lb-address-pools-from-filer\   z--bgp-lb-address-poolsr_   r   r   poolzavoid-buggy-ipszmanual-assign	addressesr   r   rc   rf   NrN   rB   r   rh   ri   rj   
ArgBooleanr   )r   rY   r"    bgp_lb_address_pools_mutex_group(bgp_lb_address_pools_from_file_help_texts        r   _AddBGPLBAddressPoolsr   >  s     ](%8%B%B0 &C &"
.*8 #//(3'')	 0  #//0!,!7!7!9*557&..E	  -	 0 r   c                 ~    U R                  S5      n[        X!5        [        X!5        [        X!5        [	        U5        g)zAdds flags for bgpLB load balancer.

Args:
  lb_config_mutex_group: The parent mutex group to add the flags to.
  is_update: bool, whether the flag is for update command or not.
zBGP LB ConfigurationN)rN   r   r   r   r   )lb_config_mutex_grouprY   r   s      r   _AddBGPLBConfigr   }  s>     .77 ".*6+7-.r   c           
          U R                  SSS9nSnUR                  SU[        R                  " 5       SS9  UR                  SSS	[        R                  " [
        [
        S
.S/S9S9  g)z{Adds flags to set the Metal LB node config.

Args:
  bare_metal_metal_lb_node_config: The parent group to add the flag to.
z+Populate MetalLB load balancer node config.Tr   a  
Path of the YAML/JSON file that contains the Metal LB node configs.

Examples:

  nodeConfigs:
  - nodeIP: 10.200.0.10
    labels:
      node1: label1
      node2: label2
  - nodeIP: 10.200.0.11
    labels:
      node3: label3
      node4: label4

List of supported fields in `nodeConfigs`

KEY           | VALUE                     | NOTE
--------------|---------------------------|---------------------------
nodeIP        | string                    | required, mutable
labels        | one or more key-val pairs | optional, mutable

z/--metal-lb-load-balancer-node-configs-from-filer\   z%--metal-lb-load-balancer-node-configsz)MetalLB load balancer node configuration.r_   r`   ra   rc   rf   Nrg   )bare_metal_metal_lb_node_configrl   )metal_lb_node_configs_from_file_help_texts      r   _AddMetalLBNodeConfigsr     s     <EE8 F /+. &&74'')	 '  &&-6 #	 ' r   c                 N    U R                  SS[        R                  " 5       SS9  g)zAdds a flag to assign labels to nodes in a MetalLB node pool.

Args:
  bare_metal_metal_lb_node_config: The parent group to add the flags to.
z$--metal-lb-load-balancer-node-labelsrp   z0Labels assigned to nodes of a MetalLB node pool.rq   Nrs   r   s    r   _AddMetalLBNodeLabelsr     s,     ".., =	 / r   c                 N    U R                  SSS[        R                  " 5       S9  g)zAdds a flag to specify the node taint in the MetalLBnode pool.

Args:
 bare_metal_metal_lb_node_config: The parent group to add the flags to.
z$--metal-lb-load-balancer-node-taintsrw   z8Node taint applied to every node in a MetalLB node pool.rx   Nrs   r   s    r   _AddMetalLBNodeTaintsr     s,     ".., E 	 / r   c                     U R                  SS9nUR                  SS9n[        U5        [        U5        [        U5        g)zAdds a command group to set the node pool config for MetalLB load balancer.

Args:
 metal_lb_config_group: The argparse parser to add the flag to.
zMAnthos on bare metal node pool configuration for MetalLB load balancer nodes.r   z MetalLB Node Pool configuration.N)rN   r   r   r   )metal_lb_config_group*bare_metal_metal_lb_node_pool_config_groupr   s      r   _AddMetalLBNodePoolConfigr     s[     0E/N/N 0O 0, 1::1 ;  " 897878r   c                 R   U(       + nU R                  SSUS9nSnUR                  SU[        R                  " 5       SS9  UR                  SSS[        R                  " [
        [        R                  " 5       [        R                  " 5       [        R                  " S	S
9S.SS/S9S9  g)zAdds flags for address pools used by Metal LB load balancer.

Args:
  metal_lb_config_group: The parent group to add the flags to.
  is_update: bool, whether the flag is for update command or not.
z$MetalLB address pools configuration.Tr   a  
Path of the YAML/JSON file that contains the MetalLB address pools.

Examples:

  addressPools:
  - pool: pool-1
    addresses:
    - 10.200.0.14/32
    - 10.200.0.15/32
    avoidBuggyIPs: True
    manualAssign: True
  - pool: pool-2
    addresses:
    - 10.200.0.16/32
    avoidBuggyIPs: False
    manualAssign: False

List of supported fields in `addressPools`

KEY           | VALUE                 | NOTE
--------------|-----------------------|---------------------------
pool          | string                | required, mutable
addresses     | one or more IP ranges | required, mutable
avoidBuggyIPs | bool                  | optional, mutable, defaults to False
manualAssign  | bool                  | optional, mutable, defaults to False

z"--metal-lb-address-pools-from-filer\   z--metal-lb-address-poolsr_   r   r   r   r   r   rc   rf   Nr   )r   rY   r"   "metal_lb_address_pools_mutex_group*metal_lb_address_pools_from_file_help_texts        r   _AddMetalLBAddressPoolsr     s     ]('<'F'F1 (G ($
0,8 %11*5'')	 2  %11 1!,!7!7!9*557&..E	  -	 2 r   c                 R    U R                  S5      n[        X!5        [        U5        g)zAdds flags for metalLB load balancer.

Args:
  lb_config_mutex_group: The parent mutex group to add the flags to.
  is_update: bool, whether the flag is for update command or not.
zMetalLB ConfigurationN)rN   r   r   )r   rY   r   s      r   _AddMetalLBConfigr   4  s,     099 /;12r   c                     U(       + nU R                  SUS9nUR                  SUSS9n[        XA5        [        XA5        g)zAdds a command group to set the load balancer config.

Args:
  parser: The argparse parser to add the flag to.
  is_update: bool, whether the flag is for update command or not.
zDAnthos on bare metal standalone cluster load balancer configuration.r{   Tz#Populate one of the load balancers.r   N)rN   r   r   )r(   rY   r"   %bare_metal_load_balancer_config_groupr   s        r   AddLoadBalancerConfigr   C  s^     ](*0*:*:
P	 +; +' @II0 J  )5'3r   c                 &   U R                  SS9nUR                  SSS[        R                  " 5       S9  UR                  SSS	[        R                  " 5       S9  UR                  S
SSSS9  UR                  SSS[        R                  " 5       SS9  g)z[Adds flags to update annotations.

Args:
  parser: The argparse parser to add the flag to.
TrI   z--add-annotationszKEY1=VALUE1,KEY2=VALUE2zhAdd the given key-value pairs to the current annotations, or update its value if the key already exists.rx   z--remove-annotationsz	KEY1,KEY2z%Remove annotations of the given keys.z--clear-annotationsr=   z!Clear all the current annotations)r^   r?   r@   z--set-annotationsz#Replace all the current annotations)r^   rr   r]   r@   N)rN   rB   r   ri   r   )r(   annotations_mutex_groups     r   AddUpdateAnnotationsr   ^  s     #,,4,8&&'2   '  &&2 	 '  &&.	 '  &&' 0 ' r   c                 &    U R                  SSSS9  g)z^Adds a flag for ignore_errors field.

Args:
  parser: The argparse parser to add the flag to.
z--ignore-errorsz{If set, the unenrollment of a bare metal standalone cluster resource will succeed even if errors occur during unenrollment.r=   )r@   r?   NrA   rC   s    r   AddIgnoreErrorsr     s%     	M   r   )TTN)F)B__doc__
__future__r   r   r   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   /googlecloudsdk.command_lib.container.bare_metalr	   (googlecloudsdk.command_lib.util.conceptsr
   r   r   r   r+   r.   r1   r4   r7   r;   ArgumentInterceptorrD   rG   rS   rU   rW   rZ   rn   ru   ry   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      sX   R &  ' / 4 5 I D G GK.2&6&J&J  00$!$4$H$H !<000.BB  ';; 3l @E;: 6;Q* =BG00G,+?? '7'K'K * =B00.4 =BA00A  0 D D (48$ 9>,$ =BB00B( =B>00>&9x1h5.<~/"1h9.<~3  =B40046"!1!E!E "J,@@ r   