Class Service.Builder

java.lang.Object
software.amazon.awscdk.services.servicediscovery.Service.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<Service>
Enclosing class:
Service

@Stability(Stable) public static final class Service.Builder extends Object implements software.amazon.jsii.Builder<Service>
A fluent builder for Service.
  • Method Details

    • create

      @Stability(Stable) public static Service.Builder create(software.constructs.Construct scope, String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      Returns:
      a new instance of Service.Builder.
    • customHealthCheck

      @Stability(Stable) public Service.Builder customHealthCheck(HealthCheckCustomConfig customHealthCheck)
      Structure containing failure threshold for a custom health checker.

      Only one of healthCheckConfig or healthCheckCustomConfig can be specified. See: https://docs.aws.amazon.com/cloud-map/latest/api/API_HealthCheckCustomConfig.html

      Default: none

      Parameters:
      customHealthCheck - Structure containing failure threshold for a custom health checker. This parameter is required.
      Returns:
      this
    • description

      @Stability(Stable) public Service.Builder description(String description)
      A description of the service.

      Default: none

      Parameters:
      description - A description of the service. This parameter is required.
      Returns:
      this
    • healthCheck

      @Stability(Stable) public Service.Builder healthCheck(HealthCheckConfig healthCheck)
      Settings for an optional health check.

      If you specify health check settings, AWS Cloud Map associates the health check with the records that you specify in DnsConfig. Only one of healthCheckConfig or healthCheckCustomConfig can be specified. Not valid for PrivateDnsNamespaces. If you use healthCheck, you can only register IP instances to this service.

      Default: none

      Parameters:
      healthCheck - Settings for an optional health check. This parameter is required.
      Returns:
      this
    • name

      @Stability(Stable) public Service.Builder name(String name)
      A name for the Service.

      Default: CloudFormation-generated name

      Parameters:
      name - A name for the Service. This parameter is required.
      Returns:
      this
    • discoveryType

      @Stability(Stable) public Service.Builder discoveryType(DiscoveryType discoveryType)
      Controls how instances within this service can be discovered.

      Default: DNS_AND_API

      Parameters:
      discoveryType - Controls how instances within this service can be discovered. This parameter is required.
      Returns:
      this
    • dnsRecordType

      @Stability(Stable) public Service.Builder dnsRecordType(DnsRecordType dnsRecordType)
      The DNS type of the record that you want AWS Cloud Map to create.

      Supported record types include A, AAAA, A and AAAA (A_AAAA), CNAME, and SRV.

      Default: A

      Parameters:
      dnsRecordType - The DNS type of the record that you want AWS Cloud Map to create. This parameter is required.
      Returns:
      this
    • dnsTtl

      @Stability(Stable) public Service.Builder dnsTtl(Duration dnsTtl)
      The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record.

      Default: Duration.minutes(1)

      Parameters:
      dnsTtl - The amount of time, in seconds, that you want DNS resolvers to cache the settings for this record. This parameter is required.
      Returns:
      this
    • loadBalancer

      @Stability(Stable) public Service.Builder loadBalancer(Boolean loadBalancer)
      Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance.

      Setting this to true correctly configures the routingPolicy and performs some additional validation.

      Default: false

      Parameters:
      loadBalancer - Whether or not this service will have an Elastic LoadBalancer registered to it as an AliasTargetInstance. This parameter is required.
      Returns:
      this
    • routingPolicy

      @Stability(Stable) public Service.Builder routingPolicy(RoutingPolicy routingPolicy)
      The routing policy that you want to apply to all DNS records that AWS Cloud Map creates when you register an instance and specify this service.

      Default: WEIGHTED for CNAME records and when loadBalancer is true, MULTIVALUE otherwise

      Parameters:
      routingPolicy - The routing policy that you want to apply to all DNS records that AWS Cloud Map creates when you register an instance and specify this service. This parameter is required.
      Returns:
      this
    • namespace

      @Stability(Stable) public Service.Builder namespace(INamespace namespace)
      The namespace that you want to use for DNS configuration.

      Parameters:
      namespace - The namespace that you want to use for DNS configuration. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public Service build()
      Specified by:
      build in interface software.amazon.jsii.Builder<Service>
      Returns:
      a newly built instance of Service.