-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovider.ts
43 lines (33 loc) · 1.19 KB
/
provider.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
import { ProviderResource, ResourceOptions, Config, Inputs, Output, Input } from '@pulumi/pulumi';
export class Provider extends ProviderResource {
static readonly __pulumiType = 'buddy';
readonly apiUrl!: Output<string>;
readonly workspace!: Output<string>;
readonly token!: Output<string>;
static isInstance(obj: any): obj is Provider {
if (obj == null) {
return false;
}
return obj['__pulumiType'] === Provider.__pulumiType;
}
constructor(name: string, args?: ProviderArgs, opts?: ResourceOptions) {
if (!opts) {
opts = {};
}
if (!opts.version) {
opts.version = require('./package').version;
}
const config = new Config('buddy');
const inputs: Inputs = {
apiUrl: args?.apiUrl ?? config.get('apiUrl')?.replace(/\/?/, ''),
workspace: args?.workspace ?? config.require('workspace'),
token: args?.token ?? config.requireSecret('token')
};
super(Provider.__pulumiType, name, inputs, opts);
}
}
export interface ProviderArgs {
apiUrl?: Input<string>;
workspace?: Input<string>;
token?: Input<string>;
}