define instances v2

Signed-off-by: Andrew Sy Kim <kim.andrewsy@gmail.com>
This commit is contained in:
Andrew Sy Kim 2020-06-18 09:41:42 -04:00 committed by gongguan
parent e24a42f07b
commit 531be1d28e

View File

@ -49,6 +49,9 @@ type Interface interface {
LoadBalancer() (LoadBalancer, bool)
// Instances returns an instances interface. Also returns true if the interface is supported, false otherwise.
Instances() (Instances, bool)
// InstancesV2 is an implementation for instances only used by cloud node-controller now.
// Also returns true if the interface is supported, false otherwise.
InstancesV2() (InstancesV2, bool)
// Zones returns a zones interface. Also returns true if the interface is supported, false otherwise.
Zones() (Zones, bool)
// Clusters returns a clusters interface. Also returns true if the interface is supported, false otherwise.
@ -186,6 +189,17 @@ type Instances interface {
InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
}
// InstancesV2 is an abstract, pluggable interface for sets of instances.
// Unlike Instances, it is only used by cloud node-controller now.
type InstancesV2 interface {
// InstanceExistsByProviderID returns true if the instance for the given provider exists.
InstanceExistsByProviderID(ctx context.Context, providerID string) (bool, error)
// InstanceShutdownByProviderID returns true if the instance is shutdown in cloudprovider.
InstanceShutdownByProviderID(ctx context.Context, providerID string) (bool, error)
// InstanceMetadataByProviderID returns the instance's metadata.
InstanceMetadataByProviderID(ctx context.Context, providerID string) (*InstanceMetadata, error)
}
// Route is a representation of an advanced routing rule.
type Route struct {
// Name is the name of the routing rule in the cloud-provider.