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

me.snowdrop.istio.mixer.adapter.signalfx.SignalfxSpecFluentImpl Maven / Gradle / Ivy

package me.snowdrop.istio.mixer.adapter.signalfx;

import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.fabric8.kubernetes.api.builder.Nested;
import java.util.ArrayList;
import java.lang.String;
import java.lang.Double;
import io.fabric8.kubernetes.api.builder.Predicate;
import java.lang.Integer;
import java.lang.Deprecated;
import javax.validation.Valid;
import io.fabric8.kubernetes.api.builder.BaseFluent;
import java.util.Collection;
import java.lang.Object;
import java.util.List;
import java.lang.Boolean;

public class SignalfxSpecFluentImpl> extends io.fabric8.kubernetes.api.builder.BaseFluent implements SignalfxSpecFluent{

    private String accessToken;
    private Integer datapointInterval;
    private Boolean enableMetrics;
    private Boolean enableTracing;
    private String ingestUrl;
    private List metrics;
    private Integer tracingBufferSize;
    private Double tracingSampleProbability;

    public SignalfxSpecFluentImpl(){
    }
    public SignalfxSpecFluentImpl(SignalfxSpec instance){
            this.withAccessToken(instance.getAccessToken()); 
            this.withDatapointInterval(instance.getDatapointInterval()); 
            this.withEnableMetrics(instance.getEnableMetrics()); 
            this.withEnableTracing(instance.getEnableTracing()); 
            this.withIngestUrl(instance.getIngestUrl()); 
            this.withMetrics(instance.getMetrics()); 
            this.withTracingBufferSize(instance.getTracingBufferSize()); 
            this.withTracingSampleProbability(instance.getTracingSampleProbability()); 
    }

    public String getAccessToken(){
            return this.accessToken;
    }

    public A withAccessToken(String accessToken){
            this.accessToken=accessToken; return (A) this;
    }

    public Boolean hasAccessToken(){
            return this.accessToken != null;
    }

    public Integer getDatapointInterval(){
            return this.datapointInterval;
    }

    public A withDatapointInterval(Integer datapointInterval){
            this.datapointInterval=datapointInterval; return (A) this;
    }

    public Boolean hasDatapointInterval(){
            return this.datapointInterval != null;
    }

    public A withNewDatapointInterval(String arg1){
            return (A)withDatapointInterval(new Integer(arg1));
    }

    public A withNewDatapointInterval(int arg1){
            return (A)withDatapointInterval(new Integer(arg1));
    }

    public Boolean isEnableMetrics(){
            return this.enableMetrics;
    }

    public A withEnableMetrics(Boolean enableMetrics){
            this.enableMetrics=enableMetrics; return (A) this;
    }

    public Boolean hasEnableMetrics(){
            return this.enableMetrics != null;
    }

    public A withNewEnableMetrics(String arg1){
            return (A)withEnableMetrics(new Boolean(arg1));
    }

    public A withNewEnableMetrics(boolean arg1){
            return (A)withEnableMetrics(new Boolean(arg1));
    }

    public Boolean isEnableTracing(){
            return this.enableTracing;
    }

    public A withEnableTracing(Boolean enableTracing){
            this.enableTracing=enableTracing; return (A) this;
    }

    public Boolean hasEnableTracing(){
            return this.enableTracing != null;
    }

    public A withNewEnableTracing(String arg1){
            return (A)withEnableTracing(new Boolean(arg1));
    }

    public A withNewEnableTracing(boolean arg1){
            return (A)withEnableTracing(new Boolean(arg1));
    }

    public String getIngestUrl(){
            return this.ingestUrl;
    }

    public A withIngestUrl(String ingestUrl){
            this.ingestUrl=ingestUrl; return (A) this;
    }

    public Boolean hasIngestUrl(){
            return this.ingestUrl != null;
    }

    public A addToMetrics(int index,MetricConfig item){
            if (this.metrics == null) {this.metrics = new ArrayList();}
            MetricConfigBuilder builder = new MetricConfigBuilder(item);_visitables.add(index >= 0 ? index : _visitables.size(), builder);this.metrics.add(index >= 0 ? index : metrics.size(), builder); return (A)this;
    }

    public A setToMetrics(int index,MetricConfig item){
            if (this.metrics == null) {this.metrics = new ArrayList();}
            MetricConfigBuilder builder = new MetricConfigBuilder(item);
            if (index < 0 || index >= _visitables.size()) { _visitables.add(builder); } else { _visitables.set(index, builder);}
            if (index < 0 || index >= metrics.size()) { metrics.add(builder); } else { metrics.set(index, builder);}
             return (A)this;
    }

    public A addToMetrics(MetricConfig... items){
            if (this.metrics == null) {this.metrics = new ArrayList();}
            for (MetricConfig item : items) {MetricConfigBuilder builder = new MetricConfigBuilder(item);_visitables.add(builder);this.metrics.add(builder);} return (A)this;
    }

    public A addAllToMetrics(Collection items){
            if (this.metrics == null) {this.metrics = new ArrayList();}
            for (MetricConfig item : items) {MetricConfigBuilder builder = new MetricConfigBuilder(item);_visitables.add(builder);this.metrics.add(builder);} return (A)this;
    }

    public A removeFromMetrics(MetricConfig... items){
            for (MetricConfig item : items) {MetricConfigBuilder builder = new MetricConfigBuilder(item);_visitables.remove(builder);if (this.metrics != null) {this.metrics.remove(builder);}} return (A)this;
    }

    public A removeAllFromMetrics(Collection items){
            for (MetricConfig item : items) {MetricConfigBuilder builder = new MetricConfigBuilder(item);_visitables.remove(builder);if (this.metrics != null) {this.metrics.remove(builder);}} return (A)this;
    }

    
/**
 * This method has been deprecated, please use method buildMetrics instead.
 * @return The buildable object.
 */
@Deprecated public List getMetrics(){
            return build(metrics);
    }

    public List buildMetrics(){
            return build(metrics);
    }

    public MetricConfig buildMetric(int index){
            return this.metrics.get(index).build();
    }

    public MetricConfig buildFirstMetric(){
            return this.metrics.get(0).build();
    }

    public MetricConfig buildLastMetric(){
            return this.metrics.get(metrics.size() - 1).build();
    }

    public MetricConfig buildMatchingMetric(io.fabric8.kubernetes.api.builder.Predicate predicate){
            for (MetricConfigBuilder item: metrics) { if(predicate.apply(item)){return item.build();} } return null;
    }

    public A withMetrics(List metrics){
            if (this.metrics != null) { _visitables.removeAll(this.metrics);}
            if (metrics != null) {this.metrics = new ArrayList(); for (MetricConfig item : metrics){this.addToMetrics(item);}} else { this.metrics = null;} return (A) this;
    }

    public A withMetrics(MetricConfig... metrics){
            if (this.metrics != null) {this.metrics.clear();}
            if (metrics != null) {for (MetricConfig item :metrics){ this.addToMetrics(item);}} return (A) this;
    }

    public Boolean hasMetrics(){
            return metrics != null && !metrics.isEmpty();
    }

    public SignalfxSpecFluent.MetricsNested addNewMetric(){
            return new MetricsNestedImpl();
    }

    public SignalfxSpecFluent.MetricsNested addNewMetricLike(MetricConfig item){
            return new MetricsNestedImpl(-1, item);
    }

    public SignalfxSpecFluent.MetricsNested setNewMetricLike(int index,MetricConfig item){
            return new MetricsNestedImpl(index, item);
    }

    public SignalfxSpecFluent.MetricsNested editMetric(int index){
            if (metrics.size() <= index) throw new RuntimeException("Can't edit metrics. Index exceeds size.");
            return setNewMetricLike(index, buildMetric(index));
    }

    public SignalfxSpecFluent.MetricsNested editFirstMetric(){
            if (metrics.size() == 0) throw new RuntimeException("Can't edit first metrics. The list is empty.");
            return setNewMetricLike(0, buildMetric(0));
    }

    public SignalfxSpecFluent.MetricsNested editLastMetric(){
            int index = metrics.size() - 1;
            if (index < 0) throw new RuntimeException("Can't edit last metrics. The list is empty.");
            return setNewMetricLike(index, buildMetric(index));
    }

    public SignalfxSpecFluent.MetricsNested editMatchingMetric(io.fabric8.kubernetes.api.builder.Predicate predicate){
            int index = -1;
            for (int i=0;i extends MetricConfigFluentImpl> implements SignalfxSpecFluent.MetricsNested,io.fabric8.kubernetes.api.builder.Nested{

            private final MetricConfigBuilder builder;
        private final int index;
    
            MetricsNestedImpl(int index,MetricConfig item){
                    this.index = index;
                    this.builder = new MetricConfigBuilder(this, item);
            }
            MetricsNestedImpl(){
                    this.index = -1;
                    this.builder = new MetricConfigBuilder(this);
            }
    
    public N and(){
            return (N) SignalfxSpecFluentImpl.this.setToMetrics(index, builder.build());
    }
    public N endMetric(){
            return and();
    }

}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy