Sha256: d90d853777392af5fa25b190da3101f3f4a360a0e67bc9a992e1ea55ffc78ade

Contents?: true

Size: 1.41 KB

Versions: 3

Compression:

Stored size: 1.41 KB

Contents

module ForemanAzureRM
  module Concerns
    module ComputeResourcesControllerExtensions
      include Api::Version2
      include Foreman::Controller::Parameters::ComputeResource

      def available_resource_groups
        compute_resource = ComputeResource.find_by_id(params[:id])
        @available_resource_groups = compute_resource.available_resource_groups
        render :available_resource_groups, :layout => 'api/v2/layouts/index_layout'
      end

      def available_sizes
        compute_resource = ComputeResource.find_by_id(params[:id])
        @available_sizes = compute_resource.vm_sizes(params[:region_id])
        render :available_sizes, :layout => 'api/v2/layouts/index_layout'
      end

      def available_subnets
        compute_resource = ComputeResource.find_by_id(params[:id])
        @available_subnets = compute_resource.available_subnets
        render :available_subnets, :layout => 'api/v2/layouts/index_layout'
      end

      def available_vnets
        compute_resource = ComputeResource.find_by_id(params[:id])
        @available_vnets = compute_resource.available_vnets
        render :available_vnets, :layout => 'api/v2/layouts/index_layout'
      end

      def action_permission
        case params[:action]
          when 'available_resource_groups', 'available_sizes', 'available_subnets', 'available_vnets'
            :view
          else
            super
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
foreman_azure_rm-2.0.0.pre1 app/controllers/foreman_azure_rm/concerns/compute_resources_controller_extensions.rb
foreman_azure_rm-1.3.1 app/controllers/foreman_azure_rm/concerns/compute_resources_controller_extensions.rb
foreman_azure_rm-1.3.0 app/controllers/foreman_azure_rm/concerns/compute_resources_controller_extensions.rb