Class: TerraformEnterprise::Commands::WorkspacesCommand
- Defined in:
- lib/terraform-enterprise/commands/workspaces_command.rb
Constant Summary collapse
Instance Method Summary collapse
- #create(name) ⇒ Object
- #delete(name) ⇒ Object
- #get(name) ⇒ Object
- #list ⇒ Object
- #lock(id) ⇒ Object
- #unlock(id) ⇒ Object
- #update(name) ⇒ Object
Instance Method Details
#create(name) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/terraform-enterprise/commands/workspaces_command.rb', line 25 def create(name) params = { organization: [:organization], name: name, 'working-directory' => [:working_directory] || '', } if [:repo] && [:oauth_token] repo = {} repo['branch'] = [:branch] || '' repo['identifier'] = [:repo] repo['oauth-token-id'] = [:oauth_token] repo['ingress-submodules'] = [:ingress_submodules] || false params['vcs-repo'] = repo end params['migration-environment'] = [:import_legacy_environment] if [:import_legacy_environment] params['terraform_version'] = [:terraform_version] if [:terraform_version] render client.workspaces.create(params), except:[:permissions, :actions, :environment] end |
#delete(name) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/terraform-enterprise/commands/workspaces_command.rb', line 57 def delete(name) params = { organization: [:organization], workspace: name } render client.workspaces.delete(params), except:[:permissions, :actions, :environment] end |
#get(name) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/terraform-enterprise/commands/workspaces_command.rb', line 47 def get(name) params = { organization: [:organization], workspace: name } render client.workspaces.get(params), except:[:permissions, :actions, :environment] end |
#list ⇒ Object
12 13 14 |
# File 'lib/terraform-enterprise/commands/workspaces_command.rb', line 12 def list render client.workspaces.list(), except:[:permissions, :actions, :environment, 'created-at'] end |
#lock(id) ⇒ Object
77 78 79 |
# File 'lib/terraform-enterprise/commands/workspaces_command.rb', line 77 def lock(id) render client.workspaces.action(action: :lock, id: id), except:[:permissions, :actions, :environment] end |
#unlock(id) ⇒ Object
82 83 84 |
# File 'lib/terraform-enterprise/commands/workspaces_command.rb', line 82 def unlock(id) render client.workspaces.action(action: :unlock, id: id), except:[:permissions, :actions, :environment] end |
#update(name) ⇒ Object
70 71 72 73 74 |
# File 'lib/terraform-enterprise/commands/workspaces_command.rb', line 70 def update(name) params = params[:workspace] = name render client.workspaces.update(params), except:[:permissions, :actions, :environment] end |