Documentation
¶
Index ¶
- Variables
- func AccessLabels(current types.Permission) ([]string, []types.Permission)
- func AddAppCollaboratorsToNamedEntitiesPrompt(ctx context.Context, IO iostreams.IOStreamer) (bool, error)
- func ChooseNamedEntityPrompt(ctx context.Context, clients *shared.ClientFactory) (string, string, error)
- func OrgSelectWorkspacePrompt(ctx context.Context, clients *shared.ClientFactory, orgDomain, token string, ...) (string, error)
- func SortAlphaNumeric(teamDomains []string, labels []string, teamIDs []string) error
- func TriggerAccessLabels(current types.Permission) ([]string, []types.Permission)
- func TriggerChooseNamedEntityActionPrompt(ctx context.Context, clients *shared.ClientFactory) (string, error)
- func TriggerChooseNamedEntityPrompt(ctx context.Context, clients *shared.ClientFactory, accessAction string, ...) (string, string, bool, error)
- func ValidateGetOrgWorkspaceGrant(ctx context.Context, clients *shared.ClientFactory, selection *SelectedApp, ...) (string, error)
- type AppEnvironmentType
- type AppInstallStatus
- type AppSelectMock
- type AppStatus
- type SelectedApp
- type TeamApps
Constants ¶
This section is empty.
Variables ¶
var SelectTeamPrompt = "Select a team"
Functions ¶
func AccessLabels ¶
func AccessLabels(current types.Permission) ([]string, []types.Permission)
func AddAppCollaboratorsToNamedEntitiesPrompt ¶
func AddAppCollaboratorsToNamedEntitiesPrompt(ctx context.Context, IO iostreams.IOStreamer) (bool, error)
AddAppCollaboratorsToNamedEntitiesPrompt displays a confirmation prompt for adding app collaborators to trigger access named entities list
func ChooseNamedEntityPrompt ¶
func ChooseNamedEntityPrompt(ctx context.Context, clients *shared.ClientFactory) (string, string, error)
ChooseNamedEntityPrompt displays a selection prompt that lists available actions one can take to manage the list of users with access to the function. This function returns the chosen action and user(s) it should be applied to but does not execute the action.
func OrgSelectWorkspacePrompt ¶
func OrgSelectWorkspacePrompt(ctx context.Context, clients *shared.ClientFactory, orgDomain, token string, topOptionAllWorkspaces bool) (string, error)
OrgSelectWorkspacePrompt prompts the user to select a single workspace to grant app access to, or grant all workspaces within the org.
func SortAlphaNumeric ¶
SortAlphaNumeric safely orders prompt domains, labels and team ids
func TriggerAccessLabels ¶
func TriggerAccessLabels(current types.Permission) ([]string, []types.Permission)
func TriggerChooseNamedEntityPrompt ¶
func TriggerChooseNamedEntityPrompt(ctx context.Context, clients *shared.ClientFactory, accessAction string, currentAccessType types.Permission, hasIncludeAppCollabFlag bool) (string, string, bool, error)
TriggerChooseNamedEntityPrompt displays a selection prompt that lists available actions one can take to manage the list of users or channels with access to the trigger. This function returns the chosen action and user(s) or channel(s) it should be applied to but does not execute the action.
func ValidateGetOrgWorkspaceGrant ¶
func ValidateGetOrgWorkspaceGrant(ctx context.Context, clients *shared.ClientFactory, selection *SelectedApp, orgGrantWorkspaceID string, promptOption bool) (string, error)
ValidateGetOrgWorkspaceGrant checks that the org-workspace-grant flag is being used appropriately. If org-workspace-grant should not be used, it will be reset to an empty string.
Types ¶
type AppEnvironmentType ¶
type AppEnvironmentType int
const ( // ShowAllEnvironments does not filter apps by environment ShowAllEnvironments AppEnvironmentType = iota // ShowHostedOnly filters to show deployed apps only ShowHostedOnly // ShowLocalOnly filters to show locally run apps only // // Note: This check might not be correct when using the "app" and "token" flag // but without a saved apps.dev.json file. The ErrDeployedAppNotSupported error // will be returned with the selection in these cases. ShowLocalOnly )
func (AppEnvironmentType) Equals ¶
func (environment AppEnvironmentType) Equals(is AppEnvironmentType) bool
Equals returns true if the app environment type is equal
type AppInstallStatus ¶
type AppInstallStatus int
const ( // ShowAllApps shows all existing and potential apps; one can choose from installed apps, uninstalled apps, or create a new app ShowAllApps AppInstallStatus = iota // ShowInstalledAppsOnly filters to show installed apps only ShowInstalledAppsOnly // ShowInstalledAndUninstalledApps filters to show both installed and uninstalled apps ShowInstalledAndUninstalledApps // ShowInstalledAndNewApps shows installed apps and allows the user to create a new app ShowInstalledAndNewApps )
type AppSelectMock ¶
AppSelectMock implementation mocks the app environment prompts
func NewAppSelectMock ¶
func NewAppSelectMock() *AppSelectMock
NewAppSelectMock returns a mock of the app environment prompts
func (*AppSelectMock) AppSelectPrompt ¶
func (m *AppSelectMock) AppSelectPrompt(ctx context.Context, clients *shared.ClientFactory, env AppEnvironmentType, status AppInstallStatus) (SelectedApp, error)
AppSelectPrompt mocks the app selection prompt
type AppStatus ¶
type AppStatus struct {
AppID string
InstallationState types.AppInstallationStatus
EnterpriseGrants []types.EnterpriseGrant
}
type SelectedApp ¶
type SelectedApp struct {
// The workspace auth corresponding to the selected app
Auth types.SlackAuth
// The app that was chosen
App types.App
}
SelectedApp contains information for the user chosen app
func AppSelectPrompt ¶
func AppSelectPrompt( ctx context.Context, clients *shared.ClientFactory, environment AppEnvironmentType, status AppInstallStatus, ) ( selected SelectedApp, err error, )
AppSelectPrompt reveals options for apps that match the install status
type TeamApps ¶
type TeamApps struct {
Auth types.SlackAuth
Hosted SelectedApp
Local SelectedApp
}
TeamApps contains the apps (local and hosted), auth and information for a team