Repository navigation
Expand file tree
/
Copy pathSessionCreateParams.java
More file actions
87 lines (67 loc) · 2.18 KB
/
Copy pathSessionCreateParams.java
File metadata and controls
87 lines (67 loc) · 2.18 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.qoder.cloudagents.forward;
import com.qoder.cloudagents.core.*;
import java.util.*;
/** Immutable JSON configuration; unknown fields are preserved. */
public final class SessionCreateParams extends JsonObject {
private SessionCreateParams(JsonValue value) {
super(value);
}
public static SessionCreateParams fromJson(JsonValue value) {
return new SessionCreateParams(value);
}
public String identityId() {
return optional("identity_id", JsonValue::asString);
}
public String templateId() {
return optional("template_id", JsonValue::asString);
}
public String title() {
return optional("title", JsonValue::asString);
}
/** Null means no limit; field("budget") distinguishes omission from explicit null. */
public SessionBudget budget() {
return optional("budget", SessionBudget::fromJson);
}
public Map<String, JsonValue> metadata() {
return optionalMap("metadata", item -> item);
}
public SessionConfig config() {
return optional("config", SessionConfig::fromJson);
}
public List<SessionResourceSpec> resources() {
return optionalList("resources", SessionResourceSpec::fromJson);
}
public static Builder builder() {
return new Builder();
}
public static final class Builder extends JsonObjectBuilder<Builder> {
private Builder() {}
public Builder identityId(String value) {
return put("identity_id", value);
}
public Builder templateId(String value) {
return put("template_id", value);
}
public Builder title(String value) {
return put("title", value);
}
/** Omit to keep the default/current budget; null clears it. */
public Builder budget(SessionBudget value) {
return put("budget", value);
}
public Builder metadata(Map<String, JsonValue> value) {
return put("metadata", value);
}
public Builder config(SessionConfig value) {
return put("config", value);
}
public Builder resources(List<SessionResourceSpec> value) {
return put("resources", value);
}
public SessionCreateParams build() {
require("identity_id");
require("template_id");
return new SessionCreateParams(json());
}
}
}