secured_cloud_api_client 0.0.6 → 0.0.7
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,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bf4654378de049601f6a9c21e33b73209822933
|
4
|
+
data.tar.gz: c08d66fbe94e1cd8559b6d390b076e56175503ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a50d6ba5aba45d8bb8de5eaceabe6833d45bec71154734a9b1b47e55190b6894637a71503db3b7fd09f7048f1c8e38f16b40ea25c65621772b7ba3b87d4ff9ba
|
7
|
+
data.tar.gz: 7e6384a6cfe6825c3a2a21c3ec542ef9d6c58fac03267865231f23fe6795295debe5c931b96fcd1e499fb3d5934ad1c229c372ec063b65471f804d4fb708242b
|
@@ -38,6 +38,30 @@ class HttpClient
|
|
38
38
|
|
39
39
|
errorMsg = ""
|
40
40
|
|
41
|
+
httpStatusDesc = ""
|
42
|
+
|
43
|
+
#Add description of HTTP error code
|
44
|
+
if (response.code == "400") then
|
45
|
+
httpStatusDesc = "Bad Request"
|
46
|
+
|
47
|
+
elsif (response.code == "403") then
|
48
|
+
httpStatusDesc = "Forbidden"
|
49
|
+
|
50
|
+
elsif (response.code == "404") then
|
51
|
+
httpStatusDesc = "Resource Not Found"
|
52
|
+
|
53
|
+
elsif (response.code == "405") then
|
54
|
+
httpStatusDesc = "Method Not Allowed"
|
55
|
+
|
56
|
+
elsif (response.code == "405") then
|
57
|
+
httpStatusDesc = "Too Many Requests"
|
58
|
+
|
59
|
+
elsif (response.code == "500") then
|
60
|
+
httpStatusDesc = "Internal Error"
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
#Add error message from SecuredCloud API if there is any
|
41
65
|
if ((response['X-Application-Error-Reference'] != nil) && (response['X-Application-Error-Reference'] != "")) then
|
42
66
|
errorMsg = response['X-Application-Error-Reference']
|
43
67
|
end
|
@@ -45,10 +69,11 @@ class HttpClient
|
|
45
69
|
errorMsg = response['X-Application-Error-Description']
|
46
70
|
end
|
47
71
|
|
72
|
+
#Build final error message to be sent to user.
|
48
73
|
if (errorMsg == "") then
|
49
|
-
errorMsg = "Error " + response.code.to_str() + " " + response.body()
|
74
|
+
errorMsg = "Error " + response.code.to_str() + " (" + httpStatusDesc + ") " + response.body()
|
50
75
|
else
|
51
|
-
errorMsg = "Error " + response.code.to_str() +
|
76
|
+
errorMsg = "Error " + response.code.to_str() + " (" + httpStatusDesc + ") " + errorMsg
|
52
77
|
end
|
53
78
|
|
54
79
|
raise errorMsg
|
@@ -18,6 +18,16 @@ class TaskStatus
|
|
18
18
|
@processDescription = processDescription
|
19
19
|
@createdTimestamp = createdTimestamp
|
20
20
|
@lastUpdatedTimeStamp = lastUpdatedTimeStamp
|
21
|
+
|
22
|
+
#Handle bum messages
|
23
|
+
if (@errorMessage == "DC VCPU Allocation not defined for VDC: %s") then
|
24
|
+
@errorMessage = "VCPU Allocation not defined for this node"
|
25
|
+
elsif (@errorMessage == "VDC Memory Allocation not defined for VDC: %s") then
|
26
|
+
@errorMessage = "Memory Allocation not defined for this node"
|
27
|
+
elsif (@errorMessage == "VDC Storage Allocation not defined for VDC: %s") then
|
28
|
+
@errorMessage = "Storage Allocation not defined for this node"
|
29
|
+
end
|
30
|
+
|
21
31
|
end
|
22
32
|
|
23
33
|
|
@@ -461,14 +461,14 @@ class SecuredCloudRestClient
|
|
461
461
|
if (name == nil) then
|
462
462
|
name = 'null'
|
463
463
|
else
|
464
|
-
raise ArgumentError, 'name needs to be a valid string' unless name.respond_to?(:to_str)
|
464
|
+
raise ArgumentError, 'Config error: name needs to be a valid string' unless name.respond_to?(:to_str)
|
465
465
|
name = '"' + name + '"'
|
466
466
|
end
|
467
467
|
|
468
468
|
if (description == nil) then
|
469
469
|
description = 'null'
|
470
470
|
else
|
471
|
-
raise ArgumentError, 'description needs to be a valid string' unless description.respond_to?(:to_str)
|
471
|
+
raise ArgumentError, 'Config error: description needs to be a valid string' unless description.respond_to?(:to_str)
|
472
472
|
description = '"' + description + '"'
|
473
473
|
end
|
474
474
|
|
@@ -477,46 +477,46 @@ class SecuredCloudRestClient
|
|
477
477
|
if (storageGB == nil) then
|
478
478
|
storageGB = 'null'
|
479
479
|
else
|
480
|
-
raise ArgumentError, 'storageGB needs to be a valid number' unless storageGB.is_a? Numeric
|
480
|
+
raise ArgumentError, 'Config error: storageGB needs to be a valid number' unless storageGB.is_a? Numeric
|
481
481
|
end
|
482
482
|
|
483
483
|
if (memoryMB == nil) then
|
484
484
|
memoryMB = 'null'
|
485
485
|
else
|
486
|
-
raise ArgumentError, 'memoryMB needs to be a valid number' unless memoryMB.is_a? Numeric
|
486
|
+
raise ArgumentError, 'Config error: memoryMB needs to be a valid number' unless memoryMB.is_a? Numeric
|
487
487
|
end
|
488
488
|
|
489
489
|
if (vCPUCount == nil) then
|
490
490
|
vCPUCount = 'null'
|
491
491
|
else
|
492
|
-
raise ArgumentError, 'vCPUCount needs to be a valid number' unless vCPUCount.is_a? Numeric
|
492
|
+
raise ArgumentError, 'Config error: vCPUCount needs to be a valid number' unless vCPUCount.is_a? Numeric
|
493
493
|
end
|
494
494
|
|
495
495
|
if (powerStatus == nil) then
|
496
496
|
powerStatus = 'null'
|
497
497
|
else
|
498
|
-
raise ArgumentError, 'powerStatus needs to be a valid string' unless powerStatus.respond_to?(:to_str)
|
498
|
+
raise ArgumentError, 'Config error: powerStatus needs to be a valid string' unless powerStatus.respond_to?(:to_str)
|
499
499
|
powerStatus = '"' + powerStatus + '"'
|
500
500
|
end
|
501
501
|
|
502
502
|
if (imageResource == nil) then
|
503
503
|
imageResource = 'null'
|
504
504
|
else
|
505
|
-
raise ArgumentError, 'imageResource needs to be a valid string' unless imageResource.respond_to?(:to_str)
|
505
|
+
raise ArgumentError, 'Config error: imageResource needs to be a valid string' unless imageResource.respond_to?(:to_str)
|
506
506
|
imageResource = '{"resourceURL":"' + imageResource + '"}'
|
507
507
|
end
|
508
508
|
|
509
509
|
if (osTemplateResource == nil) then
|
510
510
|
osTemplateResource = 'null'
|
511
511
|
else
|
512
|
-
raise ArgumentError, 'osTemplateResource needs to be a valid string' unless osTemplateResource.respond_to?(:to_str)
|
512
|
+
raise ArgumentError, 'Config error: osTemplateResource needs to be a valid string' unless osTemplateResource.respond_to?(:to_str)
|
513
513
|
osTemplateResource = '{"resourceURL":"' + osTemplateResource + '"}'
|
514
514
|
end
|
515
515
|
|
516
516
|
if (osPassword == nil) then
|
517
517
|
osPassword = 'null'
|
518
518
|
else
|
519
|
-
raise ArgumentError, 'osPassword needs to be a valid string' unless osPassword.respond_to?(:to_str)
|
519
|
+
raise ArgumentError, 'Config error: osPassword needs to be a valid string' unless osPassword.respond_to?(:to_str)
|
520
520
|
osPassword = '"' + osPassword + '"'
|
521
521
|
end
|
522
522
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: secured_cloud_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alan Vella
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A simple API client for the Secured Cloud
|
14
14
|
email: alanv@ccbilleu.com
|