
                         D   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  \R&                  \R(                  " \R*                  R,                  \R*                  R.                  5       " S S\R0                  5      5       5       rg)z.Creates Backup and DR Backup Plan Association.    )absolute_import)division)unicode_literals)
exceptions)util)BackupPlanAssociationsClient)base)flags)logc                   :    \ rS rSrSrSSSS.r\S 5       rS rS	r	g
)Create   z%Create a new backup plan association.z%Creates a new backup plan associationzzCreate a new backup plan association in the project. It can only be created in locations where Backup and DR is available.a]          To create a new backup plan association `sample-bpa` in project `sample-project` and location `us-central1` for resource `sample-resource-uri` with backup plan `sample-backup-plan`, run:

          $ {command} sample-bpa --project=sample-project --location=us-central1 --backup-plan=sample-backup-plan --resource=sample-resource-uri
        )BRIEFDESCRIPTIONEXAMPLESc                     [         R                  R                  U 5        [         R                  R                  U S5        [        R
                  " U 5        g)zmSpecifies additional command flags.

Args:
  parser: argparse.Parser: Parser object for command line inputs.
TN)r	   
ASYNC_FLAGAddToParser
SetDefaultr
   #AddCreateBackupPlanAssociationFlags)parsers    8lib/surface/backup_dr/backup_plan_associations/create.pyArgsCreate.Args1   s8     	OO'OOvt,	--f5    c                 Z   [        5       nUR                  nUR                  R                  R	                  5       nUR                  R
                  R	                  5       nUR                  nUR                  n UR                  XEXg5      nUR                  S5      (       a  [        R                  " S5        U(       aN  [        R$                  " UR'                  5       SS[         R(                  R+                  UR,                  5      S9  U$ UR/                  UR1                  U5      SR+                  UR'                  5       5      S9n[        R$                  " UR'                  5       SS	9  U$ ! [        R                   a*  n	[        R                  " U	[         R"                  5      eSn	A	ff = f)
zConstructs and sends request.

Args:
  args: argparse.Namespace, An object that contains the values for the
    arguments specified in the .Args() method.

Returns:
  ProcessHttpResponse of the request made.
DiskzIn the event of a source region outage, backups in multi-region vault remain accessible, but the restore will fail if your disk is protected with a regional CMEK.Nzbackup plan associationT)kindis_asyncdetailszSCreating backup plan association [{}]. (This operation could take up to 2 minutes.))operation_refmessage)r   )r   async_CONCEPTSbackup_plan_associationParsebackup_planresourceresource_typer   endswithr   warningapitools_exceptions	HttpErrorr   HttpExceptionr   HTTP_ERROR_FORMATCreatedResourceRelativeNameASYNC_OPERATION_MESSAGEformatnameWaitForOperationGetOperationRef)
selfargsclientr   r%   r'   r(   r)   	operationes
             r   Run
Create.Run<   ss    *+F{{H"mmCCIIK--++113K}}H&&M@--
!i 
			'	'2	
 	
!
.
.
0(..55innE	 &&,,Y7&&,f'446'	 ' H ,,.5N O1 (( @$$Q(>(>??@s   8>E, ,F* %F%%F* N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr   r<   __static_attributes__r>   r   r   r   r      s7     . 7D- 6 64r   r   N)rC   
__future__r   r   r   apitools.base.pyr   r,   googlecloudsdk.api_lib.backupdrr   8googlecloudsdk.api_lib.backupdr.backup_plan_associationsr   googlecloudsdk.api_lib.utilgooglecloudsdk.callioper	   #googlecloudsdk.command_lib.backupdrr
   googlecloudsdk.corer   DefaultUniverseOnlyReleaseTracksReleaseTrackALPHAGACreateCommandr   r>   r   r   <module>rU      s    5 '  ' > 0 a 2 ( 5 # D%%++T->->-A-ABOT O C Or   