commands

package
v0.0.0-...-756e720 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2020 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodPassword = "P"
	MethodToken    = "T"
	MethodMFA      = "M"
)
View Source
const (
	InstanceURL      = "http://localhost:8065"
	SysadminUsername = "sysadmin"
	SysadminPass     = "Sys@dmin-sample1"
	UserUsername     = "user-1"
	UserPass         = "SampleUs@r-1"
)

Variables

View Source
var (
	BuildHash = "dev mode"
	Version   = "5.24.0"
)
View Source
var AddChannelUsersCmd = &cobra.Command{
	Use:     "add [channel] [users]",
	Short:   "Add users to channel",
	Long:    "Add some users to channel",
	Example: "  channel add myteam:mychannel user@example.com username",
	RunE:    withClient(addChannelUsersCmdF),
}
View Source
var AddPermissionsCmd = &cobra.Command{
	Use:     "add [role] [permission...]",
	Short:   "Add permissions to a role (EE Only)",
	Long:    `Add one or more permissions to an existing role (Only works in Enterprise Edition).`,
	Example: `  permissions add system_user list_open_teams`,
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(addPermissionsCmdF),
}
View Source
var ArchiveChannelsCmd = &cobra.Command{
	Use:   "archive [channels]",
	Short: "Archive channels",
	Long: `Archive some channels.
Archive a channel along with all related information including posts from the database.
Channels can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: "  channel archive myteam:mychannel",
	RunE:    withClient(archiveChannelsCmdF),
}
View Source
var ArchiveTeamsCmd = &cobra.Command{
	Use:   "archive [teams]",
	Short: "Archive teams",
	Long: `Archive some teams.
Archives a team along with all related information including posts from the database.`,
	Example: "  team archive myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(archiveTeamsCmdF),
}
View Source
var AuthCmd = &cobra.Command{
	Use:   "auth",
	Short: "Manages the credentials of the remote 77673 instances",
}
View Source
var BashCmd = &cobra.Command{
	Use:   "bash",
	Short: "Generates the bash autocompletion scripts",
	Long: `To load completion, run

. <(mmctl completion bash)

To configure your bash shell to load completions for each session, add the above line to your ~/.bashrc
`,
	RunE: bashCmdF,
}
View Source
var BotCmd = &cobra.Command{
	Use:   "bot",
	Short: "Management of bots",
}
View Source
var ChannelCmd = &cobra.Command{
	Use:   "channel",
	Short: "Management of channels",
}
View Source
var ChannelCreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a channel",
	Long:  `Create a channel.`,
	Example: `  channel create --team myteam --name mynewchannel --display_name "My New Channel"
  channel create --team myteam --name mynewprivatechannel --display_name "My New Private Channel" --private`,
	RunE: withClient(createChannelCmdF),
}
View Source
var ChannelGroupCmd = &cobra.Command{
	Use:   "channel",
	Short: "Management of channel groups",
}
View Source
var ChannelGroupDisableCmd = &cobra.Command{
	Use:     "disable [team]:[channel]",
	Short:   "Disables group constrains in the specified channel",
	Example: "  group channel disable myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(channelGroupDisableCmdF),
}
View Source
var ChannelGroupEnableCmd = &cobra.Command{
	Use:     "enable [team]:[channel]",
	Short:   "Enables group constrains in the specified channel",
	Example: "  group channel enable myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(channelGroupEnableCmdF),
}
View Source
var ChannelGroupListCmd = &cobra.Command{
	Use:     "list [team]:[channel]",
	Short:   "List channel groups",
	Long:    "List the groups associated with a channel",
	Example: "  group channel list myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(channelGroupListCmdF),
}
View Source
var ChannelGroupStatusCmd = &cobra.Command{
	Use:     "status [team]:[channel]",
	Short:   "Show's the group constrain status for the specified channel",
	Example: "  group channel status myteam:mychannel",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(channelGroupStatusCmdF),
}

ChannelGroupStatusCmd is a command which outputs group constrain status for a channel

View Source
var ChannelRenameCmd = &cobra.Command{
	Use:   "rename [channel]",
	Short: "Rename channel",
	Long:  `Rename an existing channel.`,
	Example: `  channel rename myteam:oldchannel --name 'new-channel' --display_name 'New Display Name'
  channel rename myteam:oldchannel --name 'new-channel'
  channel rename myteam:oldchannel --display_name 'New Display Name'`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(renameChannelCmdF),
}

ChannelRenameCmd is used to change name and/or display name of an existing channel.

View Source
var CleanCmd = &cobra.Command{
	Use:     "clean",
	Short:   "Clean all credentials",
	Long:    "Clean the currently stored credentials",
	Example: `  auth clean`,
	RunE:    cleanCmdF,
}
View Source
var CommandArchiveCmd = &cobra.Command{
	Use:     "archive [commandID]",
	Short:   "Archive a slash command",
	Long:    `Archive a slash command. Commands can be specified by command ID.`,
	Example: `  command archive commandID`,
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(archiveCommandCmdF),
}
View Source
var CommandCmd = &cobra.Command{
	Use:   "command",
	Short: "Management of slash commands",
}
View Source
var CommandCreateCmd = &cobra.Command{
	Use:     "create [team]",
	Short:   "Create a custom slash command",
	Long:    `Create a custom slash command for the specified team.`,
	Args:    cobra.MinimumNArgs(1),
	Example: `  command create myteam --title MyCommand --description "My Command Description" --trigger-word mycommand --url http://localhost:8000/my-slash-handler --creator myusername --response-username my-bot-username --icon http://localhost:8000/my-slash-handler-bot-icon.png --autocomplete --post`,
	RunE:    withClient(createCommandCmdF),
}
View Source
var CommandDeleteCmd = &cobra.Command{
	Use:        "delete [commandID]",
	Short:      "Delete a slash command",
	Long:       `Delete a slash command. Commands can be specified by command ID.`,
	Example:    `  command delete commandID`,
	Deprecated: "please use \"archive\" instead",
	Args:       cobra.ExactArgs(1),
	RunE:       withClient(archiveCommandCmdF),
}
View Source
var CommandListCmd = &cobra.Command{
	Use:     "list [teams]",
	Short:   "List all commands on specified teams.",
	Long:    `List all commands on specified teams.`,
	Example: ` command list myteam`,
	RunE:    withClient(listCommandCmdF),
}
View Source
var CommandModifyCmd = &cobra.Command{
	Use:     "modify [commandID]",
	Short:   "Modify a slash command",
	Long:    `Modify a slash command. Commands can be specified by command ID.`,
	Args:    cobra.ExactArgs(1),
	Example: `  command modify commandID --title MyModifiedCommand --description "My Modified Command Description" --trigger-word mycommand --url http://localhost:8000/my-slash-handler --creator myusername --response-username my-bot-username --icon http://localhost:8000/my-slash-handler-bot-icon.png --autocomplete --post`,
	RunE:    withClient(modifyCommandCmdF),
}
View Source
var CommandMoveCmd = &cobra.Command{
	Use:     "move [team] [commandID]",
	Short:   "Move a slash command to a different team",
	Long:    `Move a slash command to a different team. Commands can be specified by command ID.`,
	Args:    cobra.ExactArgs(2),
	Example: `  command move newteam commandID`,
	RunE:    withClient(moveCommandCmdF),
}
View Source
var CommandShowCmd = &cobra.Command{
	Use:     "show [commandID]",
	Short:   "Show a custom slash command",
	Long:    `Show a custom slash command. Commands can be specified by command ID. Returns command ID, team ID, trigger word, display name and creator username.`,
	Args:    cobra.ExactArgs(1),
	Example: `  command show commandID`,
	RunE:    withClient(showCommandCmdF),
}
View Source
var CompletionCmd = &cobra.Command{
	Use:   "completion",
	Short: "Generates autocompletion scripts for bash and zsh",
}
View Source
var ConfigCmd = &cobra.Command{
	Use:   "config",
	Short: "Configuration",
}
View Source
var ConfigEditCmd = &cobra.Command{
	Use:     "edit",
	Short:   "Edit the config",
	Long:    "Opens the editor defined in the EDITOR environment variable to modify the server's configuration and then uploads it",
	Example: "config edit",
	Args:    cobra.NoArgs,
	RunE:    withClient(configEditCmdF),
}
View Source
var ConfigGetCmd = &cobra.Command{
	Use:     "get",
	Short:   "Get config setting",
	Long:    "Gets the value of a config setting by its name in dot notation.",
	Example: `config get SqlSettings.DriverName`,
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(configGetCmdF),
}
View Source
var ConfigResetCmd = &cobra.Command{
	Use:     "reset",
	Short:   "Reset config setting",
	Long:    "Resets the value of a config setting by its name in dot notation or a setting section. Accepts multiple values for array settings.",
	Example: "config reset SqlSettings.DriverName LogSettings",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(configResetCmdF),
}
View Source
var ConfigSetCmd = &cobra.Command{
	Use:     "set",
	Short:   "Set config setting",
	Long:    "Sets the value of a config setting by its name in dot notation. Accepts multiple values for array settings",
	Example: "config set SqlSettings.DriverName mysql",
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(configSetCmdF),
}
View Source
var ConfigShowCmd = &cobra.Command{
	Use:     "show",
	Short:   "Writes the server configuration to STDOUT",
	Long:    "Prints the server configuration and writes to STDOUT in JSON format.",
	Example: "config show",
	Args:    cobra.NoArgs,
	RunE:    withClient(configShowCmdF),
}
View Source
var CreateBotCmd = &cobra.Command{
	Use:     "create [username]",
	Short:   "Create bot",
	Long:    "Create bot.",
	Example: `  bot create testbot`,
	RunE:    withClient(botCreateCmdF),
	Args:    cobra.ExactArgs(1),
}
View Source
var CurrentCmd = &cobra.Command{
	Use:     "current",
	Short:   "Show current user credentials",
	Long:    "Show the currently stored user credentials",
	Example: `  auth current`,
	RunE:    currentCmdF,
}
View Source
var DeleteCmd = &cobra.Command{
	Use:     "delete [server name]",
	Short:   "Delete an credentials",
	Long:    "Delete an credentials by its name",
	Example: `  auth delete local-server`,
	Args:    cobra.ExactArgs(1),
	RunE:    deleteCmdF,
}
View Source
var DeleteTeamsCmd = &cobra.Command{
	Use:   "delete [teams]",
	Short: "Delete teams",
	Long: `Permanently delete some teams.
Permanently deletes a team along with all related information including posts from the database.`,
	Example: "  team delete myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(deleteTeamsCmdF),
}
View Source
var DocsCmd = &cobra.Command{
	Use:   "docs",
	Short: "Generates mmctl documentation",
	Args:  cobra.NoArgs,
	RunE:  docsCmdF,
}
View Source
var GenerateUserTokenCmd = &cobra.Command{
	Use:     "generate [user] [description]",
	Short:   "Generate token for a user",
	Long:    "Generate token for a user",
	Example: "  generate testuser test-token",
	RunE:    withClient(generateTokenForAUserCmdF),
	Args:    cobra.ExactArgs(2),
}
View Source
var GroupCmd = &cobra.Command{
	Use:   "group",
	Short: "Management of groups",
}
View Source
var LdapCmd = &cobra.Command{
	Use:   "ldap",
	Short: "LDAP related utilities",
}
View Source
var LdapSyncCmd = &cobra.Command{
	Use:     "sync",
	Short:   "Synchronize now",
	Long:    "Synchronize all LDAP users and groups now.",
	Example: "  ldap sync",
	RunE:    withClient(ldapSyncCmdF),
}
View Source
var LicenseCmd = &cobra.Command{
	Use:   "license",
	Short: "Licensing commands",
}
View Source
var ListChannelsCmd = &cobra.Command{
	Use:   "list [teams]",
	Short: "List all channels on specified teams.",
	Long: `List all channels on specified teams.
Archived channels are appended with ' (archived)'.`,
	Example: "  channel list myteam",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(listChannelsCmdF),
}

ListChannelsCmd is a command which lists all the channels of team(s) in a server.

View Source
var ListCmd = &cobra.Command{
	Use:     "list",
	Short:   "Lists the credentials",
	Long:    "Print a list of the registered credentials",
	Example: `  auth list`,
	RunE:    listCmdF,
}
View Source
var ListLdapGroupsCmd = &cobra.Command{
	Use:     "list-ldap",
	Short:   "List LDAP groups",
	Example: "  group list-ldap",
	Args:    cobra.NoArgs,
	RunE:    withClient(listLdapGroupsCmdF),
}
View Source
var ListTeamsCmd = &cobra.Command{
	Use:     "list",
	Short:   "List all teams",
	Long:    `List all teams on the server.`,
	Example: "  team list",
	RunE:    withClient(listTeamsCmdF),
}
View Source
var ListUserTokensCmd = &cobra.Command{
	Use:     "list [user]",
	Short:   "List users tokens",
	Long:    "List the tokens of a user",
	Example: "  user tokens testuser",
	RunE:    withClient(listTokensOfAUserCmdF),
	Args:    cobra.ExactArgs(1),
}
View Source
var ListUsersCmd = &cobra.Command{
	Use:     "list",
	Short:   "List users",
	Long:    "List all users",
	Example: "  user list",
	RunE:    withClient(listUsersCmdF),
	Args:    cobra.NoArgs,
}
View Source
var LoginCmd = &cobra.Command{
	Use:   "login [instance url] --name [server name] --username [username] --password [password]",
	Short: "Login into an instance",
	Long:  "Login into an instance and store credentials",
	Example: `  auth login https://mattermost.example.com
  auth login https://mattermost.example.com --name local-server --username sysadmin --password mysupersecret
  auth login https://mattermost.example.com --name local-server --username sysadmin --password mysupersecret --mfa-token 123456
  auth login https://mattermost.example.com --name local-server --access-token myaccesstoken`,
	Args: cobra.ExactArgs(1),
	RunE: loginCmdF,
}
View Source
var LogsCmd = &cobra.Command{
	Use:   "logs",
	Short: "Display logs in a human-readable format",
	RunE:  withClient(logsCmdF),
}
View Source
var MakeChannelPrivateCmd = &cobra.Command{
	Use:   "make_private [channel]",
	Short: "Set a channel's type to private",
	Long: `Set the type of a channel from public to private.
Channel can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: "  channel make_private myteam:mychannel",
	RunE:    withClient(makeChannelPrivateCmdF),
}
View Source
var ModifyChannelCmd = &cobra.Command{
	Use:   "modify [channel] [flags]",
	Short: "Modify a channel's public/private type",
	Long: `Change the public/private type of a channel.
Channel can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: `  channel modify myteam:mychannel --private
  channel modify channelId --public`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(modifyChannelCmdF),
}
View Source
var PermissionsCmd = &cobra.Command{
	Use:   "permissions",
	Short: "Management of permissions and roles",
}
View Source
var PluginAddCmd = &cobra.Command{
	Use:     "add [plugins]",
	Short:   "Add plugins",
	Long:    "Add plugins to your Mattermost server.",
	Example: `  plugin add hovercardexample.tar.gz pluginexample.tar.gz`,
	RunE:    withClient(pluginAddCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var PluginCmd = &cobra.Command{
	Use:   "plugin",
	Short: "Management of plugins",
}
View Source
var PluginDeleteCmd = &cobra.Command{
	Use:     "delete [plugins]",
	Short:   "Delete plugins",
	Long:    "Delete previously uploaded plugins from your Mattermost server.",
	Example: `  plugin delete hovercardexample pluginexample`,
	RunE:    withClient(pluginDeleteCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var PluginDisableCmd = &cobra.Command{
	Use:     "disable [plugins]",
	Short:   "Disable plugins",
	Long:    "Disable plugins. Disabled plugins are immediately removed from the user interface and logged out of all sessions.",
	Example: `  plugin disable hovercardexample pluginexample`,
	RunE:    withClient(pluginDisableCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var PluginEnableCmd = &cobra.Command{
	Use:     "enable [plugins]",
	Short:   "Enable plugins",
	Long:    "Enable plugins for use on your Mattermost server.",
	Example: `  plugin enable hovercardexample pluginexample`,
	RunE:    withClient(pluginEnableCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var PluginListCmd = &cobra.Command{
	Use:     "list",
	Short:   "List plugins",
	Long:    "List all enabled and disabled plugins installed on your Mattermost server.",
	Example: `  plugin list`,
	RunE:    withClient(pluginListCmdF),
}
View Source
var PostCmd = &cobra.Command{
	Use:   "post",
	Short: "Management of posts",
}
View Source
var PostCreateCmd = &cobra.Command{
	Use:     "create",
	Short:   "Create a post",
	Example: `  post create myteam:mychannel --message "some text for the post"`,
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(postCreateCmdF),
}
View Source
var PostListCmd = &cobra.Command{
	Use:   "list",
	Short: "List posts for a channel",
	Example: `  post list myteam:mychannel
  post list myteam:mychannel --number 20`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(postListCmdF),
}
View Source
var RemoveChannelUsersCmd = &cobra.Command{
	Use:   "remove [channel] [users]",
	Short: "Remove users from channel",
	Long:  "Remove some users from channel",
	Example: `  channel remove myteam:mychannel user@example.com username
  channel remove myteam:mychannel --all-users`,
	RunE: withClient(removeChannelUsersCmdF),
}
View Source
var RemoveLicenseCmd = &cobra.Command{
	Use:     "remove",
	Short:   "Remove the current license.",
	Long:    "Remove the current license and leave mattermost in Team Edition.",
	Example: "  license remove",
	RunE:    withClient(removeLicenseCmdF),
}
View Source
var RemovePermissionsCmd = &cobra.Command{
	Use:     "remove [role] [permission...]",
	Short:   "Remove permissions from a role (EE Only)",
	Long:    `Remove one or more permissions from an existing role (Only works in Enterprise Edition).`,
	Example: `  permissions remove system_user list_open_teams`,
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(removePermissionsCmdF),
}
View Source
var RenameTeamCmd = &cobra.Command{
	Use:     "rename [team]",
	Short:   "Rename team",
	Long:    "Rename an existing team",
	Example: "  team rename old-team --display_name 'New Display Name'",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(renameTeamCmdF),
}

RenameTeamCmd is the command to rename team along with its display name

View Source
var RenewCmd = &cobra.Command{
	Use:     "renew",
	Short:   "Renews a set of credentials",
	Long:    "Renews the credentials for a given server",
	Example: `  auth renew local-server`,
	Args:    cobra.ExactArgs(1),
	RunE:    renewCmdF,
}
View Source
var ResetUserMfaCmd = &cobra.Command{
	Use:   "resetmfa [users]",
	Short: "Turn off MFA",
	Long: `Turn off multi-factor authentication for a user.
If MFA enforcement is enabled, the user will be forced to re-enable MFA as soon as they login.`,
	Example: "  user resetmfa user@example.com",
	RunE:    withClient(resetUserMfaCmdF),
}
View Source
var RestoreChannelsCmd = &cobra.Command{
	Use:   "restore [channels]",
	Short: "Restore some channels",
	Long: `Restore a previously deleted channel
Channels can be specified by [team]:[channel]. ie. myteam:mychannel or by channel ID.`,
	Example: "  channel restore myteam:mychannel",
	RunE:    withClient(restoreChannelsCmdF),
}
View Source
var RevokeUserTokenCmd = &cobra.Command{
	Use:     "revoke [token-ids]",
	Short:   "Revoke tokens for a user",
	Long:    "Revoke tokens for a user",
	Example: "  revoke testuser test-token-id",
	RunE:    withClient(revokeTokenForAUserCmdF),
	Args:    cobra.MinimumNArgs(1),
}
View Source
var RootCmd = &cobra.Command{
	Use:               "mmctl",
	Short:             "Remote client for the Open Source, self-hosted Slack-alternative",
	Long:              `Mattermost offers workplace messaging across web, PC and phones with archiving, search and integration with your existing systems. Documentation available at https://docs.mattermost.com`,
	DisableAutoGenTag: true,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		format := viper.GetString("format")
		printer.SetFormat(format)
	},
	PersistentPostRun: func(cmd *cobra.Command, args []string) {
		printer.Flush()
	},
}
View Source
var SearchChannelCmd = &cobra.Command{
	Use:   "search [channel]\n  mmctl search --team [team] [channel]",
	Short: "Search a channel",
	Long: `Search a channel by channel name.
Channel can be specified by team. ie. --team myTeam myChannel or by team ID.`,
	Example: `  channel search myChannel
  channel search --team myTeam myChannel`,
	Args: cobra.ExactArgs(1),
	RunE: withClient(searchChannelCmdF),
}
View Source
var SearchTeamCmd = &cobra.Command{
	Use:     "search [teams]",
	Short:   "Search for teams",
	Long:    "Search for teams based on name",
	Example: "  team search team1",
	Args:    cobra.MinimumNArgs(1),
	RunE:    withClient(searchTeamCmdF),
}
View Source
var SearchUserCmd = &cobra.Command{
	Use:     "search [users]",
	Short:   "Search for users",
	Long:    "Search for users based on username, email, or user ID.",
	Example: "  user search user1@mail.com user2@mail.com",
	RunE:    withClient(searchUserCmdF),
}
View Source
var SendPasswordResetEmailCmd = &cobra.Command{
	Use:     "reset_password [users]",
	Short:   "Send users an email to reset their password",
	Long:    "Send users an email to reset their password",
	Example: "  user reset_password user@example.com",
	RunE:    withClient(sendPasswordResetEmailCmdF),
}
View Source
var SetCmd = &cobra.Command{
	Use:     "set [server name]",
	Short:   "Set the credentials to use",
	Long:    "Set an credentials to use in the following commands",
	Example: `  auth set local-server`,
	Args:    cobra.ExactArgs(1),
	RunE:    setCmdF,
}
View Source
var ShowRoleCmd = &cobra.Command{
	Use:     "show [role_name]",
	Short:   "Show the role information",
	Long:    "Show all the information about a role.",
	Example: `  permissions show system_user`,
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(showRoleCmdF),
}
View Source
var SystemClearBusyCmd = &cobra.Command{
	Use:     "clearbusy",
	Short:   "Clears the busy state",
	Long:    `Clear the busy state, which re-enables non-critical services.`,
	Example: `  system clearbusy`,
	Args:    cobra.NoArgs,
	RunE:    withClient(clearBusyCmdF),
}
View Source
var SystemCmd = &cobra.Command{
	Use:   "system",
	Short: "System management",
	Long:  `System management commands for interacting with the server state and configuration.`,
}
View Source
var SystemGetBusyCmd = &cobra.Command{
	Use:     "getbusy",
	Short:   "Get the current busy state",
	Long:    `Gets the server busy state (high load) and timestamp corresponding to when the server busy flag will be automatically cleared.`,
	Example: `  system getbusy`,
	Args:    cobra.NoArgs,
	RunE:    withClient(getBusyCmdF),
}
View Source
var SystemSetBusyCmd = &cobra.Command{
	Use:     "setbusy -s [seconds]",
	Short:   "Set the busy state to true",
	Long:    `Set the busy state to true for the specified number of seconds, which disables non-critical services.`,
	Example: `  system setbusy -s 3600`,
	Args:    cobra.NoArgs,
	RunE:    withClient(setBusyCmdF),
}
View Source
var TeamCmd = &cobra.Command{
	Use:   "team",
	Short: "Management of teams",
}
View Source
var TeamCreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a team",
	Long:  `Create a team.`,
	Example: `  team create --name mynewteam --display_name "My New Team"
  team create --name private --display_name "My New Private Team" --private`,
	RunE: withClient(createTeamCmdF),
}
View Source
var TeamGroupCmd = &cobra.Command{
	Use:   "team",
	Short: "Management of team groups",
}
View Source
var TeamGroupDisableCmd = &cobra.Command{
	Use:     "disable [team]",
	Short:   "Disables group constrains in the specified team",
	Example: "  group team disable myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(teamGroupDisableCmdF),
}
View Source
var TeamGroupEnableCmd = &cobra.Command{
	Use:     "enable [team]",
	Short:   "Enables group constrains in the specified team",
	Example: "  group team enable myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(teamGroupEnableCmdF),
}
View Source
var TeamGroupListCmd = &cobra.Command{
	Use:     "list [team]",
	Short:   "List team groups",
	Long:    "List the groups associated with a team",
	Example: "  group team list myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(teamGroupListCmdF),
}
View Source
var TeamGroupStatusCmd = &cobra.Command{
	Use:     "status [team]",
	Short:   "Show's the group constrain status for the specified team",
	Example: "  group team status myteam",
	Args:    cobra.ExactArgs(1),
	RunE:    withClient(teamGroupStatusCmdF),
}
View Source
var TeamUsersAddCmd = &cobra.Command{
	Use:     "add [team] [users]",
	Short:   "Add users to team",
	Long:    "Add some users to team",
	Example: "  team add myteam user@example.com username",
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(teamUsersAddCmdF),
}
View Source
var TeamUsersCmd = &cobra.Command{
	Use:   "users",
	Short: "Management of team users",
}
View Source
var TeamUsersRemoveCmd = &cobra.Command{
	Use:     "remove [team] [users]",
	Short:   "Remove users from team",
	Long:    "Remove some users from team",
	Example: "  team remove myteam user@example.com username",
	Args:    cobra.MinimumNArgs(2),
	RunE:    withClient(teamUsersRemoveCmdF),
}
View Source
var TokenCmd = &cobra.Command{
	Use:   "token",
	Short: "manage users' access tokens",
}
View Source
var UploadLicenseCmd = &cobra.Command{
	Use:     "upload [license]",
	Short:   "Upload a license.",
	Long:    "Upload a license. Replaces current license.",
	Example: "  license upload /path/to/license/mylicensefile.mattermost-license",
	RunE:    withClient(uploadLicenseCmdF),
}
View Source
var UserActivateCmd = &cobra.Command{
	Use:   "activate [emails, usernames, userIds]",
	Short: "Activate users",
	Long:  "Activate users that have been deactivated.",
	Example: `  user activate user@example.com
  user activate username`,
	RunE: withClient(userActivateCmdF),
	Args: cobra.MinimumNArgs(1),
}
View Source
var UserCmd = &cobra.Command{
	Use:   "user",
	Short: "Management of users",
}
View Source
var UserCreateCmd = &cobra.Command{
	Use:     "create",
	Short:   "Create a user",
	Long:    "Create a user",
	Example: `  user create --email user@example.com --username userexample --password Password1`,
	RunE:    withClient(userCreateCmdF),
}
View Source
var UserDeactivateCmd = &cobra.Command{
	Use:   "deactivate [emails, usernames, userIds]",
	Short: "Deactivate users",
	Long:  "Deactivate users. Deactivated users are immediately logged out of all sessions and are unable to log back in.",
	Example: `  user deactivate user@example.com
  user deactivate username`,
	RunE: withClient(userDeactivateCmdF),
	Args: cobra.MinimumNArgs(1),
}
View Source
var UserInviteCmd = &cobra.Command{
	Use:   "invite [email] [teams]",
	Short: "Send user an email invite to a team.",
	Long: `Send user an email invite to a team.
You can invite a user to multiple teams by listing them.
You can specify teams by name or ID.`,
	Example: `  user invite user@example.com myteam
  user invite user@example.com myteam1 myteam2`,
	RunE: withClient(userInviteCmdF),
}
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Prints the version of mmctl.",
	Args:  cobra.NoArgs,
	Run:   versionCmdF,
}
View Source
var WebsocketCmd = &cobra.Command{
	Use:   "websocket",
	Short: "Display websocket in a human-readable format",
	RunE:  websocketCmdF,
}
View Source
var ZshCmd = &cobra.Command{
	Use:   "zsh",
	Short: "Generates the zsh autocompletion scripts",
	Long: `To load completion, run

. <(mmctl completion zsh)

To configure your zsh shell to load completions for each session, add the above line to your ~/.zshrc
`,
	RunE: zshCmdF,
}

Functions

func CheckVersionMatch

func CheckVersionMatch(version, serverVersion string) bool

func CleanCredentials

func CleanCredentials() error

func InitClient

func InitClient(allowInsecure bool) (*model.Client4, string, error)

func InitClientWithCredentials

func InitClientWithCredentials(credentials *Credentials, allowInsecure bool) (*model.Client4, string, error)

func InitClientWithMFA

func InitClientWithMFA(username, password, mfaToken, instanceURL string, allowInsecure bool) (*model.Client4, string, error)

func InitClientWithUsernameAndPassword

func InitClientWithUsernameAndPassword(username, password, instanceURL string, allowInsecure bool) (*model.Client4, string, error)

func InitWebSocketClient

func InitWebSocketClient() (*model.WebSocketClient, error)

func NewAPIv4Client

func NewAPIv4Client(instanceURL string, allowInsecure bool) *model.Client4

func Run

func Run(args []string) error

func SaveCredentials

func SaveCredentials(credentials Credentials) error

func SaveCredentialsList

func SaveCredentialsList(credentialsList *CredentialsList) error

func SetCurrent

func SetCurrent(name string) error

func VerifyCertificates

func VerifyCertificates(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error

Types

type Credentials

type Credentials struct {
	Name        string `json:"name"`
	Username    string `json:"username"`
	AuthToken   string `json:"authToken"`
	AuthMethod  string `json:"authMethod"`
	InstanceURL string `json:"instanceUrl"`
	Active      bool   `json:"active"`
}

func GetCredentials

func GetCredentials(name string) (*Credentials, error)

func GetCurrentCredentials

func GetCurrentCredentials() (*Credentials, error)

type CredentialsList

type CredentialsList map[string]*Credentials

func ReadCredentialsList

func ReadCredentialsList() (*CredentialsList, error)

type TestHelper

type TestHelper struct {
	Client            client.Client
	SystemAdminClient client.Client
	BasicUser         *model.User
	SystemAdminUser   *model.User
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL