Class: VersSdk::LabelVmRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/vers_sdk/models.rb

Overview

Request body for ‘PATCH /vm/vm_id/label` (upsert) and `PUT /vm/vm_id/labels` (replace). `labels` is required on both endpoints. Sending a body without the field deserializes to a 400 — this is deliberate: the previous `Option<HashMap<…>>` shape silently no-op’d PATCH and (worse) silently wiped every label on PUT. An empty map (‘{ ’labels’: {} }‘) is still accepted as an explicit ’clear all’ for PUT and an explicit ‘no-op’ for PATCH.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_json(json_str) ⇒ Object



1412
1413
1414
1415
# File 'lib/vers_sdk/models.rb', line 1412

def self.from_json(json_str)
  obj = json_str.is_a?(String) ? JSON.parse(json_str) : json_str
  new(obj)
end

Instance Method Details

#to_hObject



1417
1418
1419
1420
1421
# File 'lib/vers_sdk/models.rb', line 1417

def to_h
  {
    "labels" => @label_vm_request,
  }
end

#to_json(*args) ⇒ Object



1423
1424
1425
# File 'lib/vers_sdk/models.rb', line 1423

def to_json(*args)
  to_h.to_json(*args)
end