How do I access the arguments that `create` has in...
# typescript
s
How do I access the arguments that
create
has in the
delete
method as well?
Copy code
interface DynamicProviderInputs {
    region: string;
    endpoint: string;
    masterKey: string;
    collectionName: string;
    dbName: string;
    cosmosAccountName: string;
}


    public async create(inputs: DynamicProviderInputs): Promise<pulumi.dynamic.CreateResult> {
        console.log('create: getting the client')
        const client = await this.getCosmosContainerClient(inputs.region, inputs.endpoint, inputs.masterKey, inputs.dbName);


    public async delete(id: string, props: DynamicProviderOutputs): Promise<void> {
@tall-librarian-49374 any ideas? Got stuck with that
t
I suppose the idea is that you pass all required fields as outputs
s
DynamicProviderOutputs already extends DynamicProviderInputs
What else might be missing?
t
What is the problem then?
s
Props argument does not contain any of the parent arguments
Thus I cannot initialise the client because I’m missing mandatory details
t
Even though you set them in create result?
s
hmm.. not setting anything in
create
Copy code
public async create(inputs: DynamicProviderInputs): Promise<pulumi.dynamic.CreateResult> {
        console.log('create: getting the client')
        const client = await this.getCosmosContainerClient(inputs.region, inputs.endpoint, inputs.masterKey, inputs.dbName);

        console.log('create: creating the container')
        const response = await client.containers.createIfNotExists({ id: inputs.collectionName });
        const container = response.container;

        return {
            id: container.id
        };
    }
are you referring to
Copy code
const outs: DynamicProviderOutputs = {
            ...result,
            name: this.name,
            resourceGroupName: inputs.resourceGroupName,
            profileName: inputs.profileName,
            endpointName: inputs.endpointName,
            customDomainHostName: inputs.customDomainHostName,
            httpsEnabled: inputs.httpsEnabled,
        };
?
sorry for responding so slow
Discussed in a parallel thread: you might also need to do this: https://github.com/pulumi/examples/blob/master/azure-ts-static-website/staticWebsite.ts#L72