Skip to content

Commit

Permalink
move deploy and login to spin cloud
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Fisher <matt.fisher@fermyon.com>
  • Loading branch information
bacongobbler committed Feb 14, 2023
1 parent 25d35a8 commit fd67c3d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 10 deletions.
14 changes: 9 additions & 5 deletions src/bin/spin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ use lazy_static::lazy_static;
use spin_cli::commands::{
bindle::BindleCommands,
build::BuildCommand,
cloud::CloudCommands,
deploy::DeployCommand,
external::execute_external_subcommand,
login::LoginCommand,
external::execute_external_subcommand,
new::{AddCommand, NewCommand},
plugins::PluginCommands,
registry::RegistryCommands,
Expand Down Expand Up @@ -52,11 +53,13 @@ enum SpinApp {
Up(UpCommand),
#[clap(subcommand)]
Bindle(BindleCommands),
#[clap(subcommand)]
Cloud(CloudCommands),
Deploy(DeployCommand),
Login(LoginCommand),
#[clap(subcommand, alias = "oci")]
Registry(RegistryCommands),
Deploy(DeployCommand),
Build(BuildCommand),
Login(LoginCommand),
#[clap(subcommand, alias = "plugin")]
Plugins(PluginCommands),
#[clap(subcommand, hide = true)]
Expand All @@ -82,13 +85,14 @@ impl SpinApp {
Self::New(cmd) => cmd.run().await,
Self::Add(cmd) => cmd.run().await,
Self::Bindle(cmd) => cmd.run().await,
Self::Registry(cmd) => cmd.run().await,
Self::Cloud(cmd) => cmd.run().await,
Self::Deploy(cmd) => cmd.run().await,
Self::Login(cmd) => cmd.run().await,
Self::Registry(cmd) => cmd.run().await,
Self::Build(cmd) => cmd.run().await,
Self::Trigger(TriggerCommands::Http(cmd)) => cmd.run().await,
Self::Trigger(TriggerCommands::Redis(cmd)) => cmd.run().await,
Self::Trigger(TriggerCommands::HelpArgsOnly(cmd)) => cmd.run().await,
Self::Login(cmd) => cmd.run().await,
Self::Plugins(cmd) => cmd.run().await,
Self::External(cmd) => execute_external_subcommand(cmd, SpinApp::command()).await,
}
Expand Down
8 changes: 5 additions & 3 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
pub mod bindle;
/// Commands for building Spin applications.
pub mod build;
/// Command for deploying a Spin app to Hippo
/// Commands for publishing applications to Fermyon Cloud.
pub mod cloud;
/// Package and upload an application to Fermyon Cloud.
pub mod deploy;
/// Log into Fermyon Cloud.
pub mod login;
/// Commands for external subcommands (i.e. plugins)
pub mod external;
// Command for logging into the server
pub mod login;
/// Command for creating a new application.
pub mod new;
/// Command for adding a plugin to Spin
Expand Down
24 changes: 24 additions & 0 deletions src/commands/cloud.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use clap::Subcommand;
use anyhow::Result;

use super::deploy::DeployCommand;
use super::login::LoginCommand;

/// Commands for publishing applications to Fermyon Cloud.
#[derive(Subcommand, Debug)]
pub enum CloudCommands {
/// Package and upload an application to Fermyon Cloud.
Deploy(DeployCommand),

/// Log into Fermyon Cloud.
Login(LoginCommand),
}

impl CloudCommands {
pub async fn run(self) -> Result<()> {
match self {
Self::Deploy(cmd) => cmd.run().await,
Self::Login(cmd) => cmd.run().await,
}
}
}
2 changes: 1 addition & 1 deletion src/commands/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const SPIN_DEPLOY_CHANNEL_NAME: &str = "spin-deploy";

const BINDLE_REGISTRY_URL_PATH: &str = "api/registry";

/// Package and upload Spin artifacts, notifying Hippo
/// Package and upload to Fermyon Cloud.
#[derive(Parser, Debug)]
#[clap(about = "Deploy a Spin application")]
pub struct DeployCommand {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const SPIN_CLIENT_ID: &str = "583e63e9-461f-4fbe-a246-23e0fb1cad10";

const DEFAULT_CLOUD_URL: &str = "https://cloud.fermyon.com/";

/// Log into the server
/// Log into Fermyon Cloud.
#[derive(Parser, Debug)]
#[clap(about = "Log into the server")]
pub struct LoginCommand {
Expand Down

0 comments on commit fd67c3d

Please sign in to comment.