sigs.k8s.io/cluster-api-provider-azure@v1.14.3/azure/services/async/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 async 18 19 import ( 20 "context" 21 22 "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" 23 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" 24 "sigs.k8s.io/cluster-api-provider-azure/azure" 25 ) 26 27 // FutureScope stores and retrieves Futures and Conditions. 28 type FutureScope interface { 29 azure.AsyncStatusUpdater 30 } 31 32 // Getter gets a resource. 33 type Getter interface { 34 Get(ctx context.Context, spec azure.ResourceSpecGetter) (result interface{}, err error) 35 } 36 37 // TagsGetter is an interface that can get a tags resource. 38 type TagsGetter interface { 39 GetAtScope(ctx context.Context, scope string) (result armresources.TagsResource, err error) 40 } 41 42 // Creator creates or updates a resource asynchronously. 43 type Creator[T any] interface { 44 Getter 45 CreateOrUpdateAsync(ctx context.Context, spec azure.ResourceSpecGetter, resumeToken string, parameters interface{}) (result interface{}, poller *runtime.Poller[T], err error) 46 } 47 48 // Deleter deletes a resource asynchronously. 49 type Deleter[T any] interface { 50 DeleteAsync(ctx context.Context, spec azure.ResourceSpecGetter, resumeToken string) (poller *runtime.Poller[T], err error) 51 } 52 53 // Reconciler reconciles a resource. 54 type Reconciler interface { 55 CreateOrUpdateResource(ctx context.Context, spec azure.ResourceSpecGetter, serviceName string) (result interface{}, err error) 56 DeleteResource(ctx context.Context, spec azure.ResourceSpecGetter, serviceName string) (err error) 57 }