Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get pool member list, through the pool name of SourceAddressTranslation? #40

Open
lefeck opened this issue Jun 23, 2022 · 0 comments
Assignees
Labels
area/ltm Issues related to the ltm subpackage. kind/support

Comments

@lefeck
Copy link

lefeck commented Jun 23, 2022

hi,
I want to get its pool member list through the pool name of SourceAddressTranslation. I can't do it through the following code, and I haven't found the corresponding method. What should I do? code show as below:

package main

import (
	"fmt"
	"github.com/e-XpertSolutions/f5-rest-client/f5"
	"github.com/e-XpertSolutions/f5-rest-client/f5/ltm"
	"log"
	"net/url"
	"strings"
)

func main() {
	f5Client, err := f5.NewBasicClient("https://192.168.5.134", "admin", "admin")
	if err != nil {
		log.Fatal(err)
	}
	f5Client.DisableCertCheck()

	// Start new transaction.
	tx, err := f5Client.Begin()
	if err != nil {
		log.Fatal(err)
	}
	ltmClient := ltm.New(tx)

	params := url.Values{}
	params.Set("expandSubcollections", "true")

	vslist, _ := ltmClient.Virtual().ListAllWithParams(params)

	var test string
	for _, value := range vslist.Items {
		test = value.SourceAddressTranslation.Pool
		//fmt.Println(test)
	}
	satpoollist := StringSplitSubStrings(test)
	satPoolList, _ := ltmClient.PoolMembers().ListAll(satpoollist)
	for _, v := range satPoolList.Items {
		fmt.Println(v.Address)
	}
}

func StringSplitSubStrings(src string) (des string) {
	str := strings.SplitN(src, "/", -1)
	return str[len(str)-1]
}
@gilliek gilliek self-assigned this Jun 30, 2022
@gilliek gilliek added kind/support area/ltm Issues related to the ltm subpackage. labels Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ltm Issues related to the ltm subpackage. kind/support
Projects
None yet
Development

No branches or pull requests

2 participants