Fix volume create cli bug

This passes the pointer to the concrete struct instead of a copy

Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
This commit is contained in:
Ulysses Souza 2020-10-20 19:23:54 +02:00
parent ed69f38b44
commit 29ba42bbc4
2 changed files with 4 additions and 4 deletions

View File

@ -79,8 +79,8 @@ type VolumeCreateOptions struct {
} }
func (cs *aciVolumeService) Create(ctx context.Context, name string, options interface{}) (volumes.Volume, error) { func (cs *aciVolumeService) Create(ctx context.Context, name string, options interface{}) (volumes.Volume, error) {
opts, ok := options.(VolumeCreateOptions) opts, ok := options.(*VolumeCreateOptions)
if !ok { if !ok || opts == nil {
return volumes.Volume{}, errors.New("could not read Azure VolumeCreateOptions struct from generic parameter") return volumes.Volume{}, errors.New("could not read Azure VolumeCreateOptions struct from generic parameter")
} }
w := progress.ContextWriter(ctx) w := progress.ContextWriter(ctx)

View File

@ -94,14 +94,14 @@ func createVolume(ctype string) *cobra.Command {
aciOpts := aci.VolumeCreateOptions{} aciOpts := aci.VolumeCreateOptions{}
cmd.Flags().StringVar(&aciOpts.Account, "storage-account", "", "Storage account name") cmd.Flags().StringVar(&aciOpts.Account, "storage-account", "", "Storage account name")
_ = cmd.MarkFlagRequired("storage-account") _ = cmd.MarkFlagRequired("storage-account")
opts = aciOpts opts = &aciOpts
case store.EcsContextType: case store.EcsContextType:
ecsOpts := ecs.VolumeCreateOptions{} ecsOpts := ecs.VolumeCreateOptions{}
cmd.Flags().StringVar(&ecsOpts.KmsKeyID, "kms-key", "", "ID of the AWS KMS CMK to be used to protect the encrypted file system") cmd.Flags().StringVar(&ecsOpts.KmsKeyID, "kms-key", "", "ID of the AWS KMS CMK to be used to protect the encrypted file system")
cmd.Flags().StringVar(&ecsOpts.PerformanceMode, "performance-mode", "", "performance mode of the file system. (generalPurpose|maxIO)") cmd.Flags().StringVar(&ecsOpts.PerformanceMode, "performance-mode", "", "performance mode of the file system. (generalPurpose|maxIO)")
cmd.Flags().Float64Var(&ecsOpts.ProvisionedThroughputInMibps, "provisioned-throughput", 0, "throughput in MiB/s (1-1024)") cmd.Flags().Float64Var(&ecsOpts.ProvisionedThroughputInMibps, "provisioned-throughput", 0, "throughput in MiB/s (1-1024)")
cmd.Flags().StringVar(&ecsOpts.ThroughputMode, "throughput-mode", "", "throughput mode (bursting|provisioned)") cmd.Flags().StringVar(&ecsOpts.ThroughputMode, "throughput-mode", "", "throughput mode (bursting|provisioned)")
opts = ecsOpts opts = &ecsOpts
} }
return cmd return cmd
} }