@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
143 lines • 6.31 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.AccessPolicyRotatingToken = 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-a-token)
*
* Required access policy scopes:
*
* * accesspolicies:read
* * accesspolicies:write
* * accesspolicies:delete
*
* This is similar to the grafana.cloud.AccessPolicyToken resource, but it represents a token that will be rotated automatically over time.
*
* ## 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 testAccessPolicyRotatingToken = new grafana.cloud.AccessPolicyRotatingToken("test", {
* region: "prod-us-east-0",
* accessPolicyId: test.policyId,
* namePrefix: "my-policy-rotating-token",
* displayName: "My Policy Rotating Token",
* expireAfter: "720h",
* earlyRotationWindow: "24h",
* });
* ```
*
* ## Import
*
* ```sh
* terraform import grafana_cloud_access_policy_rotating_token.name "{{ region }}:{{ tokenId }}"
* ```
*/
class AccessPolicyRotatingToken extends pulumi.CustomResource {
/**
* Get an existing AccessPolicyRotatingToken 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 AccessPolicyRotatingToken(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AccessPolicyRotatingToken. 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'] === AccessPolicyRotatingToken.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["accessPolicyId"] = state?.accessPolicyId;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["deleteOnDestroy"] = state?.deleteOnDestroy;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["earlyRotationWindow"] = state?.earlyRotationWindow;
resourceInputs["expireAfter"] = state?.expireAfter;
resourceInputs["expiresAt"] = state?.expiresAt;
resourceInputs["name"] = state?.name;
resourceInputs["namePrefix"] = state?.namePrefix;
resourceInputs["readyForRotation"] = state?.readyForRotation;
resourceInputs["region"] = state?.region;
resourceInputs["token"] = state?.token;
resourceInputs["updatedAt"] = state?.updatedAt;
}
else {
const args = argsOrState;
if (args?.accessPolicyId === undefined && !opts.urn) {
throw new Error("Missing required property 'accessPolicyId'");
}
if (args?.earlyRotationWindow === undefined && !opts.urn) {
throw new Error("Missing required property 'earlyRotationWindow'");
}
if (args?.expireAfter === undefined && !opts.urn) {
throw new Error("Missing required property 'expireAfter'");
}
if (args?.namePrefix === undefined && !opts.urn) {
throw new Error("Missing required property 'namePrefix'");
}
if (args?.region === undefined && !opts.urn) {
throw new Error("Missing required property 'region'");
}
resourceInputs["accessPolicyId"] = args?.accessPolicyId;
resourceInputs["deleteOnDestroy"] = args?.deleteOnDestroy;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["earlyRotationWindow"] = args?.earlyRotationWindow;
resourceInputs["expireAfter"] = args?.expireAfter;
resourceInputs["namePrefix"] = args?.namePrefix;
resourceInputs["region"] = args?.region;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["expiresAt"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["readyForRotation"] = undefined /*out*/;
resourceInputs["token"] = undefined /*out*/;
resourceInputs["updatedAt"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["token"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(AccessPolicyRotatingToken.__pulumiType, name, resourceInputs, opts);
}
}
exports.AccessPolicyRotatingToken = AccessPolicyRotatingToken;
/** @internal */
AccessPolicyRotatingToken.__pulumiType = 'grafana:cloud/accessPolicyRotatingToken:AccessPolicyRotatingToken';
//# sourceMappingURL=accessPolicyRotatingToken.js.map