default RemoteAction clean( S serviceProvider, D deploymentDetails, SpinnakerRuntimeSettings runtimeSettings ) { return serviceProvider.clean(deploymentDetails, runtimeSettings); }
SpinnakerService getSpinnakerService(SpinnakerService.Type type) { Field serviceField = getField(type.getCanonicalName() + "service"); if (serviceField == null) { return null; } serviceField.setAccessible(true); try { return (SpinnakerService) serviceField.get(this); } catch (IllegalAccessException e) { throw new HalException(Problem.Severity.FATAL, "Can't access service field for " + type + ": " + e.getMessage()); } finally { serviceField.setAccessible(false); } }
public List<SpinnakerService> getServices() { return getFieldsOfType(SpinnakerService.class) .stream() .filter(s -> s != null) .collect(Collectors.toList()); }
public void collectLogs(String deploymentName, List<String> serviceNames, List<String> excludeServiceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } if (!excludeServiceNames.isEmpty()) { serviceTypes = serviceTypes .stream() .filter(serviceType -> !excludeServiceNames.contains(serviceType.getCanonicalName())) .collect(Collectors.toList()); } deployer.collectLogs(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); }
public void clean(String deploymentName) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); RemoteAction action = serviceProvider.clean(deploymentDetails, serviceProvider.buildRuntimeSettings(deploymentConfiguration)); action.commitScript(halconfigDirectoryStructure.getUnInstallScriptPath(deploymentName)); }
public ResolvedConfiguration generateConfigWithOptionalServices(String deploymentName, List<SpinnakerService.Type> serviceTypes) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } return generateConfig(deploymentName, serviceTypes); }
protected Field getField(String name) { String reducedName = reduceFieldName(name); Optional<Field> matchingField = Arrays.stream(this.getClass().getDeclaredFields()) .filter(f -> f.getName().equalsIgnoreCase(reducedName)) .findFirst(); return matchingField.orElse(null); }
public RemoteAction connectCommand(String deploymentName, List<String> serviceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes.add(SpinnakerService.Type.DECK); serviceTypes.add(SpinnakerService.Type.GATE); } RemoteAction result = deployer.connectCommand(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); result.setAutoRun(true); result.commitScript(halconfigDirectoryStructure.getConnectScriptPath(deploymentName)); return result; }
public void collectLogs(String deploymentName, List<String> serviceNames, List<String> excludeServiceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } if (!excludeServiceNames.isEmpty()) { serviceTypes = serviceTypes .stream() .filter(serviceType -> !excludeServiceNames.contains(serviceType.getCanonicalName())) .collect(Collectors.toList()); } deployer.collectLogs(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); }
public void clean(String deploymentName) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); RemoteAction action = serviceProvider.clean(deploymentDetails, serviceProvider.buildRuntimeSettings(deploymentConfiguration)); action.commitScript(halconfigDirectoryStructure.getUnInstallScriptPath(deploymentName)); }
public ResolvedConfiguration generateConfigWithOptionalServices(String deploymentName, List<SpinnakerService.Type> serviceTypes) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } return generateConfig(deploymentName, serviceTypes); }
protected Field getField(String name) { String reducedName = reduceFieldName(name); Optional<Field> matchingField = Arrays.stream(this.getClass().getDeclaredFields()) .filter(f -> f.getName().equalsIgnoreCase(reducedName)) .findFirst(); return matchingField.orElse(null); }
public RemoteAction connectCommand(String deploymentName, List<String> serviceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes.add(SpinnakerService.Type.DECK); serviceTypes.add(SpinnakerService.Type.GATE); } RemoteAction result = deployer.connectCommand(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); result.setAutoRun(true); result.commitScript(halconfigDirectoryStructure.getConnectScriptPath(deploymentName)); return result; }
public void rollback(String deploymentName, List<String> serviceNames, List<String> excludeServiceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } if (!excludeServiceNames.isEmpty()) { serviceTypes = serviceTypes .stream() .filter(serviceType -> !excludeServiceNames.contains(serviceType.getCanonicalName())) .collect(Collectors.toList()); } SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); deployer.rollback(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); }
.getServices() .stream() .map(SpinnakerService::getType)
public List<SpinnakerService> getServices() { return getFieldsOfType(SpinnakerService.class) .stream() .filter(s -> s != null) .collect(Collectors.toList()); }
default RemoteAction clean( S serviceProvider, D deploymentDetails, SpinnakerRuntimeSettings runtimeSettings ) { return serviceProvider.clean(deploymentDetails, runtimeSettings); }
SpinnakerService getSpinnakerService(SpinnakerService.Type type) { Field serviceField = getField(type.getCanonicalName() + "service"); if (serviceField == null) { return null; } serviceField.setAccessible(true); try { return (SpinnakerService) serviceField.get(this); } catch (IllegalAccessException e) { throw new HalException(Problem.Severity.FATAL, "Can't access service field for " + type + ": " + e.getMessage()); } finally { serviceField.setAccessible(false); } }
public void rollback(String deploymentName, List<String> serviceNames, List<String> excludeServiceNames) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); List<SpinnakerService.Type> serviceTypes = serviceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList()); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } if (!excludeServiceNames.isEmpty()) { serviceTypes = serviceTypes .stream() .filter(serviceType -> !excludeServiceNames.contains(serviceType.getCanonicalName())) .collect(Collectors.toList()); } SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration); Deployer deployer = getDeployer(deploymentConfiguration); DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration); deployer.rollback(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); }
.getServices() .stream() .map(SpinnakerService::getType)