sigs.k8s.io/cluster-api-provider-azure@v1.14.3/azure/services/aso/interfaces.go (about) 1 /* 2 Copyright 2023 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package aso 18 19 import ( 20 "context" 21 22 "github.com/Azure/azure-service-operator/v2/pkg/genruntime" 23 infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" 24 "sigs.k8s.io/cluster-api-provider-azure/azure" 25 "sigs.k8s.io/controller-runtime/pkg/client" 26 ) 27 28 // Reconciler is a generic interface used to perform reconciliation of Azure resources backed by ASO. 29 type Reconciler[T genruntime.MetaObject] interface { 30 CreateOrUpdateResource(ctx context.Context, spec azure.ASOResourceSpecGetter[T], serviceName string) (result T, err error) 31 DeleteResource(ctx context.Context, resource T, serviceName string) (err error) 32 PauseResource(ctx context.Context, resource T, serviceName string) (err error) 33 } 34 35 // TagsGetterSetter represents an object that supports tags. 36 type TagsGetterSetter[T genruntime.MetaObject] interface { 37 GetAdditionalTags() infrav1.Tags 38 GetDesiredTags(resource T) infrav1.Tags 39 SetTags(resource T, tags infrav1.Tags) 40 } 41 42 // Patcher supplies extra patches to be applied to an ASO resource. 43 type Patcher interface { 44 ExtraPatches() []string 45 } 46 47 // Scope represents the common functionality related to all scopes needed for ASO services. 48 type Scope interface { 49 azure.AsyncStatusUpdater 50 GetClient() client.Client 51 ClusterName() string 52 ASOOwner() client.Object 53 }