-
Notifications
You must be signed in to change notification settings - Fork 9
/
types.go
260 lines (209 loc) · 8.59 KB
/
types.go
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
// Copyright 2022 Namespace Labs Inc; All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
package api
import (
"fmt"
"time"
)
type CreateKubernetesClusterRequest struct {
Ephemeral bool `json:"ephemeral,omitempty"`
DocumentedPurpose string `json:"documented_purpose,omitempty"`
AuthorizedSshKeys []string `json:"authorized_ssh_keys,omitempty"`
MachineType string `json:"machine_type,omitempty"`
Feature []string `json:"feature,omitempty"`
UniqueTag string `json:"unique_tag,omitempty"`
}
type GetKubernetesClusterRequest struct {
ClusterId string `json:"cluster_id,omitempty"`
}
type WaitKubernetesClusterRequest struct {
ClusterId string `json:"cluster_id,omitempty"`
}
type CreateKubernetesClusterResponse struct {
Status string `json:"status,omitempty"`
ClusterId string `json:"cluster_id,omitempty"`
Cluster *KubernetesCluster `json:"cluster,omitempty"`
Registry *ImageRegistry `json:"registry,omitempty"`
BuildCluster *BuildCluster `json:"build_cluster,omitempty"`
Deadline string `json:"deadline,omitempty"`
}
type GetKubernetesClusterResponse struct {
Cluster *KubernetesCluster `json:"cluster,omitempty"`
Registry *ImageRegistry `json:"registry,omitempty"`
BuildCluster *BuildCluster `json:"build_cluster,omitempty"`
Deadline string `json:"deadline,omitempty"`
}
type StartCreateKubernetesClusterResponse struct {
ClusterId string `json:"cluster_id,omitempty"`
ClusterFragment *KubernetesCluster `json:"cluster_fragment,omitempty"`
Registry *ImageRegistry `json:"registry,omitempty"`
Deadline string `json:"deadline,omitempty"`
}
type CreateContainersRequest struct {
MachineType string `json:"machine_type,omitempty"`
Container []*ContainerRequest `json:"container,omitempty"`
}
type ContainerRequest struct {
Name string `json:"name,omitempty"`
Image string `json:"image,omitempty"`
Args []string `json:"args,omitempty"`
Flag []string `json:"flag,omitempty"`
}
type CreateContainersResponse struct {
ClusterId string `json:"cluster_id,omitempty"`
}
type ListKubernetesClustersRequest struct {
IncludePreviousRuns bool `json:"include_previous_runs,omitempty"`
PaginationCursor []byte `json:"pagination_cursor,omitempty"`
MaxEntries int64 `json:"max_entries,omitempty"`
}
type ListKubernetesClustersResponse struct {
Clusters []KubernetesClusterMetadata `json:"cluster"`
}
type KubernetesClusterMetadata struct {
ClusterId string `json:"cluster_id,omitempty"`
Created string `json:"created,omitempty"`
DestroyedAt string `json:"destroyed_at,omitempty"`
Deadline string `json:"deadline,omitempty"`
DocumentedPurpose string `json:"documented_purpose,omitempty"`
Shape *ClusterShape `json:"shape,omitempty"`
KubernetesDistribution string `json:"kubernetes_distribution,omitempty"`
Platform []string `json:"platform,omitempty"`
IngressDomain string `json:"ingress_domain,omitempty"`
Label []*LabelEntry `json:"label,omitempty"`
CreatorId string `json:"creator_id,omitempty"`
GithubWorkflow *GithubWorkflowInfo `json:"github_workflow,omitempty"`
}
type KubernetesCluster struct {
AppURL string `json:"app_url,omitempty"`
ClusterId string `json:"cluster_id,omitempty"`
Created string `json:"created,omitempty"`
DestroyedAt string `json:"destroyed_at,omitempty"`
Deadline string `json:"deadline,omitempty"`
SSHProxyEndpoint string `json:"ssh_proxy_endpoint,omitempty"`
SshPrivateKey []byte `json:"ssh_private_key,omitempty"`
DocumentedPurpose string `json:"documented_purpose,omitempty"`
Shape *ClusterShape `json:"shape,omitempty"`
EndpointAddress string `json:"endpoint_address,omitempty"`
CertificateAuthorityData []byte `json:"certificate_authority_data,omitempty"`
ClientCertificateData []byte `json:"client_certificate_data,omitempty"`
ClientKeyData []byte `json:"client_key_data,omitempty"`
KubernetesDistribution string `json:"kubernetes_distribution,omitempty"`
Platform []string `json:"platform,omitempty"`
IngressDomain string `json:"ingress_domain,omitempty"`
Label []*LabelEntry `json:"label,omitempty"`
CreatorId string `json:"creator_id,omitempty"`
GithubWorkflow *GithubWorkflowInfo `json:"github_workflow,omitempty"`
ServiceState []*Cluster_ServiceState `json:"service_state,omitempty"`
}
type Cluster_ServiceState struct {
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
Endpoint string `json:"endpoint,omitempty"` // Service-specific endpoint.
Public bool `json:"public,omitempty"`
}
type GithubWorkflowInfo struct {
Repository string `json:"repository,omitempty"`
RunId string `json:"run_id,omitempty"`
RunAttempt string `json:"run_attempt,omitempty"`
Sha string `json:"sha,omitempty"`
Ref string `json:"ref,omitempty"`
Actor string `json:"actor,omitempty"`
Workflow string `json:"workflow,omitempty"`
}
type GetImageRegistryResponse struct {
Registry *ImageRegistry `json:"registry,omitempty"`
NSCR *ImageRegistry `json:"nscr,omitempty"`
}
type TailLogsRequest struct {
ClusterID string `json:"cluster_id,omitempty"`
Include []*LogsSelector `json:"include,omitempty"`
Exclude []*LogsSelector `json:"exclude,omitempty"`
}
type GetLogsRequest struct {
ClusterID string `json:"cluster_id,omitempty"`
StartTs *time.Time `json:"start_ts,omitempty"`
EndTs *time.Time `json:"end_ts,omitempty"`
Include []*LogsSelector `json:"include,omitempty"`
Exclude []*LogsSelector `json:"exclude,omitempty"`
}
type GetLogsResponse struct {
LogBlock []LogBlock `json:"log_block,omitempty"`
}
type LogsSelector struct {
Namespace string `json:"namespace,omitempty"`
Pod string `json:"pod,omitempty"`
Container string `json:"container,omitempty"`
}
type LogBlock struct {
Namespace string `json:"namespace,omitempty"`
Pod string `json:"pod,omitempty"`
Container string `json:"container,omitempty"`
Line []LogLine `json:"line,omitempty"`
}
type LogLine struct {
Timestamp time.Time `json:"timestamp,omitempty"`
Content string `json:"content,omitempty"`
Stream string `json:"stream,omitempty"`
}
func (l LogLine) String() string {
return fmt.Sprintf("%s stream=%s msg=%s", l.Timestamp.Format(time.RFC3339), l.Stream, l.Content)
}
type ImageRegistry struct {
EndpointAddress string `json:"endpoint_address,omitempty"`
Repository string `json:"repository,omitempty"`
}
type ClusterShape struct {
VirtualCpu int32 `json:"virtual_cpu,omitempty"`
MemoryMegabytes int32 `json:"memory_megabytes,omitempty"`
MachineArch string `json:"machine_arch,omitempty"`
}
type DestroyKubernetesClusterRequest struct {
ClusterId string `json:"cluster_id,omitempty"`
}
type ReleaseKubernetesClusterRequest struct {
ClusterId string `json:"cluster_id,omitempty"`
}
type LabelEntry struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
}
type BuildCluster struct {
Colocated *BuildCluster_ColocatedPort `json:"colocated,omitempty"`
}
type BuildCluster_ColocatedPort struct {
TargetPort int32 `json:"target_port,omitempty"`
ClusterId string `json:"cluster_id,omitempty"`
}
type Attachment struct {
TypeURL string `json:"type_url,omitempty"`
Content []byte `json:"content,omitempty"`
}
type RefreshKubernetesClusterRequest struct {
ClusterId string `json:"cluster_id,omitempty"`
}
type RefreshKubernetesClusterResponse struct {
NewDeadline string `json:"new_deadline,omitempty"`
}
type GetKubernetesConfigRequest struct {
ClusterId string `json:"cluster_id,omitempty"`
}
type GetKubernetesConfigResponse struct {
Kubeconfig string `json:"kubeconfig,omitempty"`
}
type GetProfileResponse struct {
ClusterPlatform []string `json:"cluster_platform,omitempty"`
}
type RegisterDefaultIngressRequest struct {
ClusterId string `json:"cluster_id,omitempty"`
Prefix string `json:"prefix,omitempty"`
BackendEndpoint *IngressBackendEndpoint `json:"backend_endpoint,omitempty"`
}
type IngressBackendEndpoint struct {
GuestIpAddr string `json:"guest_ip_addr,omitempty"`
Port int32 `json:"port,omitempty"`
}
type RegisterDefaultIngressResponse struct {
Fqdn string `json:"fqdn,omitempty"`
}