All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.alicloud.ecs.kotlin.SecurityGroupArgs.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 3.62.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.alicloud.ecs.kotlin

import com.pulumi.alicloud.ecs.SecurityGroupArgs.builder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import kotlin.Boolean
import kotlin.Deprecated
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Provides a Security Group resource.
 * For information about Security Group and how to use it, see [What is Security Group](https://www.alibabacloud.com/help/en/ecs/developer-reference/api-createsecuritygroup).
 * > **NOTE:** Available since v1.0.0.
 * > **NOTE:** `alicloud.ecs.SecurityGroup` is used to build and manage a security group, and `alicloud.ecs.SecurityGroupRule` can define ingress or egress rules for it.
 * > **NOTE:** From version 1.7.2, `alicloud.ecs.SecurityGroup` has supported to segregate different ECS instance in which the same security group.
 * ## Example Usage
 * Basic Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as alicloud from "@pulumi/alicloud";
 * const _default = new alicloud.ecs.SecurityGroup("default", {
 *     name: "terraform-example",
 *     description: "New security group",
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_alicloud as alicloud
 * default = alicloud.ecs.SecurityGroup("default",
 *     name="terraform-example",
 *     description="New security group")
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AliCloud = Pulumi.AliCloud;
 * return await Deployment.RunAsync(() =>
 * {
 *     var @default = new AliCloud.Ecs.SecurityGroup("default", new()
 *     {
 *         Name = "terraform-example",
 *         Description = "New security group",
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
 * 			Name:        pulumi.String("terraform-example"),
 * 			Description: pulumi.String("New security group"),
 * 		})
 * 		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.alicloud.ecs.SecurityGroup;
 * import com.pulumi.alicloud.ecs.SecurityGroupArgs;
 * 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 default_ = new SecurityGroup("default", SecurityGroupArgs.builder()
 *             .name("terraform-example")
 *             .description("New security group")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: alicloud:ecs:SecurityGroup
 *     properties:
 *       name: terraform-example
 *       description: New security group
 * ```
 * 
 * Basic Usage for VPC
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as alicloud from "@pulumi/alicloud";
 * const vpc = new alicloud.vpc.Network("vpc", {
 *     vpcName: "terraform-example",
 *     cidrBlock: "10.1.0.0/21",
 * });
 * const group = new alicloud.ecs.SecurityGroup("group", {
 *     name: "terraform-example",
 *     vpcId: vpc.id,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_alicloud as alicloud
 * vpc = alicloud.vpc.Network("vpc",
 *     vpc_name="terraform-example",
 *     cidr_block="10.1.0.0/21")
 * group = alicloud.ecs.SecurityGroup("group",
 *     name="terraform-example",
 *     vpc_id=vpc.id)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AliCloud = Pulumi.AliCloud;
 * return await Deployment.RunAsync(() =>
 * {
 *     var vpc = new AliCloud.Vpc.Network("vpc", new()
 *     {
 *         VpcName = "terraform-example",
 *         CidrBlock = "10.1.0.0/21",
 *     });
 *     var @group = new AliCloud.Ecs.SecurityGroup("group", new()
 *     {
 *         Name = "terraform-example",
 *         VpcId = vpc.Id,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
 * 	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		vpc, err := vpc.NewNetwork(ctx, "vpc", &vpc.NetworkArgs{
 * 			VpcName:   pulumi.String("terraform-example"),
 * 			CidrBlock: pulumi.String("10.1.0.0/21"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = ecs.NewSecurityGroup(ctx, "group", &ecs.SecurityGroupArgs{
 * 			Name:  pulumi.String("terraform-example"),
 * 			VpcId: vpc.ID(),
 * 		})
 * 		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.alicloud.vpc.Network;
 * import com.pulumi.alicloud.vpc.NetworkArgs;
 * import com.pulumi.alicloud.ecs.SecurityGroup;
 * import com.pulumi.alicloud.ecs.SecurityGroupArgs;
 * 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 vpc = new Network("vpc", NetworkArgs.builder()
 *             .vpcName("terraform-example")
 *             .cidrBlock("10.1.0.0/21")
 *             .build());
 *         var group = new SecurityGroup("group", SecurityGroupArgs.builder()
 *             .name("terraform-example")
 *             .vpcId(vpc.id())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   vpc:
 *     type: alicloud:vpc:Network
 *     properties:
 *       vpcName: terraform-example
 *       cidrBlock: 10.1.0.0/21
 *   group:
 *     type: alicloud:ecs:SecurityGroup
 *     properties:
 *       name: terraform-example
 *       vpcId: ${vpc.id}
 * ```
 * 
 * ## Module Support
 * You can use the existing security-group module
 * to create a security group and add several rules one-click.
 * ## Import
 * Security Group can be imported using the id, e.g.
 * ```sh
 * $ pulumi import alicloud:ecs/securityGroup:SecurityGroup example sg-abc123456
 * ```
 * @property description The security group description. Defaults to null.
 * @property innerAccess Field `inner_access` has been deprecated from provider version 1.55.3. New field `inner_access_policy` instead.
 * Combining security group rules, the policy can define multiple application scenario. Default to true. It is valid from version `1.7.2`.
 * @property innerAccessPolicy The internal access control policy of the security group. Valid values: `Accept`, `Drop`.
 * @property name The name of the security group. Defaults to null.
 * @property resourceGroupId The ID of the resource group to which the security group belongs. **NOTE:** From version 1.115.0, `resource_group_id` can be modified.
 * @property securityGroupType The type of the security group. Valid values:
 * @property tags A mapping of tags to assign to the resource.
 * @property vpcId The ID of the VPC.
 */
public data class SecurityGroupArgs(
    public val description: Output? = null,
    @Deprecated(
        message = """
  Field `inner_access` has been deprecated from provider version 1.55.3. Use `inner_access_policy`
      replaces it.
  """,
    )
    public val innerAccess: Output? = null,
    public val innerAccessPolicy: Output? = null,
    public val name: Output? = null,
    public val resourceGroupId: Output? = null,
    public val securityGroupType: Output? = null,
    public val tags: Output>? = null,
    public val vpcId: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.alicloud.ecs.SecurityGroupArgs =
        com.pulumi.alicloud.ecs.SecurityGroupArgs.builder()
            .description(description?.applyValue({ args0 -> args0 }))
            .innerAccess(innerAccess?.applyValue({ args0 -> args0 }))
            .innerAccessPolicy(innerAccessPolicy?.applyValue({ args0 -> args0 }))
            .name(name?.applyValue({ args0 -> args0 }))
            .resourceGroupId(resourceGroupId?.applyValue({ args0 -> args0 }))
            .securityGroupType(securityGroupType?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .vpcId(vpcId?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [SecurityGroupArgs].
 */
@PulumiTagMarker
public class SecurityGroupArgsBuilder internal constructor() {
    private var description: Output? = null

    private var innerAccess: Output? = null

    private var innerAccessPolicy: Output? = null

    private var name: Output? = null

    private var resourceGroupId: Output? = null

    private var securityGroupType: Output? = null

    private var tags: Output>? = null

    private var vpcId: Output? = null

    /**
     * @param value The security group description. Defaults to null.
     */
    @JvmName("jlhkejmflsxmtarr")
    public suspend fun description(`value`: Output) {
        this.description = value
    }

    /**
     * @param value Field `inner_access` has been deprecated from provider version 1.55.3. New field `inner_access_policy` instead.
     * Combining security group rules, the policy can define multiple application scenario. Default to true. It is valid from version `1.7.2`.
     */
    @Deprecated(
        message = """
  Field `inner_access` has been deprecated from provider version 1.55.3. Use `inner_access_policy`
      replaces it.
  """,
    )
    @JvmName("lbdmtdbcigqqtult")
    public suspend fun innerAccess(`value`: Output) {
        this.innerAccess = value
    }

    /**
     * @param value The internal access control policy of the security group. Valid values: `Accept`, `Drop`.
     */
    @JvmName("olsvtbuochtsgoxj")
    public suspend fun innerAccessPolicy(`value`: Output) {
        this.innerAccessPolicy = value
    }

    /**
     * @param value The name of the security group. Defaults to null.
     */
    @JvmName("sbxugjgxdcdlyisa")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The ID of the resource group to which the security group belongs. **NOTE:** From version 1.115.0, `resource_group_id` can be modified.
     */
    @JvmName("indqigkkonmhlowd")
    public suspend fun resourceGroupId(`value`: Output) {
        this.resourceGroupId = value
    }

    /**
     * @param value The type of the security group. Valid values:
     */
    @JvmName("hfglteftjjglpmil")
    public suspend fun securityGroupType(`value`: Output) {
        this.securityGroupType = value
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("tyxvfnvkwxhrnxyt")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value The ID of the VPC.
     */
    @JvmName("uvejwawqricggnuc")
    public suspend fun vpcId(`value`: Output) {
        this.vpcId = value
    }

    /**
     * @param value The security group description. Defaults to null.
     */
    @JvmName("tpsaqnktnnedmcoh")
    public suspend fun description(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.description = mapped
    }

    /**
     * @param value Field `inner_access` has been deprecated from provider version 1.55.3. New field `inner_access_policy` instead.
     * Combining security group rules, the policy can define multiple application scenario. Default to true. It is valid from version `1.7.2`.
     */
    @Deprecated(
        message = """
  Field `inner_access` has been deprecated from provider version 1.55.3. Use `inner_access_policy`
      replaces it.
  """,
    )
    @JvmName("vbjjhpysfkywqrbb")
    public suspend fun innerAccess(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.innerAccess = mapped
    }

    /**
     * @param value The internal access control policy of the security group. Valid values: `Accept`, `Drop`.
     */
    @JvmName("vpkcarcsmxnrgiqn")
    public suspend fun innerAccessPolicy(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.innerAccessPolicy = mapped
    }

    /**
     * @param value The name of the security group. Defaults to null.
     */
    @JvmName("ocgocypwuqhkhdim")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The ID of the resource group to which the security group belongs. **NOTE:** From version 1.115.0, `resource_group_id` can be modified.
     */
    @JvmName("hcdhgyflkqumlcqk")
    public suspend fun resourceGroupId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupId = mapped
    }

    /**
     * @param value The type of the security group. Valid values:
     */
    @JvmName("upmepqcftvnhddlr")
    public suspend fun securityGroupType(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.securityGroupType = mapped
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("egurvkxakhqoocfs")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags to assign to the resource.
     */
    @JvmName("cigrmpmoebkkyxqf")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value The ID of the VPC.
     */
    @JvmName("cefmxptkhwpptqsc")
    public suspend fun vpcId(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.vpcId = mapped
    }

    internal fun build(): SecurityGroupArgs = SecurityGroupArgs(
        description = description,
        innerAccess = innerAccess,
        innerAccessPolicy = innerAccessPolicy,
        name = name,
        resourceGroupId = resourceGroupId,
        securityGroupType = securityGroupType,
        tags = tags,
        vpcId = vpcId,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy