Skip to content
This repository was archived by the owner on May 17, 2022. It is now read-only.
Open
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
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
"typescript": "3.0.x"
},
"dependencies": {
"@google-cloud/common": "^0.21.1",
"google-auth-library": "^1.5.0",
"googleapis": "^32.0.0",
"p-limit": "^2.0.0"
"p-limit": "^2.0.0",
"querystring": "^0.2.0"
},
"scripts": {
"check": "gts check",
Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
import * as assert from 'assert';
import {EventEmitter} from 'events';
import {clouddebugger_v2} from 'googleapis';
import {clouddebugger_v2, cloudprofiler_v2} from 'googleapis';
import * as util from 'util';
import {Wrapper} from './wrapper';
import pLimit = require('p-limit');
Expand Down Expand Up @@ -82,6 +82,8 @@ export type DebuggeesBreakpointsListRequest =
clouddebugger_v2.Params$Resource$Debugger$Debuggees$Breakpoints$List;
export type DebuggeesBreakpointsSetRequest =
clouddebugger_v2.Params$Resource$Debugger$Debuggees$Breakpoints$Set;
export type ProfilesCreateRequest =
cloudprofiler_v2.Params$Resource$Projects$Profiles$Create;

export interface DebuggeesListResponse {
data: clouddebugger_v2.Schema$ListDebuggeesResponse;
Expand Down
21 changes: 21 additions & 0 deletions src/wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as util from 'util';
import * as types from './index';

const cloudDebugger = google.clouddebugger('v2').debugger;
const cloudProfiler = google.cloudprofiler('v2').projects;

export class Wrapper {
private googleAuth = new GoogleAuth();
Expand Down Expand Up @@ -200,4 +201,24 @@ export class Wrapper {
}
return response.data.breakpoint;
}

async profilesCreate() {
if (!this.auth || !this.projectId) {
throw new Error('You must select a project before continuing.');
}
const request: types.ProfilesCreateRequest = {
parent: 'eyqs-stackdriver-test',
requestBody: {
deployment: {
labels: ['nodejs'],
projectId: this.projectId,
target: this.projectId,
},
profileType: [],
},
auth: this.auth,
};
const response = await cloudProfiler.profiles.create(request);
console.log(response);
}
}