com.pulumi.alicloud.rocketmq.kotlin.Group.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-alicloud-kotlin Show documentation
Show all versions of pulumi-alicloud-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.alicloud.rocketmq.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.Deprecated
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
/**
* Builder for [Group].
*/
@PulumiTagMarker
public class GroupResourceBuilder internal constructor() {
public var name: String? = null
public var args: GroupArgs = GroupArgs()
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 GroupArgsBuilder.() -> Unit) {
val builder = GroupArgsBuilder()
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(): Group {
val builtJavaResource = com.pulumi.alicloud.rocketmq.Group(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Group(builtJavaResource)
}
}
/**
* Provides an ONS group resource.
* For more information about how to use it, see [RocketMQ Group Management API](https://www.alibabacloud.com/help/doc-detail/29616.html).
* > **NOTE:** Available in 1.53.0+
* ## Example Usage
* Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as alicloud from "@pulumi/alicloud";
* import * as random from "@pulumi/random";
* const config = new pulumi.Config();
* const name = config.get("name") || "GID-tf-example";
* const groupName = config.get("groupName") || "GID-tf-example";
* const _default = new random.index.Integer("default", {
* min: 10000,
* max: 99999,
* });
* const defaultInstance = new alicloud.rocketmq.Instance("default", {instanceName: `${name}-${_default.result}`});
* const defaultGroup = new alicloud.rocketmq.Group("default", {
* groupName: groupName,
* instanceId: defaultInstance.id,
* remark: "dafault_ons_group_remark",
* });
* ```
* ```python
* import pulumi
* import pulumi_alicloud as alicloud
* import pulumi_random as random
* config = pulumi.Config()
* name = config.get("name")
* if name is None:
* name = "GID-tf-example"
* group_name = config.get("groupName")
* if group_name is None:
* group_name = "GID-tf-example"
* default = random.index.Integer("default",
* min=10000,
* max=99999)
* default_instance = alicloud.rocketmq.Instance("default", instance_name=f"{name}-{default['result']}")
* default_group = alicloud.rocketmq.Group("default",
* group_name=group_name,
* instance_id=default_instance.id,
* remark="dafault_ons_group_remark")
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using AliCloud = Pulumi.AliCloud;
* using Random = Pulumi.Random;
* return await Deployment.RunAsync(() =>
* {
* var config = new Config();
* var name = config.Get("name") ?? "GID-tf-example";
* var groupName = config.Get("groupName") ?? "GID-tf-example";
* var @default = new Random.Index.Integer("default", new()
* {
* Min = 10000,
* Max = 99999,
* });
* var defaultInstance = new AliCloud.RocketMQ.Instance("default", new()
* {
* InstanceName = $"{name}-{@default.Result}",
* });
* var defaultGroup = new AliCloud.RocketMQ.Group("default", new()
* {
* GroupName = groupName,
* InstanceId = defaultInstance.Id,
* Remark = "dafault_ons_group_remark",
* });
* });
* ```
* ```go
* package main
* import (
* "fmt"
* "github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rocketmq"
* "github.com/pulumi/pulumi-random/sdk/v4/go/random"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* cfg := config.New(ctx, "")
* name := "GID-tf-example"
* if param := cfg.Get("name"); param != "" {
* name = param
* }
* groupName := "GID-tf-example"
* if param := cfg.Get("groupName"); param != "" {
* groupName = param
* }
* _, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
* Min: 10000,
* Max: 99999,
* })
* if err != nil {
* return err
* }
* defaultInstance, err := rocketmq.NewInstance(ctx, "default", &rocketmq.InstanceArgs{
* InstanceName: pulumi.Sprintf("%v-%v", name, _default.Result),
* })
* if err != nil {
* return err
* }
* _, err = rocketmq.NewGroup(ctx, "default", &rocketmq.GroupArgs{
* GroupName: pulumi.String(groupName),
* InstanceId: defaultInstance.ID(),
* Remark: pulumi.String("dafault_ons_group_remark"),
* })
* 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.random.integer;
* import com.pulumi.random.IntegerArgs;
* import com.pulumi.alicloud.rocketmq.Instance;
* import com.pulumi.alicloud.rocketmq.InstanceArgs;
* import com.pulumi.alicloud.rocketmq.Group;
* import com.pulumi.alicloud.rocketmq.GroupArgs;
* 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) {
* final var config = ctx.config();
* final var name = config.get("name").orElse("GID-tf-example");
* final var groupName = config.get("groupName").orElse("GID-tf-example");
* var default_ = new Integer("default", IntegerArgs.builder()
* .min(10000)
* .max(99999)
* .build());
* var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
* .instanceName(String.format("%s-%s", name,default_.result()))
* .build());
* var defaultGroup = new Group("defaultGroup", GroupArgs.builder()
* .groupName(groupName)
* .instanceId(defaultInstance.id())
* .remark("dafault_ons_group_remark")
* .build());
* }
* }
* ```
* ```yaml
* configuration:
* name:
* type: string
* default: GID-tf-example
* groupName:
* type: string
* default: GID-tf-example
* resources:
* default:
* type: random:integer
* properties:
* min: 10000
* max: 99999
* defaultInstance:
* type: alicloud:rocketmq:Instance
* name: default
* properties:
* instanceName: ${name}-${default.result}
* defaultGroup:
* type: alicloud:rocketmq:Group
* name: default
* properties:
* groupName: ${groupName}
* instanceId: ${defaultInstance.id}
* remark: dafault_ons_group_remark
* ```
*
* ## Import
* ONS GROUP can be imported using the id, e.g.
* ```sh
* $ pulumi import alicloud:rocketmq/group:Group group MQ_INST_1234567890_Baso1234567:GID-onsGroupDemo
* ```
*/
public class Group internal constructor(
override val javaResource: com.pulumi.alicloud.rocketmq.Group,
) : KotlinCustomResource(javaResource, GroupMapper) {
/**
* Replaced by `group_name` after version 1.98.0.
*/
@Deprecated(
message = """
Field 'group_id' has been deprecated from version 1.98.0. Use 'group_name' instead.
""",
)
public val groupId: Output
get() = javaResource.groupId().applyValue({ args0 -> args0 })
/**
* Name of the group. Two groups on a single instance cannot have the same name. A `group_name` starts with "GID_" or "GID-", and contains letters, numbers, hyphens (-), and underscores (_).
*/
public val groupName: Output
get() = javaResource.groupName().applyValue({ args0 -> args0 })
/**
* Specify the protocol applicable to the created Group ID. Valid values: `tcp`, `http`. Default to `tcp`.
*/
public val groupType: Output?
get() = javaResource.groupType().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* ID of the ONS Instance that owns the groups.
*/
public val instanceId: Output
get() = javaResource.instanceId().applyValue({ args0 -> args0 })
/**
* This attribute is used to set the message reading enabled or disabled. It can only be set after the group is used by the client.
*/
public val readEnable: Output?
get() = javaResource.readEnable().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* This attribute is a concise description of group. The length cannot exceed 256.
*/
public val remark: Output?
get() = javaResource.remark().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* A mapping of tags to assign to the resource.
* - Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
* - Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
*/
public val tags: Output