Sha256: d64dac0235ca6e649469493185300a64027335ee6c8820aeca0be7f3a649b9bb

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

module Fog
  module Compute
    class QingCloud
      class Real

        # {API Reference}[https://docs.qingcloud.com/api/sg/delete_security_group_rules.html]
        def delete_security_group_rules(rule_id)
          args = {
            'action' => 'DeleteSecurityGroupRules'
          }.merge(Fog::QingCloud.indexed_param('security_group_rules', rule_id))
          request(args)
        end
      end

      class Mock
        def delete_security_group_rules(rule_id)
          group_id = self.data[:security_group_rule_maps][rule_id]
          raise Fog::QingCloud::Errors::NotFound, "security group #{rule_id} does not exist" unless group_id

          self.data[:security_groups][group_id]['rules'].delete_if {|rid, r| [*rule_id].include?(rid)} 
          self.data[:security_groups][group_id]['is_applied'] = 0

          response = Excon::Response.new
          response.body = {
            'action'   => 'DeleteSecurityGroupRulesResponse',
            'security_group_rules' => [*rule_id],
            'ret_code' => 0
          }
          response
        end        
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ns-fog-1.22.11 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb
ns-fog-1.22.10 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb
ns-fog-1.22.9 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb
ns-fog-1.22.8 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb
ns-fog-1.22.7 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb
ns-fog-1.22.6 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb
ns-fog-1.22.4 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb
ns-fog-1.22.3 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb
ns-fog-1.22.2 lib/fog/qingcloud/requests/compute/delete_security_group_rules.rb