-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
kind_system.go
52 lines (41 loc) · 2.01 KB
/
kind_system.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
50
51
52
package backstage
import (
"context"
"net/http"
)
// KindSystem defines name for system kind.
const KindSystem = "System"
// SystemEntityV1alpha1 is a collection of resources and components. The system may expose or consume one or several APIs. It is viewed as
// abstraction level that provides potential consumers insights into exposed features without needing a too detailed view into the details
// of all components. This also gives the owning team the possibility to decide about published artifacts and APIs.
// https://github.com/backstage/backstage/blob/master/packages/catalog-model/src/schema/kinds/System.v1alpha1.schema.json
type SystemEntityV1alpha1 struct {
Entity
// ApiVersion is always "backstage.io/v1alpha1".
ApiVersion string `json:"apiVersion" yaml:"apiVersion"`
// Kind is always "System".
Kind string `json:"kind" yaml:"kind"`
// Spec is the specification data describing the system itself.
Spec *SystemEntityV1alpha1Spec `json:"spec" yaml:"spec"`
}
// SystemEntityV1alpha1Spec describes the specification data describing the system itself.
type SystemEntityV1alpha1Spec struct {
// Owner is an entity reference to the owner of the system.
Owner string `json:"owner" yaml:"owner"`
// Domain is an entity reference to the domain that the system belongs to.
Domain string `json:"domain,omitempty" yaml:"domain,omitempty"`
}
// systemService handles communication with the system methods of the Backstage Catalog API.
type systemService typedEntityService[SystemEntityV1alpha1]
// newSystemService returns a new instance of system-type entityService.
func newSystemService(s *entityService) *systemService {
return &systemService{
client: s.client,
apiPath: s.apiPath,
}
}
// Get returns a system entity identified by the name and the namespace ("default", if not specified) it belongs to.
func (s *systemService) Get(ctx context.Context, n string, ns string) (*SystemEntityV1alpha1, *http.Response, error) {
cs := (typedEntityService[SystemEntityV1alpha1])(*s)
return cs.get(ctx, KindSystem, n, ns)
}