Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix azure_storage_queue Queue is not supported for the storage account closes #458 #467

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions azure/table_azure_storage_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package azure

import (
"context"
"strings"

"github.com/Azure/azure-sdk-for-go/services/storage/mgmt/2019-06-01/storage"
"github.com/turbot/steampipe-plugin-sdk/v2/grpc/proto"
Expand Down Expand Up @@ -30,8 +31,8 @@ func tableAzureStorageQueue(_ context.Context) *plugin.Table {
ShouldIgnoreError: isNotFoundError([]string{"ResourceNotFound", "QueueNotFound", "ResourceGroupNotFound"}),
},
List: &plugin.ListConfig{
ParentHydrate: listStorageAccounts,
Hydrate: listStorageQueues,
ParentHydrate: listStorageAccounts,
Hydrate: listStorageQueues,
},
Columns: azureColumns([]*plugin.Column{
{
Expand Down Expand Up @@ -101,8 +102,8 @@ func listStorageQueues(ctx context.Context, d *plugin.QueryData, h *plugin.Hydra
// Get the details of storage account
account := h.Item.(*storageAccountInfo)

// Queue is not supported for the account if storage type is FileStorage
if account.Account.Kind == "FileStorage" {
// Queue is not supported for the account if storage type is FileStorage or BlockBlobStorage
if account.Account.Kind == "FileStorage" || account.Account.Kind == "BlockBlobStorage" {
return nil, nil
}

Expand All @@ -117,6 +118,14 @@ func listStorageQueues(ctx context.Context, d *plugin.QueryData, h *plugin.Hydra

result, err := storageClient.List(ctx, *account.ResourceGroup, *account.Name, "", "")
if err != nil {
/*
* For storage account type 'Page Blob' we are getting the kind value as 'StorageV2'.
* Storage account type 'Page Blob' does not support table, so we are getting 'FeatureNotSupportedForAccount'/'OperationNotAllowedOnKind' error.
* With same kind(StorageV2) of storage account, we my have different type(File Share) of storage account so we need to handle this particular error.
*/
if strings.Contains(err.Error(), "FeatureNotSupportedForAccount") || strings.Contains(err.Error(), "OperationNotAllowedOnKind") {
return nil, nil
}
return nil, err
}

Expand Down