
                             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 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)UpdateAlphaz7Update github enterprise config used 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	   #AddGitHubEnterpriseConfigUpdateArgsdisplay_info	AddFormat)parsers    5lib/surface/builds/enterprise_config/github/update.pyArgszUpdateAlpha.Args#   s-     $GGOF
!! #     c           	         t        j                         }t        j                         }|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dd|||d      }	t        j                   |      }
|
j#                          |j%                  |	j'                         |dj)                  |
      	      }|j*                  j-                  |      }t        j                  j/                  |j0                  d
      }t3        j4                  t3        j6                  |j*                  |j8                        |d      }t;        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:
      The updated github enterprise resource.
    T)requiredNz5cloudbuild.projects.locations.githubEnterpriseConfigsv1)
projectsIdgithubEnterpriseConfigsIdlocationsId)
collectionapi_versionparams,)namegitHubEnterpriseConfig
updateMaskz(cloudbuild.projects.locations.operations)r   z!Updating GitHub Enterprise Config)r   GetClientInstanceGetMessagesModuleCONFIGGitHubEnterpriseConfigFromArgsr   VALUESbuildsregionGetDEFAULT_REGIONcoreprojectr   REGISTRYParseMessageToFieldPathssort>CloudbuildProjectsLocationsGithubEnterpriseConfigsPatchRequestRelativeNamejoin*projects_locations_githubEnterpriseConfigsPatchParseRelativeNamer!   r   WaitForCloudOperationPollerprojects_locations_operationsr
   UpdatedResource)selfargsclientmessages	config_idghe
regionproplocationparentghe_resourceupdate_maskreq
updated_opop_resourceupdated_ghes                  r   RunzUpdateAlpha.Run5   s    ..0F002HI

8
8t
DC""))00446J{{JjJO,J,JH##++///>F %%++J )2#
	 , 	L "55c:KOO**,#&xx, 	P 	
  BBHHMJ$$66$N 7 K ..##==00	
 	+K %r   N)__name__
__module____qualname____doc__staticmethodr   rL    r   r   r   r      s       "<r   r   N)rP   
__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UpdateCommandr   rR   r   r   <module>r]      se    / &  ' = . ( H # * ) D%%++,R$$$ R -Rr   