本文整理汇总了Java中mesosphere.marathon.client.MarathonClient类的典型用法代码示例。如果您正苦于以下问题:Java MarathonClient类的具体用法?Java MarathonClient怎么用?Java MarathonClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MarathonClient类属于mesosphere.marathon.client包,在下文中一共展示了MarathonClient类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getMarathonClient
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
/**
* Get a Marathon client with Authorization headers using the token within provided credentials. If the content of
* credentials is JSON, this will use the "jenkins_token" field; if the content is just a string, that will be
* used as the token value.
*
* @param credentials String credentials
* @return Marathon client with token in auth header
*/
private Marathon getMarathonClient(StringCredentials credentials) {
String token;
try {
final JSONObject json = JSONObject.fromObject(credentials.getSecret().getPlainText());
if (json.has("jenkins_token")) {
token = json.getString("jenkins_token");
} else {
token = "";
}
} catch (JSONException jse) {
token = credentials.getSecret().getPlainText();
}
if (StringUtils.isNotEmpty(token)) {
return MarathonClient
.getInstanceWithTokenAuth(getURL(), token);
}
return getMarathonClient();
}
开发者ID:jenkinsci,项目名称:marathon-plugin,代码行数:30,代码来源:MarathonBuilderImpl.java
示例2: execute
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
final Marathon marathon = MarathonClient.getInstance(marathonHost);
App app = readApp(finalMarathonConfigFile);
getLog().info("deploying Marathon config for " + app.getId()
+ " from " + finalMarathonConfigFile + " to " + marathonHost);
if (appExists(marathon, app.getId())) {
getLog().info(app.getId() + " already exists - will be updated");
updateApp(marathon, app);
} else {
getLog().info(app.getId() + " does not exist yet - will be created");
app = createApp(marathon, app);
}
if (waitForDeploymentFinished) {
try {
waitForApp(marathon, app);
} catch (MarathonException e) {
throw new MojoExecutionException("error waiting for app", e);
}
}
}
开发者ID:holidaycheck,项目名称:marathon-maven-plugin,代码行数:23,代码来源:DeployMojo.java
示例3: marathon
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Bean
@RefreshScope
public Marathon marathon(MarathonAppDeployerProperties marathonProperties, DcosClusterProperties dcosClusterProperties) {
if (StringUtils.hasText(dcosClusterProperties.getAuthorizationToken())) {
return MarathonClient.getInstance(marathonProperties.getApiEndpoint(),
new DcosHeadersInterceptor(dcosClusterProperties.getAuthorizationToken()));
}
else {
return MarathonClient.getInstance(marathonProperties.getApiEndpoint());
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-deployer-mesos,代码行数:12,代码来源:MesosAutoConfiguration.java
示例4: marathon
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Bean
public Marathon marathon(MarathonAppDeployerProperties marathonProperties,
DcosClusterProperties dcosClusterProperties) {
if (StringUtils.hasText(dcosClusterProperties.getAuthorizationToken())) {
return MarathonClient.getInstance(marathonProperties.getApiEndpoint(),
new DcosHeadersInterceptor(dcosClusterProperties.getAuthorizationToken()));
}
else {
return MarathonClient.getInstance(marathonProperties.getApiEndpoint());
}
}
开发者ID:spring-cloud,项目名称:spring-cloud-deployer-mesos,代码行数:12,代码来源:MarathonTestSupport.java
示例5: deployApp
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
/**
* Deploys a Marathon app by JSON string
*
* @param marathonJson JSON string
*/
@Override
public void deployApp(String marathonJson) {
mesosphere.marathon.client.Marathon marathon = MarathonClient.getInstance(getMarathonEndpoint());
try {
marathon.createApp(constructApp(marathonJson));
} catch (MarathonException e) {
throw new MinimesosException("Marathon did not accept the app, error: " + e.toString());
}
LOGGER.debug(format("Installed app at '%s'", getMarathonEndpoint()));
}
开发者ID:ContainerSolutions,项目名称:minimesos,代码行数:16,代码来源:MarathonContainer.java
示例6: deleteApp
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Override
public Result deleteApp(String appId) {
mesosphere.marathon.client.Marathon marathon = MarathonClient.getInstance(getMarathonEndpoint());
try {
Result result = marathon.deleteApp(appId);
LOGGER.debug(format("Deleted app '%s' at '%s'", appId, getMarathonEndpoint()));
return result;
} catch (MarathonException e) {
throw new MinimesosException("Could not delete app '" + appId + "'. " + e.getMessage());
}
}
开发者ID:ContainerSolutions,项目名称:minimesos,代码行数:12,代码来源:MarathonContainer.java
示例7: deployGroup
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@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()));
}
开发者ID:ContainerSolutions,项目名称:minimesos,代码行数:12,代码来源:MarathonContainer.java
示例8: deleteGroup
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Override
public Result deleteGroup(String groupId) {
mesosphere.marathon.client.Marathon marathon = MarathonClient.getInstance(getMarathonEndpoint());
try {
Result result = marathon.deleteGroup(groupId);
LOGGER.debug(format("Deleted app '%s' at '%s'", groupId, getMarathonEndpoint()));
return result;
} catch (MarathonException e) {
throw new MinimesosException("Could not delete group '" + groupId + "'. " + e.getMessage());
}
}
开发者ID:ContainerSolutions,项目名称:minimesos,代码行数:12,代码来源:MarathonContainer.java
示例9: updateApp
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
/**
* Updates a Marathon app by JSON string
*
* @param marathonJson JSON string
*/
@Override
public void updateApp(String marathonJson) {
mesosphere.marathon.client.Marathon marathon = MarathonClient.getInstance(getMarathonEndpoint());
try {
App app = constructApp(marathonJson);
marathon.updateApp(app.getId(), app, true);
} catch (MarathonException e) {
throw new MinimesosException("Marathon could not update the app, error: " + e.toString());
}
LOGGER.debug(format("Installing an app on marathon %s", getMarathonEndpoint()));
}
开发者ID:ContainerSolutions,项目名称:minimesos,代码行数:17,代码来源:MarathonContainer.java
示例10: execute
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
final Marathon marathon = MarathonClient.getInstance(marathonHost);
final App app = readApp(finalMarathonConfigFile);
getLog().info("deleting Marathon instance for " + app.getId());
if (appExists(marathon, app.getId())) {
getLog().info(app.getId() + " already exists - will be updated");
deleteApp(marathon, app);
} else {
getLog().warn(app.getId() + " does not exist - nothing to delete");
}
}
开发者ID:holidaycheck,项目名称:marathon-maven-plugin,代码行数:13,代码来源:DeleteMojo.java
示例11: execute
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
final Marathon marathon = MarathonClient.getInstance(marathonHost);
final App app = readApp(finalMarathonConfigFile);
getLog().info("tasks in Marathon instance for " + app.getId());
final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1);
final Callable<Void> callable = () -> {
try {
if (appExists(marathon, app.getId())) {
getLog().info(app.getId() + " exists - getting app tasks");
getAppTasks(marathon, app);
} else {
getLog().warn(app.getId() + " does not exist");
}
} catch (final MojoExecutionException e) {
getLog().error("Problem communicating with Marathon", e);
}
return null;
};
final ScheduledFuture<Void> future = executor.schedule(callable, delay, TimeUnit.SECONDS);
while (!future.isDone() && !future.isCancelled()) {
try {
Thread.sleep(100);
} catch (InterruptedException ignored) { }
}
}
开发者ID:holidaycheck,项目名称:marathon-maven-plugin,代码行数:28,代码来源:AppTasksMojo.java
示例12: MarathonService
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
public MarathonService(String marathonBaseUrl) {
logger.info("Marathon configured with url: {}", marathonBaseUrl);
this.marathon = MarathonClient.getInstance(marathonBaseUrl);
}
开发者ID:ecg-mechaniker,项目名称:mechaniker,代码行数:5,代码来源:MarathonService.java
示例13: testExternalVolumes
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Test
public void testExternalVolumes() throws Exception {
final MockWebServer server = new MockWebServer();
final String mockResponse = "{\"container\": {\"volumes\": [" +
"{\"containerPath\":\"/data/db\",\"mode\":\"RW\",\"external\":" +
"{\"name\":\"mongodb-testvol\",\"provider\":\"dvdi\",\"options\":" +
"{\"dvdi/driver\":\"rexray\"}}}]}}";
try {
server.enqueue(new MockResponse().setBody(mockResponse));
server.start();
Marathon client = MarathonClient.getInstance(server.url("/").toString());
App app = new App();
app.setId("mongo");
app.setCpus(1.0);
app.setMem(256.0);
app.setContainer(new Container());
app.getContainer().setDocker(new Docker());
app.getContainer().getDocker().setImage("mongo");
app.getContainer().setVolumes(new ArrayList<Volume>());
ExternalVolume externalVolume = new ExternalVolume();
externalVolume.setName("mongodb-testvol");
externalVolume.setMode("RW");
externalVolume.setContainerPath("/data/db");
externalVolume.setProvider("dvdi");
externalVolume.setDriver("rexray");
app.getContainer().getVolumes().add(externalVolume);
final App appRes = client.createApp(app);
assertFalse(appRes.getContainer().getVolumes().isEmpty());
ExternalVolume responseVolume = (ExternalVolume) appRes.getContainer().getVolumes().iterator().next();
assertEquals("mongodb-testvol", responseVolume.getExternalVolumeInfo().getName());
RecordedRequest request = server.takeRequest();
assertNotNull(request);
final String requestBody = request.getBody().readUtf8();
assertNotNull(requestBody);
// request to JSON
JsonObject requestPayload = new Gson().fromJson(requestBody, JsonObject.class);
assertNotNull(requestPayload);
JsonObject requestVolume = requestPayload.getAsJsonObject("container").getAsJsonArray("volumes").get(0).getAsJsonObject();
assertNotNull(requestVolume);
assertEquals("RW", requestVolume.get("mode").getAsString());
assertEquals("/data/db", requestVolume.get("containerPath").getAsString());
} finally {
server.shutdown();
}
}
开发者ID:mesosphere,项目名称:marathon-client,代码行数:55,代码来源:ExternalVolumeTest.java
示例14: getMarathon
import mesosphere.marathon.client.MarathonClient; //导入依赖的package包/类
@Provides
Marathon getMarathon()
{
return MarathonClient.getInstance(parameters.marathonURI);
}
开发者ID:Marmelatze,项目名称:docker-controller,代码行数:6,代码来源:MarathonScalerModule.java
注:本文中的mesosphere.marathon.client.MarathonClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论