code: func (cmd *createSnapshotCmd) Run(app subcommands.Application, args []string, env subcommands.Env) int {
  	c := cli.GetContext(app, cmd, env)
  	labels, err := cmd.validateFlags(c)
  	if err != nil {
  		logging.Errorf(c, "%s", err.Error())
  		return 1
  	}
  
  	srv := getService(c)
  	logging.Infof(c, "Creating snapshot.")
  	snapshot := &compute.Snapshot{
  		Labels: labels,
  		Name:   cmd.name,
  	}
  	op, err := compute.NewDisksService(srv).CreateSnapshot(cmd.project, cmd.zone, cmd.disk, snapshot).Context(c).Do()
  	for {
  		if err != nil {
  			for _, err := range err.(*googleapi.Error).Errors {
  				logging.Errorf(c, "%s", err.Message)
  			}
  			return 1
  		}
  		if op.Status == "DONE" {
  			break
  		}
  		logging.Infof(c, "Waiting for snapshot to be created...")
  		time.Sleep(2 * time.Second)
  		op, err = compute.NewZoneOperationsService(srv).Get(cmd.project, cmd.zone, op.Name).Context(c).Do()
  	}
  	if op.Error != nil {
  		for _, err := range op.Error.Errors {
  			logging.Errorf(c, "%s", err.Message)
  		}
  		return 1
  	}
  	logging.Infof(c, "Created snapshot.")
  	return 0
  }
docs: // Run runs the command to create a disk snapshot.