class Fastly::Version
An iteration of your configuration
def self.create_new(fetcher, opts)
def self.create_new(fetcher, opts) hash = fetcher.client.post(Version.post_path(opts)) return nil if hash.nil? Version.new(hash, fetcher) end
def self.delete_path(obj)
def self.delete_path(obj) put_path(obj) end
def self.get_path(service, number)
def self.get_path(service, number) "/service/#{service}/version/#{number}" end
def self.post_path(opts = {})
def self.post_path(opts = {}) "/service/#{opts[:service_id]}/version" end
def self.put_path(obj)
def self.put_path(obj) get_path(obj.service_id, obj.number) end
def activate!
def activate! hash = fetcher.client.put("#{Version.put_path(self)}/activate") !hash.nil? end
def active?
def active? true == @active end
def clone
def clone hash = fetcher.client.put("#{Version.put_path(self)}/clone") return nil if hash.nil? Version.new(hash, fetcher) end
def deactivate!
def deactivate! hash = fetcher.client.put("#{Version.put_path(self)}/deactivate") !hash.nil? end
def delete_vcl(name)
def delete_vcl(name) hash = fetcher.client.delete("#{Version.put_path(self)}/vcl/#{name}") hash.nil? ? nil : hash end
def dictionaries
def dictionaries fetcher.list_dictionaries(:service_id => service_id, :version => number) end
def generated_vcl(opts = {})
:include_content => true
Won't return the content of the VCL unless you pass in
Get the generated VCL object for this Version (which must have been activated first)
def generated_vcl(opts = {}) hash = fetcher.client.get("#{Version.put_path(self)}/generated_vcl", opts) opts = { 'content' => hash['vcl'] || hash['content'], 'name' => hash['md5'], 'version' => hash['version'], 'service_id' => hash['service'] } VCL.new(opts, fetcher) end
def locked?
def locked? true == @locked end
def service
def service fetcher.get(Service, service_id) end
def settings
def settings fetcher.get_settings(service_id, number) end
def upload_main_vcl(name, contents)
def upload_main_vcl(name, contents) upload_vcl(name, contents).set_main! end
def upload_vcl(name, content)
def upload_vcl(name, content) hash = fetcher.client.post("#{Version.put_path(self)}/vcl", name: name, content: content) return nil if hash.nil? VCL.new(hash, fetcher) end
def validate
def validate hash = fetcher.client.get("#{Version.put_path(self)}/validate") valid = ("ok" == hash["status"]) message = hash['msg'] [valid, message] end
def vcl(name, opts = {})
:include_content => true
Won't return the content of the VCL unless you pass in
Get the named VCL for this version
def vcl(name, opts = {}) fetcher.get_vcl(service_id, number, name, opts) end