fog-softlayer 0.0.9 → 0.1.0

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDIyZDM4MDM4OTQzOGJhNmFlNDc1Mzc0ZDY2YTRkYzg1OThiNTlmMQ==
4
+ NGQ0NDhiNGE1NjdjZmVjNWNhY2UxMTRkZjBiZWFhNjYwYTU2MTBlMA==
5
5
  data.tar.gz: !binary |-
6
- ZDE3ZmZlY2FmMTlkMjA0ZjYxZjc1YjI2NzU1ZmNlYmFhYzdhYTdmNQ==
6
+ NTljMjJlMmQ3N2JlYmY3ZTM4YmZiMmQwM2I4MTUyMjgxZjc4OGY0NA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YzE4MzU0MzliMWQ0ZWJmMGEyNjg5ZmZjNzlkM2Y0NjlkMzIxODgzZmJjNzQz
10
- YjJhMjZhZmM4ZjExMjI3ZGUzYjM3N2Q4Y2Q5MWZhNDBmY2Y0NTMwNjM0ZThi
11
- MmYxOTNmN2Y0MjI4NTcwMWIwOWU0ODQyNjlhNTA2NGJmNGRmNDU=
9
+ YTBiMzQ1NDM5M2EzZWE5Y2U0ZDEzNmYzYjMxNDQ3MDExNzkzNTAzZjc0ZmY5
10
+ YWY4NTdjZmMxMjc3ODc1ZTE0ODVmMmM2MjkzNjk5ZWU2MzJlOTJiMjU3ZDEx
11
+ MjIyNjYyYWU5ZmUzMTVlNzNkZDkzNWY5NjJiNTQ2ZWFkMTNkZTA=
12
12
  data.tar.gz: !binary |-
13
- NDdhY2IyMGRmMDFiNzYwZTkyMTkzNThkMGVjYjc2NGQ1NDBlNjM1NmZlMTg0
14
- ZWIyMWFhMWQyMTY5NTg3ZDQwZGE4MDM2Yzc0ZjA2MzEwMzExYzFkMmFjNWU2
15
- OGFlMWM5MTAxZDJmMzgyOTY4OGJlN2Q1YjJkNjdlYjJhNTYzYmY=
13
+ YmI1NTgzZjI4ZjAyMWMyNTI1OTQwOTZkZDBjNjAwNWE2YmI3ZTI5NjIwOGUx
14
+ NDdmZGJmNjM1OWIzMmIxMzllMDBlZjkyNDM4MWNjMDhmOTg5Yjk5YTlkZjZk
15
+ M2I2NDY1M2YyZmNkMDhhZjI5ZmY1MmRmNDg4MGQxZTA0MDMzZGY=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ ## 0.1.0 2014-06-10
2
+
3
+ * Add missing get method to Fog::DNS::Softlayer::Record.
4
+ * Add OS attribute and ssh_password method to Compute model.
5
+
6
+ ### 0.0.9 2014-06-10
7
+
8
+ * Initial support for DNS.
9
+
10
+ ### 0.0.8 2014-06-05
11
+
12
+ * Released support for Object Storage.
13
+
1
14
  ### 0.0.7 2014-05-29
2
15
 
3
16
  * Compute requests and models initial development complete. Supports both VMs and BMC.
data/README.md CHANGED
@@ -11,12 +11,13 @@ in other applications.
11
11
 
12
12
  This release includes support for the following services:
13
13
  * Compute
14
-
15
- Additional services coming soon:
16
14
  * Storage
17
15
  * DNS
16
+
17
+ Additional services coming soon:
18
18
  * Image
19
19
  * Network
20
+ * Tags
20
21
 
21
22
  #### Installation
22
23
 
data/examples/dns.md CHANGED
@@ -15,7 +15,7 @@ These examples all assume you have `~/.fog` which contains the following
15
15
  @sl = Fog::DNS[:softlayer]
16
16
  ```
17
17
 
18
- 1. Create Operations
18
+ ##### Create Operations
19
19
 
20
20
  * Create Domain
21
21
 
@@ -27,14 +27,14 @@ These examples all assume you have `~/.fog` which contains the following
27
27
 
28
28
  ```ruby
29
29
  record = {
30
- 'data' => '127.0.0.1',
30
+ 'value' => '127.0.0.1',
31
31
  'host' => '@',
32
32
  'type' => 'a'
33
33
  }
34
34
  @domain.create_record(record)
35
35
  ```
36
36
 
37
- 1. Read Operations
37
+ ##### Read Operations
38
38
 
39
39
  * List all domains
40
40
 
@@ -61,8 +61,21 @@ These examples all assume you have `~/.fog` which contains the following
61
61
  @domain = @sl.domains.get(123456)
62
62
  @domain.records
63
63
  ```
64
+
65
+ * Get specific record by id
64
66
 
65
- 1. Update Operations
67
+ ```ruby
68
+ @domain = @sl.domains.get(123456)
69
+ @domain.records.get(456789012)
70
+ ```
71
+
72
+ or using the service:
73
+
74
+ ```ruby
75
+ @sl.records.get(456789012)
76
+ ```
77
+
78
+ ##### Update Operations
66
79
 
67
80
  After this point we consider you have a Fog::DNS::Softlayer::Domain on @domain variable
68
81
 
@@ -74,7 +87,7 @@ After this point we consider you have a Fog::DNS::Softlayer::Domain on @domain v
74
87
  @domain.records[3].save
75
88
  ```
76
89
 
77
- 1. Destroy Operations
90
+ ##### Destroy Operations
78
91
 
79
92
  After this point we consider you have a Fog::DNS::Softlayer::Domain on @domain variable
80
93
 
@@ -90,4 +103,4 @@ After this point we consider you have a Fog::DNS::Softlayer::Domain on @domain v
90
103
  ```ruby
91
104
  @domain = @sl.domains.get(123456)
92
105
  @domain.records.last.destroy
93
- ```
106
+ ```
@@ -35,6 +35,7 @@ module Fog
35
35
  request :get_domain
36
36
  request :get_domain_by_name
37
37
  request :get_domains
38
+ request :get_record
38
39
  request :get_records
39
40
  request :update_record
40
41
 
@@ -26,6 +26,7 @@ module Fog
26
26
  attribute :os_code, :aliases => 'operatingSystemReferenceCode'
27
27
  attribute :image_id, :type => :squash
28
28
  attribute :ephemeral_storage, :aliases => 'localDiskFlag'
29
+ attribute :os, :aliases => 'operatingSystem'
29
30
 
30
31
  # Times
31
32
  attribute :created_at, :aliases => ['createDate', 'provisionDate'], :type => :time
@@ -73,6 +74,10 @@ module Fog
73
74
  attributes[:image_id][:globalIdentifier] unless attributes[:image_id].nil?
74
75
  end
75
76
 
77
+ def ssh_password
78
+ self.os['passwords'][0]['password'] if self.id
79
+ end
80
+
76
81
  def ram=(set)
77
82
  if set.is_a?(Array) and set.first['hardwareComponentModel']
78
83
  set = 1024 * set.first['hardwareComponentModel']['capacity'].to_i
@@ -21,9 +21,17 @@ module Fog
21
21
  data = service.get_records(domain.id).body
22
22
  load(data)
23
23
  end
24
+
25
+ def get(identifier)
26
+ return nil if identifier.nil? || identifier == ""
27
+ response = service.get_record(identifier)
28
+ data = response.body
29
+ new.merge_attributes(data)
30
+ rescue Excon::Errors::NotFound
31
+ nil
32
+ end
24
33
 
25
34
  def new(attributes = {})
26
- requires :domain
27
35
  super({ :domain => domain }.merge!(attributes))
28
36
  end
29
37
  end
@@ -20,7 +20,7 @@ module Fog
20
20
 
21
21
  class Real
22
22
  def get_bare_metal_server(identifier)
23
- request(:hardware_server, identifier, :expected => [200, 404], :query => 'objectMask=mask[memory,provisionDate,processorCoreAmount,hardDrives,datacenter,hourlyBillingFlag]')
23
+ request(:hardware_server, identifier, :expected => [200, 404], :query => 'objectMask=mask[memory,provisionDate,processorCoreAmount,hardDrives,datacenter,hourlyBillingFlag,operatingSystem.passwords.password]')
24
24
  end
25
25
  end
26
26
  end
@@ -20,7 +20,7 @@ module Fog
20
20
 
21
21
  class Real
22
22
  def get_vm(identifier)
23
- request(:virtual_guest, identifier, :expected => [200, 404], :query => 'objectMask=mask[blockDevices,blockDeviceTemplateGroup.globalIdentifier]')
23
+ request(:virtual_guest, identifier, :expected => [200, 404], :query => 'objectMask=mask[blockDevices,blockDeviceTemplateGroup.globalIdentifier,operatingSystem.passwords.password]')
24
24
  end
25
25
  end
26
26
  end
@@ -0,0 +1,37 @@
1
+ #
2
+ # Author:: Celso Fernandes (<fernandes@zertico.com>)
3
+ # © Copyright IBM Corporation 2014.
4
+ #
5
+ # LICENSE: MIT (http://opensource.org/licenses/MIT)
6
+ #
7
+ module Fog
8
+ module DNS
9
+ class Softlayer
10
+
11
+ class Mock
12
+ def get_record(id)
13
+ # Get the record
14
+ @softlayer_domains.each do |domain|
15
+ domain[:resourceRecords].each do |record|
16
+ if record["id"].to_i == id.to_i
17
+ response = Excon::Response.new
18
+ response.body = record
19
+ response.status = 200
20
+ return response
21
+ end
22
+ end
23
+ end
24
+
25
+ raise Excon::Errors::NotFound
26
+ end
27
+
28
+ end
29
+
30
+ class Real
31
+ def get_record(id)
32
+ request(:dns_domain_resourceRecord, id)
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -6,6 +6,6 @@
6
6
  #
7
7
  module Fog
8
8
  module Softlayer
9
- VERSION = "0.0.9"
9
+ VERSION = "0.1.0"
10
10
  end
11
11
  end
@@ -22,7 +22,7 @@ Shindo.tests("Fog::DNS[:softlayer] | Record model", ["softlayer"]) do
22
22
  'type' => 'a'
23
23
  }
24
24
  current_serial = @domain.serial
25
- @domain.create_record(record)
25
+ @record = @domain.create_record(record)
26
26
  @domain.reload
27
27
  @domain.records(true)
28
28
  returns(4, "returns default plus one created, total 4 records") { @domain.records.count }
@@ -38,6 +38,18 @@ Shindo.tests("Fog::DNS[:softlayer] | Record model", ["softlayer"]) do
38
38
  returns(true, "returns serial increased") { (current_serial + 1) <= @domain.serial }
39
39
  end
40
40
 
41
+ tests("#get") do
42
+ @record_get = @service.records.get(@record.id)
43
+ returns(Fog::DNS::Softlayer::Record) { @record_get.class }
44
+
45
+ tests("after updating the record") do
46
+ @record_get.value = "192.168.10.1"
47
+ @record_get.save
48
+ @record_get.reload
49
+ returns("192.168.10.1", "returns right value") { @record_get.value }
50
+ end
51
+ end
52
+
41
53
  tests("#destroy") do
42
54
  current_serial = @domain.serial
43
55
  @domain.records.last.destroy
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-softlayer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Eldridge
@@ -274,6 +274,7 @@ files:
274
274
  - lib/fog/softlayer/requests/dns/get_domain.rb
275
275
  - lib/fog/softlayer/requests/dns/get_domain_by_name.rb
276
276
  - lib/fog/softlayer/requests/dns/get_domains.rb
277
+ - lib/fog/softlayer/requests/dns/get_record.rb
277
278
  - lib/fog/softlayer/requests/dns/get_records.rb
278
279
  - lib/fog/softlayer/requests/dns/update_record.rb
279
280
  - lib/fog/softlayer/requests/storage/copy_object.rb