Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.aws.grafana.kotlin.Workspace.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.grafana.kotlin
import com.pulumi.aws.grafana.kotlin.outputs.WorkspaceNetworkAccessControl
import com.pulumi.aws.grafana.kotlin.outputs.WorkspaceVpcConfiguration
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.aws.grafana.kotlin.outputs.WorkspaceNetworkAccessControl.Companion.toKotlin as workspaceNetworkAccessControlToKotlin
import com.pulumi.aws.grafana.kotlin.outputs.WorkspaceVpcConfiguration.Companion.toKotlin as workspaceVpcConfigurationToKotlin
/**
* Builder for [Workspace].
*/
@PulumiTagMarker
public class WorkspaceResourceBuilder internal constructor() {
public var name: String? = null
public var args: WorkspaceArgs = WorkspaceArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend WorkspaceArgsBuilder.() -> Unit) {
val builder = WorkspaceArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Workspace {
val builtJavaResource = com.pulumi.aws.grafana.Workspace(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Workspace(builtJavaResource)
}
}
/**
* Provides an Amazon Managed Grafana workspace resource.
* ## Example Usage
* ### Basic configuration
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const assume = new aws.iam.Role("assume", {
* name: "grafana-assume",
* assumeRolePolicy: JSON.stringify({
* Version: "2012-10-17",
* Statement: [{
* Action: "sts:AssumeRole",
* Effect: "Allow",
* Sid: "",
* Principal: {
* Service: "grafana.amazonaws.com",
* },
* }],
* }),
* });
* const example = new aws.grafana.Workspace("example", {
* accountAccessType: "CURRENT_ACCOUNT",
* authenticationProviders: ["SAML"],
* permissionType: "SERVICE_MANAGED",
* roleArn: assume.arn,
* });
* ```
* ```python
* import pulumi
* import json
* import pulumi_aws as aws
* assume = aws.iam.Role("assume",
* name="grafana-assume",
* assume_role_policy=json.dumps({
* "Version": "2012-10-17",
* "Statement": [{
* "Action": "sts:AssumeRole",
* "Effect": "Allow",
* "Sid": "",
* "Principal": {
* "Service": "grafana.amazonaws.com",
* },
* }],
* }))
* example = aws.grafana.Workspace("example",
* account_access_type="CURRENT_ACCOUNT",
* authentication_providers=["SAML"],
* permission_type="SERVICE_MANAGED",
* role_arn=assume.arn)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using System.Text.Json;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var assume = new Aws.Iam.Role("assume", new()
* {
* Name = "grafana-assume",
* AssumeRolePolicy = JsonSerializer.Serialize(new Dictionary
* {
* ["Version"] = "2012-10-17",
* ["Statement"] = new[]
* {
* new Dictionary
* {
* ["Action"] = "sts:AssumeRole",
* ["Effect"] = "Allow",
* ["Sid"] = "",
* ["Principal"] = new Dictionary
* {
* ["Service"] = "grafana.amazonaws.com",
* },
* },
* },
* }),
* });
* var example = new Aws.Grafana.Workspace("example", new()
* {
* AccountAccessType = "CURRENT_ACCOUNT",
* AuthenticationProviders = new[]
* {
* "SAML",
* },
* PermissionType = "SERVICE_MANAGED",
* RoleArn = assume.Arn,
* });
* });
* ```
* ```go
* package main
* import (
* "encoding/json"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/grafana"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* tmpJSON0, err := json.Marshal(map[string]interface{}{
* "Version": "2012-10-17",
* "Statement": []map[string]interface{}{
* map[string]interface{}{
* "Action": "sts:AssumeRole",
* "Effect": "Allow",
* "Sid": "",
* "Principal": map[string]interface{}{
* "Service": "grafana.amazonaws.com",
* },
* },
* },
* })
* if err != nil {
* return err
* }
* json0 := string(tmpJSON0)
* assume, err := iam.NewRole(ctx, "assume", &iam.RoleArgs{
* Name: pulumi.String("grafana-assume"),
* AssumeRolePolicy: pulumi.String(json0),
* })
* if err != nil {
* return err
* }
* _, err = grafana.NewWorkspace(ctx, "example", &grafana.WorkspaceArgs{
* AccountAccessType: pulumi.String("CURRENT_ACCOUNT"),
* AuthenticationProviders: pulumi.StringArray{
* pulumi.String("SAML"),
* },
* PermissionType: pulumi.String("SERVICE_MANAGED"),
* RoleArn: assume.Arn,
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.iam.Role;
* import com.pulumi.aws.iam.RoleArgs;
* import com.pulumi.aws.grafana.Workspace;
* import com.pulumi.aws.grafana.WorkspaceArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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 assume = new Role("assume", RoleArgs.builder()
* .name("grafana-assume")
* .assumeRolePolicy(serializeJson(
* jsonObject(
* jsonProperty("Version", "2012-10-17"),
* jsonProperty("Statement", jsonArray(jsonObject(
* jsonProperty("Action", "sts:AssumeRole"),
* jsonProperty("Effect", "Allow"),
* jsonProperty("Sid", ""),
* jsonProperty("Principal", jsonObject(
* jsonProperty("Service", "grafana.amazonaws.com")
* ))
* )))
* )))
* .build());
* var example = new Workspace("example", WorkspaceArgs.builder()
* .accountAccessType("CURRENT_ACCOUNT")
* .authenticationProviders("SAML")
* .permissionType("SERVICE_MANAGED")
* .roleArn(assume.arn())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:grafana:Workspace
* properties:
* accountAccessType: CURRENT_ACCOUNT
* authenticationProviders:
* - SAML
* permissionType: SERVICE_MANAGED
* roleArn: ${assume.arn}
* assume:
* type: aws:iam:Role
* properties:
* name: grafana-assume
* assumeRolePolicy:
* fn::toJSON:
* Version: 2012-10-17
* Statement:
* - Action: sts:AssumeRole
* Effect: Allow
* Sid:
* Principal:
* Service: grafana.amazonaws.com
* ```
*
* ### Workspace configuration options
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.grafana.Workspace("example", {
* accountAccessType: "CURRENT_ACCOUNT",
* authenticationProviders: ["SAML"],
* permissionType: "SERVICE_MANAGED",
* roleArn: assume.arn,
* configuration: JSON.stringify({
* plugins: {
* pluginAdminEnabled: true,
* },
* unifiedAlerting: {
* enabled: false,
* },
* }),
* });
* ```
* ```python
* import pulumi
* import json
* import pulumi_aws as aws
* example = aws.grafana.Workspace("example",
* account_access_type="CURRENT_ACCOUNT",
* authentication_providers=["SAML"],
* permission_type="SERVICE_MANAGED",
* role_arn=assume["arn"],
* configuration=json.dumps({
* "plugins": {
* "pluginAdminEnabled": True,
* },
* "unifiedAlerting": {
* "enabled": False,
* },
* }))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using System.Text.Json;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.Grafana.Workspace("example", new()
* {
* AccountAccessType = "CURRENT_ACCOUNT",
* AuthenticationProviders = new[]
* {
* "SAML",
* },
* PermissionType = "SERVICE_MANAGED",
* RoleArn = assume.Arn,
* Configuration = JsonSerializer.Serialize(new Dictionary
* {
* ["plugins"] = new Dictionary
* {
* ["pluginAdminEnabled"] = true,
* },
* ["unifiedAlerting"] = new Dictionary
* {
* ["enabled"] = false,
* },
* }),
* });
* });
* ```
* ```go
* package main
* import (
* "encoding/json"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/grafana"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* tmpJSON0, err := json.Marshal(map[string]interface{}{
* "plugins": map[string]interface{}{
* "pluginAdminEnabled": true,
* },
* "unifiedAlerting": map[string]interface{}{
* "enabled": false,
* },
* })
* if err != nil {
* return err
* }
* json0 := string(tmpJSON0)
* _, err = grafana.NewWorkspace(ctx, "example", &grafana.WorkspaceArgs{
* AccountAccessType: pulumi.String("CURRENT_ACCOUNT"),
* AuthenticationProviders: pulumi.StringArray{
* pulumi.String("SAML"),
* },
* PermissionType: pulumi.String("SERVICE_MANAGED"),
* RoleArn: pulumi.Any(assume.Arn),
* Configuration: pulumi.String(json0),
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.aws.grafana.Workspace;
* import com.pulumi.aws.grafana.WorkspaceArgs;
* import static com.pulumi.codegen.internal.Serialization.*;
* 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 example = new Workspace("example", WorkspaceArgs.builder()
* .accountAccessType("CURRENT_ACCOUNT")
* .authenticationProviders("SAML")
* .permissionType("SERVICE_MANAGED")
* .roleArn(assume.arn())
* .configuration(serializeJson(
* jsonObject(
* jsonProperty("plugins", jsonObject(
* jsonProperty("pluginAdminEnabled", true)
* )),
* jsonProperty("unifiedAlerting", jsonObject(
* jsonProperty("enabled", false)
* ))
* )))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:grafana:Workspace
* properties:
* accountAccessType: CURRENT_ACCOUNT
* authenticationProviders:
* - SAML
* permissionType: SERVICE_MANAGED
* roleArn: ${assume.arn}
* configuration:
* fn::toJSON:
* plugins:
* pluginAdminEnabled: true
* unifiedAlerting:
* enabled: false
* ```
*
* The optional argument `configuration` is a JSON string that enables the unified `Grafana Alerting` (Grafana version 10 or newer) and `Plugins Management` (Grafana version 9 or newer) on the Grafana Workspaces.
* For more information about using Grafana alerting, and the effects of turning it on or off, see [Alerts in Grafana version 10](https://docs.aws.amazon.com/grafana/latest/userguide/v10-alerts.html).
* ## Import
* Using `pulumi import`, import Grafana Workspace using the workspace's `id`. For example:
* ```sh
* $ pulumi import aws:grafana/workspace:Workspace example g-2054c75a02
* ```
*/
public class Workspace internal constructor(
override val javaResource: com.pulumi.aws.grafana.Workspace,
) : KotlinCustomResource(javaResource, WorkspaceMapper) {
/**
* The type of account access for the workspace. Valid values are `CURRENT_ACCOUNT` and `ORGANIZATION`. If `ORGANIZATION` is specified, then `organizational_units` must also be present.
*/
public val accountAccessType: Output
get() = javaResource.accountAccessType().applyValue({ args0 -> args0 })
/**
* The Amazon Resource Name (ARN) of the Grafana workspace.
*/
public val arn: Output
get() = javaResource.arn().applyValue({ args0 -> args0 })
/**
* The authentication providers for the workspace. Valid values are `AWS_SSO`, `SAML`, or both.
*/
public val authenticationProviders: Output>
get() = javaResource.authenticationProviders().applyValue({ args0 ->
args0.map({ args0 ->
args0
})
})
/**
* The configuration string for the workspace that you create. For more information about the format and configuration options available, see [Working in your Grafana workspace](https://docs.aws.amazon.com/grafana/latest/userguide/AMG-configure-workspace.html).
*/
public val configuration: Output
get() = javaResource.configuration().applyValue({ args0 -> args0 })
/**
* The data sources for the workspace. Valid values are `AMAZON_OPENSEARCH_SERVICE`, `ATHENA`, `CLOUDWATCH`, `PROMETHEUS`, `REDSHIFT`, `SITEWISE`, `TIMESTREAM`, `XRAY`
*/
public val dataSources: Output>?
get() = javaResource.dataSources().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
/**
* The workspace description.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The endpoint of the Grafana workspace.
*/
public val endpoint: Output
get() = javaResource.endpoint().applyValue({ args0 -> args0 })
/**
* Specifies the version of Grafana to support in the new workspace. Supported values are `8.4`, `9.4` and `10.4`. If not specified, defaults to `9.4`.
*/
public val grafanaVersion: Output
get() = javaResource.grafanaVersion().applyValue({ args0 -> args0 })
/**
* The Grafana workspace name.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* Configuration for network access to your workspace.See Network Access Control below.
*/
public val networkAccessControl: Output?
get() = javaResource.networkAccessControl().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> workspaceNetworkAccessControlToKotlin(args0) })
}).orElse(null)
})
/**
* The notification destinations. If a data source is specified here, Amazon Managed Grafana will create IAM roles and permissions needed to use these destinations. Must be set to `SNS`.
*/
public val notificationDestinations: Output>?
get() = javaResource.notificationDestinations().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
/**
* The role name that the workspace uses to access resources through Amazon Organizations.
*/
public val organizationRoleName: Output?
get() = javaResource.organizationRoleName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The Amazon Organizations organizational units that the workspace is authorized to use data sources from.
*/
public val organizationalUnits: Output>?
get() = javaResource.organizationalUnits().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
/**
* The permission type of the workspace. If `SERVICE_MANAGED` is specified, the IAM roles and IAM policy attachments are generated automatically. If `CUSTOMER_MANAGED` is specified, the IAM roles and IAM policy attachments will not be created.
* The following arguments are optional:
*/
public val permissionType: Output
get() = javaResource.permissionType().applyValue({ args0 -> args0 })
/**
* The IAM role ARN that the workspace assumes.
*/
public val roleArn: Output?
get() = javaResource.roleArn().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
public val samlConfigurationStatus: Output
get() = javaResource.samlConfigurationStatus().applyValue({ args0 -> args0 })
/**
* The AWS CloudFormation stack set name that provisions IAM roles to be used by the workspace.
*/
public val stackSetName: Output?
get() = javaResource.stackSetName().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Key-value mapping of resource tags. If configured with a provider `default_tags` configuration block present, tags with matching keys will overwrite those defined at the provider-level
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* Map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
*/
@Deprecated(
message = """
Please use `tags` instead.
""",
)
public val tagsAll: Output>
get() = javaResource.tagsAll().applyValue({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
})
/**
* The configuration settings for an Amazon VPC that contains data sources for your Grafana workspace to connect to. See VPC Configuration below.
*/
public val vpcConfiguration: Output?
get() = javaResource.vpcConfiguration().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> workspaceVpcConfigurationToKotlin(args0) })
}).orElse(null)
})
}
public object WorkspaceMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.grafana.Workspace::class == javaResource::class
override fun map(javaResource: Resource): Workspace = Workspace(
javaResource as
com.pulumi.aws.grafana.Workspace,
)
}
/**
* @see [Workspace].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Workspace].
*/
public suspend fun workspace(name: String, block: suspend WorkspaceResourceBuilder.() -> Unit): Workspace {
val builder = WorkspaceResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Workspace].
* @param name The _unique_ name of the resulting resource.
*/
public fun workspace(name: String): Workspace {
val builder = WorkspaceResourceBuilder()
builder.name(name)
return builder.build()
}