// GetEnvironmentAction handles the retrieval of environments
353070
func getEnvironmentAction(client *gocd.Client, c *cli.Context) (r interface{}, resp *gocd.APIResponse, err error) {
	var name string
	if name = c.String("name"); name == "" {
		return nil, nil, NewFlagError("name")
	}
	e, resp, err := client.Environments.Get(context.Background(), name)
	if err == nil {
		e.RemoveLinks()
	}
	return e, resp, err
}
795993
func (kc *kubeClient) GetEnvironments() ([]*app.SimpleEnvironment, error) {
	envs := []*app.SimpleEnvironment{}
	for envName := range kc.envMap {
		// Only return environments where the user can deploy applications
		if kc.CanDeploy(envName) {
			env, err := kc.GetEnvironment(envName)
			if err != nil {
				return nil, err
			}
			envs = append(envs, env)
		}
	}
	return envs, nil
}
244602
func (p *PullRequestEvent) GetAction() string {
	if p == nil || p.Action == nil {
		return ""
	}
	return *p.Action
}
766540
func (m *MilestoneEvent) GetAction() string {
	if m == nil || m.Action == nil {
		return ""
	}
	return *m.Action
}
269829
func (d *DeploymentRequest) GetEnvironment() string {
	if d == nil || d.Environment == nil {
		return ""
	}
	return *d.Environment
}
939021
func (r *RepositoryVulnerabilityAlertEvent) GetAction() string {
	if r == nil || r.Action == nil {
		return ""
	}
	return *r.Action
}
448744
func (c *CommitCommentEvent) GetAction() string {
	if c == nil || c.Action == nil {
		return ""
	}
	return *c.Action
}
610596
func (c *Gcd) AddEnvironmentVars(vars []string) {
	c.env = append(c.env, vars...)
}
1212157
func EnvironmentFromURL(resourceManagerEndpoint string, properties ...OverrideProperty) (environment Environment, err error) {
	var metadataEnvProperties environmentMetadataInfo

	if resourceManagerEndpoint == "" {
		return environment, fmt.Errorf("Metadata resource manager endpoint is empty")
	}

	if metadataEnvProperties, err = retrieveMetadataEnvironment(resourceManagerEndpoint); err != nil {
		return environment, err
	}

	// Give priority to user's override values
	overrideProperties(&environment, properties)

	if environment.Name == "" {
		environment.Name = "HybridEnvironment"
	}
	stampDNSSuffix := environment.StorageEndpointSuffix
	if stampDNSSuffix == "" {
		stampDNSSuffix = strings.TrimSuffix(strings.TrimPrefix(strings.Replace(resourceManagerEndpoint, strings.Split(resourceManagerEndpoint, ".")[0], "", 1), "."), "/")
		environment.StorageEndpointSuffix = stampDNSSuffix
	}
	if environment.KeyVaultDNSSuffix == "" {
		environment.KeyVaultDNSSuffix = fmt.Sprintf("%s.%s", "vault", stampDNSSuffix)
	}
	if environment.KeyVaultEndpoint == "" {
		environment.KeyVaultEndpoint = fmt.Sprintf("%s%s", "https://", environment.KeyVaultDNSSuffix)
	}
	if environment.TokenAudience == "" {
		environment.TokenAudience = metadataEnvProperties.Authentication.Audiences[0]
	}
	if environment.ActiveDirectoryEndpoint == "" {
		environment.ActiveDirectoryEndpoint = metadataEnvProperties.Authentication.LoginEndpoint
	}
	if environment.ResourceManagerEndpoint == "" {
		environment.ResourceManagerEndpoint = resourceManagerEndpoint
	}
	if environment.GalleryEndpoint == "" {
		environment.GalleryEndpoint = metadataEnvProperties.GalleryEndpoint
	}
	if environment.GraphEndpoint == "" {
		environment.GraphEndpoint = metadataEnvProperties.GraphEndpoint
	}

	return environment, nil
}
308579
func (qr *Rule) GetAction(ip, user string, bindVars map[string]*querypb.BindVariable) Action {
	if !reMatch(qr.requestIP.Regexp, ip) {
		return QRContinue
	}
	if !reMatch(qr.user.Regexp, user) {
		return QRContinue
	}
	for _, bvcond := range qr.bindVarConds {
		if !bvMatch(bvcond, bindVars) {
			return QRContinue
		}
	}
	return qr.act
}
308202
func (g *GitHubAppAuthorizationEvent) GetAction() string {
	if g == nil || g.Action == nil {
		return ""
	}
	return *g.Action
}
1082271
func GetEnvironment() Environment {
	v := strings.ToLower(os.Getenv(EnvVarName))
	for env, l := range EnvMap {
		for _, e := range l {
			if e == v {
				return env
			}
		}
	}
	return EnvUnknown
}
785952
func listEnvironmentsCommand() *cli.Command {
	return &cli.Command{
		Name:     ListEnvironmentsCommandName,
		Usage:    ListEnvironmentsCommandUsage,
		Action:   ActionWrapper(listEnvironmentsAction),
		Category: "Environments",
	}
}
745299
func (clg *ClientBackedDryRunGetter) HandleGetAction(action core.GetAction) (bool, runtime.Object, error) {
	unstructuredObj, err := clg.dynamicClient.Resource(action.GetResource()).Namespace(action.GetNamespace()).Get(action.GetName(), metav1.GetOptions{})
	// Inform the user that the requested object wasn't found.
	printIfNotExists(err)
	if err != nil {
		return true, nil, err
	}
	newObj, err := decodeUnstructuredIntoAPIObject(action, unstructuredObj)
	if err != nil {
		fmt.Printf("error after decode: %v %v\n", unstructuredObj, err)
		return true, nil, err
	}
	return true, newObj, err
}
44942
func NewEnviron(api NetworkingAPI, env commonProvider.OracleInstancer) *Environ {
	return &Environ{
		client: api,
		env:    env,
	}
}
385039
func (p *Page) GetAction() string {
	if p == nil || p.Action == nil {
		return ""
	}
	return *p.Action
}
326774
func (up *tenantURLProvider) GetEnvironmentMapping() map[string]string {
	result := make(map[string]string)
	// Exclude internal namespaces where the user cannot deploy applications

	// Deployments API will receive requests by environment name (e.g. "run", "stage").
	// These names correspond to the "type" attribute in Namespaces.
	for envNS, attr := range up.namespaces {
		envName := attr.Type
		if envName == nil || len(*envName) == 0 {
			log.Error(nil, map[string]interface{}{
				"namespace": envNS,
			}, "namespace has no type")
		} else {
			result[*envName] = envNS
		}
	}
	return result
}