
                             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  e
j"                  e
j$                  j&                         G d de
j(                               Zy)z(Create GitLab Enterprise config command.    )absolute_import)division)unicode_literals)cloudbuild_util)waiter)base)gitlab_flags)log)
properties)	resourcesc                   &    e Zd ZdZed        Zd Zy)CreateAlphaz9Create a GitLab Enterprise config for use by Cloud Build.c                 .    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.
    N)r	   AddGitLabConfigCreateArgs)parsers    5lib/surface/builds/enterprise_config/gitlab/create.pyArgszCreateAlpha.Args"   s     33F;F    c                    t        j                         }t        j                         }t        j                  |      }t        j
                  j                  j                  j                  d      }t        j                  j                  d||j                        }|j                  j                  |j                  |j                         ||j                               }t        j                  j#                  |j                   d      }t%        j&                  t%        j(                  |j                  |j*                        |d      }	t-        j.                  |	j                   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.
    T)requiredzcloudbuild.projects.locations)
collection
projectsIdlocationsId)parentgitLabConfiggitlabConfigIdz(cloudbuild.projects.locations.operations)r   z!Creating GitLab Enterprise configenterprise_config)kind)r   GetClientInstanceGetMessagesModuleGitLabConfigFromArgsr   VALUEScoreprojectGetr   REGISTRYCreateregion projects_locations_gitLabConfigs5CloudbuildProjectsLocationsGitLabConfigsCreateRequestRelativeNamenameParseRelativeNamer   WaitForCloudOperationPollerprojects_locations_operationsr
   CreatedResource)
selfargsclientmessagesgitlab_configr   parent_resource
created_opop_resourcecreated_configs
             r   RunzCreateAlpha.Run,   s>    ..0F002H#88>M##++///>F  ((//2KK 0 !O 88??FF"//1&99 	G 	&'J $$66$N 7 PK ^^##F$K$K$*$H$H	J8:N
 ++2EFr   N)__name__
__module____qualname____doc__staticmethodr   r;    r   r   r   r      s    A< <&r   r   N)r?   
__future__r   r   r   !googlecloudsdk.api_lib.cloudbuildr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   %googlecloudsdk.command_lib.cloudbuildr	   googlecloudsdk.corer
   r   r   ReleaseTracksReleaseTrackALPHACreateCommandr   rA   r   r   <module>rL      sb    / &  ' = . ( > # * ) D%%++,3$$$ 3 -3r   