-
Notifications
You must be signed in to change notification settings - Fork 962
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Change name from stack to backend * Change name from stack to backend * changed file names * changed file names in experiments * changed name * lower case backend * Changed stack to backend * change stack to backend in index file * List stacks in table * Backends for project message * resolve merge conflicts * removed linter errors * changed table head color to green * test method stack to backend * Changed stack to backend (#6488) * Changed stack to backend * change stack to backend in index file * List stacks in table * Backends for project message * Changed file names * removed linter errors * change file names from stack to backend * changed table head color to green * test method stack to backend * changed file name
- Loading branch information
Showing
8 changed files
with
109 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Command } from "../command"; | ||
import { Options } from "../options"; | ||
import { needProjectId } from "../projectUtils"; | ||
import * as gcp from "../gcp/frameworks"; | ||
import { FirebaseError } from "../error"; | ||
import { logger } from "../logger"; | ||
const Table = require("cli-table"); | ||
|
||
export const command = new Command("backends:get") | ||
.description("Get backend details of a Firebase project") | ||
.option("-l, --location <location>", "App Backend location", "us-central1") | ||
.option("--s, --backendId <backendId>", "Backend Id", "") | ||
.action(async (options: Options) => { | ||
const projectId = needProjectId(options); | ||
const location = options.location as string; | ||
const backendId = options.backendId as string; | ||
if (!backendId) { | ||
throw new FirebaseError("Backend id can't be empty."); | ||
} | ||
|
||
let backend; | ||
try { | ||
backend = await gcp.getBackend(projectId, location, backendId); | ||
const table = new Table({ | ||
head: ["Backend Id", "Repository Name", "URL", "Location", "Created Date", "Updated Date"], | ||
style: { head: ["green"] }, | ||
}); | ||
table.push([ | ||
backend.name, | ||
backend.codebase.repository, | ||
backend.uri, | ||
backend.createTime, | ||
backend.updateTime, | ||
]); | ||
logger.info(table.toString()); | ||
} catch (err: any) { | ||
throw new FirebaseError( | ||
`Failed to get backend: ${backendId}. Please check the parameters you have provided.`, | ||
{ original: err } | ||
); | ||
} | ||
|
||
return backend; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Command } from "../command"; | ||
import { Options } from "../options"; | ||
import { needProjectId } from "../projectUtils"; | ||
import * as gcp from "../gcp/frameworks"; | ||
import { FirebaseError } from "../error"; | ||
import { logger } from "../logger"; | ||
import { bold } from "colorette"; | ||
const Table = require("cli-table"); | ||
|
||
export const command = new Command("backends:list") | ||
.description("List backends of a Firebase project.") | ||
.option("-l, --location <location>", "App Backend location", "us-central1") | ||
.action(async (options: Options) => { | ||
const projectId = needProjectId(options); | ||
const location = options.location as string; | ||
const table = new Table({ | ||
head: ["Backend Id", "Repository Name", "URL", "Location", "Created Date", "Updated Date"], | ||
style: { head: ["green"] }, | ||
}); | ||
|
||
let backendsList; | ||
try { | ||
backendsList = await gcp.listBackends(projectId, location); | ||
for (const backend of backendsList.backends) { | ||
const entry = [ | ||
backend.name, | ||
backend.codebase.repository, | ||
backend.uri, | ||
backend.createTime, | ||
backend.updateTime, | ||
]; | ||
table.push(entry); | ||
} | ||
logger.info(`Backends for project ${bold(projectId)}`); | ||
logger.info(table.toString()); | ||
} catch (err: any) { | ||
throw new FirebaseError( | ||
`Unable to list backends present in project: ${projectId}. Please check the parameters you have provided.`, | ||
{ original: err } | ||
); | ||
} | ||
|
||
return backendsList; | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters