Class: Fog::OracleCloud::SOA::Instance
- Inherits:
-
Model
- Object
- Model
- Fog::OracleCloud::SOA::Instance
- Defined in:
- lib/fog/oraclecloud/models/soa/instance.rb
Instance Method Summary collapse
- #admin_password=(value) ⇒ Object
- #destroy(dba_name, dba_password) ⇒ Object
- #job_status ⇒ Object
- #num_nodes=(value) ⇒ Object
- #ready? ⇒ Boolean
- #save ⇒ Object
- #service_name=(value) ⇒ Object
- #shape=(value) ⇒ Object
- #stopped? ⇒ Boolean
- #stopping? ⇒ Boolean
- #topology=(value) ⇒ Object
Instance Method Details
#admin_password=(value) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 77 def admin_password=(value) if !(value[0] =~ /[[:alpha:]]/) or value.size < 8 or value.size > 30 or !(value =~ /[_#$]/) or !(value =~ /[0-9]/) 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 $, \#, _" else attributes[:admin_password] = value end end |
#destroy(dba_name, dba_password) ⇒ Object
102 103 104 105 106 107 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 102 def destroy(dba_name, dba_password) requires :service_name service.delete_instance(service_name, dba_name, dba_password, :force_delete => force_delete, :skip_backup => skip_backup).body end |
#job_status ⇒ Object
109 110 111 112 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 109 def job_status requires :creation_job_id service.get_job_status('create', creation_job_id) end |
#num_nodes=(value) ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 60 def num_nodes=(value) if value.nil? then value = 1 end if [1, 2, 4].include? value.to_i then attributes[:num_nodes] = value.to_i else raise ArgumentError, "Invalid server count (#{value}). Valid values - 1, 2 or 4" end end |
#ready? ⇒ Boolean
90 91 92 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 90 def ready? status == "Running" end |
#save ⇒ Object
85 86 87 88 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 85 def save #identity ? update : create create end |
#service_name=(value) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 44 def service_name=(value) if value.include? '_' or !(value[0] =~ /[[:alpha:]]/) or value.size > 50 or !(value[/[a-zA-Z0-9-]+/] == value) 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" else attributes[:service_name] = value end end |
#shape=(value) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 69 def shape=(value) if %w( oc1m oc2m oc3m oc4m oc5m).include? value then attributes[:shape]=value else raise ArgumentError, "Invalid Shape. Valid values - oc1m, oc2m, oc3m, oc4m or oc5m" end end |
#stopped? ⇒ Boolean
98 99 100 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 98 def stopped? status == 'Stopped' end |
#stopping? ⇒ Boolean
94 95 96 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 94 def stopping? status == 'Maintenance' || status == 'Terminating' end |
#topology=(value) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/fog/oraclecloud/models/soa/instance.rb', line 52 def topology=(value) if %w(osb soa soaosb b2b mft apim insight).include? value then attributes[:topology]=value else raise ArgumentError, "Invalid topology. Valid values - osb, soa, soaosb, b2b, mft, apim, insight" end end |