fastlyctl 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47e44218334f858ca38258f7d78f7b06a43c4ad469a3471065e9c73d44b07d4b
4
- data.tar.gz: 1f49de73048ed5acaadb18306eb3d8567e3740b40617720fb55d3386176ed104
3
+ metadata.gz: 6fa41e6ea6712a1065c4d81c9113ab86451adcff4b586ad63b6d1449ac3a0a54
4
+ data.tar.gz: 8640eee6253a25aab53c21b98c32d588209e782d3085f11e67bef9af42e51fc1
5
5
  SHA512:
6
- metadata.gz: 2db1dffff49f810de07d362bc61c43a2577084f66530b2e48e20913a7187b41818363fcaefa2783df590cbe194aeb457b4d846794cecae5624febc63c8fe58b9
7
- data.tar.gz: 03fda9af78e06722122abfb1d992574daaafcfe5acfc55de4ebeae3699ee6f281820131c13e8773c6ecd94ca127fedad172e2de921f2673b5454128da62001aa
6
+ metadata.gz: 84327784e9592df352398ba26b6e5b498693fabdf9b0717bf098c2b02014a1ed8c5e7c88be6323f4193d60c05ada4c1a6fd45546b0ae501ee68a54159ec52037
7
+ data.tar.gz: 51321b1f519aca18a50dcdd7ce478808472adfedbec53833452925374eb07b75bf141883732b40031bf81ec24e35f0043c2f880eb2d150c9f30f8c551e7d680b
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # FastlyCTL
1
+ # FastlyCTL [![Gem Version](https://img.shields.io/gem/v/fastlyctl.svg)](https://rubygems.org/gems/fastlyctl)
2
2
 
3
3
  CLI for manipulating objects with [Fastly's API](https://docs.fastly.com/api/config).
4
4
 
@@ -44,10 +44,10 @@ module FastlyCTL
44
44
  source_sid = obj["service_id"]
45
45
  abort "No version on object" unless obj.key?("version")
46
46
  source_version = obj["version"]
47
+ main = false
47
48
 
48
- if type == "director"
49
- backends = obj["backends"].dup
50
- end
49
+ backends = obj["backends"].dup if type == "director"
50
+ main = true if type == "vcl" && obj["main"] === true
51
51
 
52
52
  if type == "snippet" && obj["dynamic"] == "1"
53
53
  obj.merge!(FastlyCTL::Fetcher.api_request(:get, "/service/#{source_sid}/snippet/#{obj["id"]}"))
@@ -58,6 +58,11 @@ module FastlyCTL
58
58
 
59
59
  obj = FastlyCTL::Fetcher.api_request(meta.key?(:method) ? meta[:method] : :post, "/service/#{sid}/version/#{version}/#{type}", body: obj )
60
60
 
61
+ if main === true
62
+ # the "main-ness" of the vcl does not get carried over during creation. must explicitly set main
63
+ FastlyCTL::Fetcher.api_request(:put, "/service/#{sid}/version/#{version}/vcl/#{obj["name"]}/main")
64
+ end
65
+
61
66
  if type == "director"
62
67
  backends.each do |b|
63
68
  FastlyCTL::Fetcher.api_request(:post, "/service/#{sid}/version/#{version}/director/#{obj["name"]}/backend/#{b}", body: obj )
@@ -72,6 +77,7 @@ module FastlyCTL
72
77
 
73
78
  items = []
74
79
  entries = []
80
+ # build some batch requests for dictionaries and ACLs to save on API rate limit
75
81
  FastlyCTL::Fetcher.api_request(:get, "#{path}/#{type}/#{obj_id}/#{FastlyCTL::CloneUtils.pluralize(child)}").each do |child_obj|
76
82
  case child
77
83
  when "item"
@@ -81,7 +87,7 @@ module FastlyCTL
81
87
  next
82
88
  when "entry"
83
89
  entries.push({
84
- "op" => "create","ip" => child_obj["ip"],"subnet" => child_obj["subnet"]
90
+ "op" => "create","ip" => child_obj["ip"],"subnet" => child_obj["subnet"], "negate" => child_obj["negate"]
85
91
  })
86
92
  next
87
93
  end
@@ -1,3 +1,3 @@
1
1
  module FastlyCTL
2
- VERSION = "1.0.3"
2
+ VERSION = "1.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlyctl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Basile
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-24 00:00:00.000000000 Z
11
+ date: 2019-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler