Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.create = async (inputs: any) => {
return {
id: (currentID++).toString(),
outs: undefined,
};
};
}
}
class Component extends pulumi.ComponentResource {
constructor(name: string, parent?: pulumi.ComponentResource) {
super("component", name, {}, { parent: parent });
}
}
class Resource extends pulumi.dynamic.Resource {
constructor(name: string, parent?: pulumi.ComponentResource) {
super(Provider.instance, name, {}, { parent: parent });
}
}
// Just allocate a few resources and make sure their URNs are correct with respect to parents, etc. This
// should form a tree of roughly the following structure:
//
// A F
// / \ \
// B C G
// / \
// D E
//
// with the caveat, of course, that A and F will share a common parent, the implicit stack.
let a = new Component("a");
export class Provider implements pulumi.dynamic.ResourceProvider {
public static readonly instance = new Provider();
public readonly create: (inputs: any) => Promise;
constructor() {
this.create = async (inputs: any) => {
return {
id: (currentID++).toString(),
outs: undefined,
};
};
}
}
export class Resource extends pulumi.dynamic.Resource {
public readonly state?: any;
constructor(name: string, props: ResourceProps, opts?: pulumi.ResourceOptions) {
super(Provider.instance, name, props, opts);
this.state = props.state;
}
}
export interface ResourceProps {
state?: any; // arbitrary state bag that can be updated without replacing.
}
export class Provider implements pulumi.dynamic.ResourceProvider {
public static readonly instance = new Provider();
public readonly create: (inputs: any) => Promise;
constructor() {
this.create = async (inputs: any) => {
return {
id: (currentID++).toString(),
outs: undefined,
};
};
}
}
export class Resource extends pulumi.dynamic.Resource {
constructor(name: string, props: ResourceProps, opts?: pulumi.ResourceOptions) {
super(Provider.instance, name, props, opts);
}
}
export interface ResourceProps {
state?: any; // arbitrary state bag that can be updated without replacing.
}
}).promise();
if (resp && resp.FunctionError) {
throw new Error(
`Invoking sync function '${syncFunc}' failed [${resp.FunctionError}]: ${JSON.stringify(resp.Payload)}`);
}
} catch (err) {
// TODO[pulumi/pulumi#2721]: this can go away once diagnostics for dynamic providers is improved.
console.log(err);
throw err;
}
}
/**
* BucketDirectoryLambdaSyncer is the implementation of the "server-lambda" sync strategy.
*/
class BucketDirectoryLambdaSyncer extends pulumi.dynamic.Resource {
private static provider = {
create: async(inputs: any): Promise => {
await invokeLambdaSync(inputs, "Create");
return { id: uuid(), outs: inputs };
},
update: async(id: pulumi.ID, olds: any, news: any): Promise => {
if (olds.archiveEtag !== news.archiveEtag) {
await invokeLambdaSync(news, "Update");
}
return { outs: news };
},
delete: async(id: pulumi.ID, olds: any): Promise => {
await invokeLambdaSync(olds, "Delete");
},
};
currentOutputs.httpsEnabled = false;
return { outs: currentOutputs };
}
}
/**
* CDNCustomDomainResource is a resource that can be used to create
* custom domains against Azure CDN resources.
* The Azure CDN resource itself must exist in order to create a custom domain for it.
*
* Outputs from the dynamic resource provider must be declared in the dynamic resource itself
* as `public readonly` members with the type `Output`. These are automatically set by the dynamic
* provider engine. The names of these properties must match the names of the properties exactly as
* returned in the outputs of the dynamic resource provider functions.
*/
export class CDNCustomDomainResource extends pulumi.dynamic.Resource {
/**
* These are the same properties that were originally passed as inputs, but available as outputs
* for convenience. The names of these properties must match with `CustomDomainOptions`.
*/
public readonly resourceGroupName: pulumi.Output;
public readonly profileName: pulumi.Output;
public readonly endpointName: pulumi.Output;
public readonly customDomainHostName: pulumi.Output;
public readonly httpsEnabled: pulumi.Output;
// The following are properties set by the CDN rest client.
public readonly customHttpsProvisioningState: pulumi.Output;
public readonly customHttpsProvisioningSubstate: pulumi.Output;
public readonly provisioningState: pulumi.Output;
public readonly resourceState: pulumi.Output;
public readonly type: pulumi.Output;
// Extract the web endpoint and the hostname from the storage account
const endpoint = executeToJson(`az storage account show -n "${accountName}" --query "primaryEndpoints.web"`);
const hostName = url.parse(endpoint).hostname;
// Files for static websites should be stored in a special built-in container called '$web', see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-static-website
const webContainerName = "$web";
return {
id: `${accountName}StaticWebsite`,
outs: { endpoint, hostName, webContainerName },
};
}
}
export class StorageStaticWebsite extends pulumi.dynamic.Resource {
public readonly endpoint: pulumi.Output;
public readonly hostName: pulumi.Output;
public readonly webContainerName: pulumi.Output;
constructor(name: string, args: StorageStaticWebsiteArgs, opts?: pulumi.CustomResourceOptions) {
super(new StorageStaticWebsiteProvider(), name, { ...args, endpoint: undefined, hostName: undefined, webContainerName: undefined }, opts);
}
}
}
}
public async update(id: string, olds: any, news: any): Promise {
throw Error("this resource is replace-only and can't be updated");
}
public async read(id: pulumi.ID, props: any): Promise {
return {
id: id,
props: props,
}
}
}
export class Resource extends pulumi.dynamic.Resource {
public readonly state: pulumi.Output;
constructor(name: string, props: any, opts?: pulumi.ResourceOptions) {
super(Provider.instance, name, props, opts);
}
}
const simpleProvider: pulumi.dynamic.ResourceProvider = {
async create(inputs: any) {
return {
id: "0",
outs: { output: "a", output2: "b" },
};
},
};
interface SimpleArgs {
input: pulumi.Input;
optionalInput?: pulumi.Input;
}
class SimpleResource extends pulumi.dynamic.Resource {
output: pulumi.Output;
output2: pulumi.Output;
constructor(name, args: SimpleArgs, opts?: pulumi.CustomResourceOptions) {
super(simpleProvider, name, { ...args, output: undefined, output2: undefined }, opts);
}
}
class MyComponent extends pulumi.ComponentResource {
child: SimpleResource;
constructor(name: string, opts?: pulumi.ComponentResourceOptions) {
super("my:component:MyComponent", name, {}, opts);
this.child = new SimpleResource(`${name}-child`, { input: "hello" }, {
parent: this,
additionalSecretOutputs: ["output2"],
});
this.registerOutputs({});
}
}
public async update(id: string, olds: any, news: any): Promise {
throw Error("this resource is replace-only and can't be updated");
}
public async read(id: pulumi.ID, props: any): Promise {
return {
id: id,
props: props,
}
}
}
export class Resource extends pulumi.dynamic.Resource {
public readonly state: pulumi.Output;
constructor(name: string, props: any, opts?: pulumi.ResourceOptions) {
super(Provider.instance, name, props, opts);
}
}
}
return {
changes: false,
};
}
public async create(inputs: any): Promise {
return {
id: uuidv4(),
outs: inputs,
};
}
}
export class Resource extends pulumi.dynamic.Resource {
public uniqueKey?: pulumi.Output;
public state: pulumi.Output;
public noReplace?: pulumi.Output;
constructor(name: string, props: ResourceProps, opts?: pulumi.CustomResourceOptions) {
super(Provider.instance, name, props, opts);
}
}
export interface ResourceProps {
readonly uniqueKey?: pulumi.Input;
readonly state: pulumi.Input;
readonly noReplace?: pulumi.Input;
readonly noDBR?: pulumi.Input;
}