fog-oraclecloud 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +12 -10
- data/Gemfile +4 -4
- data/LICENSE +20 -20
- data/README.md +153 -153
- data/Rakefile +2 -2
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/fog-oracle.gemspec +32 -31
- data/lib/fog/oraclecloud.rb +29 -29
- data/lib/fog/oraclecloud/compute.rb +184 -184
- data/lib/fog/oraclecloud/database.rb +129 -129
- data/lib/fog/oraclecloud/java.rb +123 -115
- data/lib/fog/oraclecloud/models/compute/image.rb +43 -43
- data/lib/fog/oraclecloud/models/compute/image_list.rb +39 -39
- data/lib/fog/oraclecloud/models/compute/image_lists.rb +22 -22
- data/lib/fog/oraclecloud/models/compute/images.rb +22 -22
- data/lib/fog/oraclecloud/models/compute/instance.rb +74 -69
- data/lib/fog/oraclecloud/models/compute/instances.rb +22 -22
- data/lib/fog/oraclecloud/models/compute/object_plan.rb +16 -16
- data/lib/fog/oraclecloud/models/compute/object_plans.rb +12 -12
- data/lib/fog/oraclecloud/models/compute/orchestration.rb +89 -89
- data/lib/fog/oraclecloud/models/compute/orchestrations.rb +20 -20
- data/lib/fog/oraclecloud/models/compute/security_application.rb +42 -42
- data/lib/fog/oraclecloud/models/compute/security_applications.rb +22 -22
- data/lib/fog/oraclecloud/models/compute/security_list.rb +26 -26
- data/lib/fog/oraclecloud/models/compute/security_lists.rb +22 -22
- data/lib/fog/oraclecloud/models/compute/security_rule.rb +41 -41
- data/lib/fog/oraclecloud/models/compute/security_rules.rb +22 -22
- data/lib/fog/oraclecloud/models/compute/ssh_key.rb +37 -37
- data/lib/fog/oraclecloud/models/compute/ssh_keys.rb +22 -22
- data/lib/fog/oraclecloud/models/compute/volume.rb +47 -47
- data/lib/fog/oraclecloud/models/compute/volumes.rb +20 -20
- data/lib/fog/oraclecloud/models/database/backup.rb +37 -37
- data/lib/fog/oraclecloud/models/database/backups.rb +30 -30
- data/lib/fog/oraclecloud/models/database/instance.rb +331 -331
- data/lib/fog/oraclecloud/models/database/instances.rb +25 -25
- data/lib/fog/oraclecloud/models/database/patch.rb +34 -34
- data/lib/fog/oraclecloud/models/database/patches.rb +18 -18
- data/lib/fog/oraclecloud/models/database/recoveries.rb +26 -26
- data/lib/fog/oraclecloud/models/database/recovery.rb +43 -43
- data/lib/fog/oraclecloud/models/database/server.rb +28 -28
- data/lib/fog/oraclecloud/models/database/servers.rb +18 -18
- data/lib/fog/oraclecloud/models/database/snapshot.rb +60 -60
- data/lib/fog/oraclecloud/models/database/snapshots.rb +22 -22
- data/lib/fog/oraclecloud/models/java/database.rb +17 -17
- data/lib/fog/oraclecloud/models/java/databases.rb +17 -17
- data/lib/fog/oraclecloud/models/java/instance.rb +269 -265
- data/lib/fog/oraclecloud/models/java/instances.rb +23 -23
- data/lib/fog/oraclecloud/models/java/server.rb +62 -62
- data/lib/fog/oraclecloud/models/java/servers.rb +25 -25
- data/lib/fog/oraclecloud/models/soa/instance.rb +163 -163
- data/lib/fog/oraclecloud/models/soa/instances.rb +54 -54
- data/lib/fog/oraclecloud/models/storage/container.rb +33 -33
- data/lib/fog/oraclecloud/models/storage/containers.rb +24 -24
- data/lib/fog/oraclecloud/models/storage/object.rb +27 -27
- data/lib/fog/oraclecloud/models/storage/objects.rb +27 -27
- data/lib/fog/oraclecloud/requests/compute/create_image.rb +30 -30
- data/lib/fog/oraclecloud/requests/compute/create_image_list.rb +27 -27
- data/lib/fog/oraclecloud/requests/compute/create_instance.rb +53 -53
- data/lib/fog/oraclecloud/requests/compute/create_orchestration.rb +82 -82
- data/lib/fog/oraclecloud/requests/compute/create_security_application.rb +28 -28
- data/lib/fog/oraclecloud/requests/compute/create_security_rule.rb +29 -29
- data/lib/fog/oraclecloud/requests/compute/create_ssh_key.rb +46 -46
- data/lib/fog/oraclecloud/requests/compute/create_volume.rb +28 -28
- data/lib/fog/oraclecloud/requests/compute/delete_image.rb +19 -19
- data/lib/fog/oraclecloud/requests/compute/delete_image_list.rb +19 -19
- data/lib/fog/oraclecloud/requests/compute/delete_instance.rb +33 -33
- data/lib/fog/oraclecloud/requests/compute/delete_orchestration.rb +36 -36
- data/lib/fog/oraclecloud/requests/compute/delete_security_application.rb +20 -20
- data/lib/fog/oraclecloud/requests/compute/delete_security_rule.rb +20 -20
- data/lib/fog/oraclecloud/requests/compute/delete_ssh_key.rb +32 -32
- data/lib/fog/oraclecloud/requests/compute/get_image.rb +21 -21
- data/lib/fog/oraclecloud/requests/compute/get_image_list.rb +21 -21
- data/lib/fog/oraclecloud/requests/compute/get_instance.rb +45 -45
- data/lib/fog/oraclecloud/requests/compute/get_orchestration.rb +39 -39
- data/lib/fog/oraclecloud/requests/compute/get_security_application.rb +20 -20
- data/lib/fog/oraclecloud/requests/compute/get_security_rule.rb +20 -20
- data/lib/fog/oraclecloud/requests/compute/get_ssh_key.rb +39 -39
- data/lib/fog/oraclecloud/requests/compute/list_image_lists.rb +29 -29
- data/lib/fog/oraclecloud/requests/compute/list_images.rb +16 -16
- data/lib/fog/oraclecloud/requests/compute/list_instances.rb +28 -28
- data/lib/fog/oraclecloud/requests/compute/list_orchestrations.rb +28 -28
- data/lib/fog/oraclecloud/requests/compute/list_security_applications.rb +21 -21
- data/lib/fog/oraclecloud/requests/compute/list_security_lists.rb +16 -16
- data/lib/fog/oraclecloud/requests/compute/list_security_rules.rb +21 -21
- data/lib/fog/oraclecloud/requests/compute/list_ssh_keys.rb +29 -29
- data/lib/fog/oraclecloud/requests/compute/list_volumes.rb +16 -16
- data/lib/fog/oraclecloud/requests/compute/start_orchestration.rb +39 -39
- data/lib/fog/oraclecloud/requests/compute/stop_orchestration.rb +39 -39
- data/lib/fog/oraclecloud/requests/compute/update_image.rb +27 -27
- data/lib/fog/oraclecloud/requests/compute/update_image_list.rb +27 -27
- data/lib/fog/oraclecloud/requests/compute/update_orchestration.rb +80 -80
- data/lib/fog/oraclecloud/requests/compute/update_ssh_key.rb +49 -49
- data/lib/fog/oraclecloud/requests/database/backup_instance.rb +45 -45
- data/lib/fog/oraclecloud/requests/database/create_instance.rb +101 -101
- data/lib/fog/oraclecloud/requests/database/create_snapshot.rb +50 -50
- data/lib/fog/oraclecloud/requests/database/delete_instance.rb +26 -26
- data/lib/fog/oraclecloud/requests/database/delete_snapshot.rb +26 -26
- data/lib/fog/oraclecloud/requests/database/get_instance.rb +62 -62
- data/lib/fog/oraclecloud/requests/database/get_instance_from_job.rb +31 -31
- data/lib/fog/oraclecloud/requests/database/get_snapshot.rb +43 -43
- data/lib/fog/oraclecloud/requests/database/list_backups.rb +39 -39
- data/lib/fog/oraclecloud/requests/database/list_instances.rb +29 -29
- data/lib/fog/oraclecloud/requests/database/list_patches.rb +51 -51
- data/lib/fog/oraclecloud/requests/database/list_recoveries.rb +40 -40
- data/lib/fog/oraclecloud/requests/database/list_servers.rb +27 -27
- data/lib/fog/oraclecloud/requests/database/list_snapshots.rb +27 -27
- data/lib/fog/oraclecloud/requests/database/recover_instance.rb +83 -83
- data/lib/fog/oraclecloud/requests/database/scale_instance.rb +40 -40
- data/lib/fog/oraclecloud/requests/java/create_instance.rb +156 -87
- data/lib/fog/oraclecloud/requests/java/delete_instance.rb +37 -37
- data/lib/fog/oraclecloud/requests/java/get_instance.rb +43 -43
- data/lib/fog/oraclecloud/requests/java/get_server.rb +42 -42
- data/lib/fog/oraclecloud/requests/java/list_instances.rb +29 -29
- data/lib/fog/oraclecloud/requests/java/list_servers.rb +30 -30
- data/lib/fog/oraclecloud/requests/java/scale_a_node.rb +45 -45
- data/lib/fog/oraclecloud/requests/java/scale_in_a_cluster.rb +35 -35
- data/lib/fog/oraclecloud/requests/java/scale_out_a_cluster.rb +38 -38
- data/lib/fog/oraclecloud/requests/soa/create_instance.rb +71 -71
- data/lib/fog/oraclecloud/requests/soa/delete_instance.rb +35 -35
- data/lib/fog/oraclecloud/requests/soa/get_instance.rb +42 -42
- data/lib/fog/oraclecloud/requests/soa/get_job_status.rb +22 -22
- data/lib/fog/oraclecloud/requests/soa/list_instances.rb +29 -29
- data/lib/fog/oraclecloud/requests/storage/create_container.rb +41 -41
- data/lib/fog/oraclecloud/requests/storage/delete_container.rb +15 -15
- data/lib/fog/oraclecloud/requests/storage/get_container.rb +63 -63
- data/lib/fog/oraclecloud/requests/storage/list_containers.rb +27 -27
- data/lib/fog/oraclecloud/soa.rb +106 -106
- data/lib/fog/oraclecloud/storage.rb +98 -98
- data/lib/fog/oraclecloud/version.rb +5 -5
- data/tests/helper.rb +5 -3
- data/tests/helpers/mock_helper.rb +14 -14
- data/tests/requests/compute_tests.rb +9 -9
- data/tests/requests/database_tests.rb +241 -241
- data/tests/requests/instance_tests.rb +68 -61
- data/tests/requests/java_tests.rb +149 -109
- data/tests/requests/orchestrations_tests.rb +90 -90
- data/tests/requests/soa_tests.rb +151 -151
- data/tests/requests/ssh_keys_tests.rb +53 -53
- data/tests/requests/storage_tests.rb +54 -54
- metadata +17 -3
@@ -1,23 +1,23 @@
|
|
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
|
-
new(service.get_instance(service_name).body)
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
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
|
+
new(service.get_instance(service_name).body)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -1,62 +1,62 @@
|
|
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 :cluster_name, :aliases=>'clusterName'
|
10
|
-
attribute :job_id, :aliases=>'jobId'
|
11
|
-
attribute :name
|
12
|
-
attribute :shape
|
13
|
-
attribute :node_type, :aliases=>'nodeType'
|
14
|
-
attribute :is_admin, :aliases=>'isAdmin'
|
15
|
-
attribute :hostname
|
16
|
-
attribute :status
|
17
|
-
attribute :reserved_ip, :aliases=>'reservedIp'
|
18
|
-
attribute :reserved_ipaddress, :aliases=>'reservedIpAddress'
|
19
|
-
attribute :reserved_ipname, :aliases=>'reservedIpName'
|
20
|
-
attribute :storage_allocated, :aliases=>'storageAllocated'
|
21
|
-
attribute :creation_date, :aliases=>'creationDate'
|
22
|
-
attribute :service_name
|
23
|
-
|
24
|
-
def ip_addr
|
25
|
-
reserved_ip.blank? ? hostname : reserved_ip
|
26
|
-
end
|
27
|
-
|
28
|
-
def ready?
|
29
|
-
status == "Ready"
|
30
|
-
end
|
31
|
-
|
32
|
-
def scale(shape)
|
33
|
-
if !%w(oc3 oc4 oc5 oc6 oc1m oc2m oc3m oc4m).include? shape then
|
34
|
-
raise ArgumentError, "Invalid Shape. Valid values - oc3, oc4, oc5, oc6, oc1m, oc2m, oc3m or oc4m"
|
35
|
-
end
|
36
|
-
service.scale_a_node(service_name, name, :shape=>shape)
|
37
|
-
end
|
38
|
-
|
39
|
-
def scale_in_a_cluster
|
40
|
-
requires :service_name, :identity
|
41
|
-
service.scale_in_a_cluster(service_name, identity)
|
42
|
-
end
|
43
|
-
|
44
|
-
def reload
|
45
|
-
requires :identity, :service_name
|
46
|
-
|
47
|
-
data = begin
|
48
|
-
collection.get(service_name, identity)
|
49
|
-
rescue Excon::Errors::SocketError
|
50
|
-
nil
|
51
|
-
end
|
52
|
-
|
53
|
-
return unless data
|
54
|
-
|
55
|
-
new_attributes = data.attributes
|
56
|
-
merge_attributes(new_attributes)
|
57
|
-
self
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
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 :cluster_name, :aliases=>'clusterName'
|
10
|
+
attribute :job_id, :aliases=>'jobId'
|
11
|
+
attribute :name
|
12
|
+
attribute :shape
|
13
|
+
attribute :node_type, :aliases=>'nodeType'
|
14
|
+
attribute :is_admin, :aliases=>'isAdmin'
|
15
|
+
attribute :hostname
|
16
|
+
attribute :status
|
17
|
+
attribute :reserved_ip, :aliases=>'reservedIp'
|
18
|
+
attribute :reserved_ipaddress, :aliases=>'reservedIpAddress'
|
19
|
+
attribute :reserved_ipname, :aliases=>'reservedIpName'
|
20
|
+
attribute :storage_allocated, :aliases=>'storageAllocated'
|
21
|
+
attribute :creation_date, :aliases=>'creationDate'
|
22
|
+
attribute :service_name
|
23
|
+
|
24
|
+
def ip_addr
|
25
|
+
reserved_ip.blank? ? hostname : reserved_ip
|
26
|
+
end
|
27
|
+
|
28
|
+
def ready?
|
29
|
+
status == "Ready"
|
30
|
+
end
|
31
|
+
|
32
|
+
def scale(shape)
|
33
|
+
if !%w(oc3 oc4 oc5 oc6 oc1m oc2m oc3m oc4m).include? shape then
|
34
|
+
raise ArgumentError, "Invalid Shape. Valid values - oc3, oc4, oc5, oc6, oc1m, oc2m, oc3m or oc4m"
|
35
|
+
end
|
36
|
+
service.scale_a_node(service_name, name, :shape=>shape)
|
37
|
+
end
|
38
|
+
|
39
|
+
def scale_in_a_cluster
|
40
|
+
requires :service_name, :identity
|
41
|
+
service.scale_in_a_cluster(service_name, identity)
|
42
|
+
end
|
43
|
+
|
44
|
+
def reload
|
45
|
+
requires :identity, :service_name
|
46
|
+
|
47
|
+
data = begin
|
48
|
+
collection.get(service_name, identity)
|
49
|
+
rescue Excon::Errors::SocketError
|
50
|
+
nil
|
51
|
+
end
|
52
|
+
|
53
|
+
return unless data
|
54
|
+
|
55
|
+
new_attributes = data.attributes
|
56
|
+
merge_attributes(new_attributes)
|
57
|
+
self
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -1,25 +1,25 @@
|
|
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
|
-
data.each { |s| s['service_name'] = service_name }
|
13
|
-
load(data)
|
14
|
-
end
|
15
|
-
|
16
|
-
def get(service_name, server_name)
|
17
|
-
data = service.get_server(service_name, server_name).body['servers'].first
|
18
|
-
data['service_name'] = service_name
|
19
|
-
new(data)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
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
|
+
data.each { |s| s['service_name'] = service_name }
|
13
|
+
load(data)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(service_name, server_name)
|
17
|
+
data = service.get_server(service_name, server_name).body['servers'].first
|
18
|
+
data['service_name'] = service_name
|
19
|
+
new(data)
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,163 +1,163 @@
|
|
1
|
-
require 'fog/core/model'
|
2
|
-
|
3
|
-
module Fog
|
4
|
-
module OracleCloud
|
5
|
-
class SOA
|
6
|
-
class Instance < Fog::Model
|
7
|
-
identity :service_name, :aliases=>'serviceName'
|
8
|
-
|
9
|
-
attribute :service_type
|
10
|
-
attribute :resource_count
|
11
|
-
attribute :status
|
12
|
-
attribute :description
|
13
|
-
attribute :identity_domain
|
14
|
-
attribute :creation_job_id
|
15
|
-
attribute :creation_time
|
16
|
-
attribute :last_modified_time
|
17
|
-
attribute :created_by
|
18
|
-
attribute :service_uri
|
19
|
-
attribute :provisioning_progress
|
20
|
-
attribute :db_service_name, :aliases=>'dbServiceName'
|
21
|
-
attribute :num_nodes, :aliases=>'managedServerCount'
|
22
|
-
attribute :shape
|
23
|
-
attribute :version
|
24
|
-
attribute :ssh_key, :aliases=>'vmPublicKey'
|
25
|
-
|
26
|
-
# The following are only used to create an instance and are not returned in the list action
|
27
|
-
attribute :cloud_storage_container, :aliases=>'cloudStorageContainer'
|
28
|
-
attribute :cloud_storage_user, :aliases=>'cloudStorageUser'
|
29
|
-
attribute :cloud_storage_pwd, :aliases=>'cloudStoragePassword'
|
30
|
-
attribute :level
|
31
|
-
attribute :subscription_type, :aliases=>'subscriptionType'
|
32
|
-
attribute :topology
|
33
|
-
attribute :admin_username, :aliases=>'adminUserName'
|
34
|
-
attribute :admin_password, :aliases=>'adminPassword'
|
35
|
-
attribute :dba_name, :aliases=>'dbaName'
|
36
|
-
attribute :dba_password, :aliases=>'dbaPassword'
|
37
|
-
attribute :provision_otd, :aliases=>'provisionOtd'
|
38
|
-
|
39
|
-
# The following are used to delete an instance and are not returned in the list action
|
40
|
-
attribute :dba_password
|
41
|
-
attribute :force_delete
|
42
|
-
attribute :skip_backup
|
43
|
-
|
44
|
-
def service_name=(value)
|
45
|
-
if value.include? '_' or !(value[0] =~ /[[:alpha:]]/) or value.size > 50 or !(value[/[a-zA-Z0-9-]+/] == value)
|
46
|
-
raise ArgumentError, "Invalid service name. Names must be less than 50 characters; must start with a letter and can only contain letters, numbers and hyphens (-); can not end with a hyphen"
|
47
|
-
else
|
48
|
-
attributes[:service_name] = value
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def topology=(value)
|
53
|
-
if %w(osb soa soaosb b2b mft apim insight).include? value then
|
54
|
-
attributes[:topology]=value
|
55
|
-
else
|
56
|
-
raise ArgumentError, "Invalid topology. Valid values - osb, soa, soaosb, b2b, mft, apim, insight"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def num_nodes=(value)
|
61
|
-
if value.nil? then value = 1 end
|
62
|
-
if [1, 2, 4].include? value.to_i then
|
63
|
-
attributes[:num_nodes] = value.to_i
|
64
|
-
else
|
65
|
-
raise ArgumentError, "Invalid server count (#{value}). Valid values - 1, 2 or 4"
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def shape=(value)
|
70
|
-
if %w( oc1m oc2m oc3m oc4m oc5m).include? value then
|
71
|
-
attributes[:shape]=value
|
72
|
-
else
|
73
|
-
raise ArgumentError, "Invalid Shape. Valid values - oc1m, oc2m, oc3m, oc4m or oc5m"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def admin_password=(value)
|
78
|
-
if !(value[0] =~ /[[:alpha:]]/) or value.size < 8 or value.size > 30 or !(value =~ /[_#$]/) or !(value =~ /[0-9]/)
|
79
|
-
raise ArgumentError, "Invalid admin password. Password must be between 8 and 30 characters in length; must start with a letter and can only contain letters, numbers and $, \#, _"
|
80
|
-
else
|
81
|
-
attributes[:admin_password] = value
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def save
|
86
|
-
#identity ? update : create
|
87
|
-
create
|
88
|
-
end
|
89
|
-
|
90
|
-
def ready?
|
91
|
-
status == "Running"
|
92
|
-
end
|
93
|
-
|
94
|
-
def stopping?
|
95
|
-
status == 'Maintenance' || status == 'Terminating'
|
96
|
-
end
|
97
|
-
|
98
|
-
def stopped?
|
99
|
-
status == 'Stopped'
|
100
|
-
end
|
101
|
-
|
102
|
-
def destroy(dba_name, dba_password)
|
103
|
-
requires :service_name
|
104
|
-
service.delete_instance(service_name, dba_name, dba_password,
|
105
|
-
:force_delete => force_delete,
|
106
|
-
:skip_backup => skip_backup).body
|
107
|
-
end
|
108
|
-
|
109
|
-
def job_status
|
110
|
-
requires :creation_job_id
|
111
|
-
service.get_job_status('create', creation_job_id)
|
112
|
-
end
|
113
|
-
|
114
|
-
private
|
115
|
-
|
116
|
-
def create
|
117
|
-
requires :service_name, :dba_name, :dba_password, :db_service_name, :shape, :version, :ssh_key, :admin_password, :admin_username, :topology
|
118
|
-
|
119
|
-
stor_user = cloud_storage_user || service.username
|
120
|
-
stor_pwd = cloud_storage_pwd || service.password
|
121
|
-
|
122
|
-
if cloud_storage_container.nil? then
|
123
|
-
cloud_storage_container = "#{service_name}_Backup"
|
124
|
-
begin
|
125
|
-
container = Fog::Storage[:oraclecloud].containers.get(cloud_storage_container)
|
126
|
-
rescue Excon::Error::NotFound => error
|
127
|
-
# Doesn't exist, create it first
|
128
|
-
# The Oracle Cloud currently doesn't create a storage container for us, if it doesn't exist. Do it manually now
|
129
|
-
container = Fog::Storage[:oraclecloud].containers.create(
|
130
|
-
:name => cloud_storage_container,
|
131
|
-
)
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
params = {
|
136
|
-
:serviceName => service_name,
|
137
|
-
:cloudStorageContainer => cloud_storage_container,
|
138
|
-
:cloudStoragePassword => stor_pwd,
|
139
|
-
:cloudStorageUser => stor_user,
|
140
|
-
:description => description,
|
141
|
-
:provisionOTD => provision_otd.nil? ? false : provision_otd,
|
142
|
-
:subscriptionType => 'MONTHLY',
|
143
|
-
:level => 'PAAS',
|
144
|
-
:topology => topology
|
145
|
-
}
|
146
|
-
options = {
|
147
|
-
:adminPassword => admin_password,
|
148
|
-
:adminUserName => admin_username,
|
149
|
-
:dbaName => dba_name,
|
150
|
-
:dbaPassword => dba_password,
|
151
|
-
:dbServiceName => db_service_name,
|
152
|
-
:managedServerCount => num_nodes || 1,
|
153
|
-
:shape => shape,
|
154
|
-
:VMsPublicKey => ssh_key,
|
155
|
-
:version => version
|
156
|
-
}
|
157
|
-
|
158
|
-
data = service.create_instance(params, options)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
1
|
+
require 'fog/core/model'
|
2
|
+
|
3
|
+
module Fog
|
4
|
+
module OracleCloud
|
5
|
+
class SOA
|
6
|
+
class Instance < Fog::Model
|
7
|
+
identity :service_name, :aliases=>'serviceName'
|
8
|
+
|
9
|
+
attribute :service_type
|
10
|
+
attribute :resource_count
|
11
|
+
attribute :status
|
12
|
+
attribute :description
|
13
|
+
attribute :identity_domain
|
14
|
+
attribute :creation_job_id
|
15
|
+
attribute :creation_time
|
16
|
+
attribute :last_modified_time
|
17
|
+
attribute :created_by
|
18
|
+
attribute :service_uri
|
19
|
+
attribute :provisioning_progress
|
20
|
+
attribute :db_service_name, :aliases=>'dbServiceName'
|
21
|
+
attribute :num_nodes, :aliases=>'managedServerCount'
|
22
|
+
attribute :shape
|
23
|
+
attribute :version
|
24
|
+
attribute :ssh_key, :aliases=>'vmPublicKey'
|
25
|
+
|
26
|
+
# The following are only used to create an instance and are not returned in the list action
|
27
|
+
attribute :cloud_storage_container, :aliases=>'cloudStorageContainer'
|
28
|
+
attribute :cloud_storage_user, :aliases=>'cloudStorageUser'
|
29
|
+
attribute :cloud_storage_pwd, :aliases=>'cloudStoragePassword'
|
30
|
+
attribute :level
|
31
|
+
attribute :subscription_type, :aliases=>'subscriptionType'
|
32
|
+
attribute :topology
|
33
|
+
attribute :admin_username, :aliases=>'adminUserName'
|
34
|
+
attribute :admin_password, :aliases=>'adminPassword'
|
35
|
+
attribute :dba_name, :aliases=>'dbaName'
|
36
|
+
attribute :dba_password, :aliases=>'dbaPassword'
|
37
|
+
attribute :provision_otd, :aliases=>'provisionOtd'
|
38
|
+
|
39
|
+
# The following are used to delete an instance and are not returned in the list action
|
40
|
+
attribute :dba_password
|
41
|
+
attribute :force_delete
|
42
|
+
attribute :skip_backup
|
43
|
+
|
44
|
+
def service_name=(value)
|
45
|
+
if value.include? '_' or !(value[0] =~ /[[:alpha:]]/) or value.size > 50 or !(value[/[a-zA-Z0-9-]+/] == value)
|
46
|
+
raise ArgumentError, "Invalid service name. Names must be less than 50 characters; must start with a letter and can only contain letters, numbers and hyphens (-); can not end with a hyphen"
|
47
|
+
else
|
48
|
+
attributes[:service_name] = value
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def topology=(value)
|
53
|
+
if %w(osb soa soaosb b2b mft apim insight).include? value then
|
54
|
+
attributes[:topology]=value
|
55
|
+
else
|
56
|
+
raise ArgumentError, "Invalid topology. Valid values - osb, soa, soaosb, b2b, mft, apim, insight"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def num_nodes=(value)
|
61
|
+
if value.nil? then value = 1 end
|
62
|
+
if [1, 2, 4].include? value.to_i then
|
63
|
+
attributes[:num_nodes] = value.to_i
|
64
|
+
else
|
65
|
+
raise ArgumentError, "Invalid server count (#{value}). Valid values - 1, 2 or 4"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def shape=(value)
|
70
|
+
if %w( oc1m oc2m oc3m oc4m oc5m).include? value then
|
71
|
+
attributes[:shape]=value
|
72
|
+
else
|
73
|
+
raise ArgumentError, "Invalid Shape. Valid values - oc1m, oc2m, oc3m, oc4m or oc5m"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def admin_password=(value)
|
78
|
+
if !(value[0] =~ /[[:alpha:]]/) or value.size < 8 or value.size > 30 or !(value =~ /[_#$]/) or !(value =~ /[0-9]/)
|
79
|
+
raise ArgumentError, "Invalid admin password. Password must be between 8 and 30 characters in length; must start with a letter and can only contain letters, numbers and $, \#, _"
|
80
|
+
else
|
81
|
+
attributes[:admin_password] = value
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def save
|
86
|
+
#identity ? update : create
|
87
|
+
create
|
88
|
+
end
|
89
|
+
|
90
|
+
def ready?
|
91
|
+
status == "Running"
|
92
|
+
end
|
93
|
+
|
94
|
+
def stopping?
|
95
|
+
status == 'Maintenance' || status == 'Terminating'
|
96
|
+
end
|
97
|
+
|
98
|
+
def stopped?
|
99
|
+
status == 'Stopped'
|
100
|
+
end
|
101
|
+
|
102
|
+
def destroy(dba_name, dba_password)
|
103
|
+
requires :service_name
|
104
|
+
service.delete_instance(service_name, dba_name, dba_password,
|
105
|
+
:force_delete => force_delete,
|
106
|
+
:skip_backup => skip_backup).body
|
107
|
+
end
|
108
|
+
|
109
|
+
def job_status
|
110
|
+
requires :creation_job_id
|
111
|
+
service.get_job_status('create', creation_job_id)
|
112
|
+
end
|
113
|
+
|
114
|
+
private
|
115
|
+
|
116
|
+
def create
|
117
|
+
requires :service_name, :dba_name, :dba_password, :db_service_name, :shape, :version, :ssh_key, :admin_password, :admin_username, :topology
|
118
|
+
|
119
|
+
stor_user = cloud_storage_user || service.username
|
120
|
+
stor_pwd = cloud_storage_pwd || service.password
|
121
|
+
|
122
|
+
if cloud_storage_container.nil? then
|
123
|
+
cloud_storage_container = "#{service_name}_Backup"
|
124
|
+
begin
|
125
|
+
container = Fog::Storage[:oraclecloud].containers.get(cloud_storage_container)
|
126
|
+
rescue Excon::Error::NotFound => error
|
127
|
+
# Doesn't exist, create it first
|
128
|
+
# The Oracle Cloud currently doesn't create a storage container for us, if it doesn't exist. Do it manually now
|
129
|
+
container = Fog::Storage[:oraclecloud].containers.create(
|
130
|
+
:name => cloud_storage_container,
|
131
|
+
)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
|
135
|
+
params = {
|
136
|
+
:serviceName => service_name,
|
137
|
+
:cloudStorageContainer => cloud_storage_container,
|
138
|
+
:cloudStoragePassword => stor_pwd,
|
139
|
+
:cloudStorageUser => stor_user,
|
140
|
+
:description => description,
|
141
|
+
:provisionOTD => provision_otd.nil? ? false : provision_otd,
|
142
|
+
:subscriptionType => 'MONTHLY',
|
143
|
+
:level => 'PAAS',
|
144
|
+
:topology => topology
|
145
|
+
}
|
146
|
+
options = {
|
147
|
+
:adminPassword => admin_password,
|
148
|
+
:adminUserName => admin_username,
|
149
|
+
:dbaName => dba_name,
|
150
|
+
:dbaPassword => dba_password,
|
151
|
+
:dbServiceName => db_service_name,
|
152
|
+
:managedServerCount => num_nodes || 1,
|
153
|
+
:shape => shape,
|
154
|
+
:VMsPublicKey => ssh_key,
|
155
|
+
:version => version
|
156
|
+
}
|
157
|
+
|
158
|
+
data = service.create_instance(params, options)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|