env

package
v1.7.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:     "envs",
	Aliases: []string{"environments"},
	Short:   "Manage Apigee environments",
	Long:    "Manage Apigee environments",
}

Cmd to manage envs

View Source
var DebugCmd = &cobra.Command{
	Use:   "debugmask",
	Short: "Manage debugmasks for the environment",
	Long:  "Manage debugmasks for the environment",
}

Cmd to manage tracing of apis

View Source
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

View Source
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.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = env.Get(config)
		return
	},
}

Cmd to get env details

View Source
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.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = environments.GetDebug()
		return
	},
}

Cmd to manage tracing of apis

View Source
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.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = environments.GetDeployments()
		return
	},
}

DeployCmd to get deployed apis in an env

View Source
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.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = environments.GetIAM()
		return
	},
}

Cmd to manage tracing of apis

View Source
var IamCmd = &cobra.Command{
	Use:   "iam",
	Short: "Manage IAM permissions for the environment",
	Long:  "Manage IAM permissions for the environment",
}

Cmd to manage tracing of apis

View Source
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) {
		apiclient.SetApigeeOrg(org)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = env.List()
		return
	},
}

Cmd to list envs

View Source
var ObCmd = &cobra.Command{
	Use:   "enable-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.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		return env.SetEnvProperty("features.analytics.data.obfuscation.enabled", "true")
	},
}

Cmd to enable AX obfuscation

View Source
var PropCmd = &cobra.Command{
	Use:   "set",
	Short: "Set environment property",
	Long:  "Set environment property",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		return env.SetEnvProperty(propName, propValue)
	},
}

Cmd to set mart endpoint

View Source
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.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		err = environments.RemoveIAM(serviceAccountName, role)
		if err != nil {
			return err
		}
		fmt.Printf("Service account %s removed access to role %s\n", serviceAccountName, role)
		return nil
	},
}

RemoveRoleCmd to a member from a role

View Source
var SetAxCmd = &cobra.Command{
	Use:   "setax",
	Short: "Set Analytics Agent role for a SA on an environment",
	Long:  "Set Analytics Agent role for a SA an Environment",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		err = environments.SetIAM(serviceAccountName, "analytics")
		if err != nil {
			return err
		}
		fmt.Printf("Service account %s granted access to Apigee Analytics Viewer role\n", serviceAccountName)
		return nil
	},
}

Cmd to manage tracing of apis

View Source
var SetCustCmd = &cobra.Command{
	Use:   "setcustom",
	Short: "Set a custom role for a SA on an environment",
	Long:  "Set a custom role for a SA on an environment",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	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(serviceAccountName, role)
		if err != nil {
			return err
		}
		fmt.Printf("Service account %s, granted access to %s\n", serviceAccountName, role)
		return nil
	},
}

SetCustCmd to manage custom roles for an env

View Source
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.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = environments.SetDebug(payload)
		return
	},
}

Cmd to manage tracing of apis

View Source
var SetDepCmd = &cobra.Command{
	Use:   "setdeploy",
	Short: "Set Apigee Deployer role for a SA on an environment",
	Long:  "Set Apigee Deployer role for a SA on an environment",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		err = environments.SetIAM(serviceAccountName, "deploy")
		if err != nil {
			return err
		}
		fmt.Printf("Service account %s granted access to Apigee Deployer role\n", serviceAccountName)
		return nil
	},
}

Cmd to manage tracing of apis

View Source
var SetSyncCmd = &cobra.Command{
	Use:   "setsync",
	Short: "Set Synchronization Manager role for a SA on an environment",
	Long:  "Set Synchronization Manager role for a SA on an environment",
	Args: func(cmd *cobra.Command, args []string) (err error) {
		apiclient.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		err = environments.SetIAM(serviceAccountName, "sync")
		if err != nil {
			return err
		}
		fmt.Printf("Service account %s granted access to Apigee Synchronizer Manager role\n", serviceAccountName)
		return nil
	},
}

Cmd to manage tracing of apis

View Source
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.SetApigeeOrg(org)
		apiclient.SetApigeeEnv(environment)
		return nil
	},
	RunE: func(cmd *cobra.Command, args []string) (err error) {
		_, err = environments.TestIAM()
		return
	},
}

Cmd to manage tracing of apis

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