Skip to content

Commit

Permalink
Added the rate limiter config for the hydrated function and rearrange…
Browse files Browse the repository at this point in the history
… the optional qualifier as per input param
  • Loading branch information
ParthaI committed Jan 30, 2024
1 parent 22b0de0 commit d9be0e0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions aws/table_aws_iot_thing.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,18 @@ func tableAwsIotThing(_ context.Context) *plugin.Table {
{Name: "thing_type_name", Require: plugin.Optional, Operators: []string{"="}},
},
},
HydrateConfig: []plugin.HydrateConfig{
{
Func: getIotThing,
Tags: map[string]string{"service": "iot", "action": "DescribeThing"},
},
},
GetMatrixItemFunc: SupportedRegionMatrix(iotv1.EndpointsID),
Columns: awsRegionalColumns([]*plugin.Column{
{
Name: "thing_name",
Type: proto.ColumnType_STRING,
Description: "The name of the thing.",
Type: proto.ColumnType_STRING,
},
{
Name: "thing_id",
Expand Down Expand Up @@ -147,8 +153,10 @@ func listIotThings(ctx context.Context, d *plugin.QueryData, _ *plugin.HydrateDa
if d.EqualsQualString("attribute_name") != "" {
input.AttributeName = aws.String(d.EqualsQualString("attribute_name"))
}
if d.EqualsQualString("attribute_value") != "" && d.EqualsQualString("thing_type_name") != "" {
if d.EqualsQualString("attribute_value") != "" && d.EqualsQualString("attribute_name") != ""{
input.AttributeValue = aws.String(d.EqualsQualString("attribute_value"))
}
if d.EqualsQualString("thing_type_name") != "" {
input.ThingTypeName = aws.String(d.EqualsQualString("thing_type_name"))
}

Expand Down Expand Up @@ -214,4 +222,4 @@ func getIotThing(ctx context.Context, d *plugin.QueryData, h *plugin.HydrateData
}

return thing, nil
}
}

0 comments on commit d9be0e0

Please sign in to comment.