Skip to content

cloud-server update: adopt sdk-go v1.0.6 delta setters for subnet/SG/EIP/volume changes #255

Description

@aru-amedeo

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions