
    
                     8    d Z ddlmZ ddlmZ d Zd Zd Zd Zy)	zEUseful commands for interacting with the Cloud Firestore Backups API.    )	api_utils)logc                  >    t        j                         j                  S )zFReturns the service for interacting with the Firestore Backup service.)r   	GetClientprojects_locations_backups     /lib/googlecloudsdk/api_lib/firestore/backups.py_GetBackupServicer      s    					9	99r	   c                 H   t               j                  t        j                         j	                  dj                  | |                  }|j                  r7|j                  D ](  }t        j                  j                  d| d| d       * t        |j                        S )zLists backups available to Google Cloud Firestore.

  Args:
    project: the project id to list backups, a string.
    location: the location to list backups, a string.

  Returns:
    a List of Backups.
  zprojects/{}/locations/{})parentz$Failed to list backups for location zO, please retry with command gcloud {version} firestore backups list --location=z to get a more concrete error)r   Listr   GetMessages,FirestoreProjectsLocationsBackupsListRequestformatunreachabler   statusPrintlistbackups)projectlocationresultr   s       r
   ListBackupsr      s     ##JJ+227HE K &
 ))	jj0 >$%BD * 
fnn	r	   c           	          t               j                  t        j                         j	                  dj                  | ||                  S )zGets backup with the given name.

  Args:
    project: the project id to get backup, a string.
    location: the location to get backup, a string.
    backup: the backup id to get backup, a string.

  Returns:
    A Backup.
  #projects/{}/locations/{}/backups/{}name)r   Getr   r   +FirestoreProjectsLocationsBackupsGetRequestr   r   r   backups      r
   	GetBackupr#   4   sL     
		 	 II4;;x J 
 r	   c           	          t               j                  t        j                         j	                  dj                  | ||                  S )zDeletes backup with the given name.

  Args:
    project: the project id to get backup, a string.
    location: the location to get backup, a string.
    backup: the backup id to get backup, a string.

  Returns:
    Empty.
  r   r   )r   Deleter   r   .FirestoreProjectsLocationsBackupsDeleteRequestr   r!   s      r
   DeleteBackupr'   H   sL     
		#	#LL4;;x M 
 r	   N)	__doc__ googlecloudsdk.api_lib.firestorer   googlecloudsdk.corer   r   r   r#   r'   r   r	   r
   <module>r+      s'    L 7 #:
2(r	   