Sha256: f75a94422e08ba0afec59838b1328dcf697d93d188c88f8713ab997d690eab96

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require 'fog/core/collection'
require 'fog/azurerm/models/resources/resource_group'

module Fog
  module Resources
    class AzureRM
      class ResourceGroups < Fog::Collection
        model Fog::Resources::AzureRM::ResourceGroup

        def all
          resource_groups = []
          service.list_resource_groups.each do |rg|
            hash = {}
            rg.instance_variables.each do |var|
              hash[var.to_s.delete('@')] = rg.instance_variable_get(var)
            end
            resource_groups << hash
          end
          load(resource_groups)
        end

        def get(identity)
          all.find { |f| f.name == identity }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.1 lib/fog/azurerm/models/resources/resource_groups.rb
fog-azure-rm-0.0.0 lib/fog/azurerm/models/resources/resource_groups.rb