github.com/zntrio/harp/v2@v2.0.9/pkg/bundle/api.go (about) 1 // Licensed to Elasticsearch B.V. under one or more contributor 2 // license agreements. See the NOTICE file distributed with 3 // this work for additional information regarding copyright 4 // ownership. Elasticsearch B.V. licenses this file to you under 5 // the Apache License, Version 2.0 (the "License"); you may 6 // not use this file except in compliance with the License. 7 // You may obtain a copy of the License at 8 // 9 // http://www.apache.org/licenses/LICENSE-2.0 10 // 11 // Unless required by applicable law or agreed to in writing, 12 // software distributed under the License is distributed on an 13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 // KIND, either express or implied. See the License for the 15 // specific language governing permissions and limitations 16 // under the License. 17 18 package bundle 19 20 import ( 21 "io" 22 23 bundlev1 "github.com/zntrio/harp/v2/api/gen/go/harp/bundle/v1" 24 ) 25 26 // Reader exposes bundle reader contract. 27 type Reader interface { 28 Read(reader io.Reader) (*bundlev1.Bundle, error) 29 } 30 31 // Writer exposes bundle writer contract. 32 type Writer interface { 33 Write(file *bundlev1.Bundle) error 34 } 35 36 // Visitor delares the bundle vistor contract. 37 type Visitor interface { 38 Error() error 39 VisitForFile(obj *bundlev1.Bundle) 40 VisitForPackage(obj *bundlev1.Package) 41 VisitForChain(obj *bundlev1.SecretChain) 42 VisitForKV(obj *bundlev1.KV) 43 } 44 45 // ----------------------------------------------------------------------------- 46 47 var ( 48 bundleAnnotationsKey = "harp.elastic.co/v1/bundle#annotations" 49 bundleLabelsKey = "harp.elastic.co/v1/bundle#labels" 50 packageAnnotations = "harp.elastic.co/v1/package#annotations" 51 packageLabels = "harp.elastic.co/v1/package#labels" 52 packageEncryptionAnnotation = "harp.elastic.co/v1/package#encryptionKeyAlias" 53 packageEncryptedValueType = "harp.elastic.co/v1/package#encryptedValue" 54 ) 55 56 // AnnotationOwner defines annotations owner contract. 57 type AnnotationOwner interface { 58 GetAnnotations() map[string]string 59 } 60 61 // LabelOwner defines label owner contract. 62 type LabelOwner interface { 63 GetLabels() map[string]string 64 }