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

The following examples show how to use mesosphere.marathon.client.model.v2.Group. 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: MarathonAppDeployer.java    From spring-cloud-deployer-mesos with Apache License 2.0 6 votes vote down vote up
private void deleteAppsForGroupDeployment(String groupId) throws MarathonException {
	Group group = marathon.getGroup(groupId);
	for (App app : group.getApps()) {
		logger.debug(String.format("Deleting application %s in group %s", app.getId(), groupId));
		marathon.deleteApp(app.getId());
	}
	group = marathon.getGroup(groupId);
	if (logger.isDebugEnabled()) {
		logger.debug(String.format("Group %s has %d applications and %d groups", group.getId(),
				group.getApps().size(), group.getGroups().size()));
	}
	if (group.getApps().size() == 0 && group.getGroups().size() == 0) {
		logger.info(String.format("Deleting group: %s", groupId));
		marathon.deleteGroup(groupId);
	}
	deleteTopLevelGroupForDeployment(groupId);
}
 
Example #2
Source File: MarathonAppDeployer.java    From spring-cloud-deployer-mesos with Apache License 2.0 5 votes vote down vote up
private void deleteTopLevelGroupForDeployment(String id) throws MarathonException {
	String topLevelGroupId = extractGroupId(id);
	if (topLevelGroupId != null) {
		Group topGroup = marathon.getGroup(topLevelGroupId);
		if (logger.isDebugEnabled()) {
			logger.debug(String.format("Top level group %s has %d applications and %d groups", topGroup.getId(),
					topGroup.getApps().size(), topGroup.getGroups().size()));
		}
		if (topGroup.getApps().size() == 0 && topGroup.getGroups().size() == 0) {
			logger.info(String.format("Deleting group: %s", topLevelGroupId));
			marathon.deleteGroup(topLevelGroupId);
		}
	}
}
 
Example #3
Source File: MarathonContainer.java    From minimesos with Apache License 2.0 5 votes vote down vote up
@Override
public void deployGroup(String groupJson) {
    mesosphere.marathon.client.Marathon marathon = MarathonClient.getInstance(getMarathonEndpoint());
    try {
        Group group = constructGroup(groupJson);
        marathon.createGroup(group);
    } catch (Exception e) {
        throw new MinimesosException("Marathon did not accept the app, error: " + e.toString(), e);
    }
    LOGGER.debug(format("Installing group at %s", getMarathonEndpoint()));
}
 
Example #4
Source File: Marathon.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("POST /v2/groups")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Result createGroup(Group group) throws MarathonException;
 
Example #5
Source File: Marathon.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("GET /v2/groups/{id}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Group getGroup(@Param("id") String id) throws MarathonException;
 
Example #6
Source File: Marathon.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("PUT /v2/groups/{id}?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Result updateGroup(@Param("id") String id, @Param("force") boolean force, Group group) throws MarathonException;
 
Example #7
Source File: DCOS.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("GET /v2/groups")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Group getGroups() throws DCOSException;
 
Example #8
Source File: DCOS.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("PUT /v2/groups?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Result modifyGroup(@Param("force") boolean force, Group group) throws DCOSException;
 
Example #9
Source File: DCOS.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("POST /v2/groups?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Result createGroup(@Param("force") boolean force, Group group) throws DCOSException;
 
Example #10
Source File: DCOS.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("PUT /v2/groups/{id}?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Group modifyGroups(@Param("id") String id,
                   @Param("force") boolean force)
        throws DCOSException;
 
Example #11
Source File: DCOS.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("POST /v2/groups/{id}?force={force}")
@Headers(HeaderUtils.MARATHON_API_SOURCE_HEADER)
Group createGroups(@Param("id") String id,
                   @Param("force") boolean force)
        throws DCOSException;
 
Example #12
Source File: DCOS.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
default Optional<Group> maybeGroup(String id) throws DCOSException {
    return resource(() -> getGroup(id));
}
 
Example #13
Source File: MarathonContainer.java    From minimesos with Apache License 2.0 4 votes vote down vote up
private Group constructGroup(String groupJson) {
    Gson gson = new Gson();
    return gson.fromJson(replaceTokens(groupJson), Group.class);
}
 
Example #14
Source File: Marathon.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("POST /v2/groups")
Result createGroup(Group group) throws MarathonException;
 
Example #15
Source File: Marathon.java    From marathon-client with Apache License 2.0 4 votes vote down vote up
@RequestLine("GET /v2/groups/{id}")
Group getGroup(@Named("id") String id) throws MarathonException;