"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.PortalDashboard = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
 * Manages a shared dashboard in the Azure Portal.
 *
 * ## Example Usage
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 *
 * const config = new pulumi.Config();
 * // Content for the MD tile
 * const mdContent = config.get("mdContent") || "# Hello all :)";
 * // Link to a video
 * const videoLink = config.get("videoLink") || "https://www.youtube.com/watch?v=......";
 * const current = azure.core.getSubscription({});
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "mygroup",
 *     location: "West Europe",
 * });
 * const my_board = new azure.portal.PortalDashboard("my-board", {
 *     name: "my-cool-dashboard",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     tags: {
 *         source: "terraform",
 *     },
 *     dashboardProperties: current.then(current => `{
 *    \"lenses\": {
 *         \"0\": {
 *             \"order\": 0,
 *             \"parts\": {
 *                 \"0\": {
 *                     \"position\": {
 *                         \"x\": 0,
 *                         \"y\": 0,
 *                         \"rowSpan\": 2,
 *                         \"colSpan\": 3
 *                     },
 *                     \"metadata\": {
 *                         \"inputs\": [],
 *                         \"type\": \"Extension/HubsExtension/PartType/MarkdownPart\",
 *                         \"settings\": {
 *                             \"content\": {
 *                                 \"settings\": {
 *                                     \"content\": \"${mdContent}\",
 *                                     \"subtitle\": \"\",
 *                                     \"title\": \"\"
 *                                 }
 *                             }
 *                         }
 *                     }
 *                 },
 *                 \"1\": {
 *                     \"position\": {
 *                         \"x\": 5,
 *                         \"y\": 0,
 *                         \"rowSpan\": 4,
 *                         \"colSpan\": 6
 *                     },
 *                     \"metadata\": {
 *                         \"inputs\": [],
 *                         \"type\": \"Extension/HubsExtension/PartType/VideoPart\",
 *                         \"settings\": {
 *                             \"content\": {
 *                                 \"settings\": {
 *                                     \"title\": \"Important Information\",
 *                                     \"subtitle\": \"\",
 *                                     \"src\": \"${videoLink}\",
 *                                     \"autoplay\": true
 *                                 }
 *                             }
 *                         }
 *                     }
 *                 },
 *                 \"2\": {
 *                     \"position\": {
 *                         \"x\": 0,
 *                         \"y\": 4,
 *                         \"rowSpan\": 4,
 *                         \"colSpan\": 6
 *                     },
 *                     \"metadata\": {
 *                         \"inputs\": [
 *                             {
 *                                 \"name\": \"ComponentId\",
 *                                 \"value\": \"/subscriptions/${current.subscriptionId}/resourceGroups/myRG/providers/microsoft.insights/components/myWebApp\"
 *                             }
 *                         ],
 *                         \"type\": \"Extension/AppInsightsExtension/PartType/AppMapGalPt\",
 *                         \"settings\": {},
 *                         \"asset\": {
 *                             \"idInputName\": \"ComponentId\",
 *                             \"type\": \"ApplicationInsights\"
 *                         }
 *                     }
 *                 }
 *             }
 *         }
 *     },
 *     \"metadata\": {
 *         \"model\": {
 *             \"timeRange\": {
 *                 \"value\": {
 *                     \"relative\": {
 *                         \"duration\": 24,
 *                         \"timeUnit\": 1
 *                     }
 *                 },
 *                 \"type\": \"MsPortalFx.Composition.Configuration.ValueTypes.TimeRange\"
 *             },
 *             \"filterLocale\": {
 *                 \"value\": \"en-us\"
 *             },
 *             \"filters\": {
 *                 \"value\": {
 *                     \"MsPortalFx_TimeRange\": {
 *                         \"model\": {
 *                             \"format\": \"utc\",
 *                             \"granularity\": \"auto\",
 *                             \"relative\": \"24h\"
 *                         },
 *                         \"displayCache\": {
 *                             \"name\": \"UTC Time\",
 *                             \"value\": \"Past 24 hours\"
 *                         },
 *                         \"filteredPartIds\": [
 *                             \"StartboardPart-UnboundPart-ae44fef5-76b8-46b0-86f0-2b3f47bad1c7\"
 *                         ]
 *                     }
 *                 }
 *             }
 *         }
 *     }
 * }
 * `),
 * });
 * ```
 *
 * It is recommended to follow the steps outlined
 * [here](https://docs.microsoft.com/azure/azure-portal/azure-portal-dashboards-create-programmatically#fetch-the-json-representation-of-the-dashboard) to create a Dashboard in the Portal and extract the relevant JSON to use in this resource. From the extracted JSON, the contents of the `properties: {}` object can used. Variables can be injected as needed - see above example.
 *
 * ### Using a `templateFile` data source or the `templatefile` function
 *
 * Since the contents of the dashboard JSON can be quite lengthy, use a template file to improve readability:
 *
 * `dash.tpl`:
 *
 * This is then referenced in the `.tf` file by using a `templateFile` data source (terraform 0.11 or earlier), or the `templatefile` function (terraform 0.12+).
 *
 * `main.tf` (terraform 0.11 or earlier):
 *
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azurerm from "@pulumi/azurerm";
 *
 * function notImplemented(message: string) {
 *     throw new Error(message);
 * }
 *
 * const dash_template = notImplemented("The template_file data resource is not yet supported.");
 * //...
 * const my_board = new azurerm.index.Dashboard("my-board", {
 *     name: "my-cool-dashboard",
 *     resourceGroupName: example.name,
 *     location: example.location,
 *     tags: {
 *         source: "terraform",
 *     },
 *     dashboardProperties: dash_template.rendered,
 * });
 * ```
 *
 * `main.tf` (terraform 0.12+)
 *
 * ## Import
 *
 * Dashboards can be imported using the `resource id`, e.g.
 *
 * ```sh
 * $ pulumi import azure:portal/portalDashboard:PortalDashboard my-board /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Portal/dashboards/00000000-0000-0000-0000-000000000000
 * ```
 *
 * Note the URI in the above sample can be found using the Resource Explorer tool in the Azure Portal.
 */
class PortalDashboard extends pulumi.CustomResource {
    /**
     * Get an existing PortalDashboard 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 PortalDashboard(name, state, { ...opts, id: id });
    }
    /** @internal */
    static __pulumiType = 'azure:portal/portalDashboard:PortalDashboard';
    /**
     * Returns true if the given object is an instance of PortalDashboard.  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'] === PortalDashboard.__pulumiType;
    }
    constructor(name, argsOrState, opts) {
        let resourceInputs = {};
        opts = opts || {};
        if (opts.id) {
            const state = argsOrState;
            resourceInputs["dashboardProperties"] = state?.dashboardProperties;
            resourceInputs["location"] = state?.location;
            resourceInputs["name"] = state?.name;
            resourceInputs["resourceGroupName"] = state?.resourceGroupName;
            resourceInputs["tags"] = state?.tags;
        }
        else {
            const args = argsOrState;
            if (args?.dashboardProperties === undefined && !opts.urn) {
                throw new Error("Missing required property 'dashboardProperties'");
            }
            if (args?.resourceGroupName === undefined && !opts.urn) {
                throw new Error("Missing required property 'resourceGroupName'");
            }
            resourceInputs["dashboardProperties"] = args?.dashboardProperties;
            resourceInputs["location"] = args?.location;
            resourceInputs["name"] = args?.name;
            resourceInputs["resourceGroupName"] = args?.resourceGroupName;
            resourceInputs["tags"] = args?.tags;
        }
        opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
        const aliasOpts = { aliases: [{ type: "azure:portal/dashboard:Dashboard" }] };
        opts = pulumi.mergeOptions(opts, aliasOpts);
        super(PortalDashboard.__pulumiType, name, resourceInputs, opts);
    }
}
exports.PortalDashboard = PortalDashboard;
//# sourceMappingURL=portalDashboard.js.map