Skip to content

Conversation

@uzaxirr
Copy link
Contributor

@uzaxirr uzaxirr commented Apr 20, 2025

Introduce new commands to manage resource snapshots, including listing, showing details, updating, deleting, and restoring snapshots. This feature enhances the CLI's capabilities by allowing users to handle snapshots directly from the command line.

@uzaxirr uzaxirr requested a review from Copilot April 20, 2025 12:46
@uzaxirr uzaxirr self-assigned this Apr 20, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces new CLI commands to manage resource snapshots, allowing users to list, show, update, delete, and restore snapshots directly from the command line.

  • Added resource snapshot command registration in the CLI root.
  • Implemented separate commands for updating, showing, restoring, listing, and deleting snapshots.
  • Updated README documentation to include usage examples for the new feature.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/root.go Registers the resource snapshot command in the CLI.
cmd/resourcesnapshot/resourcesnapshot_update.go Implements update functionality for resource snapshots.
cmd/resourcesnapshot/resourcesnapshot_show.go Implements show functionality for resource snapshots.
cmd/resourcesnapshot/resourcesnapshot_restore.go Implements restore functionality and handles instance snapshots.
cmd/resourcesnapshot/resourcesnapshot_list.go Implements list functionality for resource snapshots.
cmd/resourcesnapshot/resourcesnapshot_delete.go Implements delete functionality for resource snapshots.
cmd/resourcesnapshot/resourcesnapshot.go Aggregates all resource snapshot commands.
README.md Documents resource snapshot commands and usage.

```sh
# List all resource snapshots
civo resource-snapshot list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have this command only called snapshots in the CLI?

We weren't able to do so in the API because of a conflict with volume snapshots that live under v2/snapshots, but maybe it's possible in the CLI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, we are going by resource level approach for the CLI so snapshots are managed within their respective resource

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's possible to call this command snapshots?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really, im considering resource snapshot as a completely different entity

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I keep not liking this UX of civo resource-snapshot ls. civo snapshots ls sounds so much better.

We had to name the API endpoints for some technical limitations, but these limitations are not present here in the CLI.

@uzaxirr uzaxirr requested review from fulviodenza and giornetta May 15, 2025 08:49
ow.AppendDataWithLabel("created_at", snapshot.CreatedAt.Format(time.RFC1123), "Created At")
}

switch common.OutputFormat {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't the "human" format here needed?

fulviodenza
fulviodenza previously approved these changes May 17, 2025
Copy link
Contributor

@fulviodenza fulviodenza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a NIT but LGTM to me

@fulviodenza
Copy link
Contributor

Let's also run a go mod tidy in the repo

Copy link
Member

@giornetta giornetta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor issues mainly in docs. CLI commands are working.

@uzaxirr uzaxirr merged commit acc29ff into master Jun 10, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants