use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.
the class EnvironmentsRepresenter method origin.
private static void origin(OutputWriter writer, EnvironmentConfig environment, String agentUuid) {
if (environment.containsAgentRemotely(agentUuid)) {
ConfigOrigin originForAgent = environment.originForAgent(agentUuid).orElseThrow(() -> bomb(String.format("Did not expect config origin to be null for Environment: %s, Agent: %s", environment.name(), agentUuid)));
writeConfigRepoOrigin(writer, (RepoConfigOrigin) originForAgent);
} else {
writeConfigXmlOrigin(writer);
}
}
use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.
the class GoFileConfigDataSource method areKnownPartialsSameAsValidPartials.
protected boolean areKnownPartialsSameAsValidPartials(List<PartialConfig> lastKnownPartials, List<PartialConfig> lastValidPartials) {
if (lastKnownPartials.size() != lastValidPartials.size()) {
return false;
}
final ArrayList<ConfigOrigin> validConfigOrigins = ListUtil.map(lastValidPartials, new ListUtil.Transformer<PartialConfig, ConfigOrigin>() {
@Override
public ConfigOrigin transform(PartialConfig partialConfig) {
return partialConfig.getOrigin();
}
});
PartialConfig invalidKnownPartial = ListUtil.find(lastKnownPartials, new ListUtil.Condition() {
@Override
public <T> boolean isMet(T item) {
return !validConfigOrigins.contains(((PartialConfig) item).getOrigin());
}
});
return invalidKnownPartial == null;
}
use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.
the class EnvironmentAgentRepresenter method toJSON.
static void toJSON(OutputWriter writer, EnvironmentAgentConfig agent, EnvironmentConfig environmentConfig) {
writer.add("uuid", agent.getUuid());
ConfigOrigin origin = environmentConfig.isLocal() ? FILE_CONFIG_ORIGIN : ((MergeEnvironmentConfig) environmentConfig).getOriginForAgent(agent.getUuid());
writer.addChild("origin", originWriter -> EntityConfigOriginRepresenter.toJSON(originWriter, origin));
}
use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.
the class EnvironmentPipelineRepresenter method toJSON.
static void toJSON(OutputWriter writer, EnvironmentPipelineConfig pipeline, EnvironmentConfig environmentConfig) {
writer.add("name", pipeline.getName());
ConfigOrigin origin = environmentConfig.isLocal() ? FILE_CONFIG_ORIGIN : ((MergeEnvironmentConfig) environmentConfig).getOriginForPipeline(pipeline.getName());
writer.addChild("origin", originWriter -> EntityConfigOriginRepresenter.toJSON(originWriter, origin));
}
use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.
the class EnvironmentEnvironmentVariableRepresenter method toJSON.
public static void toJSON(OutputWriter writer, EnvironmentVariableConfig envVar, EnvironmentConfig environmentConfig) {
EnvironmentVariableRepresenter.toJSON(writer, envVar);
ConfigOrigin origin = environmentConfig.isLocal() ? FILE_CONFIG_ORIGIN : ((MergeEnvironmentConfig) environmentConfig).getOriginForEnvironmentVariable(envVar.getName());
writer.addChild("origin", originWriter -> EntityConfigOriginRepresenter.toJSON(originWriter, origin));
}
Aggregations