
                         >   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  SSKJr  SSKJr  \
R*                  " \
R,                  R.                  \
R,                  R0                  5       " S S\
R2                  5      5       rg)z+Export Cloud Build trigger to file command.    )absolute_import)division)unicode_literals)encoding)cloudbuild_util)base)resource_args)concept_parsers)
properties)	resources)yaml)filesc                   6    \ rS rSrSrSS0r\S 5       rS rSr	g)	Export    zExport a build trigger.EXAMPLESz
        To export a build trigger to a file called trigger.yaml, run:

          $ {command} MY-TRIGGER --destination=trigger.yaml
      c                     [         R                  R                  S[        R                  " 5       SSS9R                  U 5        U R                  SSSSS9  g	)
zRegister flags for this command.

Args:
  parser: An argparse.ArgumentParser-like object. It is mocked out in order
    to capture some information, but behaves like an ArgumentParser.
TRIGGERzBuild Trigger.Trequiredz--destinationPATHz4File path where trigger should be exported.
        )metavarr   helpN)r
   ConceptParserForResourcer	   GetTriggerResourceSpecAddToParseradd_argument)parsers    %lib/surface/builds/triggers/export.pyArgsExport.Args,   s_     !!--,,.	 .  #{6*
	      c                    [         R                  " 5       n[         R                  " 5       n[        R                  R
                  R                  R                  SS9n[        R                  R                  R                  R                  5       nUR                  =(       d    U=(       d    [         R                  nUR                  n[        R                  R                  UUUUS.SS9R                  5       nUR                   R                  UR#                  XS95      n	[$        R&                  " UR(                  5       n
[*        R,                  " [.        R0                  " U	5      U
S9  SSS5        g! , (       d  f       g= f)	zExports a build trigger.

Args:
  args: an argparse namespace. All the arguments that were provided to this
    command invocation.
Tr   )
projectsIdlocationsId
triggersIdz&cloudbuild.projects.locations.triggers)params
collection)name	triggerId)streamN)r   GetClientInstanceGetMessagesModuler   VALUEScoreprojectGetbuildsregionDEFAULT_REGIONr   r   REGISTRYParseRelativeNameprojects_locations_triggers-CloudbuildProjectsLocationsTriggersGetRequestr   
FileWriterdestinationr   dumpr   MessageToDict)selfargsclientmessagesr1   
regionproplocationtriggerr*   got_triggerouts              r    Run
Export.RunC   s0    ..0F002H$$,,00$0?G""))00446J{{JjJO,J,JHllG##!#!

 < $ = >J\^ 	 4488>> 	? 	*+K 
		$**	+s
ii&&{3C@ 
,	+	+s   ?*E22
F  N)
__name__
__module____qualname____firstlineno____doc__detailed_helpstaticmethodr!   rH   __static_attributes__rJ   r#   r    r   r       s0      
-  ,Ar#   r   N)rO   
__future__r   r   r   apitools.base.pyr   !googlecloudsdk.api_lib.cloudbuildr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.cloudbuildr	   (googlecloudsdk.command_lib.util.conceptsr
   googlecloudsdk.corer   r   r   googlecloudsdk.core.utilr   ReleaseTracksReleaseTrackALPHABETACommandr   rJ   r#   r    <module>r`      sv    2 &  ' % = ( ? D * ) $ * D%%++T->->-C-CD>AT\\ >A E>Ar#   