github.com/zntrio/harp/v2@v2.0.9/pkg/bundle/template/visitor/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 visitor 19 20 import ( 21 bundlev1 "github.com/zntrio/harp/v2/api/gen/go/harp/bundle/v1" 22 ) 23 24 // InfrastructureAcceptor is the contract for visitor entrypoint. 25 type InfrastructureAcceptor interface { 26 Accept(InfrastructureVisitor) 27 } 28 29 // PlatformAcceptor is the contract for visitor entrypoint. 30 type PlatformAcceptor interface { 31 Accept(PlatformVisitor) 32 } 33 34 // ProductAcceptor is the contract for visitor entrypoint. 35 type ProductAcceptor interface { 36 Accept(ProductVisitor) 37 } 38 39 // ApplicationAcceptor is the contract for visitor entrypoint. 40 type ApplicationAcceptor interface { 41 Accept(ApplicationVisitor) 42 } 43 44 // InfrastructureVisitor describes visitor method used for tree walk. 45 type InfrastructureVisitor interface { 46 Error() error 47 VisitForProvider(obj *bundlev1.InfrastructureNS) 48 VisitForRegion(obj *bundlev1.InfrastructureRegionNS) 49 VisitForService(obj *bundlev1.InfrastructureServiceNS) 50 } 51 52 // PlatformVisitor describes visitor method used for tree walk. 53 type PlatformVisitor interface { 54 Error() error 55 VisitForRegion(obj *bundlev1.PlatformRegionNS) 56 VisitForComponent(obj *bundlev1.PlatformComponentNS) 57 } 58 59 // ProductVisitor describes visitor method used for tree walk. 60 type ProductVisitor interface { 61 Error() error 62 VisitForComponent(obj *bundlev1.ProductComponentNS) 63 } 64 65 // ApplicationVisitor describes visitor method used for tree walk. 66 type ApplicationVisitor interface { 67 Error() error 68 VisitForComponent(obj *bundlev1.ApplicationComponentNS) 69 } 70 71 // TemplateVisitor is a bundle template visitor. 72 type TemplateVisitor interface { 73 Error() error 74 Visit(*bundlev1.Template) 75 }