provider

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddCmd = &cobra.Command{
	Use:   "add",
	Short: "Add token provider",
	Long: `Add token provider. For example:
mim provider add -file provider.json
or
mim provider add -f provider.json
`,
	Run: func(cmd *cobra.Command, args []string) {
		format := utils.ResolveFormat(cmd)
		if format == "json" {
			pterm.DisableOutput()
		}

		server, token, err := login.ResolveCredentials()
		utils.HandleError(err)

		pterm.EnableDebugMessages()

		file, err := cmd.Flags().GetString("file")
		utils.HandleError(err)

		providerConfig, err := utils.ReadInput(file)
		print(string(providerConfig))
		utils.HandleError(err)
		pterm.Success.Println("Read provider config file")

		sm := api.NewSecurityManager(server, token)
		err = sm.AddTokenProvider(providerConfig)

		utils.HandleError(err)

		pterm.Success.Println("Set token provider config")

		pterm.Println()
	},
	TraverseChildren: true,
}

addCmd represents the add command

View Source
var ListCmd = &cobra.Command{
	Use:     "list",
	Aliases: []string{"ls"},
	Short:   "List all token providers",
	Long: `List all token providers. For example:
mim provider list

`,
	Run: func(cmd *cobra.Command, args []string) {
		format := utils.ResolveFormat(cmd)
		if format == "json" {
			pterm.DisableOutput()
		}

		server, token, err := login.ResolveCredentials()
		utils.HandleError(err)

		pterm.EnableDebugMessages()

		pterm.DefaultSection.Println("Listing token providers on " + server)

		sm := api.NewSecurityManager(server, token)

		tokenProviders, err := sm.ListTokenProviders()
		utils.HandleError(err)

		printOutput(tokenProviders, format)
	},

	TraverseChildren: true,
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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