class Fastly::Version
An iteration of your configuration
Attributes
active[RW]
Whether this version is active or not.
comment[RW]
a free form comment field
deployed[RW]
Whether this version is deployed or not.
locked[RW]
Whether this version is locked or not.
name[RW]
The name of this version.
number[RW]
The generation of this version
service_id[RW]
The id of the service this belongs to.
staging[RW]
Whether this version is in staging or not.
testing[RW]
Whether this version is in testing or not.
Public Class Methods
create_new(fetcher, opts)
click to toggle source
Create an entirely new version, not cloned from the previous one.
# File lib/fastly/version.rb, line 91 def self.create_new(fetcher, opts) hash = fetcher.client.post(Version.post_path(opts)) return nil if hash.nil? Version.new(hash, fetcher) end
delete_path(obj)
click to toggle source
# File lib/fastly/version.rb, line 168 def self.delete_path(obj) put_path(obj) end
get_path(service, number)
click to toggle source
# File lib/fastly/version.rb, line 156 def self.get_path(service, number) "/service/#{service}/version/#{number}" end
post_path(opts = {})
click to toggle source
# File lib/fastly/version.rb, line 160 def self.post_path(opts = {}) "/service/#{opts[:service_id]}/version" end
put_path(obj)
click to toggle source
# File lib/fastly/version.rb, line 164 def self.put_path(obj) get_path(obj.service_id, obj.number) end
Public Instance Methods
activate!()
click to toggle source
Activate this version
# File lib/fastly/version.rb, line 72 def activate! hash = fetcher.client.put("#{Version.put_path(self)}/activate") !hash.nil? end
active?()
click to toggle source
Is version active?
# File lib/fastly/version.rb, line 67 def active? true == @active end
clone()
click to toggle source
Clone this Version
# File lib/fastly/version.rb, line 84 def clone hash = fetcher.client.put("#{Version.put_path(self)}/clone") return nil if hash.nil? Version.new(hash, fetcher) end
deactivate!()
click to toggle source
Deactivate this version
# File lib/fastly/version.rb, line 78 def deactivate! hash = fetcher.client.put("#{Version.put_path(self)}/deactivate") !hash.nil? end
delete_vcl(name)
click to toggle source
dictionaries()
click to toggle source
# File lib/fastly/version.rb, line 142 def dictionaries fetcher.list_dictionaries(:service_id => service_id, :version => number) end
generated_vcl(opts = {})
click to toggle source
Get the generated VCL
object for this Version
(which must have been activated first)
Won't return the content of the VCL
unless you pass in
:include_content => true
in the opts
# File lib/fastly/version.rb, line 103 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
locked?()
click to toggle source
Is this Version
locked
# File lib/fastly/version.rb, line 52 def locked? true == @locked end
service()
click to toggle source
settings()
click to toggle source
upload_main_vcl(name, contents)
click to toggle source
upload_vcl(name, content)
click to toggle source
validate()
click to toggle source
Validate this Version
# File lib/fastly/version.rb, line 147 def validate hash = fetcher.client.get("#{Version.put_path(self)}/validate") valid = ("ok" == hash["status"]) message = hash['msg'] [valid, message] end