Sha256: b0e4e2bd1373ef1c1c7feba205f0cbe873b1e6adfe56988273077d00641f0e77

Contents?: true

Size: 1.47 KB

Versions: 5

Compression:

Stored size: 1.47 KB

Contents

# encoding: utf-8

require 'resources/azure/azure_backend'
require 'utils/filter'

module Inspec::Resources
  class AzureGenericResource < AzureResourceBase
    name 'azure_generic_resource'

    desc '
      Inspec Resource to interrogate any Resource type in Azure
    '

    supports platform: 'azure'

    attr_accessor :filter, :total, :counts, :name, :type, :location, :probes

    def initialize(opts = {})
      # Call the parent class constructor
      super(opts)

      # Get the resource group
      resource_group

      # Get the resources
      resources

      # Create the tag methods
      create_tag_methods
    end

    # Define the filter table so that it can be interrogated
    @filter = FilterTable.create
    @filter.add_accessor(:count)
           .add_accessor(:entries)
           .add_accessor(:where)
           .add_accessor(:contains)
           .add(:exist?, field: 'exist?')
           .add(:type, field: 'type')
           .add(:name, field: 'name')
           .add(:location, field: 'location')
           .add(:properties, field: 'properties')

    @filter.connect(self, :probes)

    def parse_resource(resource)
      # return a hash of information
      parsed = {
        'location' => resource.location,
        'name' => resource.name,
        'type' => resource.type,
        'exist?' => true,
        'properties' => AzureResourceProbe.new(resource.properties),
      }

      parsed
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inspec-2.1.81 lib/resources/azure/azure_generic_resource.rb
inspec-2.1.21 lib/resources/azure/azure_generic_resource.rb
inspec-2.1.10 lib/resources/azure/azure_generic_resource.rb
inspec-2.0.32 lib/resources/azure/azure_generic_resource.rb
inspec-2.0.17 lib/resources/azure/azure_generic_resource.rb