Skip to content

Commit

Permalink
Rename common column environment_name to cloud_environment #416 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
misraved authored Jan 6, 2022
1 parent fccabfa commit 7272e17
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions azure/common_columns.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import (
func commonColumns() []*plugin.Column {
return []*plugin.Column{
{
Name: "environment_name",
Name: "cloud_environment",
Type: proto.ColumnType_STRING,
Hydrate: getEnvironmentName,
Description: ColumnDescriptionEnvironmentName,
Hydrate: getCloudEnvironment,
Description: ColumnDescriptionCloudEnvironment,
Transform: transform.FromValue(),
},
{
Expand Down Expand Up @@ -52,9 +52,9 @@ func getSubscriptionID(ctx context.Context, d *plugin.QueryData, h *plugin.Hydra
return session.SubscriptionID, nil
}

func getEnvironmentName(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
plugin.Logger(ctx).Trace("getEnvironmentName")
cacheKey := "getEnvironmentName"
func getCloudEnvironment(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData) (interface{}, error) {
plugin.Logger(ctx).Trace("getCloudEnvironment")
cacheKey := "getCloudEnvironment"

if cachedData, ok := d.ConnectionManager.Cache.Get(cacheKey); ok {
return cachedData.(string), nil
Expand All @@ -66,7 +66,7 @@ func getEnvironmentName(ctx context.Context, d *plugin.QueryData, h *plugin.Hydr
}

// cache environment name for the session
d.ConnectionManager.Cache.Set(cacheKey, session.EnvironmentName)
d.ConnectionManager.Cache.Set(cacheKey, session.CloudEnvironment)

return session.EnvironmentName, nil
return session.CloudEnvironment, nil
}
6 changes: 3 additions & 3 deletions azure/monitoring_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ func commonMonitoringMetricColumns() []*plugin.Column {
Type: proto.ColumnType_STRING,
},
{
Name: "environment_name",
Description: ColumnDescriptionEnvironmentName,
Name: "cloud_environment",
Description: ColumnDescriptionCloudEnvironment,
Type: proto.ColumnType_STRING,
Hydrate: plugin.HydrateFunc(getEnvironmentName).WithCache(),
Hydrate: plugin.HydrateFunc(getCloudEnvironment).WithCache(),
Transform: transform.FromValue(),
},
{
Expand Down
6 changes: 3 additions & 3 deletions azure/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
// Session info
type Session struct {
Authorizer autorest.Authorizer
EnvironmentName string
CloudEnvironment string
Expires *time.Time
GraphEndpoint string
ResourceManagerEndpoint string
Expand Down Expand Up @@ -151,7 +151,7 @@ func GetNewSession(ctx context.Context, d *plugin.QueryData, tokenAudience strin
return nil, err
}

// Get the subscription ID and tenant ID for "GRAPH" token audience
// Get the subscription ID and tenant ID for "GRAPH" token audience
case "CLI":
authorizer, err = auth.NewAuthorizerFromCLIWithResource(resource)
if err != nil {
Expand Down Expand Up @@ -202,7 +202,7 @@ func GetNewSession(ctx context.Context, d *plugin.QueryData, tokenAudience strin

sess := &Session{
Authorizer: authorizer,
EnvironmentName: settings.Environment.Name,
CloudEnvironment: settings.Environment.Name,
Expires: &expiresOn,
GraphEndpoint: settings.Environment.GraphEndpoint,
ResourceManagerEndpoint: settings.Environment.ResourceManagerEndpoint,
Expand Down
6 changes: 3 additions & 3 deletions azure/table_azure_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ func tableAzureSubscription(_ context.Context) *plugin.Table {

// Azure standard columns
{
Name: "environment_name",
Description: ColumnDescriptionEnvironmentName,
Name: "cloud_environment",
Description: ColumnDescriptionCloudEnvironment,
Type: proto.ColumnType_STRING,
Hydrate: plugin.HydrateFunc(getEnvironmentName).WithCache(),
Hydrate: plugin.HydrateFunc(getCloudEnvironment).WithCache(),
Transform: transform.FromValue(),
},
},
Expand Down
14 changes: 7 additions & 7 deletions azure/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ func convertDateUnixToTime(ctx context.Context, d *transform.TransformData) (int

// Constants for Standard Column Descriptions
const (
ColumnDescriptionAkas = "Array of globally unique identifier strings (also known as) for the resource."
ColumnDescriptionEnvironmentName = "The Azure Environment Name."
ColumnDescriptionRegion = "The Azure region/location in which the resource is located."
ColumnDescriptionResourceGroup = "The resource group which holds this resource."
ColumnDescriptionSubscription = "The Azure Subscription ID in which the resource is located."
ColumnDescriptionTags = "A map of tags for the resource."
ColumnDescriptionTitle = "Title of the resource."
ColumnDescriptionAkas = "Array of globally unique identifier strings (also known as) for the resource."
ColumnDescriptionCloudEnvironment = "The Azure Cloud Environment."
ColumnDescriptionRegion = "The Azure region/location in which the resource is located."
ColumnDescriptionResourceGroup = "The resource group which holds this resource."
ColumnDescriptionSubscription = "The Azure Subscription ID in which the resource is located."
ColumnDescriptionTags = "A map of tags for the resource."
ColumnDescriptionTitle = "Title of the resource."
)

// convert string to lower case
Expand Down

0 comments on commit 7272e17

Please sign in to comment.