Sha256: 5d1f5acc71a09acccd7e4ea2d73e67d06e076e48a74d6e187b41d9eef6787ff3

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

module Fog
  module OracleCloud
    class Database
      class Real

      	def create_access_rule(service_name, name, description, ports, source, destination, status)
          body_data     = {
            'ruleName' => name,
            'description' => description,
            'destination' => destination,
            'ports' => ports,
            'source' => source,
            'status' => status
          }
          response = request(
            :method   => 'POST',
            :expects  => 202,
            :path     => "/paas/api/v1.1/instancemgmt/#{@identity_domain}/services/dbaas/instances/#{service_name}/accessrules",
            :body     => Fog::JSON.encode(body_data),
          )
          response
        end
      end

      class Mock
        def create_access_rule(service_name, name, description, ports, source, destination, status)
          response = Excon::Response.new

          data = {
            'ruleName' => name,
            'description' => description,
            'status' => status,
            'source' => source,
            'destination'=>destination,
            'ports'=>ports,
            'ruleType'=>'USER',
            'database_id'=>service_name
          }
          if !self.data[:access_rules].key?(service_name) then self.data[:access_rules][service_name] = [] end
          self.data[:access_rules][service_name] << data
          response.status = 202
          response
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.17 lib/fog/oraclecloud/requests/database/create_access_rule.rb