
                             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 GitHub Enterprise config command.    )absolute_import)division)unicode_literals)cloudbuild_util)waiter)base)githubenterprise_flags)log)
properties)	resourcesc                   &    e Zd ZdZed        Zd Zy)CreateAlphaz<Create a GitHub Enterprise Config for use by Cloud Build.
  c                 d    t        j                  |       } | j                  j                  d       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.
    z
          table(
            name,
            createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
            host_url,
            app_id
          )
        N)r	   #AddGitHubEnterpriseConfigCreateArgsdisplay_info	AddFormat)parsers    5lib/surface/builds/enterprise_config/github/create.pyArgszCreateAlpha.Args#   s-     $GGOF
!! #     c           	         t        j                         }t        j                         }t        j                  |d      }t        j
                  j                  j                  j                         }|j                  xs |xs t         j                  }t        j
                  j                  j                  j                  d      }t        j                  j                  d||      }|j                  j                  |j!                  |j#                         |j$                  ||            }	t        j                  j'                  |	j$                  d      }
t)        j*                  t)        j,                  |j.                  |j0                        |
d	      }t        j                  j3                  d
dd||j$                  |d      }t5        j6                  |       |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.
    FT)requiredzcloudbuild.projects.locations)
collection
projectsIdlocationsId)parentgheConfigIdgitHubEnterpriseConfig	projectIdz(cloudbuild.projects.locations.operations)r   z!Creating github enterprise configNz5cloudbuild.projects.locations.githubEnterpriseConfigsv1)r   githubEnterpriseConfigsIdr   )r   api_versionparams)r   GetClientInstanceGetMessagesModuleGitHubEnterpriseConfigFromArgsr   VALUESbuildsregionGetDEFAULT_REGIONcoreprojectr   REGISTRYCreate*projects_locations_githubEnterpriseConfigs?CloudbuildProjectsLocationsGithubEnterpriseConfigsCreateRequestRelativeNamenameParseRelativeNamer   WaitForCloudOperationPoller projects_githubEnterpriseConfigsprojects_locations_operationsParser
   CreatedResource)selfargsclientmessagesghe
regionproplocationr   parent_resource
created_opop_resourcecreated_configghe_resources                r   RunzCreateAlpha.Run5   s    ..0F002H

8
8u
EC""))00446J{{JjJO,J,JH##++///>F((//2 0 O
 BBIIPP"//1		#&	 	Q 	J $$66$N 7 PK^^##F$K$K$*$H$H	J8:N %%++J )7)<)<#
	 , L %r   N)__name__
__module____qualname____doc__staticmethodr   rG    r   r   r   r      s       "0r   r   N)rK   
__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   rM   r   r   <module>rX      se    / &  ' = . ( H # * ) D%%++,F$$$ F -Fr   