
    (                     j   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z
 ddlmZ dd	lmZ dd
lmZ ddlmZ  G d dej"                        Z G d dej&                        Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd(dZ d)dZ!d)dZ"d)dZ#d Z$d  Z%	 d(d!Z&d" Z'd# Z(d$ Z)d% Z*d& Z+y')*z<Shared resource flags for `gcloud container azure` commands.    )absolute_import)division)unicode_literals)concepts)deps)util)concept_parsers)presentation_specs)
properties)	resourcesc                   ,     e Zd ZdZ fdZ fdZ xZS )!_ProjectNumberPropertyFallthroughz<A fallthrough for project number from property core/project.c                 r    t         t        |   t        j                  j
                  j                         y)See base class.)propN)superr   __init__r   VALUEScoreprojectself	__class__s    ?lib/googlecloudsdk/command_lib/container/azure/resource_args.pyr   z*_ProjectNumberPropertyFallthrough.__init__!   s-    	
+T;##++ <     c                 <    t        t        t        |   |            S r   )_EnsureProjectNumberr   r   _Callr   parsed_argsr   s     r   r   z'_ProjectNumberPropertyFallthrough._Call'   s     /<[I r   __name__
__module____qualname____doc__r   r   __classcell__r   s   @r   r   r      s    D r   r   c                   ,     e Zd ZdZ fdZ fdZ xZS )_ProjectNumberArgFallthroughz=A fallthrough for project number from the --project argument.c                 .    t         t        |   d       y)r   z	--project)arg_nameN)r   r*   r   r   s    r   r   z%_ProjectNumberArgFallthrough.__init__1   s    	
&66Lr   c                 <    t        t        t        |   |            S r   )r   r   r*   r   r    s     r   r   z"_ProjectNumberArgFallthrough._Call5   s     *D7D r   r"   r(   s   @r   r*   r*   .   s    EM r   r*   c                 X    t         j                  j                  | j                  d      S N+gkemulticloud.projects.locations.operations
collection)r   REGISTRYParseRelativeNamename)ops    r   GetOperationResourcer7   <   s*    				-	-ggG 
. 
 r   c                  0    t        j                  dd      S )Nclusterzcluster of the {resource}.r5   	help_textr    ResourceParameterAttributeConfig r   r   AzureClusterAttributeConfigr?   B   s    		2	2 <
 r   c                  0    t        j                  dd      S )Nnodepoolznode pool of the {resource}.r:   r<   r>   r   r   AzureNodePoolAttributeConfigrB   H   s    		2	2!?
 r   c                  0    t        j                  dd      S )NclientzAzure client of the {resource}.r:   r<   r>   r   r   AzureClientAttributeConfigrE   N   s    		2	2@
 r   c                      t        j                  ddt        j                  t        j
                  j                  j                        g      S )z.Gets Google Cloud location resource attribute.locationz)Google Cloud location for the {resource}.r5   r;   fallthroughs)r   r=   r   PropertyFallthroughr   r   container_azurerG   r>   r   r   LocationAttributeConfigrL   T   s@    		2	2;

"
":#4#4#D#D#M#M
N
 r   c                 z    | st         j                  S t        j                  ddt               t	               g      S )Nr   zGProject number of the Google Cloud Platform project for the {resource}.rH   )r    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr=   r*   r   use_project_numbers    r   ProjectAttributeConfigrQ   _   s?    	444		2	2 '
(
+
-

 
r   c                  0    t        j                  dd      S )N	operationzOperation for the {resource}.r:   r<   r>   r   r   OperationAttributeConfigrT   o   s    		2	2"A
 r   c                  `    t        j                  ddt               t         j                        S )Nz gkemulticloud.projects.locationsrG   )resource_namelocationsId
projectsId)r   ResourceSpecrL   rN   r>   r   r   GetLocationResourceSpecrZ   u   s*    			()+::	
 r   c                  r    t        j                  ddt               t               t         j                        S )Nr0   rS   )rV   operationsIdrW   rX   )r   rY   rT   rL   rN   r>   r   r   GetOperationResourceSpecr]   ~   s0    			3+-)+::
 r   c                  r    t        j                  ddt               t               t         j                        S )N.gkemulticloud.projects.locations.azureClustersr9   )rV   azureClustersIdrW   rX   )r   rY   r?   rL   rN   r>   r   r   GetAzureClusterResourceSpecra      s0    			613)+::
 r   c                      t        j                  ddt               t               t	               t         j
                        S )N=gkemulticloud.projects.locations.azureClusters.azureNodePoolsrA   )rV   azureNodePoolsIdr`   rW   rX   )r   rY   rB   r?   rL   rN   r>   r   r   GetAzureNodePoolResourceSpecre      s6    			E3513)+::
 r   c           	      h    t        j                  ddt               t               t	        |             S )ag  Gets the resource spec for an Azure client.

  Args:
    use_project_number: bool, whether to enforce using project number in the
      resource spec. Project number should always be used when a resource is
      referenced in a field e.g. the client field when creating/updating Azure
      clusters.

  Returns:
    The resource spec for an Azure client.
  -gkemulticloud.projects.locations.azureClientsrD   )rV   azureClientsIdrW   rX   )r   rY   rE   rL   rQ   rO   s    r   GetAzureClientResourceSpecri      s2     
		5/1)+'(:;
 r   c                     |rdnd}t         j                  j                  |t               dj	                  |      d      j                  |        y)zAdds a resource argument for an Azure 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.
  r9   z	--clusterzcluster {}.TrequiredN)r	   ConceptParserForResourcera   formatAddToParserparserverb
positionalr5   s       r   AddAzureClusterResourceArgru      sL     !k$++
!#4 	 , 
 Kr   c                     |rdnd}t         j                  j                  |t               dj	                  |      d      j                  |        y)a   Adds a resource argument for an Azure node pool.

  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.
  	node_poolz--node-poolznode pool {}.Trk   N)r	   rm   rn   re   ro   rp   rq   s       r   AddAzureNodePoolResourceArgrx      sL     #$++
"$T"	 , 
 Kr   c                     |rdnd}t         j                  j                  |t               dj	                  |      d      j                  |        y)zAdds a resource argument for an Azure client.

  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.
  rD   --clientzAzure client {}.Trk   N)r	   rm   rn   ri   ro   rp   rq   s       r   AddAzureClientResourceArgr{      sL      Z$++
 "%	 , 
 Kr   c                     t         j                  j                  dt               dj	                  |      d      j                  |        y)zAdds a resource argument for Google Cloud location.

  Args:
    parser: The argparse.parser to add the resource arg to.
    verb: str, the verb to describe the resource, such as 'to list'.
  z
--locationzGoogle Cloud location {}.Trk   N)r	   rm   rn   rZ   ro   rp   rr   rs   s     r   AddLocationResourceArgr~      sC     ++!((.	 , 
 Kr   c                     t         j                  j                  dt               dj	                  |      d      j                  |        y)zAdds a resource argument for operation in Azure.

  Args:
    parser: The argparse parser to add the resource arg to.
    verb: str, the verb to describe the resource, such as 'to update'.
  operation_idzoperation {}.Trk   N)r	   rm   rn   r]   ro   rp   r}   s     r   AddOperationResourceArgr      sC     ++ T"	 , 
 Kr   c                 2   t        j                  t        j                  dt	               dj                  |rdnd      d      t        j                  dt        d      d	j                  |rdnd
      dddi|      gddgi      }|j                  |        y)aA  Adds resource arguments for both Azure cluster and client.

  This is used for the create and update command.

  Args:
    parser: The argparse.parser to add the resource arg to.
    auth_config_group: The Authentication Configuration argument group.
    update: bool, whether the resources are used in update command.
  r9   zAzure cluster to {}.updatecreateTrk   rz   rO   z#Azure client to use for cluster {}.creationFrG    )rl   flag_name_overridesgroupz--client.locationzcluster.location)command_level_fallthroughsN)r	   rm   r
   ResourcePresentationSpecra   ro   ri   rp   )rr   auth_config_groupr   
arg_parsers       r   $AddAzureClusterAndClientResourceArgsr     s     ,,

5
5)+$++HHM	 
5
5(DA3::$(* #-r"2%	$ #68J7K!L'**  r   c                     t         j                  j                  | j                  j                  j                         j                         d      S )Nrg   r1   )r   r3   r4   CONCEPTSrD   ParseRelativeNameargss    r   ParseAzureClientResourceArgr   '  sB    				-	-
mm  "//1@ 
. 
 r   c                     t         j                  j                  | j                  j                  j                         j                         d      S )Nr_   r1   )r   r3   r4   r   r9   r   r   r   s    r   ParseAzureClusterResourceArgr   .  sB    				-	-
mm!!#002A 
. 
 r   c                     t         j                  j                  | j                  j                  j                         j                         d      S )Nrc   r1   )r   r3   r4   r   rw   r   r   r   s    r   ParseAzureNodePoolResourceArgr   5  sB    				-	-
mm##%224
I 
. 
 r   c                     t         j                  j                  | j                  j                  j                         j                         d      S r/   )r   r3   r4   r   r   r   r   r   s    r   ParseOperationResourceArgr   >  sB    				-	-
mm  &&(557> 
. 
 r   c                 X    | | S | j                         r| S t        j                  |       S )N)isdigitproject_utilGetProjectNumber)ps    r   r   r   E  s+    YHYY[H		&	&q	))r   N)F)T),r&   
__future__r   r   r    googlecloudsdk.calliope.conceptsr   r   #googlecloudsdk.command_lib.projectsr   r   (googlecloudsdk.command_lib.util.conceptsr	   r
   googlecloudsdk.corer   r   rJ   r   ArgFallthroughr*   r7   r?   rB   rE   rL   rQ   rT   rZ   r]   ra   re   ri   ru   rx   r{   r~   r   r   r   r   r   r   r   r>   r   r   <module>r      s    C &  ' 5 1 D D G * )(@(@  4#6#6  *"""  ',!!H*r   