mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-05 21:29:39 -04:00
openstack: implement api client and metadata list
Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
parent
418f08bf40
commit
acbd70c741
9 changed files with 833 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue