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.

    Returns:
      None
    """
    cluster_ref = args.CONCEPTS.cluster.Parse()
    operation = clusters.Update(cluster_ref, args.num_nodes)
    if not args.async:
      operation_ref = util.GetOperationRef(operation)
      return util.AwaitCluster(
          operation_ref,
          'Updating bigtable cluster {0}'.format(cluster_ref.Name()))

    log.UpdatedResource(cluster_ref.Name(), kind='cluster', is_async=args.async)
    return None
Beispiel #2
0
    def _Run(self, args):
        """Implements Run() with different possible features flags."""
        cluster_ref = args.CONCEPTS.cluster.Parse()
        operation = clusters.PartialUpdate(
            cluster_ref,
            nodes=args.num_nodes,
            autoscaling_min=args.autoscaling_min_nodes,
            autoscaling_max=args.autoscaling_max_nodes,
            autoscaling_cpu_target=args.autoscaling_cpu_target,
            disable_autoscaling=args.disable_autoscaling)
        if not args.async_:
            operation_ref = util.GetOperationRef(operation)
            return util.AwaitCluster(
                operation_ref,
                'Updating bigtable cluster {0}'.format(cluster_ref.Name()))

        log.UpdatedResource(cluster_ref.Name(),
                            kind='cluster',
                            is_async=args.async_)
        return None
Beispiel #3
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.

    Returns:
      Some value that we want to have printed later.
    """
    cluster_ref = args.CONCEPTS.cluster.Parse()
    operation = clusters.Create(
        cluster_ref, args.zone, serve_nodes=args.num_nodes)
    operation_ref = util.GetOperationRef(operation)
    if args.async_:
      log.CreatedResource(
          operation_ref,
          kind='bigtable cluster {0}'.format(cluster_ref.Name()),
          is_async=True)
      return
    return util.AwaitCluster(
        operation_ref,
        'Creating bigtable cluster {0}'.format(cluster_ref.Name()))