infoblox 0.3.2 → 0.3.3

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
  SHA1:
3
- metadata.gz: 5a6880d631af71acb42ed65afde4db3e87d13c5d
4
- data.tar.gz: 7b6464bc074d7e9d1a684877d5111779345ad9ba
3
+ metadata.gz: c25a0a8c232a93161b8317af5238429446a78779
4
+ data.tar.gz: 48d577a599c4a404ea571cc7fe26619a95387c16
5
5
  SHA512:
6
- metadata.gz: 9932dfc6ae42258a694183f07b956a054a204d4317fc3b119b38b0c4dc6dd97f659356469c373ef716f4a3ec5d1011267f452a62e0e0df9e3f0dd7ef6d8f6d00
7
- data.tar.gz: a16042008fc8b9ffe30d21ec6c0254139723e234f8d862a4af279e4a42beca1d7c31a68a45b3bc747d908ab66e34c213cfad2b494e78f01b2a6e5dadc2084f09
6
+ metadata.gz: 866fb518bdae0ae892386ecfeaef74b6f7394f0243c0bcf6d69a151f05912e567cc5d7b852e36f4fa9fca3843ac3a05fa3a66f83f9235b4327da2ad5360a428a
7
+ data.tar.gz: 33e941c47b1ee9f258c3317be8921231741b1da1388d59f9fd71705adc4d1e71d6b1780ab0ce01bd3252a5eba5e0f8eb3bf595ff443c8639151b45d2ae0a4e93
@@ -43,6 +43,16 @@ module Infoblox
43
43
  end
44
44
  end
45
45
 
46
+ ##
47
+ # Define a read-only attribute
48
+ #
49
+ def self.remote_attr_reader(*args)
50
+ args.each do |a|
51
+ attr_reader a
52
+ remote_attrs << a
53
+ end
54
+ end
55
+
46
56
  def self.remote_attrs
47
57
  @remote_attrs ||= []
48
58
  end
@@ -112,7 +122,9 @@ module Infoblox
112
122
 
113
123
  def initialize(attrs={})
114
124
  attrs.each do |k,v|
115
- self.send("#{k}=", v)
125
+ # set ivars directly here, as sometimes
126
+ # we only use readers on certain fields
127
+ instance_variable_set("@#{k}", v)
116
128
  end
117
129
  end
118
130
 
@@ -1,11 +1,14 @@
1
1
  module Infoblox
2
2
  class Arecord < Resource
3
- remote_attr_accessor :extattrs,
4
- :extensible_attributes,
5
- :ipv4addr,
3
+ remote_attr_accessor :comment,
4
+ :disable,
5
+ :extattrs,
6
+ :extensible_attributes,
7
+ :ipv4addr,
8
+ :name,
6
9
  :ttl,
7
- :view,
8
- :name
10
+ :view,
11
+ :zone
9
12
 
10
13
  wapi_object "record:a"
11
14
  end
@@ -2,10 +2,13 @@ module Infoblox
2
2
  class Cname < Resource
3
3
  remote_attr_accessor :canonical,
4
4
  :comment,
5
+ :disable,
5
6
  :extattrs,
6
7
  :extensible_attributes,
7
8
  :name,
8
- :view
9
+ :view,
10
+ :zone
11
+
9
12
 
10
13
  wapi_object "record:cname"
11
14
  end
@@ -2,11 +2,14 @@ module Infoblox
2
2
  # minimum WAPI version: 1.1
3
3
  class Fixedaddress < Resource
4
4
  remote_attr_accessor :extattrs,
5
- :ipv4addr,
6
- :mac,
7
- :name,
5
+ :ipv4addr,
6
+ :mac,
7
+ :name,
8
+ :network,
9
+ :network_view,
8
10
  :options,
9
- :match_client
11
+ :match_client,
12
+ :comment
10
13
 
11
14
  wapi_object "fixedaddress"
12
15
  end
@@ -1,12 +1,15 @@
1
1
  module Infoblox
2
2
  class Host < Resource
3
- remote_attr_accessor :extattrs,
4
- :extensible_attributes,
5
- :view,
6
- :aliases,
7
- :configure_for_dns,
8
- :ipv4addrs,
9
- :name
3
+ remote_attr_accessor :aliases,
4
+ :comment,
5
+ :configure_for_dns,
6
+ :disable,
7
+ :extattrs,
8
+ :extensible_attributes,
9
+ :ipv4addrs,
10
+ :name,
11
+ :view,
12
+ :zone
10
13
 
11
14
  wapi_object "record:host"
12
15
 
@@ -5,7 +5,9 @@ module Infoblox
5
5
  :mac,
6
6
  :network,
7
7
  :nextserver,
8
- :use_nextserver
8
+ :use_nextserver,
9
+ :bootfile,
10
+ :use_bootfile
9
11
 
10
12
  remote_post_accessor :host
11
13
 
@@ -1,25 +1,32 @@
1
1
  module Infoblox
2
2
  class Ipv4address < Resource
3
- attr_accessor :dhcp_client_identifier,
4
- :ip_address,
5
- :is_conflict,
6
- :lease_state,
7
- :mac_address,
8
- :names,
9
- :network,
10
- :network_view,
11
- :objects,
12
- :status,
13
- :types,
14
- :usage,
15
- :username
3
+ remote_attr_reader :dhcp_client_identifier,
4
+ :ip_address,
5
+ :is_conflict,
6
+ :lease_state,
7
+ :mac_address,
8
+ :names,
9
+ :network,
10
+ :network_view,
11
+ :objects,
12
+ :status,
13
+ :types,
14
+ :usage,
15
+ :username
16
16
 
17
+ remote_attr_accessor :extattrs, :extensible_attributes
18
+
17
19
  wapi_object "ipv4address"
18
20
 
19
21
  def delete
20
22
  raise "Not supported"
21
23
  end
22
24
 
25
+ ##
26
+ # as per the WAPI doc:
27
+ # This object is created only as part of the record.host object,
28
+ # it cannot be created directly.
29
+ #
23
30
  def create
24
31
  raise "Not supported"
25
32
  end
@@ -1,8 +1,10 @@
1
1
  module Infoblox
2
2
  class Network < Resource
3
- remote_attr_accessor :extattrs,
3
+ remote_attr_accessor :comment,
4
+ :extattrs,
4
5
  :extensible_attributes,
5
6
  :network
7
+
6
8
 
7
9
  remote_post_accessor :auto_create_reversezone
8
10
 
@@ -1,11 +1,15 @@
1
1
  module Infoblox
2
2
  class Ptr < Resource
3
- remote_attr_accessor :extattrs,
4
- :extensible_attributes,
5
- :view,
6
- :ipv4addr,
3
+ remote_attr_accessor :comment,
4
+ :disable,
5
+ :ipv4addr,
6
+ :ipv6addr,
7
7
  :name,
8
- :ptrdname
8
+ :ptrdname,
9
+ :extattrs,
10
+ :extensible_attributes,
11
+ :view,
12
+ :zone
9
13
 
10
14
  wapi_object "record:ptr"
11
15
  end
@@ -1,3 +1,3 @@
1
1
  module Infoblox
2
- VERSION = "0.3.2"
2
+ VERSION = "0.3.3"
3
3
  end
@@ -5,7 +5,7 @@ describe Infoblox::HostIpv4addr do
5
5
  expected = [:host]
6
6
  expect(Infoblox::HostIpv4addr.remote_post_attrs).to eq(expected)
7
7
 
8
- expected = [:network, :ipv4addr, :configure_for_dhcp, :mac, :nextserver, :use_nextserver].sort
8
+ expected = [:bootfile, :configure_for_dhcp, :ipv4addr, :mac, :network, :nextserver, :use_bootfile, :use_nextserver].sort
9
9
  expect(Infoblox::HostIpv4addr.remote_attrs.sort).to eq(expected)
10
10
  end
11
11
  end
@@ -3,7 +3,7 @@ class FooResource < Infoblox::Resource
3
3
  remote_attr_accessor :name, :junction, :extattrs, :extensible_attributes
4
4
  remote_attr_writer :do_it
5
5
  remote_post_accessor :sect
6
-
6
+ remote_attr_reader :readonly_thing
7
7
  attr_accessor :animal
8
8
  wapi_object "foo:animal"
9
9
  end
@@ -23,15 +23,15 @@ describe Infoblox::Resource, "#add_ipv4addr" do
23
23
  it "handles extattrs correctly in return fields" do
24
24
  expect(Infoblox).to receive(:wapi_version).and_return("1.0")
25
25
  hsh = FooResource._return_fields
26
- expect(hsh).to eq('name,junction,extensible_attributes')
26
+ expect(hsh).to eq('name,junction,extensible_attributes,readonly_thing')
27
27
 
28
28
  expect(Infoblox).to receive(:wapi_version).and_return("1.2")
29
29
  hsh = FooResource._return_fields
30
- expect(hsh).to eq('name,junction,extattrs')
30
+ expect(hsh).to eq('name,junction,extattrs,readonly_thing')
31
31
 
32
32
  expect(Infoblox).to receive(:wapi_version).and_return("2.0")
33
33
  hsh = FooResource._return_fields
34
- expect(hsh).to eq('name,junction,extattrs')
34
+ expect(hsh).to eq('name,junction,extattrs,readonly_thing')
35
35
  end
36
36
 
37
37
  it "should have a correct resource_uri" do
@@ -45,14 +45,14 @@ describe Infoblox::Resource, "#add_ipv4addr" do
45
45
  it "should find with default attributes" do
46
46
  conn = double
47
47
  uri = Infoblox.base_path + "foo:animal"
48
- allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction,extensible_attributes"}).and_return(FooResponse.new("[]"))
48
+ allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction,extensible_attributes,readonly_thing"}).and_return(FooResponse.new("[]"))
49
49
  expect(FooResource.all(conn)).to eq([])
50
50
  end
51
51
 
52
52
  it "should allow .all with return fields or max results" do
53
53
  conn = double
54
54
  uri = Infoblox.base_path + "foo:animal"
55
- allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction,extensible_attributes", :_max_results => -70}).and_return(FooResponse.new("[]"))
55
+ allow(conn).to receive(:get).with(uri, {:_return_fields => "name,junction,extensible_attributes,readonly_thing", :_max_results => -70}).and_return(FooResponse.new("[]"))
56
56
  expect(FooResource.all(conn, :_max_results => -70)).to eq([])
57
57
  end
58
58
 
@@ -83,6 +83,13 @@ describe Infoblox::Resource, "#add_ipv4addr" do
83
83
  expect(f._ref).to eq('abcdefg')
84
84
  end
85
85
 
86
+ it 'should set all attributes including readonly attrs' do
87
+ f = FooResource.new(:readonly_thing => 45, :do_it => false, :sect => :larry)
88
+ expect(f.readonly_thing).to eq(45)
89
+ expect(f.do_it).to be(false)
90
+ expect(f.sect).to eq(:larry)
91
+ end
92
+
86
93
  it 'should map wapi objects to classes' do
87
94
  @expected = {}
88
95
  ObjectSpace.each_object(Class) do |p|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infoblox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Billy Reisinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2015-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday