salmon-beard-79336
07/17/2019, 2:29 PMexport interface CosmosContainerArgs {
region: pulumi.Input<string>;
endpoint: pulumi.Input<string>;
masterKey: pulumi.Input<string>;
client: any;
}
class MyResource extends pulumi.dynamic.Resource {
constructor(name: string, props: MyResourceInputs, opts?: pulumi.CustomResourceOptions) {
let region = args.region;
let endpoint = args.endpoint;
let masterKey = args.masterKey;
let connectionPolicy = new cosmos.ConnectionPolicy();
connectionPolicy.PreferredLocations = [args.region];
const client = new cosmos.CosmosClient({
endpoint,
auth: { masterKey },
connectionPolicy,
});
args.client = client;
super(myprovider, name, props, opts);
}
}
Trying to initialise a custom client in the resource constructor, so the I can pass it on to the provider to work with. What is the best way to approach this? The above fails because arg.region
returns Promise
Type 'Input<string>' is not assignable to type 'string'.
Type 'Promise<string>' is not assignable to type 'string'.
white-balloon-205
Input<string>
.salmon-beard-79336
07/17/2019, 6:42 PMconstructor
in the ResourceProvider
that deals with all the CRUD implementations, will mess with the arguments that’s receiving from what I’ve noticed. How do you suggest doing it? Any example I can have a look at?tall-librarian-49374
07/18/2019, 9:10 AMsalmon-beard-79336
07/25/2019, 2:00 PM