apicategories

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:   "apicategories",
	Short: "Manage Apigee API categories that are tagged on catalog items",
	Long:  "Manage Apigee API categories that are tagged on catalog items",
}

Cmd to manage api catalog items

View Source
var CreateCmd = &cobra.Command{
	Use:   "create",
	Short: "Creates a new API category",
	Long:  "Creates a new API category",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		if siteid == "" {
			return fmt.Errorf("siteid is a mandatory parameter")
		}
		_, err = apicategories.Create(siteid, name)
		return
	},
}

CreateCmd to get a catalog items

View Source
var DelCmd = &cobra.Command{
	Use:   "delete",
	Short: "Deletes an API Category by ID or name",
	Long:  "Deletes an API Category by ID or name",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if siteid == "" {
			return fmt.Errorf("siteid is a mandatory parameter")
		}
		if name == "" && id == "" {
			return fmt.Errorf("name or id must be set as a parameter")
		}
		if name != "" && id != "" {
			return fmt.Errorf("name and id cannot be set as a parameter")
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		if name != "" {
			if id, err = apicategories.GetIDByName(siteid, name); err != nil {
				return err
			}
		}
		_, err = apicategories.Delete(siteid, id)
		return
	},
}

DelCmd to get a catalog items

View Source
var ExpCmd = &cobra.Command{
	Use:   "export",
	Short: "Export API Categories across all sites",
	Long:  "Export API Categories across all sites",
	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
		}
		apiclient.DisableCmdPrintHttpResponse()
		return apicategories.Export(folder)
	},
}

ExpCmd to export apidocs

View Source
var GetCmd = &cobra.Command{
	Use:   "get",
	Short: "Gets an API Category by ID or name",
	Long:  "Gets an API Category by ID or name",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if siteid == "" {
			return fmt.Errorf("siteid is a mandatory parameter")
		}
		if name == "" && id == "" {
			return fmt.Errorf("name or id must be set as a parameter")
		}
		if name != "" && id != "" {
			return fmt.Errorf("name and id cannot be set as a parameter")
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		if name != "" {
			var payload []byte
			if payload, err = apicategories.GetByName(siteid, name); err != nil {
				return err
			}
			return apiclient.PrettyPrint("application/json", payload)
		}
		_, err = apicategories.Get(siteid, id)
		return
	},
}

GetCmd to get a catalog items

View Source
var ImpCmd = &cobra.Command{
	Use:   "import",
	Short: "Import from a folder containing apicategories",
	Long:  "Import from a folder containing apicategories",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		if siteid == "" {
			return fmt.Errorf("siteid is a mandatory parameter")
		}
		return apicategories.Import(siteid, apicategoryFile)
	},
}

ImpCmd to import products

View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "Returns the API categories associated with a portal",
	Long:  "Returns the API categories associated with a portal",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		if siteid == "" {
			return fmt.Errorf("siteid is a mandatory parameter")
		}
		return apiclient.SetApigeeOrg(org)
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = apicategories.List(siteid)
		return
	},
}

ListCmd to list apicategories

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