@maxim_mazurok/gapi.client.cloudprofiler-v2 0.0.20220808
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +263 -0
- package/package.json +20 -0
- package/readme.md +74 -0
- package/tests.ts +99 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Stackdriver Profiler API v2 0.0 */
|
|
2
|
+
// Project: https://cloud.google.com/profiler/
|
|
3
|
+
// Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
|
|
4
|
+
// Nick Amoscato <https://github.com/namoscato>
|
|
5
|
+
// Declan Vong <https://github.com/declanvong>
|
|
6
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
7
|
+
// TypeScript Version: 2.8
|
|
8
|
+
|
|
9
|
+
// IMPORTANT
|
|
10
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
11
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
12
|
+
// Generated from: https://cloudprofiler.googleapis.com/$discovery/rest?version=v2
|
|
13
|
+
// Revision: 20220808
|
|
14
|
+
|
|
15
|
+
/// <reference types="gapi.client" />
|
|
16
|
+
|
|
17
|
+
declare namespace gapi.client {
|
|
18
|
+
/** Load Stackdriver Profiler API v2 */
|
|
19
|
+
function load(urlOrObject: "https://cloudprofiler.googleapis.com/$discovery/rest?version=v2"): Promise<void>;
|
|
20
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
21
|
+
function load(name: "cloudprofiler", version: "v2"): Promise<void>;
|
|
22
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
23
|
+
function load(name: "cloudprofiler", version: "v2", callback: () => any): void;
|
|
24
|
+
|
|
25
|
+
namespace cloudprofiler {
|
|
26
|
+
interface CreateProfileRequest {
|
|
27
|
+
/** Required. Deployment details. */
|
|
28
|
+
deployment?: Deployment;
|
|
29
|
+
/** Required. One or more profile types that the agent is capable of providing. */
|
|
30
|
+
profileType?: string[];
|
|
31
|
+
}
|
|
32
|
+
interface Deployment {
|
|
33
|
+
/**
|
|
34
|
+
* Labels identify the deployment within the user universe and same target. Validation regex for label names: `^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$`. Value for an individual label must
|
|
35
|
+
* be <= 512 bytes, the total size of all label names and values must be <= 1024 bytes. Label named "language" can be used to record the programming language of the profiled
|
|
36
|
+
* deployment. The standard choices for the value include "java", "go", "python", "ruby", "nodejs", "php", "dotnet". For deployments running on Google Cloud Platform, "zone" or
|
|
37
|
+
* "region" label should be present describing the deployment location. An example of a zone is "us-central1-a", an example of a region is "us-central1" or "us-central".
|
|
38
|
+
*/
|
|
39
|
+
labels?: { [P in string]: string };
|
|
40
|
+
/** Project ID is the ID of a cloud project. Validation regex: `^a-z{4,61}[a-z0-9]$`. */
|
|
41
|
+
projectId?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Target is the service name used to group related deployments: * Service name for App Engine Flex / Standard. * Cluster and container name for GKE. * User-specified string for direct
|
|
44
|
+
* Compute Engine profiling (e.g. Java). * Job name for Dataflow. Validation regex: `^[a-z0-9]([-a-z0-9_.]{0,253}[a-z0-9])?$`.
|
|
45
|
+
*/
|
|
46
|
+
target?: string;
|
|
47
|
+
}
|
|
48
|
+
interface Profile {
|
|
49
|
+
/** Deployment this profile corresponds to. */
|
|
50
|
+
deployment?: Deployment;
|
|
51
|
+
/**
|
|
52
|
+
* Duration of the profiling session. Input (for the offline mode) or output (for the online mode). The field represents requested profiling duration. It may slightly differ from the
|
|
53
|
+
* effective profiling duration, which is recorded in the profile data, in case the profiling can't be stopped immediately (e.g. in case stopping the profiling is handled
|
|
54
|
+
* asynchronously).
|
|
55
|
+
*/
|
|
56
|
+
duration?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Input only. Labels associated to this specific profile. These labels will get merged with the deployment labels for the final data set. See documentation on deployment labels for
|
|
59
|
+
* validation rules and limits.
|
|
60
|
+
*/
|
|
61
|
+
labels?: { [P in string]: string };
|
|
62
|
+
/** Output only. Opaque, server-assigned, unique ID for this profile. */
|
|
63
|
+
name?: string;
|
|
64
|
+
/** Input only. Profile bytes, as a gzip compressed serialized proto, the format is https://github.com/google/pprof/blob/master/proto/profile.proto. */
|
|
65
|
+
profileBytes?: string;
|
|
66
|
+
/** Type of profile. For offline mode, this must be specified when creating the profile. For online mode it is assigned and returned by the server. */
|
|
67
|
+
profileType?: string;
|
|
68
|
+
}
|
|
69
|
+
interface ProfilesResource {
|
|
70
|
+
/**
|
|
71
|
+
* CreateProfile creates a new profile resource in the online mode. The server ensures that the new profiles are created at a constant rate per deployment, so the creation request may
|
|
72
|
+
* hang for some time until the next profile session is available. The request may fail with ABORTED error if the creation is not available within ~1m, the response will indicate the
|
|
73
|
+
* duration of the backoff the client should take before attempting creating a profile again. The backoff duration is returned in google.rpc.RetryInfo extension on the response status.
|
|
74
|
+
* To a gRPC client, the extension will be return as a binary-serialized proto in the trailing metadata item named "google.rpc.retryinfo-bin".
|
|
75
|
+
*/
|
|
76
|
+
create(request: {
|
|
77
|
+
/** V1 error format. */
|
|
78
|
+
"$.xgafv"?: string;
|
|
79
|
+
/** OAuth access token. */
|
|
80
|
+
access_token?: string;
|
|
81
|
+
/** Data format for response. */
|
|
82
|
+
alt?: string;
|
|
83
|
+
/** JSONP */
|
|
84
|
+
callback?: string;
|
|
85
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
86
|
+
fields?: string;
|
|
87
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
88
|
+
key?: string;
|
|
89
|
+
/** OAuth 2.0 token for the current user. */
|
|
90
|
+
oauth_token?: string;
|
|
91
|
+
/** Parent project to create the profile in. */
|
|
92
|
+
parent: string;
|
|
93
|
+
/** Returns response with indentations and line breaks. */
|
|
94
|
+
prettyPrint?: boolean;
|
|
95
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
96
|
+
quotaUser?: string;
|
|
97
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
98
|
+
upload_protocol?: string;
|
|
99
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
100
|
+
uploadType?: string;
|
|
101
|
+
/** Request body */
|
|
102
|
+
resource: CreateProfileRequest;
|
|
103
|
+
}): Request<Profile>;
|
|
104
|
+
create(request: {
|
|
105
|
+
/** V1 error format. */
|
|
106
|
+
"$.xgafv"?: string;
|
|
107
|
+
/** OAuth access token. */
|
|
108
|
+
access_token?: string;
|
|
109
|
+
/** Data format for response. */
|
|
110
|
+
alt?: string;
|
|
111
|
+
/** JSONP */
|
|
112
|
+
callback?: string;
|
|
113
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
114
|
+
fields?: string;
|
|
115
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
116
|
+
key?: string;
|
|
117
|
+
/** OAuth 2.0 token for the current user. */
|
|
118
|
+
oauth_token?: string;
|
|
119
|
+
/** Parent project to create the profile in. */
|
|
120
|
+
parent: string;
|
|
121
|
+
/** Returns response with indentations and line breaks. */
|
|
122
|
+
prettyPrint?: boolean;
|
|
123
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
124
|
+
quotaUser?: string;
|
|
125
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
126
|
+
upload_protocol?: string;
|
|
127
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
128
|
+
uploadType?: string;
|
|
129
|
+
},
|
|
130
|
+
body: CreateProfileRequest): Request<Profile>;
|
|
131
|
+
/** CreateOfflineProfile creates a new profile resource in the offline mode. The client provides the profile to create along with the profile bytes, the server records it. */
|
|
132
|
+
createOffline(request: {
|
|
133
|
+
/** V1 error format. */
|
|
134
|
+
"$.xgafv"?: string;
|
|
135
|
+
/** OAuth access token. */
|
|
136
|
+
access_token?: string;
|
|
137
|
+
/** Data format for response. */
|
|
138
|
+
alt?: string;
|
|
139
|
+
/** JSONP */
|
|
140
|
+
callback?: string;
|
|
141
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
142
|
+
fields?: string;
|
|
143
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
144
|
+
key?: string;
|
|
145
|
+
/** OAuth 2.0 token for the current user. */
|
|
146
|
+
oauth_token?: string;
|
|
147
|
+
/** Parent project to create the profile in. */
|
|
148
|
+
parent: string;
|
|
149
|
+
/** Returns response with indentations and line breaks. */
|
|
150
|
+
prettyPrint?: boolean;
|
|
151
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
152
|
+
quotaUser?: string;
|
|
153
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
154
|
+
upload_protocol?: string;
|
|
155
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
156
|
+
uploadType?: string;
|
|
157
|
+
/** Request body */
|
|
158
|
+
resource: Profile;
|
|
159
|
+
}): Request<Profile>;
|
|
160
|
+
createOffline(request: {
|
|
161
|
+
/** V1 error format. */
|
|
162
|
+
"$.xgafv"?: string;
|
|
163
|
+
/** OAuth access token. */
|
|
164
|
+
access_token?: string;
|
|
165
|
+
/** Data format for response. */
|
|
166
|
+
alt?: string;
|
|
167
|
+
/** JSONP */
|
|
168
|
+
callback?: string;
|
|
169
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
170
|
+
fields?: string;
|
|
171
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
172
|
+
key?: string;
|
|
173
|
+
/** OAuth 2.0 token for the current user. */
|
|
174
|
+
oauth_token?: string;
|
|
175
|
+
/** Parent project to create the profile in. */
|
|
176
|
+
parent: string;
|
|
177
|
+
/** Returns response with indentations and line breaks. */
|
|
178
|
+
prettyPrint?: boolean;
|
|
179
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
180
|
+
quotaUser?: string;
|
|
181
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
182
|
+
upload_protocol?: string;
|
|
183
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
184
|
+
uploadType?: string;
|
|
185
|
+
},
|
|
186
|
+
body: Profile): Request<Profile>;
|
|
187
|
+
/**
|
|
188
|
+
* UpdateProfile updates the profile bytes and labels on the profile resource created in the online mode. Updating the bytes for profiles created in the offline mode is currently not
|
|
189
|
+
* supported: the profile content must be provided at the time of the profile creation.
|
|
190
|
+
*/
|
|
191
|
+
patch(request: {
|
|
192
|
+
/** V1 error format. */
|
|
193
|
+
"$.xgafv"?: string;
|
|
194
|
+
/** OAuth access token. */
|
|
195
|
+
access_token?: string;
|
|
196
|
+
/** Data format for response. */
|
|
197
|
+
alt?: string;
|
|
198
|
+
/** JSONP */
|
|
199
|
+
callback?: string;
|
|
200
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
201
|
+
fields?: string;
|
|
202
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
203
|
+
key?: string;
|
|
204
|
+
/** Output only. Opaque, server-assigned, unique ID for this profile. */
|
|
205
|
+
name: string;
|
|
206
|
+
/** OAuth 2.0 token for the current user. */
|
|
207
|
+
oauth_token?: string;
|
|
208
|
+
/** Returns response with indentations and line breaks. */
|
|
209
|
+
prettyPrint?: boolean;
|
|
210
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
211
|
+
quotaUser?: string;
|
|
212
|
+
/**
|
|
213
|
+
* Field mask used to specify the fields to be overwritten. Currently only profile_bytes and labels fields are supported by UpdateProfile, so only those fields can be specified in
|
|
214
|
+
* the mask. When no mask is provided, all fields are overwritten.
|
|
215
|
+
*/
|
|
216
|
+
updateMask?: string;
|
|
217
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
218
|
+
upload_protocol?: string;
|
|
219
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
220
|
+
uploadType?: string;
|
|
221
|
+
/** Request body */
|
|
222
|
+
resource: Profile;
|
|
223
|
+
}): Request<Profile>;
|
|
224
|
+
patch(request: {
|
|
225
|
+
/** V1 error format. */
|
|
226
|
+
"$.xgafv"?: string;
|
|
227
|
+
/** OAuth access token. */
|
|
228
|
+
access_token?: string;
|
|
229
|
+
/** Data format for response. */
|
|
230
|
+
alt?: string;
|
|
231
|
+
/** JSONP */
|
|
232
|
+
callback?: string;
|
|
233
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
234
|
+
fields?: string;
|
|
235
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
236
|
+
key?: string;
|
|
237
|
+
/** Output only. Opaque, server-assigned, unique ID for this profile. */
|
|
238
|
+
name: string;
|
|
239
|
+
/** OAuth 2.0 token for the current user. */
|
|
240
|
+
oauth_token?: string;
|
|
241
|
+
/** Returns response with indentations and line breaks. */
|
|
242
|
+
prettyPrint?: boolean;
|
|
243
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
244
|
+
quotaUser?: string;
|
|
245
|
+
/**
|
|
246
|
+
* Field mask used to specify the fields to be overwritten. Currently only profile_bytes and labels fields are supported by UpdateProfile, so only those fields can be specified in
|
|
247
|
+
* the mask. When no mask is provided, all fields are overwritten.
|
|
248
|
+
*/
|
|
249
|
+
updateMask?: string;
|
|
250
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
251
|
+
upload_protocol?: string;
|
|
252
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
253
|
+
uploadType?: string;
|
|
254
|
+
},
|
|
255
|
+
body: Profile): Request<Profile>;
|
|
256
|
+
}
|
|
257
|
+
interface ProjectsResource {
|
|
258
|
+
profiles: ProfilesResource;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
const projects: ProjectsResource;
|
|
262
|
+
}
|
|
263
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.cloudprofiler-v2",
|
|
3
|
+
"version": "0.0.20220808",
|
|
4
|
+
"description": "TypeScript typings for Stackdriver Profiler API v2",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"email": "maxim@mazurok.com",
|
|
8
|
+
"name": "Maxim Mazurok",
|
|
9
|
+
"url": "https://maxim.mazurok.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
14
|
+
},
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/gapi.client": "*",
|
|
18
|
+
"@types/gapi.client.discovery": "*"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# TypeScript typings for Stackdriver Profiler API v2
|
|
2
|
+
|
|
3
|
+
Manages continuous profiling information.
|
|
4
|
+
For detailed description please check [documentation](https://cloud.google.com/profiler/).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Stackdriver Profiler API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.cloudprofiler-v2 --save-dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
You need to initialize Google API client in your code:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
gapi.load('client', () => {
|
|
20
|
+
// now we can use gapi.client
|
|
21
|
+
// ...
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then load api client wrapper:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
gapi.client.load('https://cloudprofiler.googleapis.com/$discovery/rest?version=v2', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.cloudprofiler
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
|
|
36
|
+
gapi.client.load('cloudprofiler', 'v2', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.cloudprofiler
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Don't forget to authenticate your client before sending any request to resources:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// declare client_id registered in Google Developers Console
|
|
46
|
+
var client_id = '',
|
|
47
|
+
scope = [
|
|
48
|
+
// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
|
|
49
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
50
|
+
|
|
51
|
+
// View and write monitoring data for all of your Google and third-party Cloud and API projects
|
|
52
|
+
'https://www.googleapis.com/auth/monitoring',
|
|
53
|
+
|
|
54
|
+
// Publish metric data to your Google Cloud projects
|
|
55
|
+
'https://www.googleapis.com/auth/monitoring.write',
|
|
56
|
+
],
|
|
57
|
+
immediate = true;
|
|
58
|
+
// ...
|
|
59
|
+
|
|
60
|
+
gapi.auth.authorize(
|
|
61
|
+
{ client_id: client_id, scope: scope, immediate: immediate },
|
|
62
|
+
authResult => {
|
|
63
|
+
if (authResult && !authResult.error) {
|
|
64
|
+
/* handle successful authorization */
|
|
65
|
+
} else {
|
|
66
|
+
/* handle authorization error */
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
After that you can use Stackdriver Profiler API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.cloudprofiler-v2 definition tests */
|
|
2
|
+
// IMPORTANT
|
|
3
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
4
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
5
|
+
|
|
6
|
+
// Revision: 20220808
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://cloudprofiler.googleapis.com/$discovery/rest?version=v2');
|
|
12
|
+
/** now we can use gapi.client.cloudprofiler */
|
|
13
|
+
|
|
14
|
+
/** don't forget to authenticate your client before sending any request to resources: */
|
|
15
|
+
/** declare client_id registered in Google Developers Console */
|
|
16
|
+
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
|
|
17
|
+
const scope = [
|
|
18
|
+
/** See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account. */
|
|
19
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
20
|
+
/** View and write monitoring data for all of your Google and third-party Cloud and API projects */
|
|
21
|
+
'https://www.googleapis.com/auth/monitoring',
|
|
22
|
+
/** Publish metric data to your Google Cloud projects */
|
|
23
|
+
'https://www.googleapis.com/auth/monitoring.write',
|
|
24
|
+
];
|
|
25
|
+
const immediate = false;
|
|
26
|
+
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
|
|
27
|
+
if (authResult && !authResult.error) {
|
|
28
|
+
/** handle successful authorization */
|
|
29
|
+
run();
|
|
30
|
+
} else {
|
|
31
|
+
/** handle authorization error */
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
async function run() {
|
|
36
|
+
/**
|
|
37
|
+
* CreateProfile creates a new profile resource in the online mode. The server ensures that the new profiles are created at a constant rate per deployment, so the creation request may hang
|
|
38
|
+
* for some time until the next profile session is available. The request may fail with ABORTED error if the creation is not available within ~1m, the response will indicate the duration
|
|
39
|
+
* of the backoff the client should take before attempting creating a profile again. The backoff duration is returned in google.rpc.RetryInfo extension on the response status. To a gRPC
|
|
40
|
+
* client, the extension will be return as a binary-serialized proto in the trailing metadata item named "google.rpc.retryinfo-bin".
|
|
41
|
+
*/
|
|
42
|
+
await gapi.client.cloudprofiler.projects.profiles.create({
|
|
43
|
+
parent: "Test string",
|
|
44
|
+
}, {
|
|
45
|
+
deployment: {
|
|
46
|
+
labels: {
|
|
47
|
+
A: "Test string"
|
|
48
|
+
},
|
|
49
|
+
projectId: "Test string",
|
|
50
|
+
target: "Test string",
|
|
51
|
+
},
|
|
52
|
+
profileType: [
|
|
53
|
+
"Test string"
|
|
54
|
+
],
|
|
55
|
+
});
|
|
56
|
+
/** CreateOfflineProfile creates a new profile resource in the offline mode. The client provides the profile to create along with the profile bytes, the server records it. */
|
|
57
|
+
await gapi.client.cloudprofiler.projects.profiles.createOffline({
|
|
58
|
+
parent: "Test string",
|
|
59
|
+
}, {
|
|
60
|
+
deployment: {
|
|
61
|
+
labels: {
|
|
62
|
+
A: "Test string"
|
|
63
|
+
},
|
|
64
|
+
projectId: "Test string",
|
|
65
|
+
target: "Test string",
|
|
66
|
+
},
|
|
67
|
+
duration: "Test string",
|
|
68
|
+
labels: {
|
|
69
|
+
A: "Test string"
|
|
70
|
+
},
|
|
71
|
+
name: "Test string",
|
|
72
|
+
profileBytes: "Test string",
|
|
73
|
+
profileType: "Test string",
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* UpdateProfile updates the profile bytes and labels on the profile resource created in the online mode. Updating the bytes for profiles created in the offline mode is currently not
|
|
77
|
+
* supported: the profile content must be provided at the time of the profile creation.
|
|
78
|
+
*/
|
|
79
|
+
await gapi.client.cloudprofiler.projects.profiles.patch({
|
|
80
|
+
name: "Test string",
|
|
81
|
+
updateMask: "Test string",
|
|
82
|
+
}, {
|
|
83
|
+
deployment: {
|
|
84
|
+
labels: {
|
|
85
|
+
A: "Test string"
|
|
86
|
+
},
|
|
87
|
+
projectId: "Test string",
|
|
88
|
+
target: "Test string",
|
|
89
|
+
},
|
|
90
|
+
duration: "Test string",
|
|
91
|
+
labels: {
|
|
92
|
+
A: "Test string"
|
|
93
|
+
},
|
|
94
|
+
name: "Test string",
|
|
95
|
+
profileBytes: "Test string",
|
|
96
|
+
profileType: "Test string",
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": ["es6", "dom"],
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noImplicitThis": true,
|
|
7
|
+
"strictNullChecks": true,
|
|
8
|
+
"baseUrl": "../",
|
|
9
|
+
"typeRoots": [
|
|
10
|
+
"../"
|
|
11
|
+
],
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"strictFunctionTypes": true
|
|
16
|
+
},
|
|
17
|
+
"files": ["index.d.ts", "tests.ts"]
|
|
18
|
+
}
|