This repository was archived by the owner on Apr 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathcommon.d.ts
112 lines (100 loc) · 3.17 KB
/
common.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* Copyright 2017 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import * as http from 'http';
/**
* Authentication Configuration – shared across all Google Cloud Libraries.
* For more details see {@link
* https://googlecloudplatform.github.io/google-cloud-node/#/docs/google-cloud/0.56.0/guides/authentication}
* and {@link
* https://developers.google.com/identity/protocols/application-default-credentials}.
*/
export interface AuthenticationConfig {
/**
* The projectId of the Google Cloud Platform project whose applications will
* be debugged. If not specified, we will try to use detect this through
* either the GCLOUD_PROJECT environment variable, through the embedded
* projectId in the provided key, the metadata service, or the default project
* configured in the gcloud cli. If none of these mechanisms are successful,
* the debug agent will fail to function.
*/
projectId?: string;
/**
* Path to a service account .json, .pem or .p12 key file.
*/
keyFilename?: string;
/**
* Required when using .p12 or pem key files.
*/
email?: string;
/**
* Instead of a keyFilename, credentials can also be provided inline.
*/
credentials?: {
client_email?: string;
private_key?: string;
client_id?: string;
client_secret?: string;
refresh_token?: string;
type?: string;
};
}
export interface ServiceConfig {
baseUrl: string;
scopes: string[];
}
// TODO: Make this more precise
export interface ServiceObjectConfig {
parent: any;
baseUrl: string;
createMethod?: string;
id?: string;
methods?: any;
}
export interface LoggerOptions {
level?: string;
levels?: string[];
tag: string;
}
export interface Logger {
new(options?: string|LoggerOptions): Logger;
LEVELS: string[];
// TODO: Determine the correct signatures for these members
error: (message: any, ...args: any[]) => void;
warn: (message: any, ...args: any[]) => void;
info: (message: any, ...args: any[]) => void;
debug: (message: any, ...args: any[]) => void;
}
export interface Service {
new(config: ServiceConfig, options: AuthenticationConfig): Service;
}
export interface ServiceObject {
new(config: ServiceObjectConfig): ServiceObject;
// TODO: Determine if this signature is correct.
request:
(reqOpts: {uri: string, json: boolean},
callback: (err: Error, body: any, response: http.ServerResponse) =>
void) => void;
}
export interface Common {
Service: Service;
ServiceObject: ServiceObject;
logger: Logger;
util: {
// TODO: Make this more precise.
normalizeArguments: (globalContext: any, localConfig: any, options?: any) =>
any;
};
}