io.vertx.kotlin.ext.consul.SessionOptions.kt Maven / Gradle / Ivy
/*
* Copyright 2019 Red Hat, Inc.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
*
* The Eclipse Public License is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* The Apache License v2.0 is available at
* http://www.opensource.org/licenses/apache2.0.php
*
* You may elect to redistribute this code under either of these licenses.
*/
package io.vertx.kotlin.ext.consul
import io.vertx.ext.consul.SessionOptions
import io.vertx.ext.consul.SessionBehavior
/**
* A function providing a DSL for building [io.vertx.ext.consul.SessionOptions] objects.
*
* Options used to create session.
*
* @param lockDelay Set the lock-delay period.
* @param name Set the human-readable name for the Session
* @param node Set the node to which the session will be assigned
* @param checks Set a list of associated health checks. It is highly recommended that, if you override this list, you include the default "serfHealth"
* @param behavior Set the behavior when a session is invalidated. The release behavior is the default if none is specified.
* @param ttl Set the TTL interval. When TTL interval expires without being renewed, the session has expired and an invalidation is triggered. If specified, it must be between 10s
and 86400s
currently. The contract of a TTL is that it represents a lower bound for invalidation; that is, Consul will not expire the session before the TTL is reached, but it is allowed to delay the expiration past the TTL. The lowest practical TTL should be used to keep the number of managed sessions low. When locks are forcibly expired, such as during a leader election, sessions may not be reaped for up to double this TTL, so long TTL values (> 1 hour) should be avoided.
*
*
* NOTE: This function has been automatically generated from the [io.vertx.ext.consul.SessionOptions original] using Vert.x codegen.
*/
fun sessionOptionsOf(
lockDelay: Long? = null,
name: String? = null,
node: String? = null,
checks: Iterable? = null,
behavior: SessionBehavior? = null,
ttl: Long? = null): SessionOptions = io.vertx.ext.consul.SessionOptions().apply {
if (lockDelay != null) {
this.setLockDelay(lockDelay)
}
if (name != null) {
this.setName(name)
}
if (node != null) {
this.setNode(node)
}
if (checks != null) {
this.setChecks(checks.toList())
}
if (behavior != null) {
this.setBehavior(behavior)
}
if (ttl != null) {
this.setTtl(ttl)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy