Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ArchiveCmd = &cobra.Command{
Use: "archives",
Short: "Manage archive deployments for the environment",
Long: "Manage archive deployments for the environment",
}
ArchiveCmd to deploy apis via archives
var Cmd = &cobra.Command{ Use: "environments", Aliases: []string{"envs"}, Short: "Manage Apigee environments", Long: "Manage Apigee environments", }
Cmd to manage envs
var CreateArchiveCmd = &cobra.Command{ Use: "create", Short: "Create a new revision of archive in the environment", Long: "Create a new revision of archive in the environment", Args: func(cmd *cobra.Command, args []string) (err error) { if zipfile != "" && folder != "" { return fmt.Errorf("both zipfile and folder path cannot be passed") } apiclient.SetApigeeEnv(environment) return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { if folder != "" { zipfile = name + ".zip" if err = proxybundle.GenerateArchiveBundle(folder, zipfile); err != nil { return err } } respBody, err := env.CreateArchive(name, zipfile) if wait { archiveResponse := op{} if err = json.Unmarshal(respBody, &archiveResponse); err != nil { return err } s := strings.Split(archiveResponse.Name, "/") operationID := s[len(s)-1] clilog.Info.Printf("Deployment operation id is %s\n", operationID) clilog.Info.Printf("Checking deployment status in %d seconds\n", interval) apiclient.DisableCmdPrintHttpResponse() stop := apiclient.Every(interval*time.Second, func(time.Time) bool { var respOpsBody []byte respMap := op{} if respOpsBody, err = operations.Get(operationID); err != nil { return true } if err = json.Unmarshal(respOpsBody, &respMap); err != nil { return true } if respMap.Metadata.State == "IN_PROGRESS" { clilog.Info.Printf("Archive deployment status is: %s. Waiting %d seconds.\n", respMap.Metadata.State, interval) return true } else if respMap.Metadata.State == "FINISHED" { if respMap.Error == (operationError{}) { clilog.Info.Println("Archive deployment completed with status: ", respMap.Metadata.State) } else { clilog.Info.Printf("Archive deployment failed with status: %s", respMap.Error.Message) } return false } else { clilog.Info.Printf("Unknown state %s", respMap.Metadata.State) return false } }) <-stop } return err }, }
CreateArchiveCmd to create env archive
var CreateCmd = &cobra.Command{ Use: "create", Short: "Create a new environment", Long: "Create a new 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 = env.Create(deploymentType, apiProxyType) return }, }
CreateCmd to create env
var CrtTraceOverridesCmd = &cobra.Command{ Use: "create", Short: "Create a new Distributed Trace config override", Long: "Create a new Distributed Trace config override", 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 = environments.CreateTraceOverrides(apiProxy, exporter, endpoint, sampler, sampleRate) return }, }
CrtTraceOverridesCmd to manage tracing of apis
var DebugCmd = &cobra.Command{
Use: "debugmask",
Short: "Manage debugmasks for the environment",
Long: "Manage debugmasks for the environment",
}
DebugCmd to manage debug masks
var DelArchiveCmd = &cobra.Command{ Use: "delete", Short: "Delete Apigee Archive from the environment", Long: "Delete Apigee Archive from the 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 = env.DeleteArchive(name) return }, }
DelArchiveCmd to list envs
var DelCmd = &cobra.Command{ Use: "delete", Short: "Delete an environment", Long: "Delete 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 = env.Delete() return }, }
DelCmd to delete env
var DeployCmd = &cobra.Command{
Use: "deployments",
Short: "Manage deployments for the environment",
Long: "Manage deployments for the environment",
}
DeployCmd to manage api deployments for an environment
var DisableTraceConfigCmd = &cobra.Command{ Use: "disable", Short: "Disable Distributed Trace config for the environment", Long: "Disable Distributed Trace config for the 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 = environments.DisableTraceConfig() return }, }
DisableTraceConfigCmd to manage tracing of apis
var GetArchiveCmd = &cobra.Command{ Use: "get", Short: "Get archive details", Long: "Get archive details", 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 = env.GetArchive(name) return }, }
GetArchiveCmd to list envs
var GetCmd = &cobra.Command{ Use: "get", Short: "Get properties of an environment", Long: "Get properties of 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 = env.Get(config) return }, }
GetCmd to get env details
var GetConfigCmd = &cobra.Command{ Use: "config", Short: "Get deployment configuration for an Environment", Long: "Get deployment configuration for 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 = environments.GetDeployedConfig() return }, }
GetConfigCmd to get deployed apis in an env
var GetDebugCmd = &cobra.Command{ Use: "get", Short: "Get debugmasks for an Environment", Long: "Get debugmasks for 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 = environments.GetDebug() return }, }
GetDebugCmd to get debug masks
var GetDeployCmd = &cobra.Command{ Use: "get", Short: "Get deployments for an Environment", Long: "Get deployments for 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) { if all { _, err = environments.GetAllDeployments() } else { _, err = environments.GetDeployments(sharedflows) } return err }, }
GetDeployCmd to get deployed apis in an env
var GetIamCmd = &cobra.Command{ Use: "get", Short: "Gets the IAM policy on an Environment", Long: "Gets the IAM policy on 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 = environments.GetIAM() return }, }
GetIamCmd to get env iam details
var GetTraceConfigCmd = &cobra.Command{ Use: "get", Short: "Get Distributed Trace config for the environment", Long: "Get Distributed Trace config for the 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 = environments.GetTraceConfig() return }, }
GetTraceConfigCmd to manage tracing of apis
var GetTraceOverridesCmd = &cobra.Command{ Use: "get", Short: "Get Distributed Trace config overrides", Long: "Get Distributed Trace config overrides", 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 = environments.GetTraceOverrides(configName) return }, }
GetTraceOverridesCmd to manage tracing of apis
var IamCmd = &cobra.Command{
Use: "iam",
Short: "Manage IAM permissions for the environment",
Long: "Manage IAM permissions for the environment",
}
IamCmd to manage manage env iam permissions
var ListArchiveCmd = &cobra.Command{ Use: "list", Short: "List archives deployed to the environment", Long: "List archives deployed to the 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 = env.ListArchives() return }, }
ListArchiveCmd to list archives in env
var ListCmd = &cobra.Command{ Use: "list", Short: "List environments in an Apigee Org", Long: "List environments in an Apigee Org", Args: func(cmd *cobra.Command, args []string) (err error) { return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { _, err = env.List() return }, }
ListCmd to list envs
var ListTraceOverridesCmd = &cobra.Command{ Use: "list", Short: "List Distributed Trace config overrides", Long: "List Distributed Trace config overrides", 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 = environments.ListTraceOverrides() return }, }
ListTraceOverridesCmd to manage tracing of apis
var ObCmd = &cobra.Command{ Use: "ax-obfuscation", Short: "Obfuscate analytics fields", Long: "Obfuscate analytics fields before sending to control plane", 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) { return env.SetEnvProperty("features.analytics.data.obfuscation.enabled", strconv.FormatBool(enable)) }, }
ObCmd to enable AX obfuscation
var PropCmd = &cobra.Command{ Use: "set", Short: "Set environment property", Long: "Set environment property", 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) { return env.SetEnvProperty(propName, propValue) }, }
PropCmd to set env prop
var RemoveRoleCmd = &cobra.Command{ Use: "removerole", Short: "Remove a member or SA from a role for an environment", Long: "Remove a member or SA from a role for 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 = environments.RemoveIAM(memberName, role) if err != nil { return err } clilog.Info.Printf("Member %s removed access to role %s\n", memberName, role) return nil }, }
RemoveRoleCmd to a member from a role
var SetAxCmd = &cobra.Command{ Use: "setax", Short: "Set Analytics Agent role for a member on an environment", Long: "Set Analytics Agent role for a member an Environment", Args: func(cmd *cobra.Command, args []string) (err error) { if role != "analyticsAgent" && role != "analyticsViewer" { return fmt.Errorf("invalid memberRole. Member role must be analyticsViewer or analyticsAgent") } apiclient.SetApigeeEnv(environment) return apiclient.SetApigeeOrg(org) }, RunE: func(cmd *cobra.Command, args []string) (err error) { err = environments.SetIAM(memberName, role, memberType) if err != nil { return err } clilog.Info.Printf("Member %s granted access to %s role\n", memberName, role) return nil }, }
SetAxCmd to set role on env
var SetCustCmd = &cobra.Command{ Use: "setcustom", Short: "Set a custom role for a member on an environment", Long: "Set a custom role for a member on 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) { re := regexp.MustCompile(`projects\/([a-zA-Z0-9_-]+)\/roles\/([a-zA-Z0-9_-]+)`) result := re.FindString(role) if result == "" { return fmt.Errorf("custom role must be of the format projects/{project-id}/roles/{role-name}") } err = environments.SetIAM(memberName, role, memberType) if err != nil { return err } clilog.Info.Printf("Member %s, granted access to %s\n", memberName, role) return nil }, }
SetCustCmd to manage custom roles for an env
var SetDebugCmd = &cobra.Command{ Use: "set", Short: "Set debugmasks for an Environment", Long: "Set debugmasks for 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 = environments.SetDebug(payload) return }, }
SetDebugCmd to set debug mas on env
var SetDepCmd = &cobra.Command{ Use: "setdeploy", Short: "Set Apigee Deployer role for a member on an environment", Long: "Set Apigee Deployer role for a member on 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 = environments.SetIAM(memberName, "deploy", memberType) if err != nil { return err } clilog.Info.Printf("Member %s granted access to Apigee Deployer role\n", memberName) return nil }, }
SetDepCmd to set deployer role on env
var SetSyncCmd = &cobra.Command{ Use: "setsync", Short: "Set Synchronization Manager role for a member on an environment", Long: "Set Synchronization Manager role for a member on 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 = environments.SetIAM(memberName, "sync", memberType) if err != nil { return err } clilog.Info.Printf("Member %s granted access to Apigee Synchronizer Manager role\n", memberName) return nil }, }
SetSyncCmd to manage tracing of apis
var TestIamCmd = &cobra.Command{ Use: "test", Short: "Test IAM policy for an Environment", Long: "Test IAM policy for 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 = environments.TestIAM(resource, verb) return }, }
TestIamCmd to manage tracing of apis
var TraceConfigCmd = &cobra.Command{
Use: "traceconfig",
Short: "Manage Distributed Trace config for the environment",
Long: "Manage Distributed Trace config for the environment",
}
TraceConfigCmd to manage tracing of apis
var TraceOverridesCmd = &cobra.Command{
Use: "overrides",
Short: "Manage Distributed Trace config overrides for the environment",
Long: "Manage Distributed Trace config overrides for the environment",
}
TraceOverridesCmd to manage tracing of apis
var UpdateTraceConfigCmd = &cobra.Command{ Use: "update", Short: "Update Distributed Trace config for the environment", Long: "Update Distributed Trace config for the 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 = environments.UpdateTraceConfig(exporter, endpoint, sampler, sampleRate) return }, }
UpdateTraceConfigCmd to manage tracing of apis
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files
¶
- archives.go
- crtarchive.go
- crtenv.go
- crttraceoverrides.go
- debugmask.go
- delarchive.go
- delenv.go
- deployments.go
- disabletracecfg.go
- enableaxob.go
- env.go
- getarchive.go
- getdebugmask.go
- getdeloyedconfig.go
- getdeployments.go
- getenv.go
- getiam.go
- gettracecfg.go
- gettraceoverrides.go
- iam.go
- listarchives.go
- listenv.go
- listtraceoverrides.go
- removerole.go
- setax.go
- setcustom.go
- setdebugmask.go
- setdeploy.go
- setprop.go
- setsync.go
- testiam.go
- traceconfig.go
- traceoverrides.go
- updatetracecfg.go