pulumi-stripe
Version:
A Pulumi package for creating and managing Stripe resources.
113 lines • 5.06 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.File = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("./utilities");
/**
* This object represents files hosted on Stripe's servers - [Stripe API file documentation](https://stripe.com/docs/api/files).
* You can upload files with the create file request (for example, when uploading dispute evidence).
*
* Stripe File upload [guide](https://stripe.com/docs/file-upload#uploading-a-file)
*
* > Update or removal of the file isn't supported through the Stripe SDK.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as fs from "fs";
* import * as stripe from "pulumi-stripe";
*
* // minimal file field
* const logoFile = new stripe.File("logoFile", {
* filename: "logo.jpg",
* purpose: "business_logo",
* base64content: fs.readFileSync(`${HOME}/logo.jpg`, { encoding: "base64" }),
* });
* // file with file link
* const logoIndex_fileFile = new stripe.File("logoIndex/fileFile", {
* filename: "logo.jpg",
* purpose: "business_logo",
* base64content: fs.readFileSync(`${HOME}/logo.jpg`, { encoding: "base64" }),
* linkData: {
* create: true,
* expiresAt: 1826659124,
* },
* });
* ```
* <!--End PulumiCodeChooser -->
*/
class File extends pulumi.CustomResource {
/**
* Get an existing File resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new File(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of File. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === File.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["base64content"] = state ? state.base64content : undefined;
resourceInputs["created"] = state ? state.created : undefined;
resourceInputs["expiresAt"] = state ? state.expiresAt : undefined;
resourceInputs["filename"] = state ? state.filename : undefined;
resourceInputs["linkData"] = state ? state.linkData : undefined;
resourceInputs["links"] = state ? state.links : undefined;
resourceInputs["object"] = state ? state.object : undefined;
resourceInputs["purpose"] = state ? state.purpose : undefined;
resourceInputs["size"] = state ? state.size : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["url"] = state ? state.url : undefined;
}
else {
const args = argsOrState;
if ((!args || args.base64content === undefined) && !opts.urn) {
throw new Error("Missing required property 'base64content'");
}
if ((!args || args.filename === undefined) && !opts.urn) {
throw new Error("Missing required property 'filename'");
}
if ((!args || args.purpose === undefined) && !opts.urn) {
throw new Error("Missing required property 'purpose'");
}
resourceInputs["base64content"] = args ? args.base64content : undefined;
resourceInputs["filename"] = args ? args.filename : undefined;
resourceInputs["linkData"] = args ? args.linkData : undefined;
resourceInputs["purpose"] = args ? args.purpose : undefined;
resourceInputs["created"] = undefined /*out*/;
resourceInputs["expiresAt"] = undefined /*out*/;
resourceInputs["links"] = undefined /*out*/;
resourceInputs["object"] = undefined /*out*/;
resourceInputs["size"] = undefined /*out*/;
resourceInputs["type"] = undefined /*out*/;
resourceInputs["url"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(File.__pulumiType, name, resourceInputs, opts);
}
}
exports.File = File;
/** @internal */
File.__pulumiType = 'stripe:index/file:File';
//# sourceMappingURL=file.js.map