Sha256: ad715004fba95c1cb3429f8a2dbe4b1d97aab1ef8c1441b4a464b12220b26295

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

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

          body_data     = {
            'name'              => "/Compute-#{@identity_domain}/#{@username}/#{name}",
            'seclist'           => "/Compute-#{@identity_domain}/#{@username}/#{seclist}",
            'vcable'					  => vcable
          }
          body_data = body_data.reject {|key, value| value.nil?}
          request(
            :method   => 'POST',
            :expects  => 201,
            :path     => "/secassociation/",
            :body     => Fog::JSON.encode(body_data),
            :headers  => {
              'Content-Type' => 'application/oracle-compute-v3+json'
            }
          )
      	end
      end
      class Mock
        def create_security_association(name, seclist, vcable)
          response = Excon::Response.new
          name.sub! "/Compute-#{@identity_domain}/#{@username}/", ''
          seclist.sub! "/Compute-#{@identity_domain}/#{@username}/", ''

          data = {
            'name'                => "/Compute-#{@identity_domain}/#{@username}/#{name}",
            'seclist'             => "/Compute-#{@identity_domain}/#{@username}/#{seclist}",
            'vcable'              => vcable,
            'uri'                 => "#{@api_endpoint}secassociation/#{name}"
          }
          self.data[:security_associations][name] = data

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