1. Packages
  2. Grafana Cloud
  3. API Docs
  4. ApiKey
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

grafana.ApiKey

Explore with Pulumi AI

grafana logo
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumiverse/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;
    
    import pulumi
    import pulumiverse_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)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana"
    )
    
    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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Grafana = Pulumiverse.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 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);
        }
    }
    
    resources:
      foo:
        type: grafana:ApiKey
        properties:
          role: Viewer
      bar:
        type: grafana:ApiKey
        properties:
          role: Admin
          secondsToLive: 30
    outputs:
      apiKeyFooKeyOnly: ${foo.key}
      apiKeyBar: ${bar}
    

    Create ApiKey Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ApiKey(name: string, args: ApiKeyArgs, opts?: CustomResourceOptions);
    @overload
    def ApiKey(resource_name: str,
               args: ApiKeyArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def ApiKey(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               role: Optional[str] = None,
               name: Optional[str] = None,
               org_id: Optional[str] = None,
               seconds_to_live: Optional[int] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var apiKeyResource = new Grafana.ApiKey("apiKeyResource", new()
    {
        Role = "string",
        Name = "string",
        OrgId = "string",
        SecondsToLive = 0,
    });
    
    example, err := grafana.NewApiKey(ctx, "apiKeyResource", &grafana.ApiKeyArgs{
    	Role:          pulumi.String("string"),
    	Name:          pulumi.String("string"),
    	OrgId:         pulumi.String("string"),
    	SecondsToLive: pulumi.Int(0),
    })
    
    var apiKeyResource = new ApiKey("apiKeyResource", ApiKeyArgs.builder()
        .role("string")
        .name("string")
        .orgId("string")
        .secondsToLive(0)
        .build());
    
    api_key_resource = grafana.ApiKey("apiKeyResource",
        role="string",
        name="string",
        org_id="string",
        seconds_to_live=0)
    
    const apiKeyResource = new grafana.ApiKey("apiKeyResource", {
        role: "string",
        name: "string",
        orgId: "string",
        secondsToLive: 0,
    });
    
    type: grafana:ApiKey
    properties:
        name: string
        orgId: string
        role: string
        secondsToLive: 0
    

    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
    Name string
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    SecondsToLive int
    Role string
    Name string
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    SecondsToLive int
    role String
    name String
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secondsToLive Integer
    role string
    name string
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    secondsToLive number
    role str
    name str
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    seconds_to_live int
    role String
    name String
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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 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,
            expiration: Optional[str] = None,
            key: Optional[str] = None,
            name: Optional[str] = None,
            org_id: 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:
    Expiration string
    Key string
    Name string
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Role string
    SecondsToLive int
    Expiration string
    Key string
    Name string
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    Role string
    SecondsToLive int
    expiration String
    key String
    name String
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    role String
    secondsToLive Integer
    expiration string
    key string
    name string
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    role string
    secondsToLive number
    expiration str
    key str
    name str
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    role str
    seconds_to_live int
    expiration String
    key String
    name String
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    role String
    secondsToLive Number

    Package Details

    Repository
    grafana pulumiverse/pulumi-grafana
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the grafana Terraform Provider.
    grafana logo
    Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse