secret

package
v0.3.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddCmd = cli.Command{
	Name:        "secret",
	Description: "Use this command to add a secret.",
	Usage:       "Add a secret",
	Action:      add,
	Flags: []cli.Flag{

		cli.StringFlag{
			Name:   "engine",
			Usage:  "Provide the engine for where the secret to be stored",
			EnvVar: "SECRET_ENGINE",
			Value:  constants.DriverNative,
		},
		cli.StringFlag{
			Name:   "type",
			Usage:  "Provide the kind of secret to be stored",
			EnvVar: "SECRET_TYPE",
			Value:  constants.SecretRepo,
		},
		cli.StringFlag{
			Name:   "org",
			Usage:  "Provide the organization for the repository",
			EnvVar: "SECRET_ORG",
		},
		cli.StringFlag{
			Name:   "repo",
			Usage:  "Provide the repository contained with the organization",
			EnvVar: "SECRET_REPO",
		},
		cli.StringFlag{
			Name:   "team",
			Usage:  "Provide the team contained with the organization",
			EnvVar: "SECRET_TEAM",
		},
		cli.StringFlag{
			Name:   "name",
			Usage:  "Provide the name of the secret",
			EnvVar: "SECRET_NAME",
		},
		cli.StringFlag{
			Name:   "value",
			Usage:  "Provide the value of the secret",
			EnvVar: "SECRET_VALUE",
		},

		cli.StringSliceFlag{
			Name:   "image",
			Usage:  "Secret limited to these images",
			EnvVar: "SECRET_IMAGES",
		},
		cli.StringSliceFlag{
			Name:   "event",
			Usage:  "Secret limited to these events",
			EnvVar: "SECRET_EVENTS",
			Value: &cli.StringSlice{
				constants.EventPush,
				constants.EventTag,
				constants.EventDeploy,
			},
		},
		cli.StringFlag{
			Name:  "filename,f",
			Usage: "Filename to use to add the secret or secrets",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
 1. Add a secret for a repository with push events.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --value bar
 2. Add a secret for an org with push events.
    $ {{.HelpName}} --engine native --type org --org github --repo '*' --name foo --value bar
 3. Add a shared secret for the platform.
    $ {{.HelpName}} --engine native --type shared --org github --team octokitties --name foo --value bar
 4. Add a secret for a repository with all event types enabled.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --value bar --event push --event pull_request --event tag --event deployment
 5. Add a secret from a file.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --value @/path/to/file
 6. Add a native repo secret with an image whitelist.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --value bar --image alpine --image golang
 7. Add a repo secret with default native engine or when engine and type environment variables are set.
	$ {{.HelpName}} --org github --repo octocat --name foo --value bar
 8. Add a secret or secrets from a file
    $ {{.HelpName}} -f secret.yml
`, cli.CommandHelpTemplate),
}

AddCmd defines the command to add a secret for a repository.

View Source
var GetCmd = cli.Command{
	Name:        "secret",
	Aliases:     []string{"secrets"},
	Description: "Use this command to get a list of secrets.",
	Usage:       "Display a list of secrets",
	Action:      get,
	Before:      loadGlobal,
	Flags: []cli.Flag{

		cli.StringFlag{
			Name:   "engine",
			Usage:  "Provide the engine for where the secret to be stored",
			EnvVar: "VELA_SECRET_ENGINE,SECRET_ENGINE",
			Value:  constants.DriverNative,
		},
		cli.StringFlag{
			Name:   "type",
			Usage:  "Provide the kind of secret to be stored",
			EnvVar: "SECRET_TYPE",
			Value:  constants.SecretRepo,
		},
		cli.StringFlag{
			Name:   "org",
			Usage:  "Provide the organization for the repository",
			EnvVar: "SECRET_ORG",
		},
		cli.StringFlag{
			Name:   "repo",
			Usage:  "Provide the repository contained with the organization",
			EnvVar: "SECRET_REPO",
		},
		cli.StringFlag{
			Name:   "team",
			Usage:  "Provide the team contained with the organization",
			EnvVar: "SECRET_TEAM",
		},

		cli.IntFlag{
			Name:  "page,p",
			Usage: "Print the out the builds a specific page",
			Value: 1,
		},
		cli.IntFlag{
			Name:  "per-page,pp",
			Usage: "Expand the number of items contained within page",
			Value: 10,
		},
		cli.StringFlag{
			Name:  "output,o",
			Usage: "Print the output in a yaml or json format",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
 1. Get repository secrets.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat
 2. Get organization secrets.
    $ {{.HelpName}} --engine native --type org --org github --repo '*'
 3. Get shared secrets.
    $ {{.HelpName}} --engine native --type shared --org github --team octokitties
 4. Get secrets for a repository with wide view output.
    $ {{.HelpName}} --output wide --engine native --type repo --org github --repo octocat
 5. Get secrets for a repository with yaml output.
    $ {{.HelpName}} --output yaml --engine native --type repo --org github --repo octocat
 6. Get secrets for a repository with json output.
    $ {{.HelpName}} --output json --engine native --type repo --org github --repo octocat
 7. Get repository secrets with default native engine or when engine and type environment variables are set.
    $ {{.HelpName}} --org github --repo octocat
`, cli.CommandHelpTemplate),
}

GetCmd defines the command for retrieving secrets from a repository.

View Source
var RemoveCmd = cli.Command{
	Name:        "secret",
	Description: "Use this command to remove a secret.",
	Usage:       "Remove a secret",
	Action:      remove,
	Before:      loadGlobal,
	Flags: []cli.Flag{

		cli.StringFlag{
			Name:   "engine",
			Usage:  "Provide the engine for where the secret to be stored",
			EnvVar: "VELA_SECRET_ENGINE,SECRET_ENGINE",
			Value:  constants.DriverNative,
		},
		cli.StringFlag{
			Name:   "type",
			Usage:  "Provide the kind of secret to be stored",
			EnvVar: "SECRET_TYPE",
			Value:  constants.SecretRepo,
		},
		cli.StringFlag{
			Name:   "org",
			Usage:  "Provide the organization for the repository",
			EnvVar: "SECRET_ORG",
		},
		cli.StringFlag{
			Name:   "repo",
			Usage:  "Provide the repository contained with the organization",
			EnvVar: "SECRET_REPO",
		},
		cli.StringFlag{
			Name:   "team",
			Usage:  "Provide the team contained with the organization",
			EnvVar: "SECRET_TEAM",
		},
		cli.StringFlag{
			Name:   "name",
			Usage:  "Provide the name of the secret",
			EnvVar: "SECRET_NAME",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
 1. Remove a secret for a repository.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo
 2. Remove a secret for an org.
    $ {{.HelpName}} --engine native --type org --org github --repo '*' --name foo
 3. Remove a shared secret for the platform.
    $ {{.HelpName}} --engine native --type shared --org github --team octokitties --name foo
 4. Remove a repo secret with default native engine or when engine and type environment variables are set.
    $ {{.HelpName}} --org github --repo octocat --name foo
`, cli.CommandHelpTemplate),
}

RemoveCmd defines the command to remove a repository.

View Source
var UpdateCmd = cli.Command{
	Name:        "secret",
	Description: "Use this command to update a secret.",
	Usage:       "Update a secret",
	Action:      update,
	Flags: []cli.Flag{

		cli.StringFlag{
			Name:   "engine",
			Usage:  "Provide the engine for where the secret to be stored",
			EnvVar: "VELA_SECRET_ENGINE,SECRET_ENGINE",
			Value:  constants.DriverNative,
		},
		cli.StringFlag{
			Name:   "type",
			Usage:  "Provide the kind of secret to be stored",
			EnvVar: "SECRET_TYPE",
			Value:  constants.SecretRepo,
		},
		cli.StringFlag{
			Name:   "org",
			Usage:  "Provide the organization for the repository",
			EnvVar: "SECRET_ORG",
		},
		cli.StringFlag{
			Name:   "repo",
			Usage:  "Provide the repository contained with the organization",
			EnvVar: "SECRET_REPO",
		},
		cli.StringFlag{
			Name:   "team",
			Usage:  "Provide the team contained with the organization",
			EnvVar: "SECRET_TEAM",
		},
		cli.StringFlag{
			Name:   "name",
			Usage:  "Provide the name of the secret",
			EnvVar: "SECRET_NAME",
		},

		cli.StringFlag{
			Name:   "value",
			Usage:  "Provide the value of the secret",
			EnvVar: "SECRET_VALUE",
		},
		cli.StringSliceFlag{
			Name:   "image",
			Usage:  "Secret limited to these images",
			EnvVar: "SECRET_IMAGES",
		},
		cli.StringSliceFlag{
			Name:   "event",
			Usage:  "Secret limited to these events",
			EnvVar: "SECRET_EVENTS",
		},
		cli.StringFlag{
			Name:  "filename,f",
			Usage: "Filename to use to create the secret or secrets",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
 1. Update a secret value for a repository.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --value bar
 2. Update a secret value for an org.
    $ {{.HelpName}} --engine native --type org --org github --repo '*' --name foo --value bar
 3. Update a shared secret value for the platform.
    $ {{.HelpName}} --engine native --type shared --org github --team octokitties --name foo --value bar
 4. Update a secret for a repository with all event types enabled.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --event push --event pull_request --event tag --event deployment
 5. Update a secret from a file.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --value @/path/to/file
 6. Update a secret for a repository with an image whitelist.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --image alpine --image golang
 7. Update a repo secret value with default native engine or when engine and type environment variables are set.
	$ {{.HelpName}} --org github --repo octocat --name foo --value bars'
 8. Update with data from a secret file.
	$ {{.HelpName}} -f secret.yml
`, cli.CommandHelpTemplate),
}

UpdateCmd defines the command to update a secret.

View Source
var ViewCmd = cli.Command{
	Name:        "secret",
	Description: "Use this command to view a secret.",
	Usage:       "View details of the provided secret",
	Action:      view,
	Before:      loadGlobal,
	Flags: []cli.Flag{

		cli.StringFlag{
			Name:   "engine",
			Usage:  "Provide the engine for where the secret to be stored",
			EnvVar: "VELA_SECRET_ENGINE,SECRET_ENGINE",
			Value:  constants.DriverNative,
		},
		cli.StringFlag{
			Name:   "type",
			Usage:  "Provide the kind of secret to be stored",
			EnvVar: "SECRET_TYPE",
			Value:  constants.SecretRepo,
		},
		cli.StringFlag{
			Name:   "org",
			Usage:  "Provide the organization for the repository",
			EnvVar: "SECRET_ORG",
		},
		cli.StringFlag{
			Name:   "repo",
			Usage:  "Provide the repository contained with the organization",
			EnvVar: "SECRET_REPO",
		},
		cli.StringFlag{
			Name:   "team",
			Usage:  "Provide the team contained with the organization",
			EnvVar: "SECRET_TEAM",
		},
		cli.StringFlag{
			Name:   "name",
			Usage:  "Provide the name of the secret",
			EnvVar: "SECRET_NAME",
		},

		cli.StringFlag{
			Name:  "output,o",
			Usage: "Print the output in json format",
		},
	},
	CustomHelpTemplate: fmt.Sprintf(`%s
EXAMPLES:
 1. View repository secret details.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo
 2. View organization secret details.
    $ {{.HelpName}} --engine native --type org --org github --repo '*' --name foo
 3. View shared secret details.
    $ {{.HelpName}} --engine native --type shared --org github --team octokitties --name foo
 4. View secret details for a repository with json output.
    $ {{.HelpName}} --engine native --type repo --org github --repo octocat --name foo --output json
 5. View secret details with default native engine or when engine and type environment variables are set.
    $ {{.HelpName}} --org github --repo octocat --name foo
`, cli.CommandHelpTemplate),
}

ViewCmd defines the command for viewing a secret.

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