hnspolicylist.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //go:build windows
  2. package hcsshim
  3. import (
  4. "github.com/Microsoft/hcsshim/internal/hns"
  5. )
  6. // RoutePolicy is a structure defining schema for Route based Policy
  7. type RoutePolicy = hns.RoutePolicy
  8. // ELBPolicy is a structure defining schema for ELB LoadBalancing based Policy
  9. type ELBPolicy = hns.ELBPolicy
  10. // LBPolicy is a structure defining schema for LoadBalancing based Policy
  11. type LBPolicy = hns.LBPolicy
  12. // PolicyList is a structure defining schema for Policy list request
  13. type PolicyList = hns.PolicyList
  14. // HNSPolicyListRequest makes a call into HNS to update/query a single network
  15. func HNSPolicyListRequest(method, path, request string) (*PolicyList, error) {
  16. return hns.HNSPolicyListRequest(method, path, request)
  17. }
  18. // HNSListPolicyListRequest gets all the policy list
  19. func HNSListPolicyListRequest() ([]PolicyList, error) {
  20. return hns.HNSListPolicyListRequest()
  21. }
  22. // PolicyListRequest makes a HNS call to modify/query a network policy list
  23. func PolicyListRequest(method, path, request string) (*PolicyList, error) {
  24. return hns.PolicyListRequest(method, path, request)
  25. }
  26. // GetPolicyListByID get the policy list by ID
  27. func GetPolicyListByID(policyListID string) (*PolicyList, error) {
  28. return hns.GetPolicyListByID(policyListID)
  29. }
  30. // AddLoadBalancer policy list for the specified endpoints
  31. func AddLoadBalancer(endpoints []HNSEndpoint, isILB bool, sourceVIP, vip string, protocol uint16, internalPort uint16, externalPort uint16) (*PolicyList, error) {
  32. return hns.AddLoadBalancer(endpoints, isILB, sourceVIP, vip, protocol, internalPort, externalPort)
  33. }
  34. // AddRoute adds route policy list for the specified endpoints
  35. func AddRoute(endpoints []HNSEndpoint, destinationPrefix string, nextHop string, encapEnabled bool) (*PolicyList, error) {
  36. return hns.AddRoute(endpoints, destinationPrefix, nextHop, encapEnabled)
  37. }