package com.netflix.spinnaker.amos.aws;

/**
 * An implementation of {@link com.netflix.spinnaker.amos.aws.AmazonCredentials} that is decorated with Netflix concepts like Edda, Discovery, Front50,
 */
public class NetflixAmazonCredentials extends AmazonCredentials {
    private String edda;
    private Boolean eddaEnabled;
    private String discovery;
    private Boolean discoveryEnabled;
    private String front50;
    private Boolean front50Enabled;

    public String getEdda() {
        return edda;
    }

    public String getDiscovery() {
        return discovery;
    }

    public String getFront50() {
        return front50;
    }

    public void setEdda(String edda) {
        this.edda = edda;
    }

    public void setDiscovery(String discovery) {
        this.discovery = discovery;
    }

    public void setFront50(String front50) {
        this.front50 = front50;
    }

    public Boolean getEddaEnabled() {
        return eddaEnabled != null ? eddaEnabled : edda.length() > 0;
    }

    public void setEddaEnabled(Boolean eddaEnabled) {
        this.eddaEnabled = eddaEnabled;
    }

    public Boolean getDiscoveryEnabled() {
        return discoveryEnabled != null ? discoveryEnabled : discovery.length() > 0;
    }

    public void setDiscoveryEnabled(Boolean discoveryEnabled) {
        this.discoveryEnabled = discoveryEnabled;
    }

    public Boolean getFront50Enabled() {
        return front50Enabled != null ? front50Enabled : front50.length() > 0;
    }

    public void setFront50Enabled(Boolean front50Enabled) {
        this.front50Enabled = front50Enabled;
    }
}

@@ -939,50 +939,157 @@
     
-return eddaEnabled != null ? eddaEnabled :
+if (eddaEnabled != null && edda != null) %7B%0A            return eddaEnabled;%0A        %7D else %7B%0A            return eddaEnabled == null && edda != null &&
  edd
@@ -1096,32 +1096,42 @@
 a.length() %3E 0;%0A
+        %7D%0A
     %7D%0A%0A    publi
@@ -1277,60 +1277,182 @@
     
-return discoveryEnabled != null ? discoveryEnabled :
+if (discoveryEnabled != null && discovery != null) %7B%0A            return discoveryEnabled;%0A        %7D else %7B%0A            return discoveryEnabled == null && discovery != null &&
  dis
@@ -1464,32 +1464,42 @@
 y.length() %3E 0;%0A
+        %7D%0A
     %7D%0A%0A    publi
@@ -1663,56 +1663,172 @@
     
-return front50Enabled != null ? front50Enabled :
+if (front50Enabled != null && front50 != null) %7B%0A            return front50Enabled;%0A        %7D else %7B%0A            return front50Enabled == null && front50 != null &&
  fro
@@ -1842,24 +1842,34 @@
 ngth() %3E 0;%0A
+        %7D%0A
     %7D%0A%0A    p

this should be the proper logic