func list_exchanges()

in analytics-hub/snippets/create_listing_golang/main.go [153:172]


func list_exchanges(ctx context.Context, client *analyticshub.Client, project_id string, location string) {
	req := &analyticshubpb.ListDataExchangesRequest{
		Parent: fmt.Sprintf("projects/%s/locations/%s", project_id, location),
		// See https://pkg.go.dev/cloud.google.com/go/bigquery/analyticshub/apiv1/analyticshubpb#ListDataExchangesRequest.
	}
	it := client.ListDataExchanges(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			println(err.Error())
			break
		} else {
			println(fmt.Sprintf("ListDataExchangesResponse: [%s] %s", resp.Name, resp.DisplayName))
			list_listings(ctx, client, resp.Name)
		}
	}
}