keyaliases

package
v1.125.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "keyaliases",
	Aliases: []string{"ka"},
	Short:   "Manage Key Aliases",
	Long:    "Manage Key Aliases",
}

Cmd to manage key aliases

View Source
var CreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a Key Alias from PEM, PKCS12 or generate self signed cert",
	Long:  "Create a Key Alias from PEM, PKCS12 or generate self signed cert",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(env)
		if format == "pfx" && password == "" {
			return fmt.Errorf("password must be set for pfx files")
		}
		if keyFile != "" && !utils.FileExists(keyFile) {
			return fmt.Errorf("keyFile was not found")
		}
		if certFile != "" && !utils.FileExists(certFile) {
			return fmt.Errorf("certFile was not found")
		}
		if pfxFile != "" && !utils.FileExists(pfxFile) {
			return fmt.Errorf("pfxFile was not found")
		}
		if selfFile != "" && !utils.FileExists(selfFile) {
			return fmt.Errorf("selfsigned JSON file was not found")
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		switch format {
		case "selfsignedcert":
			_, err = keyaliases.CreateOrUpdateSelfSigned(keystoreName,
				name,
				false,
				ignoreExpiry,
				ignoreNewLine,
				selfFile)
		case "keycertfile", "pem":
			_, err = keyaliases.CreateOrUpdateKeyCert(keystoreName,
				name,
				false,
				ignoreExpiry,
				ignoreNewLine,
				certFile,
				keyFile,
				password)
		case "pkcs12":
			_, err = keyaliases.CreateOrUpdatePfx(keystoreName,
				name,
				false,
				ignoreExpiry,
				ignoreNewLine,
				pfxFile,
				password)
		default:
			return fmt.Errorf("invalid format key alias for %s", format)
		}
		return err
	},
}

CreateCmd to create key aliases

View Source
var CsrCmd = &cobra.Command{
	Use:   "csr",
	Short: "Generates a csr for the private key in an alias",
	Long:  "Generates a PKCS #10 Certificate Signing Request for the private key in an alias",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(env)
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = keyaliases.CreateCSR(keystoreName, aliasName)
		return
	},
}

CsrCmd to get key aliases

View Source
var DelCmd = &cobra.Command{
	Use:   "delete",
	Short: "Delete a Key Alias",
	Long:  "Delete a Key Alias",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(env)
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = keyaliases.Delete(keystoreName, aliasName)
		return
	},
}

DelCmd to delete key aliases

View Source
var GetCmd = &cobra.Command{
	Use:   "get",
	Short: "Get a Key Alias",
	Long:  "Get a Key Alias",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(env)
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = keyaliases.Get(keystoreName, aliasName)
		return
	},
}

GetCmd to get key aliases

View Source
var GetctCmd = &cobra.Command{
	Use:   "getcert",
	Short: "Get a Key alias certificate",
	Long:  "Get a Key alias certificate",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(env)
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		err = keyaliases.GetCert(keystoreName, aliasName)
		return
	},
}

GetctCmd to get key aliases

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "List Key Aliases",
	Long:  "List Key Alises",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(env)
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = keyaliases.List(keystoreName)
		return
	},
}

ListCmd to list key aliases

View Source
var UpdateCmd = &cobra.Command{
	Use:   "update",
	Short: "Update a Key Alias from PEM a file",
	Long:  "Update a Key Alias from PEM a file",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(env)
		if certFile != "" && !utils.FileExists(certFile) {
			return fmt.Errorf("certFile was not found")
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = keyaliases.CreateOrUpdateKeyCert(keystoreName,
			name,
			true,
			ignoreExpiry,
			ignoreNewLine,
			certFile,
			"",
			password)

		return err
	},
}

UpdateCmd to create key aliases

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