
    -                         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'Update 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)CreateAlphaz8Update 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	   "AddBitbucketServerConfigUpdateArgsdisplay_info	AddFormat)parsers    >lib/surface/builds/enterprise_config/bitbucketserver/update.pyArgszCreateAlpha.Args"   s-     #EEfMF
!! #     c           	         t        j                         }t        j                         }|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dd|||d      }	t        j                   |      }
|j#                  |	j%                         |dj'                  |
      	      }|j(                  j+                  |      }t        j                  j-                  |j.                  d
      }t1        j2                  t1        j4                  |j(                  |j6                        |d      }t9        j:                  |	       |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)requiredNz4cloudbuild.projects.locations.bitbucketServerConfigsv1)
projectsIdlocationsIdbitbucketServerConfigsId)
collectionapi_versionparams,)namebitbucketServerConfig
updateMaskz(cloudbuild.projects.locations.operations)r   z Updating Bitbucket Server config)r   GetClientInstanceGetMessagesModuleCONFIGBitbucketServerConfigFromArgsr   VALUEScoreprojectGetbuildsregionDEFAULT_REGIONr   REGISTRYParseMessageToFieldPaths=CloudbuildProjectsLocationsBitbucketServerConfigsPatchRequestRelativeNamejoin)projects_locations_bitbucketServerConfigsPatchParseRelativeNamer!   r   WaitForCloudOperationPollerprojects_locations_operationsr
   UpdatedResource)selfargsclientmessages	config_idbbsparent
regionprop
bbs_regionbbs_resourceupdate_maskreq
updated_opop_resourceupdated_bbss                  r   RunzCreateAlpha.Run3   s    ..0F002HI

7
7d
CC##++///>F""))00446JL
Lo.L.LJ %%++I %(1
	 , L "55c:K

P
P&&(!88K( Q *C
 AAGGLJ$$66$N 7 PK ..##<<00	23>*	,K %r   N)__name__
__module____qualname____doc__staticmethodr   rK    r   r   r   r      s    @  2r   r   N)rO   
__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   rQ   r   r   <module>r\      se    . &  ' = . ( G # * ) D%%++,F$$$ F -Fr   