public abstract class MarathonBuilder extends Object
Marathon Clients from Jenkins, file system, and JSON pieces.
This allows the construction of the final payload as well as sending it to the target Marathon instance.| Constructor and Description |
|---|
MarathonBuilder() |
| Modifier and Type | Method and Description |
|---|---|
abstract MarathonBuilder |
build()
Compose the builder.
|
mesosphere.marathon.client.model.v2.App |
getApp() |
static MarathonBuilder |
getBuilder(AppConfig config)
Create a new builder instance from config.
|
abstract net.sf.json.JSONObject |
getJson() |
String |
getURL() |
abstract MarathonBuilder |
read()
Read in default file (marathon.json) as JSON.
|
abstract MarathonBuilder |
read(String filename)
Read in filename as JSON.
|
protected void |
setAppFromJson(net.sf.json.JSONObject json)
Set Marathon application from JSON object.
|
abstract MarathonBuilder |
setConfig(AppConfig config)
Set the Application Configuration to config.
|
abstract MarathonBuilder |
setEnvVars(hudson.EnvVars vars)
Set the Jenkins Environment Variables to vars.
|
abstract MarathonBuilder |
setJson(net.sf.json.JSONObject json)
Set the JSON for this builder to json.
|
void |
setURL(String url) |
abstract MarathonBuilder |
setWorkspace(hudson.FilePath ws)
Set the Jenkins workspace to ws.
|
abstract MarathonBuilder |
toFile()
Write the JSON that will be sent to the target Marathon instance to the default file
(marathon-rendered-${BUILD_NUMBER}.json).
|
abstract MarathonBuilder |
toFile(String filename)
Write the JSON that will be sent to the target Marathon instance to filename.
|
abstract MarathonBuilder |
update()
Update the Marathon application.
|
public static MarathonBuilder getBuilder(AppConfig config)
config - Application configurationpublic String getURL()
public void setURL(String url)
public mesosphere.marathon.client.model.v2.App getApp()
protected void setAppFromJson(net.sf.json.JSONObject json)
throws com.google.gson.JsonSyntaxException
json - JSON object to initially build Marathon application fromcom.google.gson.JsonSyntaxExceptionpublic abstract MarathonBuilder update() throws mesosphere.marathon.client.MarathonException, AuthenticationException
mesosphere.marathon.client.MarathonException - on error talking to Marathon serviceAuthenticationException - when authentication with Marathon service failspublic abstract MarathonBuilder read(String filename) throws IOException, InterruptedException, MarathonFileMissingException, MarathonFileInvalidException
filename - Path to the JSON fileIOException - on IO issuesInterruptedException - on complications reading fileMarathonFileMissingException - when the Marathon config file is missingMarathonFileInvalidException - when the Marathon config is not a filepublic abstract MarathonBuilder read() throws IOException, InterruptedException, MarathonFileMissingException, MarathonFileInvalidException
IOException - on IO issuesInterruptedException - on complications reading fileMarathonFileMissingException - when the Marathon config file is missingMarathonFileInvalidException - when the Marathon config is not a fileread(String)public abstract net.sf.json.JSONObject getJson()
public abstract MarathonBuilder setJson(net.sf.json.JSONObject json)
read(String).json - The JSON value to use for this builderpublic abstract MarathonBuilder setEnvVars(hudson.EnvVars vars)
vars - Jenkins environment variablespublic abstract MarathonBuilder setConfig(AppConfig config)
config - application configurationpublic abstract MarathonBuilder setWorkspace(hudson.FilePath ws)
ws - Jenkins workspacepublic abstract MarathonBuilder build()
MarathonClientpublic abstract MarathonBuilder toFile(String filename) throws InterruptedException, MarathonFileInvalidException, IOException
filename - File to write rendered JSONInterruptedException - when issues encountered with filesystemMarathonFileInvalidException - when Marathon config file is not a fileIOException - on IO issuespublic abstract MarathonBuilder toFile() throws InterruptedException, IOException, MarathonFileInvalidException
InterruptedException - when issues encountered with filesystemIOException - on IO issuesMarathonFileInvalidException - when Marathon config file is not a filetoFile(String)Copyright © 2016–2017. All rights reserved.