Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AttributesCmd = &cobra.Command{ Use: "attributes", Aliases: []string{"attrs"}, Short: "Manage API Product Attributes", Long: "Manage API Product Attributes", }
AttributesCmd to manage tracing of apis
var Cmd = &cobra.Command{ Use: "products", Aliases: []string{"prods"}, Short: "Manage Apigee API products", Long: "Manage Apigee API products and Rate Plans for Monetization", }
Cmd to manage products
var CreateCmd = &cobra.Command{ Use: "create", Short: "Create an API product", Long: "Create an API product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { p := products.APIProduct{} p.Name = name p.DisplayName = displayName p.ApprovalType = approval p.Description = description p.Quota = quota p.QuotaInterval = quotaInterval p.QuotaTimeUnit = quotaUnit p.Environments = environments p.Proxies = proxies p.Scopes = scopes p.OperationGroup, err = getOperationGroup(operationGroupFile) if err != nil { return err } p.GraphQLOperationGroup, err = getGqlOperationGroup(gqlOperationGroupFile) if err != nil { return nil } p.GrpcOperationGroup, err = getGrpcOperationGroup(grpcOperationGroupFile) if err != nil { return nil } p.Attributes = getAttributes(attrs) _, err = products.Create(p) return err }, }
CreateCmd to create a new product
var CreateRateplanCmd = &cobra.Command{ Use: "create", Short: "Create a rate plan for an API product", Long: "Create a rate plan for an API product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { if rateplanData, err = os.ReadFile(rateplanFile); err != nil { clilog.Debug.Println(err) return err } _, err = products.CreateRatePlan(apiproduct, rateplanData) return err }, }
CreateRateplanCmd to create a rate plane for an api product
var DelAttrCmd = &cobra.Command{ Use: "delete", Short: "Deletes an attribute from an API product", Long: "Deletes an attribute from an API product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.DeleteAttribute(name, attrName) return }, }
DelAttrCmd to delete product attribute
var DelCmd = &cobra.Command{ Use: "delete", Short: "Deletes an API product from an organization", Long: "Deletes an API product from an organization", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.Delete(name) return }, }
DelCmd to delete products
var DelRatePlanCmd = &cobra.Command{ Use: "delete", Short: "Delete rate plan associated with the API Product", Long: "Delete rate plan associated with the API Product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.DeleteRatePlan(name, rateplan) return }, }
DelRatePlanCmd to list envs
var ExpCmd = &cobra.Command{ Use: "export", Short: "Export API products to a file", Long: "Export API products 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) { const exportFileName = "products.json" payload, err := products.Export(conn) if err != nil { return err } return apiclient.WriteArrayByteArrayToFile(exportFileName, false, payload) }, }
ExpCmd to export products
var ExpRateplanCmd = &cobra.Command{ Use: "export", Short: "Export the rate plans of an API product to a file", Long: "Export the rate plans of an API product 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) { exportFileName := "rateplan_" + name + ".json" respBody, err := products.ExportRateplan(name) if err != nil { return err } return apiclient.WriteByteArrayToFile(exportFileName, false, respBody) }, }
ExpRateplanCmd to export products
var GetAttrCmd = &cobra.Command{ Use: "get", Short: "Get an attribute of an API product", Long: "Get an attribute of an API product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.GetAttribute(name, attrName) return }, }
GetAttrCmd to delete product attribute
var GetCmd = &cobra.Command{ Use: "get", Short: "Gets an API product from an organization", Long: "Gets an API product from an organization", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.Get(name) return }, }
GetCmd to get products
var GetRatePlanCmd = &cobra.Command{ Use: "get", Short: "Get a rate plan associated with an API Product", Long: "Get a rate plan associated with an API Product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.GetRatePlan(name, rateplan) return }, }
GetRatePlanCmd to list envs
var ImpCmd = &cobra.Command{ Use: "import", Short: "Import a file containing API products", Long: "Import a file containing API products", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) error { return products.Import(conn, filePath, upsert) }, }
ImpCmd to import products
var ListAttrCmd = &cobra.Command{ Use: "list", Short: "List attributes of an API product", Long: "List attributes of an API product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.ListAttributes(name) return }, }
ListAttrCmd to delete product attribute
var ListCmd = &cobra.Command{ Use: "list", Short: "Returns a list of API products", Long: "Returns a list of API products with a filter by attribute names and values if provided", Args: func(cmd *cobra.Command, args []string) (err error) { if len(filter) > 1 { return fmt.Errorf("invalid filter options. Only proxies are supported") } if len(filter) == 1 && (filter["proxy"] == "") { return fmt.Errorf("invalid filter options. Filter option must be proxies, " + "expand must be set to true and count cannot be set") } return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { if len(filter) > 0 { _, err = products.ListFilter(filter) } else { _, err = products.List(count, startKey, expand) } return err }, }
ListCmd to list products
var ListRatePlanCmd = &cobra.Command{ Use: "list", Short: "List rate plans associated with an API Product", Long: "List rate plans associated with an API Product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.ListRatePlan(name) return }, }
ListRatePlanCmd to list envs
var RatePlanCmd = &cobra.Command{
Use: "rateplans",
Short: "Manage rateplans for an API Product",
Long: "Manage rateplans for an API Product",
}
RatePlanCmd to manage rateplans of api products
var UpdAttrCmd = &cobra.Command{ Use: "update", Short: "Update an attribute of an API product", Long: "Update an attribute of an API product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = products.UpdateAttribute(name, attrName, attrValue) return }, }
UpdAttrCmd to delete product attribute
var UpdateCmd = &cobra.Command{ Use: "update", Short: "Update an API product", Long: "Update an API product", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { p := products.APIProduct{} p.Name = name p.DisplayName = displayName p.ApprovalType = approval p.Description = description p.Quota = quota p.QuotaInterval = quotaInterval p.QuotaTimeUnit = quotaUnit p.Environments = environments p.Proxies = proxies p.Scopes = scopes p.OperationGroup, err = getOperationGroup(operationGroupFile) if err != nil { return err } p.GraphQLOperationGroup, err = getGqlOperationGroup(gqlOperationGroupFile) if err != nil { return nil } p.GrpcOperationGroup, err = getGrpcOperationGroup(grpcOperationGroupFile) if err != nil { return nil } p.Attributes = getAttributes(attrs) _, err = products.Update(p) return err }, }
UpdateCmd to update a product
Functions ¶
This section is empty.
Types ¶
This section is empty.