Skip to content

Commit 8ce4014

Browse files
feat: Add metadata field to instances
1 parent 5fc15d8 commit 8ce4014

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 37
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-0541294848c0b8de2c31a105855c740dc98d1480dd27a20a52d7bc291ba001d8.yml
3-
openapi_spec_hash: 03714883bdadb4a6a743a7faec477a05
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fhypeman-517b6ad15b7de0b84f157cdace2d86d68a3514807731c22dc69bac5668fc7b73.yml
3+
openapi_spec_hash: 8e42a75b55ee207d38d47988a1a6cd90
44
config_hash: d452c139da1e46a44a68b91e8a40de72

instance.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ type Instance struct {
205205
//
206206
// Any of "cloud-hypervisor", "qemu", "vz".
207207
Hypervisor InstanceHypervisor `json:"hypervisor"`
208+
// User-defined key-value metadata
209+
Metadata map[string]string `json:"metadata"`
208210
// Network configuration of the instance
209211
Network InstanceNetwork `json:"network"`
210212
// Writable overlay disk size (human-readable)
@@ -234,6 +236,7 @@ type Instance struct {
234236
HasSnapshot respjson.Field
235237
HotplugSize respjson.Field
236238
Hypervisor respjson.Field
239+
Metadata respjson.Field
237240
Network respjson.Field
238241
OverlaySize respjson.Field
239242
Size respjson.Field
@@ -475,6 +478,8 @@ type InstanceNewParams struct {
475478
//
476479
// Any of "cloud-hypervisor", "qemu", "vz".
477480
Hypervisor InstanceNewParamsHypervisor `json:"hypervisor,omitzero"`
481+
// User-defined key-value metadata for the instance
482+
Metadata map[string]string `json:"metadata,omitzero"`
478483
// Network configuration for the instance
479484
Network InstanceNewParamsNetwork `json:"network,omitzero"`
480485
// Volumes to attach to the instance at creation time

instance_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ func TestInstanceNewWithOptionalParams(t *testing.T) {
4040
},
4141
HotplugSize: hypeman.String("2GB"),
4242
Hypervisor: hypeman.InstanceNewParamsHypervisorCloudHypervisor,
43+
Metadata: map[string]string{
44+
"team": "backend",
45+
"purpose": "staging",
46+
},
4347
Network: hypeman.InstanceNewParamsNetwork{
4448
BandwidthDownload: hypeman.String("1Gbps"),
4549
BandwidthUpload: hypeman.String("1Gbps"),

0 commit comments

Comments
 (0)