"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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Instance = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * This resource provides the Instance resource in Oracle Cloud Infrastructure Core service.
 * Api doc link for the resource: https://docs.oracle.com/iaas/api/#/en/iaas/latest/Instance
 *
 * Example terraform configs related to the resource : https://github.com/oracle/terraform-provider-oci/tree/master/examples/
 *
 * Creates a new instance in the specified compartment and the specified availability domain.
 * For general information about instances, see
 * [Overview of the Compute Service](https://docs.cloud.oracle.com/iaas/Content/Compute/Concepts/computeoverview.htm).
 *
 * For information about access control and compartments, see
 * [Overview of the IAM Service](https://docs.cloud.oracle.com/iaas/Content/Identity/Concepts/overview.htm).
 *
 * For information about availability domains, see
 * [Regions and Availability Domains](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/regions.htm).
 * To get a list of availability domains, use the `ListAvailabilityDomains` operation
 * in the Identity and Access Management Service API.
 *
 * All Oracle Cloud Infrastructure resources, including instances, get an Oracle-assigned,
 * unique ID called an Oracle Cloud Identifier (OCID).
 * When you create a resource, you can find its OCID in the response. You can
 * also retrieve a resource's OCID by using a List API operation
 * on that resource type, or by viewing the resource in the Console.
 *
 * To launch an instance using an image or a boot volume use the `sourceDetails` parameter in [LaunchInstanceDetails](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/LaunchInstanceDetails).
 *
 * When you launch an instance, it is automatically attached to a virtual
 * network interface card (VNIC), called the *primary VNIC*. The VNIC
 * has a private IP address from the subnet's CIDR. You can either assign a
 * private IP address of your choice or let Oracle automatically assign one.
 * You can choose whether the instance has a public IP address. To retrieve the
 * addresses, use the [ListVnicAttachments](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/VnicAttachment/ListVnicAttachments)
 * operation to get the VNIC ID for the instance, and then call
 * [GetVnic](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/Vnic/GetVnic) with the VNIC ID.
 *
 * You can later add secondary VNICs to an instance. For more information, see
 * [Virtual Network Interface Cards (VNICs)](https://docs.cloud.oracle.com/iaas/Content/Network/Tasks/managingVNICs.htm).
 *
 * To launch an instance from a Marketplace image listing, you must provide the image ID of the
 * listing resource version that you want, but you also must subscribe to the listing before you try
 * to launch the instance. To subscribe to the listing, use the [GetAppCatalogListingAgreements](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/AppCatalogListingResourceVersionAgreements/GetAppCatalogListingAgreements)
 * operation to get the signature for the terms of use agreement for the desired listing resource version.
 * Then, call [CreateAppCatalogSubscription](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/AppCatalogSubscription/CreateAppCatalogSubscription)
 * with the signature. To get the image ID for the LaunchInstance operation, call
 * [GetAppCatalogListingResourceVersion](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/AppCatalogListingResourceVersion/GetAppCatalogListingResourceVersion).
 *
 * When launching an instance, you may provide the `securityAttributes` parameter in
 * [LaunchInstanceDetails](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/LaunchInstanceDetails) to manage security attributes via the instance,
 * or in the embedded [CreateVnicDetails](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/CreateVnicDetails/) to manage security attributes
 * via the VNIC directly, but not both.  Providing `securityAttributes` in both locations will return a
 * 400 Bad Request response.
 *
 * To determine whether capacity is available for a specific shape before you create an instance,
 * use the [CreateComputeCapacityReport](https://docs.cloud.oracle.com/iaas/api/#/en/iaas/latest/ComputeCapacityReport/CreateComputeCapacityReport)
 * operation.
 *
 * ## Import
 *
 * Instances can be imported using the `id`, e.g.
 *
 * ```sh
 * $ pulumi import oci:Core/instance:Instance test_instance "id"
 * ```
 */
class Instance extends pulumi.CustomResource {
    /**
     * Get an existing Instance 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 Instance(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'oci:Core/instance:Instance';
    /**
     * Returns true if the given object is an instance of Instance.  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'] === Instance.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["agentConfig"] = state?.agentConfig;
            resourceInputs["async"] = state?.async;
            resourceInputs["availabilityConfig"] = state?.availabilityConfig;
            resourceInputs["availabilityDomain"] = state?.availabilityDomain;
            resourceInputs["bootVolumeId"] = state?.bootVolumeId;
            resourceInputs["capacityReservationId"] = state?.capacityReservationId;
            resourceInputs["clusterPlacementGroupId"] = state?.clusterPlacementGroupId;
            resourceInputs["compartmentId"] = state?.compartmentId;
            resourceInputs["computeClusterId"] = state?.computeClusterId;
            resourceInputs["createVnicDetails"] = state?.createVnicDetails;
            resourceInputs["dedicatedVmHostId"] = state?.dedicatedVmHostId;
            resourceInputs["definedTags"] = state?.definedTags;
            resourceInputs["displayName"] = state?.displayName;
            resourceInputs["extendedMetadata"] = state?.extendedMetadata;
            resourceInputs["faultDomain"] = state?.faultDomain;
            resourceInputs["freeformTags"] = state?.freeformTags;
            resourceInputs["hostnameLabel"] = state?.hostnameLabel;
            resourceInputs["image"] = state?.image;
            resourceInputs["instanceConfigurationId"] = state?.instanceConfigurationId;
            resourceInputs["instanceOptions"] = state?.instanceOptions;
            resourceInputs["ipxeScript"] = state?.ipxeScript;
            resourceInputs["isAiEnterpriseEnabled"] = state?.isAiEnterpriseEnabled;
            resourceInputs["isCrossNumaNode"] = state?.isCrossNumaNode;
            resourceInputs["isPvEncryptionInTransitEnabled"] = state?.isPvEncryptionInTransitEnabled;
            resourceInputs["launchMode"] = state?.launchMode;
            resourceInputs["launchOptions"] = state?.launchOptions;
            resourceInputs["launchVolumeAttachments"] = state?.launchVolumeAttachments;
            resourceInputs["licensingConfigs"] = state?.licensingConfigs;
            resourceInputs["metadata"] = state?.metadata;
            resourceInputs["placementConstraintDetails"] = state?.placementConstraintDetails;
            resourceInputs["platformConfig"] = state?.platformConfig;
            resourceInputs["preemptibleInstanceConfig"] = state?.preemptibleInstanceConfig;
            resourceInputs["preserveBootVolume"] = state?.preserveBootVolume;
            resourceInputs["preserveDataVolumesCreatedAtLaunch"] = state?.preserveDataVolumesCreatedAtLaunch;
            resourceInputs["privateIp"] = state?.privateIp;
            resourceInputs["publicIp"] = state?.publicIp;
            resourceInputs["region"] = state?.region;
            resourceInputs["securityAttributes"] = state?.securityAttributes;
            resourceInputs["securityAttributesState"] = state?.securityAttributesState;
            resourceInputs["shape"] = state?.shape;
            resourceInputs["shapeConfig"] = state?.shapeConfig;
            resourceInputs["sourceDetails"] = state?.sourceDetails;
            resourceInputs["state"] = state?.state;
            resourceInputs["subnetId"] = state?.subnetId;
            resourceInputs["systemTags"] = state?.systemTags;
            resourceInputs["timeCreated"] = state?.timeCreated;
            resourceInputs["timeMaintenanceRebootDue"] = state?.timeMaintenanceRebootDue;
            resourceInputs["updateOperationConstraint"] = state?.updateOperationConstraint;
        }
        else {
            const args = argsOrState;
            if (args?.availabilityDomain === undefined && !opts.urn) {
                throw new Error("Missing required property 'availabilityDomain'");
            }
            if (args?.compartmentId === undefined && !opts.urn) {
                throw new Error("Missing required property 'compartmentId'");
            }
            resourceInputs["agentConfig"] = args?.agentConfig;
            resourceInputs["async"] = args?.async;
            resourceInputs["availabilityConfig"] = args?.availabilityConfig;
            resourceInputs["availabilityDomain"] = args?.availabilityDomain;
            resourceInputs["capacityReservationId"] = args?.capacityReservationId;
            resourceInputs["clusterPlacementGroupId"] = args?.clusterPlacementGroupId;
            resourceInputs["compartmentId"] = args?.compartmentId;
            resourceInputs["computeClusterId"] = args?.computeClusterId;
            resourceInputs["createVnicDetails"] = args?.createVnicDetails;
            resourceInputs["dedicatedVmHostId"] = args?.dedicatedVmHostId;
            resourceInputs["definedTags"] = args?.definedTags;
            resourceInputs["displayName"] = args?.displayName;
            resourceInputs["extendedMetadata"] = args?.extendedMetadata;
            resourceInputs["faultDomain"] = args?.faultDomain;
            resourceInputs["freeformTags"] = args?.freeformTags;
            resourceInputs["hostnameLabel"] = args?.hostnameLabel;
            resourceInputs["image"] = args?.image;
            resourceInputs["instanceConfigurationId"] = args?.instanceConfigurationId;
            resourceInputs["instanceOptions"] = args?.instanceOptions;
            resourceInputs["ipxeScript"] = args?.ipxeScript;
            resourceInputs["isAiEnterpriseEnabled"] = args?.isAiEnterpriseEnabled;
            resourceInputs["isPvEncryptionInTransitEnabled"] = args?.isPvEncryptionInTransitEnabled;
            resourceInputs["launchOptions"] = args?.launchOptions;
            resourceInputs["launchVolumeAttachments"] = args?.launchVolumeAttachments;
            resourceInputs["licensingConfigs"] = args?.licensingConfigs;
            resourceInputs["metadata"] = args?.metadata;
            resourceInputs["placementConstraintDetails"] = args?.placementConstraintDetails;
            resourceInputs["platformConfig"] = args?.platformConfig;
            resourceInputs["preemptibleInstanceConfig"] = args?.preemptibleInstanceConfig;
            resourceInputs["preserveBootVolume"] = args?.preserveBootVolume;
            resourceInputs["preserveDataVolumesCreatedAtLaunch"] = args?.preserveDataVolumesCreatedAtLaunch;
            resourceInputs["securityAttributes"] = args?.securityAttributes;
            resourceInputs["shape"] = args?.shape;
            resourceInputs["shapeConfig"] = args?.shapeConfig;
            resourceInputs["sourceDetails"] = args?.sourceDetails;
            resourceInputs["state"] = args?.state;
            resourceInputs["subnetId"] = args?.subnetId;
            resourceInputs["updateOperationConstraint"] = args?.updateOperationConstraint;
            resourceInputs["bootVolumeId"] = undefined /*out*/;
            resourceInputs["isCrossNumaNode"] = undefined /*out*/;
            resourceInputs["launchMode"] = undefined /*out*/;
            resourceInputs["privateIp"] = undefined /*out*/;
            resourceInputs["publicIp"] = undefined /*out*/;
            resourceInputs["region"] = undefined /*out*/;
            resourceInputs["securityAttributesState"] = undefined /*out*/;
            resourceInputs["systemTags"] = undefined /*out*/;
            resourceInputs["timeCreated"] = undefined /*out*/;
            resourceInputs["timeMaintenanceRebootDue"] = undefined /*out*/;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        super(Instance.__pulumiType, name, resourceInputs, opts);
    }
}
exports.Instance = Instance;
//# sourceMappingURL=instance.js.map