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.elasticsearch.kotlin.DomainPolicy.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.aws.elasticsearch.kotlin
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.String
import kotlin.Suppress
import kotlin.Unit
/**
* Builder for [DomainPolicy].
*/
@PulumiTagMarker
public class DomainPolicyResourceBuilder internal constructor() {
public var name: String? = null
public var args: DomainPolicyArgs = DomainPolicyArgs()
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 DomainPolicyArgsBuilder.() -> Unit) {
val builder = DomainPolicyArgsBuilder()
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(): DomainPolicy {
val builtJavaResource = com.pulumi.aws.elasticsearch.DomainPolicy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return DomainPolicy(builtJavaResource)
}
}
/**
* Allows setting policy to an Elasticsearch domain while referencing domain attributes (e.g., ARN)
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
* const example = new aws.elasticsearch.Domain("example", {
* domainName: "tf-test",
* elasticsearchVersion: "2.3",
* });
* const main = new aws.elasticsearch.DomainPolicy("main", {
* domainName: example.domainName,
* accessPolicies: pulumi.interpolate`{
* "Version": "2012-10-17",
* "Statement": [
* {
* "Action": "es:*",
* "Principal": "*",
* "Effect": "Allow",
* "Condition": {
* "IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
* },
* "Resource": "${example.arn}/*"
* }
* ]
* }
* `,
* });
* ```
* ```python
* import pulumi
* import pulumi_aws as aws
* example = aws.elasticsearch.Domain("example",
* domain_name="tf-test",
* elasticsearch_version="2.3")
* main = aws.elasticsearch.DomainPolicy("main",
* domain_name=example.domain_name,
* access_policies=example.arn.apply(lambda arn: f"""{{
* "Version": "2012-10-17",
* "Statement": [
* {{
* "Action": "es:*",
* "Principal": "*",
* "Effect": "Allow",
* "Condition": {{
* "IpAddress": {{"aws:SourceIp": "127.0.0.1/32"}}
* }},
* "Resource": "{arn}/*"
* }}
* ]
* }}
* """))
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Aws = Pulumi.Aws;
* return await Deployment.RunAsync(() =>
* {
* var example = new Aws.ElasticSearch.Domain("example", new()
* {
* DomainName = "tf-test",
* ElasticsearchVersion = "2.3",
* });
* var main = new Aws.ElasticSearch.DomainPolicy("main", new()
* {
* DomainName = example.DomainName,
* AccessPolicies = example.Arn.Apply(arn => @$"{{
* ""Version"": ""2012-10-17"",
* ""Statement"": [
* {{
* ""Action"": ""es:*"",
* ""Principal"": ""*"",
* ""Effect"": ""Allow"",
* ""Condition"": {{
* ""IpAddress"": {{""aws:SourceIp"": ""127.0.0.1/32""}}
* }},
* ""Resource"": ""{arn}/*""
* }}
* ]
* }}
* "),
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/elasticsearch"
* "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 {
* example, err := elasticsearch.NewDomain(ctx, "example", &elasticsearch.DomainArgs{
* DomainName: pulumi.String("tf-test"),
* ElasticsearchVersion: pulumi.String("2.3"),
* })
* if err != nil {
* return err
* }
* _, err = elasticsearch.NewDomainPolicy(ctx, "main", &elasticsearch.DomainPolicyArgs{
* DomainName: example.DomainName,
* AccessPolicies: example.Arn.ApplyT(func(arn string) (string, error) {
* return fmt.Sprintf(`{
* "Version": "2012-10-17",
* "Statement": [
* {
* "Action": "es:*",
* "Principal": "*",
* "Effect": "Allow",
* "Condition": {
* "IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
* },
* "Resource": "%v/*"
* }
* ]
* }
* `, arn), nil
* }).(pulumi.StringOutput),
* })
* 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.elasticsearch.Domain;
* import com.pulumi.aws.elasticsearch.DomainArgs;
* import com.pulumi.aws.elasticsearch.DomainPolicy;
* import com.pulumi.aws.elasticsearch.DomainPolicyArgs;
* 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 Domain("example", DomainArgs.builder()
* .domainName("tf-test")
* .elasticsearchVersion("2.3")
* .build());
* var main = new DomainPolicy("main", DomainPolicyArgs.builder()
* .domainName(example.domainName())
* .accessPolicies(example.arn().applyValue(arn -> """
* {
* "Version": "2012-10-17",
* "Statement": [
* {
* "Action": "es:*",
* "Principal": "*",
* "Effect": "Allow",
* "Condition": {
* "IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
* },
* "Resource": "%s/*"
* }
* ]
* }
* ", arn)))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: aws:elasticsearch:Domain
* properties:
* domainName: tf-test
* elasticsearchVersion: '2.3'
* main:
* type: aws:elasticsearch:DomainPolicy
* properties:
* domainName: ${example.domainName}
* accessPolicies: |
* {
* "Version": "2012-10-17",
* "Statement": [
* {
* "Action": "es:*",
* "Principal": "*",
* "Effect": "Allow",
* "Condition": {
* "IpAddress": {"aws:SourceIp": "127.0.0.1/32"}
* },
* "Resource": "${example.arn}/*"
* }
* ]
* }
* ```
*
* */*/*/*/*/*/
*/
public class DomainPolicy internal constructor(
override val javaResource: com.pulumi.aws.elasticsearch.DomainPolicy,
) : KotlinCustomResource(javaResource, DomainPolicyMapper) {
/**
* IAM policy document specifying the access policies for the domain
*/
public val accessPolicies: Output
get() = javaResource.accessPolicies().applyValue({ args0 -> args0 })
/**
* Name of the domain.
*/
public val domainName: Output
get() = javaResource.domainName().applyValue({ args0 -> args0 })
}
public object DomainPolicyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.aws.elasticsearch.DomainPolicy::class == javaResource::class
override fun map(javaResource: Resource): DomainPolicy = DomainPolicy(
javaResource as
com.pulumi.aws.elasticsearch.DomainPolicy,
)
}
/**
* @see [DomainPolicy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [DomainPolicy].
*/
public suspend fun domainPolicy(
name: String,
block: suspend DomainPolicyResourceBuilder.() -> Unit,
): DomainPolicy {
val builder = DomainPolicyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [DomainPolicy].
* @param name The _unique_ name of the resulting resource.
*/
public fun domainPolicy(name: String): DomainPolicy {
val builder = DomainPolicyResourceBuilder()
builder.name(name)
return builder.build()
}