Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { needProjectId } from "../projectUtils";
import requireInteractive from "../requireInteractive";
import { doSetup } from "../init/features/frameworks";

export const command = new Command("stacks:create")
.description("Create a stack in a Firebase project")
export const command = new Command("backends:create")
.description("Create a backend in a Firebase project")
.before(requireInteractive)
.action(async (options: Options) => {
const projectId = needProjectId(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ import * as gcp from "../gcp/frameworks";
import { promptOnce } from "../prompt";
import * as utils from "../utils";

export const command = new Command("stacks:delete")
.description("Delete a stack from a Firebase project")
export const command = new Command("backends:delete")
.description("Delete a backend from a Firebase project")
.option("-l, --location <location>", "App Backend location", "us-central1")
.option("-s, --stackId <stackId>", "Stack Id", "")
.option("-s, --backendId <backendId>", "Backend Id", "")
.withForce()
.action(async (options: Options) => {
const projectId = needProjectId(options);
const location = options.location as string;
const stackId = options.stackId as string;
if (!stackId) {
throw new FirebaseError("Stack id can't be empty.");
const backendId = options.backendId as string;
if (!backendId) {
throw new FirebaseError("Backend id can't be empty.");
}
const confirmDeletion = await promptOnce(
{
type: "confirm",
name: "force",
default: false,
message: "You are about to delete the Stack with id: " + stackId + "\n Are you sure?",
message: "You are about to delete the backend with id: " + backendId + "\n Are you sure?",
},
options
);
Expand All @@ -32,11 +32,11 @@ export const command = new Command("stacks:delete")
}

try {
await gcp.deleteStack(projectId, location, stackId);
utils.logSuccess(`Successfully deleted the stack: ${stackId}`);
await gcp.deleteBackend(projectId, location, backendId);
utils.logSuccess(`Successfully deleted the backend: ${backendId}`);
} catch (err: any) {
throw new FirebaseError(
`Failed to delete stack: ${stackId}. Please check the parameters you have provided.`,
`Failed to delete backend: ${backendId}. Please check the parameters you have provided.`,
{ original: err }
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ export function load(client: any): any {
client.frameworks = {};
client.frameworks.stacks = {};
client.frameworks.stacks.list = loadCommand("frameworks-stacks-list");
client.frameworks.stacks.create = loadCommand("frameworks-stacks-create");
client.frameworks.stacks.create = loadCommand("frameworks-backends-create");
client.frameworks.stacks.create = loadCommand("frameworks-stacks-get");
client.frameworks.stacks.create = loadCommand("frameworks-stacks-delete");
client.frameworks.stacks.create = loadCommand("frameworks-backends-delete");
}
client.login = loadCommand("login");
client.login.add = loadCommand("login-add");
Expand Down
8 changes: 4 additions & 4 deletions src/gcp/frameworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ export async function listStack(projectId: string, location: string): Promise<Li
}

/**
* Deletes a Stack with stackId in a given project and location.
* Deletes a backend with backendId in a given project and location.
*/
export async function deleteStack(
export async function deleteBackend(
projectId: string,
location: string,
stackId: string
backendId: string
): Promise<Operation> {
const name = `projects/${projectId}/locations/${location}/backends/${stackId}`;
const name = `projects/${projectId}/locations/${location}/backends/${backendId}`;
const res = await client.delete<Operation>(name);

return res.body;
Expand Down