io.fabric8.openshift.api.model.miscellaneous.cloudcredential.v1.CredentialsRequestSpecFluentImpl 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 io.fabric8.kubernetes.api.model.ObjectReferenceFluentImpl;
import java.lang.String;
import java.util.LinkedHashMap;
import java.util.function.Predicate;
import io.fabric8.kubernetes.api.model.ObjectReference;
import java.lang.Deprecated;
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.lang.Boolean;
import java.util.Map;
/**
* Generated
*/
@SuppressWarnings(value = "unchecked")
public class CredentialsRequestSpecFluentImpl> extends BaseFluent implements CredentialsRequestSpecFluent{
public CredentialsRequestSpecFluentImpl() {
}
public CredentialsRequestSpecFluentImpl(CredentialsRequestSpec instance) {
if (instance != null) {
this.withProviderSpec(instance.getProviderSpec());
this.withSecretRef(instance.getSecretRef());
this.withServiceAccountNames(instance.getServiceAccountNames());
this.withAdditionalProperties(instance.getAdditionalProperties());
}
}
private Map providerSpec;
private ObjectReferenceBuilder secretRef;
private List serviceAccountNames = new ArrayList();
private Map additionalProperties;
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;
}
/**
* This method has been deprecated, please use method buildSecretRef instead.
* @return The buildable object.
*/
@Deprecated
public ObjectReference getSecretRef() {
return this.secretRef!=null ?this.secretRef.build():null;
}
public ObjectReference buildSecretRef() {
return this.secretRef!=null ?this.secretRef.build():null;
}
public A withSecretRef(ObjectReference secretRef) {
_visitables.get("secretRef").remove(this.secretRef);
if (secretRef!=null){ this.secretRef= new ObjectReferenceBuilder(secretRef); _visitables.get("secretRef").add(this.secretRef);} else { this.secretRef = null; _visitables.get("secretRef").remove(this.secretRef); } return (A) this;
}
public Boolean hasSecretRef() {
return this.secretRef != null;
}
public CredentialsRequestSpecFluentImpl.SecretRefNested withNewSecretRef() {
return new CredentialsRequestSpecFluentImpl.SecretRefNestedImpl();
}
public CredentialsRequestSpecFluentImpl.SecretRefNested withNewSecretRefLike(ObjectReference item) {
return new CredentialsRequestSpecFluentImpl.SecretRefNestedImpl(item);
}
public CredentialsRequestSpecFluentImpl.SecretRefNested editSecretRef() {
return withNewSecretRefLike(getSecretRef());
}
public CredentialsRequestSpecFluentImpl.SecretRefNested editOrNewSecretRef() {
return withNewSecretRefLike(getSecretRef() != null ? getSecretRef(): new ObjectReferenceBuilder().build());
}
public CredentialsRequestSpecFluentImpl.SecretRefNested editOrNewSecretRefLike(ObjectReference item) {
return withNewSecretRefLike(getSecretRef() != null ? getSecretRef(): 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) {
for (String item : items) {if (this.serviceAccountNames!= null){ this.serviceAccountNames.remove(item);}} return (A)this;
}
public A removeAllFromServiceAccountNames(Collection items) {
for (String item : items) {if (this.serviceAccountNames!= null){ 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 serviceAccountNames != null && !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;
CredentialsRequestSpecFluentImpl that = (CredentialsRequestSpecFluentImpl) o;
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(providerSpec, secretRef, serviceAccountNames, additionalProperties, super.hashCode());
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
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();
}
class SecretRefNestedImpl extends ObjectReferenceFluentImpl> implements CredentialsRequestSpecFluentImpl.SecretRefNested,Nested{
SecretRefNestedImpl(ObjectReference item) {
this.builder = new ObjectReferenceBuilder(this, item);
}
SecretRefNestedImpl() {
this.builder = new ObjectReferenceBuilder(this);
}
ObjectReferenceBuilder builder;
public N and() {
return (N) CredentialsRequestSpecFluentImpl.this.withSecretRef(builder.build());
}
public N endSecretRef() {
return and();
}
}
}