policy_client

package module
v0.110.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 13

README

policy_client

Go Report Card Go Reference

Policy Client allows Cloud Foundry system components to query the policy server for policies. It is currently used by the VXLAN policy agent (in silk-release)

[!NOTE]

This repository should be imported as code.cloudfoundry.org/policy_client.

Contributing

See the Contributing.md for more information on how to contribute.

Working Group Charter

This repository is maintained by App Runtime Platform under Networking area.

[!IMPORTANT]

Content in this file is managed by the CI task sync-readme and is generated by CI following a convention.

Documentation

Index

Constants

View Source
const DefaultMaxPolicies = 100

Variables

View Source
var DefaultConfig = Config{
	PerPageSecurityGroups: 5000,
}

Functions

This section is empty.

Types

type Chunker

type Chunker interface {
	Chunk(allPolicies []PolicyV0) [][]PolicyV0
}

type Config

type Config struct {
	PerPageSecurityGroups int
}

type Destination

type Destination struct {
	ID       string `json:"id"`
	Tag      string `json:"tag,omitempty"`
	Protocol string `json:"protocol"`
	Ports    Ports  `json:"ports"`
}

type DestinationV0

type DestinationV0 struct {
	ID       string `json:"id"`
	Tag      string `json:"tag,omitempty"`
	Protocol string `json:"protocol"`
	Port     int    `json:"port"`
}

type ExternalClient

type ExternalClient struct {
	JsonClient json_client.JsonClient
	Chunker    Chunker
}

func NewExternal

func NewExternal(logger lager.Logger, httpClient json_client.HttpClient, baseURL string) *ExternalClient

func (*ExternalClient) AddPolicies

func (c *ExternalClient) AddPolicies(token string, policies []Policy) error

func (*ExternalClient) AddPoliciesV0

func (c *ExternalClient) AddPoliciesV0(token string, policies []PolicyV0) error

func (*ExternalClient) DeletePolicies

func (c *ExternalClient) DeletePolicies(token string, policies []Policy) error

func (*ExternalClient) DeletePoliciesV0

func (c *ExternalClient) DeletePoliciesV0(token string, policies []PolicyV0) error

func (*ExternalClient) GetPolicies

func (c *ExternalClient) GetPolicies(token string) ([]Policy, error)

func (*ExternalClient) GetPoliciesByID

func (c *ExternalClient) GetPoliciesByID(token string, ids ...string) ([]Policy, error)

func (*ExternalClient) GetPoliciesV0

func (c *ExternalClient) GetPoliciesV0(token string) ([]PolicyV0, error)

func (*ExternalClient) GetPoliciesV0ByID

func (c *ExternalClient) GetPoliciesV0ByID(token string, ids ...string) ([]PolicyV0, error)

type ExternalPolicyClient

type ExternalPolicyClient interface {
	GetPolicies(token string) ([]Policy, error)
	GetPoliciesByID(token string, ids ...string) ([]Policy, error)
	GetPoliciesV0(token string) ([]PolicyV0, error)
	GetPoliciesV0ByID(token string, ids ...string) ([]PolicyV0, error)
	DeletePolicies(token string, policies []Policy) error
	DeletePoliciesV0(token string, policies []PolicyV0) error
	AddPolicies(token string, policies []Policy) error
	AddPoliciesV0(token string, policies []PolicyV0) error
}

type IPRange

type IPRange struct {
	Start string `json:"start"`
	End   string `json:"end"`
}

type InternalClient

type InternalClient struct {
	JsonClient json_client.JsonClient
	Config     Config
}

func NewInternal

func NewInternal(logger lager.Logger, httpClient json_client.HttpClient, baseURL string, conf Config) *InternalClient

func (*InternalClient) CreateOrGetTag

func (c *InternalClient) CreateOrGetTag(id, groupType string) (string, error)

func (*InternalClient) GetPolicies

func (c *InternalClient) GetPolicies() ([]*Policy, error)

func (*InternalClient) GetPoliciesByID

func (c *InternalClient) GetPoliciesByID(ids ...string) ([]Policy, error)

func (*InternalClient) GetPoliciesLastUpdated

func (c *InternalClient) GetPoliciesLastUpdated() (int, error)

func (*InternalClient) GetSecurityGroupsForSpace

func (c *InternalClient) GetSecurityGroupsForSpace(spaceGuids ...string) ([]SecurityGroup, error)

func (*InternalClient) GetSecurityGroupsLastUpdated added in v0.46.0

func (c *InternalClient) GetSecurityGroupsLastUpdated() (int, error)

func (*InternalClient) HealthCheck

func (c *InternalClient) HealthCheck() (bool, error)

type InternalPolicyClient

type InternalPolicyClient interface {
	GetPolicies() ([]*Policy, error)
	GetSecurityGroupsForSpace(spaceGuids []string) ([]*SecurityGroup, error)
}

type Policies

type Policies struct {
	TotalPolicies int      `json:"total_policies"`
	Policies      []Policy `json:"policies"`
}

type PoliciesV0

type PoliciesV0 struct {
	TotalPolicies int        `json:"total_policies"`
	Policies      []PolicyV0 `json:"policies"`
}

type Policy

type Policy struct {
	Source      Source      `json:"source"`
	Destination Destination `json:"destination"`
}

type PolicySlice

type PolicySlice []Policy

func (PolicySlice) Len

func (s PolicySlice) Len() int

func (PolicySlice) Less

func (s PolicySlice) Less(i, j int) bool

func (PolicySlice) Swap

func (s PolicySlice) Swap(i, j int)

type PolicyV0