Sha256: d2fc34e18c5b5681fadc1a64af927f50ff91189f69fa9889dd344ba0767a2e81

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

module Fog
  module Compute
    class OracleCloud
      class Real
				def get_security_rule(name)
          name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''

 					response = request(
            :expects  => 200,
            :method   => 'GET',
            :path     => "/secrule/Compute-#{@identity_domain}/#{@username}/#{name}",
            :headers  => {
              'Content-Type' => 'application/oracle-compute-v3+json',
              'Accept' => 'application/oracle-compute-v3+json'
            }
          )
          response
        end
      end

      class Mock
        def get_security_rule(name)
          response = Excon::Response.new
          clean_name = name.sub "/Compute-#{@identity_domain}/#{@username}/", ''

          if instance = self.data[:security_rules][clean_name] 
            response.status = 200
            response.body = instance
            response
          else
            raise Fog::Compute::OracleCloud::NotFound.new("Security Rule #{name} does not exist");
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-oraclecloud-0.1.17 lib/fog/oraclecloud/requests/compute/get_security_rule.rb
fog-oraclecloud-0.1.16 lib/fog/oraclecloud/requests/compute/get_security_rule.rb