Sha256: d8bf15c5d9766527ab6fc19d3cd5c49bd0a5b523d3656a93e7a6524c69d6cf2e
Contents?: true
Size: 1.82 KB
Versions: 8
Compression:
Stored size: 1.82 KB
Contents
# frozen_string_literal: true module Api module V2 class VaultConnectionsController < V2::BaseController include Api::Version2 include ForemanVault::Controller::Parameters::VaultConnection before_action :find_resource, only: [:show, :update, :destroy] api :GET, '/vault_connections/', N_('List VaultConnections') param_group :search_and_pagination, ::Api::V2::BaseController def index @vault_connections = resource_scope_for_index end api :GET, '/vault_connections/:id', N_('Show VaultConnection details') param :id, :identifier, required: true def show; end def_param_group :vault_connection do param :vault_connection, Hash, action_aware: true, required: true do param :name, String, required: true param :url, String, required: true param :token, String, required: true end end api :POST, '/vault_connections/', N_('Create a Vault Connection') param_group :vault_connection, as: :create def create @vault_connection = VaultConnection.new(vault_connection_params) process_response @vault_connection.save end api :PUT, '/vault_connections/:id', N_('Update a VaultConnection') param :id, :identifier, required: true param_group :vault_connection def update process_response @vault_connection.update(vault_connection_params) end api :DELETE, '/vault_connections/:id', N_('Delete a VaultConnection') param :id, :identifier, required: true def destroy process_response @vault_connection.destroy end private # Overload this method to avoid using search_for method def resource_scope_for_index(options = {}) resource_scope(options).paginate(paginate_options) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems