harbor/src/api/artifact/model.go
Wenkai Yin ac605db5da Define the controller/manager interface for artifact and tag
1. Define the controller/manager interface for artifact and tag
    2. Provide a null implementation for artifact manager

Signed-off-by: Wenkai Yin <yinw@vmware.com>
2019-12-24 17:12:55 +08:00

56 lines
1.9 KiB
Go

// Copyright Project Harbor 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 artifact
import (
"github.com/goharbor/harbor/src/pkg/artifact"
"github.com/goharbor/harbor/src/pkg/tag/model/tag"
)
// Artifact is the overall view of artifact
// TODO reuse the model generated by swagger
type Artifact struct {
artifact.Artifact
Tags []*tag.Tag // the list of tags that attached to the artifact
SubResourceLinks map[string][]*ResourceLink // the resource link for build history(image), values.yaml(chart), dependency(chart), etc
// TODO add other attrs: signature, scan result, label, etc
}
// Resource defines the specific resource of different artifacts: build history for image, values.yaml for chart, etc
type Resource struct {
Content []byte // the content of the resource
ContentType string // the content type of the resource, returned as "Content-Type" header in API
}
// ResourceLink is a link via that a resource can be fetched
type ResourceLink struct {
HREF string
Absolute bool // specify the href is an absolute URL or not
}
// Option is used to specify the properties returned when listing/getting artifacts
type Option struct {
WithTag bool
WithLabel bool
WithScanResult bool
WithSignature bool
}
// TODO move this to GC controller?
// Option for pruning artifact records
// type Option struct {
// KeepUntagged bool // keep the untagged artifacts or not
// }