Sha256: 99c6a5c3bfe2f5d92c128d276e1cc76d15ba8525ca4e5d8b542e50bc7e6d0530

Contents?: true

Size: 871 Bytes

Versions: 4

Compression:

Stored size: 871 Bytes

Contents

require 'fog/huaweicloud/models/collection'
require 'fog/network/huaweicloud/models/security_group_rule'

module Fog
  module Network
    class HuaweiCloud
      class SecurityGroupRules < Fog::HuaweiCloud::Collection
        attribute :filters

        model Fog::Network::HuaweiCloud::SecurityGroupRule

        def initialize(attributes)
          self.filters ||= {}
          super
        end

        def all(filters_arg = filters)
          filters = filters_arg
          load_response(service.list_security_group_rules(filters), 'security_group_rules')
        end

        def get(sec_group_rule_id)
          if sec_group_rule = service.get_security_group_rule(sec_group_rule_id).body['security_group_rule']
            new(sec_group_rule)
          end
        rescue Fog::Network::HuaweiCloud::NotFound
          nil
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/network/huaweicloud/models/security_group_rules.rb
fog-huaweicloud-0.0.2 lib/fog/network/huaweicloud/models/security_group_rules.rb
fog-huaweicloud-0.1.3 lib/fog/network/huaweicloud/models/security_group_rules.rb
fog-huaweicloud-0.1.2 lib/fog/network/huaweicloud/models/security_group_rules.rb