infoblox 0.0.3 → 0.0.4
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.
- data/README.md +8 -0
- data/lib/infoblox/host.rb +2 -1
- data/lib/infoblox/network.rb +1 -1
- data/lib/infoblox/resource.rb +18 -2
- data/lib/infoblox/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -42,6 +42,14 @@ Find hosts (fuzzy matches on host name):
|
|
42
42
|
|
43
43
|
client.find_host_by_name("build-")
|
44
44
|
|
45
|
+
One can also use the resource classes directly to run arbitrary query logic:
|
46
|
+
|
47
|
+
Infoblox::Network.find({"_return_fields" => "extensible_attributes"})
|
48
|
+
# => [...]
|
49
|
+
|
50
|
+
Infoblox::Host.find({"name~" => "demo[0-9]{1,}-web.domain"})
|
51
|
+
# => [...]
|
52
|
+
|
45
53
|
## Contributing
|
46
54
|
|
47
55
|
1. Fork it
|
data/lib/infoblox/host.rb
CHANGED
data/lib/infoblox/network.rb
CHANGED
data/lib/infoblox/resource.rb
CHANGED
@@ -6,6 +6,10 @@ module Infoblox
|
|
6
6
|
obj.nil? ? @wapi_object : @wapi_object = obj
|
7
7
|
end
|
8
8
|
|
9
|
+
##
|
10
|
+
# Define a writeable remote attribute, i.e. one that
|
11
|
+
# should show up in post / put operations.
|
12
|
+
#
|
9
13
|
def self.remote_attr_accessor(*args)
|
10
14
|
args.each do |a|
|
11
15
|
attr_accessor a
|
@@ -17,12 +21,24 @@ module Infoblox
|
|
17
21
|
@remote_attrs ||= []
|
18
22
|
end
|
19
23
|
|
24
|
+
##
|
25
|
+
# Return an array of all records for this resource.
|
26
|
+
#
|
20
27
|
def self.all
|
21
28
|
JSON.parse(connection.get(resource_uri).body).map do |item|
|
22
29
|
new(item)
|
23
30
|
end
|
24
31
|
end
|
25
32
|
|
33
|
+
##
|
34
|
+
# Find resources with query parameters.
|
35
|
+
#
|
36
|
+
# Example: return extensible attributes for every resource.
|
37
|
+
# {"_return_fields" => "extensible_attributes"}
|
38
|
+
#
|
39
|
+
# Example: filter resources by name.
|
40
|
+
# {"name~" => "foo.*bar"}
|
41
|
+
#
|
26
42
|
def self.find(params)
|
27
43
|
JSON.parse(connection.get(resource_uri, params).body).map do |item|
|
28
44
|
new(item)
|
@@ -56,8 +72,8 @@ module Infoblox
|
|
56
72
|
connection.delete(resource_uri).status == 200
|
57
73
|
end
|
58
74
|
|
59
|
-
def get
|
60
|
-
connection.get(resource_uri)
|
75
|
+
def get(params={})
|
76
|
+
connection.get(resource_uri, params)
|
61
77
|
end
|
62
78
|
|
63
79
|
def resource_uri
|
data/lib/infoblox/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infoblox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|