本文整理汇总了Java中org.springframework.cloud.deployer.spi.cloudfoundry.CloudFoundryDeploymentProperties类的典型用法代码示例。如果您正苦于以下问题:Java CloudFoundryDeploymentProperties类的具体用法?Java CloudFoundryDeploymentProperties怎么用?Java CloudFoundryDeploymentProperties使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CloudFoundryDeploymentProperties类属于org.springframework.cloud.deployer.spi.cloudfoundry包,在下文中一共展示了CloudFoundryDeploymentProperties类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doCreate
import org.springframework.cloud.deployer.spi.cloudfoundry.CloudFoundryDeploymentProperties; //导入依赖的package包/类
private CloudFoundryAppDeployer doCreate(URL api, String org, String space, String email, String password) {
CloudFoundryClient client = getCloudFoundryClient(email, password, api);
CloudFoundryOperations operations = getOperations(email, password, api, org, space);
return new CloudFoundryAppDeployer(
new CloudFoundryConnectionProperties(),
new CloudFoundryDeploymentProperties(),
operations,
client,
appName -> appName);
}
示例2: getDeployment
import org.springframework.cloud.deployer.spi.cloudfoundry.CloudFoundryDeploymentProperties; //导入依赖的package包/类
public CloudFoundryDeploymentProperties getDeployment() {
return deployment;
}
示例3: setDeployment
import org.springframework.cloud.deployer.spi.cloudfoundry.CloudFoundryDeploymentProperties; //导入依赖的package包/类
public void setDeployment(CloudFoundryDeploymentProperties deployment) {
this.deployment = deployment;
}
示例4: deploy
import org.springframework.cloud.deployer.spi.cloudfoundry.CloudFoundryDeploymentProperties; //导入依赖的package包/类
/**
* Deploy a module after finding its artifact.
*
* @param module
* @param data
* @throws IOException
*/
public void deploy(String module, Map<String, String> data, URL apiEndpoint, String org, String space, String email, String password, String namespace) throws IOException {
ModuleDetails details = getModuleDetails(module);
final Resource artifactToDeploy = findArtifact(details, ctx, data);
final Map<String, String> properties = getProperties(spinnakerConfiguration, details, data);
final Map<String, String> deploymentProperties = new HashMap<>();
deploymentProperties.put(CloudFoundryDeploymentProperties.USE_SPRING_APPLICATION_JSON_KEY, "false");
deploymentProperties.put(
CloudFoundryDeploymentProperties.SERVICES_PROPERTY_KEY,
Stream.concat(
details.getServices().stream(),
StringUtils.commaDelimitedListToSet(
data.getOrDefault(CloudFoundryDeploymentProperties.SERVICES_PROPERTY_KEY, "")).stream())
.collect(Collectors.joining(",")));
Optional.ofNullable(details.getProperties().get("buildpack"))
.ifPresent(buildpack -> deploymentProperties.put(CloudFoundryDeploymentProperties.BUILDPACK_PROPERTY_KEY, buildpack));
Optional.ofNullable(details.getProperties().get("memory"))
.ifPresent(memory -> deploymentProperties.put(CloudFoundryDeploymentProperties.MEMORY_PROPERTY_KEY, memory));
Optional.ofNullable(details.getProperties().get("disk"))
.ifPresent(disk -> deploymentProperties.put(CloudFoundryDeploymentProperties.DISK_PROPERTY_KEY, disk));
// Load up on Spring profiles!
Set<String> profiles = StringUtils.commaDelimitedListToSet(properties.getOrDefault("spring.profiles.active", ""));
profiles.addAll(StringUtils.commaDelimitedListToSet(data.getOrDefault("extra.profiles", "")));
if (profiles.size() > 0) {
log.debug("Configuring " + details.getName() + " with the following Spring profiles: " + profiles);
properties.put("spring.profiles.active", StringUtils.collectionToCommaDelimitedString(profiles));
} else {
System.out.println(details.getName() + " has no Spring profiles.");
}
CloudFoundryAppDeployer appDeployer = appDeployerFactory.getAppDeployer(apiEndpoint, org, space, email, password, namespace);
log.debug("Uploading " + artifactToDeploy + "...");
String deploymentId = appDeployer.deploy(new AppDeploymentRequest(
new AppDefinition(details.getName() + namespace, properties),
artifactToDeploy,
deploymentProperties));
try {
Mono.defer(() -> Mono.just(appDeployer.status(deploymentId)))
.filter(appStatus ->
appStatus.getState() == DeploymentState.deployed || appStatus.getState() == DeploymentState.deploying)
.repeatWhenEmpty(exponentialBackOff(Duration.ofSeconds(1), Duration.ofSeconds(15), Duration.ofMinutes(15)))
.block(Duration.ofMinutes(20));
} finally {
this.fileManager.delete(details);
}
counterService.increment(String.format(METRICS_DEPLOYED, module));
}