
                             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 Bitbucket Server config command.    )absolute_import)division)unicode_literals)cloudbuild_util)waiter)base)bitbucketserver_flags)log)
properties)	resourcesc                   &    e Zd ZdZed        Zd Zy)CreateAlphaz8Create a Bitbucket Server 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_uri
          )
        N)r	   "AddBitbucketServerConfigCreateArgsdisplay_info	AddFormat)parsers    >lib/surface/builds/enterprise_config/bitbucketserver/create.pyArgszCreateAlpha.Args"   s-     #EEfMF
!! #     c           	         t        j                         }t        j                         }t        j                  |d      }t        j
                  j                  j                  j                  d      }t        j
                  j                  j                  j                         }|j                  xs |xs t         j                  }t        j                  j                  d||      }|j                  j                  |j!                  |j#                         ||j$                              }	t        j                  j'                  |	j$                  d      }
t)        j*                  t)        j,                  |j                  |j.                        |
d	      }t        j                  j1                  d
dd|||j$                  d      }t3        j4                  |       |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bitbucketServerConfigbitbucketServerConfigIdz(cloudbuild.projects.locations.operations)r   z Creating Bitbucket Server configNz4cloudbuild.projects.locations.bitbucketServerConfigsv1)r   r   bitbucketServerConfigsId)r   api_versionparams)r   GetClientInstanceGetMessagesModuleBitbucketServerConfigFromArgsr   VALUEScoreprojectGetbuildsregionDEFAULT_REGIONr   REGISTRYCreate)projects_locations_bitbucketServerConfigs>CloudbuildProjectsLocationsBitbucketServerConfigsCreateRequestRelativeNamenameParseRelativeNamer   WaitForCloudOperationPollerprojects_locations_operationsParser
   CreatedResource)selfargsclientmessagesbbsr   
regionprop
bbs_regionparent_resource
created_opop_resourcecreated_configbbs_resources                r   RunzCreateAlpha.Run3   s    ..0F002H

7
7e
DC##++///>F""))00446JL
Lo.L.LJ((//2 0  O
 AAHHOO"//1"%$(II 	P 	/0J
 $$66$N 7 PK^^##<<00	23>*	,N
 %%++I %(6(;(;
	 , L %r   N)__name__
__module____qualname____doc__staticmethodr   rE    r   r   r   r      s    @  /r   r   N)rI   
__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   rK   r   r   <module>rV      se    . &  ' = . ( G # * ) D%%++,C$$$ C -Cr   