Class: VersSdk::SetEnvVarsRequest

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

Overview

Request body for PUT /env_vars — sets (upserts) one or more environment variables. # Lifecycle model Environment variables are written to ‘/etc/environment` inside a VM **once at boot time** via a vsock `WriteFile` request. They are not live-synced to running VMs. This is intentional: VMs are ephemeral (create → use → destroy/branch), so env var changes naturally take effect on the next VM. The `replace` flag exists so callers can atomically express ’I want exactly these variables and nothing else’ without having to DELETE each stale key individually. Without it, the only way to remove a variable from future VMs is a separate ‘DELETE /env_vars/key` call per key.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_json(json_str) ⇒ Object



909
910
911
912
# File 'lib/vers_sdk/models.rb', line 909

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



914
915
916
917
918
919
# File 'lib/vers_sdk/models.rb', line 914

def to_h
  {
    "replace" => @set_env_vars_request,
    "vars" => @set_env_vars_request,
  }
end

#to_json(*args) ⇒ Object



921
922
923
# File 'lib/vers_sdk/models.rb', line 921

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