Skip to content

Commit 33eebb4

Browse files
committed
Merge pull request #53 from softlayer/v3.0
V3.0
2 parents 9d3b67d + 1875967 commit 33eebb4

71 files changed

Lines changed: 2832 additions & 1499 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.textile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
*3.0*
2+
* Substantially rewrote the ObjectFilter class. ObjectFilters used to be hashes which made it easy to manipulate their content incorrectly. The new implementation has a strict interface that makes it harder to manipulate filters incorrectly.
3+
* Added a model for Virtual Server Image Templates (SoftLayer::ImageTemplate) - VirtualServerOrder now requires an instance of this class rather than allowing you to provide the global_id of an image
4+
* Added a model for data centers (SoftLayer::Datacenter). Bare Metal, Bare Metal Package, and Virtual server orders now use an instance of Datacenter to identify where their servers will be provisioned. The routines in those classes which used to provide lists of valid data center names now return data center objects.
5+
* Virtual Server Upgrades are now handled by the VirtualServerUpgradeOrder class and not the VirtualServer class. This change was made for several reasons. Firt and foremost, it allows multiple aspects of a virtual server to be upgraded at once without having to wait on separate transactions to complete between upgrades. Secondly it opens the door for additional upgrades (for example, to disk configuration) to be added in the future.
6+
* Added a method to reboot servers.
7+
* The routine to retreive the open tickets on an account has been moved from the Ticket class. The set of open tickets is now a dynamic property of an account object.
8+
* The Model Layer now includes models for Server (aka. Shared) and VLAN (aka. Dedicated) firewalls in the ServerFirewall, and VLANFireall classes respectively. There are corresponding classes for ordering firewalls (ServerFirewallOrder and VLANFirewallOrder). To facilitate the process of locating the 'id' for a firewall, the Account class includes the find_VLAN_with_number routine which lets you look up the segments of a firewall from the VLAN nubmer.
9+
110
*2.2.2*
211
* Fixed a bug in BareMetalServerOrder_Package.rb where the order template did not use an array for the "hardware" key. This lead to an order template that would be accepted by verifyOrder, but rejected by placeOrder. An internal issue to review verifyOrder has also been generated. (reported by Rohit Singh)
312

@@ -7,7 +16,7 @@
716

817
*2.1.1*
918
* Virtual server upgrades no longer raise exceptions
10-
* Formalized the RDoc documentation process. Added overview and welcome documentation and changed the README so it directs folks to the new documentation.
19+
* Formalized the RDoc documentation process. Added overview and welcome documentation and changed the README so it directs folks to the new documentation.
1120

1221
*2.1.0*
1322
* Began implementing a model framework that allows Ruby developers to work with elements in the SoftLayer API in a more object-oriented fashion. The first release of this framework includes the Ticket, VirtualServer, and BareMetalServer classes.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ This software is written by the SoftLayer Development Team [sldn@softlayer.com](
2626

2727
Please join us in the [SoftLayer Developer Network forums](http://forums.softlayer.com/forum/softlayer-developer-network)
2828

29+
# Contributer License Agreement
30+
31+
Contributions to the softlayer-ruby project require the submission of a contributer license agreement. Please generate the documentation and carefully refer to the Contribution Guide to participate.
32+
2933
# Copyright and License
3034

3135
The `softlayer_api` Ruby Gem and it's source files are Copyright © 2010-2014 [SoftLayer Technologies, Inc](http://www.softlayer.com/). The software is provided under an MIT license. Details of that license can be found in the embedded LICENSE.md file.

doc_src/Contribution Guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Any requests for enhancements, new features, or bug reports should be entered in
1515

1616
# Development Environment
1717

18-
As a Ruby project, your first step will be to install the [Ruby Programming Language](https://www.ruby-lang.org/en/). Many Unix-derived environments, including Mac OS X, have a version or Ruby installed by default, however, the default version may be out-of-date. Please visit the main Ruby language [site](https://www.ruby-lang.org/en/) for instructions on installing an up-to-date build of Ruby for your computing environment.
18+
As a Ruby project, your first step will be to install the [Ruby Programming Language](https://www.ruby-lang.org/en/). Many Unix-derived environments, including Mac OS X, have a version or Ruby installed by default, however, the default version may be out-of-date. Please visit the main Ruby language [site](https://www.ruby-lang.org/en/) for instructions on installing an up-to-date build of Ruby for your computing environment.
1919

2020
The Gem supports multiple versions of Ruby, and we recommend using Ruby 2.0 or later. The [Ruby Version Manager (rvm)](https://rvm.io) is an invaluable tool to help keep track of multiple versions of Ruby. The Gem no longer supports Ruby 1.8.7. Support for Ruby 1.9 will continue for a time, but the Core Ruby team is already withdrawing their support for that version.
2121

@@ -100,7 +100,7 @@ The basic directory structure for the source tree is as follows
100100
softlayer # Folder containing most of the gem's actual source code
101101
log # RVM will create a log folder when running commands across multiple ruby versions.
102102
pkg # Created when the gem is built, contains built versions of the gem
103-
spec # Source directory for the RSpec testing specifications
103+
spec # Source directory for the RSpec testing specifications
104104
fixtures # Files used by the unit tests to mock responses from the SoftLayer network API
105105

106106
Most of the source files that implement the gem are found in `lib/softlayer`. If you wish to add new functionality, or edit existing functionality, you will probably edit the class files in this directory. Unit tests using Rspec are found in the spec folder and should generally follow the naming convention of <Class>_spec.rb

doc_src/Foundation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ SoftLayer provides two different endpoint URLs to scripts. One is associated wit
2121

2222
# The base URL of the SoftLayer API available to the public internet.
2323
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3/'
24-
24+
2525
# The base URL of the SoftLayer API available through SoftLayer's private network
2626
API_PRIVATE_ENDPOINT = 'https://api.service.softlayer.com/xmlrpc/v3/'
2727

@@ -65,7 +65,7 @@ The open_tickets variable should receive an array of hashes representing the ope
6565

6666
softlayer_client = SoftLayer::Client.new( :username => "joecustomer", api_key => "feeddeadbeefbadf00d...)
6767
open_tickets = softlayer_client["Account"].getOpenTickets
68-
68+
6969
open_tickets.each { |ticket_hash| puts ticket_hash["title"] }
7070

7171
This short example shows the essence of working with the Foundation API, you create a client, obtain a service, and make calls to the network SoftLayer API through that service.
@@ -82,7 +82,7 @@ Calls to the network SoftLayer API that result in errors being returned by the s
8282

8383
## Troubleshooting
8484

85-
Communication with the SoftLayer servers is handled through the XML-RPC client that is built into the Ruby Core library. As a consequence the network communication is also handled by Core library classes.
85+
Communication with the SoftLayer servers is handled through the XML-RPC client that is built into the Ruby Core library. As a consequence the network communication is also handled by Core library classes.
8686

8787
One aspect of network communication that the `softlayer_api` relies on the Ruby Core library to provide is SSL certificate authentication. Problems with this authentication often arise if your Ruby environment is not properly configured with SSL root certificates. If you find you are having trouble communicating with the network SoftLayer API, and the error messages point to SSL certificate authentication, please consider a web search using your specific error message as a search string. This will often reveal answers that can help you resolve networking issues your Ruby environment.
8888

doc_src/Model Layer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The details of the individual classes that for the object class hierarchy of the
1010

1111
The ModelBase is the abstract base class of object class hierarchy that forms the Model Layer of the `softlayer_api` Gem. An instance of ModelBase represents a single entity within the SoftLayer API.
1212

13-
In the Foundation layer, SoftLayer entities are represented as a Ruby hash whose keys and values are the are property names and property values of the entity. In the Model Layer, SoftLayer entities are represented by instances of the concrete subclasses of the Model Base class.
13+
In the Foundation layer, SoftLayer entities are represented as a Ruby hash whose keys and values are the are property names and property values of the entity. In the Model Layer, SoftLayer entities are represented by instances of the concrete subclasses of the Model Base class.
1414

1515
In implementation terms, an instance of the ModelBase class (or more accurately and instance of a concrete subclass of the ModelBase class) encapsulates the hashes of the Foundation layer defines the attributes and operations that form a convenient model for working with the underlying entity.
1616

@@ -24,7 +24,7 @@ The initializer for classes in the ModelBase hierarchy are declared:
2424
2525
end
2626

27-
The first argument is the client that the object may use to make requests to the network API. The second is the `network_hash`, the hash representation of the entity as returned by the network API.
27+
The first argument is the client that the object may use to make requests to the network API. The second is the `network_hash`, the hash representation of the entity as returned by the network API.
2828

2929
The hash used to initialize an instance of ModelBase *must* contain a key, `id`, whose value is the `id` of the SoftLayer entity that the object model instance will represent. Correspondingly, the ModelBase class defines the `id` as having the same value as the `id` property in the network hash.
3030

@@ -43,7 +43,7 @@ The ModelBase class defines the subscript operator (`[]`) to accept a property n
4343
ticket = SoftLayer::Ticket.ticket_with_id(123456)
4444
service_provider = ticket['serviceProvider']
4545

46-
In this case we ask the ticket for the value of the `serviceProvider` property. Note that the argument to the subscript operator is a string containing the property name.
46+
In this case we ask the ticket for the value of the `serviceProvider` property. Note that the argument to the subscript operator is a string containing the property name.
4747

4848
This technique can only return values stored in the `softlayer_hash` encapsulated in the ModelBase class. Many classes in the Model Layer limit the information retrieved from the network (using object masks) to a subset of the full set of properties available through the network API. Scripts can check whether or not a given property is included in the underlying hash by calling the `has_sl_property?` method of ModelBase.
4949

doc_src/Welcome.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ The Foundation layer, makes use of the [XMLRPC client](http://www.ruby-doc.org/s
1818

1919
The Model layer is built atop the foundation as object class hierarchy. The class hierarchy models the structures found in the SoftLayer environment using the object-oriented features of Ruby. It does this to abstract out some of the implementation detail that a developer would commonly have to work with to communicate with SoftLayer through the foundation layer.
2020

21-
The Model layer is by no means complete; quite to the contrary it is in its infancy and we believe that much of the development effort in the Gem will focus on incorporating new models into this layer. Because it is incomplete, however, we have put some effort into bridges from the functionality of the model, down to the lower level foundation, without trouble. Also, as a result of this, developers interested in using the Model layer should also should familiarize themselves with the Foundation.
21+
The Model layer is by no means complete; quite to the contrary it is in its infancy and we believe that much of the development effort in the Gem will focus on incorporating new models into this layer. Because it is incomplete, however, we have put some effort into bridges from the functionality of the model, down to the lower level foundation, without trouble. Also, as a result of this, developers interested in using the Model layer should also should familiarize themselves with the Foundation.
2222

2323
All developers should continue their exploration of the `softlayer_api` gem by examining the Foundation documentation. Clients that wish to make use of the abstractions provided in the object hierarchy may continue their exploration by looking at the Model Layer documentation. Developers who wish to expand the models found in the `softlayer_api` Gem should read the [Contribution Guide](ContributionGuide_md.html)

examples/account_servers.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
require 'rubygems'
2424
require 'softlayer_api'
2525
require 'pp'
26-
27-
# We can set the default client to be our client and that way
26+
27+
# We can set the default client to be our client and that way
2828
# we can avoid supplying it later
2929
SoftLayer::Client.default_client = SoftLayer::Client.new(
3030
# :username => "joecustomer" # enter your username here

examples/create_ticket.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
account = SoftLayer::Account.account_for_client(softlayer_client)
3636
account_user = account.service.getCurrentUser
3737
my_user_id = account_user["id"]
38-
38+
3939
# We also need a subject for the ticket. Subjects are specified by id
4040
# This code prints out a table of all the ticket subjects with their
4141
# ids:
4242
ticket_subjects = SoftLayer::Ticket.ticket_subjects(softlayer_client)
4343
ticket_subjects.each do |subject|
4444
puts "#{subject['id']}\t#{subject['name']}"
4545
end
46-
46+
4747
# For this example we'll use 'Public Network Question' as the subject. That's id 1022
4848
public_network_question_id = 1022
4949

@@ -58,7 +58,7 @@
5858
)
5959

6060
puts "Created a new ticket : #{new_ticket.id} - #{new_ticket.title}"
61-
61+
6262
# we can also add an update to the ticket:
6363
new_ticket.update("This is a ticket update sent from the Ruby library")
6464

examples/open_tickets.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@
3030
# $SL_API_KEY = "feeddeadbeefbadf00d..." # enter your api key here
3131

3232
# The client constructed here must get it's credentials from somewhere
33-
# In this script you might uncomment the globals above and assign your
33+
# In this script you might uncomment the globals above and assign your
3434
# credentials there
3535
SoftLayer::Client.default_client = SoftLayer::Client.new()
3636

3737
# The openTickets routine will pick up the default client established above.
3838
open_tickets = SoftLayer::Ticket.open_tickets()
3939

40-
open_tickets.sort!{ |lhs, rhs| -(lhs.lastEditDate <=> rhs.lastEditDate) }
40+
open_tickets.sort!{ |lhs, rhs| -(lhs.lastEditDate <=> rhs.lastEditDate) }
4141
open_tickets.each do |ticket|
4242
printf "#{ticket.id} - #{ticket.title}"
4343

examples/order_bare_metal_package.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,11 @@ def tl_dr_version
129129
# We have a configuration for the server, we also need a location for the new server.
130130
# The package can give us a list of locations. Let's print out that list
131131
puts "\nData Centers for '#{quad_intel_package.name}':"
132-
quad_intel_package.datacenter_options.each { |location| puts "\t#{location}"}
132+
quad_intel_package.datacenter_options.each { |datacenter| puts "\t#{datacenter.name}"}
133133

134134
# With all the config options in place we can now construct the product order.
135135
server_order = SoftLayer::BareMetalServerOrder_Package.new(quad_intel_package, client)
136-
server_order.datacenter = 'sng01'
136+
server_order.datacenter = SoftLayer::Datacenter.datacenter_named 'sng01', client
137137
server_order.hostname = 'sample'
138138
server_order.domain = 'softlayerapi.org'
139139
server_order.configuration_options = config_options

0 commit comments

Comments
 (0)