fog-oraclecloud 0.1.1

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.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +21 -0
  5. data/README.md +34 -0
  6. data/Rakefile +2 -0
  7. data/bin/console +14 -0
  8. data/bin/setup +8 -0
  9. data/fog-oracle.gemspec +30 -0
  10. data/lib/fog/oraclecloud/compute.rb +146 -0
  11. data/lib/fog/oraclecloud/database.rb +114 -0
  12. data/lib/fog/oraclecloud/java.rb +114 -0
  13. data/lib/fog/oraclecloud/models/compute/image.rb +43 -0
  14. data/lib/fog/oraclecloud/models/compute/image_list.rb +42 -0
  15. data/lib/fog/oraclecloud/models/compute/image_lists.rb +22 -0
  16. data/lib/fog/oraclecloud/models/compute/images.rb +22 -0
  17. data/lib/fog/oraclecloud/models/compute/instance.rb +65 -0
  18. data/lib/fog/oraclecloud/models/compute/instances.rb +22 -0
  19. data/lib/fog/oraclecloud/models/compute/object_plan.rb +16 -0
  20. data/lib/fog/oraclecloud/models/compute/object_plans.rb +12 -0
  21. data/lib/fog/oraclecloud/models/compute/orchestration.rb +89 -0
  22. data/lib/fog/oraclecloud/models/compute/orchestrations.rb +20 -0
  23. data/lib/fog/oraclecloud/models/compute/security_application.rb +42 -0
  24. data/lib/fog/oraclecloud/models/compute/security_applications.rb +22 -0
  25. data/lib/fog/oraclecloud/models/compute/security_list.rb +26 -0
  26. data/lib/fog/oraclecloud/models/compute/security_lists.rb +22 -0
  27. data/lib/fog/oraclecloud/models/compute/security_rule.rb +41 -0
  28. data/lib/fog/oraclecloud/models/compute/security_rules.rb +22 -0
  29. data/lib/fog/oraclecloud/models/compute/ssh_key.rb +37 -0
  30. data/lib/fog/oraclecloud/models/compute/ssh_keys.rb +22 -0
  31. data/lib/fog/oraclecloud/models/compute/volume.rb +47 -0
  32. data/lib/fog/oraclecloud/models/compute/volumes.rb +20 -0
  33. data/lib/fog/oraclecloud/models/database/instance.rb +84 -0
  34. data/lib/fog/oraclecloud/models/database/instances.rb +26 -0
  35. data/lib/fog/oraclecloud/models/java/instance.rb +107 -0
  36. data/lib/fog/oraclecloud/models/java/instances.rb +27 -0
  37. data/lib/fog/oraclecloud/models/java/server.rb +26 -0
  38. data/lib/fog/oraclecloud/models/java/servers.rb +17 -0
  39. data/lib/fog/oraclecloud/models/soa/instance.rb +65 -0
  40. data/lib/fog/oraclecloud/models/soa/instances.rb +25 -0
  41. data/lib/fog/oraclecloud/models/storage/container.rb +34 -0
  42. data/lib/fog/oraclecloud/models/storage/containers.rb +24 -0
  43. data/lib/fog/oraclecloud/models/storage/object.rb +27 -0
  44. data/lib/fog/oraclecloud/models/storage/objects.rb +27 -0
  45. data/lib/fog/oraclecloud/requests/compute/create_image.rb +30 -0
  46. data/lib/fog/oraclecloud/requests/compute/create_image_list.rb +27 -0
  47. data/lib/fog/oraclecloud/requests/compute/create_instance.rb +32 -0
  48. data/lib/fog/oraclecloud/requests/compute/create_orchestration.rb +46 -0
  49. data/lib/fog/oraclecloud/requests/compute/create_security_application.rb +28 -0
  50. data/lib/fog/oraclecloud/requests/compute/create_security_rule.rb +29 -0
  51. data/lib/fog/oraclecloud/requests/compute/create_ssh_key.rb +27 -0
  52. data/lib/fog/oraclecloud/requests/compute/create_volume.rb +29 -0
  53. data/lib/fog/oraclecloud/requests/compute/delete_image.rb +19 -0
  54. data/lib/fog/oraclecloud/requests/compute/delete_image_list.rb +19 -0
  55. data/lib/fog/oraclecloud/requests/compute/delete_instance.rb +22 -0
  56. data/lib/fog/oraclecloud/requests/compute/delete_orchestration.rb +22 -0
  57. data/lib/fog/oraclecloud/requests/compute/delete_security_application.rb +20 -0
  58. data/lib/fog/oraclecloud/requests/compute/delete_security_rule.rb +20 -0
  59. data/lib/fog/oraclecloud/requests/compute/delete_ssh_key.rb +22 -0
  60. data/lib/fog/oraclecloud/requests/compute/get_image.rb +21 -0
  61. data/lib/fog/oraclecloud/requests/compute/get_image_list.rb +21 -0
  62. data/lib/fog/oraclecloud/requests/compute/get_instance.rb +24 -0
  63. data/lib/fog/oraclecloud/requests/compute/get_orchestration.rb +24 -0
  64. data/lib/fog/oraclecloud/requests/compute/get_security_application.rb +20 -0
  65. data/lib/fog/oraclecloud/requests/compute/get_security_rule.rb +20 -0
  66. data/lib/fog/oraclecloud/requests/compute/get_ssh_key.rb +24 -0
  67. data/lib/fog/oraclecloud/requests/compute/list_image_lists.rb +16 -0
  68. data/lib/fog/oraclecloud/requests/compute/list_images.rb +16 -0
  69. data/lib/fog/oraclecloud/requests/compute/list_instances.rb +16 -0
  70. data/lib/fog/oraclecloud/requests/compute/list_orchestrations.rb +16 -0
  71. data/lib/fog/oraclecloud/requests/compute/list_security_applications.rb +21 -0
  72. data/lib/fog/oraclecloud/requests/compute/list_security_lists.rb +16 -0
  73. data/lib/fog/oraclecloud/requests/compute/list_security_rules.rb +21 -0
  74. data/lib/fog/oraclecloud/requests/compute/list_ssh_keys.rb +16 -0
  75. data/lib/fog/oraclecloud/requests/compute/list_volumes.rb +16 -0
  76. data/lib/fog/oraclecloud/requests/compute/start_orchestration.rb +22 -0
  77. data/lib/fog/oraclecloud/requests/compute/stop_orchestration.rb +22 -0
  78. data/lib/fog/oraclecloud/requests/compute/update_image.rb +27 -0
  79. data/lib/fog/oraclecloud/requests/compute/update_image_list.rb +27 -0
  80. data/lib/fog/oraclecloud/requests/compute/update_orchestration.rb +49 -0
  81. data/lib/fog/oraclecloud/requests/compute/update_ssh_key.rb +29 -0
  82. data/lib/fog/oraclecloud/requests/database/create_instance.rb +46 -0
  83. data/lib/fog/oraclecloud/requests/database/delete_instance.rb +31 -0
  84. data/lib/fog/oraclecloud/requests/database/get_instance.rb +36 -0
  85. data/lib/fog/oraclecloud/requests/database/list_instances.rb +16 -0
  86. data/lib/fog/oraclecloud/requests/java/create_instance.rb +51 -0
  87. data/lib/fog/oraclecloud/requests/java/delete_instance.rb +42 -0
  88. data/lib/fog/oraclecloud/requests/java/get_instance.rb +37 -0
  89. data/lib/fog/oraclecloud/requests/java/get_server.rb +0 -0
  90. data/lib/fog/oraclecloud/requests/java/list_instances.rb +16 -0
  91. data/lib/fog/oraclecloud/requests/java/list_servers.rb +29 -0
  92. data/lib/fog/oraclecloud/requests/soa/create_instance.rb +47 -0
  93. data/lib/fog/oraclecloud/requests/soa/delete_instance.rb +40 -0
  94. data/lib/fog/oraclecloud/requests/soa/get_instance.rb +36 -0
  95. data/lib/fog/oraclecloud/requests/soa/list_instances.rb +16 -0
  96. data/lib/fog/oraclecloud/requests/storage/create_container.rb +21 -0
  97. data/lib/fog/oraclecloud/requests/storage/delete_container.rb +15 -0
  98. data/lib/fog/oraclecloud/requests/storage/get_container.rb +24 -0
  99. data/lib/fog/oraclecloud/requests/storage/list_containers.rb +16 -0
  100. data/lib/fog/oraclecloud/soa.rb +80 -0
  101. data/lib/fog/oraclecloud/storage.rb +80 -0
  102. data/lib/fog/oraclecloud/version.rb +5 -0
  103. data/lib/fog/oraclecloud.rb +29 -0
  104. data/tests/helper.rb +1 -0
  105. data/tests/requests/database_tests.rb +52 -0
  106. data/tests/requests/instance_tests.rb +54 -0
  107. data/tests/requests/java_tests.rb +52 -0
  108. data/tests/requests/orchestrations_tests.rb +86 -0
  109. data/tests/requests/soa_tests.rb +52 -0
  110. data/tests/requests/ssh_keys_tests.rb +49 -0
  111. data/tests/requests/storage_tests.rb +54 -0
  112. metadata +253 -0
@@ -0,0 +1,107 @@
1
+ require 'fog/core/model'
2
+
3
+ module Fog
4
+ module OracleCloud
5
+ class Java
6
+ class Instance < Fog::Model
7
+ identity :service_name, :aliases=>'name'
8
+
9
+
10
+ attribute :created_by
11
+
12
+ attribute :auto_update
13
+ attribute :cluster_name
14
+ attribute :compliance_status
15
+ attribute :compliance_status_desc
16
+ attribute :compute_site_name
17
+ attribute :content_url
18
+ attribute :creation_job_id
19
+ attribute :creation_time
20
+ attribute :db_associations
21
+ attribute :db_info
22
+ attribute :db_servicename
23
+ attribute :deletion_job_id
24
+ attribute :description
25
+ attribute :domain_mode
26
+ attribute :edition
27
+ attribute :error_status_desc
28
+ attribute :fmw_control_url
29
+ attribute :last_modified_time
30
+ attribute :level
31
+ attribute :lifecycle_control_job_id
32
+ attribute :num_ip_reservations
33
+ attribute :num_nodes
34
+ attribute :options
35
+ attribute :otd_admin_url
36
+ attribute :otd_provisioned
37
+ attribute :otd_shape
38
+ attribute :otd_strorage_size
39
+ attribute :psm_plugin_version
40
+ attribute :sample_app_url
41
+ attribute :secure_content_url
42
+ attribute :service_components
43
+ attribute :service_type
44
+ attribute :service_uri
45
+ attribute :shape
46
+ attribute :status
47
+ attribute :subscription_type
48
+ attribute :uri
49
+ attribute :version
50
+ attribute :wls_admin_url
51
+ attribute :wls_deployment_channel_port
52
+ attribute :wls_version, :aliases=>'wlsVersion'
53
+
54
+
55
+ # The following are only used to create an instance and are not returned in the list action
56
+ attribute :cloud_storage_container, :aliases=>'cloudStorageContainer'
57
+ attribute :cloud_storage_user, :aliases=>'cloudStorageUser'
58
+ attribute :cloud_storage_password, :aliases=>'cloudStoragePassword'
59
+ attribute :admin_user_name, :aliases=>'adminUserName'
60
+
61
+ # The following are used to delete an instance and are not returned in the list action
62
+ attribute :dba_name
63
+ attribute :dba_password
64
+ attribute :force_delete
65
+
66
+ def initialize(attributes={})
67
+ level ||= 'PAAS'
68
+ subscription_type ||= 'HOURLY'
69
+ edition ||= 'EE'
70
+
71
+ super
72
+ end
73
+
74
+ def save
75
+ #identity ? update : create
76
+ create
77
+ end
78
+
79
+ def ready?
80
+ status == "Running"
81
+ end
82
+
83
+ def servers
84
+ service.servers.all(service_name)
85
+ end
86
+
87
+ def destroy
88
+ requires :service_name, :dba_name, :dba_password
89
+ service.delete_instance(service_name, dba_name, dba_password, :force_delete => force_delete).body
90
+ end
91
+
92
+ private
93
+
94
+ def create
95
+ requires :service_name, :cloudStorageContainer, :cloudStorageUser, :cloudStoragePassword, :parameters
96
+
97
+ data = service.create_instance(service_name, cloudStorageContainer, cloudStorageUser, cloudStoragePassword, parameters,
98
+ :level => level,
99
+ :subscriptionType => subscriptionType,
100
+ :description => description)
101
+
102
+ end
103
+
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,27 @@
1
+ require 'fog/core/collection'
2
+
3
+ module Fog
4
+ module OracleCloud
5
+ class Java
6
+ class Instances < Fog::Collection
7
+
8
+ model Fog::OracleCloud::Java::Instance
9
+
10
+ def all
11
+ data = service.list_instances().body['services']
12
+ load(data)
13
+ end
14
+
15
+ def get(service_name)
16
+ begin
17
+ new(service.get_instance(service_name).body)
18
+ rescue Fog::OracleCloud::Java::NotFound
19
+ nil
20
+ end
21
+ end
22
+
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ require 'fog/compute/models/server'
2
+
3
+ module Fog
4
+ module OracleCloud
5
+ class Java
6
+ class Server < Fog::Model
7
+ identity :name
8
+
9
+ attribute :clusterName
10
+ attribute :name
11
+ attribute :shape
12
+ attribute :nodeType
13
+ attribute :isAdmin
14
+ attribute :hostname
15
+ attribute :status
16
+ attribute :reservedIp
17
+ attribute :storageAllocated
18
+ attribute :creationDate
19
+
20
+ def ip_addr
21
+ reservedIp.blank? ? hostname : reservedIp
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,17 @@
1
+ require 'fog/core/collection'
2
+
3
+ module Fog
4
+ module OracleCloud
5
+ class Java
6
+ class Servers < Fog::Collection
7
+
8
+ model Fog::OracleCloud::Java::Server
9
+
10
+ def all(service_name)
11
+ data = service.list_servers(service_name).body['servers']
12
+ load(data)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,65 @@
1
+ require 'fog/core/model'
2
+
3
+ module Fog
4
+ module OracleCloud
5
+ class SOA
6
+ class Instance < Fog::Model
7
+ identity :service_name
8
+
9
+ attribute :service_name
10
+ attribute :service_type
11
+ attribute :resource_count
12
+ attribute :status
13
+ attribute :description
14
+ attribute :identity_domain
15
+ attribute :creation_job_id
16
+ attribute :creation_time
17
+ attribute :last_modified_time
18
+ attribute :created_by
19
+ attribute :service_uri
20
+ attribute :provisioning_progress
21
+
22
+ # The following are only used to create an instance and are not returned in the list action
23
+ attribute :cloudStorageContainer
24
+ attribute :cloudStorageUser
25
+ attribute :cloudStoragePassword
26
+ attribute :level
27
+ attribute :subscriptionType
28
+ attribute :topology
29
+ attribute :parameters
30
+
31
+ # The following are used to delete an instance and are not returned in the list action
32
+ attribute :dba_name
33
+ attribute :dba_password
34
+ attribute :force_delete
35
+ attribute :skip_backup
36
+
37
+ def save
38
+ #identity ? update : create
39
+ create
40
+ end
41
+
42
+ def ready?
43
+ status == "Running"
44
+ end
45
+
46
+ def destroy
47
+ requires :service_name, :dba_name, :dba_password
48
+ service.delete_instance(service_name, dba_name, dba_password,
49
+ :force_delete => force_delete,
50
+ :skip_backup => skip_backup).body
51
+ end
52
+
53
+ private
54
+
55
+ def create
56
+ requires :service_name, :topology, :cloudStorageContainer, :cloudStorageUser, :cloudStoragePassword, :parameters
57
+ data = service.create_instance(service_name, topology, cloudStorageContainer, cloudStorageUser, cloudStoragePassword, parameters,
58
+ :level => level,
59
+ :subscriptionType => subscriptionType,
60
+ :description => description)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,25 @@
1
+ require 'fog/core/collection'
2
+
3
+ module Fog
4
+ module OracleCloud
5
+ class SOA
6
+ class Instances < Fog::Collection
7
+
8
+ model Fog::OracleCloud::SOA::Instance
9
+
10
+ def all
11
+ data = service.list_instances().body['services']
12
+ load(data)
13
+ end
14
+
15
+ def get(id)
16
+ begin
17
+ new(service.get_instance(id).body)
18
+ rescue Fog::OracleCloud::SOA::NotFound
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ module Fog
2
+ module Storage
3
+ class OracleCloud
4
+ class Container < Fog::Model
5
+ identity :name
6
+
7
+ attribute :count, :aliases => 'X-Container-Object-Count'
8
+ attribute :bytes, :aliases => 'X-Container-Bytes-Used'
9
+ attribute :deleteTimestamp
10
+ attribute :containerId
11
+ attribute :read_acl, :aliases => 'X-Container-Read'
12
+ attribute :write_acl, :aliases => 'X-Container-Write'
13
+ attribute :createdTimestamp, :aliases => 'X-Timestamp'
14
+
15
+ def objects
16
+ @objects ||= Fog::Storage::OracleCloud::Objects.new(:container=>self, :service=>service)
17
+ end
18
+
19
+ def save
20
+ requires :name
21
+ data = service.create_container(name)
22
+ pp data
23
+ merge_attributes(data.headers)
24
+ end
25
+
26
+ def destroy
27
+ requires :name
28
+ service.delete_container(name)
29
+ end
30
+
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,24 @@
1
+ module Fog
2
+ module Storage
3
+ class OracleCloud
4
+ class Containers < Fog::Collection
5
+
6
+ model Fog::Storage::OracleCloud::Container
7
+
8
+ def all
9
+ containers = service.list_containers().body
10
+ load(containers)
11
+ end
12
+
13
+ def get(name)
14
+ data = service.get_container(name).headers
15
+ # The storage cloud service doesn't actually return the name. Add it back in
16
+ data['name'] = name
17
+ new(data)
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Storage
3
+ class OracleCloud
4
+ class Object < Fog::Model
5
+ identity :name
6
+
7
+ attribute :content_type
8
+ attribute :bytes
9
+ attribute :last_modified
10
+ attribute :hash
11
+
12
+ def save
13
+ requires :name
14
+ # data = service.create_container(name)
15
+ # pp data
16
+ # merge_attributes(data.headers)
17
+ end
18
+
19
+ def destroy
20
+ requires :name
21
+ # service.delete_container(name)
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Storage
3
+ class OracleCloud
4
+ class Objects < Fog::Collection
5
+
6
+ attribute :container
7
+
8
+ model Fog::Storage::OracleCloud::Object
9
+
10
+ def all
11
+ requires :container
12
+ objects = service.get_container_with_objects(container.name)
13
+ load(objects.body)
14
+ end
15
+
16
+ def get(name)
17
+ data = service.get_container(name).headers
18
+ # The storage cloud service doesn't actually return the name. Add it back in
19
+ data['name'] = name
20
+ new(data)
21
+ end
22
+
23
+ end
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,30 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def create_image (account, name, no_upload, file, sizes)
6
+ # Just in case it's already set
7
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
8
+ body_data = {
9
+ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
10
+ 'account' => account,
11
+ 'no_upload' => no_upload,
12
+ 'file' => file,
13
+ 'sizes' => sizes
14
+ }
15
+ body_data = body_data.reject {|key, value| value.nil?}
16
+
17
+ request(
18
+ :method => 'POST',
19
+ :expects => 201,
20
+ :path => "/imagelist/Compute-#{@identity_domain}/#{@username}/#{name}",
21
+ :body => Fog::JSON.encode(body_data),
22
+ :headers => {
23
+ 'Content-Type' => 'application/oracle-compute-v3+json'
24
+ }
25
+ )
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def create_image_list (name, description, options={})
6
+ # Just in case it's already set
7
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
8
+ body_data = {
9
+ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
10
+ 'description' => description,
11
+ 'default' => options[:default]
12
+ }
13
+ body_data = body_data.reject {|key, value| value.nil?}
14
+ request(
15
+ :method => 'POST',
16
+ :expects => 201,
17
+ :path => "/imagelist/Compute-#{@identity_domain}/#{@username}/",
18
+ :body => Fog::JSON.encode(body_data),
19
+ :headers => {
20
+ 'Content-Type' => 'application/oracle-compute-v3+json'
21
+ }
22
+ )
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,32 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def create_instance (name, shape, imagelist, label, sshkeys)
6
+ # This will create an instance using a Launchplan. Consider using an orchestration plan for more control
7
+ # Just in case it's already set
8
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
9
+ body_data = {
10
+ 'instances' => [{
11
+ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
12
+ 'shape' => shape,
13
+ 'imagelist' => imagelist,
14
+ 'label' => label,
15
+ 'sshkeys' => sshkeys
16
+ }]
17
+ }
18
+ body_data = body_data.reject {|key, value| value.nil?}
19
+ request(
20
+ :method => 'POST',
21
+ :expects => 201,
22
+ :path => "/launchplan/",
23
+ :body => Fog::JSON.encode(body_data),
24
+ :headers => {
25
+ 'Content-Type' => 'application/oracle-compute-v3+json'
26
+ }
27
+ )
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,46 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def create_orchestration (name, oplans, options={})
6
+
7
+ # Clean up names in case they haven't provided the fully resolved names
8
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
9
+ oplans.map do |oplan|
10
+ oplan['objects'].map do |object|
11
+ if oplan['obj_type'] == 'launchplan' then
12
+ object['instances'].map do |instance|
13
+ if !instance['name'].start_with?("/Compute-") then
14
+ instance['name'] = "/Compute-#{@identity_domain}/#{@username}/#{instance['name']}"
15
+ end
16
+ end
17
+ else
18
+ if !object['name'].start_with?("/Compute-") then
19
+ object['name'] = "/Compute-#{@identity_domain}/#{@username}/#{object['name']}"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ body_data = {
25
+ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
26
+ 'oplans' => oplans,
27
+ 'relationships' => options[:relationships],
28
+ 'description' => options[:description],
29
+ 'account' => options[:account],
30
+ 'schedule' => options[:schedule]
31
+ }
32
+ body_data = body_data.reject {|key, value| value.nil?}
33
+ request(
34
+ :method => 'POST',
35
+ :expects => 201,
36
+ :path => "/orchestration/",
37
+ :body => Fog::JSON.encode(body_data),
38
+ :headers => {
39
+ 'Content-Type' => 'application/oracle-compute-v3+json'
40
+ }
41
+ )
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,28 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def create_security_application(name, protocol, options={})
6
+ body_data = {
7
+ 'name' => name,
8
+ 'protocol' => protocol,
9
+ 'dport' => options[:dport],
10
+ 'icmptype' => options[:icmptype],
11
+ 'icmpcode' => options[:icmpcode],
12
+ 'description' => options[:description]
13
+ }
14
+ body_data = body_data.reject {|key, value| value.nil?}
15
+ request(
16
+ :method => 'POST',
17
+ :expects => 201,
18
+ :path => "/secapplication/",
19
+ :body => Fog::JSON.encode(body_data),
20
+ :headers => {
21
+ 'Content-Type' => 'application/oracle-compute-v3+json'
22
+ }
23
+ )
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,29 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def create_security_rule(name, src_list, dst_list, application, action, options={})
6
+ body_data = {
7
+ 'name' => name,
8
+ 'src_list' => src_list,
9
+ 'dst_list' => dst_list,
10
+ 'application' => application,
11
+ 'action' => action,
12
+ 'description' => options[:description],
13
+ 'disabled' => options[:disabled]
14
+ }
15
+ body_data = body_data.reject {|key, value| value.nil?}
16
+ request(
17
+ :method => 'POST',
18
+ :expects => 201,
19
+ :path => "/secrule/",
20
+ :body => Fog::JSON.encode(body_data),
21
+ :headers => {
22
+ 'Content-Type' => 'application/oracle-compute-v3+json'
23
+ }
24
+ )
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def create_ssh_key (name, enabled, key)
6
+ # Just in case it's already set
7
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
8
+ body_data = {
9
+ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
10
+ 'enabled' => enabled,
11
+ 'key' => key
12
+ }
13
+ body_data = body_data.reject {|key, value| value.nil?}
14
+ request(
15
+ :method => 'POST',
16
+ :expects => 201,
17
+ :path => "/sshkey/",
18
+ :body => Fog::JSON.encode(body_data),
19
+ :headers => {
20
+ 'Content-Type' => 'application/oracle-compute-v3+json'
21
+ }
22
+ )
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def create_volume(name, size, high_latency = false, options={})
6
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", '' # Just in case it's already set
7
+ body_data = {
8
+ 'name' => "/Compute-#{@identity_domain}/#{@username}/#{name}",
9
+ 'size' => size,
10
+ 'properties' => []
11
+ }
12
+ body_data['properties'].push(high_latency ? "/oracle/public/storage/latency" : '/oracle/public/storage/default')
13
+ body_data = body_data.reject {|key, value| value.nil?}
14
+
15
+ request(
16
+ :method => 'POST',
17
+ :expects => 201,
18
+ :path => "/storage/volume/",
19
+ :body => Fog::JSON.encode(body_data),
20
+ :headers => {
21
+ 'Content-Type' => 'application/oracle-compute-v3+json'
22
+ }
23
+ )
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def delete_image (name, version)
6
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
7
+ request(
8
+ :method => 'DELETE',
9
+ :expects => 204,
10
+ :path => "/imagelist/Compute-#{@identity_domain}/#{@username}/#{name}/entry/#{version}",
11
+ :headers => {
12
+ 'Content-Type' => 'application/oracle-compute-v3+json'
13
+ }
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Compute
3
+ class OracleCloud
4
+ class Real
5
+ def delete_image_list (name)
6
+ name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
7
+ request(
8
+ :method => 'DELETE',
9
+ :expects => 204,
10
+ :path => "/imagelist/Compute-#{@identity_domain}/#{@username}/#{name}",
11
+ :headers => {
12
+ 'Content-Type' => 'application/oracle-compute-v3+json'
13
+ }
14
+ )
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end