All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hidetake.gradle.ssh.api.Remote.groovy Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package org.hidetake.gradle.ssh.api

import groovy.transform.TupleConstructor

/**
 * Represents a remote host.
 *
 * @author hidetake.org
 *
 */
@TupleConstructor
class Remote {
    /**
     * Name of this instance.
     */
    final String name

    /**
     * Remote user.
     */
    String user

    /**
     * Port.
     */
    int port = 22

    /**
     * Remote host.
     */
    String host

    /**
     * Password.
     * Leave as null if public key authentication.
     */
    String password

    /**
     * Roles.
     */
    final roles = [] as List

    /**
     * Identity key file for public-key authentication.
     */
    File identity

    /**
     * Pass-phrase for the identity key.
     * This may be null.
     */
    String passphrase

    /**
     * Use agent flag.
     * If true, Putty Agent or ssh-agent will be used to authenticate.
     */
    boolean agent

    /**
     * Add a role to this remote.
     *
     * @param role
     */
    void role(String role) {
        assert role != null, 'role should be set'
        roles.add(role)
    }

    /**
     * Returns a string representation of this remote host.
     */
    @Override
    String toString() {
        "remote '${name}'"
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy