cd.go.contrib.plugins.configrepo.groovy.dsl.ScmMaterial Maven / Gradle / Ivy
Show all versions of dsl Show documentation
// Generated by delombok at Thu May 16 19:58:20 PDT 2024
/*
* Copyright 2022 Thoughtworks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cd.go.contrib.plugins.configrepo.groovy.dsl;
import cd.go.contrib.plugins.configrepo.groovy.dsl.mixins.Notifies;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.Valid;
import java.util.List;
import java.util.function.Consumer;
import static lombok.AccessLevel.NONE;
public abstract class ScmMaterial> extends Material implements Notifies.MaterialMixin {
@JsonProperty("username")
protected String username;
/**
* The encrypted password
*
* @see Encryption API
*/
@JsonProperty("encrypted_password")
@JsonInclude(JsonInclude.Include.NON_NULL)
protected String encryptedPassword;
/**
* The plain text password in the form of secret param*
* Use encrypted password instead
*
* @see secrets
*/
@JsonProperty("password")
@JsonInclude(JsonInclude.Include.NON_NULL)
protected String password;
/**
* The directory under the sandbox of Go Agent. GoCD will check out the source code into this directory.
*/
@JsonProperty("destination")
private String destination;
/**
* By default GoCD polls the repository for changes automatically. If {@code autoUpdate} is set to {@code false}
* then GoCD will not poll the repository for changes. Instead it will check for changes only when you trigger a
* pipeline that contains this material. If the same material is specified more than once in the configuration file,
* all of them must have the same value for {@code autoUpdate}.
*/
@JsonProperty("auto_update")
private Boolean autoUpdate = true;
/**
* The {@link Filter} element specifies files in changesets that should not trigger a pipeline automatically. When a
* pipeline is triggered by files that are not ignored the filtered files will still be updated with other files.
* You can only define one filter under each SCM material. When you trigger a pipeline manually, it will update to
* most recent revision, including filtered files.
*
* {@includeCode scm.filter.groovy }
*/
@JsonProperty("filter")
@Valid
private Filter filter;
ScmMaterial() {
super();
}
ScmMaterial(String name) {
super(name);
}
ScmMaterial(String name, Consumer configure) {
super(name);
//noinspection unchecked
configure.accept((T) this);
}
@JsonIgnore
public List getBlacklist() {
if (this.filter != null && !this.filter.isWhitelist()) {
return this.filter.getItems();
}
return null;
}
/**
* {@includeCode scm.blacklist.groovy }
*/
public void setBlacklist(List blacklist) {
filter = new Filter(blacklist);
}
@JsonIgnore
public List getWhitelist() {
if (this.filter != null && this.filter.isWhitelist()) {
return this.filter.getItems();
}
return null;
}
/**
* {@includeCode scm.whitelist.groovy }
*/
public void setWhitelist(List whitelist) {
filter = new Filter(true, whitelist);
}
protected abstract T deepClone();
@SuppressWarnings({"unchecked", "UnusedReturnValue"})
protected T injectSettings(ScmMaterial other) {
other.username = username;
other.password = password;
other.encryptedPassword = encryptedPassword;
other.autoUpdate = autoUpdate;
other.destination = destination;
if (null != filter) {
other.filter = filter.deepClone();
}
return (T) other;
}
@java.lang.SuppressWarnings("all")
public String getUsername() {
return this.username;
}
/**
* The encrypted password
*
* @see Encryption API
*/
@java.lang.SuppressWarnings("all")
public String getEncryptedPassword() {
return this.encryptedPassword;
}
/**
* The plain text password in the form of secret param*
* Use encrypted password instead
*
* @see secrets
*/
@java.lang.SuppressWarnings("all")
public String getPassword() {
return this.password;
}
/**
* The directory under the sandbox of Go Agent. GoCD will check out the source code into this directory.
*/
@java.lang.SuppressWarnings("all")
public String getDestination() {
return this.destination;
}
/**
* By default GoCD polls the repository for changes automatically. If {@code autoUpdate} is set to {@code false}
* then GoCD will not poll the repository for changes. Instead it will check for changes only when you trigger a
* pipeline that contains this material. If the same material is specified more than once in the configuration file,
* all of them must have the same value for {@code autoUpdate}.
*/
@java.lang.SuppressWarnings("all")
public Boolean getAutoUpdate() {
return this.autoUpdate;
}
@JsonProperty("username")
@java.lang.SuppressWarnings("all")
public void setUsername(final String username) {
this.username = username;
}
/**
* The encrypted password
*
* @see Encryption API
*/
@JsonProperty("encrypted_password")
@java.lang.SuppressWarnings("all")
public void setEncryptedPassword(final String encryptedPassword) {
this.encryptedPassword = encryptedPassword;
}
/**
* The plain text password in the form of secret param*
* Use encrypted password instead
*
* @see secrets
*/
@JsonProperty("password")
@java.lang.SuppressWarnings("all")
public void setPassword(final String password) {
this.password = password;
}
/**
* The directory under the sandbox of Go Agent. GoCD will check out the source code into this directory.
*/
@JsonProperty("destination")
@java.lang.SuppressWarnings("all")
public void setDestination(final String destination) {
this.destination = destination;
}
/**
* By default GoCD polls the repository for changes automatically. If {@code autoUpdate} is set to {@code false}
* then GoCD will not poll the repository for changes. Instead it will check for changes only when you trigger a
* pipeline that contains this material. If the same material is specified more than once in the configuration file,
* all of them must have the same value for {@code autoUpdate}.
*/
@JsonProperty("auto_update")
@java.lang.SuppressWarnings("all")
public void setAutoUpdate(final Boolean autoUpdate) {
this.autoUpdate = autoUpdate;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof ScmMaterial)) return false;
final ScmMaterial> other = (ScmMaterial>) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (!super.equals(o)) return false;
final java.lang.Object this$autoUpdate = this.getAutoUpdate();
final java.lang.Object other$autoUpdate = other.getAutoUpdate();
if (this$autoUpdate == null ? other$autoUpdate != null : !this$autoUpdate.equals(other$autoUpdate)) return false;
final java.lang.Object this$username = this.getUsername();
final java.lang.Object other$username = other.getUsername();
if (this$username == null ? other$username != null : !this$username.equals(other$username)) return false;
final java.lang.Object this$encryptedPassword = this.getEncryptedPassword();
final java.lang.Object other$encryptedPassword = other.getEncryptedPassword();
if (this$encryptedPassword == null ? other$encryptedPassword != null : !this$encryptedPassword.equals(other$encryptedPassword)) return false;
final java.lang.Object this$password = this.getPassword();
final java.lang.Object other$password = other.getPassword();
if (this$password == null ? other$password != null : !this$password.equals(other$password)) return false;
final java.lang.Object this$destination = this.getDestination();
final java.lang.Object other$destination = other.getDestination();
if (this$destination == null ? other$destination != null : !this$destination.equals(other$destination)) return false;
final java.lang.Object this$filter = this.filter;
final java.lang.Object other$filter = other.filter;
if (this$filter == null ? other$filter != null : !this$filter.equals(other$filter)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
protected boolean canEqual(final java.lang.Object other) {
return other instanceof ScmMaterial;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
final java.lang.Object $autoUpdate = this.getAutoUpdate();
result = result * PRIME + ($autoUpdate == null ? 43 : $autoUpdate.hashCode());
final java.lang.Object $username = this.getUsername();
result = result * PRIME + ($username == null ? 43 : $username.hashCode());
final java.lang.Object $encryptedPassword = this.getEncryptedPassword();
result = result * PRIME + ($encryptedPassword == null ? 43 : $encryptedPassword.hashCode());
final java.lang.Object $password = this.getPassword();
result = result * PRIME + ($password == null ? 43 : $password.hashCode());
final java.lang.Object $destination = this.getDestination();
result = result * PRIME + ($destination == null ? 43 : $destination.hashCode());
final java.lang.Object $filter = this.filter;
result = result * PRIME + ($filter == null ? 43 : $filter.hashCode());
return result;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
return "ScmMaterial(super=" + super.toString() + ", username=" + this.getUsername() + ", encryptedPassword=" + this.getEncryptedPassword() + ", password=" + this.getPassword() + ", destination=" + this.getDestination() + ", autoUpdate=" + this.getAutoUpdate() + ", filter=" + this.filter + ")";
}
}