
    8                     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 Zd Z	dd
Z
d Zd Zd Zy	)zResource parsing helpers.    )absolute_import)division)unicode_literals)
properties)	resourcesc                  j    t         j                  j                  j                  j	                  d      S )zReturns the value of the core/project config property.

  Config properties can be overridden with command line flags. If the --project
  flag was provided, this will return the value provided with the flag.
  T)required)r   VALUEScoreprojectGet     3lib/googlecloudsdk/command_lib/metastore/parsers.py
GetProjectr      s*     
					'	'	+	+T	+	::r   c                 n    t         j                  j                  | dt        id      j	                         S )zParses a network name using configuration properties for fallback.

  Args:
    network: str, the network's ID, fully-qualified URL, or relative name

  Returns:
    str: the relative name of the network resource
  r   zcompute.networksparams
collection)r   REGISTRYParser   RelativeName)networks    r   ParseNetworkr   "   s;     
			!	!
Z& 
" 
( )57r   Nc                     t         j                  j                  | t        |t        n|dd      j                         S )a  Parses a subnetwork name using configuration properties for fallback.

  Args:
    subnetwork: str, the subnetwork's ID, fully-qualified URL, or relative name
    location: str, the location ID

  Returns:
    str: the relative name of the network resource
  )r   regionzcompute.subnetworksr   )r   r   r   r   _GetConfigLocationPropertyr   )
subnetworklocations     r   ParseSubnetworkr    1   sF     
			!	!2:2B. ' 
" 
( )57r   c                 `    t         j                  j                  | d      j                         S )zParses a secret manager secret version name using configuration properties for fallback.

  Args:
    secret_manager_version: str, fully-qualified URL, or relative name

  Returns:
    str: the relative name of the secret version resource
  z'secretmanager.projects.secrets.versionsr   r   r   r   r   )secret_manager_versions    r   ParseSecretManagerSecretVersionr%   D   s0     
			!	!: 
" 
<<HLNKr   c                 `    t         j                  j                  | d      j                         S )zParses a Cloud KMS key using configuration properties for fallback.

  Args:
    cloud_kms_key: str, fully-qualified URL, or relative name

  Returns:
    str: the relative name of the Cloud KMS key resource
  z/cloudkms.projects.locations.keyRings.cryptoKeysr"   r#   )cloud_kms_keys    r   ParseCloudKmsKeyr(   R   s1     
			!	!B 
" 
 LNr   c                  f    t         j                  j                  j                  j	                         S )z<Returns the value of the metastore/location config property.)r   r
   	metastorer   	GetOrFailr   r   r   r   r   a   s#    				$	$	-	-	7	7	99r   )N)__doc__
__future__r   r   r   googlecloudsdk.corer   r   r   r   r    r%   r(   r   r   r   r   <module>r/      s8      &  ' * );77&K:r   