openstack: implement api client and metadata list

Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Paul Meyer 2023-03-07 11:37:25 +01:00
parent 418f08bf40
commit acbd70c741
9 changed files with 833 additions and 1 deletions

View file

@ -10,6 +10,9 @@ import (
"context"
"github.com/edgelesssys/constellation/v2/internal/role"
"github.com/gophercloud/gophercloud/openstack/compute/v2/servers"
"github.com/gophercloud/gophercloud/openstack/networking/v2/subnets"
"github.com/gophercloud/gophercloud/pagination"
)
type stubIMDSClient struct {
@ -56,3 +59,25 @@ func (c *stubIMDSClient) role(ctx context.Context) (role.Role, error) {
func (c *stubIMDSClient) vpcIP(ctx context.Context) (string, error) {
return c.vpcIPResult, c.vpcIPErr
}
type stubServersClient struct {
serversPager stubPager
subnetsPager stubPager
}
func (c *stubServersClient) ListServers(opts servers.ListOptsBuilder) pagerAPI {
return &c.serversPager
}
func (c *stubServersClient) ListSubnets(opts subnets.ListOpts) pagerAPI {
return &c.subnetsPager
}
type stubPager struct {
page pagination.Page
allPagesErr error
}
func (p *stubPager) AllPages() (pagination.Page, error) {
return p.page, p.allPagesErr
}