fastly 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +35 -0
- data/.travis.yml +3 -4
- data/Gemfile +1 -0
- data/HISTORY.md +11 -1
- data/README.md +5 -1
- data/Rakefile +27 -2
- data/bin/fastly_create_domain +67 -0
- data/lib/fastly.rb +114 -114
- data/lib/fastly/backend.rb +51 -51
- data/lib/fastly/base.rb +9 -9
- data/lib/fastly/belongs_to_service_and_version.rb +10 -10
- data/lib/fastly/cache_setting.rb +3 -3
- data/lib/fastly/client.rb +11 -11
- data/lib/fastly/condition.rb +7 -7
- data/lib/fastly/customer.rb +6 -6
- data/lib/fastly/director.rb +25 -25
- data/lib/fastly/domain.rb +13 -13
- data/lib/fastly/fetcher.rb +7 -7
- data/lib/fastly/gem_version.rb +1 -1
- data/lib/fastly/gzip.rb +5 -5
- data/lib/fastly/header.rb +5 -5
- data/lib/fastly/healthcheck.rb +28 -28
- data/lib/fastly/invoice.rb +36 -36
- data/lib/fastly/match.rb +38 -38
- data/lib/fastly/origin.rb +14 -14
- data/lib/fastly/request_setting.rb +9 -9
- data/lib/fastly/response_object.rb +5 -5
- data/lib/fastly/s3_logging.rb +6 -6
- data/lib/fastly/service.rb +26 -26
- data/lib/fastly/settings.rb +14 -14
- data/lib/fastly/syslog.rb +37 -37
- data/lib/fastly/user.rb +18 -18
- data/lib/fastly/vcl.rb +12 -12
- data/lib/fastly/version.rb +32 -32
- data/test/common.rb +1 -1
- metadata +14 -11
data/lib/fastly/origin.rb
CHANGED
@@ -3,38 +3,38 @@ class Fastly
|
|
3
3
|
class Origin < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :comment
|
5
5
|
|
6
|
-
##
|
6
|
+
##
|
7
7
|
# :attr: service_id
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# The id of the service this belongs to.
|
10
|
-
#
|
10
|
+
#
|
11
11
|
|
12
|
-
##
|
12
|
+
##
|
13
13
|
# :attr: version
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# The number of the version this belongs to.
|
16
|
-
#
|
16
|
+
#
|
17
17
|
|
18
|
-
##
|
18
|
+
##
|
19
19
|
# :attr: name
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# The domain name of this domain
|
22
|
-
|
23
|
-
|
22
|
+
|
23
|
+
|
24
24
|
# Add a Director object to an Origin
|
25
25
|
#
|
26
26
|
# Return true on success and false on failure
|
27
|
-
def add_director(director)
|
27
|
+
def add_director(director)
|
28
28
|
hash = fetcher.client.post(Fastly::Origin.put_path(self)+"/director/#{director.name}")
|
29
29
|
return !hash.nil?
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
# Delete a Director object from an Origin
|
33
33
|
#
|
34
34
|
# Return true on success and false on failure
|
35
|
-
def delete_director(director)
|
35
|
+
def delete_director(director)
|
36
36
|
hash = fetcher.client.delete(Fastly::Origin.put_path(self)+"/director/#{director.name}")
|
37
37
|
return !hash.nil?
|
38
38
|
end
|
39
39
|
end
|
40
|
-
end
|
40
|
+
end
|
@@ -3,17 +3,17 @@ class Fastly
|
|
3
3
|
class RequestSetting < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :force_miss, :force_ssl, :action, :bypass_busy_wait, :max_stale_age, :hash_keys, :xff, :time_support, :geo_headers, :default_host, :request_condition
|
5
5
|
|
6
|
-
##
|
6
|
+
##
|
7
7
|
# :attr: service_id
|
8
8
|
#
|
9
9
|
# The id of the service this belongs to.
|
10
10
|
|
11
|
-
##
|
11
|
+
##
|
12
12
|
# :attr: version
|
13
13
|
#
|
14
14
|
# The number of the version this belongs to.
|
15
15
|
|
16
|
-
##
|
16
|
+
##
|
17
17
|
# :attr: name
|
18
18
|
#
|
19
19
|
# The name of the request setting
|
@@ -32,13 +32,13 @@ class Fastly
|
|
32
32
|
##
|
33
33
|
# :attr: action
|
34
34
|
#
|
35
|
-
# Allows you to terminate request handling and immediately perform an
|
35
|
+
# Allows you to terminate request handling and immediately perform an
|
36
36
|
# action. When set it can be lookup or pass (ignore the cache completely)
|
37
37
|
|
38
38
|
##
|
39
39
|
# :attr: bypass_busy_wait
|
40
40
|
#
|
41
|
-
# Disable collapsed forwarding, so you don't wait for other objects to
|
41
|
+
# Disable collapsed forwarding, so you don't wait for other objects to
|
42
42
|
# origin
|
43
43
|
|
44
44
|
##
|
@@ -50,25 +50,25 @@ class Fastly
|
|
50
50
|
##
|
51
51
|
# :attr: hash_keys
|
52
52
|
#
|
53
|
-
# Comma separated list of varnish request object fields that should be
|
53
|
+
# Comma separated list of varnish request object fields that should be
|
54
54
|
# in the hash key
|
55
55
|
|
56
56
|
##
|
57
57
|
# :attr: xff
|
58
|
-
#
|
58
|
+
#
|
59
59
|
# X-Forwarded-For: should be clear, leave, append, append_all, or
|
60
60
|
# overwrite
|
61
61
|
|
62
62
|
##
|
63
63
|
# :attr: timer_support
|
64
64
|
#
|
65
|
-
# Injects the X-Timer info into the request for viewing origin fetch
|
65
|
+
# Injects the X-Timer info into the request for viewing origin fetch
|
66
66
|
# durations
|
67
67
|
|
68
68
|
##
|
69
69
|
# :attr: geo_headers
|
70
70
|
#
|
71
|
-
# Injects Fastly-Geo-Country, Fastly-Geo-City, and Fastly-Geo-Region
|
71
|
+
# Injects Fastly-Geo-Country, Fastly-Geo-City, and Fastly-Geo-Region
|
72
72
|
# into the request headers
|
73
73
|
|
74
74
|
##
|
@@ -3,17 +3,17 @@ class Fastly
|
|
3
3
|
class ResponseObject < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :cache_condition, :request_condition, :status, :response, :content, :content_type
|
5
5
|
|
6
|
-
##
|
6
|
+
##
|
7
7
|
# :attr: service_id
|
8
8
|
#
|
9
9
|
# The id of the service this belongs to.
|
10
10
|
|
11
|
-
##
|
11
|
+
##
|
12
12
|
# :attr: version
|
13
13
|
#
|
14
14
|
# The number of the version this belongs to.
|
15
15
|
|
16
|
-
##
|
16
|
+
##
|
17
17
|
# :attr: name
|
18
18
|
#
|
19
19
|
# The name of the response object
|
@@ -32,12 +32,12 @@ class Fastly
|
|
32
32
|
|
33
33
|
##
|
34
34
|
# :attr: status
|
35
|
-
#
|
35
|
+
#
|
36
36
|
# The HTTP status code, defaults to 200
|
37
37
|
|
38
38
|
##
|
39
39
|
# :attr: response
|
40
|
-
#
|
40
|
+
#
|
41
41
|
# The HTTP response, defaults to "Ok"
|
42
42
|
|
43
43
|
##
|
data/lib/fastly/s3_logging.rb
CHANGED
@@ -3,19 +3,19 @@ class Fastly
|
|
3
3
|
class S3Logging < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :bucket_name, :access_key, :secret_key, :path, :period, :gzip_level, :format, :response_condition
|
5
5
|
|
6
|
-
##
|
6
|
+
##
|
7
7
|
# :attr: service_id
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# The id of the service this belongs to.
|
10
10
|
|
11
|
-
##
|
11
|
+
##
|
12
12
|
# :attr: version
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# The number of the version this belongs to.
|
15
15
|
|
16
|
-
##
|
16
|
+
##
|
17
17
|
# :attr: name
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# The name for this s3 rule
|
20
20
|
|
21
21
|
##
|
data/lib/fastly/service.rb
CHANGED
@@ -3,35 +3,35 @@ class Fastly
|
|
3
3
|
class Service < Base
|
4
4
|
attr_accessor :id, :customer_id, :name, :comment
|
5
5
|
@versions = []
|
6
|
-
|
7
|
-
##
|
6
|
+
|
7
|
+
##
|
8
8
|
# :attr: id
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# The id of the service
|
11
|
-
#
|
11
|
+
#
|
12
12
|
|
13
|
-
##
|
13
|
+
##
|
14
14
|
# :attr: customer_id
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# The id of the customer this belongs to
|
17
|
-
#
|
17
|
+
#
|
18
18
|
|
19
|
-
##
|
19
|
+
##
|
20
20
|
# :attr: name
|
21
|
-
#
|
21
|
+
#
|
22
22
|
# The name of this service
|
23
|
-
#
|
23
|
+
#
|
24
24
|
|
25
|
-
##
|
26
|
-
# :attr: comment
|
27
|
-
#
|
25
|
+
##
|
26
|
+
# :attr: comment
|
27
|
+
#
|
28
28
|
# a free form comment field
|
29
29
|
|
30
|
-
|
31
|
-
##
|
30
|
+
|
31
|
+
##
|
32
32
|
#
|
33
33
|
# Get a hash of stats from different data centers.
|
34
|
-
#
|
34
|
+
#
|
35
35
|
# Type can be one of
|
36
36
|
# * minutely
|
37
37
|
# * hourly
|
@@ -44,9 +44,9 @@ class Fastly
|
|
44
44
|
end
|
45
45
|
|
46
46
|
# Return a Invoice object representing the invoice for this service
|
47
|
-
#
|
48
|
-
# If a year and month are passed in returns the invoice for that whole month.
|
49
|
-
#
|
47
|
+
#
|
48
|
+
# If a year and month are passed in returns the invoice for that whole month.
|
49
|
+
#
|
50
50
|
# Otherwise it returns the invoice for the current month so far.
|
51
51
|
def invoice(year=nil, month=nil)
|
52
52
|
opts = { :service_id => self.id }
|
@@ -82,12 +82,12 @@ class Fastly
|
|
82
82
|
def version(number=-1)
|
83
83
|
versions[number]
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
# A deep hash of nested details
|
87
87
|
def details(opts={})
|
88
88
|
fetcher.client.get(Fastly::Service.get_path(self.id)+"/details", opts);
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
# Get the Customer object for this Service
|
92
92
|
def customer
|
93
93
|
fetcher.get(Fastly::Customer, customer_id)
|
@@ -95,14 +95,14 @@ class Fastly
|
|
95
95
|
end
|
96
96
|
|
97
97
|
# Search all the services that the current customer has.
|
98
|
-
#
|
98
|
+
#
|
99
99
|
# In general you'll want to do
|
100
|
-
#
|
100
|
+
#
|
101
101
|
# services = fastly.search_services(:name => name)
|
102
|
-
#
|
102
|
+
#
|
103
103
|
# or
|
104
|
-
#
|
105
|
-
# service = fastly.search_services(:name => name, :version => number)
|
104
|
+
#
|
105
|
+
# service = fastly.search_services(:name => name, :version => number)
|
106
106
|
def search_services(opts)
|
107
107
|
klass = Fastly::Service
|
108
108
|
hash = client.get(klass.post_path+"/search", opts)
|
data/lib/fastly/settings.rb
CHANGED
@@ -2,17 +2,17 @@ class Fastly
|
|
2
2
|
# Represent arbitary key value settings for a given Version
|
3
3
|
class Settings < Base
|
4
4
|
attr_accessor :service_id, :version, :settings
|
5
|
-
##
|
5
|
+
##
|
6
6
|
# :attr: service_id
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# The id of the service this belongs to.
|
9
|
-
#
|
9
|
+
#
|
10
10
|
|
11
|
-
##
|
11
|
+
##
|
12
12
|
# :attr: version
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# The number of the version this belongs to.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
|
17
17
|
##
|
18
18
|
# :attr: service
|
@@ -36,7 +36,7 @@ class Fastly
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# :nodoc:
|
39
|
-
def self.post_path
|
39
|
+
def self.post_path
|
40
40
|
raise "You can't POST to an setting"
|
41
41
|
end
|
42
42
|
|
@@ -44,26 +44,26 @@ class Fastly
|
|
44
44
|
def self.delete_path
|
45
45
|
raise "You can't DELETE to an setting"
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
# :nodoc:
|
49
49
|
def delete!
|
50
50
|
raise "You can't delete an invoice"
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
# :nodoc:
|
54
|
-
def as_hash
|
54
|
+
def as_hash
|
55
55
|
settings
|
56
56
|
end
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
# Get the Settings object for the specified Version
|
60
60
|
def get_settings(service, number)
|
61
61
|
klass = Fastly::Settings
|
62
62
|
hash = client.get(Fastly::Settings.get_path(service, number))
|
63
|
-
|
63
|
+
|
64
64
|
return nil if hash.nil?
|
65
65
|
hash["settings"] = Hash[["general.default_host", "general.default_ttl"].collect { |var| [var, hash.delete(var)] }]
|
66
|
-
|
66
|
+
|
67
67
|
return klass.new(hash, self)
|
68
68
|
end
|
69
69
|
|
@@ -71,4 +71,4 @@ class Fastly
|
|
71
71
|
def update_settings(opts={})
|
72
72
|
update(Fastly::Settings, opts)
|
73
73
|
end
|
74
|
-
end
|
74
|
+
end
|
data/lib/fastly/syslog.rb
CHANGED
@@ -1,70 +1,70 @@
|
|
1
1
|
class Fastly
|
2
|
-
# An endpoint to stream syslogs to
|
2
|
+
# An endpoint to stream syslogs to
|
3
3
|
class Syslog < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :comment, :ipv4, :ipv6, :hostname, :port, :format, :response_conditions
|
5
5
|
|
6
|
-
##
|
6
|
+
##
|
7
7
|
# :attr: service_id
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# The id of the service this belongs to.
|
10
|
-
#
|
10
|
+
#
|
11
11
|
|
12
|
-
##
|
12
|
+
##
|
13
13
|
# :attr: version
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# The number of the version this belongs to.
|
16
|
-
#
|
16
|
+
#
|
17
17
|
|
18
|
-
##
|
18
|
+
##
|
19
19
|
# :attr: name
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# The domain name of this domain
|
22
|
-
#
|
22
|
+
#
|
23
23
|
|
24
|
-
##
|
25
|
-
# :attr: comment
|
26
|
-
#
|
24
|
+
##
|
25
|
+
# :attr: comment
|
26
|
+
#
|
27
27
|
# a free form comment field
|
28
28
|
|
29
|
-
##
|
29
|
+
##
|
30
30
|
# :attr: address
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# A magic field - will automagically be set to whichever of ipv4, ipv6 or hostname is currently set.
|
33
|
-
#
|
34
|
-
# Conversely if you set the address field then the correct field from ipv4, ipv6 or hostname will be set.
|
35
|
-
|
36
|
-
##
|
33
|
+
#
|
34
|
+
# Conversely if you set the address field then the correct field from ipv4, ipv6 or hostname will be set.
|
35
|
+
|
36
|
+
##
|
37
37
|
# :attr: ipv4
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# the ipv4 address of the host to stream logs to (this, hostname or ipv6 must be set)
|
40
40
|
|
41
|
-
|
42
|
-
##
|
41
|
+
|
42
|
+
##
|
43
43
|
# :attr: ipv6
|
44
|
-
#
|
44
|
+
#
|
45
45
|
# the ipv6 address of the host to stream logs to (this, hostname or ipv4 must be set)
|
46
46
|
|
47
|
-
|
48
|
-
##
|
47
|
+
|
48
|
+
##
|
49
49
|
# :attr: hostname
|
50
|
-
#
|
50
|
+
#
|
51
51
|
# the hostname to to stream logs to (this, ipv4 or ipv6 must be set)
|
52
|
-
|
53
|
-
|
54
|
-
##
|
55
|
-
# :attr: port
|
56
|
-
#
|
52
|
+
|
53
|
+
|
54
|
+
##
|
55
|
+
# :attr: port
|
56
|
+
#
|
57
57
|
# the port to stream logs to (defaults to 514)
|
58
58
|
|
59
|
-
|
60
|
-
##
|
59
|
+
|
60
|
+
##
|
61
61
|
# :attr: format
|
62
|
-
#
|
62
|
+
#
|
63
63
|
# Format to log like in apache format
|
64
|
-
|
65
|
-
##
|
64
|
+
|
65
|
+
##
|
66
66
|
# :attr: response_condition
|
67
67
|
#
|
68
68
|
# name of a response_condition to filter the log on, if empty it always logs
|
69
69
|
end
|
70
|
-
end
|
70
|
+
end
|