Sha256: bae74ae440e62c5fc72165323ee84bfcaa2f8e63903f57158f5c9fb903fd4cb5

Contents?: true

Size: 807 Bytes

Versions: 6

Compression:

Stored size: 807 Bytes

Contents

require 'fog/core/collection'
require 'fog/aliyun/models/compute/security_group'

module Fog
  module Compute
    class Aliyun
      class SecurityGroups < Fog::Collection
        model Fog::Compute::Aliyun::SecurityGroup

        def all(options = {})
          data = Fog::JSON.decode(service.list_security_groups(options).body)['SecurityGroups']['SecurityGroup']
          load(data)
          # ['Images']['Image']
        end

        def get(security_group_id)
          if security_group_id
            data = self.class.new(service: service).all
            result = nil
            data.each do |i|
              if i.id == security_group_id
                result = i
                break
              end
            end
            result
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
fog-aliyun-0.3.0 lib/fog/aliyun/models/compute/security_groups.rb
fog-aliyun-0.2.2 lib/fog/aliyun/models/compute/security_groups.rb
fog-xiaozhu-0.2.2 lib/fog/aliyun/models/compute/security_groups.rb
fog-xiaozhu-0.2.1 lib/fog/aliyun/models/compute/security_groups.rb
fog-aliyun-0.2.1 lib/fog/aliyun/models/compute/security_groups.rb
fog-aliyun-0.2.0 lib/fog/aliyun/models/compute/security_groups.rb