List all IP Pools and fetch an IP pool given the Kubernetes Cluster Id and the Tenant Org Id.

Below is the sample code, for listing IP Pools.

from tca.caas_v3_ippool.model import V1IPPoolList, \
    V1GlobalInClusterIPPool, V1IPPoolMetadata, V1InClusterIPPoolSpec
# Other imports not shown for brevity...

# precreated sdd_mgr
global sdk_mgr

def test_list_all_ip_pools(self):
    """Test case for list_all_ip_pools
    List ip pools  # noqa: E501
    """
    # Fetch Org as described in other sections
    org_id = 'my_org'
    # Fetch cluster_id as described in the previous sections
    cluster_id = 'my_mgmt_cluster_id'
    # Fetch the CaaS (V3) IP Pool Client
    caasv3_ippool_client = \
        sdk_mgr.get_api('tca.caas_v3_ippool:IPPoolApi')
    caasv3_ippool_client.api_client.configuration.\
        lg().setLevel('DEBUG')
    # test LIST
    list_result = caasv3_ippool_client.list_all_ip_pools(
        org_id = org_id,
        cluster_id = cluster_id)
    print("Result of IP Pools LIST ", list_result)
    print("Id of the first IP Pool ", \
        list_result['items'][0]['metadata']['uid'])

Here's the sample code to fetch an individual IP Pool, given the uid obtained above.

def test_get_ip_pool(self):
    """Test case for get_ip_pool
    Get ip pool runtime status  # noqa: E501
    """
    org_id = 'my_org'
    cluster_id = 'my_mgmt_cluster_id'
    uid = 'fetched_from_above_sample_code'

    caasv3_ippool_client = \
        self.sdk_mgr.get_api('tca.caas_v3_ippool:IPPoolApi')
    caasv3_ippool_client.api_client.configuration.lg().setLevel('DEBUG')
    get_result = caasv3_ippool_client.get_ip_pool(
        org_id = org_id,
        cluster_id = cluster_id,
        uid = uid
    )
    print("Result of IP Pools GET", get_result)