// GetSpaceRunningSecurityGroupsBySpace returns a list of all security groups
// bound to this space in the 'running' lifecycle phase.
510653
func (actor Actor) GetSpaceRunningSecurityGroupsBySpace(spaceGUID string) ([]SecurityGroup, Warnings, error) {
	ccv2SecurityGroups, warnings, err := actor.CloudControllerClient.GetSpaceSecurityGroups(spaceGUID)
	return processSecurityGroups(spaceGUID, ccv2SecurityGroups, Warnings(warnings), err)
}
157551
func (t *Template) GetAllAWSRedshiftClusterSecurityGroupResources() map[string]*resources.AWSRedshiftClusterSecurityGroup {
	results := map[string]*resources.AWSRedshiftClusterSecurityGroup{}
	for name, untyped := range t.Resources {
		switch resource := untyped.(type) {
		case *resources.AWSRedshiftClusterSecurityGroup:
			results[name] = resource
		}
	}
	return results
}
1113971
func GetNamespaceContainerIds(namespaceId string) ([]string, error) {
	namespace, err := GetNamespaceByID(namespaceId)
	if err != nil {
		return nil, err
	}
	var containerIds []string
	for _, resource := range namespace.Resources {
		if resource.Type == "Container" {
			var contaienrResource NamespaceResourceContainer
			if err := json.Unmarshal([]byte(resource.Data), &contaienrResource); err != nil {
				return nil, err
			}
			containerIds = append(containerIds, contaienrResource.Id)
		}
	}
	return containerIds, nil
}
117355
func (s *Service) SpaceAppAccessList(ctx context.Context, spaceIdentity string, lr *ListRange) (SpaceAppAccessListResult, error) {
	var spaceAppAccess SpaceAppAccessListResult
	return spaceAppAccess, s.Get(ctx, &spaceAppAccess, fmt.Sprintf("/spaces/%v/members", spaceIdentity), nil, lr)
}
172237
func (actor Actor) GetOrganizationSpaces(orgGUID string) ([]Space, Warnings, error) {
	ccv2Spaces, warnings, err := actor.CloudControllerClient.GetSpaces(ccv3.Query{
		Key:    ccv3.OrganizationGUIDFilter,
		Values: []string{orgGUID},
	})
	if err != nil {
		return []Space{}, Warnings(warnings), err
	}

	spaces := make([]Space, len(ccv2Spaces))
	for i, ccv2Space := range ccv2Spaces {
		spaces[i] = Space(ccv2Space)
	}

	return spaces, Warnings(warnings), nil
}
261535
func (c *Client) AuthorizeSecurityGroupIngress(p *AuthorizeSecurityGroupIngressParameter) (*SecurityGroupIngress, error) {
	obj, err := c.Request("authorizeSecurityGroupIngress", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*SecurityGroupIngress), err
}
429309
func (s *StateStore) AllocsByNamespace(ws memdb.WatchSet, namespace string) (memdb.ResultIterator, error) {
	txn := s.db.Txn(false)
	return s.allocsByNamespaceImpl(ws, txn, namespace)
}
275986
func (client *Client) GetSpaceStagingSecurityGroups(spaceGUID string, filters ...Filter) ([]SecurityGroup, Warnings, error) {
	return client.getSpaceSecurityGroupsBySpaceAndLifecycle(spaceGUID, internal.GetSpaceStagingSecurityGroupsRequest, filters)
}
31016
func (p *podTolerationsPlugin) getNamespace(nsName string) (*corev1.Namespace, error) {
	namespace, err := p.namespaceLister.Get(nsName)
	if errors.IsNotFound(err) {
		// in case of latency in our caches, make a call direct to storage to verify that it truly exists or not
		namespace, err = p.client.CoreV1().Namespaces().Get(nsName, metav1.GetOptions{})
		if err != nil {
			if errors.IsNotFound(err) {
				return nil, err
			}
			return nil, errors.NewInternalError(err)
		}
	} else if err != nil {
		return nil, errors.NewInternalError(err)
	}

	return namespace, nil
}
570480
func (vm *VM) fillSecurityGroupsID() error {

	params := url.Values{}

	client := vm.getExoClient()
	resp, err := client.Request("listSecurityGroups", params)
	if err != nil {
		return fmt.Errorf("Getting security groups: %s", err)
	}

	sgRemotes := &egoscale.ListSecurityGroupsResponse{}
	if err := json.Unmarshal(resp, sgRemotes); err != nil {
		return fmt.Errorf("Decoding response for security groups: %s", err)
	}

	for i, sg := range vm.SecurityGroups {

		if sg.ID != "" {
			continue
		}

		newID := ""
		for _, sgRemote := range sgRemotes.SecurityGroups {
			if sg.Name == sgRemote.Name {
				newID = sgRemote.Id
				break
			}
		}

		if newID == "" {
			return fmt.Errorf("Could not find security group ID for %q", sg.Name)
		}
		vm.SecurityGroups[i].ID = newID
	}

	return nil
}
749693
func (env *environ) Spaces(ctx context.ProviderCallContext) ([]network.SpaceInfo, error) {
	if err := env.checkBroken("Spaces"); err != nil {
		return []network.SpaceInfo{}, err
	}
	return []network.SpaceInfo{{
		Name:       "foo",
		ProviderId: network.Id("0"),
		Subnets: []network.SubnetInfo{{
			ProviderId:        network.Id("1"),
			AvailabilityZones: []string{"zone1"},
		}, {
			ProviderId:        network.Id("2"),
			AvailabilityZones: []string{"zone1"},
		}}}, {
		Name:       "Another Foo 99!",
		ProviderId: "1",
		Subnets: []network.SubnetInfo{{
			ProviderId:        network.Id("3"),
			AvailabilityZones: []string{"zone1"},
		}}}, {
		Name:       "foo-",
		ProviderId: "2",
		Subnets: []network.SubnetInfo{{
			ProviderId:        network.Id("4"),
			AvailabilityZones: []string{"zone1"},
		}}}, {
		Name:       "---",
		ProviderId: "3",
		Subnets: []network.SubnetInfo{{
			ProviderId:        network.Id("5"),
			AvailabilityZones: []string{"zone1"},
		}}}}, nil
}
101822
func (client *Client) GetSpaceQuotas(orgGUID string) ([]SpaceQuota, Warnings, error) {
	request, err := client.newHTTPRequest(requestOptions{
		RequestName: internal.GetOrganizationSpaceQuotasRequest,
		URIParams:   Params{"organization_guid": orgGUID},
	})

	if err != nil {
		return nil, nil, err
	}

	var spaceQuotas []SpaceQuota
	warnings, err := client.paginate(request, SpaceQuota{}, func(item interface{}) error {
		if spaceQuota, ok := item.(SpaceQuota); ok {
			spaceQuotas = append(spaceQuotas, spaceQuota)
		} else {
			return ccerror.UnknownObjectInListError{
				Expected:   SpaceQuota{},
				Unexpected: item,
			}
		}
		return nil
	})

	return spaceQuotas, warnings, err
}
483658
func WithNamespacedCgroup() SpecOpts {
	return func(ctx context.Context, _ Client, c *containers.Container, s *Spec) error {
		namespace, err := namespaces.NamespaceRequired(ctx)
		if err != nil {
			return err
		}
		setLinux(s)
		s.Linux.CgroupsPath = filepath.Join("/", namespace, c.ID)
		return nil
	}
}
1096367
func (a *AuthWithRoles) GetNamespace(name string) (*services.Namespace, error) {
	if err := a.action(defaults.Namespace, services.KindNamespace, services.VerbRead); err != nil {
		return nil, trace.Wrap(err)
	}
	return a.authServer.GetNamespace(name)
}
185216
func (b *KopsModelContext) SecurityGroupName(role kops.InstanceGroupRole) string {
	switch role {
	case kops.InstanceGroupRoleBastion:
		return "bastion." + b.ClusterName()
	case kops.InstanceGroupRoleNode:
		return "nodes." + b.ClusterName()
	case kops.InstanceGroupRoleMaster:
		return "masters." + b.ClusterName()
	default:
		glog.Fatalf("unknown role: %v", role)
		return ""
	}
}
288299
func (e *Endpoint) GetK8sNamespace() string {
	e.UnconditionalRLock()
	ns := e.K8sNamespace
	e.RUnlock()
	return ns
}
633077
func (c *rackspaceFirewaller) GetSecurityGroups(ctx context.ProviderCallContext, ids ...instance.Id) ([]string, error) {
	return nil, nil
}