Summary
sdk-go v1.0.6 changes how Cloud Server updates work. The single Update call now dispatches to the correct API endpoint(s) depending on what changed on the wrapper:
| What changed |
Endpoint called |
| name / tags |
PUT /cloudServers/:id |
| subnet delta |
POST .../associateDisassociateSubnets |
| security-group delta |
POST .../associateDisassociateSecurityGroups |
| elastic-IP delta |
POST .../associateDisassociateElasticIPs |
| data-volume delta |
POST .../attachDetachDataVolumes |
Previously, update cloud-server only updated name/tags via PUT. Subnet, security-group, elastic-IP and data-volume changes were silently dropped.
Required changes in acloud-cli
For each attribute a user can change via the CLI update command, pass the correct delta to the SDK:
// Subnets
if subnetsChanged {
cs.AssociateSubnets(subnetsToAdd...).DisassociateSubnets(subnetsToRemove...)
}
// Security groups
if sgsChanged {
cs.AssociateSecurityGroups(sgsToAdd...).DisassociateSecurityGroups(sgsToRemove...)
}
// Elastic IPs
if eipsChanged {
cs.AssociateElasticIPs(eipsToAdd...).DisassociateElasticIPs(eipsToRemove...)
}
// Data volumes
if volsChanged {
cs.AttachDataVolumes(volsToAdd...).DetachDataVolumes(volsToRemove...)
}
// One Update call handles everything
client.FromCompute().CloudServers().Update(ctx, cs)
Password change continues to use cs.SetPassword(ctx, newPassword) — no change there.
Note: the CLI is responsible for computing what was added vs removed (e.g., by comparing the flag values with the current server state from a prior Get).
References
Summary
sdk-go v1.0.6 changes how Cloud Server updates work. The single
Updatecall now dispatches to the correct API endpoint(s) depending on what changed on the wrapper:PUT /cloudServers/:idPOST .../associateDisassociateSubnetsPOST .../associateDisassociateSecurityGroupsPOST .../associateDisassociateElasticIPsPOST .../attachDetachDataVolumesPreviously,
update cloud-serveronly updated name/tags via PUT. Subnet, security-group, elastic-IP and data-volume changes were silently dropped.Required changes in acloud-cli
For each attribute a user can change via the CLI update command, pass the correct delta to the SDK:
Password change continues to use
cs.SetPassword(ctx, newPassword)— no change there.Note: the CLI is responsible for computing what was added vs removed (e.g., by comparing the flag values with the current server state from a prior
Get).References