-
Notifications
You must be signed in to change notification settings - Fork 25
/
space.go
43 lines (35 loc) · 1.22 KB
/
space.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
package spaces
import (
"github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/resources"
"github.com/go-playground/validator/v10"
)
type Space struct {
Description string `json:"Description,omitempty"`
Slug string `json:"Slug"` // deliberately send empty string
IsDefault bool `json:"IsDefault"`
Name string `json:"Name" validate:"required,max=20"`
SpaceManagersTeamMembers []string `json:"SpaceManagersTeamMembers"` // deliberately send empty array
SpaceManagersTeams []string `json:"SpaceManagersTeams"` // deliberately send empty array
TaskQueueStopped bool `json:"TaskQueueStopped"`
resources.Resource
}
// NewSpace initializes a Space with a name.
func NewSpace(name string) *Space {
return &Space{
Name: name,
Resource: *resources.NewResource(),
}
}
// GetName returns the name of the space.
func (s *Space) GetName() string {
return s.Name
}
// SetName sets the name of the space.
func (s *Space) SetName(name string) {
s.Name = name
}
// Validate checks the state of the space and returns an error if invalid.
func (s *Space) Validate() error {
return validator.New().Struct(s)
}
var _ resources.IHasName = &Space{}