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

com.atlassian.bamboo.specs.builders.repository.git.SshPrivateKeyAuthentication Maven / Gradle / Ivy

There is a newer version: 10.1.0
Show newest version
package com.atlassian.bamboo.specs.builders.repository.git;

import com.atlassian.bamboo.specs.api.builders.EntityPropertiesBuilder;
import com.atlassian.bamboo.specs.model.repository.git.SshPrivateKeyAuthenticationProperties;
import org.jetbrains.annotations.Nullable;

import static com.atlassian.bamboo.specs.api.validators.common.ImporterUtils.checkNotNull;

/**
 * SSH private key authentication for git repository.
 */
public class SshPrivateKeyAuthentication extends EntityPropertiesBuilder {
    private String sshPrivateKey;
    private String passphrase;

    /**
     * Specifies new ssh credentials with given private key.
     * The key can be both in Bamboo encrypted and plain form.
     *
     * @param sshPrivateKey private key
     * @see Encryption in Bamboo Specs
     */
    public SshPrivateKeyAuthentication(String sshPrivateKey) {
        checkNotNull("sshPrivateKey", sshPrivateKey);

        this.sshPrivateKey = sshPrivateKey;
    }

    /**
     * Sets private key.
     * The key can be both in Bamboo encrypted and plain form.
     *
     * @param sshPrivateKey private key
     * @see Encryption in Bamboo Specs
     */
    public SshPrivateKeyAuthentication sshPrivateKey(String sshPrivateKey) {
        checkNotNull("sshPrivateKey", sshPrivateKey);

        this.sshPrivateKey = sshPrivateKey;
        return this;
    }

    /**
     * Sets passphrase for the private key.
     * The passphrase can be both in Bamboo encrypted and plain form.
     *
     * @param passphrase passphrase
     * @see Encryption in Bamboo Specs
     */
    public SshPrivateKeyAuthentication passphrase(@Nullable String passphrase) {
        this.passphrase = passphrase;
        return this;
    }

    protected SshPrivateKeyAuthenticationProperties build() {
        return new SshPrivateKeyAuthenticationProperties(sshPrivateKey, passphrase);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy