Sha256: 037843b06eb80efc95544a7c5cedf57ae3e3a0027c7f73eb587446ed3e8ec2d6

Contents?: true

Size: 1.2 KB

Versions: 29

Compression:

Stored size: 1.2 KB

Contents

module Fog
  module Compute
    class HP
      class Real
        # Delete a security group rule
        #
        # ==== Parameters
        # * id<~Integer> - id of the security group rule to delete
        #
        # {Openstack API Reference}[http://docs.openstack.org]
        def delete_security_group_rule(security_group_rule_id)
          request(
            :expects  => 202,
            :method   => 'DELETE',
            :path     => "os-security-group-rules/#{security_group_rule_id}"
          )
        end
      end

      class Mock
        def delete_security_group_rule(security_group_rule_id)
          response = Excon::Response.new

          sg_rule = nil

          self.data[:security_groups].each do |_, sgv|
            if sgv['rules']
              sg_rule = sgv['rules'].delete_if { |r| !r.nil? && r['id'] == security_group_rule_id }
              break if sg_rule
            end
          end

          if sg_rule && !sg_rule.empty?
            response.status = 202
            response.body = "202 Accepted\n\nThe request is accepted for processing.\n\n   "
            response
          else
            raise Fog::Compute::HP::NotFound
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 4 rubygems

Version Path
fog-1.37.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.36.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.35.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-2.0.0.pre.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.34.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.33.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.32.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.31.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.30.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.29.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.28.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.27.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.26.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.25.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
nsidc-fog-1.24.1 lib/fog/hp/requests/compute/delete_security_group_rule.rb
fog-1.24.0 lib/fog/hp/requests/compute/delete_security_group_rule.rb
ns-fog-1.22.11 lib/fog/hp/requests/compute/delete_security_group_rule.rb
ns-fog-1.22.10 lib/fog/hp/requests/compute/delete_security_group_rule.rb