This repository has been archived by the owner on Dec 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
/
team.go
95 lines (80 loc) · 4.35 KB
/
team.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package types
type (
// Team represents an otf team.
Team struct {
ID string `jsonapi:"primary,teams"`
Name string `jsonapi:"attribute" json:"name"`
OrganizationAccess *OrganizationAccess `jsonapi:"attribute" json:"organization-access"`
Visibility string `jsonapi:"attribute" json:"visibility"`
Permissions *TeamPermissions `jsonapi:"attribute" json:"permissions"`
UserCount int `jsonapi:"attribute" json:"users-count"`
SSOTeamID *string `jsonapi:"attribute" json:"sso-team-id"`
// Relations
Users []*User `jsonapi:"relationship" json:"users"`
}
// OrganizationAccess represents the team's permissions on its organization
OrganizationAccess struct {
ManagePolicies bool `jsonapi:"attribute" json:"manage-policies"`
ManagePolicyOverrides bool `jsonapi:"attribute" json:"manage-policy-overrides"`
ManageWorkspaces bool `jsonapi:"attribute" json:"manage-workspaces"`
ManageVCSSettings bool `jsonapi:"attribute" json:"manage-vcs-settings"`
ManageProviders bool `jsonapi:"attribute" json:"manage-providers"`
ManageModules bool `jsonapi:"attribute" json:"manage-modules"`
ManageRunTasks bool `jsonapi:"attribute" json:"manage-run-tasks"`
ManageProjects bool `jsonapi:"attribute" json:"manage-projects"`
ReadWorkspaces bool `jsonapi:"attribute" json:"read-workspaces"`
ReadProjects bool `jsonapi:"attribute" json:"read-projects"`
ManageMembership bool `jsonapi:"attribute" json:"manage-membership"`
}
// TeamPermissions represents the current user's permissions on the team.
TeamPermissions struct {
CanDestroy bool `jsonapi:"attribute" json:"can-destroy"`
CanUpdateMembership bool `jsonapi:"attribute" json:"can-update-membership"`
}
// TeamCreateOptions represents the options for creating a team.
TeamCreateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,teams"`
// Name of the team.
Name *string `jsonapi:"attribute" json:"name"`
// Optional: Unique Identifier to control team membership via SAML
SSOTeamID *string `jsonapi:"attribute" json:"sso-team-id,omitempty"`
// The team's organization access
OrganizationAccess *OrganizationAccessOptions `jsonapi:"attribute" json:"organization-access,omitempty"`
// The team's visibility ("secret", "organization")
Visibility *string `jsonapi:"attribute" json:"visibility,omitempty"`
}
// TeamUpdateOptions represents the options for updating a team.
TeamUpdateOptions struct {
// Type is a public field utilized by JSON:API to
// set the resource type via the field tag.
// It is not a user-defined value and does not need to be set.
// https://jsonapi.org/format/#crud-creating
Type string `jsonapi:"primary,teams"`
// Optional: New name for the team
Name *string `jsonapi:"attribute" json:"name,omitempty"`
// Optional: Unique Identifier to control team membership via SAML
SSOTeamID *string `jsonapi:"attribute" json:"sso-team-id,omitempty"`
// Optional: The team's organization access
OrganizationAccess *OrganizationAccessOptions `jsonapi:"attribute" json:"organization-access,omitempty"`
// Optional: The team's visibility ("secret", "organization")
Visibility *string `jsonapi:"attribute" json:"visibility,omitempty"`
}
// OrganizationAccessOptions represents the organization access options of a team.
OrganizationAccessOptions struct {
ManagePolicies *bool `json:"manage-policies,omitempty"`
ManagePolicyOverrides *bool `json:"manage-policy-overrides,omitempty"`
ManageWorkspaces *bool `json:"manage-workspaces,omitempty"`
ManageVCSSettings *bool `json:"manage-vcs-settings,omitempty"`
ManageProviders *bool `json:"manage-providers,omitempty"`
ManageModules *bool `json:"manage-modules,omitempty"`
ManageRunTasks *bool `json:"manage-run-tasks,omitempty"`
ManageProjects *bool `json:"manage-projects,omitempty"`
ReadWorkspaces *bool `json:"read-workspaces,omitempty"`
ReadProjects *bool `json:"read-projects,omitempty"`
ManageMembership *bool `json:"manage-membership,omitempty"`
}
)