com.pulumi.aws.grafana.WorkspaceApiKey Maven / Gradle / Ivy
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.pulumi.aws.grafana;
import com.pulumi.aws.Utilities;
import com.pulumi.aws.grafana.WorkspaceApiKeyArgs;
import com.pulumi.aws.grafana.inputs.WorkspaceApiKeyState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import javax.annotation.Nullable;
/**
* Provides an Amazon Managed Grafana workspace API Key resource.
*
* ## Example Usage
*
* ### Basic configuration
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.grafana.WorkspaceApiKey;
* import com.pulumi.aws.grafana.WorkspaceApiKeyArgs;
* 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 key = new WorkspaceApiKey("key", WorkspaceApiKeyArgs.builder()
* .keyName("test-key")
* .keyRole("VIEWER")
* .secondsToLive(3600)
* .workspaceId(test.id())
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
*/
@ResourceType(type="aws:grafana/workspaceApiKey:WorkspaceApiKey")
public class WorkspaceApiKey extends com.pulumi.resources.CustomResource {
/**
* The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
*
*/
@Export(name="key", refs={String.class}, tree="[0]")
private Output key;
/**
* @return The key token in JSON format. Use this value as a bearer token to authenticate HTTP requests to the workspace.
*
*/
public Output key() {
return this.key;
}
/**
* Specifies the name of the API key. Key names must be unique to the workspace.
*
*/
@Export(name="keyName", refs={String.class}, tree="[0]")
private Output keyName;
/**
* @return Specifies the name of the API key. Key names must be unique to the workspace.
*
*/
public Output keyName() {
return this.keyName;
}
/**
* Specifies the permission level of the API key. Valid values are `VIEWER`, `EDITOR`, or `ADMIN`.
*
*/
@Export(name="keyRole", refs={String.class}, tree="[0]")
private Output keyRole;
/**
* @return Specifies the permission level of the API key. Valid values are `VIEWER`, `EDITOR`, or `ADMIN`.
*
*/
public Output keyRole() {
return this.keyRole;
}
/**
* Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
*
*/
@Export(name="secondsToLive", refs={Integer.class}, tree="[0]")
private Output secondsToLive;
/**
* @return Specifies the time in seconds until the API key expires. Keys can be valid for up to 30 days.
*
*/
public Output secondsToLive() {
return this.secondsToLive;
}
/**
* The ID of the workspace that the API key is valid for.
*
*/
@Export(name="workspaceId", refs={String.class}, tree="[0]")
private Output workspaceId;
/**
* @return The ID of the workspace that the API key is valid for.
*
*/
public Output workspaceId() {
return this.workspaceId;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public WorkspaceApiKey(java.lang.String name) {
this(name, WorkspaceApiKeyArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public WorkspaceApiKey(java.lang.String name, WorkspaceApiKeyArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public WorkspaceApiKey(java.lang.String name, WorkspaceApiKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:grafana/workspaceApiKey:WorkspaceApiKey", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private WorkspaceApiKey(java.lang.String name, Output id, @Nullable WorkspaceApiKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("aws:grafana/workspaceApiKey:WorkspaceApiKey", name, state, makeResourceOptions(options, id), false);
}
private static WorkspaceApiKeyArgs makeArgs(WorkspaceApiKeyArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? WorkspaceApiKeyArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.additionalSecretOutputs(List.of(
"key"
))
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host 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
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static WorkspaceApiKey get(java.lang.String name, Output id, @Nullable WorkspaceApiKeyState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new WorkspaceApiKey(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy