Sha256: d0d267c1d854aa009a92032ac4288995585060ca393bd27d1f087c51fd7d3c3f

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

require 'hammer_cli'
require 'foreman_api'

module HammerCLIForeman

  class Environment < HammerCLI::AbstractCommand

    class ListCommand < HammerCLIForeman::ListCommand
      resource ForemanApi::Resources::Environment, "index"

      output do
        from "environment" do
          field :id, "Id"
          field :name, "Name"
        end
      end

      apipie_options
    end


    class InfoCommand < HammerCLIForeman::InfoCommand
      resource ForemanApi::Resources::Environment, "show"

      output ListCommand.output_definition do
        from "environment" do
          field :created_at, "Created at", Fields::Date
          field :updated_at, "Updated at", Fields::Date
        end
      end

    end


    class CreateCommand < HammerCLIForeman::CreateCommand

      success_message "Environment created"
      failure_message "Could not create the environment"
      resource ForemanApi::Resources::Environment, "create"

      apipie_options
    end


    class UpdateCommand < HammerCLIForeman::UpdateCommand

      success_message "Environment updated"
      failure_message "Could not update the environment"
      resource ForemanApi::Resources::Environment, "update"

      apipie_options
    end


    class DeleteCommand < HammerCLIForeman::DeleteCommand

      success_message "Environment deleted"
      failure_message "Could not delete the environment"
      resource ForemanApi::Resources::Environment, "destroy"

      apipie_options
    end

    autoload_subcommands
  end

end

HammerCLI::MainCommand.subcommand 'environment', "Manipulate Foreman's environments.", HammerCLIForeman::Environment

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hammer_cli_foreman-0.0.10 lib/hammer_cli_foreman/environment.rb
hammer_cli_foreman-0.0.9 lib/hammer_cli_foreman/environment.rb
hammer_cli_foreman-0.0.8 lib/hammer_cli_foreman/environment.rb
hammer_cli_foreman-0.0.7 lib/hammer_cli_foreman/environment.rb
hammer_cli_foreman-0.0.6 lib/hammer_cli_foreman/environment.rb
hammer_cli_foreman-0.0.5 lib/hammer_cli_foreman/environment.rb