From d4e4226c3cbfa62a6adf15f4466747468eb208c7 Mon Sep 17 00:00:00 2001 From: mzroot Date: Fri, 14 Jun 2024 19:56:10 +0300 Subject: Add tag protection via rest api #17862 (#31295) Add tag protection manage via rest API. --------- Co-authored-by: Alexander Kogay Co-authored-by: Giteabot --- modules/structs/repo_tag.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'modules') diff --git a/modules/structs/repo_tag.go b/modules/structs/repo_tag.go index 4a7d895288..5722513f4f 100644 --- a/modules/structs/repo_tag.go +++ b/modules/structs/repo_tag.go @@ -3,6 +3,8 @@ package structs +import "time" + // Tag represents a repository tag type Tag struct { Name string `json:"name"` @@ -38,3 +40,29 @@ type CreateTagOption struct { Message string `json:"message"` Target string `json:"target"` } + +// TagProtection represents a tag protection +type TagProtection struct { + ID int64 `json:"id"` + NamePattern string `json:"name_pattern"` + WhitelistUsernames []string `json:"whitelist_usernames"` + WhitelistTeams []string `json:"whitelist_teams"` + // swagger:strfmt date-time + Created time.Time `json:"created_at"` + // swagger:strfmt date-time + Updated time.Time `json:"updated_at"` +} + +// CreateTagProtectionOption options for creating a tag protection +type CreateTagProtectionOption struct { + NamePattern string `json:"name_pattern"` + WhitelistUsernames []string `json:"whitelist_usernames"` + WhitelistTeams []string `json:"whitelist_teams"` +} + +// EditTagProtectionOption options for editing a tag protection +type EditTagProtectionOption struct { + NamePattern *string `json:"name_pattern"` + WhitelistUsernames []string `json:"whitelist_usernames"` + WhitelistTeams []string `json:"whitelist_teams"` +} -- cgit v1.2.3