fermyon / cloud-plugin

A Spin plugin for the Spin CLI for managing Spin apps in Fermyon Cloud.
https://developer.fermyon.com/cloud/
Apache License 2.0
8 stars 13 forks source link

Move some cloud functions to an extension #130

Closed itowlson closed 1 year ago

itowlson commented 1 year ago

This is a pure refactor - no behaviour changes. (Unless I messed up.)

While working on some reorganisation of the deploy module, I noticed we had some instance methods that didn't use self and in fact seemed more concerned with the CloudClient than with the DeployCommand. For me it felt more readable to pull them out as extension methods on the CloudClientInterface. (My main interest was in moving code out of DeployCommand, which could be done without traitifying. But this felt nicer.)

I also noticed that commands::get_app_id_cloud and DeployCommand::try_get_app_id_cloud did the same thing (modulo one anyhow::Context), so unified them.

I removed the _cloud suffixes which were inherited from earlier Spin code where they had to be distinguished from Platform (_hippo) versions of the operations. The suffix is no longer needed in the cloud-specific plugin. I also took the opportunity to change the argument order and make some strings into &str because reduced the need for repeated cloning.