com.pulumi.kafka.Topic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kafka Show documentation
Show all versions of kafka Show documentation
A Pulumi package for creating and managing Kafka.
// *** 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.kafka;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import com.pulumi.kafka.TopicArgs;
import com.pulumi.kafka.Utilities;
import com.pulumi.kafka.inputs.TopicState;
import java.lang.Integer;
import java.lang.String;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* A resource for managing Kafka topics. Increases partition count without destroying the topic.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.kafka.Topic;
* import com.pulumi.kafka.TopicArgs;
* 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 logs = new Topic("logs", TopicArgs.builder()
* .name("systemd_logs")
* .replicationFactor(2)
* .partitions(100)
* .config(Map.ofEntries(
* Map.entry("segment.ms", "20000"),
* Map.entry("cleanup.policy", "compact")
* ))
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
* ## Import
*
* Topics can be imported using their ARN, e.g.
*
* ```sh
* $ pulumi import kafka:index/topic:Topic logs systemd_logs
* ```
*
*/
@ResourceType(type="kafka:index/topic:Topic")
public class Topic extends com.pulumi.resources.CustomResource {
/**
* A map of string k/v attributes.
*
*/
@Export(name="config", refs={Map.class,String.class}, tree="[0,1,1]")
private Output* @Nullable */ Map> config;
/**
* @return A map of string k/v attributes.
*
*/
public Output>> config() {
return Codegen.optional(this.config);
}
/**
* The name of the topic.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the topic.
*
*/
public Output name() {
return this.name;
}
/**
* The number of partitions the topic should have.
*
*/
@Export(name="partitions", refs={Integer.class}, tree="[0]")
private Output partitions;
/**
* @return The number of partitions the topic should have.
*
*/
public Output partitions() {
return this.partitions;
}
/**
* The number of replicas the topic should have.
*
*/
@Export(name="replicationFactor", refs={Integer.class}, tree="[0]")
private Output replicationFactor;
/**
* @return The number of replicas the topic should have.
*
*/
public Output replicationFactor() {
return this.replicationFactor;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public Topic(java.lang.String name) {
this(name, TopicArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public Topic(java.lang.String name, TopicArgs 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 Topic(java.lang.String name, TopicArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("kafka:index/topic:Topic", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private Topic(java.lang.String name, Output id, @Nullable TopicState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("kafka:index/topic:Topic", name, state, makeResourceOptions(options, id), false);
}
private static TopicArgs makeArgs(TopicArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? TopicArgs.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())
.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 Topic get(java.lang.String name, Output id, @Nullable TopicState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new Topic(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy