gpueater 0.0.1 → 1.0.0

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: beccaca8018c31fd575f0fe8add66e126bdb4dd7
4
- data.tar.gz: 8d2dc17153a2aa26c139aa91f4988ce65c1156e4
3
+ metadata.gz: 5924c0ad7051fef2ebf9a38f6c3d8121b99fd1b6
4
+ data.tar.gz: bfff0a424b210fd325adc8f2bcd6bf438fc0f330
5
5
  SHA512:
6
- metadata.gz: c56a439d43bd23fb05969e3030b6f4ce1e4df92f8c0be7adca2ce694e8099ed0a831ae4b8a3d70fed07b24dcc87488b9ebb438b9d58f41681cd6deafd3dbc1d0
7
- data.tar.gz: 1e2a2b07f5de78b7586b261320831ca9a8c26bc22bd176fa206622e461ef0b8a8b2a95af765f423f9ae2ff9b6dd51b0281a37cb4b98552d04e80c6183c8447c7
6
+ metadata.gz: 60ecee478aec1f73096fdf78b6bd0d0f361005b121b168024c0bd99690e41f60e37c12b66266b144e0ee1ee56d0ef91aacbcf5c674a2ffdf82ed54da5b0d77ec
7
+ data.tar.gz: d348d81746a89d95f1f585281226d72750dc75795db1cbcdb1ed4da5bca224c03a02fe7f531b17901406c5d6b4933bcb29dbda90b56fa469fcae38865ef60d41
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ pkg/
data/CODE_OF_CONDUCT.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at aki.nakatsuka@pegara.com. All
58
+ reported by contacting the project team at info@pegara.com. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gpueater (0.0.1)
4
+ gpueater (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
- # GPUEater Console API
1
+ # GPUEater API Console
2
2
 
3
3
  ## Getting Started
4
- GPUEater is a cloud computing service focusing on Machine Learning and Deep Learning. Now, AMD Radeon GPUs and NVIDIA Quadro GPUs are available.
4
+ GPUEater is a cloud computing service focusing on Machine Learning and Deep Learning. Now, AMD Radeon GPUs and NVIDIA Quadro GPUs are available.
5
5
 
6
6
  This document is intended to describe how to set up this API and how to control your instances through this API.
7
7
 
@@ -9,7 +9,7 @@ Before getting started, register your account on GPUEater.
9
9
  https://www.gpueater.com/
10
10
 
11
11
  ### Prerequisites
12
- 1. Ruby 2.x is required to run GPUEater Console API.
12
+ 1. Ruby 2.x is required to run GPUEater API Console.
13
13
  2. Create a JSON file in accordance with the following instruction.
14
14
 
15
15
  At first, open your account page(https://www.gpueater.com/console/account) and copy your access_token. The next, create a JSON file on ~/.eater
@@ -87,7 +87,7 @@ puts g.image_list()
87
87
 
88
88
  #### Instance launch
89
89
 
90
- Specify product, OS image, and ssh_key for instance launching.
90
+ Specify product, OS image, and ssh_key for instance launching.
91
91
 
92
92
  ```
93
93
  require('gpueater')
@@ -110,7 +110,7 @@ res = g.launch_ondemand_instance(param)
110
110
  puts res
111
111
  ```
112
112
  In the event, the request has succeeded, then the API returns the following empty data.
113
- {data:null, error:null}
113
+ {data:null, error:null}
114
114
 
115
115
  In the event, errors occurred during the instance instantiation process, then the API returns details about the error.
116
116
 
@@ -137,6 +137,123 @@ res.select{|e| e['tag'] == 'HappyGPUProgramming' }.each{|e|
137
137
  }
138
138
  ```
139
139
 
140
+ -----
141
+
142
+
143
+ #### API list
144
+
145
+ ##### Image
146
+ | Version | Function | Required | Description |
147
+ | ---- | ---- | ---- | ---- |
148
+ | v0.8 | image_list() | | Listing all OS images |
149
+ | v1.5 | snapshot_instance(form) | instance_id, machine_resource_id | Creating a snapshot |
150
+ | v1.5 | delete_snapshot(form) | instance_id, machine_resource_id | Deleting a snapshot |
151
+ | v1.5 | create_image(form) | instance_id, machine_resource_id | Adding an OS image of snapshot |
152
+ | v2.0 | register_image(form) | url | Registering an OS image of snapshot on the internet |
153
+ | v1.5 | delete_image(form) | image | Deleting an OS image |
154
+
155
+
156
+ ##### SSH Key
157
+ | Version | Function | Required | Description |
158
+ | ---- | ---- | ---- | ---- |
159
+ | v0.8 | ssh_key_list() | | Listing all ssh keys |
160
+ | v1.0 | generate_ssh_key() | | Generating Key Pair |
161
+ | v1.0 | register_ssh_key(form) | name, public_key | Registering an SSH key |
162
+ | v1.0 | delete_ssh_key(form) | id | Deleting an SSH key |
163
+
164
+
165
+
166
+ ##### Instance
167
+ | Version | Function | Required | Description |
168
+ | ---- | ---- | ---- | ---- |
169
+ | v0.8 | ondemand_list() | | Listing all on-demand instances |
170
+ | v2.0 | subscription_list() | | Listing all subscription instances |
171
+ | v0.8 | launch_ondemand_instance(form) | product_id, image, ssh_key_id | Launch an on-demand instance |
172
+ | v2.0 | launch_subcription_instance(form) | subscription_id, image, ssh_key_id | Launch a subscription instance |
173
+ | v0.8 | instance_list() | | Listing all launched instances |
174
+ | v1.0 | change_instance_tag(form) | instance_id, tag | Changing an instance tag |
175
+ | v1.0 | start_instance(form) | instance_id, machine_resource_id | Starting an instance. If the instance is already RUNNING, nothing is going to happen |
176
+ | v1.0 | stop_instance(form) | instance_id, machine_resource_id | Stopping an instance. If the instance is already STOPPED, nothing is going to happen |
177
+ | v1.0 | restart_instance(form) | instance_id, machine_resource_id | Restarting an instance |
178
+ | v0.8 | terminate_instance(form) | instance_id, machine_resource_id | Terminating an instance |
179
+ | v1.0 | emergency_restart_instance(form) | instance_id, machine_resource_id | Restarting an instance emergently when an instance is hung up |
180
+
181
+ The "machine_resource_id" is including an instance object. See the following sample code.
182
+
183
+ Example:
184
+ ```
185
+
186
+ instance = g.instance_list()[0]
187
+ # instance object has instance_id, and machine_resource_id.
188
+
189
+ g.terminate_instance(instance)
190
+
191
+ ```
192
+
193
+ ##### Network
194
+ | Version | Function | Required | Description |
195
+ | ---- | ---- | ---- | ---- |
196
+ | v1.0 | port_list(form) | instance_id | Listing all ports |
197
+ | v1.0 | open_port(form) | instance_id, connection_id, port | Opening a port for inbound traffic |
198
+ | v1.0 | close_port(form) | instance_id, connection_id, port | Closing a port for inbound traffic |
199
+ | v1.0 | renew_ipv4(form) | instance_id | Getting a new IPv4 address |
200
+ | v1.0 | network_description(form) | instance_id | This API reports current network status information |
201
+
202
+ ##### Storage
203
+ | Version | Function | Required | Description |
204
+ | ---- | ---- | ---- | ---- |
205
+ | v2.0 | create_volume(form) | size | Creating an extended volume |
206
+ | v2.0 | attach_volume(form) | volume_id, instance_id | Attaching an extended volume to an instance |
207
+ | v2.0 | delete_volume(form) | volume_id | Deleting an extended volume |
208
+ | v2.0 | transfer_volume(form) | volume_id,region_id | Transfering an extended volume to another region |
209
+
210
+ ##### Subscription
211
+ | Version | Function | Required | Description |
212
+ | ---- | ---- | ---- | ---- |
213
+ | v2.0 | subscription_instance_list() | | Listing all items of subscription instance |
214
+ | v2.0 | subscription_storage_list() | | Listing all items of storages volume for subscription instance |
215
+ | v2.0 | subscription_network_list() | | Listing all items of subscription networks |
216
+ | v2.0 | subscribe_instance(form) | subscription_id | Subscribing a subscription instance |
217
+ | v2.0 | unsubscribe_instance(form) | subscription_id | Canceling a subscription instance |
218
+ | v2.0 | subscribe_storage(form) | subscription_id | Subscribing a storage volume for subscription instance |
219
+ | v2.0 | unsubscribe_storage(form) | subscription_id | Canceling a storage volume for subscription instance |
220
+ | v2.0 | subscribe_network(form) | subscription_id | Subscribing a network product |
221
+ | v2.0 | unsubscribe_network(form) | subscription_id | Canceling a network product |
222
+
223
+ ##### Special
224
+ | Version | Function | Required | Description |
225
+ | ---- | ---- | ---- | ---- |
226
+ | v2.5 | live_migration(form) | product_id, region_id, connection_id | Moving a running instance between different physical machines without termination |
227
+ | v2.5 | cancel_transaction(form) | transaction_id | Canceling a transaction |
228
+ | v2.5 | peak_transaction(form) | transaction_id | This API reports current status information of a transaction |
229
+
230
+ ##### Payment
231
+ | Version | Function | Required | Description |
232
+ | ---- | ---- | ---- | ---- |
233
+ | v1.0 | invoice_list() | | Listing invoices for on-demand instances |
234
+ | v2.0 | subscription_invoice_list() | | Listing invoices for subscription instances |
235
+ | v1.5 | make_invoice(form) | invoice_id | Obtain a pdf invoice |
236
+
237
+ ##### Extensions
238
+ | Version | Function | Required | Description |
239
+ | ---- | ---- | ---- | ---- |
240
+ | v1.2 | copy_file(form) | action("get"or"put"), src, dst | Copying a file. "get" obtains a file from a remote host to your local host, and "put" is the opposite. "src" is a source file path, and "dst" is a destination file path |
241
+ | v1.2 | delete_file(form) | src, recursive | Deleting a remote file |
242
+ | v1.2 | move_file(form) | action("get"or"put"), src, dst | Moving a file. "get" obtains a file from a remote host to your local host, and "put" is the opposite. "src" is a source file path, and "dst" is a destination file path |
243
+ | v1.2 | make_directory(form) | dst | Making a directory in a remote host |
244
+ | v1.2 | file_list(form) | src | Listing all files in a remote host |
245
+ | v1.2 | synchronize_files(form) | action, src, dst | This API is similar to the "rsync" |
246
+ | v1.2 | login_instance(form) | instance_id | Logging in a specific instance through the SSH |
247
+ | v1.2 | tunnel(form) | instance_id, port | This API enables a port tunneling between your local and a remote host |
248
+
249
+ ##### Class API
250
+ | Version | Function | Required | Description |
251
+ | ---- | ---- | ---- | ---- |
252
+ | v0.8 | new() | | Instantiating a gpueater object |
253
+ | v0.8 | apilist() | | Listing all available APIs. |
254
+
255
+
256
+
140
257
  ## License
141
258
 
142
259
  This project is licensed under the MIT License - see the [LICENSE.txt](LICENSE.txt) file for details
data/gpueater.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ["Pegara, Inc."]
10
10
  spec.email = ["info@pegara.com"]
11
11
 
12
- spec.summary = %q{GPUEater Console API}
12
+ spec.summary = %q{GPUEater API Console}
13
13
  spec.description = %q{This module is API for GPUEater web console.}
14
14
  spec.homepage = "https://www.gpueater.com/"
15
15
  spec.license = "MIT"
@@ -1,3 +1,3 @@
1
1
  module GPUEater
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/gpueater.rb CHANGED
@@ -2,11 +2,13 @@ require "gpueater/version"
2
2
  require 'faraday' # gem install net-http-persistent faraday
3
3
  require 'tmpdir'
4
4
  require 'json'
5
+ require 'fileutils'
5
6
 
6
7
 
7
8
  module GPUEater
8
9
  class APIv1
9
10
  def initialize
11
+ @debug = true
10
12
  @base = 'https://www.gpueater.com'
11
13
  if ENV['GPUEATER_URL']
12
14
  @base = ENV['GPUEATER_URL']
@@ -23,6 +25,8 @@ module GPUEater
23
25
  # builder.use Faraday::Response::Logger
24
26
  builder.use Faraday::Adapter::NetHttpPersistent # gem install net-http-persistent
25
27
  end
28
+ @alist=["raccoon", "dog", "wild boar", "rabbit", "cow", "horse", "wolf", "hippopotamus", "kangaroo", "fox", "giraffe", "bear", "koala", "bat", "gorilla", "rhinoceros", "monkey", "deer", "zebra", "jaguar", "polar bear", "skunk", "elephant", "raccoon dog", "animal", "reindeer", "rat", "tiger", "cat", "mouse", "buffalo", "hamster", "panda", "sheep", "leopard", "pig", "mole", "goat", "lion", "camel", "squirrel", "donkey"]
29
+ @blist=["happy", "glad", "comfortable", "pleased", "delighted", "relieved", "calm", "surprised", "exciting"]
26
30
 
27
31
  begin
28
32
  @g_config = JSON.load(open(".eater").read)
@@ -31,27 +35,34 @@ module GPUEater
31
35
  end
32
36
 
33
37
  begin
34
- @g_header['cookie'] = open(@cookie_path).read
38
+ @g_header['cookie'] = open(@cookie_path).read
35
39
  rescue => e
36
40
  end
37
41
  end
38
42
 
39
43
 
40
44
  def _get(u,q={})
45
+ puts u if @debug
41
46
  response = @conn.get do |req|
42
47
  req.url u
43
- @g_header.each{|k,v| req.headers[k] = v }
48
+ @g_header.each{|k,v|
49
+ if v
50
+ req.headers[k] = v
51
+ end
52
+ }
44
53
  end
45
54
  return response
46
55
  end
47
56
 
48
57
  def _post(u,form)
58
+ puts u if @debug
49
59
  response = @conn.post do |req|
50
- p u
51
- p @g_header
52
- p form
53
60
  req.url u
54
- @g_header.each{|k,v| req.headers[k] = v }
61
+ @g_header.each{|k,v|
62
+ if v
63
+ req.headers[k] = v
64
+ end
65
+ }
55
66
  req.body = form
56
67
  end
57
68
  return response
@@ -59,10 +70,12 @@ module GPUEater
59
70
 
60
71
  def relogin
61
72
  res = _post('/api_login',{'email':@g_config['gpueater']['email'],'password':@g_config['gpueater']['password']})
62
- @g_header['cookie'] = res.headers['set-cookie']
63
- f = open(@cookie_path,"w")
64
- f.write(@g_header['cookie'])
65
- f.close
73
+ if res.headers['set-cookie']
74
+ @g_header['cookie'] = res.headers['set-cookie']
75
+ f = open(@cookie_path,"w")
76
+ f.write(@g_header['cookie'])
77
+ f.close
78
+ end
66
79
  end
67
80
 
68
81
  class ProductsResnpose
@@ -70,9 +83,9 @@ module GPUEater
70
83
  attr_accessor :ssh_keys
71
84
  attr_accessor :products
72
85
  def initialize(j)
73
- @images = j['data']['images']
74
- @ssh_keys = j['data']['ssh_keys']
75
- @products = j['data']['products']
86
+ @images = j['images']
87
+ @ssh_keys = j['ssh_keys']
88
+ @products = j['products']
76
89
  end
77
90
  def find_image(n)
78
91
  @images.values.select{|v| v['name'] == n }.pop
@@ -84,91 +97,293 @@ module GPUEater
84
97
  @products.select{|v| v['name'] == n }.pop
85
98
  end
86
99
  end
87
-
88
- def instance_list
100
+
101
+
102
+
103
+ def func_get(api,required_fields=[],query={}, e=nil, try=2)
104
+ raise e if try <= 0
105
+ required_fields.each{|v| raise "Required field => #{v}" unless form.include?(v) }
89
106
  j = nil
90
107
  begin
91
- j = JSON.load(_get('/console/servers/instance_list').body)
92
- rescue
108
+ j = JSON.load(_get(api).body)
109
+ rescue => e
93
110
  relogin
94
- return instance_list
111
+ return func_get(api, required_fields, query, e, try-1)
95
112
  end
96
- return j['data']
113
+ raise j['error'] if j['error']
114
+ j['data']
97
115
  end
98
116
 
99
- def image_list
117
+ def func_post(api,required_fields=[],form={}, e=nil, try=2)
118
+ raise e if try <= 0
119
+ required_fields.each{|v| raise "Required field => #{v}" unless form.include?(v) }
100
120
  j = nil
101
121
  begin
102
- j = JSON.load(_get('/console/servers/images').body)
103
- rescue
122
+ j = JSON.load(_post(api,form).body)
123
+ rescue => e
104
124
  relogin
105
- return image_list
125
+ return func_post(api, required_fields, form, e, try-1)
106
126
  end
107
- return j['data']
127
+ raise j['error'] if j['error']
128
+ j['data']
108
129
  end
109
-
110
- def ssh_key_list
130
+
131
+ def func_post_inss(api,required_fields=[],form={}, e=nil, try=2)
132
+ raise e if try <= 0
133
+ required_fields.each{|v| raise "Required field => #{v}" unless form.include?(v) }
134
+ form["instances"] = [{"instance_id"=>form["instance_id"],"machine_resource_id"=>form["machine_resource_id"]}].to_json;
111
135
  j = nil
112
136
  begin
113
- j = JSON.load(_get('/console/servers/ssh_key_list').body)
114
- rescue
137
+ j = JSON.load(_post(api,form).body)
138
+ rescue => e
115
139
  relogin
116
- return ssh_key_list
140
+ return func_post(api, required_fields, form, e, try-1)
117
141
  end
118
- return j['data']
142
+ raise j['error'] if j['error']
143
+ j['data']
119
144
  end
145
+
146
+ # def func_post_launch(api,required_fields=[],form={}, e=nil, try=2)
147
+ # raise e if try <= 0
148
+ # tag = form['tag']
149
+ # unless tag
150
+ # form['tag'] = @alist[((rand()*100) % @alist.length).to_i] +"-"+@blist[((rand()*100) % @blist.length).to_i]
151
+ # end
152
+ # required_fields.each{|v| raise "Required field => #{v}" unless form.include?(v) }
153
+ # image = form['image']
154
+ # ssh_key_id = form['ssh_key_id']
155
+ # product_id = form['product_id']
156
+ # unless image.kind_of?(String)
157
+ # end
158
+ #
159
+ # j = nil
160
+ # begin
161
+ # j = JSON.load(_post(api,form).body)
162
+ # rescue => e
163
+ # relogin
164
+ # return func_post(api, required_fields, form, e, try-1)
165
+ # end
166
+ # raise j['error'] if j['error']
167
+ # j['data']
168
+ # end
169
+
170
+ def ___________image___________;end #@
171
+ def image_list; func_get('/console/servers/images'); end #@
172
+ def snapshot_instance; raise "Not implemented yet"; end #@
173
+ def delete_snapshot; raise "Not implemented yet"; end #@
174
+ def create_image; raise "Not implemented yet"; end #@
175
+ def register_image; raise "Not implemented yet"; end #@
176
+ def delete_image; raise "Not implemented yet"; end #@
177
+
178
+
179
+ def ___________ssh_key___________;end #@
180
+ def ssh_key_list; func_get('/console/servers/ssh_keys'); end #@
181
+ def generate_ssh_key; func_get('/console/servers/ssh_key_gen'); end #@
182
+ def register_ssh_key(form); func_post('/console/servers/register_ssh_key',['name','public_key'],form); end #@
183
+ def delete_ssh_key(form); func_post('/console/servers/delete_ssh_key',['id'],form); end #@
120
184
 
121
- def ondemand_list
122
- j = nil
123
- begin
124
- j = JSON.load(_get('/console/servers/ondemand_launch_list').body)
125
- rescue
126
- relogin
127
- return ondemand_list
185
+ def ___________instance___________;end #@
186
+ def ondemand_list; ProductsResnpose.new(func_get('/console/servers/ondemand_launch_list')); end #@
187
+ def subscription_list; raise "Not implemented yet"; end #@
188
+ def launch_ondemand_instance(form); func_post('/console/servers/launch_ondemand_instance',['product_id','image','ssh_key_id','tag'],form); end #@
189
+ def launch_subcription_instance(form); raise "Not implemented yet"; end #@
190
+ def instance_list; func_get('/console/servers/instance_list'); end #@
191
+ def change_instance_tag(form); func_post('/console/servers/change_instance_tag',['instance_id','tag'],form); end #@
192
+ def start_instance(form); func_post_inss('/console/servers/start',['instance_id','machine_resource_id'],form); end #@
193
+ def stop_instance(form); func_post_inss('/console/servers/stop',['instance_id','machine_resource_id'],form); end #@
194
+ def restart_instance(form); func_post_inss('/console/servers/stop',['instance_id','machine_resource_id'],form); func_post_inss('/console/servers/start',['instance_id','machine_resource_id'],form); end #@
195
+ def terminate_instance(form); func_post_inss('/console/servers/force_terminate',['instance_id','machine_resource_id'],form); end #@
196
+ def emergency_restart_instance(form); func_post_inss('/console/servers/emergency_restart',['instance_id','machine_resource_id'],form); end #@
197
+
198
+
199
+ def test
200
+ pd = ondemand_list
201
+ image = pd.find_image "Ubuntu16.04 x64"
202
+ ssh_key = pd.find_ssh_key "my_ssh_key2"
203
+ product = pd.find_product "n1.p400"
204
+
205
+ emergency_restart_instance(instance_list[0]);
206
+ p image
207
+ p ssh_key["id"]
208
+ p product["id"]
209
+
210
+ #launch_ondemand_instance({"tag"=>"ponkoponko","product_id"=>product["id"], "ssh_key_id"=>ssh_key["id"], "image" => image["alias"]});
211
+
212
+
213
+
214
+ def ssh_key_test
215
+ key = generate_ssh_key
216
+ keyname = 'my_ssh_key2'
217
+ ssh_key_list().select{|e| delete_ssh_key(e) if e["name"] == keyname }
218
+ register_ssh_key({"name"=>keyname,"public_key"=>key["public_key"]})
219
+ pem = File.join(@homedir,'.ssh',keyname+".pem")
220
+ fp = open(pem,"w")
221
+ fp.write(key["private_key"])
222
+ fp.close
223
+ FileUtils.chmod(0600,pem)
224
+ puts ssh_key_list
128
225
  end
129
- return ProductsResnpose.new(j)
130
226
  end
227
+ end
228
+
229
+
230
+ def __________network__________;end #@
231
+ def port_list; func_get('/console/servers/port_list'); end #@
232
+ def open_port(form); func_post('/console/servers/add_port',['instance_id','connection_id','port'],form); end #@
233
+ def close_port(form); func_post('/console/servers/delete_port',['instance_id','connection_id','port'],form); end #@
234
+ def renew_ipv4(form); func_post('/console/servers/renew_ipv4',['instance_id'],form); end #@
235
+ def refresh_ipv4(form); func_post('/console/servers/refresh_ipv4',['instance_id'],form); end #@
236
+ def network_description(form); func_get('/console/servers/instance_info',['instance_id'],form); end #@
237
+
238
+
239
+ def __________storage__________;end #@
240
+ def create_volume; raise "Not implemented yet"; end #@
241
+ def delete_volume; raise "Not implemented yet"; end #@
242
+ def transfer_volume; raise "Not implemented yet"; end #@
243
+
244
+ def _________subscription__________;end #@
245
+ def subscription_instance_list; raise "Not implemented yet"; end #@
246
+ def subscription_storage_list; raise "Not implemented yet"; end #@
247
+ def subscription_network_list; raise "Not implemented yet"; end #@
248
+ def subscribe_instance; raise "Not implemented yet"; end #@
249
+ def unsubscribe_instance; raise "Not implemented yet"; end #@
250
+ def subscribe_storage; raise "Not implemented yet"; end #@
251
+ def unsubscribe_storage; raise "Not implemented yet"; end #@
252
+ def subscribe_network; raise "Not implemented yet"; end #@
253
+ def unsubscribe_network; raise "Not implemented yet"; end #@
254
+
255
+ def _________special__________;end #@
256
+ def live_migration; raise "Not implemented yet"; end #@
257
+ def cancel_transaction; raise "Not implemented yet"; end #@
131
258
 
132
- def launch_ondemand_instance(form)
133
- j = nil
134
- unless form['tag']
135
- form['tag'] = ""
136
- end
137
- raise "required product_id" unless form['product_id']
138
- raise "required image" unless form['image']
139
- raise "required ssh_key_id" unless form['ssh_key_id']
259
+ def _________payment__________;end #@
260
+ def invoice_list; raise "Not implemented yet"; end #@
261
+ def subscription_invoice_list; raise "Not implemented yet"; end #@
262
+ def make_invoice; raise "Not implemented yet"; end #@
140
263
 
141
- begin
142
- j = JSON.load(_post('/console/servers/launch_ondemand_instance',form).body)
143
- rescue
144
- relogin
145
- return launch_ondemand_instance
146
- end
147
- return j
148
- end
264
+ def _________extensions__________;end #@
265
+ def copy_file; raise "Not implemented yet"; end #@
266
+ def delete_file; raise "Not implemented yet"; end #@
267
+ def move_file; raise "Not implemented yet"; end #@
268
+ def make_directory; raise "Not implemented yet"; end #@
269
+ def file_list; raise "Not implemented yet"; end #@
270
+ def synchronize_files; raise "Not implemented yet"; end #@
271
+ def login_instance; raise "Not implemented yet"; end #@
272
+ def tunnel; raise "Not implemented yet"; end #@
273
+
274
+ def __________________________;end #@
275
+
149
276
 
150
- def terminate_instance(form)
151
- j = nil
152
- raise "required instance_id" unless form['instance_id']
153
- raise "required machine_resource_id" unless form['machine_resource_id']
154
- unless form['tag']
155
- form['tag'] = ""
156
- end
157
277
 
158
- begin
159
- arr = [{'instance_id'=>form['instance_id'],'machine_resource_id'=>form['machine_resource_id']}]
160
- j = JSON.load(_post('/console/servers/force_terminate',{'instances'=>arr.to_json}).body)
161
- rescue
162
- relogin
163
- return terminate(form)
164
- end
165
- return j
166
- end
167
-
168
- end
169
-
170
- def self.new
278
+
279
+ def self.new #@
171
280
  return APIv1.new
172
281
  end
173
282
 
174
283
  end
284
+
285
+ if __FILE__ == $0
286
+ def test
287
+ g = GPUEater.new
288
+ g.test
289
+ end
290
+ def gen
291
+ ret = []
292
+ ret2 = []
293
+ st = open(__FILE__).read
294
+ flg = false
295
+ st.split("\n").each{|e|
296
+ unless flg
297
+ if e.include? "def "
298
+ if e.include? "#@"
299
+ name = e.split("def ")[1].split("#")[0].split("(")[0].strip
300
+ name = name.gsub("self.","")
301
+ name = name.split(";")[0]
302
+ ret += ["# " + name]
303
+ end
304
+ end
305
+ ret2 += [e]
306
+ #puts e
307
+ if e == "##@@ GEN @@##"
308
+ flg = true
309
+ end
310
+ end
311
+ }
312
+
313
+ st2 = ret2.join("\n")
314
+ fp = open(__FILE__,"w")
315
+ fp.write(st2)
316
+ fp.write("\n")
317
+ fp.write(ret.join("\n"))
318
+ fp.close
319
+ end
320
+ end
321
+
322
+
323
+ ##@@ GEN @@##
324
+ # ___________image___________
325
+ # image_list
326
+ # snapshot_instance
327
+ # delete_snapshot
328
+ # create_image
329
+ # register_image
330
+ # delete_image
331
+ # ___________ssh_key___________
332
+ # ssh_key_list
333
+ # generate_ssh_key
334
+ # register_ssh_key
335
+ # delete_ssh_key
336
+ # ___________instance___________
337
+ # ondemand_list
338
+ # subscription_list
339
+ # launch_ondemand_instance
340
+ # launch_subcription_instance
341
+ # instance_list
342
+ # change_instance_tag
343
+ # start_instance
344
+ # stop_instance
345
+ # restart_instance
346
+ # terminate_instance
347
+ # emergency_restart_instance
348
+ # __________network__________
349
+ # port_list
350
+ # open_port
351
+ # close_port
352
+ # renew_ipv4
353
+ # refresh_ipv4
354
+ # network_description
355
+ # __________storage__________
356
+ # create_volume
357
+ # delete_volume
358
+ # transfer_volume
359
+ # _________subscription__________
360
+ # subscribe_instance_list
361
+ # subscribe_storage_list
362
+ # subscribe_network_list
363
+ # subscribe_instance
364
+ # unsubscribe_instance
365
+ # subscription_instance_list
366
+ # subscribe_instance
367
+ # unsubscribe_instance
368
+ # subscribe_storage
369
+ # unsubscribe_storage
370
+ # subscribe_network
371
+ # unsubscribe_network
372
+ # _________special__________
373
+ # live_migration
374
+ # cancel_transaction
375
+ # _________payment__________
376
+ # invoice_list
377
+ # subscription_invoice_list
378
+ # make_invoice
379
+ # _________extensions__________
380
+ # copy_file
381
+ # delete_file
382
+ # move_file
383
+ # make_directory
384
+ # file_list
385
+ # synchronize_files
386
+ # login_instance
387
+ # tunnel
388
+ # __________________________
389
+ # new
data/release.sh ADDED
@@ -0,0 +1,2 @@
1
+ bundle exec rake build
2
+ bundle exec rake release
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpueater
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pegara, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-07-07 00:00:00.000000000 Z
11
+ date: 2018-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,6 +87,7 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
+ - ".gitignore"
90
91
  - CODE_OF_CONDUCT.md
91
92
  - Gemfile
92
93
  - Gemfile.lock
@@ -98,6 +99,7 @@ files:
98
99
  - gpueater.gemspec
99
100
  - lib/gpueater.rb
100
101
  - lib/gpueater/version.rb
102
+ - release.sh
101
103
  homepage: https://www.gpueater.com/
102
104
  licenses:
103
105
  - MIT
@@ -118,8 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
120
  version: '0'
119
121
  requirements: []
120
122
  rubyforge_project:
121
- rubygems_version: 2.5.2
123
+ rubygems_version: 2.5.2.3
122
124
  signing_key:
123
125
  specification_version: 4
124
- summary: GPUEater Console API
126
+ summary: GPUEater API Console
125
127
  test_files: []