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 Nov 23, 2023
1 parent 17e75b6 commit b78952a
Show file tree
Hide file tree
Showing 17 changed files with 475 additions and 165 deletions.
60 changes: 59 additions & 1 deletion doc/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi" : "3.0.3",
"info" : {
"title" : "Theia.cloud API",
"version" : "0.8.0"
"version" : "0.8.1"
},
"paths" : {
"/service" : {
Expand Down Expand Up @@ -144,6 +144,7 @@
"description" : "Not Allowed"
}
},
"deprecated" : true,
"security" : [ {
"SecurityScheme" : [ ]
} ]
Expand Down Expand Up @@ -422,6 +423,40 @@
}
}
},
"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 @@ -462,6 +497,13 @@
}, {
"description" : "Environment variables"
} ]
},
"gitInit" : {
"allOf" : [ {
"$ref" : "#/components/schemas/GitInit"
}, {
"description" : "Git Init information"
} ]
}
}
},
Expand Down Expand Up @@ -589,6 +631,12 @@
"items" : {
"type" : "string"
}
},
"initOperations" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/InitOperation"
}
}
}
},
Expand Down Expand Up @@ -624,6 +672,13 @@
}, {
"description" : "Environment variables"
} ]
},
"gitInit" : {
"allOf" : [ {
"$ref" : "#/components/schemas/GitInit"
}, {
"description" : "Git Init information"
} ]
}
}
},
Expand Down Expand Up @@ -737,6 +792,9 @@
"description" : "Authentication",
"flows" : {
"implicit" : {
"authorizationUrl" : "http://localhost:34159/realms/quarkus/protocol/openid-connect/auth",
"tokenUrl" : "http://localhost:34159/realms/quarkus/protocol/openid-connect/token/introspect",
"refreshUrl" : "http://localhost:34159/realms/quarkus/protocol/openid-connect/token"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,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 INVALID_SESSION_NAME = new TheiaCloudError(474, "Invalid session name.");
Expand Down
Loading

0 comments on commit b78952a

Please sign in to comment.