
    Č                     F   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	rS
rS)S jrS rS*S jrS rS rS rS rS rS rS rS rS r S+S jr  S,S jr   S-S jrS rS r S r!S r" S.S jr#   S-S jr$S  r%S! r&S" r'S# r(S$ r)S.S% jr*S& r+S' r,g()/z#Set up flags for creating triggers.    )absolute_import)division)unicode_literals)cloudbuild_util)arg_parsers)
exceptions)flagszHA file that contains the configuration for the WorkerPool to be created.zEA file that contains updates to the configuration for the WorkerPool.c                     U R                   R                  S5        U R                  SS9n[        U5        UR	                  SS9nU(       a  [
        R                  " USSS9  [        XB5        U$ )aL  Set up the generic argparse flags for creating or updating a build trigger.

Args:
  parser: An argparse.ArgumentParser-like object.
  add_region_flag: If true, the default region flag is added.
  add_name: If true, the trigger name is added.

Returns:
  An empty parser group to be populated with flags specific to a trigger-type.

          table(
            name,
            createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
            status
          )
        Trequired Flag based trigger configurationhelpFhiddenr   display_info	AddFormatadd_mutually_exclusive_groupAddTriggerConfigFilePathArgadd_argument_groupbuild_flagsAddRegionFlagAddFlagConfigArgs)parseradd_region_flagadd_nametrigger_configflag_configs        7lib/googlecloudsdk/api_lib/cloudbuild/trigger_config.pyAddTriggerArgsr"       sw     	 !  666E.n- 11- 2 /+k%%HK*	    c                     U R                   R                  S5        U R                  SS9n[        U5        UR	                  SS9n[
        R                  " USSS9  [        U5        U$ )zSet up the generic argparse flags for creating or updating a build trigger for GitLab Enterprise.

Args:
  parser: An argparse.ArgumentParser-like object.

Returns:
  An empty parser group to be populated with flags specific to a trigger-type.
r   Tr   r   r   Fr   r   )r   r   r    s      r!   AddGitLabEnterpriseTriggerArgsr%   B   st     	 !  666E.n- 11- 2 /+KFK 	r#   c                     U(       a  U R                  SSS9  U R                  SSS9  U R                  SSSS	9  U R                  S
S[        R                  S9  g)zAdds additional argparse flags related to flag config.

Args:
  flag_config: Argparse argument group. Additional flags will be added to this
    group to cover common flag configuration settings.
  add_name: If true, the trigger name is added.
z--namezBuild trigger name.r   z--descriptionzBuild trigger description.z--service-accountaW  The service account used for all user-controlled operations including UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild. If no service account is set, then the standard Cloud Build service account ([PROJECT_NUM]@system.gserviceaccount.com) is used instead. Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`.F)r   r   z--require-approvalz-Require manual approval for triggered builds.r   actionN)add_argumentr   StoreTrueFalseAction)r    r   s     r!   r   r   a   st     X,AB?1MNK   	 :--  /r#   c                 &    U R                  SSSS9  g)zAllow trigger config to be specified on the command line or STDIN.

Args:
  trigger_config: the config of which the file path can be specified.
z--trigger-configzPath to Build Trigger config file (JSON or YAML format). For more details, see
https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.triggers#BuildTrigger
PATH)r   metavarNr)   )r   s    r!   r   r   }   s$        r#   c                 *   U R                   (       a0  [        R                  " U R                   UR                  SS/S9nUS4$ UR                  5       nU R                  Ul        U R
                  Ul        U R                  Ul        [        X U5        US4$ )a   Parses flags generic to all triggers.

Args:
  args: An argparse arguments object.
  messages: A Cloud Build messages module

Returns:
  A partially populated build trigger and a boolean indicating whether or not
  the full trigger was loaded from a file.
build trigger configsubstitutionspathmsg_typemsg_friendly_nameskip_camel_caseTF)	r   r   LoadMessageFromPathBuildTriggernamedescriptionservice_accountserviceAccountParseRequireApproval)argsmessagestriggers      r!   ParseTriggerArgsrA      s     
11  &&0()	+G
 D=!!#'',(('//'wh/	%r#   c                    U R                   (       a0  [        R                  " U R                   UR                  SS/S9nUS4$ UR                  5       nU R                  Ul        U R
                  Ul        [        X U5        US4$ )a  Parses flags generic to all triggers.

Args:
  trigger_args: An argparse arguments object.
  messages: A Cloud Build messages module

Returns:
  A partially populated build trigger and a boolean indicating whether or not
  the full trigger was loaded from a file.
r0   r1   r2   TF)r   r   r7   r8   r:   r;   r<   r=   )trigger_argsr?   r@   s      r!   ParseTriggerArgsForUpdaterD      s       11((&&0()	+G
 D=!!#'$00''77'wh7	%r#   c                 &    U R                  SSSS9  g)zAdd flag related to including logs for GitHub checkrun summary page.

Args:
  flag_config: argparse argument group. Include logs for GitHub will be
  added to this config.
z--include-logs-with-statuszFBuild logs will be sent back to GitHub as part of the checkrun result.
store_truer'   Nr.   r    s    r!   AddIncludeLogsArgsrH      s"     "  r#   c                     U R                  SS[        R                  " 5       SS9  U R                  SS[        R                  " 5       SS9  g)zAdds additional argparse flags related to repo events.

Args:
  flag_config: argparse argument group. Additional flags will be added to this
    group to cover common build configuration settings.
z--included-fileszOGlob filter. Changes affecting at least one included file will trigger builds.
GLOB)r   typer-   z--ignored-fileszHGlob filter. Changes only affecting ignored files won't trigger builds.
N)r)   r   ArgListrG   s    r!   AddRepoEventArgsrM      s^              r#   c                 $    U R                  SSS9  g)Adds trigger filter flag arg.

Args:
  flag_config: argparse argument group. Trigger filter flag will be added to
    this config.
--subscription-filterCEL filter expression for the trigger. See https://cloud.google.com/build/docs/filter-build-events-using-cel for more details.
r   Nr.   rG   s    r!   AddFilterArgrR      s       r#   c                 h    U R                  5       nUR                  SSSS9  UR                  SSSS9  g)	rO   rP   NrQ   defaultr   z--clear-subscription-filterrF   z#Clear existing subscription filter.r(   r   )r   r)   )r    
filter_args     r!   AddFilterArgForUpdaterX      sN     779*   #0  r#   c                 N    U R                  SS[        R                  " 5       SS9  g)zAdds a substituion flag to the given argument group.

Args:
  argument_group: argparse argument group to which the substitution flag will
    be added.
z--substitutions	KEY=VALUEah  Parameters to be substituted in the build specification. For example:

  $ {command} ... --substitutions _FAVORITE_COLOR=blue,_NUM_CANDIES=10

This will result in a build where every occurrence of ```${_FAVORITE_COLOR}```
in certain fields is replaced by "blue", and similarly for ```${_NUM_CANDIES}```
and "10".

Substitutions can be applied to user-defined variables (starting with an
underscore) and to the following built-in variables: REPO_NAME, BRANCH_NAME,
TAG_NAME, REVISION_ID, COMMIT_SHA, SHORT_SHA.

For more details, see:
https://cloud.google.com/build/docs/configuring-builds/substitute-variable-values
r-   rK   r   N)r)   r   ArgDictargument_groups    r!   AddSubstitutionsr_     s.      	  r#   c                     U R                  SS[        R                  " 5       SS9  U R                  SSSS9  U R                  S	S
[        R                  " 5       SS9  g)zAdds substitution updating flags to the given argument group.

Args:
  argument_group: argparse argument group to which the substitution updating
    flags flag will be added.
z--update-substitutionsrZ   a4  Update or add to existing substitutions.
Substitutions are parameters to be substituted or add in the build specification.

For example (using some nonsensical substitution keys; all keys must begin with
an underscore):

  $ gcloud builds triggers update ...
      --update-substitutions _FAVORITE_COLOR=blue,_NUM_CANDIES=10

This will add the provided substitutions to the existing substitutions and
results in a build where every occurrence of ```${_FAVORITE_COLOR}```
in certain fields is replaced by "blue", and similarly for ```${_NUM_CANDIES}```
and "10".

Only the following built-in variables can be specified with the
`--substitutions` flag: REPO_NAME, BRANCH_NAME, TAG_NAME, REVISION_ID,
COMMIT_SHA, SHORT_SHA.

For more details, see:
https://cloud.google.com/build/docs/build-config-file-schema#substitutions
r[   z--clear-substitutionsrF   zClear existing substitutions.rV   z--remove-substitutionsKEYz)Remove existing substitutions if present.N)r)   r   r\   rL   r]   s    r!   AddSubstitutionUpdatingFlagsrb   0  sv      	  8 *    6	  r#   c                     [        U 5        U R                  SS9nUR                  SSSS9  UR                  SSSS9  U(       a	  [        X2S	9  U$ )
a  Adds additional argparse flags to a group for build configuration options.

Args:
  flag_config: argparse argument group. Additional flags will be added to this
    group to cover common build configuration settings.
  add_docker_args: If true, docker args are added automatically.
  require_docker_image: If true, --dockerfile-image must be provided.
Returns:
  build_config: a build config.
Tr   --build-configr,   zPath to a YAML or JSON file containing the build configuration in the repository.

For more details, see: https://cloud.google.com/cloud-build/docs/build-config
r-   r   --inline-configN      Local path to a YAML or JSON file containing a build configuration.
    )require_docker_image)r_   r   r)   AddBuildDockerArgs)r    add_docker_argsrh   build_configs       r!   AddBuildConfigArgsrl   b  sp    " ;9949H,     	 |O	r#   c                     U R                  SS9nUR                  SSSS9  SnU(       a  SnUR                  S	US
S9  SnU(       a  SnUR                  SUUS9  g)a  Adds additional argparse flags to a group for build docker options.

Args:
  argument_group: argparse argument group to which build docker flag will
    be added.
  require_docker_image: If true, --dockerfile-image must be provided.
  update: Whether the command is update.
z$Dockerfile build configuration flagsr   z--dockerfileTzPath of Dockerfile to use for builds in the repository.

If specified, a build config will be generated to run docker
build using the specified file.

The filename is relative to the Dockerfile directory.
r   r   /Nz--dockerfile-dirzLocation of the directory containing the Dockerfile in the repository.

The directory will also be used as the Docker build context.
rT   zDocker image name to build.

If not specified, gcr.io/PROJECT/github.com/REPO_OWNER/REPO_NAME:$COMMIT_SHA will be used.

Use a build configuration (cloudbuild.yaml) file for building multiple images in a single trigger.
zDocker image name to build.z--dockerfile-image)r   r)   )r^   rh   updatedockerdefault_dirdocker_image_help_texts         r!   ri   ri     s     ,,1 - 3&  
 +K   :#!  #r#   c                     U R                  5       n[        U5        U R                  5       nU(       a  UR                  SSSS9  UR                  SSSS9  U(       a  [        U5        [	        XSSS9  U$ )	a  Adds additional argparse flags to a group for build configuration options for update command.

Args:
  flag_config: Argparse argument group. Additional flags will be added to this
    group to cover common build configuration settings.
  has_build_config: Whether it is possible for the trigger to have
    filename.
  has_file_source: Whether it is possible for the trigger to have
    git_file_source.
  require_docker_image: If true, dockerfile image must be provided.

Returns:
  build_config: A build config.
rd   r,   z  Path to a YAML or JSON file containing the build configuration in the repository.

  For more details, see: https://cloud.google.com/cloud-build/docs/build-config
  re   rf   rg   T)rh   rp   )r   rb   r)   AddGitFileSourceArgsri   )r    has_build_confighas_file_sourcerh   r1   rk   s         r!   AddBuildConfigArgsForUpdaterx     s    , ::<-}-99;,     	 &dL 
r#   c                 J   U R                  5       nUR                  SSSS9  UR                  5       nUR                  SSS9  UR                  5       nUR                  SSS	S
9  UR                  SSSS
9  U R                  5       nUR                  SSS9  UR                  SSS9  g)zAdds additional argparse flags to a group for git repo source options for update commands.

Args:
  flag_config: Argparse argument group. Git repo source flags will be added to
    this group.
z--source-to-build-repositoryTkRepository resource (2nd gen) to use, in the format "projects/*/locations/*/connections/*/repositories/*".
r   r   z*--source-to-build-github-enterprise-configzThe resource name of the GitHub Enterprise config that should be applied to
this source (1st gen).
Format: projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}
or projects/{project}/githubEnterpriseConfigs/{id}
r   z--source-to-build-repo-typeziType of the repository (1st gen). Currently only GitHub and Cloud Source
Repository types are supported.
rn   z--source-to-build-urizKThe URI of the repository that should be applied to this source (1st gen).
z--source-to-build-branchBranch to build.z--source-to-build-tagTag to build.N)r   r)   r   )r    source_to_buildv1_gen_sourcev1_gen_repo_info
ref_configs        r!   AddRepoSourceForUpdater     s      <<>/$   "446-2   #557#        779*4;MN1Hr#   c                    U R                  SS9nUR                  5       nUR                  SSSS9  UR                  5       nUR                  SSS	S
9  UR                  5       nUR                  SSSSS9  UR                  SSSS9  UR                  SSS9  UR                  5       nUR                  SSS9  UR                  SSS9  g)zAdds additional argparse flags to a group for git file source options.

Args:
  argument_group: Argparse argument group to which git file source flag will
    be added.
zBuild file source flagsr   z--git-file-source-repositoryTrz   r{   z--git-file-source-pathr,   z=The file in the repository to clone when trigger is invoked.
re   z--git-file-source-uriURLz<The URI of the repository to clone when trigger is invoked.
)r   r-   r   z--git-file-source-repo-typez=The type of the repository to clone when trigger is invoked.
rn   z*--git-file-source-github-enterprise-configzYThe resource name of the GitHub Enterprise config that should be applied to this source.
z--git-file-source-branchz?The branch of the repository to clone when trigger is invoked.
z--git-file-source-tagz<The tag of the repository to clone when trigger is invoked.
Nr   r   r)   )r^   git_file_sourcerepo_sourcer   r   r   s         r!   ru   ru      s-    #55$ 6 &/<<>+$   002-   #557	    #    2  
 ;;=*   
   r#   c           	      0    U R                  SSSSSSS.S9  g	)
zAdds additional argparse flags to a group for comment control options.

Args:
  argument_group: Argparse argument group to which comment control flag will
    be added.
z--comment-controlCOMMENTS_ENABLEDzkRequire a repository collaborator or owner to comment '/gcbrun' on a pull request before running the build.zEDo not require comments on Pull Requests before builds are triggered.zjEnforce that repository owners or collaborators must comment on Pull Requests before builds are triggered.zEnforce that repository owners or collaborators must comment on external contributors' Pull Requests before builds are triggered.)COMMENTS_DISABLEDr   /COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY)rU   r   choicesNr.   r]   s    r!   AddCommentControlArgr   X  s6      6
?  r#   c                     UR                   (       a  UR                   U l        UR                  (       a  UR                  U l        gg)zrParses repo event related flags.

Args:
  trigger: The trigger to populate.
  args: An argparse arguments object.
N)included_filesincludedFilesignored_filesignoredFiles)r@   r>   s     r!   ParseRepoEventArgsr   x  s7     
 //G	--G r#   c                 B   UR                   (       aR  U(       d  UR                   U l        [        R                  " UR                  UR
                  R                  5      U l        UR                  (       a|  UR                  (       a  [        R                  " SS5      eUR                  =(       d    UnUR                  UR                  SUR                  SSSUSUR                  S/S	9/S
9U l        UR                  (       am  [        R                   " UR                  UR                  SS/5      U l        [        R                  " UR                  UR
                  R                  5      U l        U(       a*  UR                   =(       d    UR                  n[#        XX&S9  gg)a0  Parses build-config flags.

Args:
  trigger: The trigger to populate.
  args: An argparse arguments object.
  messages: A Cloud Build messages module.
  default_image: The docker image to use if args.dockerfile_image is empty.
  need_repo: Whether or not a repo needs to be included explicitly in flags.
Dockerfile and substitutions@Substitutions are not supported with a Dockerfile configuration."gcr.io/cloud-builders/gcb-internalrq   build-t-f.r9   dirr>   stepsinline build configr1   r   N)rk   filenamer   EncodeTriggerSubstitutionsr1   r8   SubstitutionsValue
dockerfilec_exceptionsConflictingArgumentsExceptiondockerfile_imageBuild	BuildStepdockerfile_dirr   inline_configr7   ParseGitRepoSource)r@   r>   r?   default_image	need_repoimager   s          r!   ParseBuildConfigArgsr     sj    
 **g+FFH11DDFG	__66
(
LN N !!2]ENN9''OO  
 # GM" 
#778J8J8@8M9H8IKGM ,FFH11DDFG   3DOOHwhB r#   c	                    U(       a  UR                   U l        UR                  (       a  UR                  (       a  [        R
                  " SS5      eUR                  (       a  UR                  n	ORUR                  (       a?  UR                  R                  (       a$  UR                  R                  S   R                  n	OSn	UR                  =(       d    Un
UR                  UR                  SU	SSSU
S	UR                  S
/S9/S9U l        UR                  (       a3  [        R                  " UR                  UR                  SS/5      U l        UR                  (       a1  [        R                   " UR"                  UR                  U5      U l        UR$                  (       a  [        R&                  " U5      U l        UR(                  (       a1  [        R*                  " UR"                  UR(                  U5      U l        U(       ar  UR,                  (       dU  UR.                  (       dD  UR0                  (       d3  UR2                  (       d"  UR4                  (       d  UR6                  (       a  [9        XX45        U(       a  UR:                  (       df  UR<                  (       dU  UR>                  (       dD  UR@                  (       d3  URB                  (       d"  URD                  (       d  URF                  (       a  [I        XX45        ggg)a7  Parses build-config flags for update command.

Args:
  trigger: The trigger to populate.
  old_trigger: The existing trigger to be updated.
  args: An argparse arguments object.
  messages: A Cloud Build messages module.
  update_mask: The fields to be updated.
  default_image: The default docker image to use.
  has_build_config: Whether it is possible for the trigger to have
    filename.
  has_repo_source: Whether it is possible for the trigger to have
    source_to_build.
  has_file_source: Whether it is possible for the trigger to have
    git_file_source.
r   r   r   ro   r   rq   r   r   r   r   r   r   r   r1   N)%rk   r   r   update_substitutionsr   r   r   r   r   r   r   r   r   r   r   r7   !EncodeUpdatedTriggerSubstitutionsr1   clear_substitutionsEncodeEmptyTriggerSubstitutionsremove_substitutionsRemoveTriggerSubstitutionssource_to_build_urisource_to_build_branchsource_to_build_tagsource_to_build_repo_type(source_to_build_github_enterprise_configsource_to_build_repositoryParseGitRepoSourceForUpdategit_file_source_urigit_file_source_pathgit_file_source_repo_typegit_file_source_branchgit_file_source_tag(git_file_source_github_enterprise_configgit_file_source_repositoryParseGitFileSource)r@   old_triggerr>   r?   update_maskr   rv   has_repo_sourcerw   r   r   s              r!   ParseBuildConfigArgsForUpdater     sC   2 ((G	__  66
(
LN N **n			{0066"((..q155nn,,=NN9"$OO  
 # GM" 
#778J8J8@8M9H8IKGM
 
+MM!!4#<#<hHG 
+KKG 
+FF!!4#<#<hG 
		$	$		!	!		'	'		6	6		(	(xE
$";";
$$
!!T%=%=
33
%%wh< & r#   c                 "   UR                  5       U l        SnUR                  (       a  SUR                  -   nO UR                  (       a  SUR                  -   nU(       a  X@R                  l        UR
                  (       aO  UR
                  U R                  l        UR                  S5        UR                  S5        UR                  S5        gUR                  (       d"  UR                  (       d  UR                  (       a  UR                  U R                  l        UR                  U R                  l        UR                  (       a4  UR                   R                  UR                  5      U R                  l        UR                  S5        gg)zParses git repo source flags for update command.

Args:
  trigger: The trigger to populate.
  args: An argparse arguments object.
  messages: A Cloud Build messages module.
  update_mask: The fields to be updated.
Nrefs/heads/
refs/tags/zsource_to_build.urizsource_to_build.repo_typez(source_to_build.github_enterprise_configzsource_to_build.repository)GitRepoSourcesourceToBuildr   r   refr   
repositoryappendr   r   r   urigithubEnterpriseConfigRepoTypeValueValuesEnumrepoType)r@   r>   r?   r   reporefs        r!   r   r   #  s7    #002''	  d999GT555G '	$$'+'F'FG$,-23AB
		6	6		'	' $ 8 8G55 0 %%

 
 
8
8,, $ 34 
(r#   c                    UR                  5       U l        SnUR                  (       a  SUR                  -   nO UR                  (       a  SUR                  -   nX@R                  l        UR
                  (       a`  UR
                  U R                  l        UR                  S5        UR                  S5        UR                  S5        UR                  S5        gUR                  (       d3  UR                  (       d"  UR                  (       d  UR                  (       a  UR                  U R                  l        UR                  U R                  l        UR                  U R                  l        UR                  (       a4  UR                   R                  UR                  5      U R                  l        UR                  S5        gg)	zParses git repo source flags.

Args:
  trigger: The trigger to populate.
  args: An argparse arguments object.
  messages: A Cloud Build messages module.
  update_mask: The fields to be updated.
Nr   r   zgit_file_source.urizgit_file_source.repo_typez(git_file_source.github_enterprise_configzgit_file_source.pathzgit_file_source.repository)GitFileSourcegitFileSourcer   r   revisionr   r   r   r   r   r   r   r3   r   r   r   r   )r@   r>   r?   r   r   s        r!   r   r   O  s`    #002'(	  t:::Hd666H#+ 	$$'+'F'FG$,-23AB-.
33		!	!		"	"		'	'!%!:!:G $ 8 8G55 0 %%

 
 
8
8,, $ 34 
(r#   c                 &    U R                  SSSS9  g )Nz--branch-patternREGEXa  A regular expression specifying which git branches to match.

This pattern is used as a regular expression search for any incoming pushes.
For example, --branch-pattern=foo will match "foo", "foobar", and "barfoo".
Events on a branch that does not match will be ignored.

The syntax of the regular expressions accepted is the syntax accepted by
RE2 and described at https://github.com/google/re2/wiki/Syntax.
re   r.   r   s    r!   AddBranchPatternr   }  s     	  r#   c                 &    U R                  SSSS9  g )Nz--tag-patternr   a  A regular expression specifying which git tags to match.

This pattern is used as a regular expression search for any incoming pushes.
For example, --tag-pattern=foo will match "foo", "foobar", and "barfoo".
Events on a tag that does not match will be ignored.

The syntax of the regular expressions accepted is the syntax accepted by
RE2 and described at https://github.com/google/re2/wiki/Syntax.
re   r.   r   s    r!   AddTagPatternr     s     	  r#   c                    U R                  SS9nUR                  SS9nUR                  SSS9  UR                  SS9nUR                  SSS	S
9  UR                  SSSS
9  UR                  5       nUR                  SSS9  UR                  SSSS9  UR                  5       nUR                  SSS9  UR                  SSS9  g)zAdds additional argparse flags to a group for git repo source options.

Args:
  flag_config: argparse argument group. Git repo source flags will be added to
    this group.
z+Flags for repository and branch informationr   z Flags for repository informationz--repositoryrz   z1st-gen repository settings.z--repoTzrURI of the repository (1st gen). Currently only HTTP URIs for GitHub and Cloud
Source Repositories are supported.
rn   z--repo-typeziType of the repository (1st gen). Currently only GitHub and Cloud Source Repository types
are supported.
z--github-enterprise-configzThe resource name of the GitHub Enterprise config that should be applied to this source (1st gen).
Format: projects/{project}/locations/{location}/githubEnterpriseConfigs/{id} or projects/{project}/githubEnterpriseConfigs/{id}
z--bitbucket-server-configzThe resource name of the Bitbucket Server config that should be applied to this source (1st gen).
Format: projects/{project}/locations/{location}/bitbucketServerConfigs/{id}
r{   z--branchr|   z--tagr}   Nr   )r    repo_config
gen_configv1_repoconfigr   s         r!   AddGitRepoSourcer     s%    ..8 / :+77- 8 /*  
 ))/M)N'	   
   //1&"   	!   779**+=>'8r#   c           
      ,   U(       a9  UR                   (       d(  UR                  (       d  [        R                  " SS5      eUR                   (       dK  UR                  (       d:  UR                  (       d  UR
                  (       a  [        R                  " SS5      egUR                  (       d(  UR
                  (       d  [        R                  " SS5      eUR                  (       a  SUR                  -   nOSUR
                  -   nUR                  (       d  SO$UR                  R                  UR                  5      nUR                  UR                  UR                   UUUR                  UR                  S	9U l        UR                  (       d  SO$UR                  R                  UR                  5      nUR                  (       aM  UR                  UR                  UR                  UR                   UUUR                  UR                  S
9U l        gg)zParses git repo source flags.

Args:
  trigger: The trigger to populate.
  args: An argparse arguments object.
  messages: A Cloud Build messages module.
  required: Whether or not the repository info is required.
REPOzT--repo or --repository is required when specifying a --dockerfile or --build-config.zG--repo or --repository is required when specifying a --branch or --tag.NREVISIONzG--branch or --tag is required when specifying a --repository or --repo.r   r   )r   r   r   r   r   bitbucketServerConfig)r   r3   r   r   r   r   r   )repor   r   RequiredArgumentExceptionbranchtag	repo_typer   r   github_enterprise_configbitbucket_server_configr   r   rk   r   )r@   r>   r?   r   r    parsed_git_repo_source_repo_type parsed_git_file_source_repo_types          r!   r   r     s    dii

0
0"  
4??{{dhh22
$  	TXX

0
0	  
[[
$++
%C

!C ..d!!99$..I #
 #00
))
/!:: 88 1 ' ..d!!99$..I #
 
$22??II1#<<":: 3 <G r#   c                 \    UR                   b  UR                  UR                   S9U l        gg)zParses approval required flag.

Args:
  trigger: The trigger to populate.
  args: An argparse arguments object.
  messages: A Cloud Build messages module.
N)approvalRequired)require_approvalApprovalConfigapprovalConfigr@   r>   r?   s      r!   r=   r=     s6     
&%44.. 5 G 'r#   c                 r    UR                   (       a&  UR                  R                  R                  U l        gg)zParses include logs with status flag.

Args:
  trigger: The trigger to populate.
  args: An argparse arguments object.
  messages: A Cloud Build messages module.
N)include_logs_with_statusr8   IncludeBuildLogsValueValuesEnumINCLUDE_BUILD_LOGS_WITH_STATUSincludeBuildLogsr   s      r!   ParseIncludeLogsWithStatusr   .  s/     
""	(	()G)G  #r#   N)TT)T)TF)FF)FFF)F)-__doc__
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   googlecloudsdk.callioper   r   r   !googlecloudsdk.command_lib.buildsr	   r   _CREATE_FILE_DESC_UPDATE_FILE_DESCr"   r%   r   r   rA   rD   rH   rM   rR   rX   r_   rb   rl   ri   rx   r   ru   r   r   r   r   r   r   r   r   r   r   r=   r    r#   r!   <module>r	     s    * &  ' = / > B1 ' D>/8"64 4,</f =B'X 1#j 27055:2j(IV5p@
." $)	:CF 492727^=B)5X+5\  29jJ<ZIr#   