io.fabric8.openshift.api.model.miscellaneous.cloudcredential.v1.CredentialsRequestSpecFluent Maven / Gradle / Ivy
package io.fabric8.openshift.api.model.miscellaneous.cloudcredential.v1;
import java.lang.SuppressWarnings;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.model.ObjectReference;
import io.fabric8.kubernetes.api.model.ObjectReferenceFluent;
import io.fabric8.kubernetes.api.model.ObjectReferenceBuilder;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings("unchecked")
public class CredentialsRequestSpecFluent> extends BaseFluent{
public CredentialsRequestSpecFluent() {
}
public CredentialsRequestSpecFluent(CredentialsRequestSpec instance) {
this.copyInstance(instance);
}
private String cloudTokenPath;
private Map providerSpec;
private ObjectReferenceBuilder secretRef;
private List serviceAccountNames = new ArrayList();
private Map additionalProperties;
protected void copyInstance(CredentialsRequestSpec instance) {
instance = (instance != null ? instance : new CredentialsRequestSpec());
if (instance != null) {
this.withCloudTokenPath(instance.getCloudTokenPath());
this.withProviderSpec(instance.getProviderSpec());
this.withSecretRef(instance.getSecretRef());
this.withServiceAccountNames(instance.getServiceAccountNames());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
public String getCloudTokenPath() {
return this.cloudTokenPath;
}
public A withCloudTokenPath(String cloudTokenPath) {
this.cloudTokenPath = cloudTokenPath;
return (A) this;
}
public boolean hasCloudTokenPath() {
return this.cloudTokenPath != null;
}
public A addToProviderSpec(String key,Object value) {
if(this.providerSpec == null && key != null && value != null) { this.providerSpec = new LinkedHashMap(); }
if(key != null && value != null) {this.providerSpec.put(key, value);} return (A)this;
}
public A addToProviderSpec(Map map) {
if(this.providerSpec == null && map != null) { this.providerSpec = new LinkedHashMap(); }
if(map != null) { this.providerSpec.putAll(map);} return (A)this;
}
public A removeFromProviderSpec(String key) {
if(this.providerSpec == null) { return (A) this; }
if(key != null && this.providerSpec != null) {this.providerSpec.remove(key);} return (A)this;
}
public A removeFromProviderSpec(Map map) {
if(this.providerSpec == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.providerSpec != null){this.providerSpec.remove(key);}}} return (A)this;
}
public Map getProviderSpec() {
return this.providerSpec;
}
public A withProviderSpec(Map providerSpec) {
if (providerSpec == null) {
this.providerSpec = null;
} else {
this.providerSpec = new LinkedHashMap(providerSpec);
}
return (A) this;
}
public boolean hasProviderSpec() {
return this.providerSpec != null;
}
public ObjectReference buildSecretRef() {
return this.secretRef != null ? this.secretRef.build() : null;
}
public A withSecretRef(ObjectReference secretRef) {
this._visitables.remove("secretRef");
if (secretRef != null) {
this.secretRef = new ObjectReferenceBuilder(secretRef);
this._visitables.get("secretRef").add(this.secretRef);
} else {
this.secretRef = null;
this._visitables.get("secretRef").remove(this.secretRef);
}
return (A) this;
}
public boolean hasSecretRef() {
return this.secretRef != null;
}
public SecretRefNested withNewSecretRef() {
return new SecretRefNested(null);
}
public SecretRefNested withNewSecretRefLike(ObjectReference item) {
return new SecretRefNested(item);
}
public SecretRefNested editSecretRef() {
return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(null));
}
public SecretRefNested editOrNewSecretRef() {
return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(new ObjectReferenceBuilder().build()));
}
public SecretRefNested editOrNewSecretRefLike(ObjectReference item) {
return withNewSecretRefLike(java.util.Optional.ofNullable(buildSecretRef()).orElse(item));
}
public A addToServiceAccountNames(int index,String item) {
if (this.serviceAccountNames == null) {this.serviceAccountNames = new ArrayList();}
this.serviceAccountNames.add(index, item);
return (A)this;
}
public A setToServiceAccountNames(int index,String item) {
if (this.serviceAccountNames == null) {this.serviceAccountNames = new ArrayList();}
this.serviceAccountNames.set(index, item); return (A)this;
}
public A addToServiceAccountNames(java.lang.String... items) {
if (this.serviceAccountNames == null) {this.serviceAccountNames = new ArrayList();}
for (String item : items) {this.serviceAccountNames.add(item);} return (A)this;
}
public A addAllToServiceAccountNames(Collection items) {
if (this.serviceAccountNames == null) {this.serviceAccountNames = new ArrayList();}
for (String item : items) {this.serviceAccountNames.add(item);} return (A)this;
}
public A removeFromServiceAccountNames(java.lang.String... items) {
if (this.serviceAccountNames == null) return (A)this;
for (String item : items) { this.serviceAccountNames.remove(item);} return (A)this;
}
public A removeAllFromServiceAccountNames(Collection items) {
if (this.serviceAccountNames == null) return (A)this;
for (String item : items) { this.serviceAccountNames.remove(item);} return (A)this;
}
public List getServiceAccountNames() {
return this.serviceAccountNames;
}
public String getServiceAccountName(int index) {
return this.serviceAccountNames.get(index);
}
public String getFirstServiceAccountName() {
return this.serviceAccountNames.get(0);
}
public String getLastServiceAccountName() {
return this.serviceAccountNames.get(serviceAccountNames.size() - 1);
}
public String getMatchingServiceAccountName(Predicate predicate) {
for (String item : serviceAccountNames) {
if (predicate.test(item)) {
return item;
}
}
return null;
}
public boolean hasMatchingServiceAccountName(Predicate predicate) {
for (String item : serviceAccountNames) {
if (predicate.test(item)) {
return true;
}
}
return false;
}
public A withServiceAccountNames(List serviceAccountNames) {
if (serviceAccountNames != null) {
this.serviceAccountNames = new ArrayList();
for (String item : serviceAccountNames) {
this.addToServiceAccountNames(item);
}
} else {
this.serviceAccountNames = null;
}
return (A) this;
}
public A withServiceAccountNames(java.lang.String... serviceAccountNames) {
if (this.serviceAccountNames != null) {
this.serviceAccountNames.clear();
_visitables.remove("serviceAccountNames");
}
if (serviceAccountNames != null) {
for (String item : serviceAccountNames) {
this.addToServiceAccountNames(item);
}
}
return (A) this;
}
public boolean hasServiceAccountNames() {
return this.serviceAccountNames != null && !this.serviceAccountNames.isEmpty();
}
public A addToAdditionalProperties(String key,Object value) {
if(this.additionalProperties == null && key != null && value != null) { this.additionalProperties = new LinkedHashMap(); }
if(key != null && value != null) {this.additionalProperties.put(key, value);} return (A)this;
}
public A addToAdditionalProperties(Map map) {
if(this.additionalProperties == null && map != null) { this.additionalProperties = new LinkedHashMap(); }
if(map != null) { this.additionalProperties.putAll(map);} return (A)this;
}
public A removeFromAdditionalProperties(String key) {
if(this.additionalProperties == null) { return (A) this; }
if(key != null && this.additionalProperties != null) {this.additionalProperties.remove(key);} return (A)this;
}
public A removeFromAdditionalProperties(Map map) {
if(this.additionalProperties == null) { return (A) this; }
if(map != null) { for(Object key : map.keySet()) {if (this.additionalProperties != null){this.additionalProperties.remove(key);}}} return (A)this;
}
public Map getAdditionalProperties() {
return this.additionalProperties;
}
public A withAdditionalProperties(Map additionalProperties) {
if (additionalProperties == null) {
this.additionalProperties = null;
} else {
this.additionalProperties = new LinkedHashMap(additionalProperties);
}
return (A) this;
}
public boolean hasAdditionalProperties() {
return this.additionalProperties != null;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (!super.equals(o)) return false;
CredentialsRequestSpecFluent that = (CredentialsRequestSpecFluent) o;
if (!java.util.Objects.equals(cloudTokenPath, that.cloudTokenPath)) return false;
if (!java.util.Objects.equals(providerSpec, that.providerSpec)) return false;
if (!java.util.Objects.equals(secretRef, that.secretRef)) return false;
if (!java.util.Objects.equals(serviceAccountNames, that.serviceAccountNames)) return false;
if (!java.util.Objects.equals(additionalProperties, that.additionalProperties)) return false;
return true;
}
public int hashCode() {
return java.util.Objects.hash(cloudTokenPath, providerSpec, secretRef, serviceAccountNames, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (cloudTokenPath != null) { sb.append("cloudTokenPath:"); sb.append(cloudTokenPath + ","); }
if (providerSpec != null && !providerSpec.isEmpty()) { sb.append("providerSpec:"); sb.append(providerSpec + ","); }
if (secretRef != null) { sb.append("secretRef:"); sb.append(secretRef + ","); }
if (serviceAccountNames != null && !serviceAccountNames.isEmpty()) { sb.append("serviceAccountNames:"); sb.append(serviceAccountNames + ","); }
if (additionalProperties != null && !additionalProperties.isEmpty()) { sb.append("additionalProperties:"); sb.append(additionalProperties); }
sb.append("}");
return sb.toString();
}
public class SecretRefNested extends ObjectReferenceFluent> implements Nested{
SecretRefNested(ObjectReference item) {
this.builder = new ObjectReferenceBuilder(this, item);
}
ObjectReferenceBuilder builder;
public N and() {
return (N) CredentialsRequestSpecFluent.this.withSecretRef(builder.build());
}
public N endSecretRef() {
return and();
}
}
}