Ejemplo n.º 1
0
def PatchApplication(
    release_track, split_health_checks=None, use_container_optimized_os=None):
  """Updates an App Engine application via API client.

  Args:
    release_track: The release track of the app update command to run.
    split_health_checks: Boolean, whether to enable split health checks by
      default.
    use_container_optimized_os: Boolean, whether to enable Container-Opimized
      OS as Flex base VM image by default.
  """
  api_client = appengine_app_update_api_client.GetApiClientForTrack(
      release_track)

  if use_container_optimized_os is not None:
    log.warning(_APP_UPDATE_COS_WARNING)
  if (split_health_checks is not None
      or use_container_optimized_os is not None):
    with progress_tracker.ProgressTracker(
        'Updating the app [{0}]'.format(api_client.project)):
      api_client.PatchApplication(
          split_health_checks=split_health_checks,
          use_container_optimized_os=use_container_optimized_os)
  else:
    log.status.Print('Nothing to update.')
  def Run(self, args):
    api_client = appengine_app_update_api_client.GetApiClientForTrack(
        self.ReleaseTrack())

    if args.split_health_checks is not None:
      with progress_tracker.ProgressTracker(
          'Updating the app [{0}]'.format(api_client.project)):
        return api_client.PatchApplication(args.split_health_checks)
    else:
      log.status.Print('Nothing to update.')
def PatchApplication(release_track,
                     split_health_checks=None,
                     service_account=None):
    """Updates an App Engine application via API client.

  Args:
    release_track: The release track of the app update command to run.
    split_health_checks: Boolean, whether to enable split health checks by
      default.
    service_account: str, the app-level default service account to update for
      this App Engine app.
  """
    api_client = appengine_app_update_api_client.GetApiClientForTrack(
        release_track)

    if split_health_checks is not None or service_account is not None:
        with progress_tracker.ProgressTracker('Updating the app [{0}]'.format(
                api_client.project)):
            api_client.PatchApplication(
                split_health_checks=split_health_checks,
                service_account=service_account)
    else:
        log.status.Print('Nothing to update.')