DefaultEndpoint returns a basic xds Endpoint resource.
(clusterName string, host string, ports []uint32)
| 675 | |
| 676 | // DefaultEndpoint returns a basic xds Endpoint resource. |
| 677 | func DefaultEndpoint(clusterName string, host string, ports []uint32) *v3endpointpb.ClusterLoadAssignment { |
| 678 | var bOpts []BackendOptions |
| 679 | for _, p := range ports { |
| 680 | bOpts = append(bOpts, BackendOptions{Ports: []uint32{p}, Weight: 1}) |
| 681 | } |
| 682 | return EndpointResourceWithOptions(EndpointOptions{ |
| 683 | ClusterName: clusterName, |
| 684 | Host: host, |
| 685 | Localities: []LocalityOptions{ |
| 686 | { |
| 687 | Backends: bOpts, |
| 688 | Weight: 1, |
| 689 | }, |
| 690 | }, |
| 691 | }) |
| 692 | } |
| 693 | |
| 694 | // EndpointResourceWithOptions returns an xds Endpoint resource configured with |
| 695 | // the provided options. |