@@ -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) {}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user