Skip to content

Commit

Permalink
define project structure for the obs library
Browse files Browse the repository at this point in the history
  • Loading branch information
nitishfy committed Sep 14, 2023
1 parent 7f0a91b commit ad210a9
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
bin/
.vscode/
tmp/
.idea/
92 changes: 92 additions & 0 deletions obs/obs.go
Original file line number Diff line number Diff line change
@@ -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"
)

0 comments on commit ad210a9

Please sign in to comment.