diff --git a/.gitignore b/.gitignore index f52d49d..6fa4949 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bin/ .vscode/ tmp/ +.idea/ diff --git a/obs/obs.go b/obs/obs.go new file mode 100644 index 0000000..0d06fc7 --- /dev/null +++ b/obs/obs.go @@ -0,0 +1,92 @@ +/* +Copyright 2021 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package obs + +import ( + "encoding/xml" +) + +type Project struct { + XMLName xml.Name `json:"project" xml:"project"` + Name string `json:"name" xml:"name,attr"` + Title string `json:"title" xml:"title"` + Description string `json:"description" xml:"description"` + URL string `json:"url" xml:"url"` + Persons []Person `json:"persons" xml:"person,omitempty"` + Repositories []Repository `json:"repositories" xml:"repository,omitempty"` + Build *Build `json:"build" xml:"build,omitempty"` + Publish *Publish `json:"publish" xml:"publish,omitempty"` + DebugInfo *DebugInfo `json:"debugInfo" xml:"debuginfo,omitempty"` + UseForBuild *UseForBuild `json:"useForBuild" xml:"useforbuild,omitempty"` +} + +type Client struct { + Username string + Password string + ApiURL string +} + +type RepositoryPath struct { + Project string `xml:"project,attr"` + Repository string `xml:"repository,attr"` +} + +type Disabled struct{} + +type Build struct { + Disable *Disabled `xml:"disable,omitempty"` +} + +type Publish struct { + Disable *Disabled `xml:"disable,omitempty"` +} + +type DebugInfo struct { + Disable *Disabled `xml:"disable,omitempty"` +} + +type UseForBuild struct { + Disable *Disabled `xml:"disable,omitempty"` +} + +type Person struct { + UserID string `xml:"userid,attr"` + Role PersonRole `xml:"role,attr"` +} + +type Repository struct { + Repository string `xml:"name,attr"` + Architecture []string `xml:"arch"` + ReleaseTargets []ReleaseTarget `xml:"releasetarget,omitempty"` + Paths []RepositoryPath `xml:"path,omitempty"` +} + +type ReleaseTarget struct { + ProjectName string `xml:"project,attr"` + Repository string `xml:"repository,attr"` + Trigger string `xml:"trigger,attr"` +} + +type PersonRole string + +const ( + RoleBugOwner PersonRole = "bugowner" + RoleMaintainer PersonRole = "maintainer" + RoleReviewer PersonRole = "reviewer" + RoleDownloader PersonRole = "downloader" + RoleReader PersonRole = "reader" +)