@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
92 lines • 3.83 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubAccount = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Allows creation and management of a Google Cloud Billing Subaccount.
*
* !> **WARNING:** Deleting this resource will not delete or close the billing subaccount.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const subaccount = new gcp.billing.SubAccount("subaccount", {
* displayName: "My Billing Account",
* masterBillingAccount: "012345-567890-ABCDEF",
* });
* ```
*
* ## Import
*
* Billing Subaccounts can be imported using any of these accepted formats:
*
* * `billingAccounts/{billing_account_id}`
*
* When using the `pulumi import` command, Billing Subaccounts can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:billing/subAccount:SubAccount default billingAccounts/{billing_account_id}
* ```
*/
class SubAccount extends pulumi.CustomResource {
/**
* Get an existing SubAccount 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 SubAccount(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of SubAccount. 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'] === SubAccount.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["billingAccountId"] = state?.billingAccountId;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["masterBillingAccount"] = state?.masterBillingAccount;
resourceInputs["name"] = state?.name;
resourceInputs["open"] = state?.open;
}
else {
const args = argsOrState;
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.masterBillingAccount === undefined && !opts.urn) {
throw new Error("Missing required property 'masterBillingAccount'");
}
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["masterBillingAccount"] = args?.masterBillingAccount;
resourceInputs["billingAccountId"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["open"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SubAccount.__pulumiType, name, resourceInputs, opts);
}
}
exports.SubAccount = SubAccount;
/** @internal */
SubAccount.__pulumiType = 'gcp:billing/subAccount:SubAccount';
//# sourceMappingURL=subAccount.js.map
;