traefik/vendor/github.com/containous/traefik-extra-service-fabric/types.go

44 lines
1.5 KiB
Go
Raw Normal View History

2017-11-27 13:26:04 +00:00
package servicefabric
import (
sf "github.com/jjcollinge/servicefabric"
)
// ServiceItemExtended provides a flattened view
// of the service with details of the application
// it belongs too and the replicas/partitions
type ServiceItemExtended struct {
sf.ServiceItem
HasHTTPEndpoint bool
IsHealthy bool
Application sf.ApplicationItem
Partitions []PartitionItemExtended
Labels map[string]string
}
// PartitionItemExtended provides a flattened view
// of a services partitions
type PartitionItemExtended struct {
sf.PartitionItem
Replicas []sf.ReplicaItem
Instances []sf.InstanceItem
}
// sfClient is an interface for Service Fabric client's to implement.
// This is purposely a subset of the total Service Fabric API surface.
type sfClient interface {
GetApplications() (*sf.ApplicationItemsPage, error)
GetServices(appName string) (*sf.ServiceItemsPage, error)
GetPartitions(appName, serviceName string) (*sf.PartitionItemsPage, error)
GetReplicas(appName, serviceName, partitionName string) (*sf.ReplicaItemsPage, error)
GetInstances(appName, serviceName, partitionName string) (*sf.InstanceItemsPage, error)
GetServiceExtension(appType, applicationVersion, serviceTypeName, extensionKey string, response interface{}) error
GetServiceLabels(service *sf.ServiceItem, app *sf.ApplicationItem, prefix string) (map[string]string, error)
}
// replicaInstance interface provides a unified interface
// over replicas and instances
type replicaInstance interface {
GetReplicaData() (string, *sf.ReplicaItemBase)
}