Repository navigation
Expand file tree
/
Copy pathEnvironmentConfig.java
More file actions
71 lines (54 loc) · 1.77 KB
/
Copy pathEnvironmentConfig.java
File metadata and controls
71 lines (54 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package com.qoder.cloudagents.managed;
import com.qoder.cloudagents.core.*;
import java.util.*;
/** Immutable JSON configuration; unknown fields are preserved. */
public final class EnvironmentConfig extends JsonObject {
private EnvironmentConfig(JsonValue value) {
super(value);
}
public static EnvironmentConfig fromJson(JsonValue value) {
return new EnvironmentConfig(value);
}
public String type() {
return optional("type", JsonValue::asString);
}
/** Runs on each sandbox start or resume; self-hosted execution depends on the worker. */
public String startupScript() {
return optional("startup_script", JsonValue::asString);
}
public String setupScript() {
return optional("setup_script", JsonValue::asString);
}
public EnvironmentPackages packages() {
return optional("packages", EnvironmentPackages::fromJson);
}
public EnvironmentStorage storage() {
return optional("storage", EnvironmentStorage::fromJson);
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends JsonObjectBuilder<Builder> {
private Builder() {}
public Builder type(String value) {
return put("type", value);
}
/** Configure a startup script; the SDK does not execute it. */
public Builder startupScript(String value) {
return put("startup_script", value);
}
public Builder setupScript(String value) {
return put("setup_script", value);
}
public Builder packages(EnvironmentPackages value) {
return put("packages", value);
}
public Builder storage(EnvironmentStorage value) {
return put("storage", value);
}
public EnvironmentConfig build() {
require("type");
return new EnvironmentConfig(json());
}
}
}