Method: Vcloud::Core::Vapp#update_custom_fields

Defined in:
lib/vcloud/core/vapp.rb

#update_custom_fields(custom_fields) ⇒ Boolean

Update custom_fields for vApp

Parameters:

  • custom_fields (Array)

    Array of Hashes describing the custom fields

Returns:

  • (Boolean)

    return true or throws error



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/vcloud/core/vapp.rb', line 137

def update_custom_fields(custom_fields)
  return if custom_fields.nil?
  fields = custom_fields.collect do |field|
    user_configurable = field[:user_configurable] || true
    type              = field[:type] || 'string'
    password          = field[:password] || false

    {
      :id                => field[:name],
      :value             => field[:value],
      :user_configurable => user_configurable,
      :type              => type,
      :password          => password
    }
  end

  Vcloud::Core.logger.debug("adding custom fields #{fields.inspect} to vapp #{@id}")
  Vcloud::Core::Fog::ServiceInterface.new.put_product_sections(@id, fields)
end