Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Go] Readonly properties on PUT methods #1559

Closed
mcardosos opened this issue Nov 2, 2016 · 1 comment
Closed

[Go] Readonly properties on PUT methods #1559

mcardosos opened this issue Nov 2, 2016 · 1 comment
Labels
Go P1 - Required Required functionality - not blocking
Milestone

Comments

@mcardosos
Copy link
Contributor

mcardosos commented Nov 2, 2016

Currently, the Go SDK includes some parameter validation. If readonly parameters (like provisioning state) are passed, the function will return an error.
This is not as cool when you have lines like this, in which the same struct you got in a GET operation will be passed in a PUT operation (let's say I just want to update data disk size)...

	vm, err := vmClient.Get(resourceGroupName, vmName, compute.InstanceView)
        (*vm.Properties.StorageProfile.DataDisks)[index].DiskSizeGB = to.Int32Ptr(newSize)
	vm.Properties.ProvisioningState = nil
	vm.Properties.InstanceView = nil
	vm.Properties.VMID = nil
	_, err = vmClient.CreateOrUpdate(resourceGroupName, vmName, vm, nil)

Setting all these readonly parameters to nil looks horrible :(
Maybe it could be done inside the function (in this case CreateOrUpdate).
Thoughts? cc @jhendrixMSFT @vishrutshah

@mcardosos mcardosos added the Go label Nov 2, 2016
@vishrutshah vishrutshah added bug P1 - Required Required functionality - not blocking labels Nov 9, 2016
@vishrutshah vishrutshah added this to the Active milestone Nov 9, 2016
@mcardosos
Copy link
Contributor Author

Fixed in #1749

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Go P1 - Required Required functionality - not blocking
Projects
None yet
Development

No branches or pull requests

2 participants