Grafana

v0.0.3 published on Sunday, Sep 18, 2022 by lbrlabs

ApiKey

Manages Grafana API Keys.

Example Usage

using System.Collections.Generic;
using Pulumi;
using Grafana = Lbrlabs.PulumiPackage.Grafana;

return await Deployment.RunAsync(() => 
{
    var foo = new Grafana.ApiKey("foo", new()
    {
        Role = "Viewer",
    });

    var bar = new Grafana.ApiKey("bar", new()
    {
        Role = "Admin",
        SecondsToLive = 30,
    });

    return new Dictionary<string, object?>
    {
        ["apiKeyFooKeyOnly"] = foo.Key,
        ["apiKeyBar"] = bar,
    };
});
package main

import (
	"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		foo, err := grafana.NewApiKey(ctx, "foo", &grafana.ApiKeyArgs{
			Role: pulumi.String("Viewer"),
		})
		if err != nil {
			return err
		}
		bar, err := grafana.NewApiKey(ctx, "bar", &grafana.ApiKeyArgs{
			Role:          pulumi.String("Admin"),
			SecondsToLive: pulumi.Int(30),
		})
		if err != nil {
			return err
		}
		ctx.Export("apiKeyFooKeyOnly", foo.Key)
		ctx.Export("apiKeyBar", bar)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.ApiKey;
import com.pulumi.grafana.ApiKeyArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var foo = new ApiKey("foo", ApiKeyArgs.builder()        
            .role("Viewer")
            .build());

        var bar = new ApiKey("bar", ApiKeyArgs.builder()        
            .role("Admin")
            .secondsToLive(30)
            .build());

        ctx.export("apiKeyFooKeyOnly", foo.key());
        ctx.export("apiKeyBar", bar);
    }
}
import pulumi
import lbrlabs_pulumi_grafana as grafana

foo = grafana.ApiKey("foo", role="Viewer")
bar = grafana.ApiKey("bar",
    role="Admin",
    seconds_to_live=30)
pulumi.export("apiKeyFooKeyOnly", foo.key)
pulumi.export("apiKeyBar", bar)
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@lbrlabs/pulumi-grafana";

const foo = new grafana.ApiKey("foo", {role: "Viewer"});
const bar = new grafana.ApiKey("bar", {
    role: "Admin",
    secondsToLive: 30,
});
export const apiKeyFooKeyOnly = foo.key;
export const apiKeyBar = bar;
resources:
  foo:
    type: grafana:ApiKey
    properties:
      role: Viewer
  bar:
    type: grafana:ApiKey
    properties:
      role: Admin
      secondsToLive: 30
outputs:
  apiKeyFooKeyOnly: ${foo.key}
  apiKeyBar: ${bar}

Create a ApiKey Resource

new ApiKey(name: string, args: ApiKeyArgs, opts?: CustomResourceOptions);
@overload
def ApiKey(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           cloud_stack_slug: Optional[str] = None,
           name: Optional[str] = None,
           role: Optional[str] = None,
           seconds_to_live: Optional[int] = None)
@overload
def ApiKey(resource_name: str,
           args: ApiKeyArgs,
           opts: Optional[ResourceOptions] = None)
func NewApiKey(ctx *Context, name string, args ApiKeyArgs, opts ...ResourceOption) (*ApiKey, error)
public ApiKey(string name, ApiKeyArgs args, CustomResourceOptions? opts = null)
public ApiKey(String name, ApiKeyArgs args)
public ApiKey(String name, ApiKeyArgs args, CustomResourceOptions options)
type: grafana:ApiKey
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ApiKeyArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ApiKey Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ApiKey resource accepts the following input properties:

Role string
CloudStackSlug string

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

Name string
SecondsToLive int
Role string
CloudStackSlug string

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

Name string
SecondsToLive int
role String
cloudStackSlug String

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

name String
secondsToLive Integer
role string
cloudStackSlug string

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

name string
secondsToLive number
role str
cloud_stack_slug str

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

name str
seconds_to_live int
role String
cloudStackSlug String

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

name String
secondsToLive Number

Outputs

All input properties are implicitly available as output properties. Additionally, the ApiKey resource produces the following output properties:

Expiration string
Id string

The provider-assigned unique ID for this managed resource.

Key string
Expiration string
Id string

The provider-assigned unique ID for this managed resource.

Key string
expiration String
id String

The provider-assigned unique ID for this managed resource.

key String
expiration string
id string

The provider-assigned unique ID for this managed resource.

key string
expiration str
id str

The provider-assigned unique ID for this managed resource.

key str
expiration String
id String

The provider-assigned unique ID for this managed resource.

key String

Look up an Existing ApiKey Resource

Get an existing ApiKey resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ApiKeyState, opts?: CustomResourceOptions): ApiKey
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cloud_stack_slug: Optional[str] = None,
        expiration: Optional[str] = None,
        key: Optional[str] = None,
        name: Optional[str] = None,
        role: Optional[str] = None,
        seconds_to_live: Optional[int] = None) -> ApiKey
func GetApiKey(ctx *Context, name string, id IDInput, state *ApiKeyState, opts ...ResourceOption) (*ApiKey, error)
public static ApiKey Get(string name, Input<string> id, ApiKeyState? state, CustomResourceOptions? opts = null)
public static ApiKey get(String name, Output<String> id, ApiKeyState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CloudStackSlug string

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

Expiration string
Key string
Name string
Role string
SecondsToLive int
CloudStackSlug string

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

Expiration string
Key string
Name string
Role string
SecondsToLive int
cloudStackSlug String

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

expiration String
key String
name String
role String
secondsToLive Integer
cloudStackSlug string

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

expiration string
key string
name string
role string
secondsToLive number
cloud_stack_slug str

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

expiration str
key str
name str
role str
seconds_to_live int
cloudStackSlug String

If set, the API key will be created for the given Cloud stack. This can be used to bootstrap a management API key for a new stack. Note: This requires a cloud token to be configured.

expiration String
key String
name String
role String
secondsToLive Number

Package Details

Repository
https://github.com/lbrlabs/pulumi-grafana
License
Apache-2.0
Notes

This Pulumi package is based on the grafana Terraform Provider.