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



1174
1175
1176
1177
# File 'lib/vers_sdk/models.rb', line 1174

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



1179
1180
1181
1182
1183
1184
# File 'lib/vers_sdk/models.rb', line 1179

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

#to_json(*args) ⇒ Object



1186
1187
1188
# File 'lib/vers_sdk/models.rb', line 1186

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