Class: Terraform::StatesFinder

Inherits:
Object
  • Object
show all
Defined in:
app/finders/terraform/states_finder.rb

Instance Method Summary collapse

Constructor Details

#initialize(project, current_user, params: {}) ⇒ StatesFinder

Returns a new instance of StatesFinder.


5
6
7
8
9
# File 'app/finders/terraform/states_finder.rb', line 5

def initialize(project, current_user, params: {})
  @project = project
  @current_user = current_user
  @params = params
end

Instance Method Details

#executeObject


11
12
13
14
15
16
17
18
# File 'app/finders/terraform/states_finder.rb', line 11

def execute
  return ::Terraform::State.none unless can_read_terraform_states?

  states = project.terraform_states
  states = states.with_name(params[:name]) if params[:name].present?

  states.ordered_by_name
end