-
Notifications
You must be signed in to change notification settings - Fork 0
/
ece_api_structures.go
284 lines (251 loc) · 14 KB
/
ece_api_structures.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
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
package main
// ClusterCredentials defines the username and password for the new Elasticsearch cluster, which
// is returned from the Elasticsearch cluster create command.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ClusterCredentials
type ClusterCredentials struct {
Password string `json:"password"`
Username string `json:"username"`
}
// ClusterCrudResponse defines the response to an Elasticsearch cluster or Kibana instance CRUD
// (create/update-plan) request.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ClusterCrudResponse
type ClusterCrudResponse struct {
Credentials ClusterCredentials `json:"credentials"`
ElasticsearchClusterID string `json:"elasticsearch_cluster_id"`
KibanaClusterID string `json:"kibana_cluster_id"`
}
// ClusterInstanceInfo defines information about each instance in the Elasticsearch cluster.
type ClusterInstanceInfo struct {
ServiceRoles []string `json:"service_roles"` // Currently only populated for Elasticsearch, with possible values: master,data,ingest,ml
}
// ClusterMetadataSettings defines the top-level configuration settings for the Elasticsearch cluster.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ClusterMetadataSettings
type ClusterMetadataSettings struct {
ClusterName string `json:"name"`
}
// ClusterPlanStepInfo defines information about a step in a plan.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ClusterPlanStepInfo
type ClusterPlanStepInfo struct {
Completed string `json:"completed"`
DurationMS int64 `json:"duration_in_millis"`
InfoLog []ClusterPlanStepLogMessageInfo `json:"info_log"`
Stage string `json:"stage"`
Started string `json:"started"`
Status string `json:"status"`
StepID string `json:"step_id"`
}
// ClusterPlanStepLogMessageInfo defines the log message from a specified stage of an executed step in a plan.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ClusterPlanStepLogMessageInfo
type ClusterPlanStepLogMessageInfo struct {
DeltaMS int64 `json:"delta_in_millis"`
Message string `json:"message"`
Stage string `json:"stage"`
Timestamp string `json:"timestamp"`
}
// ClusterTopologyInfo defines the topology for Elasticsearch clusters, multiple Kibana instances, or multiple APM Servers.
// The ClusterTopologyInfo also includes the instances and containers, and where they are located.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ClusterTopologyInfo
type ClusterTopologyInfo struct {
Healthy bool `json:"healthy"`
Instances []ClusterInstanceInfo `json:"instances"`
}
// CreateElasticsearchClusterRequest defines the request body for creating an Elasticsearch cluster.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#CreateElasticsearchClusterRequest
type CreateElasticsearchClusterRequest struct {
ClusterName string `json:"cluster_name"`
Kibana *CreateKibanaInCreateElasticsearchRequest `json:"kibana"`
Plan ElasticsearchClusterPlan `json:"plan"`
}
// CreateKibanaInCreateElasticsearchRequest defines the request body for creating a Kibana instance,
// which is included in the Elasticsearch cluster create request.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#CreateKibanaInCreateElasticsearchRequest
type CreateKibanaInCreateElasticsearchRequest struct {
ClusterName string `json:"cluster_name,omitempty"`
Plan *KibanaClusterPlan `json:"plan"`
}
// CreateKibanaRequest defines the request body for creating one or more Kibana instances.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#CreateKibanaRequest
type CreateKibanaRequest struct {
ClusterName string `json:"cluster_name"`
ElasticsearchClusterID string `json:"elasticsearch_cluster_id"`
Plan *KibanaClusterPlan `json:"plan"`
}
// ElasticsearchClusterInfo defines the information for an Elasticsearch cluster.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchClusterInfo
type ElasticsearchClusterInfo struct {
ClusterID string `json:"cluster_id"`
ClusterName string `json:"cluster_name"`
Healthy bool `json:"healthy"`
PlanInfo ElasticsearchClusterPlansInfo `json:"plan_info"`
AssociatedKibanaClusters []KibanaSubClusterInfo `json:"associated_kibana_clusters"`
Status string `json:"status"`
Topology ClusterTopologyInfo `json:"topology"`
}
// ElasticsearchClusterPlan defines the plan for an Elasticsearch cluster.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchClusterPlan
type ElasticsearchClusterPlan struct {
ClusterTopology []ElasticsearchClusterTopologyElement `json:"cluster_topology"`
Elasticsearch ElasticsearchConfiguration `json:"elasticsearch"`
Transient TransientElasticsearchPlanConfiguration `json:"transient,omitempty"`
ZoneCount int `json:"zone_count"`
}
// ElasticsearchClusterPlanInfo defines information about an Elasticsearch cluster plan.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchClusterPlanInfo
type ElasticsearchClusterPlanInfo struct {
AttemptEndTime string `json:"attempt_end_time"`
AttemptStartTime string `json:"attempt_start_time"`
Healthy bool `json:"healthy"`
Plan ElasticsearchClusterPlan `json:"plan"`
PlanAttemptID string `json:"plan_attempt_id"`
PlanAttemptLog []ClusterPlanStepInfo `json:"plan_attempt_log"`
PlanAttemptName string `json:"plan_attempt_name"`
PlanEndTime string `json:"plan_end_time"`
}
// ElasticsearchClusterPlansInfo defines information about the current, pending, and past Elasticsearch cluster plans.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchClusterPlansInfo
type ElasticsearchClusterPlansInfo struct {
Current ElasticsearchClusterPlanInfo `json:"current"`
Healthy bool `json:"healthy"`
History []ElasticsearchClusterPlanInfo `json:"history"`
Pending ElasticsearchClusterPlanInfo `json:"pending"`
}
// ElasticsearchClusterTopologyElement defines the topology of the Elasticsearch nodes, including the number,
// capacity, and type of nodes, and where they can be allocated.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchClusterTopologyElement
type ElasticsearchClusterTopologyElement struct {
InstanceConfigurationID string `json:"instance_configuration_id"`
MemoryPerNode int `json:"memory_per_node"`
NodeCountPerZone int `json:"node_count_per_zone"`
NodeType ElasticsearchNodeType `json:"node_type"`
ZoneCount int `json:"zone_count"`
}
// DefaultElasticsearchClusterTopologyElement returns a new ElasticsearchClusterTopologyElement with default values.
func DefaultElasticsearchClusterTopologyElement() *ElasticsearchClusterTopologyElement {
return &ElasticsearchClusterTopologyElement{
InstanceConfigurationID: "data.default",
MemoryPerNode: 1024,
NodeCountPerZone: 1,
NodeType: *DefaultElasticsearchNodeType(),
ZoneCount: 1,
}
}
// ElasticsearchConfiguration defines the Elasticsearch cluster settings.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchConfiguration
type ElasticsearchConfiguration struct {
SystemSettings ElasticsearchSystemSettings `json:"system_settings"`
Version string `json:"version"`
}
// ElasticsearchNodeType defines the combinations of Elasticsearch node types.
// TIP: By default, the Elasticsearch node is master eligible, can hold data, and run ingest pipelines.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchNodeType
type ElasticsearchNodeType struct {
Data bool `json:"data"`
Ingest bool `json:"ingest"`
Master bool `json:"master"`
ML bool `json:"ml"`
}
// DefaultElasticsearchNodeType creates a new ElasticsearchNodeType with default values.
func DefaultElasticsearchNodeType() *ElasticsearchNodeType {
return &ElasticsearchNodeType{
Data: true,
Ingest: true,
Master: true,
ML: false,
}
}
// ElasticsearchPlanControlConfiguration defines the configuration settings for the timeout and fallback parameters.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchPlanControlConfiguration
type ElasticsearchPlanControlConfiguration struct {
// Commenting because default is calculated based on cluster size and is
// typically higher than configured provider timeout.
// Timeout int64 `json:"timeout"`
}
// ElasticsearchSystemSettings defines a subset of elasticsearch settings.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#ElasticsearchSystemSettings
type ElasticsearchSystemSettings struct {
UseDiskThreshold bool `json:"use_disk_threshold"`
}
// DefaultElasticsearchSystemSettings returns a new ElasticsearchSystemSettings with default values.
func DefaultElasticsearchSystemSettings() *ElasticsearchSystemSettings {
return &ElasticsearchSystemSettings{
UseDiskThreshold: true,
}
}
// KibanaClusterInfo defines the top-level object information for a Kibana instance.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#KibanaClusterInfo
type KibanaClusterInfo struct {
ClusterID string `json:"cluster_id"`
ClusterName string `json:"cluster_name"`
Healthy bool `json:"healthy"`
Status string `json:"status"`
}
// KibanaClusterPlan defines the plan for the Kibana instance.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#KibanaClusterPlan
type KibanaClusterPlan struct {
ClusterTopology []KibanaClusterTopologyElement `json:"cluster_topology"`
Kibana KibanaConfiguration `json:"kibana"`
ZoneCount int `json:"zone_count"`
}
// DefaultKibanaClusterPlan returns a new KibanaClusterPlan with default values.
func DefaultKibanaClusterPlan() *KibanaClusterPlan {
return &KibanaClusterPlan{
ClusterTopology: []KibanaClusterTopologyElement{*DefaultKibanaClusterTopologyElement()},
Kibana: *DefaultKibanaConfiguration(),
ZoneCount: 1,
}
}
// KibanaClusterPlanInfo defines information about the current, pending, or past Kibana instance plan.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#KibanaClusterPlanInfo
type KibanaClusterPlanInfo struct {
AttemptEndTime string `json:"attempt_end_time"`
AttemptStartTime string `json:"attempt_start_time"`
Healthy bool `json:"healthy"`
Plan KibanaClusterPlan `json:"plan"`
PlanAttemptID string `json:"plan_attempt_id"`
PlanAttemptLog []ClusterPlanStepInfo `json:"plan_attempt_log"`
PlanAttemptName string `json:"plan_attempt_name"`
PlanEndTime string `json:"plan_end_time"`
}
// KibanaClusterPlansInfo defines information about the current, pending, or past Kibana instance plans.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#KibanaClusterPlansInfo
type KibanaClusterPlansInfo struct {
Current KibanaClusterPlanInfo `json:"current"`
Healthy bool `json:"healthy"`
}
// KibanaClusterTopologyElement defines the topology of the Kibana nodes, including the number, capacity, and
// type of nodes, and where they can be allocated.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#KibanaClusterTopologyElement
type KibanaClusterTopologyElement struct {
MemoryPerNode int `json:"memory_per_node"`
NodeCountPerZone int `json:"node_count_per_zone"`
ZoneCount int `json:"zone_count"`
}
// DefaultKibanaClusterTopologyElement returns a new KibanaClusterTopologyElement with default values.
func DefaultKibanaClusterTopologyElement() *KibanaClusterTopologyElement {
return &KibanaClusterTopologyElement{
MemoryPerNode: 1024,
NodeCountPerZone: 1,
ZoneCount: 1,
}
}
// KibanaConfiguration defines the Kibana instance settings. When specified at the top level, provides a field-by-field default.
// When specified at the topology level, provides the override settings.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#KibanaConfiguration
type KibanaConfiguration struct {
}
// DefaultKibanaConfiguration returns a new KibanaConfiguration with default values.
func DefaultKibanaConfiguration() *KibanaConfiguration {
return &KibanaConfiguration{}
}
// KibanaSubClusterInfo defines information about the Kibana instances associated with the Elasticsearch cluster.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#KibanaSubClusterInfo
type KibanaSubClusterInfo struct {
Enabled bool `json:"enabled"`
KibanaID string `json:"kibana_id"`
}
// TransientElasticsearchPlanConfiguration defines the configuration parameters that control how the plan is applied.
// For example, the Elasticsearch cluster topology and Elasticsearch settings.
// See https://www.elastic.co/guide/en/cloud-enterprise/current/definitions.html#TransientElasticsearchPlanConfiguration
type TransientElasticsearchPlanConfiguration struct {
PlanConfiguration ElasticsearchPlanControlConfiguration `json:"plan_configuration"`
}