Sha256: caf65be0b1773590c4ccd72cfab7cc910679b57e8c08e6b3ee88b6d5b76565ea

Contents?: true

Size: 1.24 KB

Versions: 28

Compression:

Stored size: 1.24 KB

Contents

module Fog
  module Resources
    class AzureRM
      # This class is giving implementation of all/list and get.
      class AzureResources < Fog::Collection
        attribute :tag_name
        attribute :tag_value
        model Fog::Resources::AzureRM::AzureResource

        def all
          unless tag_name.nil? && tag_value.nil?
            resources = []
            service.list_tagged_resources(tag_name, tag_value).each do |resource|
              resources << Fog::Resources::AzureRM::AzureResource.parse(resource)
            end
            resources.inspect
            return load(resources)
          end
          nil
        end

        def get(resource_id)
          all.find { |f| f.id == resource_id }
        end

        def check_azure_resource_exists(resource_id, api_version)
          service.check_azure_resource_exists(resource_id, api_version)
        end

        def list_resources_in_resource_group(resource_group_name)
          resources = []
          service.list_resources_in_resource_group(resource_group_name).each do |resource|
            resources.push(Fog::Resources::AzureRM::AzureResource.parse(resource))
          end
          load(resources)
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 3 rubygems

Version Path
gitlab-fog-azure-rm-1.8.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.7.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.6.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.5.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.4.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.3.0 lib/fog/azurerm/models/resources/azure_resources.rb
fog-azure-rm-0.6.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.2.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.1.1 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.0.1 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-1.0.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-0.9.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-0.8.1 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-0.8.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-0.7.0 lib/fog/azurerm/models/resources/azure_resources.rb
gitlab-fog-azure-rm-0.6.0 lib/fog/azurerm/models/resources/azure_resources.rb
fog-azure-rm-0.5.3 lib/fog/azurerm/models/resources/azure_resources.rb
fog-azure-rm-0.5.2 lib/fog/azurerm/models/resources/azure_resources.rb
far-gem-0.5.6 lib/fog/azurerm/models/resources/azure_resources.rb
fog-azure-rm-0.5.1 lib/fog/azurerm/models/resources/azure_resources.rb