UNPKG

@lbrlabs/pulumi-grafana

Version:

A Pulumi package for creating and managing grafana.

115 lines 5.04 kB
"use strict"; // *** 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.CloudAccessPolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("./utilities"); /** * * [Official documentation](https://grafana.com/docs/grafana-cloud/account-management/authentication-and-permissions/access-policies/) * * [API documentation](https://grafana.com/docs/grafana-cloud/developer-resources/api-reference/cloud-api/#create-an-access-policy) * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@lbrlabs/pulumi-grafana"; * import * as grafana from "@pulumi/grafana"; * * const current = grafana.getCloudOrganization({ * slug: "<your org slug>", * }); * const testCloudAccessPolicy = new grafana.CloudAccessPolicy("testCloudAccessPolicy", { * region: "us", * displayName: "My Policy", * scopes: [ * "metrics:read", * "logs:read", * ], * realms: [{ * type: "org", * identifier: current.then(current => current.id), * labelPolicies: [{ * selector: "{namespace=\"default\"}", * }], * }], * }); * const testCloudAccessPolicyToken = new grafana.CloudAccessPolicyToken("testCloudAccessPolicyToken", { * region: "us", * accessPolicyId: testCloudAccessPolicy.policyId, * displayName: "My Policy Token", * expiresAt: "2023-01-01T00:00:00Z", * }); * ``` * * ## Import * * ```sh * $ pulumi import grafana:index/cloudAccessPolicy:CloudAccessPolicy policyname {{region}}/{{policy_id}} * ``` */ class CloudAccessPolicy extends pulumi.CustomResource { /** * Get an existing CloudAccessPolicy 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 CloudAccessPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of CloudAccessPolicy. 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'] === CloudAccessPolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["createdAt"] = state ? state.createdAt : undefined; resourceInputs["displayName"] = state ? state.displayName : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["policyId"] = state ? state.policyId : undefined; resourceInputs["realms"] = state ? state.realms : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["scopes"] = state ? state.scopes : undefined; resourceInputs["updatedAt"] = state ? state.updatedAt : undefined; } else { const args = argsOrState; if ((!args || args.realms === undefined) && !opts.urn) { throw new Error("Missing required property 'realms'"); } if ((!args || args.region === undefined) && !opts.urn) { throw new Error("Missing required property 'region'"); } if ((!args || args.scopes === undefined) && !opts.urn) { throw new Error("Missing required property 'scopes'"); } resourceInputs["displayName"] = args ? args.displayName : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["realms"] = args ? args.realms : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["scopes"] = args ? args.scopes : undefined; resourceInputs["createdAt"] = undefined /*out*/; resourceInputs["policyId"] = undefined /*out*/; resourceInputs["updatedAt"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(CloudAccessPolicy.__pulumiType, name, resourceInputs, opts); } } exports.CloudAccessPolicy = CloudAccessPolicy; /** @internal */ CloudAccessPolicy.__pulumiType = 'grafana:index/cloudAccessPolicy:CloudAccessPolicy'; //# sourceMappingURL=cloudAccessPolicy.js.map