mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-11 17:04:22 -05:00
5efe05d933
* Rename Metadata->Cloud * Remove unused methods, functions, and variables * More privacy for testing stubs Signed-off-by: Daniel Weiße <dw@edgeless.systems>
47 lines
1.2 KiB
Go
47 lines
1.2 KiB
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package kubernetes
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/edgelesssys/constellation/v2/internal/cloud/metadata"
|
|
)
|
|
|
|
// ProviderMetadata implementers read/write cloud provider metadata.
|
|
type ProviderMetadata interface {
|
|
// UID returns the unique identifier for the constellation.
|
|
UID(ctx context.Context) (string, error)
|
|
// Self retrieves the current instance.
|
|
Self(ctx context.Context) (metadata.InstanceMetadata, error)
|
|
// GetLoadBalancerEndpoint retrieves the load balancer endpoint.
|
|
GetLoadBalancerEndpoint(ctx context.Context) (string, error)
|
|
}
|
|
|
|
type stubProviderMetadata struct {
|
|
getLoadBalancerEndpointErr error
|
|
getLoadBalancerEndpointResp string
|
|
|
|
selfErr error
|
|
selfResp metadata.InstanceMetadata
|
|
|
|
uidErr error
|
|
uidResp string
|
|
}
|
|
|
|
func (m *stubProviderMetadata) GetLoadBalancerEndpoint(ctx context.Context) (string, error) {
|
|
return m.getLoadBalancerEndpointResp, m.getLoadBalancerEndpointErr
|
|
}
|
|
|
|
func (m *stubProviderMetadata) Self(ctx context.Context) (metadata.InstanceMetadata, error) {
|
|
return m.selfResp, m.selfErr
|
|
}
|
|
|
|
func (m *stubProviderMetadata) UID(ctx context.Context) (string, error) {
|
|
return m.uidResp, m.uidErr
|
|
}
|