org.cloudfoundry.operations.applications.RestartApplicationRequest Java Examples

The following examples show how to use org.cloudfoundry.operations.applications.RestartApplicationRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CloudFoundryService.java    From spring-cloud-app-broker with Apache License 2.0 6 votes vote down vote up
public Mono<Void> updateBrokerApp(String appName, String brokerClientId, List<String> appBrokerProperties) {
	return cloudFoundryOperations.applications().get(GetApplicationRequest.builder().name(appName).build())
		.map(ApplicationDetail::getId)
		.flatMap(applicationId -> cloudFoundryClient.applicationsV2().update(UpdateApplicationRequest
			.builder()
			.applicationId(applicationId)
			.putAllEnvironmentJsons(appBrokerDeployerEnvironmentVariables(brokerClientId))
			.putAllEnvironmentJsons(propertiesToEnvironment(appBrokerProperties))
			.name(appName)
			.memory(1024)
			.build())
			.thenReturn(applicationId))
		.then(cloudFoundryOperations.applications().restart(RestartApplicationRequest.builder()
			.name(appName)
			.build()))
		.doOnSuccess(item -> LOG.info("Updated broker app " + appName))
		.doOnError(error -> LOG.error("Error updating broker app " + appName + ": " + error))
		.then();
}
 
Example #2
Source File: CfPushDelegateTest.java    From ya-cf-app-gradle-plugin with Apache License 2.0 6 votes vote down vote up
@Test
public void testCfPushWithoutEnvOrServices() throws Exception {
    CloudFoundryOperations cfOperations = mock(CloudFoundryOperations.class);
    Applications mockApplications = mock(Applications.class);
    when(cfOperations.applications()).thenReturn(mockApplications);
    when(mockApplications.push(any(PushApplicationRequest.class))).thenReturn(Mono.empty());
    when(mockApplications.restart(any(RestartApplicationRequest.class))).thenReturn(Mono.empty());

    Services mockServices = mock(Services.class);
    when(cfOperations.services()).thenReturn(mockServices);
    ServiceInstance mockInstance = ServiceInstance.builder().name("testservice").id("id").type(ServiceInstanceType.MANAGED).build();
    when(mockServices.getInstance(any(GetServiceInstanceRequest.class))).thenReturn(Mono.just(mockInstance));

    CfProperties cfAppProperties = sampleApp();
    cfPushDelegate.push(cfOperations, cfAppProperties);
}
 
Example #3
Source File: StackChangeAppInstancesPolicyExecutorTask.java    From cf-butler with Apache License 2.0 5 votes vote down vote up
private Mono<Void> restartApp(AppDetail detail) {
	return DefaultCloudFoundryOperations.builder()
			.from(opsClient)
			.organization(detail.getOrganization())
			.space(detail.getSpace())
			.build()
				.applications()
					.restart(RestartApplicationRequest.builder().name(detail.getAppName()).build());
}
 
Example #4
Source File: RestartSiteProjectPostReleaseTask.java    From spring-cloud-release-tools with Apache License 2.0 4 votes vote down vote up
void restartApp(String name) {
	this.cloudFoundryOperations.applications()
			.restart(RestartApplicationRequest.builder().name(name).build());
}
 
Example #5
Source File: CfAppRestartTask.java    From ya-cf-app-gradle-plugin with Apache License 2.0 3 votes vote down vote up
@TaskAction
public void restartApp() {

    CloudFoundryOperations cfOperations = getCfOperations();
    CfProperties cfProperties = getCfProperties();

    Mono<Void> resp = cfOperations.applications()
        .restart(RestartApplicationRequest.builder().name(cfProperties.name()).build());

    resp.block(Duration.ofMillis(defaultWaitTimeout));

}