mesosphere.marathon.client.model.v2.GetServerInfoResponse Java Examples

The following examples show how to use mesosphere.marathon.client.model.v2.GetServerInfoResponse. 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: MarathonHealthIndicator.java    From spring-cloud-marathon with MIT License 6 votes vote down vote up
@Override
protected void doHealthCheck(Health.Builder builder) throws Exception {
    try {
        GetServerInfoResponse serverInfo = client.getServerInfo();
        List<VersionedApp> apps = client.getApps().getApps();
        builder.up()
                .withDetail("services", apps)
                .withDetail("name", serverInfo.getName())
                .withDetail("leader", serverInfo.getLeader())
                .withDetail("http_port", serverInfo.getHttp_config().getHttp_port())
                .withDetail("https_port", serverInfo.getHttp_config().getHttps_port())
                .withDetail("hostname", serverInfo.getMarathon_config().getHostname())
                .withDetail("local_port_min", serverInfo.getMarathon_config().getLocal_port_min())
                .withDetail("local_port_max", serverInfo.getMarathon_config().getLocal_port_max());
    }
    catch (Exception e) {
        builder.down(e);
    }
}
 
Example #2
Source File: MarathonAppDeployer.java    From spring-cloud-deployer-mesos with Apache License 2.0 6 votes vote down vote up
@Override
public RuntimeEnvironmentInfo environmentInfo() {
	String apiVersion = "v1";
	String hostVersion = "unknown";
	String frameworkId = "unknown";
	String leader = "unknown";
	try {
		GetServerInfoResponse serverInfo = marathon.getServerInfo();
		hostVersion = serverInfo.getVersion();
		frameworkId = serverInfo.getFrameworkId();
		leader = serverInfo.getLeader();
	} catch (MarathonException ignore) {}
	return new RuntimeEnvironmentInfo.Builder()
			.spiClass(AppDeployer.class)
			.implementationName(this.getClass().getSimpleName())
			.implementationVersion(RuntimeVersionUtils.getVersion(this.getClass()))
			.platformType("Mesos")
			.platformApiVersion(apiVersion)
			.platformClientVersion(RuntimeVersionUtils.getVersion(marathon.getClass()))
			.platformHostVersion(hostVersion)
			.addPlatformSpecificInfo("leader", leader)
			.addPlatformSpecificInfo("frameworkId", frameworkId)
			.build();
}
 
Example #3
Source File: MarathonEndpointTests.java    From spring-cloud-marathon with MIT License 5 votes vote down vote up
@Bean
public Marathon marathonClient(MarathonProperties properties) throws MarathonException {
    Marathon client = mock(Marathon.class);

    when(client.getServerInfo()).thenReturn(new GetServerInfoResponse());

    GetAppsResponse appsResponse = new GetAppsResponse();
    VersionedApp app = new VersionedApp();
    app.setId("test-app");
    appsResponse.setApps(Collections.singletonList(app));
    when(client.getApps()).thenReturn(appsResponse);

    return client;
}
 
Example #4
Source File: Marathon.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("GET /v2/info")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
GetServerInfoResponse getServerInfo() throws MarathonException;
 
Example #5
Source File: DCOS.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("GET /v2/info")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
GetServerInfoResponse getInfo() throws DCOSException;
 
Example #6
Source File: Marathon.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("GET /v2/info")
GetServerInfoResponse getServerInfo();