From f07807a63d26176b4b866941166cd247ea5280de Mon Sep 17 00:00:00 2001 From: Sergey Galkin Date: Mon, 27 Feb 2023 15:15:04 -0700 Subject: [PATCH] Addressing code review comments --- azure/plugin.go | 2 +- azure/table_azure_compute_ssh_key.go | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/azure/plugin.go b/azure/plugin.go index 2e9e63cd..fffe38a9 100644 --- a/azure/plugin.go +++ b/azure/plugin.go @@ -54,6 +54,7 @@ func Plugin(ctx context.Context) *plugin.Plugin { "azure_compute_image": tableAzureComputeImage(ctx), "azure_compute_resource_sku": tableAzureResourceSku(ctx), "azure_compute_snapshot": tableAzureComputeSnapshot(ctx), + "azure_compute_ssh_key": tableAzureComputeSshKey(ctx), "azure_compute_virtual_machine": tableAzureComputeVirtualMachine(ctx), "azure_compute_virtual_machine_metric_cpu_utilization": tableAzureComputeVirtualMachineMetricCpuUtilization(ctx), "azure_compute_virtual_machine_metric_cpu_utilization_daily": tableAzureComputeVirtualMachineMetricCpuUtilizationDaily(ctx), @@ -61,7 +62,6 @@ func Plugin(ctx context.Context) *plugin.Plugin { "azure_compute_virtual_machine_scale_set": tableAzureComputeVirtualMachineScaleSet(ctx), "azure_compute_virtual_machine_scale_set_network_interface": tableAzureComputeVirtualMachineScaleSetNetworkInterface(ctx), "azure_compute_virtual_machine_scale_set_vm": tableAzureComputeVirtualMachineScaleSetVm(ctx), - "azure_compute_ssh_key": tableAzureComputeSshKey(ctx), "azure_container_registry": tableAzureContainerRegistry(ctx), "azure_cosmosdb_account": tableAzureCosmosDBAccount(ctx), "azure_cosmosdb_mongo_database": tableAzureCosmosDBMongoDatabase(ctx), diff --git a/azure/table_azure_compute_ssh_key.go b/azure/table_azure_compute_ssh_key.go index 741ac386..22abb5d1 100644 --- a/azure/table_azure_compute_ssh_key.go +++ b/azure/table_azure_compute_ssh_key.go @@ -2,6 +2,7 @@ package azure import ( "context" + "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-01/compute" "github.com/turbot/steampipe-plugin-sdk/v4/grpc/proto" "github.com/turbot/steampipe-plugin-sdk/v4/plugin" @@ -27,23 +28,23 @@ func tableAzureComputeSshKey(_ context.Context) *plugin.Table { Columns: azureColumns([]*plugin.Column{ { Name: "id", - Description: "The unique id identifying the resource in subscription", + Description: "The unique ID identifying the resource in subscription.", Type: proto.ColumnType_STRING, Transform: transform.FromGo(), }, { Name: "name", - Description: "Name of the ssh key", + Description: "Name of the ssh key.", Type: proto.ColumnType_STRING, }, { Name: "type", - Description: "The type of the resource in Azure", + Description: "The type of the resource in Azure.", Type: proto.ColumnType_STRING, }, { Name: "public_key", - Description: "SSH public key", + Description: "SSH public key.", Type: proto.ColumnType_STRING, Transform: transform.FromField("SSHPublicKeyResourceProperties.PublicKey"), }, @@ -90,6 +91,7 @@ func listAzureComputeSshKeys(ctx context.Context, d *plugin.QueryData, _ *plugin plugin.Logger(ctx).Trace("listAzureComputeSshKeys") session, err := GetNewSession(ctx, d, "MANAGEMENT") if err != nil { + plugin.Logger(ctx).Error("azure_compute_ssh_key. listAzureComputeSshKeys", "client_error", err) return nil, err } @@ -98,6 +100,7 @@ func listAzureComputeSshKeys(ctx context.Context, d *plugin.QueryData, _ *plugin client.Authorizer = session.Authorizer result, err := client.ListBySubscription(ctx) if err != nil { + plugin.Logger(ctx).Error("azure_compute_ssh_key. listAzureComputeSshKeys", "query_error", err) return nil, err } @@ -139,6 +142,7 @@ func getAzureComputeSshKey(ctx context.Context, d *plugin.QueryData, h *plugin.H session, err := GetNewSession(ctx, d, "MANAGEMENT") if err != nil { + plugin.Logger(ctx).Error("azure_compute_ssh_key. getAzureComputeSshKey", "client_error", err) return nil, err } subscriptionID := session.SubscriptionID @@ -147,6 +151,7 @@ func getAzureComputeSshKey(ctx context.Context, d *plugin.QueryData, h *plugin.H op, err := client.Get(ctx, resourceGroup, name) if err != nil { + plugin.Logger(ctx).Error("azure_compute_ssh_key. getAzureComputeSshKey", "query_error", err) return nil, err }