Skip to content

Commit

Permalink
Add new API to Service #69
Browse files Browse the repository at this point in the history
* make auth info optional (for public repos)
* regenerate open api schema
* regenerate typescript API
  • Loading branch information
jfaltermeier committed May 17, 2023
1 parent 4d7a6e1 commit 62d4351
Show file tree
Hide file tree
Showing 12 changed files with 481 additions and 153 deletions.
115 changes: 89 additions & 26 deletions doc/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"description" : "Not Allowed"
}
},
"deprecated" : true,
"security" : [ {
"SecurityScheme" : [ ]
} ]
Expand Down Expand Up @@ -395,6 +396,67 @@
},
"components" : {
"schemas" : {
"EnvironmentVars" : {
"description" : "An object to hold all the ways environment variables can be passed. Not to be used by itself.",
"type" : "object",
"properties" : {
"fromMap" : {
"description" : "Map of environment variables to be passed to Deployment. Ignored if Theia applications are started eagerly. Empty by default.",
"type" : "object",
"additionalProperties" : {
"type" : "string"
}
},
"fromConfigMaps" : {
"description" : "List of ConfigMaps (by name) containing environment variables to be passed to Deployment as envFrom.configMapRef. Ignored if Theia applications are started eagerly. Empty by default.",
"type" : "array",
"items" : {
"type" : "string"
}
},
"fromSecrets" : {
"description" : "List of Secrets (by name) containing environment variables to be passed to Deployment as envFrom.secretRef. Ignored if Theia applications are started eagerly. Empty by default.",
"type" : "array",
"items" : {
"type" : "string"
}
}
}
},
"GitInit" : {
"description" : "Holds information used to initialize a Workspace with a clone of a Git repository.",
"required" : [ "repository", "checkout" ],
"type" : "object",
"properties" : {
"repository" : {
"description" : "The Git repository URL.",
"type" : "string"
},
"checkout" : {
"description" : "The branch, commit-id, or tag name to checkout.",
"type" : "string",
"example" : "main, bd402d6, tags/1.0.0"
},
"authInformation" : {
"description" : "Key for the required auth information, if the repository is not public.",
"type" : "string"
}
}
},
"InitOperation" : {
"type" : "object",
"properties" : {
"id" : {
"type" : "string"
},
"arguments" : {
"type" : "array",
"items" : {
"type" : "string"
}
}
}
},
"LaunchRequest" : {
"description" : "A request to launch a new session.",
"required" : [ "appId", "user" ],
Expand Down Expand Up @@ -431,36 +493,17 @@
},
"env" : {
"allOf" : [ {
"$ref" : "#/components/schemas/LaunchRequest.Env"
"$ref" : "#/components/schemas/EnvironmentVars"
}, {
"description" : "Environment variables"
} ]
}
}
},
"LaunchRequest.Env" : {
"type" : "object",
"properties" : {
"fromMap" : {
"description" : "Map of environment variables to be passed to Deployment. Ignored if Theia applications are started eagerly. Empty by default.",
"type" : "object",
"additionalProperties" : {
"type" : "string"
}
},
"fromConfigMaps" : {
"description" : "List of ConfigMaps (by name) containing environment variables to be passed to Deployment as envFrom.configMapRef. Ignored if Theia applications are started eagerly. Empty by default.",
"type" : "array",
"items" : {
"type" : "string"
}
},
"fromSecrets" : {
"description" : "List of Secrets (by name) containing environment variables to be passed to Deployment as envFrom.secretRef. Ignored if Theia applications are started eagerly. Empty by default.",
"type" : "array",
"items" : {
"type" : "string"
}
"gitInit" : {
"allOf" : [ {
"$ref" : "#/components/schemas/GitInit"
}, {
"description" : "Git Init information"
} ]
}
}
},
Expand Down Expand Up @@ -588,6 +631,12 @@
"items" : {
"type" : "string"
}
},
"initOperations" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/InitOperation"
}
}
}
},
Expand Down Expand Up @@ -616,6 +665,20 @@
"format" : "int32",
"description" : "Number of minutes to wait for session launch. Default is 3 Minutes.",
"type" : "integer"
},
"env" : {
"allOf" : [ {
"$ref" : "#/components/schemas/EnvironmentVars"
}, {
"description" : "Environment variables"
} ]
},
"gitInit" : {
"allOf" : [ {
"$ref" : "#/components/schemas/GitInit"
}, {
"description" : "Git Init information"
} ]
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,35 @@ public SessionSpec(String name, String appDefinition, String user) {
this(name, appDefinition, user, null);
}

public SessionSpec(String name, String appDefinition, String user, String workspace) {
this(name, appDefinition, user, workspace, Map.of(), List.of(), List.of());
public SessionSpec(String name, String appDefinition, String user, Map<String, String> envVars,
List<String> envVarsFromConfigMaps, List<String> envVarsFromSecrets) {
this(name, appDefinition, user, null, Map.of(), List.of(), List.of(), List.of());
}

public SessionSpec(String name, String appDefinition, String user, String workspace, Map<String, String> envVars) {
this(name, appDefinition, user, workspace, envVars, List.of(), List.of());
public SessionSpec(String name, String appDefinition, String user, String workspace) {
this(name, appDefinition, user, workspace, Map.of(), List.of(), List.of(), List.of());
}

public SessionSpec(String name, String appDefinition, String user, String workspace, Map<String, String> envVars,
List<String> envVarsFromConfigMaps) {
this(name, appDefinition, user, workspace, envVars, envVarsFromConfigMaps, List.of());
List<String> envVarsFromConfigMaps, List<String> envVarsFromSecrets) {
this(name, appDefinition, user, workspace, envVars, envVarsFromConfigMaps, envVarsFromSecrets, List.of());
}

public SessionSpec(String name, String appDefinition, String user, String workspace,
List<InitOperation> initOperations) {
this(name, appDefinition, user, workspace, Map.of(), List.of(), List.of(), initOperations);
}

public SessionSpec(String name, String appDefinition, String user, String workspace, Map<String, String> envVars,
List<String> envVarsFromConfigMaps, List<String> envVarsFromSecrets) {
List<String> envVarsFromConfigMaps, List<String> envVarsFromSecrets, List<InitOperation> initOperations) {
this.name = name;
this.appDefinition = appDefinition;
this.user = user;
this.workspace = workspace;
this.envVars = envVars;
this.envVarsFromConfigMaps = envVarsFromConfigMaps;
this.envVarsFromSecrets = envVarsFromSecrets;
this.initOperations = initOperations;
}

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class TheiaCloudError {
// client errors: 47x
public static final TheiaCloudError INVALID_APP_ID = new TheiaCloudError(470, "Invalid application id.");
public static final TheiaCloudError INVALID_WORKSPACE_NAME = new TheiaCloudError(471, "Invalid workspace name.");
public static final TheiaCloudError INVALID_GIT_INIT_CONFIGURATION = new TheiaCloudError(472,
"Invalid git init configuration");
public static final TheiaCloudError INVALID_APP_DEFINITION_NAME = new TheiaCloudError(473,
"Invalid app definition name.");
public static final TheiaCloudError MISSING_WORKSPACE_NAME = new TheiaCloudError(480, "Missing workspace name.");
Expand Down
Loading

0 comments on commit 62d4351

Please sign in to comment.