Documentation ¶
Overview ¶
Package client implements the northbound client used to manage Calico configuration.
This client is the main entry point for applications that are managing or querying Calico configuration.
This client provides a typed interface for managing different resource types. The definitions for each resource type are defined in the following package:
github.com/projectcalico/libcalico-go/lib/api
The client has a number of methods that return interfaces for managing:
- BGP Peer resources
- Policy resources
- IP Pool resources
- Host endpoint resources
- Workload endpoint resources
- Profile resources
- IP Address Management (IPAM)
See [resource definitions](http://docs.projectcalico.org/latest/reference/calicoctl/resources/) for details about the set of management commands for each resource type.
Index ¶
- type BGPConfigurationInterface
- type BGPPeerInterface
- type ClusterInformationInterface
- type FelixConfigurationInterface
- type GlobalNetworkPolicyInterface
- type HostEndpointInterface
- type IPPoolInterface
- type Interface
- type NetworkPolicyInterface
- type NodeInterface
- type ProfileInterface
- type WorkloadEndpointInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BGPConfigurationInterface ¶
type BGPConfigurationInterface interface { Create(ctx context.Context, res *apiv2.BGPConfiguration, opts options.SetOptions) (*apiv2.BGPConfiguration, error) Update(ctx context.Context, res *apiv2.BGPConfiguration, opts options.SetOptions) (*apiv2.BGPConfiguration, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.BGPConfiguration, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.BGPConfiguration, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.BGPConfigurationList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
BGPConfigurationInterface has methods to work with BGPConfiguration resources.
type BGPPeerInterface ¶
type BGPPeerInterface interface { Create(ctx context.Context, res *apiv2.BGPPeer, opts options.SetOptions) (*apiv2.BGPPeer, error) Update(ctx context.Context, res *apiv2.BGPPeer, opts options.SetOptions) (*apiv2.BGPPeer, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.BGPPeer, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.BGPPeer, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.BGPPeerList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
BGPPeerInterface has methods to work with BGPPeer resources.
type ClusterInformationInterface ¶
type ClusterInformationInterface interface { Create(ctx context.Context, res *apiv2.ClusterInformation, opts options.SetOptions) (*apiv2.ClusterInformation, error) Update(ctx context.Context, res *apiv2.ClusterInformation, opts options.SetOptions) (*apiv2.ClusterInformation, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.ClusterInformation, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.ClusterInformation, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.ClusterInformationList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
ClusterInformationInterface has methods to work with ClusterInformation resources.
type FelixConfigurationInterface ¶
type FelixConfigurationInterface interface { Create(ctx context.Context, res *apiv2.FelixConfiguration, opts options.SetOptions) (*apiv2.FelixConfiguration, error) Update(ctx context.Context, res *apiv2.FelixConfiguration, opts options.SetOptions) (*apiv2.FelixConfiguration, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.FelixConfiguration, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.FelixConfiguration, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.FelixConfigurationList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
FelixConfigurationInterface has methods to work with FelixConfiguration resources.
type GlobalNetworkPolicyInterface ¶
type GlobalNetworkPolicyInterface interface { Create(ctx context.Context, res *apiv2.GlobalNetworkPolicy, opts options.SetOptions) (*apiv2.GlobalNetworkPolicy, error) Update(ctx context.Context, res *apiv2.GlobalNetworkPolicy, opts options.SetOptions) (*apiv2.GlobalNetworkPolicy, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.GlobalNetworkPolicy, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.GlobalNetworkPolicy, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.GlobalNetworkPolicyList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
GlobalNetworkPolicyInterface has methods to work with GlobalNetworkPolicy resources.
type HostEndpointInterface ¶
type HostEndpointInterface interface { Create(ctx context.Context, res *apiv2.HostEndpoint, opts options.SetOptions) (*apiv2.HostEndpoint, error) Update(ctx context.Context, res *apiv2.HostEndpoint, opts options.SetOptions) (*apiv2.HostEndpoint, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.HostEndpoint, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.HostEndpoint, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.HostEndpointList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
HostEndpointInterface has methods to work with HostEndpoint resources.
type IPPoolInterface ¶
type IPPoolInterface interface { Create(ctx context.Context, res *apiv2.IPPool, opts options.SetOptions) (*apiv2.IPPool, error) Update(ctx context.Context, res *apiv2.IPPool, opts options.SetOptions) (*apiv2.IPPool, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.IPPool, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.IPPool, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.IPPoolList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
IPPoolInterface has methods to work with IPPool resources.
type Interface ¶
type Interface interface { // Nodes returns an interface for managing node resources. Nodes() NodeInterface // GlobalNetworkPolicies returns an interface for managing global network policy resources. GlobalNetworkPolicies() GlobalNetworkPolicyInterface // NetworkPolicies returns an interface for managing namespaced network policy resources. NetworkPolicies() NetworkPolicyInterface // IPPools returns an interface for managing IP pool resources. IPPools() IPPoolInterface // Profiles returns an interface for managing profile resources. Profiles() ProfileInterface // HostEndpoints returns an interface for managing host endpoint resources. HostEndpoints() HostEndpointInterface // WorkloadEndpoints returns an interface for managing workload endpoint resources. WorkloadEndpoints() WorkloadEndpointInterface // BGPPeers returns an interface for managing BGP peer resources. BGPPeers() BGPPeerInterface // IPAM returns an interface for managing IP address assignment and releasing. IPAM() ipam.Interface // BGPConfigurations returns an interface for managing the BGP configuration resources. BGPConfigurations() BGPConfigurationInterface // FelixConfigurations returns an interface for managing the Felix configuration resources. FelixConfigurations() FelixConfigurationInterface // ClusterInformation returns an interface for managing the cluster information resource. ClusterInformation() ClusterInformationInterface // EnsureInitialized is used to ensure the backend datastore is correctly // initialized for use by Calico. This method may be called multiple times, and // will have no effect if the datastore is already correctly initialized. // Most Calico deployment scenarios will automatically implicitly invoke this // method and so a general consumer of this API can assume that the datastore // is already initialized. EnsureInitialized() error }
func New ¶
func New(config apiconfig.CalicoAPIConfig) (Interface, error)
New returns a connected client. The ClientConfig can either be created explicitly, or can be loaded from a config file or environment variables using the LoadClientConfig() function.
func NewFromEnv ¶
NewFromEnv loads the config from ENV variables and returns a connected client.
type NetworkPolicyInterface ¶
type NetworkPolicyInterface interface { Create(ctx context.Context, res *apiv2.NetworkPolicy, opts options.SetOptions) (*apiv2.NetworkPolicy, error) Update(ctx context.Context, res *apiv2.NetworkPolicy, opts options.SetOptions) (*apiv2.NetworkPolicy, error) Delete(ctx context.Context, namespace, name string, opts options.DeleteOptions) (*apiv2.NetworkPolicy, error) Get(ctx context.Context, namespace, name string, opts options.GetOptions) (*apiv2.NetworkPolicy, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.NetworkPolicyList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
NetworkPolicyInterface has methods to work with NetworkPolicy resources.
type NodeInterface ¶
type NodeInterface interface { Create(ctx context.Context, res *apiv2.Node, opts options.SetOptions) (*apiv2.Node, error) Update(ctx context.Context, res *apiv2.Node, opts options.SetOptions) (*apiv2.Node, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.Node, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.Node, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.NodeList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
NodeInterface has methods to work with Node resources.
type ProfileInterface ¶
type ProfileInterface interface { Create(ctx context.Context, res *apiv2.Profile, opts options.SetOptions) (*apiv2.Profile, error) Update(ctx context.Context, res *apiv2.Profile, opts options.SetOptions) (*apiv2.Profile, error) Delete(ctx context.Context, name string, opts options.DeleteOptions) (*apiv2.Profile, error) Get(ctx context.Context, name string, opts options.GetOptions) (*apiv2.Profile, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.ProfileList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
ProfileInterface has methods to work with Profile resources.
type WorkloadEndpointInterface ¶
type WorkloadEndpointInterface interface { Create(ctx context.Context, res *apiv2.WorkloadEndpoint, opts options.SetOptions) (*apiv2.WorkloadEndpoint, error) Update(ctx context.Context, res *apiv2.WorkloadEndpoint, opts options.SetOptions) (*apiv2.WorkloadEndpoint, error) Delete(ctx context.Context, namespace, name string, opts options.DeleteOptions) (*apiv2.WorkloadEndpoint, error) Get(ctx context.Context, namespace, name string, opts options.GetOptions) (*apiv2.WorkloadEndpoint, error) List(ctx context.Context, opts options.ListOptions) (*apiv2.WorkloadEndpointList, error) Watch(ctx context.Context, opts options.ListOptions) (watch.Interface, error) }
WorkloadEndpointInterface has methods to work with WorkloadEndpoint resources.