Skip to content

Commit 8150eaf

Browse files
vsi security groups ruby example
1 parent c5b2543 commit 8150eaf

30 files changed

Lines changed: 1124 additions & 1257 deletions

File tree

classes/softlayer_virtual_guest/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ <h3>rest</h3>
240240
<h3>ruby</h3>
241241
<ul>
242242

243+
<li>
244+
<a href="https://softlayer.github.io/ruby/vsisecgroups/">Create a new virtual server and attach Security Groups</a>
245+
<div class="meta">Creates a new virtual server (VSI) aand attach the public and private interfaces to respective Security Groups.</div>
246+
</li>
247+
243248
<li>
244249
<a href="https://softlayer.github.io/ruby/migratededicatedinstance/">Migrate a VSI between dedicated hosts</a>
245250
<div class="meta">Migrate a Dedicated Host instance to another Dedicated Host. You can migrate your dedicated host instances from one host to another within the same POD.</div>

classes/softlayer_virtual_guest/index.xml

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,54 @@ def create_vsi():
5757

5858
if __name__ == &#39;__main__&#39;:
5959
create_vsi()
60+
&lt;/code&gt;&lt;/pre&gt;
61+
</description>
62+
</item>
63+
64+
<item>
65+
<title>Create a new virtual server and attach Security Groups</title>
66+
<link>https://softlayer.github.io/ruby/vsisecgroups/</link>
67+
<pubDate>Mon, 30 Oct 2017 00:00:00 UTC</pubDate>
68+
<author>Enthusiastic Hugo User</author>
69+
<guid>https://softlayer.github.io/ruby/vsisecgroups/</guid>
70+
<description>&lt;p&gt;To get a list of Security Groups you can attach to a Virtual Guest you can run the following code:&lt;/p&gt;
71+
72+
&lt;pre&gt;&lt;code class=&#34;language-ruby&#34;&gt;require &#39;softlayer_api&#39;
73+
require &#39;pp&#39;
74+
75+
client = SoftLayer::Client.new(:timeout =&amp;gt; 120)
76+
77+
getGroups = client[&#39;Network_SecurityGroup&#39;].getAllObjects
78+
79+
pp getGroups
80+
&lt;/code&gt;&lt;/pre&gt;
81+
82+
&lt;p&gt;Once you have the Security Group IDs you would like to use you can plug them in to the following example:&lt;/p&gt;
83+
84+
&lt;pre&gt;&lt;code class=&#34;language-ruby&#34;&gt;require &#39;softlayer_api&#39;
85+
require &#39;pp&#39;
86+
87+
client = SoftLayer::Client.new(:timeout =&amp;gt; 120)
88+
89+
productOrder = {
90+
&#39;hostname&#39; =&amp;gt; &#39;rubysectest&#39;,
91+
&#39;domain&#39; =&amp;gt; &#39;cde.services&#39;,
92+
&#39;datacenter&#39; =&amp;gt; {&#39;name&#39; =&amp;gt; &#39;dal05&#39;},
93+
&#39;startCpus&#39; =&amp;gt; 2, # 2 x 2.0 GHz Cores
94+
&#39;maxMemory&#39; =&amp;gt; 2048, # 4GB RAM
95+
&#39;private_network_only&#39; =&amp;gt; false,
96+
&#39;dedicated_host_only&#39; =&amp;gt; false,
97+
&#39;operatingSystemReferenceCode&#39; =&amp;gt; &#39;UBUNTU_LATEST_64&#39;, # Latest Ubuntu LTS
98+
&#39;localDiskFlag&#39; =&amp;gt; false, # Use a SAN disk
99+
&#39;public_security_groups&#39; =&amp;gt; [43507],
100+
&#39;private_security_groups&#39; =&amp;gt; [43511],
101+
&#39;hourly&#39; =&amp;gt; false # Charge me for hourly use, rather than monthly.
102+
}
103+
104+
order = client[&#39;Virtual_Guest&#39;].createObject(productOrder)
105+
106+
pp order
107+
60108
&lt;/code&gt;&lt;/pre&gt;
61109
</description>
62110
</item>
@@ -826,35 +874,6 @@ try {
826874
&lt;/code&gt;&lt;/pre&gt;
827875

828876
&lt;p&gt;To detach the disk simply change &lt;code&gt;$client-&amp;gt;attachDiskImage($storage_id)&lt;/code&gt; to &lt;code&gt;$client-&amp;gt;detachDiskImage($storage_id)&lt;/code&gt;.&lt;/p&gt;
829-
</description>
830-
</item>
831-
832-
<item>
833-
<title>Attach and Detach a Block Device to a Virtual_Guest</title>
834-
<link>https://softlayer.github.io/ruby/attach_detach/</link>
835-
<pubDate>Mon, 22 Aug 2016 00:00:00 UTC</pubDate>
836-
<author>Enthusiastic Hugo User</author>
837-
<guid>https://softlayer.github.io/ruby/attach_detach/</guid>
838-
<description>&lt;p&gt;Attaching a currently detached portable block device to a given guest. The disk image will need to be migrated to the host the guest is on, so make sure to check if that host has enough disk space (with checkHostDiskAvailability) before attaching. This is only required for guests with local storage guests. SAN based guests don&amp;rsquo;t need that step.&lt;/p&gt;
839-
840-
&lt;p&gt;Running this on a disk that is already attached will move the disk to the new guest.&lt;/p&gt;
841-
842-
&lt;pre&gt;&lt;code class=&#34;language-ruby&#34;&gt;require &#39;softlayer_api&#39;
843-
require &#39;pp&#39;
844-
845-
# Credentials to the API are read from a configuration file by default.
846-
# See https://github.com/softlayer/softlayer-ruby/blob/master/lib/softlayer/Config.rb#L11-L44
847-
client = SoftLayer::Client.new(:timeout =&amp;gt; 120)
848-
disk_id = 87654321
849-
guest_id = 1234567
850-
851-
attach = client[&#39;SoftLayer_Virtual_Guest&#39;]
852-
item = attach.object_with_id(guest_id).attachDiskImage(disk_id)
853-
854-
pp item
855-
&lt;/code&gt;&lt;/pre&gt;
856-
857-
&lt;p&gt;To detach the disk simply change &lt;code&gt;attachDiskImage(disk_id)&lt;/code&gt; to &lt;code&gt;detachDiskImage(disk_id)&lt;/code&gt;.&lt;/p&gt;
858877
</description>
859878
</item>
860879

index.html

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,44 @@
9999
<h1>Release Notes</h1>
100100
<div class="col-md-9">
101101

102+
<div class="well well-sm release-note example col-md-12">
103+
<h3>
104+
<a href="https://softlayer.github.io/release_notes/2017/20171025/"> October 25, 2017</a>
105+
<br>
106+
</h3>
107+
<div class="container">
108+
<div class="row">
109+
<div class="col-md-8">
110+
111+
112+
<h4 id="portal">Portal</h4>
113+
114+
<ul>
115+
<li>Added 2 links to the order approval email when ordering MDMS. The links will guide the customers to the User Guide and device Checklist.<br /></li>
116+
<li>Removed the warning on the order forms that 2nd disk is required for Balanced local flavor VSIs.</li>
117+
</ul>
118+
119+
<h4 id="api">API</h4>
120+
121+
<ul>
122+
<li>When a user is created with double quotes in email address from API, Error message pointed to a problem with username. This has been fixed to show the correct error message.</li>
123+
</ul>
124+
125+
<h4 id="backend">Backend</h4>
126+
127+
<ul>
128+
<li>Added Saudi Arabia, United Arab Emirates to the list of countries that accept VAT ID.</li>
129+
</ul>
130+
131+
</div>
132+
</div>
133+
</div>
134+
</div>
135+
136+
137+
138+
139+
102140
<div class="well well-sm release-note example col-md-12">
103141
<h3>
104142
<a href="https://softlayer.github.io/release_notes/2017/20171012/"> October 12, 2017</a>
@@ -446,45 +484,6 @@ <h4 id="backend">Backend</h4>
446484

447485

448486

449-
<div class="well well-sm release-note example col-md-12">
450-
<h3>
451-
<a href="https://softlayer.github.io/release_notes/2017/20170803/"> August 3, 2017</a>
452-
<br>
453-
</h3>
454-
<div class="container">
455-
<div class="row">
456-
<div class="col-md-8">
457-
458-
459-
<h4 id="portal">Portal</h4>
460-
461-
<ul>
462-
<li>Added the new <a href="https://www.ibm.com/blogs/bluemix/2017/08/maximize-control-ibm-bluemix-virtual-servers/">Dedicated Host</a> offering to the catalog. A dedicated host is a physical server with workload capacity entirely dedicated to a single client’s use.</li>
463-
<li>Corrected an issue where customers were unable to attach more than one dedicated host to a ticket.</li>
464-
</ul>
465-
466-
<h4 id="api">API</h4>
467-
468-
<ul>
469-
<li>Exposed the <a href="http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_DedicatedHost">SoftLayer_Virtual_DedicatedHost</a> Service. This allows you to interact with the new Dedicated Host offering.</li>
470-
<li>Added the <a href="http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/addBulkDedicatedHostAccess">addBulkDedicatedHostAccess</a> method to the <a href="http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer">SoftLayer_User_Customer</a> service.</li>
471-
</ul>
472-
473-
<h4 id="backend">Backend</h4>
474-
475-
<ul>
476-
<li>None</li>
477-
</ul>
478-
479-
</div>
480-
</div>
481-
</div>
482-
</div>
483-
484-
485-
486-
487-
488487
</div>
489488

490489

0 commit comments

Comments
 (0)