Class CheckOptions


  • public class CheckOptions
    extends Object
    Options used to register checks in Consul.
    Author:
    Ruslan Sennov
    • Constructor Detail

      • CheckOptions

        public CheckOptions()
        Default constructor
      • CheckOptions

        public CheckOptions​(CheckOptions options)
        Copy constructor
        Parameters:
        options - the one to copy
      • CheckOptions

        public CheckOptions​(JsonObject options)
        Constructor from JSON
        Parameters:
        options - the JSON
    • Method Detail

      • toJson

        public JsonObject toJson()
        Convert to JSON
        Returns:
        the JSON
      • getServiceId

        public String getServiceId()
        Get the service ID to associate the registered check with an existing service provided by the agent.
        Returns:
        the service ID
      • setServiceId

        public CheckOptions setServiceId​(String serviceId)
        Set the service ID to associate the registered check with an existing service provided by the agent.
        Parameters:
        serviceId - the service ID
        Returns:
        reference to this, for fluency
      • getStatus

        public CheckStatus getStatus()
        Get the check status to specify the initial state of the health check.
        Returns:
        the check status
      • setStatus

        public CheckOptions setStatus​(CheckStatus status)
        Set the check status to specify the initial state of the health check.
        Parameters:
        status - the check status
        Returns:
        reference to this, for fluency
      • getScriptArgs

        public List<String> getScriptArgs()
        Get scriptArgs
        Returns:
        scriptArgs
      • setScriptArgs

        public CheckOptions setScriptArgs​(List<String> scriptArgs)
        Set scriptArgs. Also you should set checking interval
        Parameters:
        scriptArgs -
        Returns:
        reference to this, for fluency
      • getHttp

        public String getHttp()
        Get HTTP address
        Returns:
        HTTP address
      • setHttp

        public CheckOptions setHttp​(String http)
        Set HTTP address to check. Also you should set checking interval
        Parameters:
        http - HTTP address
        Returns:
        reference to this, for fluency
      • getHeaders

        public Map<String,​List<String>> getHeaders()
        Get header map
        Returns:
        header map
      • setHeaders

        public CheckOptions setHeaders​(Map<String,​List<String>> header)
        Set headers to check
        Parameters:
        header - header map
        Returns:
        reference to this, for fluency
      • getGrpc

        public String getGrpc()
        Specifies a gRPC check's endpoint that supports the standard gRPC health checking protocol. The state of the check will be updated at the given Interval by probing the configured endpoint. The endpoint must be represented as address:port/service
        Returns:
        gRPC endpoint
      • setGrpc

        public CheckOptions setGrpc​(String grpc)
        Specifies a gRPC check's endpoint that supports the standard gRPC health checking protocol. The state of the check will be updated at the given Interval by probing the configured endpoint. The endpoint must be represented as address:port/service
        Parameters:
        grpc - endpoint
      • isGrpcTls

        public boolean isGrpcTls()
        Specifies whether to use TLS for this gRPC health check. If TLS is enabled, then by default, a valid TLS certificate is expected. Certificate verification can be turned off by setting TLSSkipVerify to true.
        Returns:
        true if TLS is enabled
      • setGrpcTls

        public CheckOptions setGrpcTls​(boolean grpcTls)
        Specifies whether to use TLS for this gRPC health check. If TLS is enabled, then by default, a valid TLS certificate is expected. Certificate verification can be turned off by setting TLSSkipVerify to true.
        Parameters:
        grpcTls - true if TLS is enabled
      • isTlsSkipVerify

        public boolean isTlsSkipVerify()
        Specifies if the certificate for an HTTPS check should not be verified.
        Returns:
        true if the certificate for an HTTPS check should not be verified.
      • setTlsSkipVerify

        public CheckOptions setTlsSkipVerify​(boolean tlsSkipVerify)
        Specifies if the certificate for an HTTPS check should not be verified.
        Parameters:
        tlsSkipVerify - true if the certificate for an HTTPS check should not be verified.
      • getTtl

        public String getTtl()
        Get Time to Live of check
        Returns:
        Time to Live of check
      • setTtl

        public CheckOptions setTtl​(String ttl)
        Set Time to Live of check.
        Parameters:
        ttl - Time to Live of check
        Returns:
        reference to this, for fluency
      • getTcp

        public String getTcp()
        Get TCP address. Also you should set checking interval
        Returns:
        TCP address
      • setTcp

        public CheckOptions setTcp​(String tcp)
        Set TCP address to check. Also you should set checking interval
        Parameters:
        tcp - TCP address
        Returns:
        reference to this, for fluency
      • getInterval

        public String getInterval()
        Get checking interval
        Returns:
        interval
      • setInterval

        public CheckOptions setInterval​(String interval)
        Set checking interval
        Parameters:
        interval - checking interval in Go's time format which is sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
        Returns:
        reference to this, for fluency
      • getId

        public String getId()
        Get check ID
        Returns:
        check ID
      • setId

        public CheckOptions setId​(String id)
        Set check ID
        Parameters:
        id - check ID
        Returns:
        reference to this, for fluency
      • getName

        public String getName()
        Get check name
        Returns:
        check name
      • setName

        public CheckOptions setName​(String name)
        Set check name. This is mandatory field
        Parameters:
        name - check name
        Returns:
        reference to this, for fluency
      • getNotes

        public String getNotes()
        Get check notes
        Returns:
        check notes
      • setNotes

        public CheckOptions setNotes​(String notes)
        Set check notes
        Parameters:
        notes - check notes
        Returns:
        reference to this, for fluency
      • getDeregisterAfter

        public String getDeregisterAfter()
        Get deregister timeout
        Returns:
        timeout
      • setDeregisterAfter

        public CheckOptions setDeregisterAfter​(String deregisterAfter)
        Set deregister timeout. This is optional field, which is a timeout in the same time format as Interval and TTL. If a check is associated with a service and has the critical state for more than this configured value, then its associated service (and all of its associated checks) will automatically be deregistered. The minimum timeout is 1 minute, and the process that reaps critical services runs every 30 seconds, so it may take slightly longer than the configured timeout to trigger the deregistration. This should generally be configured with a timeout that's much, much longer than any expected recoverable outage for the given service.
        Parameters:
        deregisterAfter - timeout
        Returns:
        reference to this, for fluency