
                             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SKJr  SSKJr   " S S\R&                  5      r " S S\5      rg)zPUtilities for gkeonprem API clients for Bare Metal Standalone cluster resources.    )absolute_import)division)unicode_literals)
list_pager)client)update_mask)arg_parsers)
exceptions)parser_extensions)
properties)gkeonprem_v1_messagesc                      \ 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	 rS\R                  4S
 jrS rS\R                  4S j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\R                  4S jrS\R                  4S jrS rS\R                  4S j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\R                  4S jr!S\R                  4S jr"S  r#S\R                  4S! jr$S\R                  4S" jr%S\R                  4S# jr&S$ r'S% r(S\R                  4S& j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\R                  4S- jr0S\R                  4S. jr1S\R                  4S/ jr2S\R                  4S0 jr3S\R                  4S1 jr4S\R                  4S2 jr5S\R                  4S3 jr6S\R                  4S4 jr7S\R                  4S5 jr8S\R                  4S6 jr9S\R                  4S7 jr:S\R                  4S8 jr;S\R                  4S9 jr<S\R                  4S: jr=S; r>S\R                  4S< jr?S\R                  4S= jr@S> rAS?rBg@)A!_BareMetalStandaloneClusterClient   z<Base class for GKE OnPrem Bare Metal Standalone API clients.argsc                 X    SUR                  5       ;   a  gSUR                  5       ;   a  gg )Nenable_sr_iov_configTdisable_sr_iov_configF)GetSpecifiedArgsDictselfr   s     Elib/googlecloudsdk/api_lib/container/gkeonprem/standalone_clusters.py_sr_iov_config_enabled8_BareMetalStandaloneClusterClient._sr_iov_config_enabled"   s-    !:!:!<<	 D$=$=$?	?    c                     SU R                  U5      0nU R                  U5      (       a  [        R                  " S0 UD6$ g)z8Constructs proto message BareMetalStandaloneSrIovConfig.enabledN )r   IsSetmessagesBareMetalStandaloneSrIovConfigr   r   kwargss      r   _sr_iov_config0_BareMetalStandaloneClusterClient._sr_iov_config*   sC     	4..t4F zz&44>v>>r   c                     S[        US/ 5      0n[        UR                  5       5      (       a  [        R                  " S0 UD6$ g)zAConstructs proto message BareMetalStandaloneIslandModeCidrConfig.serviceAddressCidrBlocks'island_mode_service_address_cidr_blocksNr   )getattranyvaluesr    'BareMetalStandaloneIslandModeCidrConfigr"   s      r   _island_mode_cidr_config:_BareMetalStandaloneClusterClient._island_mode_cidr_config5   sG     	#G;R%
F 6==?==GGGr   c                     U R                  U5      U R                  U5      S.n[        UR                  5       5      (       a  [        R
                  " S0 UD6$ g)z:Constructs proto message BareMetalStandaloneNetworkConfig.)islandModeCidrsrIovConfigNr   )r-   r$   r*   r+   r     BareMetalStandaloneNetworkConfigr"   s      r   _network_config1_BareMetalStandaloneClusterClient._network_configB   sQ     77=**40F
 6==?66@@@r   c                     UR                   (       d  / $ UR                   R                  S/ 5      nU(       d  U R                  SSS5        U Vs/ s H  nU R                  U5      PM     nnU$ s  snf )-Constructs proto message field address_pools.addressPools"--metal_lb_address_pools_from_fileMetal LB address pools file) metal_lb_address_pools_from_fileget#_raise_bad_argument_exception_error_metal_lb_address_pool)r   r   address_poolsaddress_pooladdress_pool_messagess        r   _address_pools_from_file:_BareMetalStandaloneClusterClient._address_pools_from_fileN   s    00i99==M 
..
.

' *)L 	##L1)  
 ! s   A-c                 ,   UR                  S/ 5      nU(       d  U R                  SSS5        UR                  SS5      nU(       d  U R                  SSS5        UUR                  SS5      UR                  SS5      US.n[        R                  " S	0 UD6$ )
DConstructs proto message BareMetalStandaloneLoadBalancerAddressPool.	addressesr8   r9   poolNavoidBuggyIPsmanualAssignrE   avoidBuggyIpsrH   rF   r   r;   r<   r    *BareMetalStandaloneLoadBalancerAddressPoolr   r?   rE   rF   r#   s        r   r=   8_BareMetalStandaloneClusterClient._metal_lb_address_poole   s      b1I
..
.

' FD)D
..
.

' %))/4@$((>	F >>HHHr   c                 "   UR                   (       d  / $ / nUR                    Hi  nUR                  [        R                  " UR	                  S/ 5      UR	                  SS 5      UR	                  SS 5      UR	                  SS 5      S95        Mk     U$ NrE   zavoid-buggy-ipszmanual-assignrF   rI   )metal_lb_address_poolsappendr    rL   r;   r   r   r>   r?   s       r   _address_pools_from_flag:_BareMetalStandaloneClusterClient._address_pools_from_flag   s    &&iM33

=
=$((b9(,,->E'++OTB##FD1	 4 r   c                     UR                  SS5      nU(       d  U R                  SSS5        UU R                  UR                  S0 5      5      S.n[        R                  " S0 UD6$ )	-Constructs proto message BareMetalNodeConfig.nodeIP /--metal_lb_load_balancer_node_configs_from_filenodeIpMetal LB Node configs filelabelsr[   r]   r   r;   r<   _node_labelsr    BareMetalNodeConfig)r   metal_lb_node_confignode_ipr#   s       r   _metal_lb_node_config7_BareMetalStandaloneClusterClient._metal_lb_node_config   sl    "&&x4G
..
;

& ##$8$<$<Xr$JKF
 ''1&11r   c                     UR                   (       d  / $ UR                   R                  S/ 5      nU(       d  U R                  SSS5        / nU H#  nUR                  U R	                  U5      5        M%     U$ ),Constructs proto message field node_configs.nodeConfigsrZ   r\   )-metal_lb_load_balancer_node_configs_from_filer;   r<   rR   rd   )r   r   metal_lb_node_configsmetal_lb_node_configs_messagesrb   s        r    _metal_lb_node_configs_from_fileB_BareMetalStandaloneClusterClient._metal_lb_node_configs_from_file   s    ==i 	::>>2	
  !
..
;

& &(" 5$++

$
$%9
: !6
 *)r   c                    UR                  S5      (       d  gUR                  SS5      R                  S5      n/ nU H  nUR                  S5      n[        U5      S:w  a%  [        R                  " SR                  U5      5      eUR                  [        R                  R                  R                  US   US	   S
95        M     [        R                  R                  US9nU$ )a8  Validates and parses a node label object.

Args:
  node_labels: str of key-val pairs separated by ';' delimiter.

Returns:
  If label is valid, returns a dict mapping message LabelsValue to its
  value, otherwise, raise ArgumentTypeError.
  For example,
  {
      'key': LABEL_KEY
      'value': LABEL_VALUE
  }
r]   NrY   ;=   z8Node Label [{}] not in correct format, expect KEY=VALUE.r      keyvalueadditionalProperties)r;   splitlenr	   ArgumentTypeErrorformatrR   r    ra   LabelsValueAdditionalProperty)r   node_labelsinput_node_labelsadditional_property_messageslabelkey_val_pairlabels_value_messages          r   parse_node_labels3_BareMetalStandaloneClusterClient.parse_node_labels   s     ??8$$#"5;;C@#% "[[%l	\	a	++FMM!
 	

 #))

&
&
2
2
E
Eq/a F  # $77CC9 D   r   c                     UR                  SS5      U R                  U5      S.nU R                  [        R                  U5      $ )rW   znode-iprY   r^   )r;   r   _set_config_if_existsr    ra   )r   node_config_argsr#   s      r   node_config-_BareMetalStandaloneClusterClient.node_config   sE     #&&y"5(()9:F
 %%h&B&BFKKr   c                     UR                   (       a  [        US/ 5      O/ nU Vs/ s H  o0R                  U5      PM     sn$ s  snf )rg   #metal_lb_load_balancer_node_configs)r   r)   r   r   r   node_config_flag_valuer   s       r    _metal_lb_node_configs_from_flagB_BareMetalStandaloneClusterClient._metal_lb_node_configs_from_flag   sR     33 	;R@  :P9O+%9O     Ac                     / n[        US0 5      nU(       d  / $ UR                  5        H9  nU R                  U5      nUR                  [        R
                  " S0 UD65        M;     U$ )#Constructs proto message NodeTaint."metal_lb_load_balancer_node_taintsr   r)   items_parse_node_taintrR   r    	NodeTaintr   r   taint_messagesnode_taints
node_tainttaint_objects         r   _metal_lb_node_taints7_BareMetalStandaloneClusterClient._metal_lb_node_taints   se    N$ DbIKi!'')
++J7lH..>>? * r   c                    [        US0 5      n/ nU(       d  gUR                  5        H;  u  pEUR                  [        R                  R
                  R                  XES95        M=     [        R                  R                  US9nU$ )%Constructs proto message LabelsValue."metal_lb_load_balancer_node_labelsNrs   rv   r)   r   rR   r    BareMetalNodePoolConfigr|   r}   r   r   r~   r   rt   ru   r   s          r   _metal_lb_labels2_BareMetalStandaloneClusterClient._metal_lb_labels  s    $ DbIK#% !'')
"))

*
*
6
6
I
I J  * $;;GG9 H   r   c                 "   SUR                  5       ;   a  U R                  U5      nOU R                  U5      nUU R                  U5      U R	                  U5      S.n[        UR                  5       5      (       a  [        R                  " S0 UD6$ g)1Constructs proto message BareMetalNodePoolConfig.ri   rh   r]   taintsNr   )	r   rl   r   r   r   r*   r+   r    r   )r   r   rj   r#   s       r   (_metal_lb_load_balancer_node_pool_configJ_BareMetalStandaloneClusterClient._metal_lb_load_balancer_node_pool_config  s    
 	8$$&	' #CCDI"CCDI -''-,,T2F 6==?--777r   c                     SU R                  U5      0n[        UR                  5       5      (       a  [        R                  " S0 UD6$ gzGConstructs proto message BareMetalStandaloneLoadBalancerNodePoolConfig.nodePoolConfigNr   )r   r*   r+   r    -BareMetalStandaloneLoadBalancerNodePoolConfigr"   s      r   _metal_lb_node_pool_config<_BareMetalStandaloneClusterClient._metal_lb_node_pool_config3  sE     	$GGMF 6==?CCMfMMr   c                    SUR                  5       ;   a  U R                  U5      nOU R                  U5      nUU R                  U5      S.n[	        UR                  5       5      (       a  [        R                  " S0 UD6$ g)z:Constructs proto message BareMetalStandaloneMetalLbConfig.r:   )r7   loadBalancerNodePoolConfigNr   )r   rA   rT   r   r*   r+   r     BareMetalStandaloneMetalLbConfig)r   r   r>   r#   s       r   _metal_lb_config2_BareMetalStandaloneClusterClient._metal_lb_config>  su    )T-F-F-HH33D9m33D9m%&*&E&Ed&KF
 6==?66@@@r   c                     UR                   (       d  / $ UR                   R                  S/ 5      nU(       d  U R                  SSS5        / nU H#  nUR                  U R	                  U5      5        M%     U$ )r6   r7    --bgp_lb_address_pools_from_fileBGP LB address pools file)bgp_lb_address_pools_from_filer;   r<   rR   _bgp_lb_address_pool)r   r   r>   r@   r?   s        r   _bgp_address_pools_from_file>_BareMetalStandaloneClusterClient._bgp_address_pools_from_fileN  sz    ..i77;;M 
..
,

% %""4#<#<\#JK & ! r   c                 ,   UR                  S/ 5      nU(       d  U R                  SSS5        UR                  SS5      nU(       d  U R                  SSS5        UUR                  SS5      UR                  SS5      US.n[        R                  " S	0 UD6$ )
rD   rE   r   r   rF   NrG   rH   rI   r   rK   rM   s        r   r   6_BareMetalStandaloneClusterClient._bgp_lb_address_poold  s      b1I
..
,

% FD)D
..
,

% %))/4@$((>	F >>HHHr   c                 "   UR                   (       d  / $ / nUR                    Hi  nUR                  [        R                  " UR	                  S/ 5      UR	                  SS 5      UR	                  SS 5      UR	                  SS 5      S95        Mk     U$ rP   )bgp_lb_address_poolsrR   r    rL   r;   rS   s       r   _bgp_address_pools_from_flag>_BareMetalStandaloneClusterClient._bgp_address_pools_from_flag  s    $$iM11

=
=$((b9(,,->E'++OTB##FD1	 2 r   c                     UR                  SS5      nU(       d  U R                  SSS5        UU R                  UR                  S0 5      5      S.n[        R                  " S0 UD6$ )rW   rX   rY   ---bgp_lb_load_balancer_node_configs_from_fileBGP LB Node configs filer]   r^   r   r_   )r   bgp_lb_node_configrc   r#   s       r   _bgp_lb_node_config5_BareMetalStandaloneClusterClient._bgp_lb_node_config  sl     $$Xr2G
..
9

$ ##$6$:$:8R$HIF
 ''1&11r   c                     UR                   (       d  / $ UR                   R                  S/ 5      nU(       d  U R                  SSS5        / nU H#  nUR                  U R	                  U5      5        M%     U$ )rg   rh   r   r   )+bgp_lb_load_balancer_node_configs_from_filer;   r<   rR   r   )r   r   bgp_lb_node_configsbgp_lb_node_configs_messagesr   s        r   _bgp_lb_node_configs_from_file@_BareMetalStandaloneClusterClient._bgp_lb_node_configs_from_file  s    ;;i 	88<<2	
  
..
9

$ $& 1"))

"
"#5
6 2
 ('r   c                     UR                   (       a  [        US/ 5      O/ nU Vs/ s H  o0R                  U5      PM     sn$ s  snf )rg   !bgp_lb_load_balancer_node_configs)r   r)   r   r   s       r   _bgp_lb_node_configs_from_flag@_BareMetalStandaloneClusterClient._bgp_lb_node_configs_from_flag  sR     11 	92>  :P9O+%9O  r   c                     / n[        US0 5      nU(       d  / $ UR                  5        H9  nU R                  U5      nUR                  [        R
                  " S0 UD65        M;     U$ )r    bgp_lb_load_balancer_node_taintsr   r   r   s         r   _bgp_lb_node_taints5_BareMetalStandaloneClusterClient._bgp_lb_node_taints  se    N$ BBGKi!'')
++J7lH..>>? * r   c                    [        US0 5      n/ nU(       d  gUR                  5        H;  u  pEUR                  [        R                  R
                  R                  XES95        M=     [        R                  R                  US9nU$ )r    bgp_lb_load_balancer_node_labelsNrs   rv   r   r   s          r   _bgp_lb_labels0_BareMetalStandaloneClusterClient._bgp_lb_labels  s    $ BBGK#% !'')
"))

*
*
6
6
I
I J  * $;;GG9 H   r   c                 "   SUR                  5       ;   a  U R                  U5      nOU R                  U5      nUU R                  U5      U R	                  U5      S.n[        UR                  5       5      (       a  [        R                  " S0 UD6$ g)r   r   r   Nr   )	r   r   r   r   r   r*   r+   r    r   )r   r   r   r#   s       r   &_bgp_lb_load_balancer_node_pool_configH_BareMetalStandaloneClusterClient._bgp_lb_load_balancer_node_pool_config  s    
 	6$$&	' !??E ??E +%%d+**40F 6==?--777r   c                     SU R                  U5      0n[        UR                  5       5      (       a  [        R                  " S0 UD6$ gr   )r   r*   r+   r    r   r"   s      r   _bgp_lb_node_pool_config:_BareMetalStandaloneClusterClient._bgp_lb_node_pool_config   sE     	$EEdKF 6==?CCMfMMr   c                     UR                   (       d  / $ UR                   R                  S/ 5      nU(       d  U R                  SSS5        / nU H#  nUR                  U R	                  U5      5        M%     U$ )r6   bgpPeerConfigs--bgp_lb_peer_configs_from_fileBGP LB peer configs file)bgp_lb_peer_configs_from_filer;   r<   rR   _peer_configs)r   r   peer_configspeer_configs_messagespeer_configs        r   _bgp_peer_configs_from_file=_BareMetalStandaloneClusterClient._bgp_peer_configs_from_file  sv    --i5599:JBOL
..
+

$ #""4#5#5k#BC $ ! r   c                 
   UR                  SS5      nU(       d  U R                  SSS5        UR                  SS5      nU(       d  U R                  SSS5        UUUR                  S/ 5      S.n[        R                  " S0 UD6$ )	z:Constructs proto message BareMetalStandaloneBgpPeerConfig.asnNr   r   	ipAddresscontrolPlaneNodes)r   r   r   r   )r;   r<   r     BareMetalStandaloneBgpPeerConfig)r   r   r   
ip_addressr#   s        r   r   /_BareMetalStandaloneClusterClient._peer_configs  s    
//%
&C
..
+

$ d3J
..
+

$ (__-@"EF 44>v>>r   c                     UR                   (       d  / $ / nUR                    HX  nUR                  [        R                  " UR	                  S/ 5      UR	                  SS 5      UR	                  SS 5      S95        MZ     U$ )Nzcontrol-plane-nodesr   z
ip-address)r   r   r   )bgp_lb_peer_configsrR   r    r   r;   )r   r   r   r   s       r   _bgp_peer_configs_from_flag=_BareMetalStandaloneClusterClient._bgp_peer_configs_from_flag9  st    ##iL//

3
3 +0Er J//%.#d; 0 r   c                    SUR                  5       ;   a  U R                  U5      nOU R                  U5      nSUR                  5       ;   a  U R                  U5      nOU R	                  U5      nU[        USS5      U R                  U5      US.n[        UR                  5       5      (       a  [        R                  " S0 UD6$ g)z8Constructs proto message BareMetalStandaloneBgpLbConfig.r   r   
bgp_lb_asnN)r7   r   r   r   r   )r   r   r   r   r   r)   r   r*   r+   r    BareMetalStandaloneBgpLbConfig)r   r   r>   r   r#   s        r   _bgp_lb_config0_BareMetalStandaloneClusterClient._bgp_lb_configI  s    '4+D+D+FF77=m77=m&$*C*C*EE55d;l55d;l &t\40&*&C&CD&I&	F 6==?44>v>>r   c                     U R                  U5      U R                  U5      S.n[        UR                  5       5      (       a  [        R
                  " S0 UD6$ g)z?Constructs proto message BareMetalStandaloneLoadBalancerConfig.)metalLbConfigbgpLbConfigNr   )r   r   r*   r+   r    %BareMetalStandaloneLoadBalancerConfigr"   s      r   _load_balancer_config7_BareMetalStandaloneClusterClient._load_balancer_configa  sQ     ..t4**40F
 6==?;;EfEEr   c                     / nU(       d  gUR                  5        H;  u  p4UR                  [        R                  R                  R                  X4S95        M=     [        R                  R	                  US9nU$ )r   Nrs   rv   )r   rR   r    ra   r|   r}   )r   r]   r   rt   ru   r   s         r   r`   ._BareMetalStandaloneClusterClient._node_labelsm  s{    #% lln
"))

&
&
2
2
E
E F  % $77CC9 D   r   c                     UR                  SS5      nU(       d  U R                  SSS5        UU R                  UR                  S0 5      5      S.n[        R                  " S0 UD6$ )rW   rX   rY   &--control_plane_node_configs_from_fileControl Plane Node configs filer]   r^   r   r_   )r   control_plane_node_configrc   r#   s       r   _control_plane_node_config<_BareMetalStandaloneClusterClient._control_plane_node_config  sn    '++Hb9G
..
2

+ ##%))(B7
F ''1&11r   c                     UR                   (       d  / $ UR                   R                  S/ 5      nU(       d  U R                  SSS5        / nU H#  nUR                  U R	                  U5      5        M%     U$ )rg   rh   r  r	  )$control_plane_node_configs_from_filer;   r<   rR   r  )r   r   control_plane_node_configs#control_plane_node_configs_messagesr
  s        r   %_control_plane_node_configs_from_fileG_BareMetalStandaloneClusterClient._control_plane_node_configs_from_file  s     44i!%!J!J!N!Nr" &
..
2

+ +-'%?!)00

)
)*C
D &@
 /.r   c                 B    [         R                  " USU-   S-   U-   5      e)NzMissing field [z] in )r
   BadArgumentException)r   flagfieldfiles       r   r<   E_BareMetalStandaloneClusterClient._raise_bad_argument_exception_error  s*    

)
)%''1D8 r   c                     / n[        USS5      nU(       a)  U H#  nUR                  U R                  U5      5        M%     U$ )rg   r  N)r)   rR   r   )r   r   node_configsr   r   s        r   %_control_plane_node_configs_from_flagG_BareMetalStandaloneClusterClient._control_plane_node_configs_from_flag  sG     L$T+GN/+D,,[9: 0 r   c                     / n[        US0 5      nU(       d  / $ UR                  5        H9  nU R                  U5      nUR                  [        R
                  " S0 UD65        M;     U$ )r   control_plane_node_taintsr   r   r   s         r   _control_plane_node_taints<_BareMetalStandaloneClusterClient._control_plane_node_taints  se    N$ ;R@Ki!'')
++J7lH..>>? * r   c                    [        US0 5      n/ nU(       d  gUR                  5        H;  u  pEUR                  [        R                  R
                  R                  XES95        M=     [        R                  R                  US9nU$ )r   control_plane_node_labelsNrs   rv   r   r   s          r   _control_plane_node_labels<_BareMetalStandaloneClusterClient._control_plane_node_labels  s    $ ;R@K#% !'')
"))

*
*
6
6
I
I J  * $;;GG9 H   r   c                     SUR                  5       ;   a  U R                  U5      nOU R                  U5      nUU R                  U5      U R	                  U5      S.nU R                  [        R                  U5      $ )r   r  r   )r   r  r  r#  r  r   r    r   )r   r   r  r#   s       r   _node_pool_config3_BareMetalStandaloneClusterClient._node_pool_config  sv    -1J1J1LL??El??El $11$711$7F %%h&F&FOOr   c                 h    SU R                  U5      0nU R                  [        R                  U5      $ )zGConstructs proto message BareMetalStandaloneControlPlaneNodePoolConfig.r   )r&  r   r    -BareMetalStandaloneControlPlaneNodePoolConfigr"   s      r   _control_plane_node_pool_configA_BareMetalStandaloneClusterClient._control_plane_node_pool_config  s;     	$006F %%>> r   c                     / n[        USS5      nU(       a<  UR                  5        H(  u  pEUR                  [        R                  " XES95        M*     U$ )z>Constructs proto message BareMetalStandaloneApiServerArgument.api_server_argsN)argumentru   )r)   r   rR   r    $BareMetalStandaloneApiServerArgument)r   r   r-  api_server_args_flag_valuert   vals         r   _api_server_args2_BareMetalStandaloneClusterClient._api_server_args  sV    O!(/@$!G!0668(#99	
 9 r   c                     U R                  U5      U R                  U5      S.nU R                  [        R                  U5      $ )z?Constructs proto message BareMetalStandaloneControlPlaneConfig.)controlPlaneNodePoolConfigapiServerArgs)r*  r2  r   r    %BareMetalStandaloneControlPlaneConfigr"   s      r   _control_plane_config7_BareMetalStandaloneClusterClient._control_plane_config  sL     '+&J&J'
 ..t4	F %%66 r   c                 `    S[        USS5      0nU R                  [        R                  U5      $ )zDConstructs proto message BareMetalStandaloneClusterOperationsConfig.enableApplicationLogsenable_application_logsN)r)   r   r    *BareMetalStandaloneClusterOperationsConfigr"   s      r   _cluster_operations_config<_BareMetalStandaloneClusterClient._cluster_operations_config  s:     	 /H$!OF %%;;V r   c                 `    S[        US/ 5      0nU R                  [        R                  U5      $ )z>Constructs proto message BareMetalStandaloneMaintenanceConfig.maintenanceAddressCidrBlocksmaintenance_address_cidr_blocks)r)   r   r    $BareMetalStandaloneMaintenanceConfigr"   s      r   _maintenance_config5_BareMetalStandaloneClusterClient._maintenance_config  s=     	'3R)
F %%55v r   c                 h   / n[        USS5      nU(       a%  U Vs/ s H  n[        R                  " US9PM     sn$ UR                  S   S:X  a  g[        R
                  R                  R                  R                  5       nU(       a%  [        R                  " US9nUR                  U5      $ gs  snf )z.Constructs repeated proto message ClusterUser.admin_usersN)usernameupdate)
r)   r    ClusterUsercommand_pathr   VALUEScoreaccountGetrR   )r   r   cluster_user_messagesrG  
admin_usergcloud_config_core_accountdefault_admin_user_messages          r   _cluster_users0_BareMetalStandaloneClusterClient._cluster_users*  s    $t4K ('j 



3'  ( ",!2!2!7!7!?!?!C!C!E!#+#7#7-$  #))*DEE#s   B/c                 h    SU R                  U5      0nU R                  [        R                  U5      $ )z'Constructs proto message Authorization.
adminUsers)rU  r   r    Authorizationr"   s      r   _authorization0_BareMetalStandaloneClusterClient._authorizationB  s6     	d))$/F %%h&<&<fEEr   c                 h    SU R                  U5      0nU R                  [        R                  U5      $ )z;Constructs proto message BareMetalStandaloneSecurityConfig.authorization)rZ  r   r    !BareMetalStandaloneSecurityConfigr"   s      r   _security_config2_BareMetalStandaloneClusterClient._security_configJ  s;     	,,T2F %%22F r   c                 `    S[        USS5      0nU R                  [        R                  U5      $ )z=Constructs proto message BareMetalStandaloneNodeAccessConfig.	loginUser
login_userroot)r)   r   r    #BareMetalStandaloneNodeAccessConfigr"   s      r   _node_access_config5_BareMetalStandaloneClusterClient._node_access_configT  s9     	WT<8F %%44f r   c                     U R                  U5      nUR                  R                  5        H	  u  p4XBU'   M     U R                  U5      $ )zEConstructs proto message AnnotationsValue for adding new annotations.)_get_current_annotationsadd_annotationsr   _dict_to_annotations_message)r   r   curr_annotationsrt   ru   s        r   _add_annotations2_BareMetalStandaloneClusterClient._add_annotations^  sJ    44T:**002
#s 3 ,,-=>>r   c                 >    [         R                  R                  5       $ )zCConstructs proto message AnnotationsValue for clearing annotations.)r    BareMetalStandaloneClusterAnnotationsValuer   s     r   _clear_annotations4_BareMetalStandaloneClusterClient._clear_annotationsf  s    ..??AAr   c                     U R                  U5      nUR                  5        VVs0 s H  u  p4X1R                  ;  d  M  X4_M     nnnU R                  U5      $ s  snnf )zCConstructs proto message AnnotationsValue for removing annotations.)ri  r   remove_annotationsrk  )r   r   rl  rt   ru   updated_annotationss         r   _remove_annotations5_BareMetalStandaloneClusterClient._remove_annotationsj  si    44T: +0022JC--- 	
2   ,,-@AAs
   AAc                 8    U R                  UR                  5      $ )zBConstructs proto message AnnotationsValue for setting annotations.)rk  set_annotationsr   s     r   _set_annotations2_BareMetalStandaloneClusterClient._set_annotationsu  s    ,,T-A-ABBr   c                     UR                   R                  R                  5       nU R                  U5      n0 nUR                  (       a5  UR                  R
                   H  nUR                  XER                  '   M     U$ )z+Fetches the standalone cluster annotations.)CONCEPTSstandalone_clusterParseDescribeannotationsrw   ru   rt   )r   r   cluster_refcluster_responserl  
annotations         r   ri  :_BareMetalStandaloneClusterClient._get_current_annotationsy  sj    --2288:K}}[1##(44II*+5+;+;( J r   c                 ,   SUR                  5       ;   a  U R                  U5      $ SUR                  5       ;   a  U R                  U5      $ SUR                  5       ;   a  U R                  U5      $ SUR                  5       ;   a  U R	                  U5      $ g)z=Constructs proto message AnnotationsValue for update command.rj  clear_annotationsru  rz  N)r   rm  rr  rw  r{  r   s     r   _update_annotations5_BareMetalStandaloneClusterClient._update_annotations  s    D5577""4((d7799$$T**t88::%%d++D5577""4((r   c                     / nU(       d  gUR                  5        H;  u  p4UR                  [        R                  R                  R                  X4S95        M=     [        R                  R	                  US9nU$ )z9Converts key-val pairs to proto message AnnotationsValue.Nrs   rv   )r   rR   r    rp  rq  r}   )r   r  r   rt   ru   annotation_value_messages         r   rk  >_BareMetalStandaloneClusterClient._dict_to_annotations_message  s    #% !'')
"))11BBUU V D" * 	++<<!= 	= 	
 
 $#r   c                 L    UR                   S   S:X  a  U R                  U5      $ g)z*Constructs proto message AnnotationsValue.rI  rJ  N)rL  r  r   s     r   _annotations._BareMetalStandaloneClusterClient._annotations  s)    (%%d++r   c                    U R                  U5      [        USS5      [        USS5      U R                  U5      U R                  U5      U R	                  U5      U R                  U5      U R                  U5      U R                  U5      U R                  U5      U R                  U5      U R                  U5      S.nU R                  [        R                  U5      $ )z7Constructs proto message Bare Metal Standalone Cluster.descriptionNversion)namer  bareMetalVersionnetworkConfigloadBalancercontrolPlaneclusterOperationsmaintenanceConfigsecurityConfignodeAccessConfigr  binaryAuthorization)_standalone_cluster_namer)   r3   r  r8  r>  rD  r_  rf  r  _binary_authorizationr   r    rp  r"   s      r   _bare_metal_standalone_cluster@_BareMetalStandaloneClusterClient._bare_metal_standalone_cluster  s     --d3t]D9#D)T:--d322482248!<<TB!55d;//5 44T:((.#99$?F %%++V r   c                 P    [        UR                  5       5      (       a  U" S0 UD6$ g Nr   )r*   r+   )r   config_typer#   s      r   r   7_BareMetalStandaloneClusterClient._set_config_if_exists  s$    
6==?"6""r   r   N)C__name__
__module____qualname____firstlineno____doc__r   	Namespacer   r$   r-   r3   rA   r=   rT   rd   rl   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*  r2  r8  r>  rD  rU  rZ  r_  rf  rm  rr  rw  r{  ri  r  rk  r  r  r   __static_attributes__r   r   r   r   r      s   D):)D)D 	!2!<!< 	+<+F+F 
"3"="= 
!+<+F+F !.I6+<+F+F "2"*3D3N3N *4' RL
3D3N3N 
(9(C(C  #4#>#>  *#--.	->-H-H 	#4#>#>  !/@/J/J !,I6/@/J/J "2"(1B1L1L (4
1B1L1L 
&7&A&A  !2!<!<  *#--.	+<+F+F 	!.?.I.I !(?4.?.I.I  !2!<!< 0
(9(C(C 
 &2&/#--/4

#--
->-H-H  ->-H-H  (P$5$?$? P2C2M2M #4#>#> (9(C(C ->-H-H 
&7&A&A 
!2!<!< 0F!2!<!< F#4#>#> &7&A&A ?#4#>#> ?B%6%@%@ B	B&7&A&A 	BC#4#>#> C
+<+F+F 
&7&A&A  $(0:: 1B1L1L *r   r   c                      ^  \ rS rSrSrU 4S jrSS j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U =r$ )StandaloneClustersClienti  z;Client for clusters in gkeonprem bare metal standalone API.c                 d   > [         [        U ]
  " S0 UD6  U R                  R                  U l        g r  )superr  __init___client.projects_locations_bareMetalStandaloneClusters_service)r   r#   	__class__s     r   r  !StandaloneClustersClient.__init__  s'    	
"D2<V<LLOODMr   c           	          [         R                  " UR                  5       S9n[        R                  " U R
                  USUUSS9$ )z<Lists Clusters in the GKE On-Prem Bare Metal Standalone API.)parentbareMetalStandaloneClusterspageSize)r  
batch_sizelimitbatch_size_attribute)r    @GkeonpremProjectsLocationsBareMetalStandaloneClustersListRequestRelativeNamer   YieldFromListr  )r   location_refr  	page_sizelist_reqs        r   ListStandaloneClustersClient.List  sI    XX((*H ##+') )r   c                 |    [         R                  " UR                  5       S9nU R                  R	                  U5      $ )z>Gets a GKE On-Prem Bare Metal Standalone API cluster resource.)r  )r    ?GkeonpremProjectsLocationsBareMetalStandaloneClustersGetRequestr  r  rP  )r   resource_refreqs      r   r  !StandaloneClustersClient.Describe  s5    

R
R&&(C ==S!!r   r   c                     U R                  U5      U R                  U5      S.n[        R                  " U R	                  U5      [        R
                  " S0 UD6S9nU R                  R                  U5      $ )zmEnrolls an existing bare metal standalone cluster to the GKE on-prem API within a given project and location.)
membershipbareMetalStandaloneClusterId)r  'enrollBareMetalStandaloneClusterRequestr   )#_standalone_cluster_membership_name_standalone_cluster_idr    BGkeonpremProjectsLocationsBareMetalStandaloneClustersEnrollRequest_standalone_cluster_parent'EnrollBareMetalStandaloneClusterRequestr  Enrollr   r   r#   r  s       r   r  StandaloneClustersClient.Enroll  st     >>tD(,(C(CD(IF 
U
U..t4080`0` 1
1
C ==$$r   c                     U R                  U5      [        USS5      [        USS5      S.n[        R                  " S0 UD6nU R                  R                  U5      $ )z5Unenrolls an Anthos on bare metal standalone cluster.allow_missingNignore_errors)r  allowMissingignoreErrorsr   )r  r)   r    DGkeonpremProjectsLocationsBareMetalStandaloneClustersUnenrollRequestr  Unenrollr  s       r   r  !StandaloneClustersClient.Unenroll  sb     --d3ot<ot<F
 
W
W 
C ==!!#&&r   c                     U R                  U5      U R                  U5      R                  5       S.n[        R                  " S0 UD6nU R
                  R                  U5      $ )zDQuery Anthos on bare metal standalone cluster version configuration.)upgradeConfig_clusterNamer  r   )r  _location_refr  r    NGkeonpremProjectsLocationsBareMetalStandaloneClustersQueryVersionConfigRequestr  QueryVersionConfigr  s       r   r  +StandaloneClustersClient.QueryVersionConfig  sa     &*%B%B4%H$$T*779F
 
a
a 
C ==++C00r   c                 "   U R                  U5      [        USS5      [        R                  " U[        R                  5      [        USS5      U R                  U5      S.n[        R                  " S0 UD6nU R                  R                  U5      $ )z3Updates an Anthos on bare metal standalone cluster.r  Nvalidate_onlyF)r  r  
updateMaskvalidateOnlybareMetalStandaloneClusterr   )
r  r)   r   get_update_mask2BARE_METAL_STANDALONE_CLUSTER_ARGS_TO_UPDATE_MASKSr  r    AGkeonpremProjectsLocationsBareMetalStandaloneClustersPatchRequestr  Patchr  s       r   UpdateStandaloneClustersClient.Update  s     --d3ot<!11+PP
  ou=&*&I&I$&OF 
T
T 
C ==s##r   )r  )NN)r  r  r  r  r  r  r  r  r   r  r  r  r  r  r  __classcell__)r  s   @r   r  r    sg    CP)"%*44 %',66 '
1%6%@%@ 
1$*44 $ $r   r  N)r  
__future__r   r   r   apitools.base.pyr   *googlecloudsdk.api_lib.container.gkeonpremr   r   googlecloudsdk.callioper	   r
   r   googlecloudsdk.corer   2googlecloudsdk.generated_clients.apis.gkeonprem.v1r   r    
ClientBaser   r  r   r   r   <module>r     sP    W &  ' ' = B / . 5 * `j(9(9 jZT$@ T$r   