Skip to content

Commit

Permalink
Addressing code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
srgg committed Feb 27, 2023
1 parent 52cef8a commit f07807a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion azure/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ 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),
"azure_compute_virtual_machine_metric_cpu_utilization_hourly": tableAzureComputeVirtualMachineMetricCpuUtilizationHourly(ctx),
"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),
Expand Down
13 changes: 9 additions & 4 deletions azure/table_azure_compute_ssh_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"),
},
Expand Down Expand Up @@ -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
}

Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit f07807a

Please sign in to comment.