lib/fog/oraclecloud/models/database/instance.rb in fog-oraclecloud-0.1.16 vs lib/fog/oraclecloud/models/database/instance.rb in fog-oraclecloud-0.1.17
- old
+ new
@@ -207,13 +207,23 @@
if type.nil? then type = 'data' end
if type == 'backup' then type ='fra' end
service.scale_instance(service_name, :additional_storage=>size, :usage=>type).body
end
+ def access_rules
+ requires :service_name
+ service.access_rules.all(service_name)
+ end
+
+ def get_access_rule(rule_name)
+ requires :service_name
+ service.access_rules.get(service_name, rule_name)
+ end
+
def add_rule(port, ip, rule_name=nil)
if !rule_name then rule_name = "#{service_name}_#{port}_#{ip}" end
begin
- rule = service.access_rules.get(service_name, rule_name)
+ rule = get_access_rule(rule_name)
rescue Fog::OracleCloud::Database::NotFound
Fog::Logger.debug "Add access rule (#{rule_name}) to (#{service_name}) on port #{port}"
rule = service.access_rules.create(service_name, :ports=>port, :source=>ip, :destination=>'DB', :ruleName=>rule_name)
end
end