Sha256: fd9a4ab5781da8d6772d437458d11e7e218834ab677ae945632372d36c6792ea

Contents?: true

Size: 1.27 KB

Versions: 9

Compression:

Stored size: 1.27 KB

Contents

module Fog
  module Compute
    class QingCloud
      class Real

        # {API Reference}[https://docs.qingcloud.com/api/sg/modify_security_group_rule_attributes.html]
        def modify_security_group_rule_attributes(rule_id, priority, name = nil)
          args = {
            'action' => 'ModifySecurityGroupRuleAttributes',
            'security_group_rule' => rule_id,
            'security_group_rule_name' => name
          }
          request(args)
        end
      end

      class Mock
        def modify_security_group_rule_attributes(rule_id, priority, name = nil)
          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

          rule = self.data[:security_groups][group_id]['rules'][rule_id]
          rule['security_group_rule_name'] = name if name
          rule['priority'] = priority
          self.data[:security_groups][group_id]['is_applied'] = 0

          response = Excon::Response.new
          response.body = {
            'action'   => 'AddSecurityGroupRulesResponse',
            'security_group_rule_id' => rule['security_group_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/modify_security_group_rule_attributes.rb
ns-fog-1.22.10 lib/fog/qingcloud/requests/compute/modify_security_group_rule_attributes.rb
ns-fog-1.22.9 lib/fog/qingcloud/requests/compute/modify_security_group_rule_attributes.rb
ns-fog-1.22.8 lib/fog/qingcloud/requests/compute/modify_security_group_rule_attributes.rb
ns-fog-1.22.7 lib/fog/qingcloud/requests/compute/modify_security_group_rule_attributes.rb
ns-fog-1.22.6 lib/fog/qingcloud/requests/compute/modify_security_group_rule_attributes.rb
ns-fog-1.22.4 lib/fog/qingcloud/requests/compute/modify_security_group_rule_attributes.rb
ns-fog-1.22.3 lib/fog/qingcloud/requests/compute/modify_security_group_rule_attributes.rb
ns-fog-1.22.2 lib/fog/qingcloud/requests/compute/modify_security_group_rule_attributes.rb