
    v                     d    S r SSKJr  SSKJr  SSKJr   " S S\5      r " S S\5      rS	 r	S
 r
g)zFBase classes for abstracting away common logic for Deployment Manager.    )apis)
properties)	resourcesc                       \ rS rSrSr " S S\5      r\" SSS5      r\" SSR                  S	5      S
5      r	\" SSR                  S	5      S5      r
\\	\
4rSrg)DmApiVersion   zAn enum representing the API version of Deployment Manager.

The DM API version controls which version of DM API to use for a certain
command under certain release track.
c                   *    \ rS rSrSrS rS rS rSrg)DmApiVersion._VERSION   z;An enum representing the API version of Deployment Manager.c                 (    Xl         X l        X0l        g N)idhelp_tag	help_note)selfr   r   r   s       8lib/googlecloudsdk/api_lib/deployment_manager/dm_base.py__init__DmApiVersion._VERSION.__init__#   s    gm n    c                     U R                   $ r   r   r   s    r   __str__DmApiVersion._VERSION.__str__(   s    WWnr   c                 4    U R                   UR                   :H  $ r   r   )r   others     r   __eq__DmApiVersion._VERSION.__eq__+   s    WW  r   )r   r   r   N)	__name__
__module____qualname____firstlineno____doc__r   r   r   __static_attributes__ r   r   _VERSIONr
      s    E!
!r   r&   v2Nalphaz{0}(ALPHA){0} *zAThe DM API currently used is ALPHA and may change without notice.v2betaz{0}(V2BETA){0} zBThe DM API currently used is V2BETA and may change without notice.r%   )r   r    r!   r"   r#   objectr&   V2formatALPHAV2BETA_ALLr$   r%   r   r   r   r      sq    ! ! dD!"
c"IK%
 s#JL&
 eV	$r   r   c                       \ rS rSrSr\R                  rSrSr	Sr
S r\S 5       r\S 5       r\S 5       r\S 5       rS	rg)
	DmCommand=   z:DmCommand is a base class for Deployment Manager commands.Nc                     g r   r%   r   s    r   r   DmCommand.__init__E   s    r   c                     U R                   $ r   _dm_versionr   s    r   versionDmCommand.versionH   s    r   c                     U R                   c0  [        R                  " SU R                  R                  5      U l         U R                   $ )zSpecifies the DM client.deploymentmanager)
_dm_clientr   GetClientInstancer8   r   r   s    r   clientDmCommand.clientL   s=     ../B/3/?/?/B/BDdo??r   c                     U R                   c0  [        R                  " SU R                  R                  5      U l         U R                   $ )zSpecifies the DM messages.r<   )_dm_messagesr   GetMessagesModuler8   r   r   s    r   messagesDmCommand.messagesT   sB      001D151A1A1D1DFdr   c                     U R                   cS  [        R                  R                  5       U l         U R                   R	                  SU R
                  R                  5        U R                   $ )z0Specifies the resources parser for DM resources.r<   )_dm_resourcesr   REGISTRYCloneRegisterApiByNamer8   r   r   s    r   r   DmCommand.resources\   sZ     !$--335d
**+>+/+;+;+>+>@r   )r=   rB   rG   )r   r    r!   r"   r#   r   r,   r8   r=   rB   rG   r   propertyr9   r?   rD   r   r$   r%   r   r   r2   r2   =   sr    B+*,-	        r   r2   c                    ^  U 4S jnU$ )zMark this command class to use given Deployment Manager API version.

Args:
  api_version: DM API version to use for the command

Returns:
  The decorator function
c                    > TU l         U $ )z#Wrapper function for the decorator.r7   )	cmd_classapi_versions    r   InitApiHolderUseDmApi.<locals>.InitApiHoldero   s     (Ir   r%   )rP   rQ   s   ` r   UseDmApirS   f   s    
 
r   c                  d    [         R                  R                  R                  R	                  SS9$ )NT)required)r   VALUEScoreprojectGetr%   r   r   
GetProjectrZ   w   s(    						'	'	+	+T	+	::r   N)r#   googlecloudsdk.api_lib.utilr   googlecloudsdk.corer   r   r+   r   r2   rS   rZ   r%   r   r   <module>r]      s:     M - * )"6 "J& &R";r   