Java Code Examples for org.cloudfoundry.client.lib.domain.CloudApplication#getState()

The following examples show how to use org.cloudfoundry.client.lib.domain.CloudApplication#getState() . 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: CloudControllerRestClientImpl.java    From cf-java-client-sap with Apache License 2.0 6 votes vote down vote up
@Override
public StartingInfo startApplication(String applicationName) {
    CloudApplication application = getApplication(applicationName);
    if (application.getState() == CloudApplication.State.STARTED) {
        return null;
    }
    UUID applicationGuid = application.getMetadata()
                                      .getGuid();
    delegate.applicationsV2()
            .update(UpdateApplicationRequest.builder()
                                            .applicationId(applicationGuid.toString())
                                            .state(CloudApplication.State.STARTED.toString())
                                            .build())
            .block();
    return null;
}
 
Example 2
Source File: CloudControllerRestClientImpl.java    From cf-java-client-sap with Apache License 2.0 5 votes vote down vote up
@Override
public void stopApplication(String applicationName) {
    CloudApplication application = getApplication(applicationName);
    if (application.getState() == CloudApplication.State.STOPPED) {
        return;
    }
    UUID applicationGuid = application.getMetadata()
                                      .getGuid();
    delegate.applicationsV2()
            .update(UpdateApplicationRequest.builder()
                                            .applicationId(applicationGuid.toString())
                                            .state(CloudApplication.State.STOPPED.toString())
                                            .build())
            .block();
}