Skip to content

Commit

Permalink
🧹 fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey committed Jan 22, 2024
1 parent 5736487 commit 88b0bb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions providers/aws/resources/aws_elb.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,7 @@ func (a *mqlAwsElbLoadbalancer) listenerDescriptions() ([]interface{}, error) {
ctx := context.Background()

if isV1LoadBalancerArn(arn) {
svc := conn.Elb(region)
listeners, err := svc.DescribeListeners(ctx, &elasticloadbalancing.DescribeListenersInput{LoadBalancerArn: &arn})
if err != nil {
return nil, err
}
return convert.JsonToDictSlice(listeners.Listeners)
return a.ListenerDescriptions.Data, nil
}
svc := conn.Elbv2(region)
listeners, err := svc.DescribeListeners(ctx, &elasticloadbalancingv2.DescribeListenersInput{LoadBalancerArn: &arn})
Expand All @@ -238,6 +233,7 @@ func (a *mqlAwsElbLoadbalancer) listenerDescriptions() ([]interface{}, error) {
func (a *mqlAwsElbLoadbalancer) attributes() ([]interface{}, error) {
conn := a.MqlRuntime.Connection.(*connection.AwsConnection)
arn := a.Arn.Data
name := a.Name.Data

region, err := GetRegionFromArn(arn)
if err != nil {
Expand All @@ -247,18 +243,22 @@ func (a *mqlAwsElbLoadbalancer) attributes() ([]interface{}, error) {

if isV1LoadBalancerArn(arn) {
svc := conn.Elb(region)
attributes, err := svc.DescribeLoadBalancerAttributes(ctx, &elasticloadbalancing.DescribeLoadBalancerAttributesInput{LoadBalancerName: &arn})
attributes, err := svc.DescribeLoadBalancerAttributes(ctx, &elasticloadbalancing.DescribeLoadBalancerAttributesInput{LoadBalancerName: &name})
if err != nil {
return nil, err
}
j, err := convert.JsonToDict(attributes.LoadBalancerAttributes)
if err != nil {
return nil, err
}
return convert.JsonToDictSlice(attributes.Attributes)
return []interface{}{j}, nil
}
svc := conn.Elbv2(region)
attributes, err := svc.DescribeLoadBalancerAttributes(ctx, &elasticloadbalancingv2.DescribeLoadBalancerAttributesInput{LoadBalancerArn: &arn})
if err != nil {
return nil, err
}
return convert.JsonToDictSlice(attributes.LoadBalancerAttributes)
return convert.JsonToDictSlice(attributes.Attributes)
}

func isV1LoadBalancerArn(a string) bool {
Expand Down
2 changes: 1 addition & 1 deletion providers/aws/resources/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ func discover(runtime *plugin.Runtime, awsAccount *mqlAwsAccount, target string,

d := res.(*mqlAwsDynamodb)

ts = d.GetGlobalTables()
ts := d.GetGlobalTables()
if ts == nil {
return assetList, nil
}
Expand Down

0 comments on commit 88b0bb5

Please sign in to comment.