예제 #1
0
// listPorts returns the slice of port ranges (network.PortRange)
// that this machine has opened. The returned list does not contain
// the "initial port ranges" (i.e. the port ranges every instance
// shoud have opened).
func (azInstance *azureInstance) listPorts(api *gwacl.ManagementAPI) ([]network.PortRange, error) {
	endpoints, err := api.ListRoleEndpoints(&gwacl.ListRoleEndpointsRequest{
		ServiceName:    azInstance.serviceName(),
		DeploymentName: azInstance.deploymentName,
		RoleName:       azInstance.roleName,
	})
	if err != nil {
		return nil, err
	}
	ports := convertAndFilterEndpoints(endpoints, azInstance.environ, azInstance.maskStateServerPorts)
	return ports, nil
}