Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BundleCreateCmd = &cobra.Command{ Use: "bundle", Short: "Creates a sharedflow in an Apigee Org", Long: "Creates a sharedflow in an Apigee Org; Optionally deploy the sharedflow to an env", Args: func(cmd *cobra.Command, args []string) (err error) { apiclient.SetApigeeEnv(env) if sfZip != "" && sfFolder != "" { return fmt.Errorf("sharedflow bundle (zip) and folder to a sharedflow cannot be combined") } if sfZip == "" && sfFolder == "" { return fmt.Errorf("either sharedflow bundle (zip) or folder must be specified, not both") } if sfFolder != "" { if _, err := os.Stat(sfFolder); os.IsNotExist(err) { return err } } if env != "" { apiclient.SetApigeeEnv(env) } return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { var respBody []byte if sfZip != "" { respBody, err = sharedflows.Create(name, sfZip) } else if sfFolder != "" { if stat, err := os.Stat(folder); err == nil && !stat.IsDir() { return fmt.Errorf("supplied path is not a folder") } if filepath.Base(sfFolder) != "sharedflowbundle" { return fmt.Errorf("--sf-folder or -p must be a path to sharedflowbundle folder") } tmpDir, err := os.MkdirTemp("", "sf") if err != nil { return err } defer os.RemoveAll(tmpDir) sfBundlePath := path.Join(tmpDir, name+".zip") if err = proxybundle.GenerateArchiveBundle(sfFolder, sfBundlePath, true); err != nil { return err } if respBody, err = sharedflows.Create(name, sfBundlePath); err != nil { return err } if err = os.Remove(sfBundlePath); err != nil { return err } } if env != "" { clilog.Info.Printf("Deploying the Sharedflow %s to environment %s\n", name, env) if revision, err = GetRevision(respBody); err != nil { return err } if _, err = sharedflows.Deploy(name, revision, overrides, serviceAccountName); err != nil { return err } if wait { return Wait(name, revision) } } return err }, }
BundleCreateCmd to create shared flow
View Source
var CleanCmd = &cobra.Command{ Use: "clean", Short: "Deletes undeployed/unused reivisions of a Sharedflow", Long: "Deletes undeployed/unused reivisions of a Sharedflow", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { return sharedflows.Clean(name, reportOnly) }, }
CleanCmd to delete sf
View Source
var Cmd = &cobra.Command{
Use: "sharedflows",
Short: "Manage Apigee shared flows in an org",
Long: "Manage Apigee shared flows in an org",
}
Cmd to manage shared flows
View Source
var CreateCmd = &cobra.Command{
Use: "create",
Short: "Creates a Sharedflow in an Apigee Org",
Long: "Creates a Sharedflow in an Apigee Org",
}
CreateCmd to create sharedflow
View Source
var DelCmd = &cobra.Command{ Use: "delete", Short: "Deletes a shared flow", Long: "Deletes a shared flow and all associated policies, resources, and revisions." + "The flow must be undeployed first.", 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 = sharedflows.Delete(name, revision) return }, }
DelCmd to delete shared flow
View Source
var DepCmd = &cobra.Command{ Use: "deploy", Short: "Deploys a revision of an existing Sharedflow", Long: "Deploys a revision of an existing Sharedflow to an environment in an organization", 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) { if revision == -1 { if revision, err = sharedflows.GetHighestSfRevision(name); err != nil { return err } } _, err = sharedflows.Deploy(name, revision, overrides, serviceAccountName) apiclient.DisableCmdPrintHttpResponse() if wait { err = Wait(name, revision) } return err }, }
DepCmd to deploy shared flow
View Source
var ExpCmd = &cobra.Command{ Use: "export", Short: "export Sharedflow bundles from an org", Long: "export Sharedflow bundles from an org", 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) { if err = apiclient.FolderExists(folder); err != nil { return err } return sharedflows.Export(conn, folder, allRevisions) }, }
ExpCmd to export shared flows
View Source
var FetCmd = &cobra.Command{ Use: "fetch", Short: "Returns a zip-formatted shared flow bundle ", Long: "Returns a zip-formatted shared flow bundle of code and config files", 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) { if revision == -1 { if revision, err = sharedflows.GetHighestSfRevision(name); err != nil { return err } } return sharedflows.Fetch(name, revision) }, }
FetCmd to download shared flow
View Source
var GetCmd = &cobra.Command{ Use: "get", Short: "Gets a shared flow by name", Long: "Gets a shared flow by name, including a list of its revisions.", 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 = sharedflows.Get(name, revision) return }, }
GetCmd to get shared flow
View Source
var GhCreateCmd = &cobra.Command{ Use: "github", Aliases: []string{"gh"}, Short: "Creates a sharedflow from a GitHub repo", Long: "Creates a sharedflow from a GitHub repo. Check apigeecli prefs for GH on-prem options", Args: func(cmd *cobra.Command, args []string) (err error) { re := regexp.MustCompile(`(\w+)?\/sharedflowbundle$`) if ok := re.Match([]byte(ghPath)); !ok { return fmt.Errorf("github path must end with /sharedflowbundle") } return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { if os.Getenv("GITHUB_TOKEN") == "" { clilog.Debug.Println("github token is not set as an env var. Running unauthenticated") } if err = proxybundle.GitHubImportBundle(ghOwner, ghRepo, ghPath, true); err != nil { proxybundle.SharedflowCleanUp() return err } _, err = sharedflows.Create(name, bundleName) proxybundle.SharedflowCleanUp() return err }, }
GhCreateCmd create an api from a github repo
View Source
var ImpCmd = &cobra.Command{ Use: "import", Short: "Import a folder containing sharedflow bundles", Long: "Import a folder containing sharedflow bundles", 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) { if stat, err := os.Stat(folder); err == nil && !stat.IsDir() { return fmt.Errorf("supplied path is not a folder") } return sharedflows.Import(conn, folder) }, }
ImpCmd to import shared flow
View Source
var ListCmd = &cobra.Command{ Use: "list", Short: "Lists all shared flows in the organization.", Long: "Lists all shared flows in the organization.", 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 = sharedflows.List(includeRevisions) return }, }
ListCmd to list shared flow
View Source
var ListDepCmd = &cobra.Command{ Use: "listdeploy", Short: "Lists all deployments of a Sharedflow", Long: "Lists all deployments of a Sharedflow", Args: func(cmd *cobra.Command, args []string) error { apiclient.SetApigeeEnv(env) if apiclient.GetApigeeEnv() == "" && name == "" { return fmt.Errorf("sharedflow name or environment must be supplied") } if revision != -1 && name == "" { return fmt.Errorf("sharedflow name must be supplied with revision") } if name != "" && revision == -1 && apiclient.GetApigeeEnv() != "" { return fmt.Errorf("revision must be supplied with sharedflow name and env") } return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { if apiclient.GetApigeeEnv() != "" { if revision != -1 { _, err = sharedflows.ListRevisionDeployments(name, revision) } else { _, err = sharedflows.ListEnvDeployments() } } else { _, err = sharedflows.ListDeployments(name) } return err }, }
ListDepCmd to list deployed api
View Source
var UndepCmd = &cobra.Command{ Use: "undeploy", Short: "Undeploys a revision of an existing API proxy", Long: "Undeploys a revision of an existing API proxy to an environment in an organization", 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 = sharedflows.Undeploy(name, revision) return }, }
UndepCmd to undeploy shared flow
Functions ¶
func GetRevision ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.