@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
124 lines • 4.85 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.AccessPolicy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* * [Official documentation](https://grafana.com/docs/grafana-cloud/security-and-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)
*
* Required access policy scopes:
*
* * accesspolicies:read
* * accesspolicies:write
* * accesspolicies:delete
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* const current = grafana.cloud.getOrganization({
* slug: "<your org slug>",
* });
* const test = new grafana.cloud.AccessPolicy("test", {
* region: "prod-us-east-0",
* name: "my-policy",
* displayName: "My Policy",
* scopes: [
* "metrics:read",
* "logs:read",
* ],
* realms: [{
* type: "org",
* identifier: current.then(current => current.id),
* labelPolicies: [{
* selector: "{namespace=\"default\"}",
* }],
* }],
* });
* const testAccessPolicyToken = new grafana.cloud.AccessPolicyToken("test", {
* region: "prod-us-east-0",
* accessPolicyId: test.policyId,
* name: "my-policy-token",
* displayName: "My Policy Token",
* expiresAt: "2023-01-01T00:00:00Z",
* });
* ```
*
* ## Import
*
* ```sh
* terraform import grafana_cloud_access_policy.name "{{ region }}:{{ policyId }}"
* ```
*/
class AccessPolicy extends pulumi.CustomResource {
/**
* Get an existing AccessPolicy 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 AccessPolicy(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AccessPolicy. 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'] === AccessPolicy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["conditions"] = state?.conditions;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["name"] = state?.name;
resourceInputs["policyId"] = state?.policyId;
resourceInputs["realms"] = state?.realms;
resourceInputs["region"] = state?.region;
resourceInputs["scopes"] = state?.scopes;
resourceInputs["updatedAt"] = state?.updatedAt;
}
else {
const args = argsOrState;
if (args?.realms === undefined && !opts.urn) {
throw new Error("Missing required property 'realms'");
}
if (args?.region === undefined && !opts.urn) {
throw new Error("Missing required property 'region'");
}
if (args?.scopes === undefined && !opts.urn) {
throw new Error("Missing required property 'scopes'");
}
resourceInputs["conditions"] = args?.conditions;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["name"] = args?.name;
resourceInputs["realms"] = args?.realms;
resourceInputs["region"] = args?.region;
resourceInputs["scopes"] = args?.scopes;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["policyId"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AccessPolicy.__pulumiType, name, resourceInputs, opts);
}
}
exports.AccessPolicy = AccessPolicy;
/** @internal */
AccessPolicy.__pulumiType = 'grafana:cloud/accessPolicy:AccessPolicy';
//# sourceMappingURL=accessPolicy.js.map