From ae8dc626b43174c1289644ef2ce8ce00edf72cde Mon Sep 17 00:00:00 2001 From: Reuben Lifshay Date: Fri, 27 Oct 2023 11:04:36 -0700 Subject: [PATCH 1/9] chore: clean up some cancellation logic in pipeline functions --- pipeline/pipeline.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index e909162..7c35740 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -161,8 +161,9 @@ func Tee[D, T any](done <-chan D, in <-chan T, outputs ...chan T) { for item := range OrDone(done, in) { for _, out := range outputs { select { - case <-done: case out <- item: + case <-done: + return } } } @@ -190,10 +191,6 @@ func Batch[D, T any](done <-chan D, in <-chan T, maxItems int, maxTimeout time.D for { select { case <-done: - if len(batch) > 0 { - out <- batch - batch = nil - } return case item, ok := <-in: if !ok { From 5c3e8d122e76b7c80150479d6935a48fa10cacaa Mon Sep 17 00:00:00 2001 From: Reuben Lifshay Date: Fri, 27 Oct 2023 15:23:16 -0700 Subject: [PATCH 2/9] chore: add Send() and Recv() channel functions to pipeline --- pipeline/pipeline.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index 7c35740..92708d2 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -31,6 +31,26 @@ type Result[T any] struct { Ok T } +// Send sends a value to a channel while monitoring the done channel for cancellation +func Send[D, T any](done <-chan D, tgt chan<- T, val T) bool { + select { + case tgt <- val: + return true + case <-done: + return false + } +} + +// Recv receives a value from a channel while monitoring the done channel for cancellation +func Recv[D, T any](done <-chan D, src <-chan T) (T, bool) { + select { + case val, ok := <-src: + return val, ok + case <-done: + return *new(T), false + } +} + // OrDone provides an explicit cancellation mechanism to ensure the encapsulated and downstream goroutines are cleaned // up. This frees the caller from depending on the input channel to close in order to free the goroutine, thus // preventing possible leaks. From 578e5e4f813910b239ac2bc17ec94d8976f40107 Mon Sep 17 00:00:00 2001 From: Reuben Lifshay Date: Fri, 27 Oct 2023 15:59:28 -0700 Subject: [PATCH 3/9] chore: update client to use pipeline.Send() --- client/app_role_assignments.go | 29 +++++++++--- client/apps.go | 85 +++++++++++++++++++++++++--------- client/automation_accounts.go | 29 +++++++++--- client/container_registries.go | 29 +++++++++--- client/devices.go | 57 +++++++++++++++++------ client/function_apps.go | 29 +++++++++--- client/groups.go | 85 +++++++++++++++++++++++++--------- client/keyvaults.go | 29 +++++++++--- client/logic_apps.go | 29 +++++++++--- client/managed_clusters.go | 29 +++++++++--- client/management_groups.go | 57 +++++++++++++++++------ client/resource_groups.go | 29 +++++++++--- client/role_assignments.go | 85 +++++++++++++++++++++++++--------- client/roles.go | 29 +++++++++--- client/service_principals.go | 57 +++++++++++++++++------ client/storage_accounts.go | 57 +++++++++++++++++------ client/subscriptions.go | 29 +++++++++--- client/tenants.go | 29 +++++++++--- client/users.go | 29 +++++++++--- client/virtual_machines.go | 29 +++++++++--- client/vm_scale_sets.go | 29 +++++++++--- client/web_apps.go | 29 +++++++++--- 22 files changed, 694 insertions(+), 224 deletions(-) diff --git a/client/app_role_assignments.go b/client/app_role_assignments.go index fbcba83..c2eac7a 100644 --- a/client/app_role_assignments.go +++ b/client/app_role_assignments.go @@ -27,6 +27,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureADAppRoleAssignments(ctx context.Context, servicePrincipalId string, filter, search, orderBy, expand string, selectCols []string, top int32, count bool) (azure.AppRoleAssignmentList, error) { @@ -64,10 +65,14 @@ func (s *azureClient) ListAzureADAppRoleAssignments(ctx context.Context, service if list, err := s.GetAzureADAppRoleAssignments(ctx, servicePrincipal, filter, search, orderBy, expand, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.AppRoleAssignmentResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.AppRoleAssignmentResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink @@ -75,23 +80,33 @@ func (s *azureClient) ListAzureADAppRoleAssignments(ctx context.Context, service var list azure.AppRoleAssignmentList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.AppRoleAssignmentResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.AppRoleAssignmentResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } diff --git a/client/apps.go b/client/apps.go index b509b6e..1091a31 100644 --- a/client/apps.go +++ b/client/apps.go @@ -28,6 +28,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureADApp(ctx context.Context, objectId string, selectCols []string) (*azure.Application, error) { @@ -113,10 +114,14 @@ func (s *azureClient) ListAzureADApps(ctx context.Context, filter, search, order if list, err := s.GetAzureADApps(ctx, filter, search, orderBy, expand, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.ApplicationResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.ApplicationResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink @@ -124,23 +129,33 @@ func (s *azureClient) ListAzureADApps(ctx context.Context, filter, search, order var list azure.ApplicationList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } return } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } return } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } return } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } return } else { for _, u := range list.Value { - out <- azure.ApplicationResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.ApplicationResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } @@ -163,12 +178,16 @@ func (s *azureClient) ListAzureADAppOwners(ctx context.Context, objectId string, if list, err := s.GetAzureADAppOwners(ctx, objectId, filter, search, orderBy, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.AppOwnerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.AppOwnerResult{ AppId: objectId, Ok: u, + }); !ok { + return } } @@ -177,25 +196,35 @@ func (s *azureClient) ListAzureADAppOwners(ctx context.Context, objectId string, var list azure.DirectoryObjectList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } return } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } return } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } return } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } return } else { for _, u := range list.Value { - out <- azure.AppOwnerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.AppOwnerResult{ AppId: objectId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink @@ -221,13 +250,17 @@ func (s *azureClient) ListAzureADAppMemberObjects(ctx context.Context, objectId ) if list, err := s.GetAzureADAppMemberObjects(ctx, objectId, securityEnabledOnly); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.MemberObjectResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.MemberObjectResult{ ParentId: objectId, ParentType: string(enums.EntityApplication), Ok: u, + }); !ok { + return } } @@ -236,26 +269,36 @@ func (s *azureClient) ListAzureADAppMemberObjects(ctx context.Context, objectId var list azure.MemberObjectList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.MemberObjectResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.MemberObjectResult{ ParentId: objectId, ParentType: string(enums.EntityApplication), Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/automation_accounts.go b/client/automation_accounts.go index 53cd564..2131acf 100644 --- a/client/automation_accounts.go +++ b/client/automation_accounts.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureAutomationAccount(ctx context.Context, subscriptionId, groupName, aaName, expand string) (*azure.AutomationAccount, error) { @@ -75,10 +76,14 @@ func (s *azureClient) ListAzureAutomationAccounts(ctx context.Context, subscript if result, err := s.GetAzureAutomationAccounts(ctx, subscriptionId); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.AutomationAccountResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.AutomationAccountResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -86,25 +91,35 @@ func (s *azureClient) ListAzureAutomationAccounts(ctx context.Context, subscript var list azure.AutomationAccountList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.AutomationAccountResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.AutomationAccountResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/container_registries.go b/client/container_registries.go index 77e10f6..8aeecdc 100644 --- a/client/container_registries.go +++ b/client/container_registries.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureContainerRegistry(ctx context.Context, subscriptionId, groupName, crName, expand string) (*azure.ContainerRegistry, error) { @@ -75,10 +76,14 @@ func (s *azureClient) ListAzureContainerRegistries(ctx context.Context, subscrip if result, err := s.GetAzureContainerRegistries(ctx, subscriptionId); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.ContainerRegistryResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.ContainerRegistryResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -86,25 +91,35 @@ func (s *azureClient) ListAzureContainerRegistries(ctx context.Context, subscrip var list azure.ContainerRegistryList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.ContainerRegistryResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.ContainerRegistryResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/devices.go b/client/devices.go index 6aa3849..8b811a2 100644 --- a/client/devices.go +++ b/client/devices.go @@ -27,6 +27,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureDevice(ctx context.Context, objectId string, selectCols []string) (*azure.Device, error) { @@ -94,10 +95,14 @@ func (s *azureClient) ListAzureDevices(ctx context.Context, filter, search, orde if list, err := s.GetAzureDevices(ctx, filter, search, orderBy, expand, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.DeviceResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.DeviceResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink @@ -105,23 +110,33 @@ func (s *azureClient) ListAzureDevices(ctx context.Context, filter, search, orde var list azure.DeviceList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.DeviceResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.DeviceResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } @@ -146,12 +161,16 @@ func (s *azureClient) ListAzureDeviceRegisteredOwners(ctx context.Context, objec if list, err := s.GetAzureDeviceRegisteredOwners(ctx, objectId, "", "", false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.DeviceRegisteredOwnerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.DeviceRegisteredOwnerResult{ DeviceId: objectId, Ok: u, + }); !ok { + return } } @@ -160,25 +179,35 @@ func (s *azureClient) ListAzureDeviceRegisteredOwners(ctx context.Context, objec var list azure.DirectoryObjectList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.DeviceRegisteredOwnerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.DeviceRegisteredOwnerResult{ DeviceId: objectId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/function_apps.go b/client/function_apps.go index a572315..640acce 100644 --- a/client/function_apps.go +++ b/client/function_apps.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureFunctionApp(ctx context.Context, subscriptionId, groupName, functionAppName, expand string) (*azure.FunctionApp, error) { @@ -75,10 +76,14 @@ func (s *azureClient) ListAzureFunctionApps(ctx context.Context, subscriptionId if result, err := s.GetAzureFunctionApps(ctx, subscriptionId); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.FunctionAppResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.FunctionAppResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -86,25 +91,35 @@ func (s *azureClient) ListAzureFunctionApps(ctx context.Context, subscriptionId var list azure.FunctionAppList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.FunctionAppResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.FunctionAppResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/groups.go b/client/groups.go index 7cd7dfa..4e205f8 100644 --- a/client/groups.go +++ b/client/groups.go @@ -28,6 +28,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureADGroup(ctx context.Context, objectId string, selectCols []string) (*azure.Group, error) { @@ -110,10 +111,14 @@ func (s *azureClient) ListAzureADGroups(ctx context.Context, filter, search, ord if list, err := s.GetAzureADGroups(ctx, filter, search, orderBy, expand, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.GroupResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.GroupResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink @@ -121,23 +126,33 @@ func (s *azureClient) ListAzureADGroups(ctx context.Context, filter, search, ord var list azure.GroupList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.GroupResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.GroupResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } @@ -160,12 +175,16 @@ func (s *azureClient) ListAzureADGroupOwners(ctx context.Context, objectId strin if list, err := s.GetAzureADGroupOwners(ctx, objectId, filter, search, orderBy, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.GroupOwnerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.GroupOwnerResult{ GroupId: objectId, Ok: u, + }); !ok { + return } } @@ -174,25 +193,35 @@ func (s *azureClient) ListAzureADGroupOwners(ctx context.Context, objectId strin var list azure.DirectoryObjectList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.GroupOwnerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.GroupOwnerResult{ GroupId: objectId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink @@ -219,13 +248,17 @@ func (s *azureClient) ListAzureADGroupMembers(ctx context.Context, objectId stri if list, err := s.GetAzureADGroupMembers(ctx, objectId, filter, search, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.MemberObjectResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.MemberObjectResult{ ParentId: objectId, ParentType: string(enums.EntityGroup), Ok: u, + }); !ok { + return } } @@ -234,26 +267,36 @@ func (s *azureClient) ListAzureADGroupMembers(ctx context.Context, objectId stri var list azure.MemberObjectList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.MemberObjectResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.MemberObjectResult{ ParentId: objectId, ParentType: string(enums.EntityGroup), Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/keyvaults.go b/client/keyvaults.go index 8fe1993..991cd6c 100644 --- a/client/keyvaults.go +++ b/client/keyvaults.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureKeyVault(ctx context.Context, subscriptionId, groupName, vaultName string) (*azure.KeyVault, error) { @@ -75,12 +76,16 @@ func (s *azureClient) ListAzureKeyVaults(ctx context.Context, subscriptionId str if result, err := s.GetAzureKeyVaults(ctx, subscriptionId, top); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.KeyVaultResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.KeyVaultResult{ SubscriptionId: subscriptionId, Ok: u, + }); !ok { + return } } @@ -89,25 +94,35 @@ func (s *azureClient) ListAzureKeyVaults(ctx context.Context, subscriptionId str var list azure.KeyVaultList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.KeyVaultResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.KeyVaultResult{ SubscriptionId: subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/logic_apps.go b/client/logic_apps.go index 68fa9dd..70d1257 100644 --- a/client/logic_apps.go +++ b/client/logic_apps.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureLogicApp(ctx context.Context, subscriptionId, groupName, logicappName, expand string) (*azure.LogicApp, error) { @@ -75,10 +76,14 @@ func (s *azureClient) ListAzureLogicApps(ctx context.Context, subscriptionId str if result, err := s.GetAzureLogicApps(ctx, subscriptionId, filter, top); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.LogicAppResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.LogicAppResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -86,25 +91,35 @@ func (s *azureClient) ListAzureLogicApps(ctx context.Context, subscriptionId str var list azure.LogicAppList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.LogicAppResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.LogicAppResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/managed_clusters.go b/client/managed_clusters.go index 2deeac8..13168ac 100644 --- a/client/managed_clusters.go +++ b/client/managed_clusters.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureManagedCluster(ctx context.Context, subscriptionId, groupName, mcName, expand string) (*azure.ManagedCluster, error) { @@ -75,10 +76,14 @@ func (s *azureClient) ListAzureManagedClusters(ctx context.Context, subscription if result, err := s.GetAzureManagedClusters(ctx, subscriptionId, statusOnly); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.ManagedClusterResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.ManagedClusterResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -86,25 +91,35 @@ func (s *azureClient) ListAzureManagedClusters(ctx context.Context, subscription var list azure.ManagedClusterList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.ManagedClusterResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.ManagedClusterResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/management_groups.go b/client/management_groups.go index 53ab49f..673c9b0 100644 --- a/client/management_groups.go +++ b/client/management_groups.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureManagementGroup(ctx context.Context, groupId, filter, expand string, recurse bool) (*azure.ManagementGroup, error) { @@ -90,10 +91,14 @@ func (s *azureClient) ListAzureManagementGroups(ctx context.Context) <-chan azur if result, err := s.GetAzureManagementGroups(ctx); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.ManagementGroupResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.ManagementGroupResult{Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -101,23 +106,33 @@ func (s *azureClient) ListAzureManagementGroups(ctx context.Context) <-chan azur var list azure.ManagementGroupList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.ManagementGroupResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.ManagementGroupResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } @@ -140,10 +155,14 @@ func (s *azureClient) ListAzureManagementGroupDescendants(ctx context.Context, g if result, err := s.GetAzureManagementGroupDescendants(ctx, groupId, 3000); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.DescendantInfoResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.DescendantInfoResult{Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -151,23 +170,33 @@ func (s *azureClient) ListAzureManagementGroupDescendants(ctx context.Context, g var list azure.DescendantInfoList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.DescendantInfoResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.DescendantInfoResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } diff --git a/client/resource_groups.go b/client/resource_groups.go index 9c37679..3164c0f 100644 --- a/client/resource_groups.go +++ b/client/resource_groups.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureResourceGroup(ctx context.Context, subscriptionId, groupName string) (*azure.ResourceGroup, error) { @@ -74,12 +75,16 @@ func (s *azureClient) ListAzureResourceGroups(ctx context.Context, subscriptionI if result, err := s.GetAzureResourceGroups(ctx, subscriptionId, filter, 1000); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.ResourceGroupResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.ResourceGroupResult{ SubscriptionId: objectId, Ok: u, + }); !ok { + return } } @@ -88,25 +93,35 @@ func (s *azureClient) ListAzureResourceGroups(ctx context.Context, subscriptionI var list azure.ResourceGroupList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.ResourceGroupResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.ResourceGroupResult{ SubscriptionId: objectId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/role_assignments.go b/client/role_assignments.go index 2304fbb..fd94cd4 100644 --- a/client/role_assignments.go +++ b/client/role_assignments.go @@ -27,6 +27,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureADRoleAssignment(ctx context.Context, objectId string, selectCols []string) (*azure.UnifiedRoleAssignment, error) { @@ -79,10 +80,14 @@ func (s *azureClient) ListAzureADRoleAssignments(ctx context.Context, filter, se if list, err := s.GetAzureADRoleAssignments(ctx, filter, search, orderBy, expand, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.UnifiedRoleAssignmentResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.UnifiedRoleAssignmentResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink @@ -90,23 +95,33 @@ func (s *azureClient) ListAzureADRoleAssignments(ctx context.Context, filter, se var list azure.UnifiedRoleAssignmentList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.UnifiedRoleAssignmentResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.UnifiedRoleAssignmentResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } @@ -147,12 +162,16 @@ func (s *azureClient) ListRoleAssignmentsForResource(ctx context.Context, resour if result, err := s.GetRoleAssignmentsForResource(ctx, resourceId, filter); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.RoleAssignmentResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.RoleAssignmentResult{ ParentId: resourceId, Ok: u, + }); !ok { + return } } @@ -161,25 +180,35 @@ func (s *azureClient) ListRoleAssignmentsForResource(ctx context.Context, resour var list azure.RoleAssignmentList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.RoleAssignmentResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.RoleAssignmentResult{ ParentId: resourceId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink @@ -220,12 +249,16 @@ func (s *azureClient) ListResourceRoleAssignments(ctx context.Context, subscript if result, err := s.GetResourceRoleAssignments(ctx, subscriptionId, filter, expand); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.RoleAssignmentResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.RoleAssignmentResult{ ParentId: subscriptionId, Ok: u, + }); !ok { + return } } @@ -234,25 +267,35 @@ func (s *azureClient) ListResourceRoleAssignments(ctx context.Context, subscript var list azure.RoleAssignmentList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.RoleAssignmentResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.RoleAssignmentResult{ ParentId: subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/roles.go b/client/roles.go index c28031c..006c003 100644 --- a/client/roles.go +++ b/client/roles.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureADRole(ctx context.Context, roleId string, selectCols []string) (*azure.Role, error) { @@ -73,10 +74,14 @@ func (s *azureClient) ListAzureADRoles(ctx context.Context, filter, expand strin if users, err := s.GetAzureADRoles(ctx, filter, expand); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range users.Value { - out <- azure.RoleResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.RoleResult{Ok: u}); !ok { + return + } } nextLink = users.NextLink @@ -84,23 +89,33 @@ func (s *azureClient) ListAzureADRoles(ctx context.Context, filter, expand strin var users azure.RoleList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &users); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range users.Value { - out <- azure.RoleResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.RoleResult{Ok: u}); !ok { + return + } } nextLink = users.NextLink } diff --git a/client/service_principals.go b/client/service_principals.go index fa8e422..9c1d39b 100644 --- a/client/service_principals.go +++ b/client/service_principals.go @@ -27,6 +27,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureADServicePrincipal(ctx context.Context, objectId string, selectCols []string) (*azure.ServicePrincipal, error) { @@ -94,10 +95,14 @@ func (s *azureClient) ListAzureADServicePrincipals(ctx context.Context, filter, if list, err := s.GetAzureADServicePrincipals(ctx, filter, search, orderBy, expand, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.ServicePrincipalResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.ServicePrincipalResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink @@ -105,23 +110,33 @@ func (s *azureClient) ListAzureADServicePrincipals(ctx context.Context, filter, var list azure.ServicePrincipalList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.ServicePrincipalResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.ServicePrincipalResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } @@ -146,12 +161,16 @@ func (s *azureClient) ListAzureADServicePrincipalOwners(ctx context.Context, obj if list, err := s.GetAzureADServicePrincipalOwners(ctx, objectId, filter, search, orderBy, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range list.Value { - out <- azure.ServicePrincipalOwnerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.ServicePrincipalOwnerResult{ ServicePrincipalId: objectId, Ok: u, + }); !ok { + return } } @@ -160,25 +179,35 @@ func (s *azureClient) ListAzureADServicePrincipalOwners(ctx context.Context, obj var list azure.DirectoryObjectList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.ServicePrincipalOwnerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.ServicePrincipalOwnerResult{ ServicePrincipalId: objectId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/storage_accounts.go b/client/storage_accounts.go index 5379f09..50f40c9 100644 --- a/client/storage_accounts.go +++ b/client/storage_accounts.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureStorageAccount(ctx context.Context, subscriptionId, groupName, saName, expand string) (*azure.StorageAccount, error) { @@ -74,10 +75,14 @@ func (s *azureClient) ListAzureStorageAccounts(ctx context.Context, subscription if result, err := s.GetAzureStorageAccounts(ctx, subscriptionId); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.StorageAccountResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.StorageAccountResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -85,25 +90,35 @@ func (s *azureClient) ListAzureStorageAccounts(ctx context.Context, subscription var list azure.StorageAccountList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.StorageAccountResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.StorageAccountResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink @@ -165,10 +180,14 @@ func (s *azureClient) ListAzureStorageContainers(ctx context.Context, subscripti if result, err := s.GetAzureStorageContainers(ctx, subscriptionId, resourceGroupName, saName, filter, includeDeleted, maxPageSize); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.StorageContainerResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.StorageContainerResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -176,25 +195,35 @@ func (s *azureClient) ListAzureStorageContainers(ctx context.Context, subscripti var list azure.StorageContainerList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.StorageContainerResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.StorageContainerResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/subscriptions.go b/client/subscriptions.go index 4b6a9ab..c44c17f 100644 --- a/client/subscriptions.go +++ b/client/subscriptions.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureSubscription(ctx context.Context, objectId string) (*azure.Subscription, error) { @@ -73,10 +74,14 @@ func (s *azureClient) ListAzureSubscriptions(ctx context.Context) <-chan azure.S if result, err := s.GetAzureSubscriptions(ctx); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.SubscriptionResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.SubscriptionResult{Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -84,23 +89,33 @@ func (s *azureClient) ListAzureSubscriptions(ctx context.Context) <-chan azure.S var list azure.SubscriptionList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.SubscriptionResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.SubscriptionResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } diff --git a/client/tenants.go b/client/tenants.go index f9b2439..bd3314e 100644 --- a/client/tenants.go +++ b/client/tenants.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureADOrganization(ctx context.Context, selectCols []string) (*azure.Organization, error) { @@ -73,10 +74,14 @@ func (s *azureClient) ListAzureADTenants(ctx context.Context, includeAllTenantCa if result, err := s.GetAzureADTenants(ctx, includeAllTenantCategories); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.TenantResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.TenantResult{Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -84,23 +89,33 @@ func (s *azureClient) ListAzureADTenants(ctx context.Context, includeAllTenantCa var list azure.TenantList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.TenantResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.TenantResult{Ok: u}); !ok { + return + } } nextLink = list.NextLink } diff --git a/client/users.go b/client/users.go index a84713a..98cec6c 100644 --- a/client/users.go +++ b/client/users.go @@ -27,6 +27,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/constants" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureADUser(ctx context.Context, objectId string, selectCols []string) (*azure.User, error) { @@ -78,10 +79,14 @@ func (s *azureClient) ListAzureADUsers(ctx context.Context, filter string, searc ) if users, err := s.GetAzureADUsers(ctx, filter, search, orderBy, selectCols, 999, false); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range users.Value { - out <- azure.UserResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.UserResult{Ok: u}); !ok { + return + } } nextLink = users.NextLink @@ -89,23 +94,33 @@ func (s *azureClient) ListAzureADUsers(ctx context.Context, filter string, searc var users azure.UserList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.msgraph.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &users); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range users.Value { - out <- azure.UserResult{Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.UserResult{Ok: u}); !ok { + return + } } nextLink = users.NextLink } diff --git a/client/virtual_machines.go b/client/virtual_machines.go index a09f5fc..ccb810c 100644 --- a/client/virtual_machines.go +++ b/client/virtual_machines.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureVirtualMachine(ctx context.Context, subscriptionId, groupName, vmName, expand string) (*azure.VirtualMachine, error) { @@ -75,10 +76,14 @@ func (s *azureClient) ListAzureVirtualMachines(ctx context.Context, subscription if result, err := s.GetAzureVirtualMachines(ctx, subscriptionId, statusOnly); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.VirtualMachineResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.VirtualMachineResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -86,25 +91,35 @@ func (s *azureClient) ListAzureVirtualMachines(ctx context.Context, subscription var list azure.VirtualMachineList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.VirtualMachineResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.VirtualMachineResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/vm_scale_sets.go b/client/vm_scale_sets.go index 2a443b3..4158553 100644 --- a/client/vm_scale_sets.go +++ b/client/vm_scale_sets.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureVMScaleSet(ctx context.Context, subscriptionId, groupName, vmssName, expand string) (*azure.VMScaleSet, error) { @@ -75,10 +76,14 @@ func (s *azureClient) ListAzureVMScaleSets(ctx context.Context, subscriptionId s if result, err := s.GetAzureVMScaleSets(ctx, subscriptionId, statusOnly); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.VMScaleSetResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.VMScaleSetResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -86,25 +91,35 @@ func (s *azureClient) ListAzureVMScaleSets(ctx context.Context, subscriptionId s var list azure.VMScaleSetList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.VMScaleSetResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.VMScaleSetResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink diff --git a/client/web_apps.go b/client/web_apps.go index 3175250..7560d23 100644 --- a/client/web_apps.go +++ b/client/web_apps.go @@ -25,6 +25,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client/query" "github.com/bloodhoundad/azurehound/v2/client/rest" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" ) func (s *azureClient) GetAzureWebApp(ctx context.Context, subscriptionId, groupName, waName, expand string) (*azure.WebApp, error) { @@ -75,10 +76,14 @@ func (s *azureClient) ListAzureWebApps(ctx context.Context, subscriptionId strin if result, err := s.GetAzureWebApps(ctx, subscriptionId); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } } else { for _, u := range result.Value { - out <- azure.WebAppResult{SubscriptionId: subscriptionId, Ok: u} + if ok := pipeline.Send(ctx.Done(), out, azure.WebAppResult{SubscriptionId: subscriptionId, Ok: u}); !ok { + return + } } nextLink = result.NextLink @@ -86,25 +91,35 @@ func (s *azureClient) ListAzureWebApps(ctx context.Context, subscriptionId strin var list azure.WebAppList if url, err := url.Parse(nextLink); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if req, err := rest.NewRequest(ctx, "GET", url, nil, nil, nil); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if res, err := s.resourceManager.Send(req); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else if err := rest.Decode(res.Body, &list); err != nil { errResult.Error = err - out <- errResult + if ok := pipeline.Send(ctx.Done(), out, errResult); !ok { + return + } nextLink = "" } else { for _, u := range list.Value { - out <- azure.WebAppResult{ + if ok := pipeline.Send(ctx.Done(), out, azure.WebAppResult{ SubscriptionId: "/subscriptions/" + subscriptionId, Ok: u, + }); !ok { + return } } nextLink = list.NextLink From 2bd306218982c135e2b588a2770a09101be2c99a Mon Sep 17 00:00:00 2001 From: Reuben Lifshay Date: Fri, 27 Oct 2023 17:01:40 -0700 Subject: [PATCH 4/9] chore: update cmd to use pipeline.Send() --- cmd/list-app-owners.go | 6 ++++-- cmd/list-app-role-assignments.go | 8 ++++++-- cmd/list-apps.go | 7 +++++-- cmd/list-automation-account-role-assignments.go | 8 ++++++-- cmd/list-automation-accounts.go | 8 ++++++-- cmd/list-container-registries.go | 8 ++++++-- cmd/list-container-registry-role-assignments.go | 8 ++++++-- cmd/list-device-owners.go | 8 ++++++-- cmd/list-devices.go | 5 ++++- cmd/list-function-app-role-assignments.go | 8 ++++++-- cmd/list-function-apps.go | 8 ++++++-- cmd/list-group-members.go | 8 ++++++-- cmd/list-group-owners.go | 8 ++++++-- cmd/list-groups.go | 5 ++++- cmd/list-key-vault-access-policies.go | 8 ++++++-- cmd/list-key-vault-role-assignments.go | 8 ++++++-- cmd/list-key-vaults.go | 8 ++++++-- cmd/list-logic-app-role-assignments.go | 8 ++++++-- cmd/list-logic-apps.go | 8 ++++++-- cmd/list-managed-cluster-role-assignments.go | 8 ++++++-- cmd/list-managed-clusters.go | 8 ++++++-- cmd/list-management-group-descendants.go | 8 ++++++-- cmd/list-management-group-role-assignments.go | 10 +++++++--- cmd/list-management-groups.go | 5 ++++- cmd/list-resource-group-role-assignments.go | 8 ++++++-- cmd/list-resource-groups.go | 8 ++++++-- cmd/list-role-assignments.go | 8 ++++++-- cmd/list-roles.go | 5 ++++- cmd/list-service-principal-owners.go | 8 ++++++-- cmd/list-service-principals.go | 5 ++++- cmd/list-storage-account-role-assignments.go | 8 ++++++-- cmd/list-storage-accounts.go | 8 ++++++-- cmd/list-storage-containers.go | 8 ++++++-- cmd/list-subscription-owners.go | 4 +++- cmd/list-subscription-role-assignments.go | 8 ++++++-- cmd/list-subscription-user-access-admins.go | 4 +++- cmd/list-subscriptions.go | 5 ++++- cmd/list-tenants.go | 9 +++++++-- cmd/list-users.go | 5 ++++- cmd/list-virtual-machine-role-assignments.go | 8 ++++++-- cmd/list-virtual-machines.go | 8 ++++++-- cmd/list-vm-scale-set-role-assignments.go | 8 ++++++-- cmd/list-vm-scale-sets.go | 8 ++++++-- cmd/list-web-app-role-assignments.go | 8 ++++++-- cmd/list-web-apps.go | 8 ++++++-- 45 files changed, 249 insertions(+), 82 deletions(-) diff --git a/cmd/list-app-owners.go b/cmd/list-app-owners.go index de137ca..869f03b 100644 --- a/cmd/list-app-owners.go +++ b/cmd/list-app-owners.go @@ -89,10 +89,12 @@ func listAppOwners(ctx context.Context, client client.AzureClient, apps <-chan a } } - out <- NewAzureWrapper( + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( enums.KindAZAppOwner, data, - ) + )); !ok { + return + } log.V(1).Info("finished listing app owners", "appId", app.Data.AppId, "count", count) } }() diff --git a/cmd/list-app-role-assignments.go b/cmd/list-app-role-assignments.go index 3672548..9815d9b 100644 --- a/cmd/list-app-role-assignments.go +++ b/cmd/list-app-role-assignments.go @@ -75,7 +75,9 @@ func listAppRoleAssignments(ctx context.Context, client client.AzureClient, serv return } else { if len(servicePrincipal.AppRoles) != 0 { - filteredSPs <- servicePrincipal + if ok := pipeline.Send(ctx.Done(), filteredSPs, servicePrincipal); !ok { + return + } } } } @@ -96,13 +98,15 @@ func listAppRoleAssignments(ctx context.Context, client client.AzureClient, serv } else { log.V(2).Info("found app role assignment", "roleAssignments", item) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZAppRoleAssignment, Data: models.AppRoleAssignment{ AppRoleAssignment: item.Ok, AppId: servicePrincipal.AppId, TenantId: client.TenantInfo().TenantId, }, + })); !ok { + return } } } diff --git a/cmd/list-apps.go b/cmd/list-apps.go index 67bfd9f..76f7e59 100644 --- a/cmd/list-apps.go +++ b/cmd/list-apps.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" ) @@ -67,14 +68,16 @@ func listApps(ctx context.Context, client client.AzureClient) <-chan azureWrappe } else { log.V(2).Info("found application", "app", item) count++ - out <- NewAzureWrapper( + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( enums.KindAZApp, models.App{ Application: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, }, - ) + )); !ok { + return + } } } log.Info("finished listing all apps", "count", count) diff --git a/cmd/list-automation-account-role-assignments.go b/cmd/list-automation-account-role-assignments.go index b1d74fc..5866e0a 100644 --- a/cmd/list-automation-account-role-assignments.go +++ b/cmd/list-automation-account-role-assignments.go @@ -75,7 +75,9 @@ func listAutomationAccountRoleAssignments(ctx context.Context, client client.Azu log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating automation account role assignments", "result", result) return } else { - ids <- automationAccount.Id + if ok := pipeline.Send(ctx.Done(), ids, automationAccount.Id); !ok { + return + } } } }() @@ -108,9 +110,11 @@ func listAutomationAccountRoleAssignments(ctx context.Context, client client.Azu automationAccountRoleAssignments.RoleAssignments = append(automationAccountRoleAssignments.RoleAssignments, automationAccountRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZAutomationAccountRoleAssignment, Data: automationAccountRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing automation account role assignments", "automationAccountId", id, "count", count) } diff --git a/cmd/list-automation-accounts.go b/cmd/list-automation-accounts.go index ebdc1f1..b6cf0c1 100644 --- a/cmd/list-automation-accounts.go +++ b/cmd/list-automation-accounts.go @@ -72,7 +72,9 @@ func listAutomationAccounts(ctx context.Context, client client.AzureClient, subs log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating automation accounts", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -97,9 +99,11 @@ func listAutomationAccounts(ctx context.Context, client client.AzureClient, subs } log.V(2).Info("found automation account", "automationAccount", automationAccount) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZAutomationAccount, Data: automationAccount, + })); !ok { + return } } } diff --git a/cmd/list-container-registries.go b/cmd/list-container-registries.go index fcfd7b2..a57dacd 100644 --- a/cmd/list-container-registries.go +++ b/cmd/list-container-registries.go @@ -77,7 +77,9 @@ func listContainerRegistries(ctx context.Context, client client.AzureClient, sub log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating container registries", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -102,9 +104,11 @@ func listContainerRegistries(ctx context.Context, client client.AzureClient, sub } log.V(2).Info("found container registry", "containerRegistry", containerRegistry) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZContainerRegistry, Data: containerRegistry, + })); !ok { + return } } } diff --git a/cmd/list-container-registry-role-assignments.go b/cmd/list-container-registry-role-assignments.go index 32fd56e..a601986 100644 --- a/cmd/list-container-registry-role-assignments.go +++ b/cmd/list-container-registry-role-assignments.go @@ -80,7 +80,9 @@ func listContainerRegistryRoleAssignments(ctx context.Context, client client.Azu log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating container registry role assignments", "result", result) return } else { - ids <- containerRegistry.Id + if ok := pipeline.Send(ctx.Done(), ids, containerRegistry.Id); !ok { + return + } } } }() @@ -113,9 +115,11 @@ func listContainerRegistryRoleAssignments(ctx context.Context, client client.Azu containerRegistryRoleAssignments.RoleAssignments = append(containerRegistryRoleAssignments.RoleAssignments, containerRegistryRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZContainerRegistryRoleAssignment, Data: containerRegistryRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing container registry role assignments", "containerRegistryId", id, "count", count) } diff --git a/cmd/list-device-owners.go b/cmd/list-device-owners.go index be04b8a..86e1e71 100644 --- a/cmd/list-device-owners.go +++ b/cmd/list-device-owners.go @@ -72,7 +72,9 @@ func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <- if device, ok := result.(AzureWrapper).Data.(models.Device); !ok { log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating device owners", "result", result) } else { - ids <- device.Id + if ok := pipeline.Send(ctx.Done(), ids, device.Id); !ok { + return + } } } }() @@ -102,9 +104,11 @@ func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <- data.Owners = append(data.Owners, deviceOwner) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZDeviceOwner, Data: data, + })); !ok { + return } log.V(1).Info("finished listing device owners", "deviceId", id, "count", count) } diff --git a/cmd/list-devices.go b/cmd/list-devices.go index f185d49..71acad6 100644 --- a/cmd/list-devices.go +++ b/cmd/list-devices.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" ) @@ -67,13 +68,15 @@ func listDevices(ctx context.Context, client client.AzureClient) <-chan interfac } else { log.V(2).Info("found device", "device", item) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZDevice, Data: models.Device{ Device: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, }, + })); !ok { + return } } } diff --git a/cmd/list-function-app-role-assignments.go b/cmd/list-function-app-role-assignments.go index 7cf539f..fdc0323 100644 --- a/cmd/list-function-app-role-assignments.go +++ b/cmd/list-function-app-role-assignments.go @@ -75,7 +75,9 @@ func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClie log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating function app role assignments", "result", result) return } else { - ids <- functionApp.Id + if ok := pipeline.Send(ctx.Done(), ids, functionApp.Id); !ok { + return + } } } }() @@ -108,9 +110,11 @@ func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClie functionAppRoleAssignments.RoleAssignments = append(functionAppRoleAssignments.RoleAssignments, functionAppRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZFunctionAppRoleAssignment, Data: functionAppRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing function app role assignments", "functionAppId", id, "count", count) } diff --git a/cmd/list-function-apps.go b/cmd/list-function-apps.go index eb147e9..ec4a013 100644 --- a/cmd/list-function-apps.go +++ b/cmd/list-function-apps.go @@ -72,7 +72,9 @@ func listFunctionApps(ctx context.Context, client client.AzureClient, subscripti log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating function apps", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -98,9 +100,11 @@ func listFunctionApps(ctx context.Context, client client.AzureClient, subscripti if functionApp.Kind == "functionapp" { log.V(2).Info("found function app", "functionApp", functionApp) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZFunctionApp, Data: functionApp, + })); !ok { + return } } } diff --git a/cmd/list-group-members.go b/cmd/list-group-members.go index ce6ced6..ef53857 100644 --- a/cmd/list-group-members.go +++ b/cmd/list-group-members.go @@ -73,7 +73,9 @@ func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-c log.Error(fmt.Errorf("failed group type assertion"), "unable to continue enumerating group members", "result", result) return } else { - ids <- group.Id + if ok := pipeline.Send(ctx.Done(), ids, group.Id); !ok { + return + } } } }() @@ -103,9 +105,11 @@ func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-c data.Members = append(data.Members, groupMember) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZGroupMember, Data: data, + })); !ok { + return } log.V(1).Info("finished listing group memberships", "groupId", id, "count", count) } diff --git a/cmd/list-group-owners.go b/cmd/list-group-owners.go index a45834b..8974abd 100644 --- a/cmd/list-group-owners.go +++ b/cmd/list-group-owners.go @@ -73,7 +73,9 @@ func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-ch log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating group owners", "result", result) return } else { - ids <- group.Id + if ok := pipeline.Send(ctx.Done(), ids, group.Id); !ok { + return + } } } }() @@ -103,9 +105,11 @@ func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-ch groupOwners.Owners = append(groupOwners.Owners, groupOwner) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZGroupOwner, Data: groupOwners, + })); !ok { + return } log.V(1).Info("finished listing group owners", "groupId", id, "count", count) } diff --git a/cmd/list-groups.go b/cmd/list-groups.go index e6632c5..8a7d32d 100644 --- a/cmd/list-groups.go +++ b/cmd/list-groups.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" ) @@ -72,9 +73,11 @@ func listGroups(ctx context.Context, client client.AzureClient) <-chan interface TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZGroup, Data: group, + })); !ok { + return } } } diff --git a/cmd/list-key-vault-access-policies.go b/cmd/list-key-vault-access-policies.go index 79c9c94..dc8cdda 100644 --- a/cmd/list-key-vault-access-policies.go +++ b/cmd/list-key-vault-access-policies.go @@ -80,12 +80,14 @@ func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, } else { for _, policy := range keyVault.Properties.AccessPolicies { if len(filters) == 0 { - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: kinds.KindAZKeyVaultAccessPolicy, Data: models.KeyVaultAccessPolicy{ KeyVaultId: keyVault.Id, AccessPolicyEntry: policy, }, + })); !ok { + return } } else { for _, filter := range filters { @@ -103,12 +105,14 @@ func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, } }() if contains(permissions, "Get") { - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: kinds.KindAZKeyVaultAccessPolicy, Data: models.KeyVaultAccessPolicy{ KeyVaultId: keyVault.Id, AccessPolicyEntry: policy, }, + })); !ok { + return } break } diff --git a/cmd/list-key-vault-role-assignments.go b/cmd/list-key-vault-role-assignments.go index c9f0070..ee14b05 100644 --- a/cmd/list-key-vault-role-assignments.go +++ b/cmd/list-key-vault-role-assignments.go @@ -74,7 +74,9 @@ func listKeyVaultRoleAssignments(ctx context.Context, client client.AzureClient, log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating key vault role assignments", "result", result) return } else { - ids <- keyVault.Id + if ok := pipeline.Send(ctx.Done(), ids, keyVault.Id); !ok { + return + } } } }() @@ -104,7 +106,9 @@ func listKeyVaultRoleAssignments(ctx context.Context, client client.AzureClient, keyVaultRoleAssignments.RoleAssignments = append(keyVaultRoleAssignments.RoleAssignments, keyVaultRoleAssignment) } } - out <- NewAzureWrapper(enums.KindAZKeyVaultRoleAssignment, keyVaultRoleAssignments) + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZKeyVaultRoleAssignment, keyVaultRoleAssignments)); !ok { + return + } log.V(1).Info("finished listing key vault role assignments", "keyVaultId", id, "count", count) } }() diff --git a/cmd/list-key-vaults.go b/cmd/list-key-vaults.go index 90cd52a..1440844 100644 --- a/cmd/list-key-vaults.go +++ b/cmd/list-key-vaults.go @@ -73,7 +73,9 @@ func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating key vaults", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -100,9 +102,11 @@ func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions } log.V(2).Info("found key vault", "keyVault", keyVault) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZKeyVault, Data: keyVault, + })); !ok { + return } } } diff --git a/cmd/list-logic-app-role-assignments.go b/cmd/list-logic-app-role-assignments.go index 83e9df6..1b6b861 100644 --- a/cmd/list-logic-app-role-assignments.go +++ b/cmd/list-logic-app-role-assignments.go @@ -80,7 +80,9 @@ func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating logic app role assignments", "result", result) return } else { - ids <- logicapp.Id + if ok := pipeline.Send(ctx.Done(), ids, logicapp.Id); !ok { + return + } } } }() @@ -113,9 +115,11 @@ func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, logicappRoleAssignments.RoleAssignments = append(logicappRoleAssignments.RoleAssignments, logicappRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZLogicAppRoleAssignment, Data: logicappRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing logic app role assignments", "logicappId", id, "count", count) } diff --git a/cmd/list-logic-apps.go b/cmd/list-logic-apps.go index 6bd54e1..46877ab 100644 --- a/cmd/list-logic-apps.go +++ b/cmd/list-logic-apps.go @@ -77,7 +77,9 @@ func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating logic apps", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -107,9 +109,11 @@ func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions } log.V(2).Info("found logicapp", "logicapp", logicapp) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZLogicApp, Data: logicapp, + })); !ok { + return } } } diff --git a/cmd/list-managed-cluster-role-assignments.go b/cmd/list-managed-cluster-role-assignments.go index 0ba6b1e..feb2f1e 100644 --- a/cmd/list-managed-cluster-role-assignments.go +++ b/cmd/list-managed-cluster-role-assignments.go @@ -80,7 +80,9 @@ func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureC log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating managed cluster role assignments", "result", result) return } else { - ids <- managedCluster.Id + if ok := pipeline.Send(ctx.Done(), ids, managedCluster.Id); !ok { + return + } } } }() @@ -113,9 +115,11 @@ func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureC managedClusterRoleAssignments.RoleAssignments = append(managedClusterRoleAssignments.RoleAssignments, managedClusterRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZManagedClusterRoleAssignment, Data: managedClusterRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing managed cluster role assignments", "managedClusterId", id, "count", count) } diff --git a/cmd/list-managed-clusters.go b/cmd/list-managed-clusters.go index b072a3c..db21930 100644 --- a/cmd/list-managed-clusters.go +++ b/cmd/list-managed-clusters.go @@ -77,7 +77,9 @@ func listManagedClusters(ctx context.Context, client client.AzureClient, subscri log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating managed clusters", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -102,9 +104,11 @@ func listManagedClusters(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found managed cluster", "managedCluster", managedCluster) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZManagedCluster, Data: managedCluster, + })); !ok { + return } } } diff --git a/cmd/list-management-group-descendants.go b/cmd/list-management-group-descendants.go index 33a05cf..2330857 100644 --- a/cmd/list-management-group-descendants.go +++ b/cmd/list-management-group-descendants.go @@ -73,7 +73,9 @@ func listManagementGroupDescendants(ctx context.Context, client client.AzureClie log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating management group descendants", "result", result) return } else { - ids <- managementGroup.Name + if ok := pipeline.Send(ctx.Done(), ids, managementGroup.Name); !ok { + return + } } } }() @@ -91,9 +93,11 @@ func listManagementGroupDescendants(ctx context.Context, client client.AzureClie } else { log.V(2).Info("found management group descendant", "type", item.Ok.Type, "id", item.Ok.Id, "parent", item.Ok.Properties.Parent.Id) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZManagementGroupDescendant, Data: item.Ok, + })); !ok { + return } } } diff --git a/cmd/list-management-group-role-assignments.go b/cmd/list-management-group-role-assignments.go index 0a2bb76..3d07121 100644 --- a/cmd/list-management-group-role-assignments.go +++ b/cmd/list-management-group-role-assignments.go @@ -74,7 +74,9 @@ func listManagementGroupRoleAssignments(ctx context.Context, client client.Azure log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating management group role assignments", "result", result) return } else { - ids <- managementGroup.Id + if ok := pipeline.Send(ctx.Done(), ids, managementGroup.Id); !ok { + return + } } } }() @@ -104,10 +106,12 @@ func listManagementGroupRoleAssignments(ctx context.Context, client client.Azure managementGroupRoleAssignments.RoleAssignments = append(managementGroupRoleAssignments.RoleAssignments, managementGroupRoleAssignment) } } - out <- NewAzureWrapper( + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( enums.KindAZManagementGroupRoleAssignment, managementGroupRoleAssignments, - ) + )); !ok { + return + } log.V(1).Info("finished listing managementGroup role assignments", "managementGroupId", id, "count", count) } }() diff --git a/cmd/list-management-groups.go b/cmd/list-management-groups.go index 66b1f46..6a4d89a 100644 --- a/cmd/list-management-groups.go +++ b/cmd/list-management-groups.go @@ -27,6 +27,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/config" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" ) @@ -74,9 +75,11 @@ func listManagementGroups(ctx context.Context, client client.AzureClient) <-chan TenantName: client.TenantInfo().DisplayName, } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZManagementGroup, Data: mgmtGroup, + })); !ok { + return } } } diff --git a/cmd/list-resource-group-role-assignments.go b/cmd/list-resource-group-role-assignments.go index a44fd8a..055d3e0 100644 --- a/cmd/list-resource-group-role-assignments.go +++ b/cmd/list-resource-group-role-assignments.go @@ -75,7 +75,9 @@ func listResourceGroupRoleAssignments(ctx context.Context, client client.AzureCl log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating resource group role assignments", "result", result) return } else { - ids <- resourceGroup.Id + if ok := pipeline.Send(ctx.Done(), ids, resourceGroup.Id); !ok { + return + } } } }() @@ -105,7 +107,9 @@ func listResourceGroupRoleAssignments(ctx context.Context, client client.AzureCl resourceGroupRoleAssignments.RoleAssignments = append(resourceGroupRoleAssignments.RoleAssignments, resourceGroupRoleAssignment) } } - out <- NewAzureWrapper(enums.KindAZResourceGroupRoleAssignment, resourceGroupRoleAssignments) + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZResourceGroupRoleAssignment, resourceGroupRoleAssignments)); !ok { + return + } log.V(1).Info("finished listing resourceGroup role assignments", "resourceGroupId", id, "count", count) } }() diff --git a/cmd/list-resource-groups.go b/cmd/list-resource-groups.go index 7299852..84737fb 100644 --- a/cmd/list-resource-groups.go +++ b/cmd/list-resource-groups.go @@ -73,7 +73,9 @@ func listResourceGroups(ctx context.Context, client client.AzureClient, subscrip log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating resource groups", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -96,9 +98,11 @@ func listResourceGroups(ctx context.Context, client client.AzureClient, subscrip } log.V(2).Info("found resource group", "resourceGroup", resourceGroup) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZResourceGroup, Data: resourceGroup, + })); !ok { + return } } } diff --git a/cmd/list-role-assignments.go b/cmd/list-role-assignments.go index 8348fd7..cd0ac6e 100644 --- a/cmd/list-role-assignments.go +++ b/cmd/list-role-assignments.go @@ -74,7 +74,9 @@ func listRoleAssignments(ctx context.Context, client client.AzureClient, roles < log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating role assignments", "result", result) return } else { - ids <- role.Id + if ok := pipeline.Send(ctx.Done(), ids, role.Id); !ok { + return + } } } }() @@ -102,9 +104,11 @@ func listRoleAssignments(ctx context.Context, client client.AzureClient, roles < roleAssignments.RoleAssignments = append(roleAssignments.RoleAssignments, item.Ok) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZRoleAssignment, Data: roleAssignments, + })); !ok { + return } log.V(1).Info("finished listing role assignments", "roleDefinitionId", id, "count", count) } diff --git a/cmd/list-roles.go b/cmd/list-roles.go index 23db917..b3eddc1 100644 --- a/cmd/list-roles.go +++ b/cmd/list-roles.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" ) @@ -67,13 +68,15 @@ func listRoles(ctx context.Context, client client.AzureClient) <-chan interface{ } else { log.V(2).Info("found role", "role", item) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZRole, Data: models.Role{ Role: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, }, + })); !ok { + return } } } diff --git a/cmd/list-service-principal-owners.go b/cmd/list-service-principal-owners.go index 845d30d..acb47a6 100644 --- a/cmd/list-service-principal-owners.go +++ b/cmd/list-service-principal-owners.go @@ -73,7 +73,9 @@ func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating service principal owners", "result", result) return } else { - ids <- servicePrincipal.Id + if ok := pipeline.Send(ctx.Done(), ids, servicePrincipal.Id); !ok { + return + } } } }() @@ -103,9 +105,11 @@ func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, servicePrincipalOwners.Owners = append(servicePrincipalOwners.Owners, servicePrincipalOwner) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZServicePrincipalOwner, Data: servicePrincipalOwners, + })); !ok { + return } log.V(1).Info("finished listing service principal owners", "servicePrincipalId", id, "count", count) } diff --git a/cmd/list-service-principals.go b/cmd/list-service-principals.go index bf7aecf..8dade1c 100644 --- a/cmd/list-service-principals.go +++ b/cmd/list-service-principals.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" ) @@ -67,13 +68,15 @@ func listServicePrincipals(ctx context.Context, client client.AzureClient) <-cha } else { log.V(2).Info("found service principal", "servicePrincipal", item) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZServicePrincipal, Data: models.ServicePrincipal{ ServicePrincipal: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, }, + })); !ok { + return } } } diff --git a/cmd/list-storage-account-role-assignments.go b/cmd/list-storage-account-role-assignments.go index b049dd8..1b1298e 100644 --- a/cmd/list-storage-account-role-assignments.go +++ b/cmd/list-storage-account-role-assignments.go @@ -75,7 +75,9 @@ func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureC log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating storage account role assignments", "result", result) return } else { - ids <- storageAccount.Id + if ok := pipeline.Send(ctx.Done(), ids, storageAccount.Id); !ok { + return + } } } }() @@ -108,9 +110,11 @@ func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureC storageAccountRoleAssignments.RoleAssignments = append(storageAccountRoleAssignments.RoleAssignments, storageAccountRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZStorageAccountRoleAssignment, Data: storageAccountRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing storage account role assignments", "storageAccountId", id, "count", count) } diff --git a/cmd/list-storage-accounts.go b/cmd/list-storage-accounts.go index fd22ec1..464322b 100644 --- a/cmd/list-storage-accounts.go +++ b/cmd/list-storage-accounts.go @@ -72,7 +72,9 @@ func listStorageAccounts(ctx context.Context, client client.AzureClient, subscri log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating storage accounts", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -99,9 +101,11 @@ func listStorageAccounts(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found storage account", "storageAccount", storageAccount) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZStorageAccount, Data: storageAccount, + })); !ok { + return } } } diff --git a/cmd/list-storage-containers.go b/cmd/list-storage-containers.go index 66e461d..ffbb01b 100644 --- a/cmd/list-storage-containers.go +++ b/cmd/list-storage-containers.go @@ -79,7 +79,9 @@ func listStorageContainers(ctx context.Context, client client.AzureClient, stora log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating storage containers", "result", result) return } else { - ids <- storageAccount + if ok := pipeline.Send(ctx.Done(), ids, interface{}(storageAccount)); !ok { + return + } } } }() @@ -107,9 +109,11 @@ func listStorageContainers(ctx context.Context, client client.AzureClient, stora } log.V(2).Info("found storage container", "storageContainer", storageContainer) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZStorageContainer, Data: storageContainer, + })); !ok { + return } } log.V(1).Info("finished listing storage containers", "subscriptionId", stAccount.(models.StorageAccount).SubscriptionId, "count", count) diff --git a/cmd/list-subscription-owners.go b/cmd/list-subscription-owners.go index 000e778..207c583 100644 --- a/cmd/list-subscription-owners.go +++ b/cmd/list-subscription-owners.go @@ -90,9 +90,11 @@ func listSubscriptionOwners(ctx context.Context, client client.AzureClient, role subscriptionOwners.Owners = append(subscriptionOwners.Owners, subscriptionOwner) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZSubscriptionOwner, Data: subscriptionOwners, + })); !ok { + return } log.V(1).Info("finished listing subscription owners", "subscriptionId", roleAssignments.SubscriptionId, "count", count) } diff --git a/cmd/list-subscription-role-assignments.go b/cmd/list-subscription-role-assignments.go index 8e6dab3..18e27f2 100644 --- a/cmd/list-subscription-role-assignments.go +++ b/cmd/list-subscription-role-assignments.go @@ -74,7 +74,9 @@ func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureCli log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating subscription role assignments", "result", result) return } else { - ids <- subscription.Id + if ok := pipeline.Send(ctx.Done(), ids, subscription.Id); !ok { + return + } } } }() @@ -104,9 +106,11 @@ func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureCli subscriptionRoleAssignments.RoleAssignments = append(subscriptionRoleAssignments.RoleAssignments, subscriptionRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZSubscriptionRoleAssignment, Data: subscriptionRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing subscription role assignments", "subscriptionId", id, "count", count) } diff --git a/cmd/list-subscription-user-access-admins.go b/cmd/list-subscription-user-access-admins.go index 3502ed8..3d81ca7 100644 --- a/cmd/list-subscription-user-access-admins.go +++ b/cmd/list-subscription-user-access-admins.go @@ -90,9 +90,11 @@ func listSubscriptionUserAccessAdmins(ctx context.Context, client client.AzureCl subscriptionUserAccessAdmins.UserAccessAdmins = append(subscriptionUserAccessAdmins.UserAccessAdmins, subscriptionUserAccessAdmin) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZSubscriptionUserAccessAdmin, Data: subscriptionUserAccessAdmins, + })); !ok { + return } log.V(1).Info("finished listing subscription user access admins", "subscriptionId", roleAssignments.SubscriptionId, "count", count) } diff --git a/cmd/list-subscriptions.go b/cmd/list-subscriptions.go index b27fa7f..1a14283 100644 --- a/cmd/list-subscriptions.go +++ b/cmd/list-subscriptions.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/models" "github.com/bloodhoundad/azurehound/v2/models/azure" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/config" @@ -96,9 +97,11 @@ func listSubscriptions(ctx context.Context, client client.AzureClient) <-chan in Subscription: item.Ok, } data.TenantId = client.TenantInfo().TenantId - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZSubscription, Data: data, + })); !ok { + return } } } diff --git a/cmd/list-tenants.go b/cmd/list-tenants.go index 128a8e8..c969660 100644 --- a/cmd/list-tenants.go +++ b/cmd/list-tenants.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" ) @@ -62,12 +63,14 @@ func listTenants(ctx context.Context, client client.AzureClient) <-chan interfac // Send the fully hydrated tenant that is being collected collectedTenant := client.TenantInfo() - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZTenant, Data: models.Tenant{ Tenant: collectedTenant, Collected: true, }, + })); !ok { + return } count := 1 for item := range client.ListAzureADTenants(ctx, true) { @@ -80,11 +83,13 @@ func listTenants(ctx context.Context, client client.AzureClient) <-chan interfac // Send the remaining tenant trusts if item.Ok.TenantId != collectedTenant.TenantId { - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZTenant, Data: models.Tenant{ Tenant: item.Ok, }, + })); !ok { + return } } } diff --git a/cmd/list-users.go b/cmd/list-users.go index 7a71eca..6ec8314 100644 --- a/cmd/list-users.go +++ b/cmd/list-users.go @@ -26,6 +26,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" + "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" ) @@ -84,9 +85,11 @@ func listUsers(ctx context.Context, client client.AzureClient) <-chan interface{ TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZUser, Data: user, + })); !ok { + return } } } diff --git a/cmd/list-virtual-machine-role-assignments.go b/cmd/list-virtual-machine-role-assignments.go index 18346e7..d826a3f 100644 --- a/cmd/list-virtual-machine-role-assignments.go +++ b/cmd/list-virtual-machine-role-assignments.go @@ -74,7 +74,9 @@ func listVirtualMachineRoleAssignments(ctx context.Context, client client.AzureC log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating virtual machine role assignments", "result", result) return } else { - ids <- virtualMachine.Id + if ok := pipeline.Send(ctx.Done(), ids, virtualMachine.Id); !ok { + return + } } } }() @@ -104,7 +106,9 @@ func listVirtualMachineRoleAssignments(ctx context.Context, client client.AzureC virtualMachineRoleAssignments.RoleAssignments = append(virtualMachineRoleAssignments.RoleAssignments, virtualMachineRoleAssignment) } } - out <- NewAzureWrapper(enums.KindAZVMRoleAssignment, virtualMachineRoleAssignments) + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMRoleAssignment, virtualMachineRoleAssignments)); !ok { + return + } log.V(1).Info("finished listing virtual machine role assignments", "virtualMachineId", id, "count", count) } }() diff --git a/cmd/list-virtual-machines.go b/cmd/list-virtual-machines.go index 3f1597a..c812e32 100644 --- a/cmd/list-virtual-machines.go +++ b/cmd/list-virtual-machines.go @@ -72,7 +72,9 @@ func listVirtualMachines(ctx context.Context, client client.AzureClient, subscri log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating virtual machines", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -97,9 +99,11 @@ func listVirtualMachines(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found virtual machine", "virtualMachine", virtualMachine) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZVM, Data: virtualMachine, + })); !ok { + return } } } diff --git a/cmd/list-vm-scale-set-role-assignments.go b/cmd/list-vm-scale-set-role-assignments.go index de6f3de..bdc0c4e 100644 --- a/cmd/list-vm-scale-set-role-assignments.go +++ b/cmd/list-vm-scale-set-role-assignments.go @@ -80,7 +80,9 @@ func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClien log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating vm scale set role assignments", "result", result) return } else { - ids <- vmScaleSet.Id + if ok := pipeline.Send(ctx.Done(), ids, vmScaleSet.Id); !ok { + return + } } } }() @@ -113,9 +115,11 @@ func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClien vmScaleSetRoleAssignments.RoleAssignments = append(vmScaleSetRoleAssignments.RoleAssignments, vmScaleSetRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZVMScaleSetRoleAssignment, Data: vmScaleSetRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing vm scale set role assignments", "vmScaleSetId", id, "count", count) } diff --git a/cmd/list-vm-scale-sets.go b/cmd/list-vm-scale-sets.go index 8ddac92..68690fc 100644 --- a/cmd/list-vm-scale-sets.go +++ b/cmd/list-vm-scale-sets.go @@ -77,7 +77,9 @@ func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptio log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating virtual machine scale sets", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -102,9 +104,11 @@ func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptio } log.V(2).Info("found virtual machine scale set", "vmScaleSet", vmScaleSet) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZVMScaleSet, Data: vmScaleSet, + })); !ok { + return } } } diff --git a/cmd/list-web-app-role-assignments.go b/cmd/list-web-app-role-assignments.go index c47d96e..74b78cf 100644 --- a/cmd/list-web-app-role-assignments.go +++ b/cmd/list-web-app-role-assignments.go @@ -80,7 +80,9 @@ func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, w log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating web app role assignments", "result", result) return } else { - ids <- webApp.Id + if ok := pipeline.Send(ctx.Done(), ids, webApp.Id); !ok { + return + } } } }() @@ -113,9 +115,11 @@ func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, w webAppRoleAssignments.RoleAssignments = append(webAppRoleAssignments.RoleAssignments, webAppRoleAssignment) } } - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZWebAppRoleAssignment, Data: webAppRoleAssignments, + })); !ok { + return } log.V(1).Info("finished listing web app role assignments", "webAppId", id, "count", count) } diff --git a/cmd/list-web-apps.go b/cmd/list-web-apps.go index 23152eb..56bb9be 100644 --- a/cmd/list-web-apps.go +++ b/cmd/list-web-apps.go @@ -77,7 +77,9 @@ func listWebApps(ctx context.Context, client client.AzureClient, subscriptions < log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating web apps", "result", result) return } else { - ids <- subscription.SubscriptionId + if ok := pipeline.Send(ctx.Done(), ids, subscription.SubscriptionId); !ok { + return + } } } }() @@ -103,9 +105,11 @@ func listWebApps(ctx context.Context, client client.AzureClient, subscriptions < if webApp.Kind == "app" { log.V(2).Info("found web app", "webApp", webApp) count++ - out <- AzureWrapper{ + if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ Kind: enums.KindAZWebApp, Data: webApp, + })); !ok { + return } } } From 8b0505f52ac34db8330a2657efd3a27039577ea6 Mon Sep 17 00:00:00 2001 From: Irshad Ahmed Date: Mon, 30 Oct 2023 15:02:46 -0500 Subject: [PATCH 5/9] last few changes to use pipeline.Send() --- pipeline/pipeline.go | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index 92708d2..b6a7549 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -86,7 +86,9 @@ func Mux[D any](done <-chan D, channels ...<-chan any) <-chan any { muxer := func(channel <-chan any) { defer wg.Done() for item := range OrDone(done, channel) { - out <- item + if ok := Send(done, out, item); !ok { + return + } } } @@ -149,7 +151,9 @@ func Map[D, T, U any](done <-chan D, in <-chan T, fn func(T) U) <-chan U { go func() { defer close(out) for item := range OrDone(done, in) { - out <- fn(item) + if ok := Send(done, out, fn(item)); !ok { + return + } } }() return out @@ -161,7 +165,9 @@ func Filter[D, T any](done <-chan D, in <-chan T, fn func(T) bool) <-chan T { defer close(out) for item := range OrDone(done, in) { if fn(item) { - out <- item + if ok := Send(done, out, item); !ok { + return + } } } }() @@ -215,7 +221,9 @@ func Batch[D, T any](done <-chan D, in <-chan T, maxItems int, maxTimeout time.D case item, ok := <-in: if !ok { if len(batch) > 0 { - out <- batch + if ok = Send(done, out, batch); !ok { + return + } batch = nil } return @@ -225,14 +233,18 @@ func Batch[D, T any](done <-chan D, in <-chan T, maxItems int, maxTimeout time.D // Flush if limit is reached if len(batch) >= maxItems { - out <- batch + if ok = Send(done, out, batch); !ok { + return + } batch = nil timeout = time.After(maxTimeout) } } case <-timeout: if len(batch) > 0 { - out <- batch + if ok := Send(done, out, batch); !ok { + return + } batch = nil } timeout = time.After(maxTimeout) @@ -253,7 +265,9 @@ func FormatJson[D, T any](done <-chan D, in <-chan T) <-chan string { if bytes, err := json.Marshal(item); err != nil { panic(err) } else { - out <- string(bytes) + if ok := Send(done, out, string(bytes)); !ok { + return + } } } }() From 9e92fed014a3e9d4c7c44efce0ad15ae0b38d385 Mon Sep 17 00:00:00 2001 From: irshadaj Date: Thu, 2 Nov 2023 10:57:11 -0500 Subject: [PATCH 6/9] pipeline.Send() without interface conversions and removing deprecated struct usage --- cmd/list-app-role-assignments.go | 9 ++++----- ...ist-automation-account-role-assignments.go | 5 +---- cmd/list-automation-accounts.go | 5 +---- cmd/list-container-registries.go | 5 +---- ...ist-container-registry-role-assignments.go | 5 +---- cmd/list-device-owners.go | 5 +---- cmd/list-devices.go | 9 ++++----- cmd/list-function-app-role-assignments.go | 5 +---- cmd/list-function-apps.go | 5 +---- cmd/list-group-members.go | 5 +---- cmd/list-group-owners.go | 5 +---- cmd/list-groups.go | 5 +---- cmd/list-key-vault-access-policies.go | 19 ++++++++----------- cmd/list-key-vaults.go | 5 +---- cmd/list-logic-app-role-assignments.go | 5 +---- cmd/list-logic-apps.go | 5 +---- cmd/list-managed-cluster-role-assignments.go | 5 +---- cmd/list-managed-clusters.go | 5 +---- cmd/list-management-group-descendants.go | 5 +---- cmd/list-management-groups.go | 5 +---- cmd/list-resource-groups.go | 5 +---- cmd/list-role-assignments.go | 5 +---- cmd/list-roles.go | 9 ++++----- cmd/list-service-principal-owners.go | 5 +---- cmd/list-service-principals.go | 9 ++++----- cmd/list-storage-account-role-assignments.go | 5 +---- cmd/list-storage-accounts.go | 5 +---- cmd/list-storage-containers.go | 7 ++----- cmd/list-subscription-owners.go | 5 +---- cmd/list-subscription-role-assignments.go | 5 +---- cmd/list-subscription-user-access-admins.go | 5 +---- cmd/list-subscriptions.go | 5 +---- cmd/list-tenants.go | 18 ++++++++---------- cmd/list-users.go | 5 +---- cmd/list-virtual-machines.go | 5 +---- cmd/list-vm-scale-set-role-assignments.go | 5 +---- cmd/list-vm-scale-sets.go | 5 +---- cmd/list-web-app-role-assignments.go | 5 +---- cmd/list-web-apps.go | 5 +---- pipeline/pipeline.go | 10 ---------- 40 files changed, 66 insertions(+), 184 deletions(-) diff --git a/cmd/list-app-role-assignments.go b/cmd/list-app-role-assignments.go index 9815d9b..785f85f 100644 --- a/cmd/list-app-role-assignments.go +++ b/cmd/list-app-role-assignments.go @@ -98,14 +98,13 @@ func listAppRoleAssignments(ctx context.Context, client client.AzureClient, serv } else { log.V(2).Info("found app role assignment", "roleAssignments", item) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZAppRoleAssignment, - Data: models.AppRoleAssignment{ + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + enums.KindAZAppRoleAssignment, + models.AppRoleAssignment{ AppRoleAssignment: item.Ok, AppId: servicePrincipal.AppId, TenantId: client.TenantInfo().TenantId, - }, - })); !ok { + })); !ok { return } } diff --git a/cmd/list-automation-account-role-assignments.go b/cmd/list-automation-account-role-assignments.go index 5866e0a..206df7a 100644 --- a/cmd/list-automation-account-role-assignments.go +++ b/cmd/list-automation-account-role-assignments.go @@ -110,10 +110,7 @@ func listAutomationAccountRoleAssignments(ctx context.Context, client client.Azu automationAccountRoleAssignments.RoleAssignments = append(automationAccountRoleAssignments.RoleAssignments, automationAccountRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZAutomationAccountRoleAssignment, - Data: automationAccountRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZAutomationAccountRoleAssignment, automationAccountRoleAssignments)); !ok { return } log.V(1).Info("finished listing automation account role assignments", "automationAccountId", id, "count", count) diff --git a/cmd/list-automation-accounts.go b/cmd/list-automation-accounts.go index b6cf0c1..837937d 100644 --- a/cmd/list-automation-accounts.go +++ b/cmd/list-automation-accounts.go @@ -99,10 +99,7 @@ func listAutomationAccounts(ctx context.Context, client client.AzureClient, subs } log.V(2).Info("found automation account", "automationAccount", automationAccount) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZAutomationAccount, - Data: automationAccount, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZAutomationAccount, automationAccount)); !ok { return } } diff --git a/cmd/list-container-registries.go b/cmd/list-container-registries.go index a57dacd..d1ad803 100644 --- a/cmd/list-container-registries.go +++ b/cmd/list-container-registries.go @@ -104,10 +104,7 @@ func listContainerRegistries(ctx context.Context, client client.AzureClient, sub } log.V(2).Info("found container registry", "containerRegistry", containerRegistry) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZContainerRegistry, - Data: containerRegistry, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZContainerRegistry, containerRegistry)); !ok { return } } diff --git a/cmd/list-container-registry-role-assignments.go b/cmd/list-container-registry-role-assignments.go index a601986..a49ba16 100644 --- a/cmd/list-container-registry-role-assignments.go +++ b/cmd/list-container-registry-role-assignments.go @@ -115,10 +115,7 @@ func listContainerRegistryRoleAssignments(ctx context.Context, client client.Azu containerRegistryRoleAssignments.RoleAssignments = append(containerRegistryRoleAssignments.RoleAssignments, containerRegistryRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZContainerRegistryRoleAssignment, - Data: containerRegistryRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZContainerRegistryRoleAssignment, containerRegistryRoleAssignments)); !ok { return } log.V(1).Info("finished listing container registry role assignments", "containerRegistryId", id, "count", count) diff --git a/cmd/list-device-owners.go b/cmd/list-device-owners.go index 86e1e71..29637ef 100644 --- a/cmd/list-device-owners.go +++ b/cmd/list-device-owners.go @@ -104,10 +104,7 @@ func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <- data.Owners = append(data.Owners, deviceOwner) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZDeviceOwner, - Data: data, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZDeviceOwner, data)); !ok { return } log.V(1).Info("finished listing device owners", "deviceId", id, "count", count) diff --git a/cmd/list-devices.go b/cmd/list-devices.go index 71acad6..afdbf27 100644 --- a/cmd/list-devices.go +++ b/cmd/list-devices.go @@ -68,14 +68,13 @@ func listDevices(ctx context.Context, client client.AzureClient) <-chan interfac } else { log.V(2).Info("found device", "device", item) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZDevice, - Data: models.Device{ + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + enums.KindAZDevice, + models.Device{ Device: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, - }, - })); !ok { + })); !ok { return } } diff --git a/cmd/list-function-app-role-assignments.go b/cmd/list-function-app-role-assignments.go index fdc0323..23b3f9f 100644 --- a/cmd/list-function-app-role-assignments.go +++ b/cmd/list-function-app-role-assignments.go @@ -110,10 +110,7 @@ func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClie functionAppRoleAssignments.RoleAssignments = append(functionAppRoleAssignments.RoleAssignments, functionAppRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZFunctionAppRoleAssignment, - Data: functionAppRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZFunctionAppRoleAssignment, functionAppRoleAssignments)); !ok { return } log.V(1).Info("finished listing function app role assignments", "functionAppId", id, "count", count) diff --git a/cmd/list-function-apps.go b/cmd/list-function-apps.go index ec4a013..0bc975a 100644 --- a/cmd/list-function-apps.go +++ b/cmd/list-function-apps.go @@ -100,10 +100,7 @@ func listFunctionApps(ctx context.Context, client client.AzureClient, subscripti if functionApp.Kind == "functionapp" { log.V(2).Info("found function app", "functionApp", functionApp) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZFunctionApp, - Data: functionApp, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZFunctionApp, functionApp)); !ok { return } } diff --git a/cmd/list-group-members.go b/cmd/list-group-members.go index ef53857..0313651 100644 --- a/cmd/list-group-members.go +++ b/cmd/list-group-members.go @@ -105,10 +105,7 @@ func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-c data.Members = append(data.Members, groupMember) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZGroupMember, - Data: data, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroupMember, data)); !ok { return } log.V(1).Info("finished listing group memberships", "groupId", id, "count", count) diff --git a/cmd/list-group-owners.go b/cmd/list-group-owners.go index 8974abd..ca1dde5 100644 --- a/cmd/list-group-owners.go +++ b/cmd/list-group-owners.go @@ -105,10 +105,7 @@ func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-ch groupOwners.Owners = append(groupOwners.Owners, groupOwner) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZGroupOwner, - Data: groupOwners, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroupOwner, groupOwners)); !ok { return } log.V(1).Info("finished listing group owners", "groupId", id, "count", count) diff --git a/cmd/list-groups.go b/cmd/list-groups.go index 8a7d32d..01e4558 100644 --- a/cmd/list-groups.go +++ b/cmd/list-groups.go @@ -73,10 +73,7 @@ func listGroups(ctx context.Context, client client.AzureClient) <-chan interface TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZGroup, - Data: group, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroup, group)); !ok { return } } diff --git a/cmd/list-key-vault-access-policies.go b/cmd/list-key-vault-access-policies.go index dc8cdda..db0b436 100644 --- a/cmd/list-key-vault-access-policies.go +++ b/cmd/list-key-vault-access-policies.go @@ -27,7 +27,6 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/config" "github.com/bloodhoundad/azurehound/v2/enums" - kinds "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" @@ -80,13 +79,12 @@ func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, } else { for _, policy := range keyVault.Properties.AccessPolicies { if len(filters) == 0 { - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: kinds.KindAZKeyVaultAccessPolicy, - Data: models.KeyVaultAccessPolicy{ + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + enums.KindAZKeyVaultAccessPolicy, + models.KeyVaultAccessPolicy{ KeyVaultId: keyVault.Id, AccessPolicyEntry: policy, - }, - })); !ok { + })); !ok { return } } else { @@ -105,13 +103,12 @@ func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, } }() if contains(permissions, "Get") { - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: kinds.KindAZKeyVaultAccessPolicy, - Data: models.KeyVaultAccessPolicy{ + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + enums.KindAZKeyVaultAccessPolicy, + models.KeyVaultAccessPolicy{ KeyVaultId: keyVault.Id, AccessPolicyEntry: policy, - }, - })); !ok { + })); !ok { return } break diff --git a/cmd/list-key-vaults.go b/cmd/list-key-vaults.go index 1440844..375304f 100644 --- a/cmd/list-key-vaults.go +++ b/cmd/list-key-vaults.go @@ -102,10 +102,7 @@ func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions } log.V(2).Info("found key vault", "keyVault", keyVault) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZKeyVault, - Data: keyVault, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZKeyVault, keyVault)); !ok { return } } diff --git a/cmd/list-logic-app-role-assignments.go b/cmd/list-logic-app-role-assignments.go index 1b6b861..c025c2e 100644 --- a/cmd/list-logic-app-role-assignments.go +++ b/cmd/list-logic-app-role-assignments.go @@ -115,10 +115,7 @@ func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, logicappRoleAssignments.RoleAssignments = append(logicappRoleAssignments.RoleAssignments, logicappRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZLogicAppRoleAssignment, - Data: logicappRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZLogicAppRoleAssignment, logicappRoleAssignments)); !ok { return } log.V(1).Info("finished listing logic app role assignments", "logicappId", id, "count", count) diff --git a/cmd/list-logic-apps.go b/cmd/list-logic-apps.go index 46877ab..ab405ab 100644 --- a/cmd/list-logic-apps.go +++ b/cmd/list-logic-apps.go @@ -109,10 +109,7 @@ func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions } log.V(2).Info("found logicapp", "logicapp", logicapp) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZLogicApp, - Data: logicapp, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZLogicApp, logicapp)); !ok { return } } diff --git a/cmd/list-managed-cluster-role-assignments.go b/cmd/list-managed-cluster-role-assignments.go index feb2f1e..df70531 100644 --- a/cmd/list-managed-cluster-role-assignments.go +++ b/cmd/list-managed-cluster-role-assignments.go @@ -115,10 +115,7 @@ func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureC managedClusterRoleAssignments.RoleAssignments = append(managedClusterRoleAssignments.RoleAssignments, managedClusterRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZManagedClusterRoleAssignment, - Data: managedClusterRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagedClusterRoleAssignment, managedClusterRoleAssignments)); !ok { return } log.V(1).Info("finished listing managed cluster role assignments", "managedClusterId", id, "count", count) diff --git a/cmd/list-managed-clusters.go b/cmd/list-managed-clusters.go index db21930..e588040 100644 --- a/cmd/list-managed-clusters.go +++ b/cmd/list-managed-clusters.go @@ -104,10 +104,7 @@ func listManagedClusters(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found managed cluster", "managedCluster", managedCluster) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZManagedCluster, - Data: managedCluster, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagedCluster, managedCluster)); !ok { return } } diff --git a/cmd/list-management-group-descendants.go b/cmd/list-management-group-descendants.go index 2330857..658a29e 100644 --- a/cmd/list-management-group-descendants.go +++ b/cmd/list-management-group-descendants.go @@ -93,10 +93,7 @@ func listManagementGroupDescendants(ctx context.Context, client client.AzureClie } else { log.V(2).Info("found management group descendant", "type", item.Ok.Type, "id", item.Ok.Id, "parent", item.Ok.Properties.Parent.Id) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZManagementGroupDescendant, - Data: item.Ok, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagementGroupDescendant, item.Ok)); !ok { return } } diff --git a/cmd/list-management-groups.go b/cmd/list-management-groups.go index 6a4d89a..0580ca5 100644 --- a/cmd/list-management-groups.go +++ b/cmd/list-management-groups.go @@ -75,10 +75,7 @@ func listManagementGroups(ctx context.Context, client client.AzureClient) <-chan TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZManagementGroup, - Data: mgmtGroup, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagementGroup, mgmtGroup)); !ok { return } } diff --git a/cmd/list-resource-groups.go b/cmd/list-resource-groups.go index 84737fb..29d731c 100644 --- a/cmd/list-resource-groups.go +++ b/cmd/list-resource-groups.go @@ -98,10 +98,7 @@ func listResourceGroups(ctx context.Context, client client.AzureClient, subscrip } log.V(2).Info("found resource group", "resourceGroup", resourceGroup) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZResourceGroup, - Data: resourceGroup, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZResourceGroup, resourceGroup)); !ok { return } } diff --git a/cmd/list-role-assignments.go b/cmd/list-role-assignments.go index cd0ac6e..8ee87fb 100644 --- a/cmd/list-role-assignments.go +++ b/cmd/list-role-assignments.go @@ -104,10 +104,7 @@ func listRoleAssignments(ctx context.Context, client client.AzureClient, roles < roleAssignments.RoleAssignments = append(roleAssignments.RoleAssignments, item.Ok) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZRoleAssignment, - Data: roleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZRoleAssignment, roleAssignments)); !ok { return } log.V(1).Info("finished listing role assignments", "roleDefinitionId", id, "count", count) diff --git a/cmd/list-roles.go b/cmd/list-roles.go index b3eddc1..1ea7e01 100644 --- a/cmd/list-roles.go +++ b/cmd/list-roles.go @@ -68,14 +68,13 @@ func listRoles(ctx context.Context, client client.AzureClient) <-chan interface{ } else { log.V(2).Info("found role", "role", item) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZRole, - Data: models.Role{ + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + enums.KindAZRole, + models.Role{ Role: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, - }, - })); !ok { + })); !ok { return } } diff --git a/cmd/list-service-principal-owners.go b/cmd/list-service-principal-owners.go index acb47a6..656bbf0 100644 --- a/cmd/list-service-principal-owners.go +++ b/cmd/list-service-principal-owners.go @@ -105,10 +105,7 @@ func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, servicePrincipalOwners.Owners = append(servicePrincipalOwners.Owners, servicePrincipalOwner) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZServicePrincipalOwner, - Data: servicePrincipalOwners, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZServicePrincipalOwner, servicePrincipalOwners)); !ok { return } log.V(1).Info("finished listing service principal owners", "servicePrincipalId", id, "count", count) diff --git a/cmd/list-service-principals.go b/cmd/list-service-principals.go index 8dade1c..2d53e1e 100644 --- a/cmd/list-service-principals.go +++ b/cmd/list-service-principals.go @@ -68,14 +68,13 @@ func listServicePrincipals(ctx context.Context, client client.AzureClient) <-cha } else { log.V(2).Info("found service principal", "servicePrincipal", item) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZServicePrincipal, - Data: models.ServicePrincipal{ + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + enums.KindAZServicePrincipal, + models.ServicePrincipal{ ServicePrincipal: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, - }, - })); !ok { + })); !ok { return } } diff --git a/cmd/list-storage-account-role-assignments.go b/cmd/list-storage-account-role-assignments.go index 1b1298e..ae0acbf 100644 --- a/cmd/list-storage-account-role-assignments.go +++ b/cmd/list-storage-account-role-assignments.go @@ -110,10 +110,7 @@ func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureC storageAccountRoleAssignments.RoleAssignments = append(storageAccountRoleAssignments.RoleAssignments, storageAccountRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZStorageAccountRoleAssignment, - Data: storageAccountRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageAccountRoleAssignment, storageAccountRoleAssignments)); !ok { return } log.V(1).Info("finished listing storage account role assignments", "storageAccountId", id, "count", count) diff --git a/cmd/list-storage-accounts.go b/cmd/list-storage-accounts.go index 464322b..e082d21 100644 --- a/cmd/list-storage-accounts.go +++ b/cmd/list-storage-accounts.go @@ -101,10 +101,7 @@ func listStorageAccounts(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found storage account", "storageAccount", storageAccount) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZStorageAccount, - Data: storageAccount, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageAccount, storageAccount)); !ok { return } } diff --git a/cmd/list-storage-containers.go b/cmd/list-storage-containers.go index ffbb01b..a59593f 100644 --- a/cmd/list-storage-containers.go +++ b/cmd/list-storage-containers.go @@ -79,7 +79,7 @@ func listStorageContainers(ctx context.Context, client client.AzureClient, stora log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating storage containers", "result", result) return } else { - if ok := pipeline.Send(ctx.Done(), ids, interface{}(storageAccount)); !ok { + if ok := pipeline.Send(ctx.Done(), ids, storageAccount); !ok { return } } @@ -109,10 +109,7 @@ func listStorageContainers(ctx context.Context, client client.AzureClient, stora } log.V(2).Info("found storage container", "storageContainer", storageContainer) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZStorageContainer, - Data: storageContainer, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageContainer, storageContainer)); !ok { return } } diff --git a/cmd/list-subscription-owners.go b/cmd/list-subscription-owners.go index 207c583..1bd27c2 100644 --- a/cmd/list-subscription-owners.go +++ b/cmd/list-subscription-owners.go @@ -90,10 +90,7 @@ func listSubscriptionOwners(ctx context.Context, client client.AzureClient, role subscriptionOwners.Owners = append(subscriptionOwners.Owners, subscriptionOwner) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZSubscriptionOwner, - Data: subscriptionOwners, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionOwner, subscriptionOwners)); !ok { return } log.V(1).Info("finished listing subscription owners", "subscriptionId", roleAssignments.SubscriptionId, "count", count) diff --git a/cmd/list-subscription-role-assignments.go b/cmd/list-subscription-role-assignments.go index 18e27f2..4374d0f 100644 --- a/cmd/list-subscription-role-assignments.go +++ b/cmd/list-subscription-role-assignments.go @@ -106,10 +106,7 @@ func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureCli subscriptionRoleAssignments.RoleAssignments = append(subscriptionRoleAssignments.RoleAssignments, subscriptionRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZSubscriptionRoleAssignment, - Data: subscriptionRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionRoleAssignment, subscriptionRoleAssignments)); !ok { return } log.V(1).Info("finished listing subscription role assignments", "subscriptionId", id, "count", count) diff --git a/cmd/list-subscription-user-access-admins.go b/cmd/list-subscription-user-access-admins.go index 3d81ca7..c5cfc40 100644 --- a/cmd/list-subscription-user-access-admins.go +++ b/cmd/list-subscription-user-access-admins.go @@ -90,10 +90,7 @@ func listSubscriptionUserAccessAdmins(ctx context.Context, client client.AzureCl subscriptionUserAccessAdmins.UserAccessAdmins = append(subscriptionUserAccessAdmins.UserAccessAdmins, subscriptionUserAccessAdmin) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZSubscriptionUserAccessAdmin, - Data: subscriptionUserAccessAdmins, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionUserAccessAdmin, subscriptionUserAccessAdmins)); !ok { return } log.V(1).Info("finished listing subscription user access admins", "subscriptionId", roleAssignments.SubscriptionId, "count", count) diff --git a/cmd/list-subscriptions.go b/cmd/list-subscriptions.go index 1a14283..2ce8d50 100644 --- a/cmd/list-subscriptions.go +++ b/cmd/list-subscriptions.go @@ -97,10 +97,7 @@ func listSubscriptions(ctx context.Context, client client.AzureClient) <-chan in Subscription: item.Ok, } data.TenantId = client.TenantInfo().TenantId - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZSubscription, - Data: data, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscription, data)); !ok { return } } diff --git a/cmd/list-tenants.go b/cmd/list-tenants.go index c969660..bdb715d 100644 --- a/cmd/list-tenants.go +++ b/cmd/list-tenants.go @@ -63,13 +63,12 @@ func listTenants(ctx context.Context, client client.AzureClient) <-chan interfac // Send the fully hydrated tenant that is being collected collectedTenant := client.TenantInfo() - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZTenant, - Data: models.Tenant{ + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + enums.KindAZTenant, + models.Tenant{ Tenant: collectedTenant, Collected: true, - }, - })); !ok { + })); !ok { return } count := 1 @@ -83,12 +82,11 @@ func listTenants(ctx context.Context, client client.AzureClient) <-chan interfac // Send the remaining tenant trusts if item.Ok.TenantId != collectedTenant.TenantId { - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZTenant, - Data: models.Tenant{ + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + enums.KindAZTenant, + models.Tenant{ Tenant: item.Ok, - }, - })); !ok { + })); !ok { return } } diff --git a/cmd/list-users.go b/cmd/list-users.go index 6ec8314..6226f3b 100644 --- a/cmd/list-users.go +++ b/cmd/list-users.go @@ -85,10 +85,7 @@ func listUsers(ctx context.Context, client client.AzureClient) <-chan interface{ TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZUser, - Data: user, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZUser, user)); !ok { return } } diff --git a/cmd/list-virtual-machines.go b/cmd/list-virtual-machines.go index c812e32..9b6d211 100644 --- a/cmd/list-virtual-machines.go +++ b/cmd/list-virtual-machines.go @@ -99,10 +99,7 @@ func listVirtualMachines(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found virtual machine", "virtualMachine", virtualMachine) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZVM, - Data: virtualMachine, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZVM, virtualMachine)); !ok { return } } diff --git a/cmd/list-vm-scale-set-role-assignments.go b/cmd/list-vm-scale-set-role-assignments.go index bdc0c4e..39c4054 100644 --- a/cmd/list-vm-scale-set-role-assignments.go +++ b/cmd/list-vm-scale-set-role-assignments.go @@ -115,10 +115,7 @@ func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClien vmScaleSetRoleAssignments.RoleAssignments = append(vmScaleSetRoleAssignments.RoleAssignments, vmScaleSetRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZVMScaleSetRoleAssignment, - Data: vmScaleSetRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMScaleSetRoleAssignment, vmScaleSetRoleAssignments)); !ok { return } log.V(1).Info("finished listing vm scale set role assignments", "vmScaleSetId", id, "count", count) diff --git a/cmd/list-vm-scale-sets.go b/cmd/list-vm-scale-sets.go index 68690fc..70965c5 100644 --- a/cmd/list-vm-scale-sets.go +++ b/cmd/list-vm-scale-sets.go @@ -104,10 +104,7 @@ func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptio } log.V(2).Info("found virtual machine scale set", "vmScaleSet", vmScaleSet) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZVMScaleSet, - Data: vmScaleSet, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMScaleSet, vmScaleSet)); !ok { return } } diff --git a/cmd/list-web-app-role-assignments.go b/cmd/list-web-app-role-assignments.go index 74b78cf..16f97ea 100644 --- a/cmd/list-web-app-role-assignments.go +++ b/cmd/list-web-app-role-assignments.go @@ -115,10 +115,7 @@ func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, w webAppRoleAssignments.RoleAssignments = append(webAppRoleAssignments.RoleAssignments, webAppRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZWebAppRoleAssignment, - Data: webAppRoleAssignments, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZWebAppRoleAssignment, webAppRoleAssignments)); !ok { return } log.V(1).Info("finished listing web app role assignments", "webAppId", id, "count", count) diff --git a/cmd/list-web-apps.go b/cmd/list-web-apps.go index 56bb9be..6136c86 100644 --- a/cmd/list-web-apps.go +++ b/cmd/list-web-apps.go @@ -105,10 +105,7 @@ func listWebApps(ctx context.Context, client client.AzureClient, subscriptions < if webApp.Kind == "app" { log.V(2).Info("found web app", "webApp", webApp) count++ - if ok := pipeline.Send(ctx.Done(), out, interface{}(AzureWrapper{ - Kind: enums.KindAZWebApp, - Data: webApp, - })); !ok { + if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZWebApp, webApp)); !ok { return } } diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index b6a7549..1da50b2 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -41,16 +41,6 @@ func Send[D, T any](done <-chan D, tgt chan<- T, val T) bool { } } -// Recv receives a value from a channel while monitoring the done channel for cancellation -func Recv[D, T any](done <-chan D, src <-chan T) (T, bool) { - select { - case val, ok := <-src: - return val, ok - case <-done: - return *new(T), false - } -} - // OrDone provides an explicit cancellation mechanism to ensure the encapsulated and downstream goroutines are cleaned // up. This frees the caller from depending on the input channel to close in order to free the goroutine, thus // preventing possible leaks. From 3b1b68bb4c68bd275aa02c17b7bf88244fdfca6a Mon Sep 17 00:00:00 2001 From: Alyx Holms Date: Mon, 6 Nov 2023 16:25:29 -0700 Subject: [PATCH 7/9] fix: broken types by adding a new SendAny function chore: update interface{} to any in affected files --- cmd/list-app-role-assignments.go | 6 +++--- cmd/list-automation-account-role-assignments.go | 6 +++--- cmd/list-automation-accounts.go | 6 +++--- cmd/list-container-registries.go | 6 +++--- cmd/list-container-registry-role-assignments.go | 6 +++--- cmd/list-device-owners.go | 6 +++--- cmd/list-devices.go | 6 +++--- cmd/list-function-app-role-assignments.go | 6 +++--- cmd/list-function-apps.go | 6 +++--- cmd/list-group-members.go | 6 +++--- cmd/list-group-owners.go | 6 +++--- cmd/list-groups.go | 6 +++--- cmd/list-key-vault-access-policies.go | 8 ++++---- cmd/list-key-vaults.go | 6 +++--- cmd/list-logic-app-role-assignments.go | 6 +++--- cmd/list-logic-apps.go | 6 +++--- cmd/list-managed-cluster-role-assignments.go | 6 +++--- cmd/list-managed-clusters.go | 6 +++--- cmd/list-management-group-descendants.go | 6 +++--- cmd/list-management-groups.go | 6 +++--- cmd/list-resource-groups.go | 6 +++--- cmd/list-role-assignments.go | 6 +++--- cmd/list-roles.go | 6 +++--- cmd/list-service-principal-owners.go | 6 +++--- cmd/list-service-principals.go | 6 +++--- cmd/list-storage-account-role-assignments.go | 6 +++--- cmd/list-storage-accounts.go | 6 +++--- cmd/list-storage-containers.go | 10 +++++----- cmd/list-subscription-owners.go | 6 +++--- cmd/list-subscription-role-assignments.go | 6 +++--- cmd/list-subscription-user-access-admins.go | 6 +++--- cmd/list-subscriptions.go | 6 +++--- cmd/list-tenants.go | 8 ++++---- cmd/list-users.go | 6 +++--- cmd/list-virtual-machines.go | 6 +++--- cmd/list-vm-scale-set-role-assignments.go | 6 +++--- cmd/list-vm-scale-sets.go | 6 +++--- cmd/list-web-app-role-assignments.go | 6 +++--- cmd/list-web-apps.go | 6 +++--- pipeline/pipeline.go | 12 +++++++++++- 40 files changed, 132 insertions(+), 122 deletions(-) diff --git a/cmd/list-app-role-assignments.go b/cmd/list-app-role-assignments.go index 785f85f..6da8575 100644 --- a/cmd/list-app-role-assignments.go +++ b/cmd/list-app-role-assignments.go @@ -58,9 +58,9 @@ func listAppRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAppRoleAssignments(ctx context.Context, client client.AzureClient, servicePrincipals <-chan interface{}) <-chan interface{} { +func listAppRoleAssignments(ctx context.Context, client client.AzureClient, servicePrincipals <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) filteredSPs = make(chan models.ServicePrincipal) streams = pipeline.Demux(ctx.Done(), filteredSPs, 25) wg sync.WaitGroup @@ -98,7 +98,7 @@ func listAppRoleAssignments(ctx context.Context, client client.AzureClient, serv } else { log.V(2).Info("found app role assignment", "roleAssignments", item) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( enums.KindAZAppRoleAssignment, models.AppRoleAssignment{ AppRoleAssignment: item.Ok, diff --git a/cmd/list-automation-account-role-assignments.go b/cmd/list-automation-account-role-assignments.go index 206df7a..65233fc 100644 --- a/cmd/list-automation-account-role-assignments.go +++ b/cmd/list-automation-account-role-assignments.go @@ -59,9 +59,9 @@ func listAutomationAccountRoleAssignmentImpl(cmd *cobra.Command, args []string) log.Info("collection completed", "duration", duration.String()) } -func listAutomationAccountRoleAssignments(ctx context.Context, client client.AzureClient, automationAccounts <-chan interface{}) <-chan interface{} { +func listAutomationAccountRoleAssignments(ctx context.Context, client client.AzureClient, automationAccounts <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -110,7 +110,7 @@ func listAutomationAccountRoleAssignments(ctx context.Context, client client.Azu automationAccountRoleAssignments.RoleAssignments = append(automationAccountRoleAssignments.RoleAssignments, automationAccountRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZAutomationAccountRoleAssignment, automationAccountRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZAutomationAccountRoleAssignment, automationAccountRoleAssignments)); !ok { return } log.V(1).Info("finished listing automation account role assignments", "automationAccountId", id, "count", count) diff --git a/cmd/list-automation-accounts.go b/cmd/list-automation-accounts.go index 837937d..2c74490 100644 --- a/cmd/list-automation-accounts.go +++ b/cmd/list-automation-accounts.go @@ -57,9 +57,9 @@ func listAutomationAccountsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAutomationAccounts(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listAutomationAccounts(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -99,7 +99,7 @@ func listAutomationAccounts(ctx context.Context, client client.AzureClient, subs } log.V(2).Info("found automation account", "automationAccount", automationAccount) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZAutomationAccount, automationAccount)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZAutomationAccount, automationAccount)); !ok { return } } diff --git a/cmd/list-container-registries.go b/cmd/list-container-registries.go index d1ad803..1d6a5f1 100644 --- a/cmd/list-container-registries.go +++ b/cmd/list-container-registries.go @@ -62,9 +62,9 @@ func listContainerRegistriesCmdImpl(cmd *cobra.Command, args []string) { } } -func listContainerRegistries(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listContainerRegistries(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,7 @@ func listContainerRegistries(ctx context.Context, client client.AzureClient, sub } log.V(2).Info("found container registry", "containerRegistry", containerRegistry) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZContainerRegistry, containerRegistry)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZContainerRegistry, containerRegistry)); !ok { return } } diff --git a/cmd/list-container-registry-role-assignments.go b/cmd/list-container-registry-role-assignments.go index a49ba16..558be19 100644 --- a/cmd/list-container-registry-role-assignments.go +++ b/cmd/list-container-registry-role-assignments.go @@ -64,9 +64,9 @@ func listContainerRegistryRoleAssignmentImpl(cmd *cobra.Command, args []string) } } -func listContainerRegistryRoleAssignments(ctx context.Context, client client.AzureClient, containerRegistries <-chan interface{}) <-chan interface{} { +func listContainerRegistryRoleAssignments(ctx context.Context, client client.AzureClient, containerRegistries <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,7 @@ func listContainerRegistryRoleAssignments(ctx context.Context, client client.Azu containerRegistryRoleAssignments.RoleAssignments = append(containerRegistryRoleAssignments.RoleAssignments, containerRegistryRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZContainerRegistryRoleAssignment, containerRegistryRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZContainerRegistryRoleAssignment, containerRegistryRoleAssignments)); !ok { return } log.V(1).Info("finished listing container registry role assignments", "containerRegistryId", id, "count", count) diff --git a/cmd/list-device-owners.go b/cmd/list-device-owners.go index 29637ef..d526901 100644 --- a/cmd/list-device-owners.go +++ b/cmd/list-device-owners.go @@ -57,9 +57,9 @@ func listDeviceOwnersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <-chan interface{}) <-chan interface{} { +func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,7 @@ func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <- data.Owners = append(data.Owners, deviceOwner) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZDeviceOwner, data)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZDeviceOwner, data)); !ok { return } log.V(1).Info("finished listing device owners", "deviceId", id, "count", count) diff --git a/cmd/list-devices.go b/cmd/list-devices.go index afdbf27..c77f9fb 100644 --- a/cmd/list-devices.go +++ b/cmd/list-devices.go @@ -55,8 +55,8 @@ func listDevicesCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listDevices(ctx context.Context, client client.AzureClient) <-chan interface{} { - out := make(chan interface{}) +func listDevices(ctx context.Context, client client.AzureClient) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -68,7 +68,7 @@ func listDevices(ctx context.Context, client client.AzureClient) <-chan interfac } else { log.V(2).Info("found device", "device", item) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( enums.KindAZDevice, models.Device{ Device: item.Ok, diff --git a/cmd/list-function-app-role-assignments.go b/cmd/list-function-app-role-assignments.go index 23b3f9f..4f47639 100644 --- a/cmd/list-function-app-role-assignments.go +++ b/cmd/list-function-app-role-assignments.go @@ -59,9 +59,9 @@ func listFunctionAppRoleAssignmentImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClient, functionApps <-chan interface{}) <-chan interface{} { +func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClient, functionApps <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -110,7 +110,7 @@ func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClie functionAppRoleAssignments.RoleAssignments = append(functionAppRoleAssignments.RoleAssignments, functionAppRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZFunctionAppRoleAssignment, functionAppRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZFunctionAppRoleAssignment, functionAppRoleAssignments)); !ok { return } log.V(1).Info("finished listing function app role assignments", "functionAppId", id, "count", count) diff --git a/cmd/list-function-apps.go b/cmd/list-function-apps.go index 0bc975a..cea1133 100644 --- a/cmd/list-function-apps.go +++ b/cmd/list-function-apps.go @@ -57,9 +57,9 @@ func listFunctionAppsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listFunctionApps(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listFunctionApps(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -100,7 +100,7 @@ func listFunctionApps(ctx context.Context, client client.AzureClient, subscripti if functionApp.Kind == "functionapp" { log.V(2).Info("found function app", "functionApp", functionApp) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZFunctionApp, functionApp)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZFunctionApp, functionApp)); !ok { return } } diff --git a/cmd/list-group-members.go b/cmd/list-group-members.go index 0313651..67b24f8 100644 --- a/cmd/list-group-members.go +++ b/cmd/list-group-members.go @@ -57,9 +57,9 @@ func listGroupMembersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-chan interface{}) <-chan interface{} { +func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -105,7 +105,7 @@ func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-c data.Members = append(data.Members, groupMember) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroupMember, data)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroupMember, data)); !ok { return } log.V(1).Info("finished listing group memberships", "groupId", id, "count", count) diff --git a/cmd/list-group-owners.go b/cmd/list-group-owners.go index ca1dde5..d319794 100644 --- a/cmd/list-group-owners.go +++ b/cmd/list-group-owners.go @@ -57,9 +57,9 @@ func listGroupOwnersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-chan interface{}) <-chan interface{} { +func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -105,7 +105,7 @@ func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-ch groupOwners.Owners = append(groupOwners.Owners, groupOwner) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroupOwner, groupOwners)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroupOwner, groupOwners)); !ok { return } log.V(1).Info("finished listing group owners", "groupId", id, "count", count) diff --git a/cmd/list-groups.go b/cmd/list-groups.go index 01e4558..1bfee7e 100644 --- a/cmd/list-groups.go +++ b/cmd/list-groups.go @@ -55,8 +55,8 @@ func listGroupsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listGroups(ctx context.Context, client client.AzureClient) <-chan interface{} { - out := make(chan interface{}) +func listGroups(ctx context.Context, client client.AzureClient) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -73,7 +73,7 @@ func listGroups(ctx context.Context, client client.AzureClient) <-chan interface TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroup, group)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroup, group)); !ok { return } } diff --git a/cmd/list-key-vault-access-policies.go b/cmd/list-key-vault-access-policies.go index db0b436..7a1c7da 100644 --- a/cmd/list-key-vault-access-policies.go +++ b/cmd/list-key-vault-access-policies.go @@ -66,8 +66,8 @@ func listKeyVaultAccessPoliciesCmdImpl(cmd *cobra.Command, args []string) { } } -func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, keyVaults <-chan interface{}, filters []enums.KeyVaultAccessType) <-chan interface{} { - out := make(chan interface{}) +func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, keyVaults <-chan any, filters []enums.KeyVaultAccessType) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -79,7 +79,7 @@ func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, } else { for _, policy := range keyVault.Properties.AccessPolicies { if len(filters) == 0 { - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( enums.KindAZKeyVaultAccessPolicy, models.KeyVaultAccessPolicy{ KeyVaultId: keyVault.Id, @@ -103,7 +103,7 @@ func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, } }() if contains(permissions, "Get") { - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( enums.KindAZKeyVaultAccessPolicy, models.KeyVaultAccessPolicy{ KeyVaultId: keyVault.Id, diff --git a/cmd/list-key-vaults.go b/cmd/list-key-vaults.go index 375304f..6f27235 100644 --- a/cmd/list-key-vaults.go +++ b/cmd/list-key-vaults.go @@ -57,9 +57,9 @@ func listKeyVaultsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -102,7 +102,7 @@ func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions } log.V(2).Info("found key vault", "keyVault", keyVault) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZKeyVault, keyVault)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZKeyVault, keyVault)); !ok { return } } diff --git a/cmd/list-logic-app-role-assignments.go b/cmd/list-logic-app-role-assignments.go index c025c2e..a307ad4 100644 --- a/cmd/list-logic-app-role-assignments.go +++ b/cmd/list-logic-app-role-assignments.go @@ -64,9 +64,9 @@ func listLogicAppRoleAssignmentImpl(cmd *cobra.Command, args []string) { } } -func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, logicapps <-chan interface{}) <-chan interface{} { +func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, logicapps <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,7 @@ func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, logicappRoleAssignments.RoleAssignments = append(logicappRoleAssignments.RoleAssignments, logicappRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZLogicAppRoleAssignment, logicappRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZLogicAppRoleAssignment, logicappRoleAssignments)); !ok { return } log.V(1).Info("finished listing logic app role assignments", "logicappId", id, "count", count) diff --git a/cmd/list-logic-apps.go b/cmd/list-logic-apps.go index ab405ab..ab64a86 100644 --- a/cmd/list-logic-apps.go +++ b/cmd/list-logic-apps.go @@ -62,9 +62,9 @@ func listLogicAppsCmdImpl(cmd *cobra.Command, args []string) { } } -func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -109,7 +109,7 @@ func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions } log.V(2).Info("found logicapp", "logicapp", logicapp) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZLogicApp, logicapp)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZLogicApp, logicapp)); !ok { return } } diff --git a/cmd/list-managed-cluster-role-assignments.go b/cmd/list-managed-cluster-role-assignments.go index df70531..1b03013 100644 --- a/cmd/list-managed-cluster-role-assignments.go +++ b/cmd/list-managed-cluster-role-assignments.go @@ -64,9 +64,9 @@ func listManagedClusterRoleAssignmentImpl(cmd *cobra.Command, args []string) { } } -func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureClient, managedClusters <-chan interface{}) <-chan interface{} { +func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureClient, managedClusters <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,7 @@ func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureC managedClusterRoleAssignments.RoleAssignments = append(managedClusterRoleAssignments.RoleAssignments, managedClusterRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagedClusterRoleAssignment, managedClusterRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagedClusterRoleAssignment, managedClusterRoleAssignments)); !ok { return } log.V(1).Info("finished listing managed cluster role assignments", "managedClusterId", id, "count", count) diff --git a/cmd/list-managed-clusters.go b/cmd/list-managed-clusters.go index e588040..aa851b6 100644 --- a/cmd/list-managed-clusters.go +++ b/cmd/list-managed-clusters.go @@ -62,9 +62,9 @@ func listManagedClustersCmdImpl(cmd *cobra.Command, args []string) { } } -func listManagedClusters(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listManagedClusters(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,7 @@ func listManagedClusters(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found managed cluster", "managedCluster", managedCluster) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagedCluster, managedCluster)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagedCluster, managedCluster)); !ok { return } } diff --git a/cmd/list-management-group-descendants.go b/cmd/list-management-group-descendants.go index 658a29e..ebc1eec 100644 --- a/cmd/list-management-group-descendants.go +++ b/cmd/list-management-group-descendants.go @@ -57,9 +57,9 @@ func listManagementGroupDescendantsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listManagementGroupDescendants(ctx context.Context, client client.AzureClient, managementGroups <-chan interface{}) <-chan interface{} { +func listManagementGroupDescendants(ctx context.Context, client client.AzureClient, managementGroups <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -93,7 +93,7 @@ func listManagementGroupDescendants(ctx context.Context, client client.AzureClie } else { log.V(2).Info("found management group descendant", "type", item.Ok.Type, "id", item.Ok.Id, "parent", item.Ok.Properties.Parent.Id) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagementGroupDescendant, item.Ok)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagementGroupDescendant, item.Ok)); !ok { return } } diff --git a/cmd/list-management-groups.go b/cmd/list-management-groups.go index 0580ca5..30fd03e 100644 --- a/cmd/list-management-groups.go +++ b/cmd/list-management-groups.go @@ -56,8 +56,8 @@ func listManagementGroupsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listManagementGroups(ctx context.Context, client client.AzureClient) <-chan interface{} { - out := make(chan interface{}) +func listManagementGroups(ctx context.Context, client client.AzureClient) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -75,7 +75,7 @@ func listManagementGroups(ctx context.Context, client client.AzureClient) <-chan TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagementGroup, mgmtGroup)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagementGroup, mgmtGroup)); !ok { return } } diff --git a/cmd/list-resource-groups.go b/cmd/list-resource-groups.go index 29d731c..9149683 100644 --- a/cmd/list-resource-groups.go +++ b/cmd/list-resource-groups.go @@ -57,9 +57,9 @@ func listResourceGroupsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listResourceGroups(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listResourceGroups(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -98,7 +98,7 @@ func listResourceGroups(ctx context.Context, client client.AzureClient, subscrip } log.V(2).Info("found resource group", "resourceGroup", resourceGroup) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZResourceGroup, resourceGroup)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZResourceGroup, resourceGroup)); !ok { return } } diff --git a/cmd/list-role-assignments.go b/cmd/list-role-assignments.go index 8ee87fb..954ff6c 100644 --- a/cmd/list-role-assignments.go +++ b/cmd/list-role-assignments.go @@ -58,9 +58,9 @@ func listRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listRoleAssignments(ctx context.Context, client client.AzureClient, roles <-chan interface{}) <-chan interface{} { +func listRoleAssignments(ctx context.Context, client client.AzureClient, roles <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,7 @@ func listRoleAssignments(ctx context.Context, client client.AzureClient, roles < roleAssignments.RoleAssignments = append(roleAssignments.RoleAssignments, item.Ok) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZRoleAssignment, roleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZRoleAssignment, roleAssignments)); !ok { return } log.V(1).Info("finished listing role assignments", "roleDefinitionId", id, "count", count) diff --git a/cmd/list-roles.go b/cmd/list-roles.go index 1ea7e01..6660155 100644 --- a/cmd/list-roles.go +++ b/cmd/list-roles.go @@ -55,8 +55,8 @@ func listRolesCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listRoles(ctx context.Context, client client.AzureClient) <-chan interface{} { - out := make(chan interface{}) +func listRoles(ctx context.Context, client client.AzureClient) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -68,7 +68,7 @@ func listRoles(ctx context.Context, client client.AzureClient) <-chan interface{ } else { log.V(2).Info("found role", "role", item) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( enums.KindAZRole, models.Role{ Role: item.Ok, diff --git a/cmd/list-service-principal-owners.go b/cmd/list-service-principal-owners.go index 656bbf0..adbc68e 100644 --- a/cmd/list-service-principal-owners.go +++ b/cmd/list-service-principal-owners.go @@ -57,9 +57,9 @@ func listServicePrincipalOwnersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, servicePrincipals <-chan interface{}) <-chan interface{} { +func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, servicePrincipals <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -105,7 +105,7 @@ func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, servicePrincipalOwners.Owners = append(servicePrincipalOwners.Owners, servicePrincipalOwner) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZServicePrincipalOwner, servicePrincipalOwners)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZServicePrincipalOwner, servicePrincipalOwners)); !ok { return } log.V(1).Info("finished listing service principal owners", "servicePrincipalId", id, "count", count) diff --git a/cmd/list-service-principals.go b/cmd/list-service-principals.go index 2d53e1e..fd061aa 100644 --- a/cmd/list-service-principals.go +++ b/cmd/list-service-principals.go @@ -55,8 +55,8 @@ func listServicePrincipalsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listServicePrincipals(ctx context.Context, client client.AzureClient) <-chan interface{} { - out := make(chan interface{}) +func listServicePrincipals(ctx context.Context, client client.AzureClient) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -68,7 +68,7 @@ func listServicePrincipals(ctx context.Context, client client.AzureClient) <-cha } else { log.V(2).Info("found service principal", "servicePrincipal", item) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( enums.KindAZServicePrincipal, models.ServicePrincipal{ ServicePrincipal: item.Ok, diff --git a/cmd/list-storage-account-role-assignments.go b/cmd/list-storage-account-role-assignments.go index ae0acbf..a642982 100644 --- a/cmd/list-storage-account-role-assignments.go +++ b/cmd/list-storage-account-role-assignments.go @@ -59,9 +59,9 @@ func listStorageAccountRoleAssignmentsImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureClient, storageAccounts <-chan interface{}) <-chan interface{} { +func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureClient, storageAccounts <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -110,7 +110,7 @@ func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureC storageAccountRoleAssignments.RoleAssignments = append(storageAccountRoleAssignments.RoleAssignments, storageAccountRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageAccountRoleAssignment, storageAccountRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageAccountRoleAssignment, storageAccountRoleAssignments)); !ok { return } log.V(1).Info("finished listing storage account role assignments", "storageAccountId", id, "count", count) diff --git a/cmd/list-storage-accounts.go b/cmd/list-storage-accounts.go index e082d21..181878f 100644 --- a/cmd/list-storage-accounts.go +++ b/cmd/list-storage-accounts.go @@ -57,9 +57,9 @@ func listStorageAccountsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listStorageAccounts(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listStorageAccounts(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -101,7 +101,7 @@ func listStorageAccounts(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found storage account", "storageAccount", storageAccount) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageAccount, storageAccount)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageAccount, storageAccount)); !ok { return } } diff --git a/cmd/list-storage-containers.go b/cmd/list-storage-containers.go index a59593f..1b86521 100644 --- a/cmd/list-storage-containers.go +++ b/cmd/list-storage-containers.go @@ -59,10 +59,10 @@ func listStorageContainersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listStorageContainers(ctx context.Context, client client.AzureClient, storageAccounts <-chan interface{}) <-chan interface{} { +func listStorageContainers(ctx context.Context, client client.AzureClient, storageAccounts <-chan any) <-chan any { var ( - out = make(chan interface{}) - ids = make(chan interface{}) + out = make(chan any) + ids = make(chan any) // The original size of the demuxxer cascaded into error messages for a lot of collection steps. // Decreasing the demuxxer size only here is sufficient to prevent the cascade // The error message with higher values for size is @@ -79,7 +79,7 @@ func listStorageContainers(ctx context.Context, client client.AzureClient, stora log.Error(fmt.Errorf("failed type assertion"), "unable to continue enumerating storage containers", "result", result) return } else { - if ok := pipeline.Send(ctx.Done(), ids, storageAccount); !ok { + if ok := pipeline.SendAny(ctx.Done(), ids, storageAccount); !ok { return } } @@ -109,7 +109,7 @@ func listStorageContainers(ctx context.Context, client client.AzureClient, stora } log.V(2).Info("found storage container", "storageContainer", storageContainer) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageContainer, storageContainer)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageContainer, storageContainer)); !ok { return } } diff --git a/cmd/list-subscription-owners.go b/cmd/list-subscription-owners.go index 1bd27c2..10f711e 100644 --- a/cmd/list-subscription-owners.go +++ b/cmd/list-subscription-owners.go @@ -60,8 +60,8 @@ func listSubscriptionOwnersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listSubscriptionOwners(ctx context.Context, client client.AzureClient, roleAssignments <-chan interface{}) <-chan interface{} { - out := make(chan interface{}) +func listSubscriptionOwners(ctx context.Context, client client.AzureClient, roleAssignments <-chan any) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -90,7 +90,7 @@ func listSubscriptionOwners(ctx context.Context, client client.AzureClient, role subscriptionOwners.Owners = append(subscriptionOwners.Owners, subscriptionOwner) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionOwner, subscriptionOwners)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionOwner, subscriptionOwners)); !ok { return } log.V(1).Info("finished listing subscription owners", "subscriptionId", roleAssignments.SubscriptionId, "count", count) diff --git a/cmd/list-subscription-role-assignments.go b/cmd/list-subscription-role-assignments.go index 4374d0f..2b95283 100644 --- a/cmd/list-subscription-role-assignments.go +++ b/cmd/list-subscription-role-assignments.go @@ -58,9 +58,9 @@ func listSubscriptionRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -106,7 +106,7 @@ func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureCli subscriptionRoleAssignments.RoleAssignments = append(subscriptionRoleAssignments.RoleAssignments, subscriptionRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionRoleAssignment, subscriptionRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionRoleAssignment, subscriptionRoleAssignments)); !ok { return } log.V(1).Info("finished listing subscription role assignments", "subscriptionId", id, "count", count) diff --git a/cmd/list-subscription-user-access-admins.go b/cmd/list-subscription-user-access-admins.go index c5cfc40..8ec173b 100644 --- a/cmd/list-subscription-user-access-admins.go +++ b/cmd/list-subscription-user-access-admins.go @@ -60,8 +60,8 @@ func listSubscriptionUserAccessAdminsCmdImpl(cmd *cobra.Command, args []string) log.Info("collection completed", "duration", duration.String()) } -func listSubscriptionUserAccessAdmins(ctx context.Context, client client.AzureClient, vmRoleAssignments <-chan interface{}) <-chan interface{} { - out := make(chan interface{}) +func listSubscriptionUserAccessAdmins(ctx context.Context, client client.AzureClient, vmRoleAssignments <-chan any) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -90,7 +90,7 @@ func listSubscriptionUserAccessAdmins(ctx context.Context, client client.AzureCl subscriptionUserAccessAdmins.UserAccessAdmins = append(subscriptionUserAccessAdmins.UserAccessAdmins, subscriptionUserAccessAdmin) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionUserAccessAdmin, subscriptionUserAccessAdmins)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionUserAccessAdmin, subscriptionUserAccessAdmins)); !ok { return } log.V(1).Info("finished listing subscription user access admins", "subscriptionId", roleAssignments.SubscriptionId, "count", count) diff --git a/cmd/list-subscriptions.go b/cmd/list-subscriptions.go index 2ce8d50..6557de3 100644 --- a/cmd/list-subscriptions.go +++ b/cmd/list-subscriptions.go @@ -59,8 +59,8 @@ func listSubscriptionsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listSubscriptions(ctx context.Context, client client.AzureClient) <-chan interface{} { - out := make(chan interface{}) +func listSubscriptions(ctx context.Context, client client.AzureClient) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -97,7 +97,7 @@ func listSubscriptions(ctx context.Context, client client.AzureClient) <-chan in Subscription: item.Ok, } data.TenantId = client.TenantInfo().TenantId - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscription, data)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscription, data)); !ok { return } } diff --git a/cmd/list-tenants.go b/cmd/list-tenants.go index bdb715d..ae958d2 100644 --- a/cmd/list-tenants.go +++ b/cmd/list-tenants.go @@ -55,15 +55,15 @@ func listTenantsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listTenants(ctx context.Context, client client.AzureClient) <-chan interface{} { - out := make(chan interface{}) +func listTenants(ctx context.Context, client client.AzureClient) <-chan any { + out := make(chan any) go func() { defer close(out) // Send the fully hydrated tenant that is being collected collectedTenant := client.TenantInfo() - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( enums.KindAZTenant, models.Tenant{ Tenant: collectedTenant, @@ -82,7 +82,7 @@ func listTenants(ctx context.Context, client client.AzureClient) <-chan interfac // Send the remaining tenant trusts if item.Ok.TenantId != collectedTenant.TenantId { - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper( + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( enums.KindAZTenant, models.Tenant{ Tenant: item.Ok, diff --git a/cmd/list-users.go b/cmd/list-users.go index 6226f3b..0c1a3ad 100644 --- a/cmd/list-users.go +++ b/cmd/list-users.go @@ -55,8 +55,8 @@ func listUsersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listUsers(ctx context.Context, client client.AzureClient) <-chan interface{} { - out := make(chan interface{}) +func listUsers(ctx context.Context, client client.AzureClient) <-chan any { + out := make(chan any) go func() { defer close(out) @@ -85,7 +85,7 @@ func listUsers(ctx context.Context, client client.AzureClient) <-chan interface{ TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZUser, user)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZUser, user)); !ok { return } } diff --git a/cmd/list-virtual-machines.go b/cmd/list-virtual-machines.go index 9b6d211..b9e4830 100644 --- a/cmd/list-virtual-machines.go +++ b/cmd/list-virtual-machines.go @@ -57,9 +57,9 @@ func listVirtualMachinesCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listVirtualMachines(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listVirtualMachines(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -99,7 +99,7 @@ func listVirtualMachines(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found virtual machine", "virtualMachine", virtualMachine) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZVM, virtualMachine)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZVM, virtualMachine)); !ok { return } } diff --git a/cmd/list-vm-scale-set-role-assignments.go b/cmd/list-vm-scale-set-role-assignments.go index 39c4054..f5b3adb 100644 --- a/cmd/list-vm-scale-set-role-assignments.go +++ b/cmd/list-vm-scale-set-role-assignments.go @@ -64,9 +64,9 @@ func listVMScaleSetRoleAssignmentImpl(cmd *cobra.Command, args []string) { } } -func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClient, vmScaleSets <-chan interface{}) <-chan interface{} { +func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClient, vmScaleSets <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,7 @@ func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClien vmScaleSetRoleAssignments.RoleAssignments = append(vmScaleSetRoleAssignments.RoleAssignments, vmScaleSetRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMScaleSetRoleAssignment, vmScaleSetRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMScaleSetRoleAssignment, vmScaleSetRoleAssignments)); !ok { return } log.V(1).Info("finished listing vm scale set role assignments", "vmScaleSetId", id, "count", count) diff --git a/cmd/list-vm-scale-sets.go b/cmd/list-vm-scale-sets.go index 70965c5..9e706df 100644 --- a/cmd/list-vm-scale-sets.go +++ b/cmd/list-vm-scale-sets.go @@ -62,9 +62,9 @@ func listVMScaleSetsCmdImpl(cmd *cobra.Command, args []string) { } } -func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,7 @@ func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptio } log.V(2).Info("found virtual machine scale set", "vmScaleSet", vmScaleSet) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMScaleSet, vmScaleSet)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMScaleSet, vmScaleSet)); !ok { return } } diff --git a/cmd/list-web-app-role-assignments.go b/cmd/list-web-app-role-assignments.go index 16f97ea..ab9176b 100644 --- a/cmd/list-web-app-role-assignments.go +++ b/cmd/list-web-app-role-assignments.go @@ -64,9 +64,9 @@ func listWebAppRoleAssignmentImpl(cmd *cobra.Command, args []string) { } } -func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, webApps <-chan interface{}) <-chan interface{} { +func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, webApps <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,7 @@ func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, w webAppRoleAssignments.RoleAssignments = append(webAppRoleAssignments.RoleAssignments, webAppRoleAssignment) } } - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZWebAppRoleAssignment, webAppRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZWebAppRoleAssignment, webAppRoleAssignments)); !ok { return } log.V(1).Info("finished listing web app role assignments", "webAppId", id, "count", count) diff --git a/cmd/list-web-apps.go b/cmd/list-web-apps.go index 6136c86..4580cfc 100644 --- a/cmd/list-web-apps.go +++ b/cmd/list-web-apps.go @@ -62,9 +62,9 @@ func listWebAppsCmdImpl(cmd *cobra.Command, args []string) { } } -func listWebApps(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { +func listWebApps(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { var ( - out = make(chan interface{}) + out = make(chan any) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -105,7 +105,7 @@ func listWebApps(ctx context.Context, client client.AzureClient, subscriptions < if webApp.Kind == "app" { log.V(2).Info("found web app", "webApp", webApp) count++ - if ok := pipeline.Send(ctx.Done(), out, NewAzureWrapper(enums.KindAZWebApp, webApp)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZWebApp, webApp)); !ok { return } } diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index 1da50b2..a124593 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -41,6 +41,16 @@ func Send[D, T any](done <-chan D, tgt chan<- T, val T) bool { } } +// SendAny sends a value to an any channel while monitoring the done channel for cancellation +func SendAny[T any](done <-chan T, tgt chan<- any, val any) bool { + select { + case tgt <- val: + return true + case <-done: + return false + } +} + // OrDone provides an explicit cancellation mechanism to ensure the encapsulated and downstream goroutines are cleaned // up. This frees the caller from depending on the input channel to close in order to free the goroutine, thus // preventing possible leaks. @@ -71,7 +81,7 @@ func OrDone[D, T any](done <-chan D, in <-chan T) <-chan T { // Mux joins multiple channels and returns a channel as single stream of data. func Mux[D any](done <-chan D, channels ...<-chan any) <-chan any { var wg sync.WaitGroup - out := make(chan interface{}) + out := make(chan any) muxer := func(channel <-chan any) { defer wg.Done() From de2394d8370997bb0d2900c2e530e0a185f3b09e Mon Sep 17 00:00:00 2001 From: Alyx Holms Date: Mon, 6 Nov 2023 16:25:58 -0700 Subject: [PATCH 8/9] chore: update all remaining instances of interface{} to any --- client/client.go | 2 +- client/mocks/client.go | 130 +++++++++--------- client/rest/client.go | 18 +-- client/rest/http.go | 2 +- client/rest/mocks/client.go | 20 +-- client/rest/utils.go | 10 +- cmd/list-azure-ad.go | 24 ++-- cmd/list-azure-rm.go | 80 +++++------ cmd/list-device-owners_test.go | 2 +- cmd/list-group-members_test.go | 2 +- cmd/list-group-owners_test.go | 2 +- cmd/list-key-vault-access-policies_test.go | 2 +- cmd/list-key-vault-role-assignments.go | 2 +- cmd/list-key-vault-role-assignments_test.go | 2 +- cmd/list-key-vaults_test.go | 2 +- cmd/list-management-group-descendants_test.go | 2 +- cmd/list-management-group-role-assignments.go | 2 +- ...-management-group-role-assignments_test.go | 2 +- cmd/list-resource-group-role-assignments.go | 2 +- ...st-resource-group-role-assignments_test.go | 2 +- cmd/list-resource-groups_test.go | 2 +- cmd/list-root.go | 2 +- cmd/list-service-principal-owners_test.go | 2 +- cmd/list-subscription-owners_test.go | 2 +- ...list-subscription-role-assignments_test.go | 2 +- ...st-subscription-user-access-admins_test.go | 2 +- cmd/list-virtual-machine-role-assignments.go | 2 +- ...t-virtual-machine-role-assignments_test.go | 2 +- cmd/list-virtual-machines_test.go | 2 +- cmd/start.go | 2 +- cmd/utils.go | 4 +- config/internal/config.go | 6 +- logger/internal/logger.go | 8 +- models/azure/app_role_assignment.go | 1 - models/azure/app_scope.go | 4 +- models/azure/cloning_info.go | 22 +-- models/azure/ip_security_restriction.go | 2 +- models/azure/logic_app_definition.go | 32 ++--- models/azure/logic_app_parameter.go | 8 +- models/azure/site_config.go | 40 +++--- models/azure/storage_container_props.go | 2 +- models/ingest-request.go | 4 +- pipeline/pipeline_test.go | 4 +- 43 files changed, 233 insertions(+), 234 deletions(-) diff --git a/client/client.go b/client/client.go index 03e5a76..8b6ba79 100644 --- a/client/client.go +++ b/client/client.go @@ -55,7 +55,7 @@ func NewClient(config config.Config) (AzureClient, error) { } } -func initClientViaRM(msgraph, resourceManager rest.RestClient, tid interface{}) (AzureClient, error) { +func initClientViaRM(msgraph, resourceManager rest.RestClient, tid any) (AzureClient, error) { client := &azureClient{ msgraph: msgraph, resourceManager: resourceManager, diff --git a/client/mocks/client.go b/client/mocks/client.go index fa2ca60..83b9115 100644 --- a/client/mocks/client.go +++ b/client/mocks/client.go @@ -58,7 +58,7 @@ func (m *MockAzureClient) GetAzureADApp(arg0 context.Context, arg1 string, arg2 } // GetAzureADApp indicates an expected call of GetAzureADApp. -func (mr *MockAzureClientMockRecorder) GetAzureADApp(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADApp(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADApp", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADApp), arg0, arg1, arg2) } @@ -73,7 +73,7 @@ func (m *MockAzureClient) GetAzureADApps(arg0 context.Context, arg1, arg2, arg3, } // GetAzureADApps indicates an expected call of GetAzureADApps. -func (mr *MockAzureClientMockRecorder) GetAzureADApps(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADApps(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADApps", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADApps), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -88,7 +88,7 @@ func (m *MockAzureClient) GetAzureADDirectoryObject(arg0 context.Context, arg1 s } // GetAzureADDirectoryObject indicates an expected call of GetAzureADDirectoryObject. -func (mr *MockAzureClientMockRecorder) GetAzureADDirectoryObject(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADDirectoryObject(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADDirectoryObject", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADDirectoryObject), arg0, arg1) } @@ -103,7 +103,7 @@ func (m *MockAzureClient) GetAzureADGroup(arg0 context.Context, arg1 string, arg } // GetAzureADGroup indicates an expected call of GetAzureADGroup. -func (mr *MockAzureClientMockRecorder) GetAzureADGroup(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADGroup(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADGroup", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADGroup), arg0, arg1, arg2) } @@ -118,7 +118,7 @@ func (m *MockAzureClient) GetAzureADGroupOwners(arg0 context.Context, arg1, arg2 } // GetAzureADGroupOwners indicates an expected call of GetAzureADGroupOwners. -func (mr *MockAzureClientMockRecorder) GetAzureADGroupOwners(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADGroupOwners(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADGroupOwners", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADGroupOwners), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -133,7 +133,7 @@ func (m *MockAzureClient) GetAzureADGroups(arg0 context.Context, arg1, arg2, arg } // GetAzureADGroups indicates an expected call of GetAzureADGroups. -func (mr *MockAzureClientMockRecorder) GetAzureADGroups(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADGroups(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADGroups", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADGroups), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -148,7 +148,7 @@ func (m *MockAzureClient) GetAzureADOrganization(arg0 context.Context, arg1 []st } // GetAzureADOrganization indicates an expected call of GetAzureADOrganization. -func (mr *MockAzureClientMockRecorder) GetAzureADOrganization(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADOrganization(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADOrganization", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADOrganization), arg0, arg1) } @@ -163,7 +163,7 @@ func (m *MockAzureClient) GetAzureADRole(arg0 context.Context, arg1 string, arg2 } // GetAzureADRole indicates an expected call of GetAzureADRole. -func (mr *MockAzureClientMockRecorder) GetAzureADRole(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADRole(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADRole", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADRole), arg0, arg1, arg2) } @@ -178,7 +178,7 @@ func (m *MockAzureClient) GetAzureADRoleAssignment(arg0 context.Context, arg1 st } // GetAzureADRoleAssignment indicates an expected call of GetAzureADRoleAssignment. -func (mr *MockAzureClientMockRecorder) GetAzureADRoleAssignment(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADRoleAssignment(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADRoleAssignment", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADRoleAssignment), arg0, arg1, arg2) } @@ -193,7 +193,7 @@ func (m *MockAzureClient) GetAzureADRoleAssignments(arg0 context.Context, arg1, } // GetAzureADRoleAssignments indicates an expected call of GetAzureADRoleAssignments. -func (mr *MockAzureClientMockRecorder) GetAzureADRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADRoleAssignments), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -208,7 +208,7 @@ func (m *MockAzureClient) GetAzureADRoles(arg0 context.Context, arg1, arg2 strin } // GetAzureADRoles indicates an expected call of GetAzureADRoles. -func (mr *MockAzureClientMockRecorder) GetAzureADRoles(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADRoles(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADRoles", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADRoles), arg0, arg1, arg2) } @@ -223,7 +223,7 @@ func (m *MockAzureClient) GetAzureADServicePrincipal(arg0 context.Context, arg1 } // GetAzureADServicePrincipal indicates an expected call of GetAzureADServicePrincipal. -func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipal(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipal(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADServicePrincipal", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADServicePrincipal), arg0, arg1, arg2) } @@ -238,7 +238,7 @@ func (m *MockAzureClient) GetAzureADServicePrincipalOwners(arg0 context.Context, } // GetAzureADServicePrincipalOwners indicates an expected call of GetAzureADServicePrincipalOwners. -func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipalOwners(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipalOwners(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADServicePrincipalOwners", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADServicePrincipalOwners), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -253,7 +253,7 @@ func (m *MockAzureClient) GetAzureADServicePrincipals(arg0 context.Context, arg1 } // GetAzureADServicePrincipals indicates an expected call of GetAzureADServicePrincipals. -func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipals(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipals(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADServicePrincipals", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADServicePrincipals), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -268,7 +268,7 @@ func (m *MockAzureClient) GetAzureADTenants(arg0 context.Context, arg1 bool) (az } // GetAzureADTenants indicates an expected call of GetAzureADTenants. -func (mr *MockAzureClientMockRecorder) GetAzureADTenants(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADTenants(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADTenants", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADTenants), arg0, arg1) } @@ -283,7 +283,7 @@ func (m *MockAzureClient) GetAzureADUser(arg0 context.Context, arg1 string, arg2 } // GetAzureADUser indicates an expected call of GetAzureADUser. -func (mr *MockAzureClientMockRecorder) GetAzureADUser(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADUser(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADUser", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADUser), arg0, arg1, arg2) } @@ -298,7 +298,7 @@ func (m *MockAzureClient) GetAzureADUsers(arg0 context.Context, arg1, arg2, arg3 } // GetAzureADUsers indicates an expected call of GetAzureADUsers. -func (mr *MockAzureClientMockRecorder) GetAzureADUsers(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADUsers(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADUsers", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADUsers), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } @@ -313,7 +313,7 @@ func (m *MockAzureClient) GetAzureDevice(arg0 context.Context, arg1 string, arg2 } // GetAzureDevice indicates an expected call of GetAzureDevice. -func (mr *MockAzureClientMockRecorder) GetAzureDevice(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureDevice(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureDevice", reflect.TypeOf((*MockAzureClient)(nil).GetAzureDevice), arg0, arg1, arg2) } @@ -328,7 +328,7 @@ func (m *MockAzureClient) GetAzureDevices(arg0 context.Context, arg1, arg2, arg3 } // GetAzureDevices indicates an expected call of GetAzureDevices. -func (mr *MockAzureClientMockRecorder) GetAzureDevices(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureDevices(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureDevices", reflect.TypeOf((*MockAzureClient)(nil).GetAzureDevices), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -343,7 +343,7 @@ func (m *MockAzureClient) GetAzureKeyVault(arg0 context.Context, arg1, arg2, arg } // GetAzureKeyVault indicates an expected call of GetAzureKeyVault. -func (mr *MockAzureClientMockRecorder) GetAzureKeyVault(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureKeyVault(arg0, arg1, arg2, arg3 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureKeyVault", reflect.TypeOf((*MockAzureClient)(nil).GetAzureKeyVault), arg0, arg1, arg2, arg3) } @@ -358,7 +358,7 @@ func (m *MockAzureClient) GetAzureKeyVaults(arg0 context.Context, arg1 string, a } // GetAzureKeyVaults indicates an expected call of GetAzureKeyVaults. -func (mr *MockAzureClientMockRecorder) GetAzureKeyVaults(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureKeyVaults(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureKeyVaults", reflect.TypeOf((*MockAzureClient)(nil).GetAzureKeyVaults), arg0, arg1, arg2) } @@ -373,7 +373,7 @@ func (m *MockAzureClient) GetAzureManagementGroup(arg0 context.Context, arg1, ar } // GetAzureManagementGroup indicates an expected call of GetAzureManagementGroup. -func (mr *MockAzureClientMockRecorder) GetAzureManagementGroup(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureManagementGroup(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureManagementGroup", reflect.TypeOf((*MockAzureClient)(nil).GetAzureManagementGroup), arg0, arg1, arg2, arg3, arg4) } @@ -388,7 +388,7 @@ func (m *MockAzureClient) GetAzureManagementGroups(arg0 context.Context) (azure. } // GetAzureManagementGroups indicates an expected call of GetAzureManagementGroups. -func (mr *MockAzureClientMockRecorder) GetAzureManagementGroups(arg0 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureManagementGroups(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureManagementGroups", reflect.TypeOf((*MockAzureClient)(nil).GetAzureManagementGroups), arg0) } @@ -403,7 +403,7 @@ func (m *MockAzureClient) GetAzureResourceGroup(arg0 context.Context, arg1, arg2 } // GetAzureResourceGroup indicates an expected call of GetAzureResourceGroup. -func (mr *MockAzureClientMockRecorder) GetAzureResourceGroup(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureResourceGroup(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureResourceGroup", reflect.TypeOf((*MockAzureClient)(nil).GetAzureResourceGroup), arg0, arg1, arg2) } @@ -418,7 +418,7 @@ func (m *MockAzureClient) GetAzureResourceGroups(arg0 context.Context, arg1, arg } // GetAzureResourceGroups indicates an expected call of GetAzureResourceGroups. -func (mr *MockAzureClientMockRecorder) GetAzureResourceGroups(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureResourceGroups(arg0, arg1, arg2, arg3 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureResourceGroups", reflect.TypeOf((*MockAzureClient)(nil).GetAzureResourceGroups), arg0, arg1, arg2, arg3) } @@ -433,7 +433,7 @@ func (m *MockAzureClient) GetAzureStorageAccount(arg0 context.Context, arg1, arg } // GetAzureStorageAccount indicates an expected call of GetAzureStorageAccount. -func (mr *MockAzureClientMockRecorder) GetAzureStorageAccount(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureStorageAccount(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureStorageAccount", reflect.TypeOf((*MockAzureClient)(nil).GetAzureStorageAccount), arg0, arg1, arg2, arg3, arg4) } @@ -448,7 +448,7 @@ func (m *MockAzureClient) GetAzureStorageAccounts(arg0 context.Context, arg1 str } // GetAzureStorageAccounts indicates an expected call of GetAzureStorageAccounts. -func (mr *MockAzureClientMockRecorder) GetAzureStorageAccounts(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureStorageAccounts(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureStorageAccounts", reflect.TypeOf((*MockAzureClient)(nil).GetAzureStorageAccounts), arg0, arg1) } @@ -463,7 +463,7 @@ func (m *MockAzureClient) GetAzureSubscription(arg0 context.Context, arg1 string } // GetAzureSubscription indicates an expected call of GetAzureSubscription. -func (mr *MockAzureClientMockRecorder) GetAzureSubscription(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureSubscription(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureSubscription", reflect.TypeOf((*MockAzureClient)(nil).GetAzureSubscription), arg0, arg1) } @@ -478,7 +478,7 @@ func (m *MockAzureClient) GetAzureSubscriptions(arg0 context.Context) (azure.Sub } // GetAzureSubscriptions indicates an expected call of GetAzureSubscriptions. -func (mr *MockAzureClientMockRecorder) GetAzureSubscriptions(arg0 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureSubscriptions(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureSubscriptions", reflect.TypeOf((*MockAzureClient)(nil).GetAzureSubscriptions), arg0) } @@ -493,7 +493,7 @@ func (m *MockAzureClient) GetAzureVirtualMachine(arg0 context.Context, arg1, arg } // GetAzureVirtualMachine indicates an expected call of GetAzureVirtualMachine. -func (mr *MockAzureClientMockRecorder) GetAzureVirtualMachine(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureVirtualMachine(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureVirtualMachine", reflect.TypeOf((*MockAzureClient)(nil).GetAzureVirtualMachine), arg0, arg1, arg2, arg3, arg4) } @@ -508,7 +508,7 @@ func (m *MockAzureClient) GetAzureVirtualMachines(arg0 context.Context, arg1 str } // GetAzureVirtualMachines indicates an expected call of GetAzureVirtualMachines. -func (mr *MockAzureClientMockRecorder) GetAzureVirtualMachines(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureVirtualMachines(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureVirtualMachines", reflect.TypeOf((*MockAzureClient)(nil).GetAzureVirtualMachines), arg0, arg1, arg2) } @@ -523,7 +523,7 @@ func (m *MockAzureClient) GetResourceRoleAssignments(arg0 context.Context, arg1, } // GetResourceRoleAssignments indicates an expected call of GetResourceRoleAssignments. -func (mr *MockAzureClientMockRecorder) GetResourceRoleAssignments(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetResourceRoleAssignments(arg0, arg1, arg2, arg3 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResourceRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).GetResourceRoleAssignments), arg0, arg1, arg2, arg3) } @@ -538,7 +538,7 @@ func (m *MockAzureClient) GetRoleAssignmentsForResource(arg0 context.Context, ar } // GetRoleAssignmentsForResource indicates an expected call of GetRoleAssignmentsForResource. -func (mr *MockAzureClientMockRecorder) GetRoleAssignmentsForResource(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetRoleAssignmentsForResource(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRoleAssignmentsForResource", reflect.TypeOf((*MockAzureClient)(nil).GetRoleAssignmentsForResource), arg0, arg1, arg2) } @@ -552,7 +552,7 @@ func (m *MockAzureClient) ListAzureADAppMemberObjects(arg0 context.Context, arg1 } // ListAzureADAppMemberObjects indicates an expected call of ListAzureADAppMemberObjects. -func (mr *MockAzureClientMockRecorder) ListAzureADAppMemberObjects(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADAppMemberObjects(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADAppMemberObjects", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADAppMemberObjects), arg0, arg1, arg2) } @@ -566,7 +566,7 @@ func (m *MockAzureClient) ListAzureADAppOwners(arg0 context.Context, arg1, arg2, } // ListAzureADAppOwners indicates an expected call of ListAzureADAppOwners. -func (mr *MockAzureClientMockRecorder) ListAzureADAppOwners(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADAppOwners(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADAppOwners", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADAppOwners), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -580,7 +580,7 @@ func (m *MockAzureClient) ListAzureADAppRoleAssignments(arg0 context.Context, ar } // ListAzureADAppRoleAssignments indicates an expected call of ListAzureADAppRoleAssignments. -func (mr *MockAzureClientMockRecorder) ListAzureADAppRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADAppRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADAppRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADAppRoleAssignments), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } @@ -594,7 +594,7 @@ func (m *MockAzureClient) ListAzureADApps(arg0 context.Context, arg1, arg2, arg3 } // ListAzureADApps indicates an expected call of ListAzureADApps. -func (mr *MockAzureClientMockRecorder) ListAzureADApps(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADApps(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADApps", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADApps), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -608,7 +608,7 @@ func (m *MockAzureClient) ListAzureADGroupMembers(arg0 context.Context, arg1, ar } // ListAzureADGroupMembers indicates an expected call of ListAzureADGroupMembers. -func (mr *MockAzureClientMockRecorder) ListAzureADGroupMembers(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADGroupMembers(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADGroupMembers", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADGroupMembers), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -622,7 +622,7 @@ func (m *MockAzureClient) ListAzureADGroupOwners(arg0 context.Context, arg1, arg } // ListAzureADGroupOwners indicates an expected call of ListAzureADGroupOwners. -func (mr *MockAzureClientMockRecorder) ListAzureADGroupOwners(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADGroupOwners(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADGroupOwners", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADGroupOwners), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -636,7 +636,7 @@ func (m *MockAzureClient) ListAzureADGroups(arg0 context.Context, arg1, arg2, ar } // ListAzureADGroups indicates an expected call of ListAzureADGroups. -func (mr *MockAzureClientMockRecorder) ListAzureADGroups(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADGroups(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADGroups", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADGroups), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -650,7 +650,7 @@ func (m *MockAzureClient) ListAzureADRoleAssignments(arg0 context.Context, arg1, } // ListAzureADRoleAssignments indicates an expected call of ListAzureADRoleAssignments. -func (mr *MockAzureClientMockRecorder) ListAzureADRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADRoleAssignments), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -664,7 +664,7 @@ func (m *MockAzureClient) ListAzureADRoles(arg0 context.Context, arg1, arg2 stri } // ListAzureADRoles indicates an expected call of ListAzureADRoles. -func (mr *MockAzureClientMockRecorder) ListAzureADRoles(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADRoles(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADRoles", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADRoles), arg0, arg1, arg2) } @@ -678,7 +678,7 @@ func (m *MockAzureClient) ListAzureADServicePrincipalOwners(arg0 context.Context } // ListAzureADServicePrincipalOwners indicates an expected call of ListAzureADServicePrincipalOwners. -func (mr *MockAzureClientMockRecorder) ListAzureADServicePrincipalOwners(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADServicePrincipalOwners(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADServicePrincipalOwners", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADServicePrincipalOwners), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -692,7 +692,7 @@ func (m *MockAzureClient) ListAzureADServicePrincipals(arg0 context.Context, arg } // ListAzureADServicePrincipals indicates an expected call of ListAzureADServicePrincipals. -func (mr *MockAzureClientMockRecorder) ListAzureADServicePrincipals(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADServicePrincipals(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADServicePrincipals", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADServicePrincipals), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -706,7 +706,7 @@ func (m *MockAzureClient) ListAzureADTenants(arg0 context.Context, arg1 bool) <- } // ListAzureADTenants indicates an expected call of ListAzureADTenants. -func (mr *MockAzureClientMockRecorder) ListAzureADTenants(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADTenants(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADTenants", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADTenants), arg0, arg1) } @@ -720,7 +720,7 @@ func (m *MockAzureClient) ListAzureADUsers(arg0 context.Context, arg1, arg2, arg } // ListAzureADUsers indicates an expected call of ListAzureADUsers. -func (mr *MockAzureClientMockRecorder) ListAzureADUsers(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADUsers(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADUsers", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADUsers), arg0, arg1, arg2, arg3, arg4) } @@ -734,7 +734,7 @@ func (m *MockAzureClient) ListAzureAutomationAccounts(arg0 context.Context, arg1 } // ListAzureAutomationAccounts indicates an expected call of ListAzureAutomationAccounts. -func (mr *MockAzureClientMockRecorder) ListAzureAutomationAccounts(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureAutomationAccounts(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureAutomationAccounts", reflect.TypeOf((*MockAzureClient)(nil).ListAzureAutomationAccounts), arg0, arg1) } @@ -748,7 +748,7 @@ func (m *MockAzureClient) ListAzureContainerRegistries(arg0 context.Context, arg } // ListAzureContainerRegistries indicates an expected call of ListAzureContainerRegistries. -func (mr *MockAzureClientMockRecorder) ListAzureContainerRegistries(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureContainerRegistries(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureContainerRegistries", reflect.TypeOf((*MockAzureClient)(nil).ListAzureContainerRegistries), arg0, arg1) } @@ -762,7 +762,7 @@ func (m *MockAzureClient) ListAzureDeviceRegisteredOwners(arg0 context.Context, } // ListAzureDeviceRegisteredOwners indicates an expected call of ListAzureDeviceRegisteredOwners. -func (mr *MockAzureClientMockRecorder) ListAzureDeviceRegisteredOwners(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureDeviceRegisteredOwners(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureDeviceRegisteredOwners", reflect.TypeOf((*MockAzureClient)(nil).ListAzureDeviceRegisteredOwners), arg0, arg1, arg2) } @@ -776,7 +776,7 @@ func (m *MockAzureClient) ListAzureDevices(arg0 context.Context, arg1, arg2, arg } // ListAzureDevices indicates an expected call of ListAzureDevices. -func (mr *MockAzureClientMockRecorder) ListAzureDevices(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureDevices(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureDevices", reflect.TypeOf((*MockAzureClient)(nil).ListAzureDevices), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -790,7 +790,7 @@ func (m *MockAzureClient) ListAzureFunctionApps(arg0 context.Context, arg1 strin } // ListAzureFunctionApps indicates an expected call of ListAzureFunctionApps. -func (mr *MockAzureClientMockRecorder) ListAzureFunctionApps(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureFunctionApps(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureFunctionApps", reflect.TypeOf((*MockAzureClient)(nil).ListAzureFunctionApps), arg0, arg1) } @@ -804,7 +804,7 @@ func (m *MockAzureClient) ListAzureKeyVaults(arg0 context.Context, arg1 string, } // ListAzureKeyVaults indicates an expected call of ListAzureKeyVaults. -func (mr *MockAzureClientMockRecorder) ListAzureKeyVaults(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureKeyVaults(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureKeyVaults", reflect.TypeOf((*MockAzureClient)(nil).ListAzureKeyVaults), arg0, arg1, arg2) } @@ -818,7 +818,7 @@ func (m *MockAzureClient) ListAzureLogicApps(arg0 context.Context, arg1, arg2 st } // ListAzureLogicApps indicates an expected call of ListAzureLogicApps. -func (mr *MockAzureClientMockRecorder) ListAzureLogicApps(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureLogicApps(arg0, arg1, arg2, arg3 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureLogicApps", reflect.TypeOf((*MockAzureClient)(nil).ListAzureLogicApps), arg0, arg1, arg2, arg3) } @@ -832,7 +832,7 @@ func (m *MockAzureClient) ListAzureManagedClusters(arg0 context.Context, arg1 st } // ListAzureManagedClusters indicates an expected call of ListAzureManagedClusters. -func (mr *MockAzureClientMockRecorder) ListAzureManagedClusters(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureManagedClusters(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureManagedClusters", reflect.TypeOf((*MockAzureClient)(nil).ListAzureManagedClusters), arg0, arg1, arg2) } @@ -846,7 +846,7 @@ func (m *MockAzureClient) ListAzureManagementGroupDescendants(arg0 context.Conte } // ListAzureManagementGroupDescendants indicates an expected call of ListAzureManagementGroupDescendants. -func (mr *MockAzureClientMockRecorder) ListAzureManagementGroupDescendants(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureManagementGroupDescendants(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureManagementGroupDescendants", reflect.TypeOf((*MockAzureClient)(nil).ListAzureManagementGroupDescendants), arg0, arg1) } @@ -860,7 +860,7 @@ func (m *MockAzureClient) ListAzureManagementGroups(arg0 context.Context) <-chan } // ListAzureManagementGroups indicates an expected call of ListAzureManagementGroups. -func (mr *MockAzureClientMockRecorder) ListAzureManagementGroups(arg0 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureManagementGroups(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureManagementGroups", reflect.TypeOf((*MockAzureClient)(nil).ListAzureManagementGroups), arg0) } @@ -874,7 +874,7 @@ func (m *MockAzureClient) ListAzureResourceGroups(arg0 context.Context, arg1, ar } // ListAzureResourceGroups indicates an expected call of ListAzureResourceGroups. -func (mr *MockAzureClientMockRecorder) ListAzureResourceGroups(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureResourceGroups(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureResourceGroups", reflect.TypeOf((*MockAzureClient)(nil).ListAzureResourceGroups), arg0, arg1, arg2) } @@ -888,7 +888,7 @@ func (m *MockAzureClient) ListAzureStorageAccounts(arg0 context.Context, arg1 st } // ListAzureStorageAccounts indicates an expected call of ListAzureStorageAccounts. -func (mr *MockAzureClientMockRecorder) ListAzureStorageAccounts(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureStorageAccounts(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureStorageAccounts", reflect.TypeOf((*MockAzureClient)(nil).ListAzureStorageAccounts), arg0, arg1) } @@ -902,7 +902,7 @@ func (m *MockAzureClient) ListAzureStorageContainers(arg0 context.Context, arg1, } // ListAzureStorageContainers indicates an expected call of ListAzureStorageContainers. -func (mr *MockAzureClientMockRecorder) ListAzureStorageContainers(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureStorageContainers(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureStorageContainers", reflect.TypeOf((*MockAzureClient)(nil).ListAzureStorageContainers), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } @@ -916,7 +916,7 @@ func (m *MockAzureClient) ListAzureSubscriptions(arg0 context.Context) <-chan az } // ListAzureSubscriptions indicates an expected call of ListAzureSubscriptions. -func (mr *MockAzureClientMockRecorder) ListAzureSubscriptions(arg0 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureSubscriptions(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureSubscriptions", reflect.TypeOf((*MockAzureClient)(nil).ListAzureSubscriptions), arg0) } @@ -930,7 +930,7 @@ func (m *MockAzureClient) ListAzureVMScaleSets(arg0 context.Context, arg1 string } // ListAzureVMScaleSets indicates an expected call of ListAzureVMScaleSets. -func (mr *MockAzureClientMockRecorder) ListAzureVMScaleSets(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureVMScaleSets(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureVMScaleSets", reflect.TypeOf((*MockAzureClient)(nil).ListAzureVMScaleSets), arg0, arg1, arg2) } @@ -944,7 +944,7 @@ func (m *MockAzureClient) ListAzureVirtualMachines(arg0 context.Context, arg1 st } // ListAzureVirtualMachines indicates an expected call of ListAzureVirtualMachines. -func (mr *MockAzureClientMockRecorder) ListAzureVirtualMachines(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureVirtualMachines(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureVirtualMachines", reflect.TypeOf((*MockAzureClient)(nil).ListAzureVirtualMachines), arg0, arg1, arg2) } @@ -958,7 +958,7 @@ func (m *MockAzureClient) ListAzureWebApps(arg0 context.Context, arg1 string) <- } // ListAzureWebApps indicates an expected call of ListAzureWebApps. -func (mr *MockAzureClientMockRecorder) ListAzureWebApps(arg0, arg1 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureWebApps(arg0, arg1 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureWebApps", reflect.TypeOf((*MockAzureClient)(nil).ListAzureWebApps), arg0, arg1) } @@ -972,7 +972,7 @@ func (m *MockAzureClient) ListResourceRoleAssignments(arg0 context.Context, arg1 } // ListResourceRoleAssignments indicates an expected call of ListResourceRoleAssignments. -func (mr *MockAzureClientMockRecorder) ListResourceRoleAssignments(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListResourceRoleAssignments(arg0, arg1, arg2, arg3 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListResourceRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).ListResourceRoleAssignments), arg0, arg1, arg2, arg3) } @@ -986,7 +986,7 @@ func (m *MockAzureClient) ListRoleAssignmentsForResource(arg0 context.Context, a } // ListRoleAssignmentsForResource indicates an expected call of ListRoleAssignmentsForResource. -func (mr *MockAzureClientMockRecorder) ListRoleAssignmentsForResource(arg0, arg1, arg2 interface{}) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListRoleAssignmentsForResource(arg0, arg1, arg2 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRoleAssignmentsForResource", reflect.TypeOf((*MockAzureClient)(nil).ListRoleAssignmentsForResource), arg0, arg1, arg2) } diff --git a/client/rest/client.go b/client/rest/client.go index 77b637f..97612a4 100644 --- a/client/rest/client.go +++ b/client/rest/client.go @@ -38,11 +38,11 @@ import ( type RestClient interface { Authenticate() error - Delete(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) + Delete(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) Get(ctx context.Context, path string, params, headers map[string]string) (*http.Response, error) - Patch(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) - Post(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) - Put(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) + Patch(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) + Post(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) + Put(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) Send(req *http.Request) (*http.Response, error) CloseIdleConnections() } @@ -155,7 +155,7 @@ func (s *restClient) Authenticate() error { } } -func (s *restClient) Delete(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) { +func (s *restClient) Delete(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) { endpoint := s.api.ResolveReference(&url.URL{Path: path}) if req, err := NewRequest(ctx, http.MethodDelete, endpoint, body, params, headers); err != nil { return nil, err @@ -173,7 +173,7 @@ func (s *restClient) Get(ctx context.Context, path string, params, headers map[s } } -func (s *restClient) Patch(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) { +func (s *restClient) Patch(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) { endpoint := s.api.ResolveReference(&url.URL{Path: path}) if req, err := NewRequest(ctx, http.MethodPatch, endpoint, body, params, headers); err != nil { return nil, err @@ -182,7 +182,7 @@ func (s *restClient) Patch(ctx context.Context, path string, body interface{}, p } } -func (s *restClient) Post(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) { +func (s *restClient) Post(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) { endpoint := s.api.ResolveReference(&url.URL{Path: path}) if req, err := NewRequest(ctx, http.MethodPost, endpoint, body, params, headers); err != nil { return nil, err @@ -191,7 +191,7 @@ func (s *restClient) Post(ctx context.Context, path string, body interface{}, pa } } -func (s *restClient) Put(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) { +func (s *restClient) Put(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) { endpoint := s.api.ResolveReference(&url.URL{Path: path}) if req, err := NewRequest(ctx, http.MethodPost, endpoint, body, params, headers); err != nil { return nil, err @@ -275,7 +275,7 @@ func (s *restClient) send(req *http.Request) (*http.Response, error) { continue } else { // Not a status code that warrants a retry - var errRes map[string]interface{} + var errRes map[string]any if err := Decode(res.Body, &errRes); err != nil { return nil, fmt.Errorf("malformed error response, status code: %d", res.StatusCode) } else { diff --git a/client/rest/http.go b/client/rest/http.go index 5fa256a..61748ba 100644 --- a/client/rest/http.go +++ b/client/rest/http.go @@ -71,7 +71,7 @@ func NewRequest( ctx context.Context, verb string, endpoint *url.URL, - body interface{}, + body any, params map[string]string, headers map[string]string, ) (*http.Request, error) { diff --git a/client/rest/mocks/client.go b/client/rest/mocks/client.go index b9df20b..28fbe04 100644 --- a/client/rest/mocks/client.go +++ b/client/rest/mocks/client.go @@ -62,7 +62,7 @@ func (mr *MockRestClientMockRecorder) CloseIdleConnections() *gomock.Call { } // Delete mocks base method. -func (m *MockRestClient) Delete(arg0 context.Context, arg1 string, arg2 interface{}, arg3, arg4 map[string]string) (*http.Response, error) { +func (m *MockRestClient) Delete(arg0 context.Context, arg1 string, arg2 any, arg3, arg4 map[string]string) (*http.Response, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(*http.Response) @@ -71,7 +71,7 @@ func (m *MockRestClient) Delete(arg0 context.Context, arg1 string, arg2 interfac } // Delete indicates an expected call of Delete. -func (mr *MockRestClientMockRecorder) Delete(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockRestClientMockRecorder) Delete(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRestClient)(nil).Delete), arg0, arg1, arg2, arg3, arg4) } @@ -86,13 +86,13 @@ func (m *MockRestClient) Get(arg0 context.Context, arg1 string, arg2, arg3 map[s } // Get indicates an expected call of Get. -func (mr *MockRestClientMockRecorder) Get(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { +func (mr *MockRestClientMockRecorder) Get(arg0, arg1, arg2, arg3 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRestClient)(nil).Get), arg0, arg1, arg2, arg3) } // Patch mocks base method. -func (m *MockRestClient) Patch(arg0 context.Context, arg1 string, arg2 interface{}, arg3, arg4 map[string]string) (*http.Response, error) { +func (m *MockRestClient) Patch(arg0 context.Context, arg1 string, arg2 any, arg3, arg4 map[string]string) (*http.Response, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Patch", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(*http.Response) @@ -101,13 +101,13 @@ func (m *MockRestClient) Patch(arg0 context.Context, arg1 string, arg2 interface } // Patch indicates an expected call of Patch. -func (mr *MockRestClientMockRecorder) Patch(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockRestClientMockRecorder) Patch(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockRestClient)(nil).Patch), arg0, arg1, arg2, arg3, arg4) } // Post mocks base method. -func (m *MockRestClient) Post(arg0 context.Context, arg1 string, arg2 interface{}, arg3, arg4 map[string]string) (*http.Response, error) { +func (m *MockRestClient) Post(arg0 context.Context, arg1 string, arg2 any, arg3, arg4 map[string]string) (*http.Response, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Post", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(*http.Response) @@ -116,13 +116,13 @@ func (m *MockRestClient) Post(arg0 context.Context, arg1 string, arg2 interface{ } // Post indicates an expected call of Post. -func (mr *MockRestClientMockRecorder) Post(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockRestClientMockRecorder) Post(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Post", reflect.TypeOf((*MockRestClient)(nil).Post), arg0, arg1, arg2, arg3, arg4) } // Put mocks base method. -func (m *MockRestClient) Put(arg0 context.Context, arg1 string, arg2 interface{}, arg3, arg4 map[string]string) (*http.Response, error) { +func (m *MockRestClient) Put(arg0 context.Context, arg1 string, arg2 any, arg3, arg4 map[string]string) (*http.Response, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(*http.Response) @@ -131,7 +131,7 @@ func (m *MockRestClient) Put(arg0 context.Context, arg1 string, arg2 interface{} } // Put indicates an expected call of Put. -func (mr *MockRestClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockRestClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockRestClient)(nil).Put), arg0, arg1, arg2, arg3, arg4) } @@ -146,7 +146,7 @@ func (m *MockRestClient) Send(arg0 *http.Request) (*http.Response, error) { } // Send indicates an expected call of Send. -func (mr *MockRestClientMockRecorder) Send(arg0 interface{}) *gomock.Call { +func (mr *MockRestClientMockRecorder) Send(arg0 any) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockRestClient)(nil).Send), arg0) } diff --git a/client/rest/utils.go b/client/rest/utils.go index b048e7b..cfe0805 100644 --- a/client/rest/utils.go +++ b/client/rest/utils.go @@ -33,7 +33,7 @@ import ( "github.com/youmark/pkcs8" ) -func Decode(body io.ReadCloser, v interface{}) error { +func Decode(body io.ReadCloser, v any) error { defer body.Close() defer io.ReadAll(body) // must read all; streaming to the json decoder does not read to EOF making the connection unavailable for reuse return json.NewDecoder(body).Decode(v) @@ -59,7 +59,7 @@ func NewClientAssertion(tokenUrl string, clientId string, clientCert string, sig IssuedAt: iat.Unix(), }) - token.Header = map[string]interface{}{ + token.Header = map[string]any{ "alg": "RS256", "typ": "JWT", "x5t": thumbprint, @@ -73,9 +73,9 @@ func NewClientAssertion(tokenUrl string, clientId string, clientCert string, sig } } -func ParseBody(accessToken string) (map[string]interface{}, error) { +func ParseBody(accessToken string) (map[string]any, error) { var ( - body = make(map[string]interface{}) + body = make(map[string]any) parts = strings.Split(accessToken, ".") ) @@ -100,7 +100,7 @@ func ParseAud(accessToken string) (string, error) { } } -func parseRSAPrivateKey(signingKey string, password string) (interface{}, error) { +func parseRSAPrivateKey(signingKey string, password string) (any, error) { if decodedBlock, _ := pem.Decode([]byte(signingKey)); decodedBlock == nil { return nil, fmt.Errorf("Unable to decode private key") } else if key, _, err := pkcs8.ParsePrivateKey(decodedBlock.Bytes, []byte(password)); err != nil { diff --git a/cmd/list-azure-ad.go b/cmd/list-azure-ad.go index c53fcaa..e434465 100644 --- a/cmd/list-azure-ad.go +++ b/cmd/list-azure-ad.go @@ -59,23 +59,23 @@ func listAzureADCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAllAD(ctx context.Context, client client.AzureClient) <-chan interface{} { +func listAllAD(ctx context.Context, client client.AzureClient) <-chan any { var ( - devices = make(chan interface{}) - devices2 = make(chan interface{}) + devices = make(chan any) + devices2 = make(chan any) - groups = make(chan interface{}) - groups2 = make(chan interface{}) - groups3 = make(chan interface{}) + groups = make(chan any) + groups2 = make(chan any) + groups3 = make(chan any) - roles = make(chan interface{}) - roles2 = make(chan interface{}) + roles = make(chan any) + roles2 = make(chan any) - servicePrincipals = make(chan interface{}) - servicePrincipals2 = make(chan interface{}) - servicePrincipals3 = make(chan interface{}) + servicePrincipals = make(chan any) + servicePrincipals2 = make(chan any) + servicePrincipals3 = make(chan any) - tenants = make(chan interface{}) + tenants = make(chan any) ) // Enumerate Apps, AppOwners and AppMembers diff --git a/cmd/list-azure-rm.go b/cmd/list-azure-rm.go index de4f186..c872f61 100644 --- a/cmd/list-azure-rm.go +++ b/cmd/list-azure-rm.go @@ -61,65 +61,65 @@ func listAzureRMCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAllRM(ctx context.Context, client client.AzureClient) <-chan interface{} { +func listAllRM(ctx context.Context, client client.AzureClient) <-chan any { var ( - functionApps = make(chan interface{}) - functionApps2 = make(chan interface{}) + functionApps = make(chan any) + functionApps2 = make(chan any) - webApps = make(chan interface{}) - webApps2 = make(chan interface{}) + webApps = make(chan any) + webApps2 = make(chan any) - automationAccounts = make(chan interface{}) - automationAccounts2 = make(chan interface{}) + automationAccounts = make(chan any) + automationAccounts2 = make(chan any) - containerRegistries = make(chan interface{}) - containerRegistries2 = make(chan interface{}) + containerRegistries = make(chan any) + containerRegistries2 = make(chan any) - logicApps = make(chan interface{}) - logicApps2 = make(chan interface{}) + logicApps = make(chan any) + logicApps2 = make(chan any) - managedClusters = make(chan interface{}) - managedClusters2 = make(chan interface{}) + managedClusters = make(chan any) + managedClusters2 = make(chan any) - vmScaleSets = make(chan interface{}) - vmScaleSets2 = make(chan interface{}) + vmScaleSets = make(chan any) + vmScaleSets2 = make(chan any) - keyVaults = make(chan interface{}) - keyVaults2 = make(chan interface{}) - keyVaults3 = make(chan interface{}) + keyVaults = make(chan any) + keyVaults2 = make(chan any) + keyVaults3 = make(chan any) keyVaultRoleAssignments1 = make(chan azureWrapper[models.KeyVaultRoleAssignments]) keyVaultRoleAssignments2 = make(chan azureWrapper[models.KeyVaultRoleAssignments]) keyVaultRoleAssignments3 = make(chan azureWrapper[models.KeyVaultRoleAssignments]) keyVaultRoleAssignments4 = make(chan azureWrapper[models.KeyVaultRoleAssignments]) - mgmtGroups = make(chan interface{}) - mgmtGroups2 = make(chan interface{}) - mgmtGroups3 = make(chan interface{}) + mgmtGroups = make(chan any) + mgmtGroups2 = make(chan any) + mgmtGroups3 = make(chan any) mgmtGroupRoleAssignments1 = make(chan azureWrapper[models.ManagementGroupRoleAssignments]) mgmtGroupRoleAssignments2 = make(chan azureWrapper[models.ManagementGroupRoleAssignments]) - resourceGroups = make(chan interface{}) - resourceGroups2 = make(chan interface{}) + resourceGroups = make(chan any) + resourceGroups2 = make(chan any) resourceGroupRoleAssignments1 = make(chan azureWrapper[models.ResourceGroupRoleAssignments]) resourceGroupRoleAssignments2 = make(chan azureWrapper[models.ResourceGroupRoleAssignments]) - subscriptions = make(chan interface{}) - subscriptions2 = make(chan interface{}) - subscriptions3 = make(chan interface{}) - subscriptions4 = make(chan interface{}) - subscriptions5 = make(chan interface{}) - subscriptions6 = make(chan interface{}) - subscriptions7 = make(chan interface{}) - subscriptions8 = make(chan interface{}) - subscriptions9 = make(chan interface{}) - subscriptions10 = make(chan interface{}) - subscriptions11 = make(chan interface{}) - subscriptions12 = make(chan interface{}) - subscriptionRoleAssignments1 = make(chan interface{}) - subscriptionRoleAssignments2 = make(chan interface{}) - - virtualMachines = make(chan interface{}) - virtualMachines2 = make(chan interface{}) + subscriptions = make(chan any) + subscriptions2 = make(chan any) + subscriptions3 = make(chan any) + subscriptions4 = make(chan any) + subscriptions5 = make(chan any) + subscriptions6 = make(chan any) + subscriptions7 = make(chan any) + subscriptions8 = make(chan any) + subscriptions9 = make(chan any) + subscriptions10 = make(chan any) + subscriptions11 = make(chan any) + subscriptions12 = make(chan any) + subscriptionRoleAssignments1 = make(chan any) + subscriptionRoleAssignments2 = make(chan any) + + virtualMachines = make(chan any) + virtualMachines2 = make(chan any) virtualMachineRoleAssignments1 = make(chan azureWrapper[models.VirtualMachineRoleAssignments]) virtualMachineRoleAssignments2 = make(chan azureWrapper[models.VirtualMachineRoleAssignments]) virtualMachineRoleAssignments3 = make(chan azureWrapper[models.VirtualMachineRoleAssignments]) diff --git a/cmd/list-device-owners_test.go b/cmd/list-device-owners_test.go index 5f0dc3e..765ef78 100644 --- a/cmd/list-device-owners_test.go +++ b/cmd/list-device-owners_test.go @@ -40,7 +40,7 @@ func TestListDeviceOwners(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockDevicesChannel := make(chan interface{}) + mockDevicesChannel := make(chan any) mockDeviceOwnerChannel := make(chan azure.DeviceRegisteredOwnerResult) mockDeviceOwnerChannel2 := make(chan azure.DeviceRegisteredOwnerResult) diff --git a/cmd/list-group-members_test.go b/cmd/list-group-members_test.go index f3cf088..42cfa51 100644 --- a/cmd/list-group-members_test.go +++ b/cmd/list-group-members_test.go @@ -40,7 +40,7 @@ func TestListGroupMembers(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockGroupsChannel := make(chan interface{}) + mockGroupsChannel := make(chan any) mockGroupMemberChannel := make(chan azure.MemberObjectResult) mockGroupMemberChannel2 := make(chan azure.MemberObjectResult) diff --git a/cmd/list-group-owners_test.go b/cmd/list-group-owners_test.go index b1e7eea..9478254 100644 --- a/cmd/list-group-owners_test.go +++ b/cmd/list-group-owners_test.go @@ -40,7 +40,7 @@ func TestListGroupOwners(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockGroupsChannel := make(chan interface{}) + mockGroupsChannel := make(chan any) mockGroupOwnerChannel := make(chan azure.GroupOwnerResult) mockGroupOwnerChannel2 := make(chan azure.GroupOwnerResult) diff --git a/cmd/list-key-vault-access-policies_test.go b/cmd/list-key-vault-access-policies_test.go index 877fe1f..8393856 100644 --- a/cmd/list-key-vault-access-policies_test.go +++ b/cmd/list-key-vault-access-policies_test.go @@ -38,7 +38,7 @@ func TestListKeyVaultAccessPolicies(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockKeyVaultsChannel := make(chan interface{}) + mockKeyVaultsChannel := make(chan any) mockTenant := azure.Tenant{} mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes() channel := listKeyVaultAccessPolicies(ctx, mockClient, mockKeyVaultsChannel, nil) diff --git a/cmd/list-key-vault-role-assignments.go b/cmd/list-key-vault-role-assignments.go index ee14b05..fa2520b 100644 --- a/cmd/list-key-vault-role-assignments.go +++ b/cmd/list-key-vault-role-assignments.go @@ -58,7 +58,7 @@ func listKeyVaultRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listKeyVaultRoleAssignments(ctx context.Context, client client.AzureClient, keyVaults <-chan interface{}) <-chan azureWrapper[models.KeyVaultRoleAssignments] { +func listKeyVaultRoleAssignments(ctx context.Context, client client.AzureClient, keyVaults <-chan any) <-chan azureWrapper[models.KeyVaultRoleAssignments] { var ( out = make(chan azureWrapper[models.KeyVaultRoleAssignments]) ids = make(chan string) diff --git a/cmd/list-key-vault-role-assignments_test.go b/cmd/list-key-vault-role-assignments_test.go index db7e4c3..4de6772 100644 --- a/cmd/list-key-vault-role-assignments_test.go +++ b/cmd/list-key-vault-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListKeyVaultRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockKeyVaultsChannel := make(chan interface{}) + mockKeyVaultsChannel := make(chan any) mockKeyVaultRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockKeyVaultRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-key-vaults_test.go b/cmd/list-key-vaults_test.go index 269288a..a898837 100644 --- a/cmd/list-key-vaults_test.go +++ b/cmd/list-key-vaults_test.go @@ -39,7 +39,7 @@ func TestListKeyVaults(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockSubscriptionsChannel := make(chan interface{}) + mockSubscriptionsChannel := make(chan any) mockKeyVaultChannel := make(chan azure.KeyVaultResult) mockKeyVaultChannel2 := make(chan azure.KeyVaultResult) diff --git a/cmd/list-management-group-descendants_test.go b/cmd/list-management-group-descendants_test.go index 01806b1..99bd0ec 100644 --- a/cmd/list-management-group-descendants_test.go +++ b/cmd/list-management-group-descendants_test.go @@ -39,7 +39,7 @@ func TestListManagementGroupDescendants(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockManagementGroupsChannel := make(chan interface{}) + mockManagementGroupsChannel := make(chan any) mockManagementGroupDescendantChannel := make(chan azure.DescendantInfoResult) mockManagementGroupDescendantChannel2 := make(chan azure.DescendantInfoResult) diff --git a/cmd/list-management-group-role-assignments.go b/cmd/list-management-group-role-assignments.go index 3d07121..950a85a 100644 --- a/cmd/list-management-group-role-assignments.go +++ b/cmd/list-management-group-role-assignments.go @@ -58,7 +58,7 @@ func listManagementGroupRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string log.Info("collection completed", "duration", duration.String()) } -func listManagementGroupRoleAssignments(ctx context.Context, client client.AzureClient, managementGroups <-chan interface{}) <-chan azureWrapper[models.ManagementGroupRoleAssignments] { +func listManagementGroupRoleAssignments(ctx context.Context, client client.AzureClient, managementGroups <-chan any) <-chan azureWrapper[models.ManagementGroupRoleAssignments] { var ( out = make(chan azureWrapper[models.ManagementGroupRoleAssignments]) ids = make(chan string) diff --git a/cmd/list-management-group-role-assignments_test.go b/cmd/list-management-group-role-assignments_test.go index eed6954..da18ab7 100644 --- a/cmd/list-management-group-role-assignments_test.go +++ b/cmd/list-management-group-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListResourceGroupRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockResourceGroupsChannel := make(chan interface{}) + mockResourceGroupsChannel := make(chan any) mockResourceGroupRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockResourceGroupRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-resource-group-role-assignments.go b/cmd/list-resource-group-role-assignments.go index 055d3e0..b131def 100644 --- a/cmd/list-resource-group-role-assignments.go +++ b/cmd/list-resource-group-role-assignments.go @@ -59,7 +59,7 @@ func listResourceGroupRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) log.Info("collection completed", "duration", duration.String()) } -func listResourceGroupRoleAssignments(ctx context.Context, client client.AzureClient, resourceGroups <-chan interface{}) <-chan azureWrapper[models.ResourceGroupRoleAssignments] { +func listResourceGroupRoleAssignments(ctx context.Context, client client.AzureClient, resourceGroups <-chan any) <-chan azureWrapper[models.ResourceGroupRoleAssignments] { var ( out = make(chan azureWrapper[models.ResourceGroupRoleAssignments]) ids = make(chan string) diff --git a/cmd/list-resource-group-role-assignments_test.go b/cmd/list-resource-group-role-assignments_test.go index 5c8c8bb..f8271f6 100644 --- a/cmd/list-resource-group-role-assignments_test.go +++ b/cmd/list-resource-group-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListManagementGroupRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockManagementGroupsChannel := make(chan interface{}) + mockManagementGroupsChannel := make(chan any) mockManagementGroupRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockManagementGroupRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-resource-groups_test.go b/cmd/list-resource-groups_test.go index 78ac328..665ec2f 100644 --- a/cmd/list-resource-groups_test.go +++ b/cmd/list-resource-groups_test.go @@ -39,7 +39,7 @@ func TestListResourceGroups(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockSubscriptionsChannel := make(chan interface{}) + mockSubscriptionsChannel := make(chan any) mockResourceGroupChannel := make(chan azure.ResourceGroupResult) mockResourceGroupChannel2 := make(chan azure.ResourceGroupResult) diff --git a/cmd/list-root.go b/cmd/list-root.go index fb0d05d..e4f8660 100644 --- a/cmd/list-root.go +++ b/cmd/list-root.go @@ -61,7 +61,7 @@ func listCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAll(ctx context.Context, client client.AzureClient) <-chan interface{} { +func listAll(ctx context.Context, client client.AzureClient) <-chan any { var ( azureAD = listAllAD(ctx, client) azureRM = listAllRM(ctx, client) diff --git a/cmd/list-service-principal-owners_test.go b/cmd/list-service-principal-owners_test.go index 1dff1d1..ec4ddfc 100644 --- a/cmd/list-service-principal-owners_test.go +++ b/cmd/list-service-principal-owners_test.go @@ -40,7 +40,7 @@ func TestListServicePrincipalOwners(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockServicePrincipalsChannel := make(chan interface{}) + mockServicePrincipalsChannel := make(chan any) mockServicePrincipalOwnerChannel := make(chan azure.ServicePrincipalOwnerResult) mockServicePrincipalOwnerChannel2 := make(chan azure.ServicePrincipalOwnerResult) diff --git a/cmd/list-subscription-owners_test.go b/cmd/list-subscription-owners_test.go index 7850fef..b52142c 100644 --- a/cmd/list-subscription-owners_test.go +++ b/cmd/list-subscription-owners_test.go @@ -39,7 +39,7 @@ func TestListSubscriptionOwners(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockRoleAssignmentsChannel := make(chan interface{}) + mockRoleAssignmentsChannel := make(chan any) mockTenant := azure.Tenant{} mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes() channel := listSubscriptionOwners(ctx, mockClient, mockRoleAssignmentsChannel) diff --git a/cmd/list-subscription-role-assignments_test.go b/cmd/list-subscription-role-assignments_test.go index 1902684..308eab7 100644 --- a/cmd/list-subscription-role-assignments_test.go +++ b/cmd/list-subscription-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListSubscriptionRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockSubscriptionsChannel := make(chan interface{}) + mockSubscriptionsChannel := make(chan any) mockSubscriptionRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockSubscriptionRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-subscription-user-access-admins_test.go b/cmd/list-subscription-user-access-admins_test.go index 1a6a8dc..5dd5410 100644 --- a/cmd/list-subscription-user-access-admins_test.go +++ b/cmd/list-subscription-user-access-admins_test.go @@ -39,7 +39,7 @@ func TestListSubscriptionUserAccessAdmins(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockRoleAssignmentsChannel := make(chan interface{}) + mockRoleAssignmentsChannel := make(chan any) mockTenant := azure.Tenant{} mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes() channel := listSubscriptionUserAccessAdmins(ctx, mockClient, mockRoleAssignmentsChannel) diff --git a/cmd/list-virtual-machine-role-assignments.go b/cmd/list-virtual-machine-role-assignments.go index d826a3f..65f1450 100644 --- a/cmd/list-virtual-machine-role-assignments.go +++ b/cmd/list-virtual-machine-role-assignments.go @@ -58,7 +58,7 @@ func listVirtualMachineRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) log.Info("collection completed", "duration", duration.String()) } -func listVirtualMachineRoleAssignments(ctx context.Context, client client.AzureClient, virtualMachines <-chan interface{}) <-chan azureWrapper[models.VirtualMachineRoleAssignments] { +func listVirtualMachineRoleAssignments(ctx context.Context, client client.AzureClient, virtualMachines <-chan any) <-chan azureWrapper[models.VirtualMachineRoleAssignments] { var ( out = make(chan azureWrapper[models.VirtualMachineRoleAssignments]) ids = make(chan string) diff --git a/cmd/list-virtual-machine-role-assignments_test.go b/cmd/list-virtual-machine-role-assignments_test.go index dffaf79..69cfb2d 100644 --- a/cmd/list-virtual-machine-role-assignments_test.go +++ b/cmd/list-virtual-machine-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListVirtualMachineRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockVirtualMachinesChannel := make(chan interface{}) + mockVirtualMachinesChannel := make(chan any) mockVirtualMachineRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockVirtualMachineRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-virtual-machines_test.go b/cmd/list-virtual-machines_test.go index 58b9113..39fcb63 100644 --- a/cmd/list-virtual-machines_test.go +++ b/cmd/list-virtual-machines_test.go @@ -39,7 +39,7 @@ func TestListVirtualMachines(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockSubscriptionsChannel := make(chan interface{}) + mockSubscriptionsChannel := make(chan any) mockVirtualMachineChannel := make(chan azure.VirtualMachineResult) mockVirtualMachineChannel2 := make(chan azure.VirtualMachineResult) diff --git a/cmd/start.go b/cmd/start.go index 064fce3..d9fc245 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -177,7 +177,7 @@ func start(ctx context.Context) { } } -func ingest(ctx context.Context, bheUrl url.URL, bheClient *http.Client, in <-chan []interface{}) bool { +func ingest(ctx context.Context, bheUrl url.URL, bheClient *http.Client, in <-chan []any) bool { endpoint := bheUrl.ResolveReference(&url.URL{Path: "/api/v2/ingest"}) var ( diff --git a/cmd/utils.go b/cmd/utils.go index fd59f82..8126e05 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -423,8 +423,8 @@ func setupLogger() { // deprecated: use azureWrapper instead type AzureWrapper struct { - Kind enums.Kind `json:"kind"` - Data interface{} `json:"data"` + Kind enums.Kind `json:"kind"` + Data any `json:"data"` } type azureWrapper[T any] struct { diff --git a/config/internal/config.go b/config/internal/config.go index bf45a9e..81cc1de 100644 --- a/config/internal/config.go +++ b/config/internal/config.go @@ -35,10 +35,10 @@ type Config struct { Usage string Required bool Persistent bool - Default interface{} + Default any } -func (s Config) Value() interface{} { +func (s Config) Value() any { if reflect.ValueOf(s.Default).Kind() == reflect.Slice { return viper.GetStringSlice(s.Name) } else { @@ -46,7 +46,7 @@ func (s Config) Value() interface{} { } } -func (s Config) Set(value interface{}) { +func (s Config) Set(value any) { viper.Set(s.Name, value) } diff --git a/logger/internal/logger.go b/logger/internal/logger.go index e27fa5c..be9bacc 100644 --- a/logger/internal/logger.go +++ b/logger/internal/logger.go @@ -101,7 +101,7 @@ func (s logSink) Enabled(level int) bool { // Error logs an error, with the given message and key/value pairs as // context. See logr.Logger.Error for more details. -func (s logSink) Error(err error, msg string, keysAndValues ...interface{}) { +func (s logSink) Error(err error, msg string, keysAndValues ...any) { logEvent := s.logger.Error().Err(err) s.log(logEvent, msg, keysAndValues) } @@ -110,7 +110,7 @@ func (s logSink) Error(err error, msg string, keysAndValues ...interface{}) { // The level argument is provided for optional logging. This method will // only be called when Enabled(level) is true. See logr.Logger.Info for more // details. -func (s logSink) Info(level int, msg string, keysAndValues ...interface{}) { +func (s logSink) Info(level int, msg string, keysAndValues ...any) { lvl := calcLevel(level) logEvent := s.logger.WithLevel(lvl) s.log(logEvent, msg, keysAndValues) @@ -131,7 +131,7 @@ func (s logSink) WithName(name string) logr.LogSink { // WithValues returns a new logr.LogSink with additional key/value pairs. See // logr.Logger.WithValues for more details. -func (s logSink) WithValues(keysAndValues ...interface{}) logr.LogSink { +func (s logSink) WithValues(keysAndValues ...any) logr.LogSink { logger := s.logger.With().Fields(keysAndValues).Logger() s.logger = &logger return &s @@ -153,7 +153,7 @@ func (s logSink) WithCallDepth(depth int) logr.LogSink { return &s } -func (s logSink) log(e *zerolog.Event, msg string, keysAndValues []interface{}) { +func (s logSink) log(e *zerolog.Event, msg string, keysAndValues []any) { if e != nil { if s.name != "" { e.Str("name", s.name) diff --git a/models/azure/app_role_assignment.go b/models/azure/app_role_assignment.go index dab358b..1b840c3 100644 --- a/models/azure/app_role_assignment.go +++ b/models/azure/app_role_assignment.go @@ -22,7 +22,6 @@ import "github.com/gofrs/uuid" // Represents an application role that can be requested by (and granted to) a client application, or that can be used to // assign an application to users or groups in a specified role. // -// // An app role assignment is a relationship between the assigned principal (a user, a group, or a service principal), // a resource application (the app's service principal) and an app role defined on the resource application. // diff --git a/models/azure/app_scope.go b/models/azure/app_scope.go index de8f8fb..ea0f826 100644 --- a/models/azure/app_scope.go +++ b/models/azure/app_scope.go @@ -23,8 +23,8 @@ package azure // // This may be in both the following principal and scope scenarios: // -// A single principal and a single scope -// Multiple principals and multiple scopes. +// A single principal and a single scope +// Multiple principals and multiple scopes. type AppScope struct { Entity diff --git a/models/azure/cloning_info.go b/models/azure/cloning_info.go index 8d42ec0..b3f38b9 100644 --- a/models/azure/cloning_info.go +++ b/models/azure/cloning_info.go @@ -18,15 +18,15 @@ package azure type CloningInfo struct { - AppSettingsOverrides interface{} `json:"appSettingsOverrides,omitempty"` - CloneCustomHostNames bool `json:"cloneCustomHostNames,omitempty"` - CloneSourceControl bool `json:"cloneSourceControl,omitempty"` - ConfigureLoadBalancing bool `json:"configureLoadBalancing,omitempty"` - CorrelationId string `json:"correlationId,omitempty"` - HostingEnvironment string `json:"hostingEnvironment,omitempty"` - Overwrite bool `json:"overwrite,omitempty"` - SourceWebAppId string `json:"sourceWebAppId,omitempty"` - SourceWebAppLocation string `json:"sourceWebAppLocation,omitempty"` - TrafficManagerProfileId string `json:"trafficManagerProfileId,omitempty"` - TrafficManagerProfileName string `json:"trafficManagerProfileName,omitempty"` + AppSettingsOverrides any `json:"appSettingsOverrides,omitempty"` + CloneCustomHostNames bool `json:"cloneCustomHostNames,omitempty"` + CloneSourceControl bool `json:"cloneSourceControl,omitempty"` + ConfigureLoadBalancing bool `json:"configureLoadBalancing,omitempty"` + CorrelationId string `json:"correlationId,omitempty"` + HostingEnvironment string `json:"hostingEnvironment,omitempty"` + Overwrite bool `json:"overwrite,omitempty"` + SourceWebAppId string `json:"sourceWebAppId,omitempty"` + SourceWebAppLocation string `json:"sourceWebAppLocation,omitempty"` + TrafficManagerProfileId string `json:"trafficManagerProfileId,omitempty"` + TrafficManagerProfileName string `json:"trafficManagerProfileName,omitempty"` } diff --git a/models/azure/ip_security_restriction.go b/models/azure/ip_security_restriction.go index 414d6d2..2cf987e 100644 --- a/models/azure/ip_security_restriction.go +++ b/models/azure/ip_security_restriction.go @@ -22,7 +22,7 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type IpSecurityRestriction struct { Action string `json:"action,omitempty"` Description string `json:"description,omitempty"` - Headers interface{} `json:"headers,omitempty"` + Headers any `json:"headers,omitempty"` IpAddress string `json:"ipAddress,omitempty"` Name string `json:"name,omitempty"` Priority int `json:"priority,omitempty"` diff --git a/models/azure/logic_app_definition.go b/models/azure/logic_app_definition.go index 2cff0bb..1135a52 100644 --- a/models/azure/logic_app_definition.go +++ b/models/azure/logic_app_definition.go @@ -21,7 +21,7 @@ type Definition struct { Schema string `json:"$schema,omitempty"` // Certain actions can be nested, have different elements based on the name(key) of given action - Condition is an example // Actions map[string]Action `json:"actions,omitempty"` - Actions map[string]interface{} `json:"actions,omitempty"` + Actions map[string]any `json:"actions,omitempty"` ContentVersion string `json:"contentVersion,omitempty"` Outputs map[string]Output `json:"outputs,omitempty"` Parameters map[string]Parameter `json:"parameters,omitempty"` @@ -32,28 +32,28 @@ type Definition struct { type Action struct { Type string `json:"type"` // Kind is missing in the MSDN, but returned and present in examples and during testing - Kind string `json:"kind,omitempty"` - Inputs map[string]interface{} `json:"inputs,omitempty"` - RunAfter interface{} `json:"runAfter,omitempty"` - RuntimeConfiguration interface{} `json:"runtimeConfiguration,omitempty"` - OperationOptions string `json:"operationOptions,omitempty"` + Kind string `json:"kind,omitempty"` + Inputs map[string]any `json:"inputs,omitempty"` + RunAfter any `json:"runAfter,omitempty"` + RuntimeConfiguration any `json:"runtimeConfiguration,omitempty"` + OperationOptions string `json:"operationOptions,omitempty"` } type Output struct { Type string `json:"type,omitempty"` // Type of this is based on above Type - Value interface{} `json:"value,omitempty"` + Value any `json:"value,omitempty"` } type Parameter struct { - Type string `json:"type,omitempty"` - DefaultValue interface{} `json:"defaultValue,omitempty"` - AllowedValues []interface{} `json:"allowedValues,omitempty"` - Metadata Metadata `json:"metadata,omitempty"` + Type string `json:"type,omitempty"` + DefaultValue any `json:"defaultValue,omitempty"` + AllowedValues []any `json:"allowedValues,omitempty"` + Metadata Metadata `json:"metadata,omitempty"` } type Metadata struct { - Description interface{} `json:"description,omitempty"` + Description any `json:"description,omitempty"` } type StaticResult struct { @@ -71,13 +71,13 @@ type Trigger struct { // Kind is missing in the MSDN, but returned and present in examples and during testing Kind string `json:"kind,omitempty"` // Inputs is a custom element based on the type of trigger - Inputs interface{} `json:"inputs,omitempty"` + Inputs any `json:"inputs,omitempty"` Recurrence Recurrence `json:"recurrence,omitempty"` Conditions []Condition `json:"conditions,omitempty"` // Runtime configuration is a custom element based on the type of trigger - RuntimeConfiguration interface{} `json:"runtimeConfiguration,omitempty"` - SplitOn string `json:"splitOn,omitempty"` - OperationOptions string `json:"operationOptions,omitempty"` + RuntimeConfiguration any `json:"runtimeConfiguration,omitempty"` + SplitOn string `json:"splitOn,omitempty"` + OperationOptions string `json:"operationOptions,omitempty"` } type Recurrence struct { diff --git a/models/azure/logic_app_parameter.go b/models/azure/logic_app_parameter.go index 8cfc424..d69a0b6 100644 --- a/models/azure/logic_app_parameter.go +++ b/models/azure/logic_app_parameter.go @@ -24,15 +24,15 @@ import ( type LogicAppParameter struct { Description string `json:"description,omitempty"` //Metadata - marked as object in MSDN, however no other description available - in testing was not able to return a value here - Metadata interface{} `json:"metadata,omitempty"` + Metadata any `json:"metadata,omitempty"` Type enums.ParameterType `json:"type,omitempty"` - Value interface{} `json:"value,omitempty"` + Value any `json:"value,omitempty"` } -func (s LogicAppParameter) GetValue() interface{} { +func (s LogicAppParameter) GetValue() any { switch s.Type { case enums.ArrayType: - return s.Value.([]interface{}) + return s.Value.([]any) case enums.BoolType: return s.Value.(bool) case enums.FloatType: diff --git a/models/azure/site_config.go b/models/azure/site_config.go index ad1b4a8..cd45801 100644 --- a/models/azure/site_config.go +++ b/models/azure/site_config.go @@ -89,26 +89,26 @@ type SiteConfig struct { XManagedServiceIdentityId int `json:"xManagedServiceIdentityId,omitempty"` //Following ones have been found in testing, but not present in the documentation - AntivirusScanEnabled bool `json:"antivirusScanEnabled,omitempty"` - AzureMonitorLogCategories interface{} `json:"azureMonitorLogCategories,omitempty"` - CustomAppPoolIdentityAdminState interface{} `json:"customAppPoolIdentityAdminState,omitempty"` - CustomAppPoolIdentityTenantState interface{} `json:"customAppPoolIdentityTenantState,omitempty"` - ElasticWebAppScaleLimit interface{} `json:"elasticWebAppScaleLimit,omitempty"` - FileChangeAuditEnabled bool `json:"fileChangeAuditEnabled,omitempty"` - Http20ProxyFlag interface{} `json:"http20ProxyFlag,omitempty"` - IpSecurityRestrictionsDefaultAction interface{} `json:"ipSecurityRestrictionsDefaultAction,omitempty"` - Metadata interface{} `json:"metadata,omitempty"` - MinTlsCipherSuite interface{} `json:"minTlsCipherSuite,omitempty"` - PublishingPassword interface{} `json:"publishingPassword,omitempty"` - RoutingRules interface{} `json:"routingRules,omitempty"` - RuntimeADUser interface{} `json:"runtimeADUser,omitempty"` - RuntimeADUserPassword interface{} `json:"runtimeADUserPassword,omitempty"` - ScmIpSecurityRestrictionsDefaultAction interface{} `json:"scmIpSecurityRestrictionsDefaultAction,omitempty"` - SitePort interface{} `json:"sitePort,omitempty"` - StorageType interface{} `json:"storageType,omitempty"` - SupportedTlsCipherSuites interface{} `json:"supportedTlsCipherSuites,omitempty"` - WinAuthAdminState interface{} `json:"winAuthAdminState,omitempty"` - WinAuthTenantState interface{} `json:"winAuthTenantState,omitempty"` + AntivirusScanEnabled bool `json:"antivirusScanEnabled,omitempty"` + AzureMonitorLogCategories any `json:"azureMonitorLogCategories,omitempty"` + CustomAppPoolIdentityAdminState any `json:"customAppPoolIdentityAdminState,omitempty"` + CustomAppPoolIdentityTenantState any `json:"customAppPoolIdentityTenantState,omitempty"` + ElasticWebAppScaleLimit any `json:"elasticWebAppScaleLimit,omitempty"` + FileChangeAuditEnabled bool `json:"fileChangeAuditEnabled,omitempty"` + Http20ProxyFlag any `json:"http20ProxyFlag,omitempty"` + IpSecurityRestrictionsDefaultAction any `json:"ipSecurityRestrictionsDefaultAction,omitempty"` + Metadata any `json:"metadata,omitempty"` + MinTlsCipherSuite any `json:"minTlsCipherSuite,omitempty"` + PublishingPassword any `json:"publishingPassword,omitempty"` + RoutingRules any `json:"routingRules,omitempty"` + RuntimeADUser any `json:"runtimeADUser,omitempty"` + RuntimeADUserPassword any `json:"runtimeADUserPassword,omitempty"` + ScmIpSecurityRestrictionsDefaultAction any `json:"scmIpSecurityRestrictionsDefaultAction,omitempty"` + SitePort any `json:"sitePort,omitempty"` + StorageType any `json:"storageType,omitempty"` + SupportedTlsCipherSuites any `json:"supportedTlsCipherSuites,omitempty"` + WinAuthAdminState any `json:"winAuthAdminState,omitempty"` + WinAuthTenantState any `json:"winAuthTenantState,omitempty"` } type ApiDefinitionInfo struct { diff --git a/models/azure/storage_container_props.go b/models/azure/storage_container_props.go index d22a34a..14724d1 100644 --- a/models/azure/storage_container_props.go +++ b/models/azure/storage_container_props.go @@ -35,7 +35,7 @@ type StorageContainerProperties struct { LeaseState enums.LeaseState `json:"leaseState,omitempty"` LeaseStatus enums.LeaseStatus `json:"leaseStatus,omitempty"` LegalHold LegalHoldProperties `json:"legalHold,omitempty"` - Metadata interface{} `json:"metadata,omitempty"` + Metadata any `json:"metadata,omitempty"` PublicAccess enums.PublicAccess `json:"publicAccess,omitempty"` RemainingRetentionDays int `json:"remainingRetentionDays,omitempty"` Version string `json:"version,omitempty"` diff --git a/models/ingest-request.go b/models/ingest-request.go index 6ba0dba..98d955f 100644 --- a/models/ingest-request.go +++ b/models/ingest-request.go @@ -18,8 +18,8 @@ package models type IngestRequest struct { - Meta Meta `json:"meta"` - Data interface{} `json:"data"` + Meta Meta `json:"meta"` + Data any `json:"data"` } type Meta struct { diff --git a/pipeline/pipeline_test.go b/pipeline/pipeline_test.go index 07c3617..a112ebc 100644 --- a/pipeline/pipeline_test.go +++ b/pipeline/pipeline_test.go @@ -28,7 +28,7 @@ import ( func TestBatch(t *testing.T) { - done := make(chan interface{}) + done := make(chan any) in := make(chan string) go func() { @@ -71,7 +71,7 @@ func TestBatch(t *testing.T) { func TestDemux(t *testing.T) { var ( - done = make(chan interface{}) + done = make(chan any) in = make(chan string) wg sync.WaitGroup count int From e433482593cc621cdb7c7f6bb4e9a2dc8fdd9e45 Mon Sep 17 00:00:00 2001 From: Alyx Holms Date: Tue, 7 Nov 2023 12:05:41 -0700 Subject: [PATCH 9/9] chore: revert to last known good commit chore: keep SendAny improvement and remove the unnecessary type casting --- client/client.go | 2 +- client/mocks/client.go | 130 +++++++++--------- client/rest/client.go | 18 +-- client/rest/http.go | 2 +- client/rest/mocks/client.go | 20 +-- client/rest/utils.go | 10 +- cmd/list-app-role-assignments.go | 13 +- ...ist-automation-account-role-assignments.go | 9 +- cmd/list-automation-accounts.go | 9 +- cmd/list-azure-ad.go | 24 ++-- cmd/list-azure-rm.go | 80 +++++------ cmd/list-container-registries.go | 9 +- ...ist-container-registry-role-assignments.go | 9 +- cmd/list-device-owners.go | 9 +- cmd/list-device-owners_test.go | 2 +- cmd/list-devices.go | 13 +- cmd/list-function-app-role-assignments.go | 9 +- cmd/list-function-apps.go | 9 +- cmd/list-group-members.go | 9 +- cmd/list-group-members_test.go | 2 +- cmd/list-group-owners.go | 9 +- cmd/list-group-owners_test.go | 2 +- cmd/list-groups.go | 9 +- cmd/list-key-vault-access-policies.go | 23 ++-- cmd/list-key-vault-access-policies_test.go | 2 +- cmd/list-key-vault-role-assignments.go | 2 +- cmd/list-key-vault-role-assignments_test.go | 2 +- cmd/list-key-vaults.go | 9 +- cmd/list-key-vaults_test.go | 2 +- cmd/list-logic-app-role-assignments.go | 9 +- cmd/list-logic-apps.go | 9 +- cmd/list-managed-cluster-role-assignments.go | 9 +- cmd/list-managed-clusters.go | 9 +- cmd/list-management-group-descendants.go | 9 +- cmd/list-management-group-descendants_test.go | 2 +- cmd/list-management-group-role-assignments.go | 2 +- ...-management-group-role-assignments_test.go | 2 +- cmd/list-management-groups.go | 9 +- cmd/list-resource-group-role-assignments.go | 2 +- ...st-resource-group-role-assignments_test.go | 2 +- cmd/list-resource-groups.go | 9 +- cmd/list-resource-groups_test.go | 2 +- cmd/list-role-assignments.go | 9 +- cmd/list-roles.go | 13 +- cmd/list-root.go | 2 +- cmd/list-service-principal-owners.go | 9 +- cmd/list-service-principal-owners_test.go | 2 +- cmd/list-service-principals.go | 13 +- cmd/list-storage-account-role-assignments.go | 9 +- cmd/list-storage-accounts.go | 9 +- cmd/list-storage-containers.go | 11 +- cmd/list-subscription-owners.go | 9 +- cmd/list-subscription-owners_test.go | 2 +- cmd/list-subscription-role-assignments.go | 9 +- ...list-subscription-role-assignments_test.go | 2 +- cmd/list-subscription-user-access-admins.go | 9 +- ...st-subscription-user-access-admins_test.go | 2 +- cmd/list-subscriptions.go | 9 +- cmd/list-tenants.go | 22 +-- cmd/list-users.go | 9 +- cmd/list-virtual-machine-role-assignments.go | 2 +- ...t-virtual-machine-role-assignments_test.go | 2 +- cmd/list-virtual-machines.go | 9 +- cmd/list-virtual-machines_test.go | 2 +- cmd/list-vm-scale-set-role-assignments.go | 9 +- cmd/list-vm-scale-sets.go | 9 +- cmd/list-web-app-role-assignments.go | 9 +- cmd/list-web-apps.go | 9 +- cmd/start.go | 2 +- cmd/utils.go | 4 +- config/internal/config.go | 6 +- logger/internal/logger.go | 8 +- models/azure/app_role_assignment.go | 1 + models/azure/app_scope.go | 4 +- models/azure/cloning_info.go | 22 +-- models/azure/ip_security_restriction.go | 2 +- models/azure/logic_app_definition.go | 32 ++--- models/azure/logic_app_parameter.go | 8 +- models/azure/site_config.go | 40 +++--- models/azure/storage_container_props.go | 2 +- models/ingest-request.go | 4 +- pipeline/pipeline.go | 2 +- pipeline/pipeline_test.go | 4 +- 83 files changed, 487 insertions(+), 378 deletions(-) diff --git a/client/client.go b/client/client.go index 8b6ba79..03e5a76 100644 --- a/client/client.go +++ b/client/client.go @@ -55,7 +55,7 @@ func NewClient(config config.Config) (AzureClient, error) { } } -func initClientViaRM(msgraph, resourceManager rest.RestClient, tid any) (AzureClient, error) { +func initClientViaRM(msgraph, resourceManager rest.RestClient, tid interface{}) (AzureClient, error) { client := &azureClient{ msgraph: msgraph, resourceManager: resourceManager, diff --git a/client/mocks/client.go b/client/mocks/client.go index 83b9115..fa2ca60 100644 --- a/client/mocks/client.go +++ b/client/mocks/client.go @@ -58,7 +58,7 @@ func (m *MockAzureClient) GetAzureADApp(arg0 context.Context, arg1 string, arg2 } // GetAzureADApp indicates an expected call of GetAzureADApp. -func (mr *MockAzureClientMockRecorder) GetAzureADApp(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADApp(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADApp", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADApp), arg0, arg1, arg2) } @@ -73,7 +73,7 @@ func (m *MockAzureClient) GetAzureADApps(arg0 context.Context, arg1, arg2, arg3, } // GetAzureADApps indicates an expected call of GetAzureADApps. -func (mr *MockAzureClientMockRecorder) GetAzureADApps(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADApps(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADApps", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADApps), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -88,7 +88,7 @@ func (m *MockAzureClient) GetAzureADDirectoryObject(arg0 context.Context, arg1 s } // GetAzureADDirectoryObject indicates an expected call of GetAzureADDirectoryObject. -func (mr *MockAzureClientMockRecorder) GetAzureADDirectoryObject(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADDirectoryObject(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADDirectoryObject", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADDirectoryObject), arg0, arg1) } @@ -103,7 +103,7 @@ func (m *MockAzureClient) GetAzureADGroup(arg0 context.Context, arg1 string, arg } // GetAzureADGroup indicates an expected call of GetAzureADGroup. -func (mr *MockAzureClientMockRecorder) GetAzureADGroup(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADGroup(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADGroup", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADGroup), arg0, arg1, arg2) } @@ -118,7 +118,7 @@ func (m *MockAzureClient) GetAzureADGroupOwners(arg0 context.Context, arg1, arg2 } // GetAzureADGroupOwners indicates an expected call of GetAzureADGroupOwners. -func (mr *MockAzureClientMockRecorder) GetAzureADGroupOwners(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADGroupOwners(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADGroupOwners", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADGroupOwners), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -133,7 +133,7 @@ func (m *MockAzureClient) GetAzureADGroups(arg0 context.Context, arg1, arg2, arg } // GetAzureADGroups indicates an expected call of GetAzureADGroups. -func (mr *MockAzureClientMockRecorder) GetAzureADGroups(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADGroups(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADGroups", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADGroups), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -148,7 +148,7 @@ func (m *MockAzureClient) GetAzureADOrganization(arg0 context.Context, arg1 []st } // GetAzureADOrganization indicates an expected call of GetAzureADOrganization. -func (mr *MockAzureClientMockRecorder) GetAzureADOrganization(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADOrganization(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADOrganization", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADOrganization), arg0, arg1) } @@ -163,7 +163,7 @@ func (m *MockAzureClient) GetAzureADRole(arg0 context.Context, arg1 string, arg2 } // GetAzureADRole indicates an expected call of GetAzureADRole. -func (mr *MockAzureClientMockRecorder) GetAzureADRole(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADRole(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADRole", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADRole), arg0, arg1, arg2) } @@ -178,7 +178,7 @@ func (m *MockAzureClient) GetAzureADRoleAssignment(arg0 context.Context, arg1 st } // GetAzureADRoleAssignment indicates an expected call of GetAzureADRoleAssignment. -func (mr *MockAzureClientMockRecorder) GetAzureADRoleAssignment(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADRoleAssignment(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADRoleAssignment", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADRoleAssignment), arg0, arg1, arg2) } @@ -193,7 +193,7 @@ func (m *MockAzureClient) GetAzureADRoleAssignments(arg0 context.Context, arg1, } // GetAzureADRoleAssignments indicates an expected call of GetAzureADRoleAssignments. -func (mr *MockAzureClientMockRecorder) GetAzureADRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADRoleAssignments), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -208,7 +208,7 @@ func (m *MockAzureClient) GetAzureADRoles(arg0 context.Context, arg1, arg2 strin } // GetAzureADRoles indicates an expected call of GetAzureADRoles. -func (mr *MockAzureClientMockRecorder) GetAzureADRoles(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADRoles(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADRoles", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADRoles), arg0, arg1, arg2) } @@ -223,7 +223,7 @@ func (m *MockAzureClient) GetAzureADServicePrincipal(arg0 context.Context, arg1 } // GetAzureADServicePrincipal indicates an expected call of GetAzureADServicePrincipal. -func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipal(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipal(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADServicePrincipal", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADServicePrincipal), arg0, arg1, arg2) } @@ -238,7 +238,7 @@ func (m *MockAzureClient) GetAzureADServicePrincipalOwners(arg0 context.Context, } // GetAzureADServicePrincipalOwners indicates an expected call of GetAzureADServicePrincipalOwners. -func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipalOwners(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipalOwners(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADServicePrincipalOwners", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADServicePrincipalOwners), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -253,7 +253,7 @@ func (m *MockAzureClient) GetAzureADServicePrincipals(arg0 context.Context, arg1 } // GetAzureADServicePrincipals indicates an expected call of GetAzureADServicePrincipals. -func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipals(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADServicePrincipals(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADServicePrincipals", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADServicePrincipals), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -268,7 +268,7 @@ func (m *MockAzureClient) GetAzureADTenants(arg0 context.Context, arg1 bool) (az } // GetAzureADTenants indicates an expected call of GetAzureADTenants. -func (mr *MockAzureClientMockRecorder) GetAzureADTenants(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADTenants(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADTenants", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADTenants), arg0, arg1) } @@ -283,7 +283,7 @@ func (m *MockAzureClient) GetAzureADUser(arg0 context.Context, arg1 string, arg2 } // GetAzureADUser indicates an expected call of GetAzureADUser. -func (mr *MockAzureClientMockRecorder) GetAzureADUser(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADUser(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADUser", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADUser), arg0, arg1, arg2) } @@ -298,7 +298,7 @@ func (m *MockAzureClient) GetAzureADUsers(arg0 context.Context, arg1, arg2, arg3 } // GetAzureADUsers indicates an expected call of GetAzureADUsers. -func (mr *MockAzureClientMockRecorder) GetAzureADUsers(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureADUsers(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureADUsers", reflect.TypeOf((*MockAzureClient)(nil).GetAzureADUsers), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } @@ -313,7 +313,7 @@ func (m *MockAzureClient) GetAzureDevice(arg0 context.Context, arg1 string, arg2 } // GetAzureDevice indicates an expected call of GetAzureDevice. -func (mr *MockAzureClientMockRecorder) GetAzureDevice(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureDevice(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureDevice", reflect.TypeOf((*MockAzureClient)(nil).GetAzureDevice), arg0, arg1, arg2) } @@ -328,7 +328,7 @@ func (m *MockAzureClient) GetAzureDevices(arg0 context.Context, arg1, arg2, arg3 } // GetAzureDevices indicates an expected call of GetAzureDevices. -func (mr *MockAzureClientMockRecorder) GetAzureDevices(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureDevices(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureDevices", reflect.TypeOf((*MockAzureClient)(nil).GetAzureDevices), arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) } @@ -343,7 +343,7 @@ func (m *MockAzureClient) GetAzureKeyVault(arg0 context.Context, arg1, arg2, arg } // GetAzureKeyVault indicates an expected call of GetAzureKeyVault. -func (mr *MockAzureClientMockRecorder) GetAzureKeyVault(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureKeyVault(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureKeyVault", reflect.TypeOf((*MockAzureClient)(nil).GetAzureKeyVault), arg0, arg1, arg2, arg3) } @@ -358,7 +358,7 @@ func (m *MockAzureClient) GetAzureKeyVaults(arg0 context.Context, arg1 string, a } // GetAzureKeyVaults indicates an expected call of GetAzureKeyVaults. -func (mr *MockAzureClientMockRecorder) GetAzureKeyVaults(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureKeyVaults(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureKeyVaults", reflect.TypeOf((*MockAzureClient)(nil).GetAzureKeyVaults), arg0, arg1, arg2) } @@ -373,7 +373,7 @@ func (m *MockAzureClient) GetAzureManagementGroup(arg0 context.Context, arg1, ar } // GetAzureManagementGroup indicates an expected call of GetAzureManagementGroup. -func (mr *MockAzureClientMockRecorder) GetAzureManagementGroup(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureManagementGroup(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureManagementGroup", reflect.TypeOf((*MockAzureClient)(nil).GetAzureManagementGroup), arg0, arg1, arg2, arg3, arg4) } @@ -388,7 +388,7 @@ func (m *MockAzureClient) GetAzureManagementGroups(arg0 context.Context) (azure. } // GetAzureManagementGroups indicates an expected call of GetAzureManagementGroups. -func (mr *MockAzureClientMockRecorder) GetAzureManagementGroups(arg0 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureManagementGroups(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureManagementGroups", reflect.TypeOf((*MockAzureClient)(nil).GetAzureManagementGroups), arg0) } @@ -403,7 +403,7 @@ func (m *MockAzureClient) GetAzureResourceGroup(arg0 context.Context, arg1, arg2 } // GetAzureResourceGroup indicates an expected call of GetAzureResourceGroup. -func (mr *MockAzureClientMockRecorder) GetAzureResourceGroup(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureResourceGroup(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureResourceGroup", reflect.TypeOf((*MockAzureClient)(nil).GetAzureResourceGroup), arg0, arg1, arg2) } @@ -418,7 +418,7 @@ func (m *MockAzureClient) GetAzureResourceGroups(arg0 context.Context, arg1, arg } // GetAzureResourceGroups indicates an expected call of GetAzureResourceGroups. -func (mr *MockAzureClientMockRecorder) GetAzureResourceGroups(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureResourceGroups(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureResourceGroups", reflect.TypeOf((*MockAzureClient)(nil).GetAzureResourceGroups), arg0, arg1, arg2, arg3) } @@ -433,7 +433,7 @@ func (m *MockAzureClient) GetAzureStorageAccount(arg0 context.Context, arg1, arg } // GetAzureStorageAccount indicates an expected call of GetAzureStorageAccount. -func (mr *MockAzureClientMockRecorder) GetAzureStorageAccount(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureStorageAccount(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureStorageAccount", reflect.TypeOf((*MockAzureClient)(nil).GetAzureStorageAccount), arg0, arg1, arg2, arg3, arg4) } @@ -448,7 +448,7 @@ func (m *MockAzureClient) GetAzureStorageAccounts(arg0 context.Context, arg1 str } // GetAzureStorageAccounts indicates an expected call of GetAzureStorageAccounts. -func (mr *MockAzureClientMockRecorder) GetAzureStorageAccounts(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureStorageAccounts(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureStorageAccounts", reflect.TypeOf((*MockAzureClient)(nil).GetAzureStorageAccounts), arg0, arg1) } @@ -463,7 +463,7 @@ func (m *MockAzureClient) GetAzureSubscription(arg0 context.Context, arg1 string } // GetAzureSubscription indicates an expected call of GetAzureSubscription. -func (mr *MockAzureClientMockRecorder) GetAzureSubscription(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureSubscription(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureSubscription", reflect.TypeOf((*MockAzureClient)(nil).GetAzureSubscription), arg0, arg1) } @@ -478,7 +478,7 @@ func (m *MockAzureClient) GetAzureSubscriptions(arg0 context.Context) (azure.Sub } // GetAzureSubscriptions indicates an expected call of GetAzureSubscriptions. -func (mr *MockAzureClientMockRecorder) GetAzureSubscriptions(arg0 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureSubscriptions(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureSubscriptions", reflect.TypeOf((*MockAzureClient)(nil).GetAzureSubscriptions), arg0) } @@ -493,7 +493,7 @@ func (m *MockAzureClient) GetAzureVirtualMachine(arg0 context.Context, arg1, arg } // GetAzureVirtualMachine indicates an expected call of GetAzureVirtualMachine. -func (mr *MockAzureClientMockRecorder) GetAzureVirtualMachine(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureVirtualMachine(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureVirtualMachine", reflect.TypeOf((*MockAzureClient)(nil).GetAzureVirtualMachine), arg0, arg1, arg2, arg3, arg4) } @@ -508,7 +508,7 @@ func (m *MockAzureClient) GetAzureVirtualMachines(arg0 context.Context, arg1 str } // GetAzureVirtualMachines indicates an expected call of GetAzureVirtualMachines. -func (mr *MockAzureClientMockRecorder) GetAzureVirtualMachines(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetAzureVirtualMachines(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetAzureVirtualMachines", reflect.TypeOf((*MockAzureClient)(nil).GetAzureVirtualMachines), arg0, arg1, arg2) } @@ -523,7 +523,7 @@ func (m *MockAzureClient) GetResourceRoleAssignments(arg0 context.Context, arg1, } // GetResourceRoleAssignments indicates an expected call of GetResourceRoleAssignments. -func (mr *MockAzureClientMockRecorder) GetResourceRoleAssignments(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetResourceRoleAssignments(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetResourceRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).GetResourceRoleAssignments), arg0, arg1, arg2, arg3) } @@ -538,7 +538,7 @@ func (m *MockAzureClient) GetRoleAssignmentsForResource(arg0 context.Context, ar } // GetRoleAssignmentsForResource indicates an expected call of GetRoleAssignmentsForResource. -func (mr *MockAzureClientMockRecorder) GetRoleAssignmentsForResource(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) GetRoleAssignmentsForResource(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRoleAssignmentsForResource", reflect.TypeOf((*MockAzureClient)(nil).GetRoleAssignmentsForResource), arg0, arg1, arg2) } @@ -552,7 +552,7 @@ func (m *MockAzureClient) ListAzureADAppMemberObjects(arg0 context.Context, arg1 } // ListAzureADAppMemberObjects indicates an expected call of ListAzureADAppMemberObjects. -func (mr *MockAzureClientMockRecorder) ListAzureADAppMemberObjects(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADAppMemberObjects(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADAppMemberObjects", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADAppMemberObjects), arg0, arg1, arg2) } @@ -566,7 +566,7 @@ func (m *MockAzureClient) ListAzureADAppOwners(arg0 context.Context, arg1, arg2, } // ListAzureADAppOwners indicates an expected call of ListAzureADAppOwners. -func (mr *MockAzureClientMockRecorder) ListAzureADAppOwners(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADAppOwners(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADAppOwners", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADAppOwners), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -580,7 +580,7 @@ func (m *MockAzureClient) ListAzureADAppRoleAssignments(arg0 context.Context, ar } // ListAzureADAppRoleAssignments indicates an expected call of ListAzureADAppRoleAssignments. -func (mr *MockAzureClientMockRecorder) ListAzureADAppRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADAppRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADAppRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADAppRoleAssignments), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } @@ -594,7 +594,7 @@ func (m *MockAzureClient) ListAzureADApps(arg0 context.Context, arg1, arg2, arg3 } // ListAzureADApps indicates an expected call of ListAzureADApps. -func (mr *MockAzureClientMockRecorder) ListAzureADApps(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADApps(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADApps", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADApps), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -608,7 +608,7 @@ func (m *MockAzureClient) ListAzureADGroupMembers(arg0 context.Context, arg1, ar } // ListAzureADGroupMembers indicates an expected call of ListAzureADGroupMembers. -func (mr *MockAzureClientMockRecorder) ListAzureADGroupMembers(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADGroupMembers(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADGroupMembers", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADGroupMembers), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -622,7 +622,7 @@ func (m *MockAzureClient) ListAzureADGroupOwners(arg0 context.Context, arg1, arg } // ListAzureADGroupOwners indicates an expected call of ListAzureADGroupOwners. -func (mr *MockAzureClientMockRecorder) ListAzureADGroupOwners(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADGroupOwners(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADGroupOwners", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADGroupOwners), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -636,7 +636,7 @@ func (m *MockAzureClient) ListAzureADGroups(arg0 context.Context, arg1, arg2, ar } // ListAzureADGroups indicates an expected call of ListAzureADGroups. -func (mr *MockAzureClientMockRecorder) ListAzureADGroups(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADGroups(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADGroups", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADGroups), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -650,7 +650,7 @@ func (m *MockAzureClient) ListAzureADRoleAssignments(arg0 context.Context, arg1, } // ListAzureADRoleAssignments indicates an expected call of ListAzureADRoleAssignments. -func (mr *MockAzureClientMockRecorder) ListAzureADRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADRoleAssignments(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADRoleAssignments), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -664,7 +664,7 @@ func (m *MockAzureClient) ListAzureADRoles(arg0 context.Context, arg1, arg2 stri } // ListAzureADRoles indicates an expected call of ListAzureADRoles. -func (mr *MockAzureClientMockRecorder) ListAzureADRoles(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADRoles(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADRoles", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADRoles), arg0, arg1, arg2) } @@ -678,7 +678,7 @@ func (m *MockAzureClient) ListAzureADServicePrincipalOwners(arg0 context.Context } // ListAzureADServicePrincipalOwners indicates an expected call of ListAzureADServicePrincipalOwners. -func (mr *MockAzureClientMockRecorder) ListAzureADServicePrincipalOwners(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADServicePrincipalOwners(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADServicePrincipalOwners", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADServicePrincipalOwners), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -692,7 +692,7 @@ func (m *MockAzureClient) ListAzureADServicePrincipals(arg0 context.Context, arg } // ListAzureADServicePrincipals indicates an expected call of ListAzureADServicePrincipals. -func (mr *MockAzureClientMockRecorder) ListAzureADServicePrincipals(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADServicePrincipals(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADServicePrincipals", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADServicePrincipals), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -706,7 +706,7 @@ func (m *MockAzureClient) ListAzureADTenants(arg0 context.Context, arg1 bool) <- } // ListAzureADTenants indicates an expected call of ListAzureADTenants. -func (mr *MockAzureClientMockRecorder) ListAzureADTenants(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADTenants(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADTenants", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADTenants), arg0, arg1) } @@ -720,7 +720,7 @@ func (m *MockAzureClient) ListAzureADUsers(arg0 context.Context, arg1, arg2, arg } // ListAzureADUsers indicates an expected call of ListAzureADUsers. -func (mr *MockAzureClientMockRecorder) ListAzureADUsers(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureADUsers(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureADUsers", reflect.TypeOf((*MockAzureClient)(nil).ListAzureADUsers), arg0, arg1, arg2, arg3, arg4) } @@ -734,7 +734,7 @@ func (m *MockAzureClient) ListAzureAutomationAccounts(arg0 context.Context, arg1 } // ListAzureAutomationAccounts indicates an expected call of ListAzureAutomationAccounts. -func (mr *MockAzureClientMockRecorder) ListAzureAutomationAccounts(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureAutomationAccounts(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureAutomationAccounts", reflect.TypeOf((*MockAzureClient)(nil).ListAzureAutomationAccounts), arg0, arg1) } @@ -748,7 +748,7 @@ func (m *MockAzureClient) ListAzureContainerRegistries(arg0 context.Context, arg } // ListAzureContainerRegistries indicates an expected call of ListAzureContainerRegistries. -func (mr *MockAzureClientMockRecorder) ListAzureContainerRegistries(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureContainerRegistries(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureContainerRegistries", reflect.TypeOf((*MockAzureClient)(nil).ListAzureContainerRegistries), arg0, arg1) } @@ -762,7 +762,7 @@ func (m *MockAzureClient) ListAzureDeviceRegisteredOwners(arg0 context.Context, } // ListAzureDeviceRegisteredOwners indicates an expected call of ListAzureDeviceRegisteredOwners. -func (mr *MockAzureClientMockRecorder) ListAzureDeviceRegisteredOwners(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureDeviceRegisteredOwners(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureDeviceRegisteredOwners", reflect.TypeOf((*MockAzureClient)(nil).ListAzureDeviceRegisteredOwners), arg0, arg1, arg2) } @@ -776,7 +776,7 @@ func (m *MockAzureClient) ListAzureDevices(arg0 context.Context, arg1, arg2, arg } // ListAzureDevices indicates an expected call of ListAzureDevices. -func (mr *MockAzureClientMockRecorder) ListAzureDevices(arg0, arg1, arg2, arg3, arg4, arg5 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureDevices(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureDevices", reflect.TypeOf((*MockAzureClient)(nil).ListAzureDevices), arg0, arg1, arg2, arg3, arg4, arg5) } @@ -790,7 +790,7 @@ func (m *MockAzureClient) ListAzureFunctionApps(arg0 context.Context, arg1 strin } // ListAzureFunctionApps indicates an expected call of ListAzureFunctionApps. -func (mr *MockAzureClientMockRecorder) ListAzureFunctionApps(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureFunctionApps(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureFunctionApps", reflect.TypeOf((*MockAzureClient)(nil).ListAzureFunctionApps), arg0, arg1) } @@ -804,7 +804,7 @@ func (m *MockAzureClient) ListAzureKeyVaults(arg0 context.Context, arg1 string, } // ListAzureKeyVaults indicates an expected call of ListAzureKeyVaults. -func (mr *MockAzureClientMockRecorder) ListAzureKeyVaults(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureKeyVaults(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureKeyVaults", reflect.TypeOf((*MockAzureClient)(nil).ListAzureKeyVaults), arg0, arg1, arg2) } @@ -818,7 +818,7 @@ func (m *MockAzureClient) ListAzureLogicApps(arg0 context.Context, arg1, arg2 st } // ListAzureLogicApps indicates an expected call of ListAzureLogicApps. -func (mr *MockAzureClientMockRecorder) ListAzureLogicApps(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureLogicApps(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureLogicApps", reflect.TypeOf((*MockAzureClient)(nil).ListAzureLogicApps), arg0, arg1, arg2, arg3) } @@ -832,7 +832,7 @@ func (m *MockAzureClient) ListAzureManagedClusters(arg0 context.Context, arg1 st } // ListAzureManagedClusters indicates an expected call of ListAzureManagedClusters. -func (mr *MockAzureClientMockRecorder) ListAzureManagedClusters(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureManagedClusters(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureManagedClusters", reflect.TypeOf((*MockAzureClient)(nil).ListAzureManagedClusters), arg0, arg1, arg2) } @@ -846,7 +846,7 @@ func (m *MockAzureClient) ListAzureManagementGroupDescendants(arg0 context.Conte } // ListAzureManagementGroupDescendants indicates an expected call of ListAzureManagementGroupDescendants. -func (mr *MockAzureClientMockRecorder) ListAzureManagementGroupDescendants(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureManagementGroupDescendants(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureManagementGroupDescendants", reflect.TypeOf((*MockAzureClient)(nil).ListAzureManagementGroupDescendants), arg0, arg1) } @@ -860,7 +860,7 @@ func (m *MockAzureClient) ListAzureManagementGroups(arg0 context.Context) <-chan } // ListAzureManagementGroups indicates an expected call of ListAzureManagementGroups. -func (mr *MockAzureClientMockRecorder) ListAzureManagementGroups(arg0 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureManagementGroups(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureManagementGroups", reflect.TypeOf((*MockAzureClient)(nil).ListAzureManagementGroups), arg0) } @@ -874,7 +874,7 @@ func (m *MockAzureClient) ListAzureResourceGroups(arg0 context.Context, arg1, ar } // ListAzureResourceGroups indicates an expected call of ListAzureResourceGroups. -func (mr *MockAzureClientMockRecorder) ListAzureResourceGroups(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureResourceGroups(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureResourceGroups", reflect.TypeOf((*MockAzureClient)(nil).ListAzureResourceGroups), arg0, arg1, arg2) } @@ -888,7 +888,7 @@ func (m *MockAzureClient) ListAzureStorageAccounts(arg0 context.Context, arg1 st } // ListAzureStorageAccounts indicates an expected call of ListAzureStorageAccounts. -func (mr *MockAzureClientMockRecorder) ListAzureStorageAccounts(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureStorageAccounts(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureStorageAccounts", reflect.TypeOf((*MockAzureClient)(nil).ListAzureStorageAccounts), arg0, arg1) } @@ -902,7 +902,7 @@ func (m *MockAzureClient) ListAzureStorageContainers(arg0 context.Context, arg1, } // ListAzureStorageContainers indicates an expected call of ListAzureStorageContainers. -func (mr *MockAzureClientMockRecorder) ListAzureStorageContainers(arg0, arg1, arg2, arg3, arg4, arg5, arg6 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureStorageContainers(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureStorageContainers", reflect.TypeOf((*MockAzureClient)(nil).ListAzureStorageContainers), arg0, arg1, arg2, arg3, arg4, arg5, arg6) } @@ -916,7 +916,7 @@ func (m *MockAzureClient) ListAzureSubscriptions(arg0 context.Context) <-chan az } // ListAzureSubscriptions indicates an expected call of ListAzureSubscriptions. -func (mr *MockAzureClientMockRecorder) ListAzureSubscriptions(arg0 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureSubscriptions(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureSubscriptions", reflect.TypeOf((*MockAzureClient)(nil).ListAzureSubscriptions), arg0) } @@ -930,7 +930,7 @@ func (m *MockAzureClient) ListAzureVMScaleSets(arg0 context.Context, arg1 string } // ListAzureVMScaleSets indicates an expected call of ListAzureVMScaleSets. -func (mr *MockAzureClientMockRecorder) ListAzureVMScaleSets(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureVMScaleSets(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureVMScaleSets", reflect.TypeOf((*MockAzureClient)(nil).ListAzureVMScaleSets), arg0, arg1, arg2) } @@ -944,7 +944,7 @@ func (m *MockAzureClient) ListAzureVirtualMachines(arg0 context.Context, arg1 st } // ListAzureVirtualMachines indicates an expected call of ListAzureVirtualMachines. -func (mr *MockAzureClientMockRecorder) ListAzureVirtualMachines(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureVirtualMachines(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureVirtualMachines", reflect.TypeOf((*MockAzureClient)(nil).ListAzureVirtualMachines), arg0, arg1, arg2) } @@ -958,7 +958,7 @@ func (m *MockAzureClient) ListAzureWebApps(arg0 context.Context, arg1 string) <- } // ListAzureWebApps indicates an expected call of ListAzureWebApps. -func (mr *MockAzureClientMockRecorder) ListAzureWebApps(arg0, arg1 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListAzureWebApps(arg0, arg1 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListAzureWebApps", reflect.TypeOf((*MockAzureClient)(nil).ListAzureWebApps), arg0, arg1) } @@ -972,7 +972,7 @@ func (m *MockAzureClient) ListResourceRoleAssignments(arg0 context.Context, arg1 } // ListResourceRoleAssignments indicates an expected call of ListResourceRoleAssignments. -func (mr *MockAzureClientMockRecorder) ListResourceRoleAssignments(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListResourceRoleAssignments(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListResourceRoleAssignments", reflect.TypeOf((*MockAzureClient)(nil).ListResourceRoleAssignments), arg0, arg1, arg2, arg3) } @@ -986,7 +986,7 @@ func (m *MockAzureClient) ListRoleAssignmentsForResource(arg0 context.Context, a } // ListRoleAssignmentsForResource indicates an expected call of ListRoleAssignmentsForResource. -func (mr *MockAzureClientMockRecorder) ListRoleAssignmentsForResource(arg0, arg1, arg2 any) *gomock.Call { +func (mr *MockAzureClientMockRecorder) ListRoleAssignmentsForResource(arg0, arg1, arg2 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListRoleAssignmentsForResource", reflect.TypeOf((*MockAzureClient)(nil).ListRoleAssignmentsForResource), arg0, arg1, arg2) } diff --git a/client/rest/client.go b/client/rest/client.go index 97612a4..77b637f 100644 --- a/client/rest/client.go +++ b/client/rest/client.go @@ -38,11 +38,11 @@ import ( type RestClient interface { Authenticate() error - Delete(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) + Delete(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) Get(ctx context.Context, path string, params, headers map[string]string) (*http.Response, error) - Patch(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) - Post(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) - Put(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) + Patch(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) + Post(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) + Put(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) Send(req *http.Request) (*http.Response, error) CloseIdleConnections() } @@ -155,7 +155,7 @@ func (s *restClient) Authenticate() error { } } -func (s *restClient) Delete(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) { +func (s *restClient) Delete(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) { endpoint := s.api.ResolveReference(&url.URL{Path: path}) if req, err := NewRequest(ctx, http.MethodDelete, endpoint, body, params, headers); err != nil { return nil, err @@ -173,7 +173,7 @@ func (s *restClient) Get(ctx context.Context, path string, params, headers map[s } } -func (s *restClient) Patch(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) { +func (s *restClient) Patch(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) { endpoint := s.api.ResolveReference(&url.URL{Path: path}) if req, err := NewRequest(ctx, http.MethodPatch, endpoint, body, params, headers); err != nil { return nil, err @@ -182,7 +182,7 @@ func (s *restClient) Patch(ctx context.Context, path string, body any, params, h } } -func (s *restClient) Post(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) { +func (s *restClient) Post(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) { endpoint := s.api.ResolveReference(&url.URL{Path: path}) if req, err := NewRequest(ctx, http.MethodPost, endpoint, body, params, headers); err != nil { return nil, err @@ -191,7 +191,7 @@ func (s *restClient) Post(ctx context.Context, path string, body any, params, he } } -func (s *restClient) Put(ctx context.Context, path string, body any, params, headers map[string]string) (*http.Response, error) { +func (s *restClient) Put(ctx context.Context, path string, body interface{}, params, headers map[string]string) (*http.Response, error) { endpoint := s.api.ResolveReference(&url.URL{Path: path}) if req, err := NewRequest(ctx, http.MethodPost, endpoint, body, params, headers); err != nil { return nil, err @@ -275,7 +275,7 @@ func (s *restClient) send(req *http.Request) (*http.Response, error) { continue } else { // Not a status code that warrants a retry - var errRes map[string]any + var errRes map[string]interface{} if err := Decode(res.Body, &errRes); err != nil { return nil, fmt.Errorf("malformed error response, status code: %d", res.StatusCode) } else { diff --git a/client/rest/http.go b/client/rest/http.go index 61748ba..5fa256a 100644 --- a/client/rest/http.go +++ b/client/rest/http.go @@ -71,7 +71,7 @@ func NewRequest( ctx context.Context, verb string, endpoint *url.URL, - body any, + body interface{}, params map[string]string, headers map[string]string, ) (*http.Request, error) { diff --git a/client/rest/mocks/client.go b/client/rest/mocks/client.go index 28fbe04..b9df20b 100644 --- a/client/rest/mocks/client.go +++ b/client/rest/mocks/client.go @@ -62,7 +62,7 @@ func (mr *MockRestClientMockRecorder) CloseIdleConnections() *gomock.Call { } // Delete mocks base method. -func (m *MockRestClient) Delete(arg0 context.Context, arg1 string, arg2 any, arg3, arg4 map[string]string) (*http.Response, error) { +func (m *MockRestClient) Delete(arg0 context.Context, arg1 string, arg2 interface{}, arg3, arg4 map[string]string) (*http.Response, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Delete", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(*http.Response) @@ -71,7 +71,7 @@ func (m *MockRestClient) Delete(arg0 context.Context, arg1 string, arg2 any, arg } // Delete indicates an expected call of Delete. -func (mr *MockRestClientMockRecorder) Delete(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockRestClientMockRecorder) Delete(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockRestClient)(nil).Delete), arg0, arg1, arg2, arg3, arg4) } @@ -86,13 +86,13 @@ func (m *MockRestClient) Get(arg0 context.Context, arg1 string, arg2, arg3 map[s } // Get indicates an expected call of Get. -func (mr *MockRestClientMockRecorder) Get(arg0, arg1, arg2, arg3 any) *gomock.Call { +func (mr *MockRestClientMockRecorder) Get(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockRestClient)(nil).Get), arg0, arg1, arg2, arg3) } // Patch mocks base method. -func (m *MockRestClient) Patch(arg0 context.Context, arg1 string, arg2 any, arg3, arg4 map[string]string) (*http.Response, error) { +func (m *MockRestClient) Patch(arg0 context.Context, arg1 string, arg2 interface{}, arg3, arg4 map[string]string) (*http.Response, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Patch", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(*http.Response) @@ -101,13 +101,13 @@ func (m *MockRestClient) Patch(arg0 context.Context, arg1 string, arg2 any, arg3 } // Patch indicates an expected call of Patch. -func (mr *MockRestClientMockRecorder) Patch(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockRestClientMockRecorder) Patch(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Patch", reflect.TypeOf((*MockRestClient)(nil).Patch), arg0, arg1, arg2, arg3, arg4) } // Post mocks base method. -func (m *MockRestClient) Post(arg0 context.Context, arg1 string, arg2 any, arg3, arg4 map[string]string) (*http.Response, error) { +func (m *MockRestClient) Post(arg0 context.Context, arg1 string, arg2 interface{}, arg3, arg4 map[string]string) (*http.Response, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Post", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(*http.Response) @@ -116,13 +116,13 @@ func (m *MockRestClient) Post(arg0 context.Context, arg1 string, arg2 any, arg3, } // Post indicates an expected call of Post. -func (mr *MockRestClientMockRecorder) Post(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockRestClientMockRecorder) Post(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Post", reflect.TypeOf((*MockRestClient)(nil).Post), arg0, arg1, arg2, arg3, arg4) } // Put mocks base method. -func (m *MockRestClient) Put(arg0 context.Context, arg1 string, arg2 any, arg3, arg4 map[string]string) (*http.Response, error) { +func (m *MockRestClient) Put(arg0 context.Context, arg1 string, arg2 interface{}, arg3, arg4 map[string]string) (*http.Response, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Put", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(*http.Response) @@ -131,7 +131,7 @@ func (m *MockRestClient) Put(arg0 context.Context, arg1 string, arg2 any, arg3, } // Put indicates an expected call of Put. -func (mr *MockRestClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4 any) *gomock.Call { +func (mr *MockRestClientMockRecorder) Put(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockRestClient)(nil).Put), arg0, arg1, arg2, arg3, arg4) } @@ -146,7 +146,7 @@ func (m *MockRestClient) Send(arg0 *http.Request) (*http.Response, error) { } // Send indicates an expected call of Send. -func (mr *MockRestClientMockRecorder) Send(arg0 any) *gomock.Call { +func (mr *MockRestClientMockRecorder) Send(arg0 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockRestClient)(nil).Send), arg0) } diff --git a/client/rest/utils.go b/client/rest/utils.go index cfe0805..b048e7b 100644 --- a/client/rest/utils.go +++ b/client/rest/utils.go @@ -33,7 +33,7 @@ import ( "github.com/youmark/pkcs8" ) -func Decode(body io.ReadCloser, v any) error { +func Decode(body io.ReadCloser, v interface{}) error { defer body.Close() defer io.ReadAll(body) // must read all; streaming to the json decoder does not read to EOF making the connection unavailable for reuse return json.NewDecoder(body).Decode(v) @@ -59,7 +59,7 @@ func NewClientAssertion(tokenUrl string, clientId string, clientCert string, sig IssuedAt: iat.Unix(), }) - token.Header = map[string]any{ + token.Header = map[string]interface{}{ "alg": "RS256", "typ": "JWT", "x5t": thumbprint, @@ -73,9 +73,9 @@ func NewClientAssertion(tokenUrl string, clientId string, clientCert string, sig } } -func ParseBody(accessToken string) (map[string]any, error) { +func ParseBody(accessToken string) (map[string]interface{}, error) { var ( - body = make(map[string]any) + body = make(map[string]interface{}) parts = strings.Split(accessToken, ".") ) @@ -100,7 +100,7 @@ func ParseAud(accessToken string) (string, error) { } } -func parseRSAPrivateKey(signingKey string, password string) (any, error) { +func parseRSAPrivateKey(signingKey string, password string) (interface{}, error) { if decodedBlock, _ := pem.Decode([]byte(signingKey)); decodedBlock == nil { return nil, fmt.Errorf("Unable to decode private key") } else if key, _, err := pkcs8.ParsePrivateKey(decodedBlock.Bytes, []byte(password)); err != nil { diff --git a/cmd/list-app-role-assignments.go b/cmd/list-app-role-assignments.go index 6da8575..0cb2a52 100644 --- a/cmd/list-app-role-assignments.go +++ b/cmd/list-app-role-assignments.go @@ -58,9 +58,9 @@ func listAppRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAppRoleAssignments(ctx context.Context, client client.AzureClient, servicePrincipals <-chan any) <-chan any { +func listAppRoleAssignments(ctx context.Context, client client.AzureClient, servicePrincipals <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) filteredSPs = make(chan models.ServicePrincipal) streams = pipeline.Demux(ctx.Done(), filteredSPs, 25) wg sync.WaitGroup @@ -98,13 +98,14 @@ func listAppRoleAssignments(ctx context.Context, client client.AzureClient, serv } else { log.V(2).Info("found app role assignment", "roleAssignments", item) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( - enums.KindAZAppRoleAssignment, - models.AppRoleAssignment{ + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZAppRoleAssignment, + Data: models.AppRoleAssignment{ AppRoleAssignment: item.Ok, AppId: servicePrincipal.AppId, TenantId: client.TenantInfo().TenantId, - })); !ok { + }, + }); !ok { return } } diff --git a/cmd/list-automation-account-role-assignments.go b/cmd/list-automation-account-role-assignments.go index 65233fc..f0bbcff 100644 --- a/cmd/list-automation-account-role-assignments.go +++ b/cmd/list-automation-account-role-assignments.go @@ -59,9 +59,9 @@ func listAutomationAccountRoleAssignmentImpl(cmd *cobra.Command, args []string) log.Info("collection completed", "duration", duration.String()) } -func listAutomationAccountRoleAssignments(ctx context.Context, client client.AzureClient, automationAccounts <-chan any) <-chan any { +func listAutomationAccountRoleAssignments(ctx context.Context, client client.AzureClient, automationAccounts <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -110,7 +110,10 @@ func listAutomationAccountRoleAssignments(ctx context.Context, client client.Azu automationAccountRoleAssignments.RoleAssignments = append(automationAccountRoleAssignments.RoleAssignments, automationAccountRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZAutomationAccountRoleAssignment, automationAccountRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZAutomationAccountRoleAssignment, + Data: automationAccountRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing automation account role assignments", "automationAccountId", id, "count", count) diff --git a/cmd/list-automation-accounts.go b/cmd/list-automation-accounts.go index 2c74490..cf38396 100644 --- a/cmd/list-automation-accounts.go +++ b/cmd/list-automation-accounts.go @@ -57,9 +57,9 @@ func listAutomationAccountsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAutomationAccounts(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listAutomationAccounts(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -99,7 +99,10 @@ func listAutomationAccounts(ctx context.Context, client client.AzureClient, subs } log.V(2).Info("found automation account", "automationAccount", automationAccount) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZAutomationAccount, automationAccount)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZAutomationAccount, + Data: automationAccount, + }); !ok { return } } diff --git a/cmd/list-azure-ad.go b/cmd/list-azure-ad.go index e434465..c53fcaa 100644 --- a/cmd/list-azure-ad.go +++ b/cmd/list-azure-ad.go @@ -59,23 +59,23 @@ func listAzureADCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAllAD(ctx context.Context, client client.AzureClient) <-chan any { +func listAllAD(ctx context.Context, client client.AzureClient) <-chan interface{} { var ( - devices = make(chan any) - devices2 = make(chan any) + devices = make(chan interface{}) + devices2 = make(chan interface{}) - groups = make(chan any) - groups2 = make(chan any) - groups3 = make(chan any) + groups = make(chan interface{}) + groups2 = make(chan interface{}) + groups3 = make(chan interface{}) - roles = make(chan any) - roles2 = make(chan any) + roles = make(chan interface{}) + roles2 = make(chan interface{}) - servicePrincipals = make(chan any) - servicePrincipals2 = make(chan any) - servicePrincipals3 = make(chan any) + servicePrincipals = make(chan interface{}) + servicePrincipals2 = make(chan interface{}) + servicePrincipals3 = make(chan interface{}) - tenants = make(chan any) + tenants = make(chan interface{}) ) // Enumerate Apps, AppOwners and AppMembers diff --git a/cmd/list-azure-rm.go b/cmd/list-azure-rm.go index c872f61..de4f186 100644 --- a/cmd/list-azure-rm.go +++ b/cmd/list-azure-rm.go @@ -61,65 +61,65 @@ func listAzureRMCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAllRM(ctx context.Context, client client.AzureClient) <-chan any { +func listAllRM(ctx context.Context, client client.AzureClient) <-chan interface{} { var ( - functionApps = make(chan any) - functionApps2 = make(chan any) + functionApps = make(chan interface{}) + functionApps2 = make(chan interface{}) - webApps = make(chan any) - webApps2 = make(chan any) + webApps = make(chan interface{}) + webApps2 = make(chan interface{}) - automationAccounts = make(chan any) - automationAccounts2 = make(chan any) + automationAccounts = make(chan interface{}) + automationAccounts2 = make(chan interface{}) - containerRegistries = make(chan any) - containerRegistries2 = make(chan any) + containerRegistries = make(chan interface{}) + containerRegistries2 = make(chan interface{}) - logicApps = make(chan any) - logicApps2 = make(chan any) + logicApps = make(chan interface{}) + logicApps2 = make(chan interface{}) - managedClusters = make(chan any) - managedClusters2 = make(chan any) + managedClusters = make(chan interface{}) + managedClusters2 = make(chan interface{}) - vmScaleSets = make(chan any) - vmScaleSets2 = make(chan any) + vmScaleSets = make(chan interface{}) + vmScaleSets2 = make(chan interface{}) - keyVaults = make(chan any) - keyVaults2 = make(chan any) - keyVaults3 = make(chan any) + keyVaults = make(chan interface{}) + keyVaults2 = make(chan interface{}) + keyVaults3 = make(chan interface{}) keyVaultRoleAssignments1 = make(chan azureWrapper[models.KeyVaultRoleAssignments]) keyVaultRoleAssignments2 = make(chan azureWrapper[models.KeyVaultRoleAssignments]) keyVaultRoleAssignments3 = make(chan azureWrapper[models.KeyVaultRoleAssignments]) keyVaultRoleAssignments4 = make(chan azureWrapper[models.KeyVaultRoleAssignments]) - mgmtGroups = make(chan any) - mgmtGroups2 = make(chan any) - mgmtGroups3 = make(chan any) + mgmtGroups = make(chan interface{}) + mgmtGroups2 = make(chan interface{}) + mgmtGroups3 = make(chan interface{}) mgmtGroupRoleAssignments1 = make(chan azureWrapper[models.ManagementGroupRoleAssignments]) mgmtGroupRoleAssignments2 = make(chan azureWrapper[models.ManagementGroupRoleAssignments]) - resourceGroups = make(chan any) - resourceGroups2 = make(chan any) + resourceGroups = make(chan interface{}) + resourceGroups2 = make(chan interface{}) resourceGroupRoleAssignments1 = make(chan azureWrapper[models.ResourceGroupRoleAssignments]) resourceGroupRoleAssignments2 = make(chan azureWrapper[models.ResourceGroupRoleAssignments]) - subscriptions = make(chan any) - subscriptions2 = make(chan any) - subscriptions3 = make(chan any) - subscriptions4 = make(chan any) - subscriptions5 = make(chan any) - subscriptions6 = make(chan any) - subscriptions7 = make(chan any) - subscriptions8 = make(chan any) - subscriptions9 = make(chan any) - subscriptions10 = make(chan any) - subscriptions11 = make(chan any) - subscriptions12 = make(chan any) - subscriptionRoleAssignments1 = make(chan any) - subscriptionRoleAssignments2 = make(chan any) - - virtualMachines = make(chan any) - virtualMachines2 = make(chan any) + subscriptions = make(chan interface{}) + subscriptions2 = make(chan interface{}) + subscriptions3 = make(chan interface{}) + subscriptions4 = make(chan interface{}) + subscriptions5 = make(chan interface{}) + subscriptions6 = make(chan interface{}) + subscriptions7 = make(chan interface{}) + subscriptions8 = make(chan interface{}) + subscriptions9 = make(chan interface{}) + subscriptions10 = make(chan interface{}) + subscriptions11 = make(chan interface{}) + subscriptions12 = make(chan interface{}) + subscriptionRoleAssignments1 = make(chan interface{}) + subscriptionRoleAssignments2 = make(chan interface{}) + + virtualMachines = make(chan interface{}) + virtualMachines2 = make(chan interface{}) virtualMachineRoleAssignments1 = make(chan azureWrapper[models.VirtualMachineRoleAssignments]) virtualMachineRoleAssignments2 = make(chan azureWrapper[models.VirtualMachineRoleAssignments]) virtualMachineRoleAssignments3 = make(chan azureWrapper[models.VirtualMachineRoleAssignments]) diff --git a/cmd/list-container-registries.go b/cmd/list-container-registries.go index 1d6a5f1..2ed3e4f 100644 --- a/cmd/list-container-registries.go +++ b/cmd/list-container-registries.go @@ -62,9 +62,9 @@ func listContainerRegistriesCmdImpl(cmd *cobra.Command, args []string) { } } -func listContainerRegistries(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listContainerRegistries(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,10 @@ func listContainerRegistries(ctx context.Context, client client.AzureClient, sub } log.V(2).Info("found container registry", "containerRegistry", containerRegistry) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZContainerRegistry, containerRegistry)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZContainerRegistry, + Data: containerRegistry, + }); !ok { return } } diff --git a/cmd/list-container-registry-role-assignments.go b/cmd/list-container-registry-role-assignments.go index 558be19..4cfdf12 100644 --- a/cmd/list-container-registry-role-assignments.go +++ b/cmd/list-container-registry-role-assignments.go @@ -64,9 +64,9 @@ func listContainerRegistryRoleAssignmentImpl(cmd *cobra.Command, args []string) } } -func listContainerRegistryRoleAssignments(ctx context.Context, client client.AzureClient, containerRegistries <-chan any) <-chan any { +func listContainerRegistryRoleAssignments(ctx context.Context, client client.AzureClient, containerRegistries <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,10 @@ func listContainerRegistryRoleAssignments(ctx context.Context, client client.Azu containerRegistryRoleAssignments.RoleAssignments = append(containerRegistryRoleAssignments.RoleAssignments, containerRegistryRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZContainerRegistryRoleAssignment, containerRegistryRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZContainerRegistryRoleAssignment, + Data: containerRegistryRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing container registry role assignments", "containerRegistryId", id, "count", count) diff --git a/cmd/list-device-owners.go b/cmd/list-device-owners.go index d526901..124c646 100644 --- a/cmd/list-device-owners.go +++ b/cmd/list-device-owners.go @@ -57,9 +57,9 @@ func listDeviceOwnersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <-chan any) <-chan any { +func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,10 @@ func listDeviceOwners(ctx context.Context, client client.AzureClient, devices <- data.Owners = append(data.Owners, deviceOwner) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZDeviceOwner, data)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZDeviceOwner, + Data: data, + }); !ok { return } log.V(1).Info("finished listing device owners", "deviceId", id, "count", count) diff --git a/cmd/list-device-owners_test.go b/cmd/list-device-owners_test.go index 765ef78..5f0dc3e 100644 --- a/cmd/list-device-owners_test.go +++ b/cmd/list-device-owners_test.go @@ -40,7 +40,7 @@ func TestListDeviceOwners(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockDevicesChannel := make(chan any) + mockDevicesChannel := make(chan interface{}) mockDeviceOwnerChannel := make(chan azure.DeviceRegisteredOwnerResult) mockDeviceOwnerChannel2 := make(chan azure.DeviceRegisteredOwnerResult) diff --git a/cmd/list-devices.go b/cmd/list-devices.go index c77f9fb..37ccbb6 100644 --- a/cmd/list-devices.go +++ b/cmd/list-devices.go @@ -55,8 +55,8 @@ func listDevicesCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listDevices(ctx context.Context, client client.AzureClient) <-chan any { - out := make(chan any) +func listDevices(ctx context.Context, client client.AzureClient) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -68,13 +68,14 @@ func listDevices(ctx context.Context, client client.AzureClient) <-chan any { } else { log.V(2).Info("found device", "device", item) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( - enums.KindAZDevice, - models.Device{ + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZDevice, + Data: models.Device{ Device: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, - })); !ok { + }, + }); !ok { return } } diff --git a/cmd/list-function-app-role-assignments.go b/cmd/list-function-app-role-assignments.go index 4f47639..7433e75 100644 --- a/cmd/list-function-app-role-assignments.go +++ b/cmd/list-function-app-role-assignments.go @@ -59,9 +59,9 @@ func listFunctionAppRoleAssignmentImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClient, functionApps <-chan any) <-chan any { +func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClient, functionApps <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -110,7 +110,10 @@ func listFunctionAppRoleAssignments(ctx context.Context, client client.AzureClie functionAppRoleAssignments.RoleAssignments = append(functionAppRoleAssignments.RoleAssignments, functionAppRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZFunctionAppRoleAssignment, functionAppRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZFunctionAppRoleAssignment, + Data: functionAppRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing function app role assignments", "functionAppId", id, "count", count) diff --git a/cmd/list-function-apps.go b/cmd/list-function-apps.go index cea1133..a63e453 100644 --- a/cmd/list-function-apps.go +++ b/cmd/list-function-apps.go @@ -57,9 +57,9 @@ func listFunctionAppsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listFunctionApps(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listFunctionApps(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -100,7 +100,10 @@ func listFunctionApps(ctx context.Context, client client.AzureClient, subscripti if functionApp.Kind == "functionapp" { log.V(2).Info("found function app", "functionApp", functionApp) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZFunctionApp, functionApp)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZFunctionApp, + Data: functionApp, + }); !ok { return } } diff --git a/cmd/list-group-members.go b/cmd/list-group-members.go index 67b24f8..cfdd203 100644 --- a/cmd/list-group-members.go +++ b/cmd/list-group-members.go @@ -57,9 +57,9 @@ func listGroupMembersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-chan any) <-chan any { +func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -105,7 +105,10 @@ func listGroupMembers(ctx context.Context, client client.AzureClient, groups <-c data.Members = append(data.Members, groupMember) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroupMember, data)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZGroupMember, + Data: data, + }); !ok { return } log.V(1).Info("finished listing group memberships", "groupId", id, "count", count) diff --git a/cmd/list-group-members_test.go b/cmd/list-group-members_test.go index 42cfa51..f3cf088 100644 --- a/cmd/list-group-members_test.go +++ b/cmd/list-group-members_test.go @@ -40,7 +40,7 @@ func TestListGroupMembers(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockGroupsChannel := make(chan any) + mockGroupsChannel := make(chan interface{}) mockGroupMemberChannel := make(chan azure.MemberObjectResult) mockGroupMemberChannel2 := make(chan azure.MemberObjectResult) diff --git a/cmd/list-group-owners.go b/cmd/list-group-owners.go index d319794..6bd171d 100644 --- a/cmd/list-group-owners.go +++ b/cmd/list-group-owners.go @@ -57,9 +57,9 @@ func listGroupOwnersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-chan any) <-chan any { +func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -105,7 +105,10 @@ func listGroupOwners(ctx context.Context, client client.AzureClient, groups <-ch groupOwners.Owners = append(groupOwners.Owners, groupOwner) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroupOwner, groupOwners)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZGroupOwner, + Data: groupOwners, + }); !ok { return } log.V(1).Info("finished listing group owners", "groupId", id, "count", count) diff --git a/cmd/list-group-owners_test.go b/cmd/list-group-owners_test.go index 9478254..b1e7eea 100644 --- a/cmd/list-group-owners_test.go +++ b/cmd/list-group-owners_test.go @@ -40,7 +40,7 @@ func TestListGroupOwners(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockGroupsChannel := make(chan any) + mockGroupsChannel := make(chan interface{}) mockGroupOwnerChannel := make(chan azure.GroupOwnerResult) mockGroupOwnerChannel2 := make(chan azure.GroupOwnerResult) diff --git a/cmd/list-groups.go b/cmd/list-groups.go index 1bfee7e..21e321a 100644 --- a/cmd/list-groups.go +++ b/cmd/list-groups.go @@ -55,8 +55,8 @@ func listGroupsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listGroups(ctx context.Context, client client.AzureClient) <-chan any { - out := make(chan any) +func listGroups(ctx context.Context, client client.AzureClient) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -73,7 +73,10 @@ func listGroups(ctx context.Context, client client.AzureClient) <-chan any { TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZGroup, group)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZGroup, + Data: group, + }); !ok { return } } diff --git a/cmd/list-key-vault-access-policies.go b/cmd/list-key-vault-access-policies.go index 7a1c7da..a7438e1 100644 --- a/cmd/list-key-vault-access-policies.go +++ b/cmd/list-key-vault-access-policies.go @@ -27,6 +27,7 @@ import ( "github.com/bloodhoundad/azurehound/v2/client" "github.com/bloodhoundad/azurehound/v2/config" "github.com/bloodhoundad/azurehound/v2/enums" + kinds "github.com/bloodhoundad/azurehound/v2/enums" "github.com/bloodhoundad/azurehound/v2/models" "github.com/bloodhoundad/azurehound/v2/pipeline" "github.com/spf13/cobra" @@ -66,8 +67,8 @@ func listKeyVaultAccessPoliciesCmdImpl(cmd *cobra.Command, args []string) { } } -func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, keyVaults <-chan any, filters []enums.KeyVaultAccessType) <-chan any { - out := make(chan any) +func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, keyVaults <-chan interface{}, filters []enums.KeyVaultAccessType) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -79,12 +80,13 @@ func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, } else { for _, policy := range keyVault.Properties.AccessPolicies { if len(filters) == 0 { - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( - enums.KindAZKeyVaultAccessPolicy, - models.KeyVaultAccessPolicy{ + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: kinds.KindAZKeyVaultAccessPolicy, + Data: models.KeyVaultAccessPolicy{ KeyVaultId: keyVault.Id, AccessPolicyEntry: policy, - })); !ok { + }, + }); !ok { return } } else { @@ -103,12 +105,13 @@ func listKeyVaultAccessPolicies(ctx context.Context, client client.AzureClient, } }() if contains(permissions, "Get") { - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( - enums.KindAZKeyVaultAccessPolicy, - models.KeyVaultAccessPolicy{ + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: kinds.KindAZKeyVaultAccessPolicy, + Data: models.KeyVaultAccessPolicy{ KeyVaultId: keyVault.Id, AccessPolicyEntry: policy, - })); !ok { + }, + }); !ok { return } break diff --git a/cmd/list-key-vault-access-policies_test.go b/cmd/list-key-vault-access-policies_test.go index 8393856..877fe1f 100644 --- a/cmd/list-key-vault-access-policies_test.go +++ b/cmd/list-key-vault-access-policies_test.go @@ -38,7 +38,7 @@ func TestListKeyVaultAccessPolicies(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockKeyVaultsChannel := make(chan any) + mockKeyVaultsChannel := make(chan interface{}) mockTenant := azure.Tenant{} mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes() channel := listKeyVaultAccessPolicies(ctx, mockClient, mockKeyVaultsChannel, nil) diff --git a/cmd/list-key-vault-role-assignments.go b/cmd/list-key-vault-role-assignments.go index fa2520b..ee14b05 100644 --- a/cmd/list-key-vault-role-assignments.go +++ b/cmd/list-key-vault-role-assignments.go @@ -58,7 +58,7 @@ func listKeyVaultRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listKeyVaultRoleAssignments(ctx context.Context, client client.AzureClient, keyVaults <-chan any) <-chan azureWrapper[models.KeyVaultRoleAssignments] { +func listKeyVaultRoleAssignments(ctx context.Context, client client.AzureClient, keyVaults <-chan interface{}) <-chan azureWrapper[models.KeyVaultRoleAssignments] { var ( out = make(chan azureWrapper[models.KeyVaultRoleAssignments]) ids = make(chan string) diff --git a/cmd/list-key-vault-role-assignments_test.go b/cmd/list-key-vault-role-assignments_test.go index 4de6772..db7e4c3 100644 --- a/cmd/list-key-vault-role-assignments_test.go +++ b/cmd/list-key-vault-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListKeyVaultRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockKeyVaultsChannel := make(chan any) + mockKeyVaultsChannel := make(chan interface{}) mockKeyVaultRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockKeyVaultRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-key-vaults.go b/cmd/list-key-vaults.go index 6f27235..dee1bcb 100644 --- a/cmd/list-key-vaults.go +++ b/cmd/list-key-vaults.go @@ -57,9 +57,9 @@ func listKeyVaultsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -102,7 +102,10 @@ func listKeyVaults(ctx context.Context, client client.AzureClient, subscriptions } log.V(2).Info("found key vault", "keyVault", keyVault) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZKeyVault, keyVault)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZKeyVault, + Data: keyVault, + }); !ok { return } } diff --git a/cmd/list-key-vaults_test.go b/cmd/list-key-vaults_test.go index a898837..269288a 100644 --- a/cmd/list-key-vaults_test.go +++ b/cmd/list-key-vaults_test.go @@ -39,7 +39,7 @@ func TestListKeyVaults(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockSubscriptionsChannel := make(chan any) + mockSubscriptionsChannel := make(chan interface{}) mockKeyVaultChannel := make(chan azure.KeyVaultResult) mockKeyVaultChannel2 := make(chan azure.KeyVaultResult) diff --git a/cmd/list-logic-app-role-assignments.go b/cmd/list-logic-app-role-assignments.go index a307ad4..ed73508 100644 --- a/cmd/list-logic-app-role-assignments.go +++ b/cmd/list-logic-app-role-assignments.go @@ -64,9 +64,9 @@ func listLogicAppRoleAssignmentImpl(cmd *cobra.Command, args []string) { } } -func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, logicapps <-chan any) <-chan any { +func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, logicapps <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,10 @@ func listLogicAppRoleAssignments(ctx context.Context, client client.AzureClient, logicappRoleAssignments.RoleAssignments = append(logicappRoleAssignments.RoleAssignments, logicappRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZLogicAppRoleAssignment, logicappRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZLogicAppRoleAssignment, + Data: logicappRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing logic app role assignments", "logicappId", id, "count", count) diff --git a/cmd/list-logic-apps.go b/cmd/list-logic-apps.go index ab64a86..a928634 100644 --- a/cmd/list-logic-apps.go +++ b/cmd/list-logic-apps.go @@ -62,9 +62,9 @@ func listLogicAppsCmdImpl(cmd *cobra.Command, args []string) { } } -func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -109,7 +109,10 @@ func listLogicApps(ctx context.Context, client client.AzureClient, subscriptions } log.V(2).Info("found logicapp", "logicapp", logicapp) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZLogicApp, logicapp)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZLogicApp, + Data: logicapp, + }); !ok { return } } diff --git a/cmd/list-managed-cluster-role-assignments.go b/cmd/list-managed-cluster-role-assignments.go index 1b03013..323df75 100644 --- a/cmd/list-managed-cluster-role-assignments.go +++ b/cmd/list-managed-cluster-role-assignments.go @@ -64,9 +64,9 @@ func listManagedClusterRoleAssignmentImpl(cmd *cobra.Command, args []string) { } } -func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureClient, managedClusters <-chan any) <-chan any { +func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureClient, managedClusters <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,10 @@ func listManagedClusterRoleAssignments(ctx context.Context, client client.AzureC managedClusterRoleAssignments.RoleAssignments = append(managedClusterRoleAssignments.RoleAssignments, managedClusterRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagedClusterRoleAssignment, managedClusterRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZManagedClusterRoleAssignment, + Data: managedClusterRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing managed cluster role assignments", "managedClusterId", id, "count", count) diff --git a/cmd/list-managed-clusters.go b/cmd/list-managed-clusters.go index aa851b6..3384e61 100644 --- a/cmd/list-managed-clusters.go +++ b/cmd/list-managed-clusters.go @@ -62,9 +62,9 @@ func listManagedClustersCmdImpl(cmd *cobra.Command, args []string) { } } -func listManagedClusters(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listManagedClusters(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,10 @@ func listManagedClusters(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found managed cluster", "managedCluster", managedCluster) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagedCluster, managedCluster)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZManagedCluster, + Data: managedCluster, + }); !ok { return } } diff --git a/cmd/list-management-group-descendants.go b/cmd/list-management-group-descendants.go index ebc1eec..904c11e 100644 --- a/cmd/list-management-group-descendants.go +++ b/cmd/list-management-group-descendants.go @@ -57,9 +57,9 @@ func listManagementGroupDescendantsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listManagementGroupDescendants(ctx context.Context, client client.AzureClient, managementGroups <-chan any) <-chan any { +func listManagementGroupDescendants(ctx context.Context, client client.AzureClient, managementGroups <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -93,7 +93,10 @@ func listManagementGroupDescendants(ctx context.Context, client client.AzureClie } else { log.V(2).Info("found management group descendant", "type", item.Ok.Type, "id", item.Ok.Id, "parent", item.Ok.Properties.Parent.Id) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagementGroupDescendant, item.Ok)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZManagementGroupDescendant, + Data: item.Ok, + }); !ok { return } } diff --git a/cmd/list-management-group-descendants_test.go b/cmd/list-management-group-descendants_test.go index 99bd0ec..01806b1 100644 --- a/cmd/list-management-group-descendants_test.go +++ b/cmd/list-management-group-descendants_test.go @@ -39,7 +39,7 @@ func TestListManagementGroupDescendants(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockManagementGroupsChannel := make(chan any) + mockManagementGroupsChannel := make(chan interface{}) mockManagementGroupDescendantChannel := make(chan azure.DescendantInfoResult) mockManagementGroupDescendantChannel2 := make(chan azure.DescendantInfoResult) diff --git a/cmd/list-management-group-role-assignments.go b/cmd/list-management-group-role-assignments.go index 950a85a..3d07121 100644 --- a/cmd/list-management-group-role-assignments.go +++ b/cmd/list-management-group-role-assignments.go @@ -58,7 +58,7 @@ func listManagementGroupRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string log.Info("collection completed", "duration", duration.String()) } -func listManagementGroupRoleAssignments(ctx context.Context, client client.AzureClient, managementGroups <-chan any) <-chan azureWrapper[models.ManagementGroupRoleAssignments] { +func listManagementGroupRoleAssignments(ctx context.Context, client client.AzureClient, managementGroups <-chan interface{}) <-chan azureWrapper[models.ManagementGroupRoleAssignments] { var ( out = make(chan azureWrapper[models.ManagementGroupRoleAssignments]) ids = make(chan string) diff --git a/cmd/list-management-group-role-assignments_test.go b/cmd/list-management-group-role-assignments_test.go index da18ab7..eed6954 100644 --- a/cmd/list-management-group-role-assignments_test.go +++ b/cmd/list-management-group-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListResourceGroupRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockResourceGroupsChannel := make(chan any) + mockResourceGroupsChannel := make(chan interface{}) mockResourceGroupRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockResourceGroupRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-management-groups.go b/cmd/list-management-groups.go index 30fd03e..2d02e5f 100644 --- a/cmd/list-management-groups.go +++ b/cmd/list-management-groups.go @@ -56,8 +56,8 @@ func listManagementGroupsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listManagementGroups(ctx context.Context, client client.AzureClient) <-chan any { - out := make(chan any) +func listManagementGroups(ctx context.Context, client client.AzureClient) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -75,7 +75,10 @@ func listManagementGroups(ctx context.Context, client client.AzureClient) <-chan TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZManagementGroup, mgmtGroup)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZManagementGroup, + Data: mgmtGroup, + }); !ok { return } } diff --git a/cmd/list-resource-group-role-assignments.go b/cmd/list-resource-group-role-assignments.go index b131def..055d3e0 100644 --- a/cmd/list-resource-group-role-assignments.go +++ b/cmd/list-resource-group-role-assignments.go @@ -59,7 +59,7 @@ func listResourceGroupRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) log.Info("collection completed", "duration", duration.String()) } -func listResourceGroupRoleAssignments(ctx context.Context, client client.AzureClient, resourceGroups <-chan any) <-chan azureWrapper[models.ResourceGroupRoleAssignments] { +func listResourceGroupRoleAssignments(ctx context.Context, client client.AzureClient, resourceGroups <-chan interface{}) <-chan azureWrapper[models.ResourceGroupRoleAssignments] { var ( out = make(chan azureWrapper[models.ResourceGroupRoleAssignments]) ids = make(chan string) diff --git a/cmd/list-resource-group-role-assignments_test.go b/cmd/list-resource-group-role-assignments_test.go index f8271f6..5c8c8bb 100644 --- a/cmd/list-resource-group-role-assignments_test.go +++ b/cmd/list-resource-group-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListManagementGroupRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockManagementGroupsChannel := make(chan any) + mockManagementGroupsChannel := make(chan interface{}) mockManagementGroupRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockManagementGroupRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-resource-groups.go b/cmd/list-resource-groups.go index 9149683..5f83d56 100644 --- a/cmd/list-resource-groups.go +++ b/cmd/list-resource-groups.go @@ -57,9 +57,9 @@ func listResourceGroupsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listResourceGroups(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listResourceGroups(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -98,7 +98,10 @@ func listResourceGroups(ctx context.Context, client client.AzureClient, subscrip } log.V(2).Info("found resource group", "resourceGroup", resourceGroup) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZResourceGroup, resourceGroup)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZResourceGroup, + Data: resourceGroup, + }); !ok { return } } diff --git a/cmd/list-resource-groups_test.go b/cmd/list-resource-groups_test.go index 665ec2f..78ac328 100644 --- a/cmd/list-resource-groups_test.go +++ b/cmd/list-resource-groups_test.go @@ -39,7 +39,7 @@ func TestListResourceGroups(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockSubscriptionsChannel := make(chan any) + mockSubscriptionsChannel := make(chan interface{}) mockResourceGroupChannel := make(chan azure.ResourceGroupResult) mockResourceGroupChannel2 := make(chan azure.ResourceGroupResult) diff --git a/cmd/list-role-assignments.go b/cmd/list-role-assignments.go index 954ff6c..0289c9e 100644 --- a/cmd/list-role-assignments.go +++ b/cmd/list-role-assignments.go @@ -58,9 +58,9 @@ func listRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listRoleAssignments(ctx context.Context, client client.AzureClient, roles <-chan any) <-chan any { +func listRoleAssignments(ctx context.Context, client client.AzureClient, roles <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,10 @@ func listRoleAssignments(ctx context.Context, client client.AzureClient, roles < roleAssignments.RoleAssignments = append(roleAssignments.RoleAssignments, item.Ok) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZRoleAssignment, roleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZRoleAssignment, + Data: roleAssignments, + }); !ok { return } log.V(1).Info("finished listing role assignments", "roleDefinitionId", id, "count", count) diff --git a/cmd/list-roles.go b/cmd/list-roles.go index 6660155..ab93352 100644 --- a/cmd/list-roles.go +++ b/cmd/list-roles.go @@ -55,8 +55,8 @@ func listRolesCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listRoles(ctx context.Context, client client.AzureClient) <-chan any { - out := make(chan any) +func listRoles(ctx context.Context, client client.AzureClient) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -68,13 +68,14 @@ func listRoles(ctx context.Context, client client.AzureClient) <-chan any { } else { log.V(2).Info("found role", "role", item) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( - enums.KindAZRole, - models.Role{ + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZRole, + Data: models.Role{ Role: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, - })); !ok { + }, + }); !ok { return } } diff --git a/cmd/list-root.go b/cmd/list-root.go index e4f8660..fb0d05d 100644 --- a/cmd/list-root.go +++ b/cmd/list-root.go @@ -61,7 +61,7 @@ func listCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listAll(ctx context.Context, client client.AzureClient) <-chan any { +func listAll(ctx context.Context, client client.AzureClient) <-chan interface{} { var ( azureAD = listAllAD(ctx, client) azureRM = listAllRM(ctx, client) diff --git a/cmd/list-service-principal-owners.go b/cmd/list-service-principal-owners.go index adbc68e..5e07aed 100644 --- a/cmd/list-service-principal-owners.go +++ b/cmd/list-service-principal-owners.go @@ -57,9 +57,9 @@ func listServicePrincipalOwnersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, servicePrincipals <-chan any) <-chan any { +func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, servicePrincipals <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -105,7 +105,10 @@ func listServicePrincipalOwners(ctx context.Context, client client.AzureClient, servicePrincipalOwners.Owners = append(servicePrincipalOwners.Owners, servicePrincipalOwner) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZServicePrincipalOwner, servicePrincipalOwners)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZServicePrincipalOwner, + Data: servicePrincipalOwners, + }); !ok { return } log.V(1).Info("finished listing service principal owners", "servicePrincipalId", id, "count", count) diff --git a/cmd/list-service-principal-owners_test.go b/cmd/list-service-principal-owners_test.go index ec4ddfc..1dff1d1 100644 --- a/cmd/list-service-principal-owners_test.go +++ b/cmd/list-service-principal-owners_test.go @@ -40,7 +40,7 @@ func TestListServicePrincipalOwners(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockServicePrincipalsChannel := make(chan any) + mockServicePrincipalsChannel := make(chan interface{}) mockServicePrincipalOwnerChannel := make(chan azure.ServicePrincipalOwnerResult) mockServicePrincipalOwnerChannel2 := make(chan azure.ServicePrincipalOwnerResult) diff --git a/cmd/list-service-principals.go b/cmd/list-service-principals.go index fd061aa..80500e9 100644 --- a/cmd/list-service-principals.go +++ b/cmd/list-service-principals.go @@ -55,8 +55,8 @@ func listServicePrincipalsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listServicePrincipals(ctx context.Context, client client.AzureClient) <-chan any { - out := make(chan any) +func listServicePrincipals(ctx context.Context, client client.AzureClient) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -68,13 +68,14 @@ func listServicePrincipals(ctx context.Context, client client.AzureClient) <-cha } else { log.V(2).Info("found service principal", "servicePrincipal", item) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( - enums.KindAZServicePrincipal, - models.ServicePrincipal{ + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZServicePrincipal, + Data: models.ServicePrincipal{ ServicePrincipal: item.Ok, TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, - })); !ok { + }, + }); !ok { return } } diff --git a/cmd/list-storage-account-role-assignments.go b/cmd/list-storage-account-role-assignments.go index a642982..4e5d0bc 100644 --- a/cmd/list-storage-account-role-assignments.go +++ b/cmd/list-storage-account-role-assignments.go @@ -59,9 +59,9 @@ func listStorageAccountRoleAssignmentsImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureClient, storageAccounts <-chan any) <-chan any { +func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureClient, storageAccounts <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -110,7 +110,10 @@ func listStorageAccountRoleAssignments(ctx context.Context, client client.AzureC storageAccountRoleAssignments.RoleAssignments = append(storageAccountRoleAssignments.RoleAssignments, storageAccountRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageAccountRoleAssignment, storageAccountRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZStorageAccountRoleAssignment, + Data: storageAccountRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing storage account role assignments", "storageAccountId", id, "count", count) diff --git a/cmd/list-storage-accounts.go b/cmd/list-storage-accounts.go index 181878f..143a645 100644 --- a/cmd/list-storage-accounts.go +++ b/cmd/list-storage-accounts.go @@ -57,9 +57,9 @@ func listStorageAccountsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listStorageAccounts(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listStorageAccounts(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -101,7 +101,10 @@ func listStorageAccounts(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found storage account", "storageAccount", storageAccount) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageAccount, storageAccount)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZStorageAccount, + Data: storageAccount, + }); !ok { return } } diff --git a/cmd/list-storage-containers.go b/cmd/list-storage-containers.go index 1b86521..08b04d1 100644 --- a/cmd/list-storage-containers.go +++ b/cmd/list-storage-containers.go @@ -59,10 +59,10 @@ func listStorageContainersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listStorageContainers(ctx context.Context, client client.AzureClient, storageAccounts <-chan any) <-chan any { +func listStorageContainers(ctx context.Context, client client.AzureClient, storageAccounts <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) - ids = make(chan any) + out = make(chan interface{}) + ids = make(chan interface{}) // The original size of the demuxxer cascaded into error messages for a lot of collection steps. // Decreasing the demuxxer size only here is sufficient to prevent the cascade // The error message with higher values for size is @@ -109,7 +109,10 @@ func listStorageContainers(ctx context.Context, client client.AzureClient, stora } log.V(2).Info("found storage container", "storageContainer", storageContainer) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZStorageContainer, storageContainer)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZStorageContainer, + Data: storageContainer, + }); !ok { return } } diff --git a/cmd/list-subscription-owners.go b/cmd/list-subscription-owners.go index 10f711e..af7dd59 100644 --- a/cmd/list-subscription-owners.go +++ b/cmd/list-subscription-owners.go @@ -60,8 +60,8 @@ func listSubscriptionOwnersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listSubscriptionOwners(ctx context.Context, client client.AzureClient, roleAssignments <-chan any) <-chan any { - out := make(chan any) +func listSubscriptionOwners(ctx context.Context, client client.AzureClient, roleAssignments <-chan interface{}) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -90,7 +90,10 @@ func listSubscriptionOwners(ctx context.Context, client client.AzureClient, role subscriptionOwners.Owners = append(subscriptionOwners.Owners, subscriptionOwner) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionOwner, subscriptionOwners)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZSubscriptionOwner, + Data: subscriptionOwners, + }); !ok { return } log.V(1).Info("finished listing subscription owners", "subscriptionId", roleAssignments.SubscriptionId, "count", count) diff --git a/cmd/list-subscription-owners_test.go b/cmd/list-subscription-owners_test.go index b52142c..7850fef 100644 --- a/cmd/list-subscription-owners_test.go +++ b/cmd/list-subscription-owners_test.go @@ -39,7 +39,7 @@ func TestListSubscriptionOwners(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockRoleAssignmentsChannel := make(chan any) + mockRoleAssignmentsChannel := make(chan interface{}) mockTenant := azure.Tenant{} mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes() channel := listSubscriptionOwners(ctx, mockClient, mockRoleAssignmentsChannel) diff --git a/cmd/list-subscription-role-assignments.go b/cmd/list-subscription-role-assignments.go index 2b95283..3f23107 100644 --- a/cmd/list-subscription-role-assignments.go +++ b/cmd/list-subscription-role-assignments.go @@ -58,9 +58,9 @@ func listSubscriptionRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -106,7 +106,10 @@ func listSubscriptionRoleAssignments(ctx context.Context, client client.AzureCli subscriptionRoleAssignments.RoleAssignments = append(subscriptionRoleAssignments.RoleAssignments, subscriptionRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionRoleAssignment, subscriptionRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZSubscriptionRoleAssignment, + Data: subscriptionRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing subscription role assignments", "subscriptionId", id, "count", count) diff --git a/cmd/list-subscription-role-assignments_test.go b/cmd/list-subscription-role-assignments_test.go index 308eab7..1902684 100644 --- a/cmd/list-subscription-role-assignments_test.go +++ b/cmd/list-subscription-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListSubscriptionRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockSubscriptionsChannel := make(chan any) + mockSubscriptionsChannel := make(chan interface{}) mockSubscriptionRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockSubscriptionRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-subscription-user-access-admins.go b/cmd/list-subscription-user-access-admins.go index 8ec173b..9947836 100644 --- a/cmd/list-subscription-user-access-admins.go +++ b/cmd/list-subscription-user-access-admins.go @@ -60,8 +60,8 @@ func listSubscriptionUserAccessAdminsCmdImpl(cmd *cobra.Command, args []string) log.Info("collection completed", "duration", duration.String()) } -func listSubscriptionUserAccessAdmins(ctx context.Context, client client.AzureClient, vmRoleAssignments <-chan any) <-chan any { - out := make(chan any) +func listSubscriptionUserAccessAdmins(ctx context.Context, client client.AzureClient, vmRoleAssignments <-chan interface{}) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -90,7 +90,10 @@ func listSubscriptionUserAccessAdmins(ctx context.Context, client client.AzureCl subscriptionUserAccessAdmins.UserAccessAdmins = append(subscriptionUserAccessAdmins.UserAccessAdmins, subscriptionUserAccessAdmin) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscriptionUserAccessAdmin, subscriptionUserAccessAdmins)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZSubscriptionUserAccessAdmin, + Data: subscriptionUserAccessAdmins, + }); !ok { return } log.V(1).Info("finished listing subscription user access admins", "subscriptionId", roleAssignments.SubscriptionId, "count", count) diff --git a/cmd/list-subscription-user-access-admins_test.go b/cmd/list-subscription-user-access-admins_test.go index 5dd5410..1a6a8dc 100644 --- a/cmd/list-subscription-user-access-admins_test.go +++ b/cmd/list-subscription-user-access-admins_test.go @@ -39,7 +39,7 @@ func TestListSubscriptionUserAccessAdmins(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockRoleAssignmentsChannel := make(chan any) + mockRoleAssignmentsChannel := make(chan interface{}) mockTenant := azure.Tenant{} mockClient.EXPECT().TenantInfo().Return(mockTenant).AnyTimes() channel := listSubscriptionUserAccessAdmins(ctx, mockClient, mockRoleAssignmentsChannel) diff --git a/cmd/list-subscriptions.go b/cmd/list-subscriptions.go index 6557de3..b2ee039 100644 --- a/cmd/list-subscriptions.go +++ b/cmd/list-subscriptions.go @@ -59,8 +59,8 @@ func listSubscriptionsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listSubscriptions(ctx context.Context, client client.AzureClient) <-chan any { - out := make(chan any) +func listSubscriptions(ctx context.Context, client client.AzureClient) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -97,7 +97,10 @@ func listSubscriptions(ctx context.Context, client client.AzureClient) <-chan an Subscription: item.Ok, } data.TenantId = client.TenantInfo().TenantId - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZSubscription, data)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZSubscription, + Data: data, + }); !ok { return } } diff --git a/cmd/list-tenants.go b/cmd/list-tenants.go index ae958d2..438cb79 100644 --- a/cmd/list-tenants.go +++ b/cmd/list-tenants.go @@ -55,20 +55,21 @@ func listTenantsCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listTenants(ctx context.Context, client client.AzureClient) <-chan any { - out := make(chan any) +func listTenants(ctx context.Context, client client.AzureClient) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) // Send the fully hydrated tenant that is being collected collectedTenant := client.TenantInfo() - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( - enums.KindAZTenant, - models.Tenant{ + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZTenant, + Data: models.Tenant{ Tenant: collectedTenant, Collected: true, - })); !ok { + }, + }); !ok { return } count := 1 @@ -82,11 +83,12 @@ func listTenants(ctx context.Context, client client.AzureClient) <-chan any { // Send the remaining tenant trusts if item.Ok.TenantId != collectedTenant.TenantId { - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper( - enums.KindAZTenant, - models.Tenant{ + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZTenant, + Data: models.Tenant{ Tenant: item.Ok, - })); !ok { + }, + }); !ok { return } } diff --git a/cmd/list-users.go b/cmd/list-users.go index 0c1a3ad..e02e37a 100644 --- a/cmd/list-users.go +++ b/cmd/list-users.go @@ -55,8 +55,8 @@ func listUsersCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listUsers(ctx context.Context, client client.AzureClient) <-chan any { - out := make(chan any) +func listUsers(ctx context.Context, client client.AzureClient) <-chan interface{} { + out := make(chan interface{}) go func() { defer close(out) @@ -85,7 +85,10 @@ func listUsers(ctx context.Context, client client.AzureClient) <-chan any { TenantId: client.TenantInfo().TenantId, TenantName: client.TenantInfo().DisplayName, } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZUser, user)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZUser, + Data: user, + }); !ok { return } } diff --git a/cmd/list-virtual-machine-role-assignments.go b/cmd/list-virtual-machine-role-assignments.go index 65f1450..d826a3f 100644 --- a/cmd/list-virtual-machine-role-assignments.go +++ b/cmd/list-virtual-machine-role-assignments.go @@ -58,7 +58,7 @@ func listVirtualMachineRoleAssignmentsCmdImpl(cmd *cobra.Command, args []string) log.Info("collection completed", "duration", duration.String()) } -func listVirtualMachineRoleAssignments(ctx context.Context, client client.AzureClient, virtualMachines <-chan any) <-chan azureWrapper[models.VirtualMachineRoleAssignments] { +func listVirtualMachineRoleAssignments(ctx context.Context, client client.AzureClient, virtualMachines <-chan interface{}) <-chan azureWrapper[models.VirtualMachineRoleAssignments] { var ( out = make(chan azureWrapper[models.VirtualMachineRoleAssignments]) ids = make(chan string) diff --git a/cmd/list-virtual-machine-role-assignments_test.go b/cmd/list-virtual-machine-role-assignments_test.go index 69cfb2d..dffaf79 100644 --- a/cmd/list-virtual-machine-role-assignments_test.go +++ b/cmd/list-virtual-machine-role-assignments_test.go @@ -40,7 +40,7 @@ func TestListVirtualMachineRoleAssignments(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockVirtualMachinesChannel := make(chan any) + mockVirtualMachinesChannel := make(chan interface{}) mockVirtualMachineRoleAssignmentChannel := make(chan azure.RoleAssignmentResult) mockVirtualMachineRoleAssignmentChannel2 := make(chan azure.RoleAssignmentResult) diff --git a/cmd/list-virtual-machines.go b/cmd/list-virtual-machines.go index b9e4830..ad4b78e 100644 --- a/cmd/list-virtual-machines.go +++ b/cmd/list-virtual-machines.go @@ -57,9 +57,9 @@ func listVirtualMachinesCmdImpl(cmd *cobra.Command, args []string) { log.Info("collection completed", "duration", duration.String()) } -func listVirtualMachines(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listVirtualMachines(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -99,7 +99,10 @@ func listVirtualMachines(ctx context.Context, client client.AzureClient, subscri } log.V(2).Info("found virtual machine", "virtualMachine", virtualMachine) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZVM, virtualMachine)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZVM, + Data: virtualMachine, + }); !ok { return } } diff --git a/cmd/list-virtual-machines_test.go b/cmd/list-virtual-machines_test.go index 39fcb63..58b9113 100644 --- a/cmd/list-virtual-machines_test.go +++ b/cmd/list-virtual-machines_test.go @@ -39,7 +39,7 @@ func TestListVirtualMachines(t *testing.T) { mockClient := mocks.NewMockAzureClient(ctrl) - mockSubscriptionsChannel := make(chan any) + mockSubscriptionsChannel := make(chan interface{}) mockVirtualMachineChannel := make(chan azure.VirtualMachineResult) mockVirtualMachineChannel2 := make(chan azure.VirtualMachineResult) diff --git a/cmd/list-vm-scale-set-role-assignments.go b/cmd/list-vm-scale-set-role-assignments.go index f5b3adb..80c5a52 100644 --- a/cmd/list-vm-scale-set-role-assignments.go +++ b/cmd/list-vm-scale-set-role-assignments.go @@ -64,9 +64,9 @@ func listVMScaleSetRoleAssignmentImpl(cmd *cobra.Command, args []string) { } } -func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClient, vmScaleSets <-chan any) <-chan any { +func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClient, vmScaleSets <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,10 @@ func listVMScaleSetRoleAssignments(ctx context.Context, client client.AzureClien vmScaleSetRoleAssignments.RoleAssignments = append(vmScaleSetRoleAssignments.RoleAssignments, vmScaleSetRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMScaleSetRoleAssignment, vmScaleSetRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZVMScaleSetRoleAssignment, + Data: vmScaleSetRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing vm scale set role assignments", "vmScaleSetId", id, "count", count) diff --git a/cmd/list-vm-scale-sets.go b/cmd/list-vm-scale-sets.go index 9e706df..9623a54 100644 --- a/cmd/list-vm-scale-sets.go +++ b/cmd/list-vm-scale-sets.go @@ -62,9 +62,9 @@ func listVMScaleSetsCmdImpl(cmd *cobra.Command, args []string) { } } -func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -104,7 +104,10 @@ func listVMScaleSets(ctx context.Context, client client.AzureClient, subscriptio } log.V(2).Info("found virtual machine scale set", "vmScaleSet", vmScaleSet) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZVMScaleSet, vmScaleSet)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZVMScaleSet, + Data: vmScaleSet, + }); !ok { return } } diff --git a/cmd/list-web-app-role-assignments.go b/cmd/list-web-app-role-assignments.go index ab9176b..3b45efb 100644 --- a/cmd/list-web-app-role-assignments.go +++ b/cmd/list-web-app-role-assignments.go @@ -64,9 +64,9 @@ func listWebAppRoleAssignmentImpl(cmd *cobra.Command, args []string) { } } -func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, webApps <-chan any) <-chan any { +func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, webApps <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -115,7 +115,10 @@ func listWebAppRoleAssignments(ctx context.Context, client client.AzureClient, w webAppRoleAssignments.RoleAssignments = append(webAppRoleAssignments.RoleAssignments, webAppRoleAssignment) } } - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZWebAppRoleAssignment, webAppRoleAssignments)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZWebAppRoleAssignment, + Data: webAppRoleAssignments, + }); !ok { return } log.V(1).Info("finished listing web app role assignments", "webAppId", id, "count", count) diff --git a/cmd/list-web-apps.go b/cmd/list-web-apps.go index 4580cfc..ac1bad7 100644 --- a/cmd/list-web-apps.go +++ b/cmd/list-web-apps.go @@ -62,9 +62,9 @@ func listWebAppsCmdImpl(cmd *cobra.Command, args []string) { } } -func listWebApps(ctx context.Context, client client.AzureClient, subscriptions <-chan any) <-chan any { +func listWebApps(ctx context.Context, client client.AzureClient, subscriptions <-chan interface{}) <-chan interface{} { var ( - out = make(chan any) + out = make(chan interface{}) ids = make(chan string) streams = pipeline.Demux(ctx.Done(), ids, 25) wg sync.WaitGroup @@ -105,7 +105,10 @@ func listWebApps(ctx context.Context, client client.AzureClient, subscriptions < if webApp.Kind == "app" { log.V(2).Info("found web app", "webApp", webApp) count++ - if ok := pipeline.SendAny(ctx.Done(), out, NewAzureWrapper(enums.KindAZWebApp, webApp)); !ok { + if ok := pipeline.SendAny(ctx.Done(), out, AzureWrapper{ + Kind: enums.KindAZWebApp, + Data: webApp, + }); !ok { return } } diff --git a/cmd/start.go b/cmd/start.go index d9fc245..064fce3 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -177,7 +177,7 @@ func start(ctx context.Context) { } } -func ingest(ctx context.Context, bheUrl url.URL, bheClient *http.Client, in <-chan []any) bool { +func ingest(ctx context.Context, bheUrl url.URL, bheClient *http.Client, in <-chan []interface{}) bool { endpoint := bheUrl.ResolveReference(&url.URL{Path: "/api/v2/ingest"}) var ( diff --git a/cmd/utils.go b/cmd/utils.go index 8126e05..fd59f82 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -423,8 +423,8 @@ func setupLogger() { // deprecated: use azureWrapper instead type AzureWrapper struct { - Kind enums.Kind `json:"kind"` - Data any `json:"data"` + Kind enums.Kind `json:"kind"` + Data interface{} `json:"data"` } type azureWrapper[T any] struct { diff --git a/config/internal/config.go b/config/internal/config.go index 81cc1de..bf45a9e 100644 --- a/config/internal/config.go +++ b/config/internal/config.go @@ -35,10 +35,10 @@ type Config struct { Usage string Required bool Persistent bool - Default any + Default interface{} } -func (s Config) Value() any { +func (s Config) Value() interface{} { if reflect.ValueOf(s.Default).Kind() == reflect.Slice { return viper.GetStringSlice(s.Name) } else { @@ -46,7 +46,7 @@ func (s Config) Value() any { } } -func (s Config) Set(value any) { +func (s Config) Set(value interface{}) { viper.Set(s.Name, value) } diff --git a/logger/internal/logger.go b/logger/internal/logger.go index be9bacc..e27fa5c 100644 --- a/logger/internal/logger.go +++ b/logger/internal/logger.go @@ -101,7 +101,7 @@ func (s logSink) Enabled(level int) bool { // Error logs an error, with the given message and key/value pairs as // context. See logr.Logger.Error for more details. -func (s logSink) Error(err error, msg string, keysAndValues ...any) { +func (s logSink) Error(err error, msg string, keysAndValues ...interface{}) { logEvent := s.logger.Error().Err(err) s.log(logEvent, msg, keysAndValues) } @@ -110,7 +110,7 @@ func (s logSink) Error(err error, msg string, keysAndValues ...any) { // The level argument is provided for optional logging. This method will // only be called when Enabled(level) is true. See logr.Logger.Info for more // details. -func (s logSink) Info(level int, msg string, keysAndValues ...any) { +func (s logSink) Info(level int, msg string, keysAndValues ...interface{}) { lvl := calcLevel(level) logEvent := s.logger.WithLevel(lvl) s.log(logEvent, msg, keysAndValues) @@ -131,7 +131,7 @@ func (s logSink) WithName(name string) logr.LogSink { // WithValues returns a new logr.LogSink with additional key/value pairs. See // logr.Logger.WithValues for more details. -func (s logSink) WithValues(keysAndValues ...any) logr.LogSink { +func (s logSink) WithValues(keysAndValues ...interface{}) logr.LogSink { logger := s.logger.With().Fields(keysAndValues).Logger() s.logger = &logger return &s @@ -153,7 +153,7 @@ func (s logSink) WithCallDepth(depth int) logr.LogSink { return &s } -func (s logSink) log(e *zerolog.Event, msg string, keysAndValues []any) { +func (s logSink) log(e *zerolog.Event, msg string, keysAndValues []interface{}) { if e != nil { if s.name != "" { e.Str("name", s.name) diff --git a/models/azure/app_role_assignment.go b/models/azure/app_role_assignment.go index 1b840c3..dab358b 100644 --- a/models/azure/app_role_assignment.go +++ b/models/azure/app_role_assignment.go @@ -22,6 +22,7 @@ import "github.com/gofrs/uuid" // Represents an application role that can be requested by (and granted to) a client application, or that can be used to // assign an application to users or groups in a specified role. // +// // An app role assignment is a relationship between the assigned principal (a user, a group, or a service principal), // a resource application (the app's service principal) and an app role defined on the resource application. // diff --git a/models/azure/app_scope.go b/models/azure/app_scope.go index ea0f826..de8f8fb 100644 --- a/models/azure/app_scope.go +++ b/models/azure/app_scope.go @@ -23,8 +23,8 @@ package azure // // This may be in both the following principal and scope scenarios: // -// A single principal and a single scope -// Multiple principals and multiple scopes. +// A single principal and a single scope +// Multiple principals and multiple scopes. type AppScope struct { Entity diff --git a/models/azure/cloning_info.go b/models/azure/cloning_info.go index b3f38b9..8d42ec0 100644 --- a/models/azure/cloning_info.go +++ b/models/azure/cloning_info.go @@ -18,15 +18,15 @@ package azure type CloningInfo struct { - AppSettingsOverrides any `json:"appSettingsOverrides,omitempty"` - CloneCustomHostNames bool `json:"cloneCustomHostNames,omitempty"` - CloneSourceControl bool `json:"cloneSourceControl,omitempty"` - ConfigureLoadBalancing bool `json:"configureLoadBalancing,omitempty"` - CorrelationId string `json:"correlationId,omitempty"` - HostingEnvironment string `json:"hostingEnvironment,omitempty"` - Overwrite bool `json:"overwrite,omitempty"` - SourceWebAppId string `json:"sourceWebAppId,omitempty"` - SourceWebAppLocation string `json:"sourceWebAppLocation,omitempty"` - TrafficManagerProfileId string `json:"trafficManagerProfileId,omitempty"` - TrafficManagerProfileName string `json:"trafficManagerProfileName,omitempty"` + AppSettingsOverrides interface{} `json:"appSettingsOverrides,omitempty"` + CloneCustomHostNames bool `json:"cloneCustomHostNames,omitempty"` + CloneSourceControl bool `json:"cloneSourceControl,omitempty"` + ConfigureLoadBalancing bool `json:"configureLoadBalancing,omitempty"` + CorrelationId string `json:"correlationId,omitempty"` + HostingEnvironment string `json:"hostingEnvironment,omitempty"` + Overwrite bool `json:"overwrite,omitempty"` + SourceWebAppId string `json:"sourceWebAppId,omitempty"` + SourceWebAppLocation string `json:"sourceWebAppLocation,omitempty"` + TrafficManagerProfileId string `json:"trafficManagerProfileId,omitempty"` + TrafficManagerProfileName string `json:"trafficManagerProfileName,omitempty"` } diff --git a/models/azure/ip_security_restriction.go b/models/azure/ip_security_restriction.go index 2cf987e..414d6d2 100644 --- a/models/azure/ip_security_restriction.go +++ b/models/azure/ip_security_restriction.go @@ -22,7 +22,7 @@ import "github.com/bloodhoundad/azurehound/v2/enums" type IpSecurityRestriction struct { Action string `json:"action,omitempty"` Description string `json:"description,omitempty"` - Headers any `json:"headers,omitempty"` + Headers interface{} `json:"headers,omitempty"` IpAddress string `json:"ipAddress,omitempty"` Name string `json:"name,omitempty"` Priority int `json:"priority,omitempty"` diff --git a/models/azure/logic_app_definition.go b/models/azure/logic_app_definition.go index 1135a52..2cff0bb 100644 --- a/models/azure/logic_app_definition.go +++ b/models/azure/logic_app_definition.go @@ -21,7 +21,7 @@ type Definition struct { Schema string `json:"$schema,omitempty"` // Certain actions can be nested, have different elements based on the name(key) of given action - Condition is an example // Actions map[string]Action `json:"actions,omitempty"` - Actions map[string]any `json:"actions,omitempty"` + Actions map[string]interface{} `json:"actions,omitempty"` ContentVersion string `json:"contentVersion,omitempty"` Outputs map[string]Output `json:"outputs,omitempty"` Parameters map[string]Parameter `json:"parameters,omitempty"` @@ -32,28 +32,28 @@ type Definition struct { type Action struct { Type string `json:"type"` // Kind is missing in the MSDN, but returned and present in examples and during testing - Kind string `json:"kind,omitempty"` - Inputs map[string]any `json:"inputs,omitempty"` - RunAfter any `json:"runAfter,omitempty"` - RuntimeConfiguration any `json:"runtimeConfiguration,omitempty"` - OperationOptions string `json:"operationOptions,omitempty"` + Kind string `json:"kind,omitempty"` + Inputs map[string]interface{} `json:"inputs,omitempty"` + RunAfter interface{} `json:"runAfter,omitempty"` + RuntimeConfiguration interface{} `json:"runtimeConfiguration,omitempty"` + OperationOptions string `json:"operationOptions,omitempty"` } type Output struct { Type string `json:"type,omitempty"` // Type of this is based on above Type - Value any `json:"value,omitempty"` + Value interface{} `json:"value,omitempty"` } type Parameter struct { - Type string `json:"type,omitempty"` - DefaultValue any `json:"defaultValue,omitempty"` - AllowedValues []any `json:"allowedValues,omitempty"` - Metadata Metadata `json:"metadata,omitempty"` + Type string `json:"type,omitempty"` + DefaultValue interface{} `json:"defaultValue,omitempty"` + AllowedValues []interface{} `json:"allowedValues,omitempty"` + Metadata Metadata `json:"metadata,omitempty"` } type Metadata struct { - Description any `json:"description,omitempty"` + Description interface{} `json:"description,omitempty"` } type StaticResult struct { @@ -71,13 +71,13 @@ type Trigger struct { // Kind is missing in the MSDN, but returned and present in examples and during testing Kind string `json:"kind,omitempty"` // Inputs is a custom element based on the type of trigger - Inputs any `json:"inputs,omitempty"` + Inputs interface{} `json:"inputs,omitempty"` Recurrence Recurrence `json:"recurrence,omitempty"` Conditions []Condition `json:"conditions,omitempty"` // Runtime configuration is a custom element based on the type of trigger - RuntimeConfiguration any `json:"runtimeConfiguration,omitempty"` - SplitOn string `json:"splitOn,omitempty"` - OperationOptions string `json:"operationOptions,omitempty"` + RuntimeConfiguration interface{} `json:"runtimeConfiguration,omitempty"` + SplitOn string `json:"splitOn,omitempty"` + OperationOptions string `json:"operationOptions,omitempty"` } type Recurrence struct { diff --git a/models/azure/logic_app_parameter.go b/models/azure/logic_app_parameter.go index d69a0b6..8cfc424 100644 --- a/models/azure/logic_app_parameter.go +++ b/models/azure/logic_app_parameter.go @@ -24,15 +24,15 @@ import ( type LogicAppParameter struct { Description string `json:"description,omitempty"` //Metadata - marked as object in MSDN, however no other description available - in testing was not able to return a value here - Metadata any `json:"metadata,omitempty"` + Metadata interface{} `json:"metadata,omitempty"` Type enums.ParameterType `json:"type,omitempty"` - Value any `json:"value,omitempty"` + Value interface{} `json:"value,omitempty"` } -func (s LogicAppParameter) GetValue() any { +func (s LogicAppParameter) GetValue() interface{} { switch s.Type { case enums.ArrayType: - return s.Value.([]any) + return s.Value.([]interface{}) case enums.BoolType: return s.Value.(bool) case enums.FloatType: diff --git a/models/azure/site_config.go b/models/azure/site_config.go index cd45801..ad1b4a8 100644 --- a/models/azure/site_config.go +++ b/models/azure/site_config.go @@ -89,26 +89,26 @@ type SiteConfig struct { XManagedServiceIdentityId int `json:"xManagedServiceIdentityId,omitempty"` //Following ones have been found in testing, but not present in the documentation - AntivirusScanEnabled bool `json:"antivirusScanEnabled,omitempty"` - AzureMonitorLogCategories any `json:"azureMonitorLogCategories,omitempty"` - CustomAppPoolIdentityAdminState any `json:"customAppPoolIdentityAdminState,omitempty"` - CustomAppPoolIdentityTenantState any `json:"customAppPoolIdentityTenantState,omitempty"` - ElasticWebAppScaleLimit any `json:"elasticWebAppScaleLimit,omitempty"` - FileChangeAuditEnabled bool `json:"fileChangeAuditEnabled,omitempty"` - Http20ProxyFlag any `json:"http20ProxyFlag,omitempty"` - IpSecurityRestrictionsDefaultAction any `json:"ipSecurityRestrictionsDefaultAction,omitempty"` - Metadata any `json:"metadata,omitempty"` - MinTlsCipherSuite any `json:"minTlsCipherSuite,omitempty"` - PublishingPassword any `json:"publishingPassword,omitempty"` - RoutingRules any `json:"routingRules,omitempty"` - RuntimeADUser any `json:"runtimeADUser,omitempty"` - RuntimeADUserPassword any `json:"runtimeADUserPassword,omitempty"` - ScmIpSecurityRestrictionsDefaultAction any `json:"scmIpSecurityRestrictionsDefaultAction,omitempty"` - SitePort any `json:"sitePort,omitempty"` - StorageType any `json:"storageType,omitempty"` - SupportedTlsCipherSuites any `json:"supportedTlsCipherSuites,omitempty"` - WinAuthAdminState any `json:"winAuthAdminState,omitempty"` - WinAuthTenantState any `json:"winAuthTenantState,omitempty"` + AntivirusScanEnabled bool `json:"antivirusScanEnabled,omitempty"` + AzureMonitorLogCategories interface{} `json:"azureMonitorLogCategories,omitempty"` + CustomAppPoolIdentityAdminState interface{} `json:"customAppPoolIdentityAdminState,omitempty"` + CustomAppPoolIdentityTenantState interface{} `json:"customAppPoolIdentityTenantState,omitempty"` + ElasticWebAppScaleLimit interface{} `json:"elasticWebAppScaleLimit,omitempty"` + FileChangeAuditEnabled bool `json:"fileChangeAuditEnabled,omitempty"` + Http20ProxyFlag interface{} `json:"http20ProxyFlag,omitempty"` + IpSecurityRestrictionsDefaultAction interface{} `json:"ipSecurityRestrictionsDefaultAction,omitempty"` + Metadata interface{} `json:"metadata,omitempty"` + MinTlsCipherSuite interface{} `json:"minTlsCipherSuite,omitempty"` + PublishingPassword interface{} `json:"publishingPassword,omitempty"` + RoutingRules interface{} `json:"routingRules,omitempty"` + RuntimeADUser interface{} `json:"runtimeADUser,omitempty"` + RuntimeADUserPassword interface{} `json:"runtimeADUserPassword,omitempty"` + ScmIpSecurityRestrictionsDefaultAction interface{} `json:"scmIpSecurityRestrictionsDefaultAction,omitempty"` + SitePort interface{} `json:"sitePort,omitempty"` + StorageType interface{} `json:"storageType,omitempty"` + SupportedTlsCipherSuites interface{} `json:"supportedTlsCipherSuites,omitempty"` + WinAuthAdminState interface{} `json:"winAuthAdminState,omitempty"` + WinAuthTenantState interface{} `json:"winAuthTenantState,omitempty"` } type ApiDefinitionInfo struct { diff --git a/models/azure/storage_container_props.go b/models/azure/storage_container_props.go index 14724d1..d22a34a 100644 --- a/models/azure/storage_container_props.go +++ b/models/azure/storage_container_props.go @@ -35,7 +35,7 @@ type StorageContainerProperties struct { LeaseState enums.LeaseState `json:"leaseState,omitempty"` LeaseStatus enums.LeaseStatus `json:"leaseStatus,omitempty"` LegalHold LegalHoldProperties `json:"legalHold,omitempty"` - Metadata any `json:"metadata,omitempty"` + Metadata interface{} `json:"metadata,omitempty"` PublicAccess enums.PublicAccess `json:"publicAccess,omitempty"` RemainingRetentionDays int `json:"remainingRetentionDays,omitempty"` Version string `json:"version,omitempty"` diff --git a/models/ingest-request.go b/models/ingest-request.go index 98d955f..6ba0dba 100644 --- a/models/ingest-request.go +++ b/models/ingest-request.go @@ -18,8 +18,8 @@ package models type IngestRequest struct { - Meta Meta `json:"meta"` - Data any `json:"data"` + Meta Meta `json:"meta"` + Data interface{} `json:"data"` } type Meta struct { diff --git a/pipeline/pipeline.go b/pipeline/pipeline.go index a124593..d4b4df5 100644 --- a/pipeline/pipeline.go +++ b/pipeline/pipeline.go @@ -81,7 +81,7 @@ func OrDone[D, T any](done <-chan D, in <-chan T) <-chan T { // Mux joins multiple channels and returns a channel as single stream of data. func Mux[D any](done <-chan D, channels ...<-chan any) <-chan any { var wg sync.WaitGroup - out := make(chan any) + out := make(chan interface{}) muxer := func(channel <-chan any) { defer wg.Done() diff --git a/pipeline/pipeline_test.go b/pipeline/pipeline_test.go index a112ebc..07c3617 100644 --- a/pipeline/pipeline_test.go +++ b/pipeline/pipeline_test.go @@ -28,7 +28,7 @@ import ( func TestBatch(t *testing.T) { - done := make(chan any) + done := make(chan interface{}) in := make(chan string) go func() { @@ -71,7 +71,7 @@ func TestBatch(t *testing.T) { func TestDemux(t *testing.T) { var ( - done = make(chan any) + done = make(chan interface{}) in = make(chan string) wg sync.WaitGroup count int