Sha256: bd79d48021f817873a846eb65f2bf5297c94f7f0fdf370cab695a0c790e4d7b4

Contents?: true

Size: 849 Bytes

Versions: 4

Compression:

Stored size: 849 Bytes

Contents

# frozen_string_literal: true

module Foreman
  module Controller
    module Parameters
      module ResourceQuota
        extend ActiveSupport::Concern

        class_methods do
          def resource_quota_params_filter
            Foreman::ParameterFilter.new(::ForemanResourceQuota::ResourceQuota).tap do |filter|
              filter.permit :name
              filter.permit :description
              filter.permit :cpu_cores
              filter.permit :memory_mb
              filter.permit :disk_gb
            end
          end
        end

        def resource_quota_params
          param_name = parameter_filter_context.api? ? 'resource_quota' : 'foreman_resource_quota_resource_quota'
          self.class.resource_quota_params_filter.filter_params(params, parameter_filter_context, param_name)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_resource_quota-0.3.1 app/controllers/concerns/foreman/controller/parameters/resource_quota.rb
foreman_resource_quota-0.3.0 app/controllers/concerns/foreman/controller/parameters/resource_quota.rb
foreman_resource_quota-0.2.0 app/controllers/concerns/foreman/controller/parameters/resource_quota.rb
foreman_resource_quota-0.1.0 app/controllers/concerns/foreman/controller/parameters/resource_quota.rb