-
Notifications
You must be signed in to change notification settings - Fork 28
/
interface.go
49 lines (43 loc) · 2.2 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2023 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package service
import (
"github.com/go-vela/types/library"
)
// ServiceInterface represents the Vela interface for service
// functions with the supported Database backends.
//
//nolint:revive // ignore name stutter
type ServiceInterface interface {
// Service Data Definition Language Functions
//
// https://en.wikipedia.org/wiki/Data_definition_language
// CreateServiceTable defines a function that creates the services table.
CreateServiceTable(string) error
// Service Data Manipulation Language Functions
//
// https://en.wikipedia.org/wiki/Data_manipulation_language
// CountServices defines a function that gets the count of all services.
CountServices() (int64, error)
// CountServicesForBuild defines a function that gets the count of services by build ID.
CountServicesForBuild(*library.Build, map[string]interface{}) (int64, error)
// CreateService defines a function that creates a new service.
CreateService(*library.Service) error
// DeleteService defines a function that deletes an existing service.
DeleteService(*library.Service) error
// GetService defines a function that gets a service by ID.
GetService(int64) (*library.Service, error)
// GetServiceForBuild defines a function that gets a service by number and build ID.
GetServiceForBuild(*library.Build, int) (*library.Service, error)
// ListServices defines a function that gets a list of all services.
ListServices() ([]*library.Service, error)
// ListServicesForBuild defines a function that gets a list of services by build ID.
ListServicesForBuild(*library.Build, map[string]interface{}, int, int) ([]*library.Service, int64, error)
// ListServiceImageCount defines a function that gets a list of all service images and the count of their occurrence.
ListServiceImageCount() (map[string]float64, error)
// ListServiceStatusCount defines a function that gets a list of all service statuses and the count of their occurrence.
ListServiceStatusCount() (map[string]float64, error)
// UpdateService defines a function that updates an existing service.
UpdateService(*library.Service) error
}