
com.pulumi.consul.AgentService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of consul Show documentation
Show all versions of consul Show documentation
A Pulumi package for creating and managing consul resources.
// *** 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.consul;
import com.pulumi.consul.AgentServiceArgs;
import com.pulumi.consul.Utilities;
import com.pulumi.consul.inputs.AgentServiceState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Integer;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* !> The `consul.AgentService` resource has been deprecated in version 2.0.0 of the provider
* and will be removed in a future release. Please read the [upgrade guide](https://www.terraform.io/docs/providers/consul/guides/upgrading.html#deprecation-of-consul_agent_service)
* for more information.
*
* Provides access to the agent service data in Consul. This can be used to
* define a service associated with a particular agent. Currently, defining
* health checks for an agent service is not supported.
*
* ## Example Usage
*
* <!--Start PulumiCodeChooser -->
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.consul.AgentService;
* import com.pulumi.consul.AgentServiceArgs;
* 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 app = new AgentService("app", AgentServiceArgs.builder()
* .address("www.google.com")
* .name("google")
* .port(80)
* .tags(
* "tag0",
* "tag1")
* .build());
*
* }
* }
* }
*
* <!--End PulumiCodeChooser -->
*
*/
@ResourceType(type="consul:index/agentService:AgentService")
public class AgentService extends com.pulumi.resources.CustomResource {
/**
* The address of the service. Defaults to the
* address of the agent.
*
*/
@Export(name="address", refs={String.class}, tree="[0]")
private Output address;
/**
* @return The address of the service. Defaults to the
* address of the agent.
*
*/
public Output address() {
return this.address;
}
/**
* The name of the service.
*
*/
@Export(name="name", refs={String.class}, tree="[0]")
private Output name;
/**
* @return The name of the service.
*
*/
public Output name() {
return this.name;
}
/**
* The port of the service.
*
*/
@Export(name="port", refs={Integer.class}, tree="[0]")
private Output* @Nullable */ Integer> port;
/**
* @return The port of the service.
*
*/
public Output> port() {
return Codegen.optional(this.port);
}
/**
* A list of values that are opaque to Consul,
* but can be used to distinguish between services or nodes.
*
*/
@Export(name="tags", refs={List.class,String.class}, tree="[0,1]")
private Output* @Nullable */ List> tags;
/**
* @return A list of values that are opaque to Consul,
* but can be used to distinguish between services or nodes.
*
*/
public Output>> tags() {
return Codegen.optional(this.tags);
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public AgentService(java.lang.String name) {
this(name, AgentServiceArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public AgentService(java.lang.String name, @Nullable AgentServiceArgs 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 AgentService(java.lang.String name, @Nullable AgentServiceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("consul:index/agentService:AgentService", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private AgentService(java.lang.String name, Output id, @Nullable AgentServiceState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("consul:index/agentService:AgentService", name, state, makeResourceOptions(options, id), false);
}
private static AgentServiceArgs makeArgs(@Nullable AgentServiceArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? AgentServiceArgs.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 AgentService get(java.lang.String name, Output id, @Nullable AgentServiceState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new AgentService(name, id, state, options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy