
                            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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dlmZ ddlmZ  e
j(                  e
j*                  j,                         G d de
j.                               Zy)z(Update GitLab Enterprise config command.    )absolute_import)division)unicode_literals)cloudbuild_util)waiter)base)gitlab_flags)resource_args)concept_parsers)log)
properties)	resourcesc                   &    e Zd ZdZed        Zd Zy)CreateAlphaz9Update a GitLab Enterprise config for use by Cloud Build.c                     t         j                  j                  dt        j                         dd      j                  |        t        j                  |       } y)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.
    CONFIGzGitLab Enterprise config.TrequiredN)r   ConceptParserForResourcer
   GetGitLabConfigResourceSpecAddToParserr	   AddGitLabConfigUpdateArgs)parsers    5lib/surface/builds/enterprise_config/gitlab/update.pyArgszCreateAlpha.Args$   sN     !!--113#	 .  #{6*33F;F    c           	      &   t        j                         }t        j                         }|j                  }t        j                  |      }t
        j                  j                  j                  j                  d      }t        j                  j                  ddd||j                  |d      }t        j                  |      }|j                  |j!                         |dj#                  |      	      }	|j$                  j'                  |	      }
t        j                  j)                  |
j*                  d
      }t-        j.                  t-        j0                  |j$                  |j2                        |d      }t5        j6                  |d       |S )zThis is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      Some value that we want to have printed later.
    Tr   Nz+cloudbuild.projects.locations.gitLabConfigsv1)
projectsIdlocationsIdgitLabConfigsId)
collectionapi_versionparams,)namegitLabConfig
updateMaskz(cloudbuild.projects.locations.operations)r#   z!Updating GitLab Enterprise configenterprise_config)kind)r   GetClientInstanceGetMessagesModuler   GitLabConfigFromArgsr   VALUEScoreprojectGetr   REGISTRYParseregionMessageToFieldPaths4CloudbuildProjectsLocationsGitLabConfigsPatchRequestRelativeNamejoin projects_locations_gitLabConfigsPatchParseRelativeNamer'   r   WaitForCloudOperationPollerprojects_locations_operationsr   UpdatedResource)selfargsclientmessages	config_idgitlabparentgitlab_resourceupdate_maskreq
updated_opop_resourceupdated_gitlabs                r   RunzCreateAlpha.Run4   sf    ..0F002HI11$7F##++///>F  ((..@ ;;(
	 / O "55f=K

G
G))+88K( H *C
 88>>sCJ$$66$N 7 PK ^^##F$K$K$*$H$H	J8:N
 	(;<r   N)__name__
__module____qualname____doc__staticmethodr   rN    r   r   r   r       s    A< <-r   r   N)rR   
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.cloudbuildr	   r
   (googlecloudsdk.command_lib.util.conceptsr   googlecloudsdk.corer   r   r   ReleaseTracksReleaseTrackALPHACreateCommandr   rT   r   r   <module>r`      sk    / &  ' = . ( > ? D # * ) D%%++,@$$$ @ -@r   