Sha256: 2d83a2a1cfb54101db80ebf708ba05cbf55565ef658def98013f5ecdd841ba9d

Contents?: true

Size: 1.58 KB

Versions: 2

Compression:

Stored size: 1.58 KB

Contents

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

          body_data     = {
            'name'                => "/Compute-#{@identity_domain}/#{@username}/#{name}",
            'description'         => description,
            'policy'              => policy,
            'outbound_cidr_policy'=> outbound_policy
          }
          body_data = body_data.reject {|key, value| value.nil?}
          request(
            :method   => 'POST',
            :expects  => 201,
            :path     => "/seclist/",
            :body     => Fog::JSON.encode(body_data),
            :headers  => {
              'Content-Type' => 'application/oracle-compute-v3+json'
            }
          )

      	end
      end

      class Mock
        def create_security_list(name, description, policy, outbound_policy)
          response = Excon::Response.new
          name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''

          data = {
            'name'                => "/Compute-#{@identity_domain}/#{@username}/#{name}",
            'description'         => description,
            'policy'              => policy,
            'outbound_cidr_policy'=> outbound_policy,
            'uri'                 => "#{@api_endpoint}seclist/#{name}"
          }
          self.data[:security_lists][name] = data

          response.status = 201
          response.body = self.data[:security_lists][name]
          response
        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/create_security_list.rb
fog-oraclecloud-0.1.16 lib/fog/oraclecloud/requests/compute/create_security_list.rb