"use strict";
// *** 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.UnitOperation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
 * A UnitOperation encapsulates the intent to change or interact with a Unit. Operations such as provisioning, upgrading, or deprovisioning a Unit are triggered by creating a UnitOperation resource.
 *
 * ## Example Usage
 *
 * ### Saas Runtime Unit Operation Basic
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 *
 * const location = "us-east1";
 * const tenantProjectId = "tenant";
 * const exampleSaas = new gcp.saasruntime.SaaS("example_saas", {
 *     saasId: "example-saas",
 *     location: location,
 *     locations: [{
 *         name: location,
 *     }],
 * });
 * const clusterUnitKind = new gcp.saasruntime.UnitKind("cluster_unit_kind", {
 *     location: location,
 *     unitKindId: "vm-unitkind",
 *     saas: exampleSaas.id,
 *     defaultRelease: `projects/my-project-name/locations/${location}/releases/example-release`,
 * });
 * const exampleRelease = new gcp.saasruntime.Release("example_release", {
 *     location: location,
 *     releaseId: "example-release",
 *     unitKind: clusterUnitKind.id,
 *     blueprint: {
 *         "package": "us-central1-docker.pkg.dev/ci-test-project-188019/test-repo/tf-test-easysaas-alpha-image@sha256:7992fdbaeaf998ecd31a7f937bb26e38a781ecf49b24857a6176c1e9bfc299ee",
 *     },
 * });
 * const exampleUnit = new gcp.saasruntime.Unit("example_unit", {
 *     location: location,
 *     unitId: "example-unit",
 *     unitKind: clusterUnitKind.id,
 * });
 * const tenantProject = new gcp.organizations.Project("tenant_project", {
 *     projectId: tenantProjectId,
 *     name: tenantProjectId,
 *     billingAccount: "000000-0000000-0000000-000000",
 *     orgId: "123456789",
 *     deletionPolicy: "DELETE",
 * });
 * const saasServices = new gcp.projects.Service("saas_services", {
 *     project: tenantProject.projectId,
 *     service: "compute.googleapis.com",
 *     disableDependentServices: true,
 * });
 * const actuationServiceAccount = new gcp.serviceaccount.Account("actuation_service_account", {
 *     accountId: "actuator",
 *     displayName: "SaaS Actuation Service Account",
 * });
 * const tenantConfigAdmin = new gcp.projects.IAMMember("tenant_config_admin", {
 *     project: tenantProject.projectId,
 *     role: "roles/config.admin",
 *     member: pulumi.interpolate`serviceAccount:${actuationServiceAccount.email}`,
 * });
 * const tenantStorageAdmin = new gcp.projects.IAMMember("tenant_storage_admin", {
 *     project: tenantProject.projectId,
 *     role: "roles/storage.admin",
 *     member: pulumi.interpolate`serviceAccount:${actuationServiceAccount.email}`,
 * });
 * const tenantComputeAdmin = new gcp.projects.IAMMember("tenant_compute_admin", {
 *     project: tenantProject.projectId,
 *     role: "roles/compute.admin",
 *     member: pulumi.interpolate`serviceAccount:${actuationServiceAccount.email}`,
 * });
 * const actuationTokenCreator = new gcp.serviceaccount.IAMMember("actuation_token_creator", {
 *     serviceAccountId: actuationServiceAccount.name,
 *     role: "roles/iam.serviceAccountTokenCreator",
 *     member: "serviceAccount:service-1111111111111@gcp-sa-saasservicemgmt.iam.gserviceaccount.com",
 * });
 * const provisionUnitOperation = new gcp.saasruntime.UnitOperation("provision_unit_operation", {
 *     location: location,
 *     unitOperationId: "provision-unit-operation",
 *     unit: exampleUnit.id,
 *     waitForCompletion: true,
 *     provision: {
 *         release: exampleRelease.id,
 *         inputVariables: [
 *             {
 *                 variable: "tenant_project_id",
 *                 value: tenantProject.projectId,
 *                 type: "STRING",
 *             },
 *             {
 *                 variable: "tenant_project_number",
 *                 value: tenantProject.number,
 *                 type: "INT",
 *             },
 *             {
 *                 variable: "zone",
 *                 value: "us-central1-a",
 *                 type: "STRING",
 *             },
 *             {
 *                 variable: "instance_name",
 *                 value: "terraform-test-instance",
 *                 type: "STRING",
 *             },
 *             {
 *                 variable: "actuation_sa",
 *                 value: actuationServiceAccount.email,
 *                 type: "STRING",
 *             },
 *         ],
 *     },
 *     labels: {
 *         "label-one": "foo",
 *     },
 *     annotations: {
 *         "annotation-one": "bar",
 *     },
 * }, {
 *     dependsOn: [
 *         tenantConfigAdmin,
 *         tenantStorageAdmin,
 *         tenantComputeAdmin,
 *         actuationTokenCreator,
 *         saasServices,
 *     ],
 * });
 * const noopUpgradeUnitOperation = new gcp.saasruntime.UnitOperation("noop_upgrade_unit_operation", {
 *     location: location,
 *     unitOperationId: "upgrade-unit-operation",
 *     unit: exampleUnit.id,
 *     waitForCompletion: true,
 *     upgrade: {
 *         release: exampleRelease.id,
 *         inputVariables: [
 *             {
 *                 variable: "tenant_project_id",
 *                 value: tenantProject.projectId,
 *                 type: "STRING",
 *             },
 *             {
 *                 variable: "tenant_project_number",
 *                 value: tenantProject.number,
 *                 type: "INT",
 *             },
 *             {
 *                 variable: "zone",
 *                 value: "us-central1-a",
 *                 type: "STRING",
 *             },
 *             {
 *                 variable: "instance_name",
 *                 value: "terraform-test-instance",
 *                 type: "STRING",
 *             },
 *             {
 *                 variable: "actuation_sa",
 *                 value: actuationServiceAccount.email,
 *                 type: "STRING",
 *             },
 *         ],
 *     },
 * }, {
 *     dependsOn: [provisionUnitOperation],
 * });
 * const deprovisionOperation = new gcp.saasruntime.UnitOperation("deprovision_operation", {
 *     location: location,
 *     unitOperationId: "deprovision-unit-operation",
 *     unit: exampleUnit.id,
 *     waitForCompletion: true,
 *     deprovision: {},
 * }, {
 *     dependsOn: [noopUpgradeUnitOperation],
 * });
 * ```
 *
 * ## Import
 *
 * UnitOperation can be imported using any of these accepted formats:
 *
 * * `projects/{{project}}/locations/{{location}}/unitOperations/{{unit_operation_id}}`
 *
 * * `{{project}}/{{location}}/{{unit_operation_id}}`
 *
 * * `{{location}}/{{unit_operation_id}}`
 *
 * When using the `pulumi import` command, UnitOperation can be imported using one of the formats above. For example:
 *
 * ```sh
 * $ pulumi import gcp:saasruntime/unitOperation:UnitOperation default projects/{{project}}/locations/{{location}}/unitOperations/{{unit_operation_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:saasruntime/unitOperation:UnitOperation default {{project}}/{{location}}/{{unit_operation_id}}
 * ```
 *
 * ```sh
 * $ pulumi import gcp:saasruntime/unitOperation:UnitOperation default {{location}}/{{unit_operation_id}}
 * ```
 */
class UnitOperation extends pulumi.CustomResource {
    /**
     * Get an existing UnitOperation 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 UnitOperation(name, state, { ...opts, id: id });
    }
    /**
     * Returns true if the given object is an instance of UnitOperation.  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'] === UnitOperation.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["annotations"] = state?.annotations;
            resourceInputs["conditions"] = state?.conditions;
            resourceInputs["createTime"] = state?.createTime;
            resourceInputs["deprovision"] = state?.deprovision;
            resourceInputs["effectiveAnnotations"] = state?.effectiveAnnotations;
            resourceInputs["effectiveLabels"] = state?.effectiveLabels;
            resourceInputs["engineState"] = state?.engineState;
            resourceInputs["errorCategory"] = state?.errorCategory;
            resourceInputs["etag"] = state?.etag;
            resourceInputs["labels"] = state?.labels;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["project"] = state?.project;
            resourceInputs["provision"] = state?.provision;
            resourceInputs["pulumiLabels"] = state?.pulumiLabels;
            resourceInputs["state"] = state?.state;
            resourceInputs["uid"] = state?.uid;
            resourceInputs["unit"] = state?.unit;
            resourceInputs["unitOperationId"] = state?.unitOperationId;
            resourceInputs["updateTime"] = state?.updateTime;
            resourceInputs["upgrade"] = state?.upgrade;
            resourceInputs["waitForCompletion"] = state?.waitForCompletion;
        }
        else {
            const args = argsOrState;
            if (args?.location === undefined && !opts.urn) {
                throw new Error("Missing required property 'location'");
            }
            if (args?.unit === undefined && !opts.urn) {
                throw new Error("Missing required property 'unit'");
            }
            if (args?.unitOperationId === undefined && !opts.urn) {
                throw new Error("Missing required property 'unitOperationId'");
            }
            resourceInputs["annotations"] = args?.annotations;
            resourceInputs["deprovision"] = args?.deprovision;
            resourceInputs["labels"] = args?.labels;
            resourceInputs["location"] = args?.location;
            resourceInputs["project"] = args?.project;
            resourceInputs["provision"] = args?.provision;
            resourceInputs["unit"] = args?.unit;
            resourceInputs["unitOperationId"] = args?.unitOperationId;
            resourceInputs["upgrade"] = args?.upgrade;
            resourceInputs["waitForCompletion"] = args?.waitForCompletion;
            resourceInputs["conditions"] = undefined /*out*/;
            resourceInputs["createTime"] = undefined /*out*/;
            resourceInputs["effectiveAnnotations"] = undefined /*out*/;
            resourceInputs["effectiveLabels"] = undefined /*out*/;
            resourceInputs["engineState"] = undefined /*out*/;
            resourceInputs["errorCategory"] = undefined /*out*/;
            resourceInputs["etag"] = undefined /*out*/;
            resourceInputs["name"] = undefined /*out*/;
            resourceInputs["pulumiLabels"] = undefined /*out*/;
            resourceInputs["state"] = undefined /*out*/;
            resourceInputs["uid"] = undefined /*out*/;
            resourceInputs["updateTime"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
        opts = pulumi.mergeOptions(opts, secretOpts);
        super(UnitOperation.__pulumiType, name, resourceInputs, opts);
    }
}
exports.UnitOperation = UnitOperation;
/** @internal */
UnitOperation.__pulumiType = 'gcp:saasruntime/unitOperation:UnitOperation';
//# sourceMappingURL=unitOperation.js.map