Sha256: 10814b9e224d5c0b86ff4afd2c912bb78b4b3772df0fb7aedb312f4ada0a843d

Contents?: true

Size: 1.98 KB

Versions: 16

Compression:

Stored size: 1.98 KB

Contents

require 'hammer_cli_foreman/usergroup'

module HammerCLIForeman
  class ExternalUsergroup < HammerCLIForeman::Command
    resource :external_usergroups
    desc _("View and manage user group's external user groups")

    class ListCommand < HammerCLIForeman::ListCommand
      output do
        field :id, _("Id")
        field :name, _("Name")
        field :_auth_source, _("Auth source"), Fields::Reference
      end

      def extend_data(record)
        key = record.keys.find{ |k| k =~ /^auth_source/ }
        record['_auth_source'] = record[key]
        record
      end

      build_options
    end

    class InfoCommand < HammerCLIForeman::InfoCommand
      output ListCommand.output_definition

      def extend_data(record)
        key = record.keys.find{ |k| k =~ /^auth_source/ }
        record['_auth_source'] = record[key]
        record
      end

      build_options
    end

    class RefreshExternalUsergroupsCommand < HammerCLIForeman::ListCommand
      action :refresh
      command_name 'refresh'
      desc _("Refresh external user group")

      output do
        field :name, _("Name")
        field :_auth_source, _("Auth source")
      end

      def extend_data(record)
        key = record.keys.find{ |k| k =~ /^auth_source/ }
        record['_auth_source'] = record[key]
        record
      end

      build_options
    end


    class CreateCommand < HammerCLIForeman::CreateCommand
      success_message _("External user group created")
      failure_message _("Could not create external user group")

      build_options
    end


    class UpdateCommand < HammerCLIForeman::UpdateCommand
      success_message _("External user group updated")
      failure_message _("Could not update external user group")

      build_options
    end


    class DeleteCommand < HammerCLIForeman::DeleteCommand
      success_message _("External user group deleted")
      failure_message _("Could not delete the external user group")

      build_options
    end

    autoload_subcommands
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
hammer_cli_foreman-0.11.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.10.2 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.10.1 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.10.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.9.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.8.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.7.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.6.2 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.6.1 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.6.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.5.1 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.5.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.4.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.3.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.2.0 lib/hammer_cli_foreman/external_usergroup.rb
hammer_cli_foreman-0.1.4 lib/hammer_cli_foreman/external_usergroup.rb