func newModifyFlags() *modifyFlags { m := &modifyFlags{} flagSet := flag.NewFlagSet("modify", flag.ContinueOnError) flagSet.BoolVar(&m.force, "f", false, "Force creation of tags on not taggable image") flagSet.Var(flags.NewStringSlice(nil, &m.createTags), "create-tags", "Create or override tags") flagSet.Var(flags.NewStringSlice(nil, &m.deleteTags), "delete-tags", "Delete tags") flagSet.Var(flags.NewIntSlice(nil, &m.imageIds), "ids", "Images to be delete with actions") m.helpMsg = `Usage: images modify --providers sl [options] Modify AMI properties. Options: -ids "123,..." Images to be used with below actions -create-tags "key=val,..." Create or override tags -delete-tags "key,..." Delete tags -f Force creation of tags on not taggable image. ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, m.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission m.flagSet = flagSet return m }
func newListFlags() *listFlags { l := &listFlags{} flagSet := flag.NewFlagSet("list", flag.ContinueOnError) flagSet.Var(utils.NewOutputValue(utils.Simplified, &l.output), "output", "Output mode") flagSet.Var(flags.NewStringSlice(nil, &l.imageIds), "ids", "Images to be listed. Default case is all images") flagSet.Var(flags.NewStringSlice(nil, &l.owners), "owners", "Filters the images by the owner. By ddefault self is being used") l.helpMsg = `Usage: images list --providers aws [options] List AMI properties. Options: -ids "ami-123,..." Images to be listed. By default all images are shown. -owners "self,..." Filters the images by the owner. By default self is being used. -output "json" Output mode of images. (default: "simplified") Available options: "json","table" or "simplified" ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, l.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission l.flagSet = flagSet return l }
func newCopyOptions() *CopyOptions { c := &CopyOptions{} flagSet := flag.NewFlagSet("copy", flag.ContinueOnError) flagSet.StringVar(&c.ImageID, "image", "", "Image to be copied with the given id") flagSet.StringVar(&c.Desc, "desc", "", "Description for the new AMI (optional)") flagSet.BoolVar(&c.DryRun, "dry-run", false, "Don't run command, but show the action") flagSet.Var(flags.NewStringSlice(nil, &c.SourceRegions), "to", "Images to be copied to the given regions") c.helpMsg = `Usage: images copy --providers aws [options] Copy image to regions Options: -image "ami-123" Image to be copied with the given id -to "us-east-1,..." Image to be copied to the given regions -desc "My New Image" Description for the new AMI's (optional) -dry-run Don't run command, but show the action ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, c.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission c.flagSet = flagSet return c }
func newModifyFlags() *modifyFlags { m := &modifyFlags{} flagSet := flag.NewFlagSet("modify", flag.ContinueOnError) flagSet.StringVar(&m.createTags, "create-tags", "", "Create or override tags") flagSet.StringVar(&m.deleteTags, "delete-tags", "", "Delete tags") flagSet.Var(flags.NewStringSlice(nil, &m.imageIds), "ids", "Images to be delete with actions") flagSet.BoolVar(&m.dryRun, "dry-run", false, "Don't run command, but show the action") m.helpMsg = `Usage: images modify --providers aws [options] Modify AMI properties. Options: -ids "ami-123,..." Images to be used with below actions -create-tags "key=val,..." Create or override tags -delete-tags "key,..." Delete tags -dry-run Don't run command, but show the action ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, m.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission m.flagSet = flagSet return m }
func newCopyFlags() *copyFlags { c := ©Flags{} flagSet := flag.NewFlagSet("copy", flag.ContinueOnError) flagSet.IntVar(&c.imageID, "id", 0, "Image to be copied with the given id") flagSet.Var(flags.NewStringSlice(nil, &c.datacenters), "to", "Images to be copied to the given datacenters") c.helpMsg = `Usage: images copy --providers sl [options] Copy image to regions Options: -id "123" Image to be copied with the given id -to "dal05,..." Image to be copied to the given datacenters ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, c.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission c.flagSet = flagSet return c }
func newCopyOptions() *CopyOptions { c := &CopyOptions{} flagSet := flag.NewFlagSet("copy", flag.ContinueOnError) flagSet.IntVar(&c.ImageID, "image", 0, "Image to be copied with the given id") flagSet.Var(flags.NewStringSlice(nil, &c.SourceRegions), "to", "Images to be copied to the given regions") c.helpMsg = `Usage: images copy --providers do [options] Copy image to regions Options: -image "123" Image to be copied with the given id -to "fra1,nyc2,..." Image to be copied to the given regions ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, c.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission c.flagSet = flagSet return c }
func newDeleteOptions() *DeleteOptions { d := &DeleteOptions{} flagSet := flag.NewFlagSet("delete", flag.ContinueOnError) flagSet.Var(flags.NewStringSlice(nil, &d.Names), "names", "Images to be delete with the given names") d.helpMsg = `Usage: images delete --providers gce [options] Delete images Options: -names "myImage,..." Images to be deleted with the given names ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, d.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission d.flagSet = flagSet return d }
func newDeleteOptions() *DeleteOptions { d := &DeleteOptions{} flagSet := flag.NewFlagSet("delete", flag.ContinueOnError) flagSet.Var(flags.NewStringSlice(nil, &d.ImageIds), "ids", "Images to be delete with the given ids") flagSet.BoolVar(&d.DryRun, "dry-run", false, "Don't run command, but show the action") d.helpMsg = `Usage: images delete --providers aws [options] Deregister AMI's. Options: -ids "ami-123,..." Images to be deleted with the given ids -dry-run Don't run command, but show the action ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, d.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission d.flagSet = flagSet return d }
func newDeprecateOptions() *DeprecateOptions { m := &DeprecateOptions{} flagSet := flag.NewFlagSet("modify", flag.ContinueOnError) flagSet.Var(flags.NewStringSlice(nil, &m.Names), "ids", "Images to be delete with the given names") flagSet.StringVar(&m.State, "state", "", "Image state to be applied") m.helpMsg = `Usage: images modify --providers gce [options] Depcreate images Options: -names "myImage,..." Images to be deprecated -state "..." Image state to be applied. Possible values: DELETED, DEPRECATED, OBSOLETE or "" (to clear state) ` flagSet.Usage = func() { fmt.Fprintf(os.Stderr, m.helpMsg) } flagSet.SetOutput(ioutil.Discard) // don't print anything without my permission m.flagSet = flagSet return m }