fastly 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- 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/domain.rb
CHANGED
@@ -3,27 +3,27 @@ class Fastly
|
|
3
3
|
class Domain < 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
|
-
#
|
22
|
+
#
|
23
23
|
|
24
|
-
##
|
25
|
-
# :attr: comment
|
26
|
-
#
|
24
|
+
##
|
25
|
+
# :attr: comment
|
26
|
+
#
|
27
27
|
# a free form comment field
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
data/lib/fastly/fetcher.rb
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
class Fastly
|
1
|
+
class Fastly
|
2
2
|
# :nodoc:
|
3
3
|
class AuthRequired < RuntimeError; end
|
4
4
|
# :nodoc:
|
5
5
|
class FullAuthRequired < Fastly::AuthRequired; end
|
6
|
-
# :nodoc:
|
6
|
+
# :nodoc:
|
7
7
|
class Error < RuntimeError; end
|
8
8
|
# :nodoc:
|
9
|
-
class Unauthorized < AuthRequired; end
|
9
|
+
class Unauthorized < AuthRequired; end
|
10
10
|
# :nodoc:
|
11
11
|
class AdminRequired < AuthRequired; end
|
12
|
-
|
13
|
-
module Fetcher # :nodoc: all
|
12
|
+
|
13
|
+
module Fetcher # :nodoc: all
|
14
14
|
|
15
15
|
# Get the current Fastly::Client
|
16
16
|
def client(opts={})
|
17
17
|
@client ||= Fastly::Client.new(opts)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def list(klass, opts={})
|
21
21
|
list = client.get(klass.list_path(opts))
|
22
22
|
return [] if list.nil?
|
@@ -32,7 +32,7 @@ class Fastly
|
|
32
32
|
return nil if hash.nil?
|
33
33
|
return klass.new(hash, self)
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def create(klass, opts)
|
37
37
|
hash = client.post(klass.post_path(opts),opts)
|
38
38
|
return klass.new(hash, self)
|
data/lib/fastly/gem_version.rb
CHANGED
data/lib/fastly/gzip.rb
CHANGED
@@ -3,17 +3,17 @@ class Fastly
|
|
3
3
|
class Gzip < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :extensions, :content_types, :cache_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 condition
|
@@ -26,13 +26,13 @@ class Fastly
|
|
26
26
|
|
27
27
|
##
|
28
28
|
# :attr: content_types
|
29
|
-
#
|
29
|
+
#
|
30
30
|
# Content types to be gzipped. Seems to want them in a list like
|
31
31
|
# "text/html application/x-javascript"
|
32
32
|
|
33
33
|
##
|
34
34
|
# :attr" cache_condition
|
35
|
-
#
|
35
|
+
#
|
36
36
|
# Cache condition to be used to determine when to apply this gzip setting
|
37
37
|
|
38
38
|
end
|
data/lib/fastly/header.rb
CHANGED
@@ -3,17 +3,17 @@ class Fastly
|
|
3
3
|
class Header < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :action, :cache_condition, :request_condition, :response_condition, :ignore_if_set, :type, :dst, :src, :substitution, :priority, :regexp
|
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 header setting
|
@@ -47,7 +47,7 @@ class Fastly
|
|
47
47
|
#
|
48
48
|
# Header to set
|
49
49
|
|
50
|
-
##
|
50
|
+
##
|
51
51
|
# :attr: src
|
52
52
|
#
|
53
53
|
# Variable to be used as a source for the header content. Does not apply
|
@@ -61,7 +61,7 @@ class Fastly
|
|
61
61
|
##
|
62
62
|
# :attr: substitution
|
63
63
|
#
|
64
|
-
# Value to substitute in place of regular expression. (Only applies to
|
64
|
+
# Value to substitute in place of regular expression. (Only applies to
|
65
65
|
# 'regex' and 'regex_repeat'.)
|
66
66
|
|
67
67
|
##
|
data/lib/fastly/healthcheck.rb
CHANGED
@@ -3,62 +3,62 @@ class Fastly
|
|
3
3
|
class Healthcheck < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :comment, :path, :host, :http_version, :timeout, :window, :threshold
|
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 name of this Healthcheck
|
22
|
-
#
|
22
|
+
#
|
23
23
|
|
24
|
-
##
|
25
|
-
# :attr: comment
|
26
|
-
#
|
24
|
+
##
|
25
|
+
# :attr: comment
|
26
|
+
#
|
27
27
|
# A free form comment field
|
28
|
-
|
29
|
-
##
|
28
|
+
|
29
|
+
##
|
30
30
|
# :attr: method
|
31
|
-
#
|
31
|
+
#
|
32
32
|
# Which HTTP method to use
|
33
33
|
|
34
|
-
##
|
34
|
+
##
|
35
35
|
# :attr: host
|
36
|
-
#
|
36
|
+
#
|
37
37
|
# Which host to check
|
38
38
|
|
39
|
-
##
|
39
|
+
##
|
40
40
|
# :attr: path
|
41
|
-
#
|
41
|
+
#
|
42
42
|
# Path to check
|
43
43
|
|
44
|
-
##
|
44
|
+
##
|
45
45
|
# :attr: http_version
|
46
|
-
#
|
46
|
+
#
|
47
47
|
# 1.0 or 1.1 (defaults to 1.1)
|
48
48
|
|
49
|
-
##
|
49
|
+
##
|
50
50
|
# :attr: timeout
|
51
|
-
#
|
51
|
+
#
|
52
52
|
# Timeout in seconds
|
53
53
|
|
54
|
-
##
|
54
|
+
##
|
55
55
|
# :attr: window
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# How large window to keep track for healthchecks
|
58
58
|
|
59
|
-
##
|
59
|
+
##
|
60
60
|
# :attr: threshold
|
61
|
-
#
|
61
|
+
#
|
62
62
|
# How many have to be ok for it work
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
data/lib/fastly/invoice.rb
CHANGED
@@ -2,55 +2,55 @@ class Fastly
|
|
2
2
|
# An invoice for a time period
|
3
3
|
class Invoice < Base
|
4
4
|
attr_accessor :service_id, :service_name, :start_time, :end_time, :total, :regions
|
5
|
-
|
6
|
-
##
|
5
|
+
|
6
|
+
##
|
7
7
|
# :attr: service_id
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# The id of the service this invoice is for
|
10
|
-
#
|
10
|
+
#
|
11
11
|
|
12
|
-
##
|
12
|
+
##
|
13
13
|
# :attr: service_name
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# The id of the service this invoice is for
|
16
|
-
#
|
16
|
+
#
|
17
17
|
|
18
|
-
##
|
18
|
+
##
|
19
19
|
# :attr: start_time
|
20
|
-
#
|
20
|
+
#
|
21
21
|
# The earliest date and time this invoice covers
|
22
|
-
#
|
22
|
+
#
|
23
23
|
|
24
|
-
##
|
24
|
+
##
|
25
25
|
# :attr: end_time
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# The latest date and time this invoice covers
|
28
|
-
#
|
28
|
+
#
|
29
29
|
|
30
|
-
##
|
30
|
+
##
|
31
31
|
# :attr: total
|
32
|
-
#
|
32
|
+
#
|
33
33
|
# The total for this invoice in US dollars
|
34
|
-
#
|
34
|
+
#
|
35
35
|
|
36
|
-
##
|
36
|
+
##
|
37
37
|
# :attr: regions
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# A hash reference with all the different regions and their subtotals
|
40
|
-
|
41
|
-
|
40
|
+
|
41
|
+
|
42
42
|
# Get the start time of this invoice as a DateTime object in UTC
|
43
43
|
def start
|
44
44
|
DateTime.parse(start_time).new_offset(0)
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
# Get the end time of this invoice as a DateTime object in UTC
|
48
48
|
def end
|
49
49
|
DateTime.parse(end_time).new_offset(0)
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
private
|
53
|
-
|
53
|
+
|
54
54
|
def self.get_path(*args)
|
55
55
|
opts = args.size>0 ? args[0] : {}
|
56
56
|
url = "/billing"
|
@@ -62,37 +62,37 @@ class Fastly
|
|
62
62
|
end
|
63
63
|
url
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
def self.list_path(*args)
|
67
67
|
get_path(*args)
|
68
68
|
end
|
69
|
-
|
70
|
-
def self.post_path
|
69
|
+
|
70
|
+
def self.post_path
|
71
71
|
raise "You can't POST to an invoice"
|
72
72
|
end
|
73
|
-
|
73
|
+
|
74
74
|
def self.put_path
|
75
75
|
raise "You can't PUT to an invoice"
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
def self.delete_path
|
79
79
|
raise "You can't DELETE to an invoice"
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
def save!
|
83
83
|
raise "You can't save an invoice"
|
84
84
|
end
|
85
|
-
|
85
|
+
|
86
86
|
def delete!
|
87
87
|
raise "You can't delete an invoice"
|
88
88
|
end
|
89
89
|
end
|
90
|
-
|
90
|
+
|
91
91
|
|
92
92
|
# Return an array of Invoice objects representing invoices for all services.
|
93
|
-
#
|
94
|
-
# If a year and month are passed in returns the invoices for that whole month.
|
95
|
-
#
|
93
|
+
#
|
94
|
+
# If a year and month are passed in returns the invoices for that whole month.
|
95
|
+
#
|
96
96
|
# Otherwise it returns the invoices for the current month so far.
|
97
97
|
def get_invoice(year=nil, month=nil)
|
98
98
|
opts = {}
|
@@ -102,5 +102,5 @@ class Fastly
|
|
102
102
|
end
|
103
103
|
get(Fastly::Invoice, opts)
|
104
104
|
end
|
105
|
-
|
106
|
-
end
|
105
|
+
|
106
|
+
end
|
data/lib/fastly/match.rb
CHANGED
@@ -3,75 +3,75 @@ class Fastly
|
|
3
3
|
class Match < BelongsToServiceAndVersion
|
4
4
|
attr_accessor :service_id, :name, :comment, :pattern, :priority, :on_recv, :on_lookup, :on_fetch, :on_deliver, :on_miss, :on_hit
|
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 name of this match.
|
22
|
-
#
|
22
|
+
#
|
23
23
|
|
24
|
-
##
|
24
|
+
##
|
25
25
|
# :attr: pattern
|
26
|
-
#
|
26
|
+
#
|
27
27
|
# The matching pattern.
|
28
|
-
#
|
28
|
+
#
|
29
29
|
|
30
|
-
##
|
30
|
+
##
|
31
31
|
# :attr: on_recv
|
32
|
-
#
|
32
|
+
#
|
33
33
|
# What VCL action to execute before we lookup the object.
|
34
|
-
#
|
34
|
+
#
|
35
35
|
|
36
|
-
##
|
36
|
+
##
|
37
37
|
# :attr: on_lookup
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# What VCL action to execute during a lookup.
|
40
|
-
#
|
40
|
+
#
|
41
41
|
|
42
|
-
##
|
43
|
-
# :attr: on_fetch
|
44
|
-
#
|
42
|
+
##
|
43
|
+
# :attr: on_fetch
|
44
|
+
#
|
45
45
|
# What to execute after we have the header.
|
46
|
-
#
|
46
|
+
#
|
47
47
|
|
48
|
-
##
|
48
|
+
##
|
49
49
|
# :attr: on_miss
|
50
|
-
#
|
50
|
+
#
|
51
51
|
# What to execute on a cache miss
|
52
|
-
#
|
52
|
+
#
|
53
53
|
|
54
|
-
##
|
54
|
+
##
|
55
55
|
# :attr: on_hit
|
56
|
-
#
|
56
|
+
#
|
57
57
|
# What to execute on a cache hit.
|
58
|
-
#
|
58
|
+
#
|
59
59
|
|
60
|
-
##
|
60
|
+
##
|
61
61
|
# :attr: on_deliver
|
62
|
-
#
|
62
|
+
#
|
63
63
|
# What to execute just before delivering the object.
|
64
|
-
#
|
64
|
+
#
|
65
65
|
|
66
|
-
##
|
66
|
+
##
|
67
67
|
# :attr: priority
|
68
|
-
#
|
68
|
+
#
|
69
69
|
# The ordering of the match object
|
70
|
-
#
|
70
|
+
#
|
71
71
|
|
72
|
-
##
|
73
|
-
# :attr: comment
|
74
|
-
#
|
72
|
+
##
|
73
|
+
# :attr: comment
|
74
|
+
#
|
75
75
|
# a free form comment field
|
76
76
|
end
|
77
|
-
end
|
77
|
+
end
|