def Run(self, args):
        """This 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.

    Raises:
      ConflictingArgumentsException:
          If both cluster and multi_cluster are present.
          If both multi_cluster and transactional_writes are present.
      OneOfArgumentsRequiredException: If neither cluster or multi_cluster are
          present.

    Returns:
      Updated resource.
    """
        app_profile_ref = args.CONCEPTS.app_profile.Parse()
        try:
            result = self._UpdateAppProfile(app_profile_ref, args)
        except HttpError as e:
            util.FormatErrorMessages(e)
        else:
            operation_ref = util.GetOperationRef(result)

            if args.async_:
                log.UpdatedResource(operation_ref,
                                    kind='bigtable app profile {0}'.format(
                                        app_profile_ref.Name()),
                                    is_async=True)
                return result

            return util.AwaitAppProfile(
                operation_ref, 'Updating bigtable app profile {0}'.format(
                    app_profile_ref.Name()))
예제 #2
0
  def Run(self, args):
    """This 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.

    Raises:
      exceptions.ConflictingArgumentsException: If the user provides
        --transactional-writes and --route-any.

    Returns:
      Created resource.
    """
    app_profile_ref = args.CONCEPTS.app_profile.Parse()
    try:
      result = app_profiles.Update(
          app_profile_ref,
          cluster=args.route_to,
          description=args.description,
          multi_cluster=args.route_any,
          transactional_writes=args.transactional_writes,
          force=args.force)
    except HttpError as e:
      util.FormatErrorMessages(e)
    else:
      operation_ref = util.GetOperationRef(result)

      if args.async:
        log.UpdatedResource(
            operation_ref,
            kind='bigtable app-profile {0}'.format(app_profile_ref.Name()),
            is_async=True)
        return result

      return util.AwaitAppProfile(
          operation_ref,
          'Updating bigtable app-profile {0}'.format(app_profile_ref.Name()))