MCPcopy
hub / github.com/lxc/incus / command

Method command

cmd/incus/storage_volume.go:1146–1187  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1144var cmdStorageVolumeGetUsage = u.Usage{u.Pool.Remote(), u.MakePath(u.StorageVolumeType.Optional(), u.Volume, u.Snapshot.Optional()), u.Key}
1145
1146func (c *cmdStorageVolumeGet) command() *cobra.Command {
1147 cmd := &cobra.Command{}
1148 cmd.Use = cli.U("get", cmdStorageVolumeGetUsage...)
1149 cmd.Short = i18n.G("Get values for storage volume configuration keys")
1150 cmd.Long = cli.FormatSection(color.DescriptionPrefix, i18n.G(
1151 `Get values for storage volume configuration keys
1152
1153If the type is not specified, incus assumes the type is "custom".
1154Supported values for type are "custom", "container" and "virtual-machine".
1155
1156For snapshots, add the snapshot name (only if type is one of custom, container or virtual-machine).`,
1157 ))
1158 cmd.Example = cli.FormatSection("", i18n.G(
1159 `incus storage volume get default data size
1160 Returns the size of a custom volume "data" in pool "default"
1161
1162incus storage volume get default virtual-machine/data snapshots.expiry
1163 Returns the snapshot expiration period for a virtual machine "data" in pool "default"`,
1164 ))
1165
1166 cli.AddStringFlag(cmd.Flags(), &c.storage.flagTarget, "target", "", "", i18n.G("Cluster member name"))
1167 cli.AddBoolFlag(cmd.Flags(), &c.flagIsProperty, "property|p", i18n.G("Get the key as a storage volume property"))
1168 cmd.RunE = c.run
1169
1170 cmd.ValidArgsFunction = func(_ *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
1171 if len(args) == 0 {
1172 return c.global.cmpStoragePools(toComplete)
1173 }
1174
1175 if len(args) == 1 {
1176 return c.global.cmpStoragePoolVolumes(args[0])
1177 }
1178
1179 if len(args) == 2 {
1180 return c.global.cmpStoragePoolVolumeConfigs(args[0], args[1])
1181 }
1182
1183 return nil, cobra.ShellCompDirectiveNoFileComp
1184 }
1185
1186 return cmd
1187}
1188
1189func (c *cmdStorageVolumeGet) run(cmd *cobra.Command, args []string) error {
1190 parsed, err := c.global.Parse(cmdStorageVolumeGetUsage, cmd, args)

Callers 1

commandMethod · 0.95

Calls 4

GFunction · 0.92
cmpStoragePoolsMethod · 0.80
cmpStoragePoolVolumesMethod · 0.80

Tested by

no test coverage detected