11/*
2- Copyright 2021 The Kubernetes Authors.
2+ Copyright 2023 The Kubernetes Authors.
33
44Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
@@ -19,25 +19,17 @@ package async
1919import (
2020 "context"
2121
22+ "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime"
2223 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources"
23- azureautorest "github.com/Azure/go-autorest/autorest/azure"
2424 "sigs.k8s.io/cluster-api-provider-azure/azure"
2525)
2626
27- // FutureScope is a scope that can perform store futures and conditions in Status .
27+ // FutureScope stores and retrieves Futures and Conditions .
2828type FutureScope interface {
2929 azure.AsyncStatusUpdater
3030}
3131
32- // FutureHandler is a client that can check on the progress of a future.
33- type FutureHandler interface {
34- // IsDone returns true if the operation is complete.
35- IsDone (ctx context.Context , future azureautorest.FutureAPI ) (isDone bool , err error )
36- // Result returns the result of the operation.
37- Result (ctx context.Context , future azureautorest.FutureAPI , futureType string ) (result interface {}, err error )
38- }
39-
40- // Getter is an interface that can get a resource.
32+ // Getter gets a resource.
4133type Getter interface {
4234 Get (ctx context.Context , spec azure.ResourceSpecGetter ) (result interface {}, err error )
4335}
@@ -47,20 +39,18 @@ type TagsGetter interface {
4739 GetAtScope (ctx context.Context , scope string ) (result armresources.TagsResource , err error )
4840}
4941
50- // Creator is a client that can create or update a resource asynchronously.
51- type Creator interface {
52- FutureHandler
42+ // Creator creates or updates a resource asynchronously.
43+ type Creator [T any ] interface {
5344 Getter
54- CreateOrUpdateAsync (ctx context.Context , spec azure.ResourceSpecGetter , parameters interface {}) (result interface {}, future azureautorest. FutureAPI , err error )
45+ CreateOrUpdateAsync (ctx context.Context , spec azure.ResourceSpecGetter , resumeToken string , parameters interface {}) (result interface {}, poller * runtime. Poller [ T ] , err error )
5546}
5647
57- // Deleter is a client that can delete a resource asynchronously.
58- type Deleter interface {
59- FutureHandler
60- DeleteAsync (ctx context.Context , spec azure.ResourceSpecGetter ) (future azureautorest.FutureAPI , err error )
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 )
6151}
6252
63- // Reconciler is a generic interface used to perform asynchronous reconciliation of Azure resources .
53+ // Reconciler reconciles a resource .
6454type Reconciler interface {
6555 CreateOrUpdateResource (ctx context.Context , spec azure.ResourceSpecGetter , serviceName string ) (result interface {}, err error )
6656 DeleteResource (ctx context.Context , spec azure.ResourceSpecGetter , serviceName string ) (err error )
0 commit comments