securityprofiles

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AttachCmd = &cobra.Command{
	Use:   "attach",
	Short: "Attach a security profile to an environment",
	Long:  "Attach a security profile to an environment",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(environment)
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = securityprofiles.Attach(name, revision)
		return
	},
}

AttachCmd to list catalog items

View Source
var Cmd = &cobra.Command{
	Use:     "securityprofiles",
	Aliases: []string{"secprofiles"},
	Short:   "Manage Adv API Security Profiles",
	Long:    "Manage Adv API Security Profiles",
}

Cmd to manage apis

View Source
var ComputeCmd = &cobra.Command{
	Use:   "compute",
	Short: "Calculates scores for requested time range",
	Long:  "Calculates scores for requested time range for the specified security profile",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if startTime != "" {
			if _, err = time.Parse(time.RFC3339, startTime); err != nil {
				return fmt.Errorf("invalid format for startTime: %v", err)
			}
		}
		if endTime != "" {
			if _, err = time.Parse(time.RFC3339, endTime); err != nil {
				return fmt.Errorf("invalid format for endTime: %v", err)
			}
		}
		apiclient.SetApigeeEnv(environment)
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		if endTime == "" {

			endTime = time.Now().UTC().Format(time.RFC3339)
		}
		if startTime == "" {

			startTime = time.Now().AddDate(0, 0, -1).UTC().Format(time.RFC3339)
		}
		_, err = securityprofiles.Compute(name, startTime, endTime,
			filters, pageSize, pageToken, full)
		return
	},
}

ComputeCmd to list catalog items

View Source
var CreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Create a new Security Profile",
	Long:  "Create a new Security Profile",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		content, err := utils.ReadFile(securityActionFile)
		if err != nil {
			return err
		}
		_, err = securityprofiles.Create(name, content)
		return
	},
}

CreateCmd to get a securityprofile

View Source
var DeleteCmd = &cobra.Command{
	Use:   "delete",
	Short: "Deletes a security profile",
	Long:  "Deletes a security profile",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = securityprofiles.Delete(name)
		return
	},
}

DeleteCmd to list catalog items

View Source
var DetachCmd = &cobra.Command{
	Use:   "detach",
	Short: "Detach a security profile from an environment",
	Long:  "Detach a security profile from an environment",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeEnv(environment)
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = securityprofiles.Detach(name)
		return
	},
}

DetachCmd to list catalog items

View Source
var ExpCmd = &cobra.Command{
	Use:   "export",
	Short: "Export Security Profiles to a file",
	Long:  "Export Security Profiles to a file",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		if folder == "" {
			folder, _ = os.Getwd()
		}
		if err = apiclient.FolderExists(folder); err != nil {
			return err
		}
		return securityprofiles.Export(conn, folder)
	},
}

ExpCmd to export sec profiles

View Source
var GetCmd = &cobra.Command{
	Use:   "get",
	Short: "Returns a security profile by name",
	Long:  "Returns a security profile by name",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = securityprofiles.Get(name, revision)
		return
	},
}

GetCmd to list catalog items

View Source
var ImpCmd = &cobra.Command{
	Use:   "import",
	Short: "Import a folder containing Security Profiles",
	Long:  "Import a folder containing Security Profiles",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		if stat, err := os.Stat(folder); err == nil && !stat.IsDir() {
			return fmt.Errorf("supplied path is not a folder")
		}
		return securityprofiles.Import(conn, folder)
	},
}

ImpCmd to import sec profiles

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "Returns the security profiles in the org",
	Long:  "Returns the security profiles in the org",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = securityprofiles.List(pageSize, pageToken)
		return
	},
}

ListCmd to list catalog items

View Source
var ListRevisionsCmd = &cobra.Command{
	Use:   "listrevisions",
	Short: "Returns the revisions of a security profile",
	Long:  "Returns the revisions of a security profile",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = securityprofiles.ListRevisions(name)
		return
	},
}

ListRevisionsCmd to list catalog items

View Source
var UpdateCmd = &cobra.Command{
	Use:   "update",
	Short: "Update an existing Security Profile",
	Long:  "Update an existing Security Profile",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		content, err := utils.ReadFile(securityActionFile)
		if err != nil {
			return err
		}
		_, err = securityprofiles.Update(name, content)
		return
	},
}

UpdateCmd to update a security profile

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