gcp-projects

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2022-08-19 13:12:39 +02:00
parent 9a5a1681c1
commit 93b552b34c
6 changed files with 9 additions and 19 deletions
+2
View File
@@ -17,10 +17,12 @@
import { Project, Operation } from './types';
import { createApiRef } from '@backstage/core-plugin-api';
/** @public */
export const gcpApiRef = createApiRef<GcpApi>({
id: 'plugin.gcpprojects.service',
});
/** @public */
export type GcpApi = {
listProjects(): Promise<Project[]>;
getProject(projectId: string): Promise<Project>;
@@ -21,6 +21,7 @@ import { OAuthApi } from '@backstage/core-plugin-api';
const BASE_URL =
'https://content-cloudresourcemanager.googleapis.com/v1/projects';
/** @public */
export class GcpClient implements GcpApi {
constructor(private readonly googleAuthApi: OAuthApi) {}
+4
View File
@@ -14,6 +14,7 @@
* limitations under the License.
*/
/** @public */
export type Project = {
name: string;
projectNumber?: string;
@@ -22,10 +23,12 @@ export type Project = {
createTime?: string;
};
/** @public */
export type ProjectDetails = {
details: string;
};
/** @public */
export type Operation = {
name: string;
metadata: string;
@@ -34,6 +37,7 @@ export type Operation = {
response: string;
};
/** @public */
export type Status = {
code: number;
message: string;
+2
View File
@@ -23,6 +23,7 @@ import {
googleAuthApiRef,
} from '@backstage/core-plugin-api';
/** @public */
export const gcpProjectsPlugin = createPlugin({
id: 'gcp-projects',
routes: {
@@ -39,6 +40,7 @@ export const gcpProjectsPlugin = createPlugin({
],
});
/** @public */
export const GcpProjectsPage = gcpProjectsPlugin.provide(
createRoutableExtension({
name: 'GcpProjectsPage',