Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK should respect DefaultGetConfig of the plugin for tables #319

Closed
LalitLab opened this issue Apr 27, 2022 · 1 comment · Fixed by #326
Closed

SDK should respect DefaultGetConfig of the plugin for tables #319

LalitLab opened this issue Apr 27, 2022 · 1 comment · Fixed by #326
Assignees
Labels
bug Something isn't working

Comments

@LalitLab
Copy link

steampipe-plugin-sdk version: v3.2.0-rc.0

Problem Description

Have below in the plugins DefaultGetConfig and DefaultIgnoreConfig

		DefaultGetConfig: &plugin.GetConfig{
			IgnoreConfig: &plugin.IgnoreConfig{
				ShouldIgnoreErrorFunc: isNotFoundErrorWithContext([]string{"ResourceNotFoundException", "NoSuchEntity"}),
			},
		    DefaultIgnoreConfig: &plugin.IgnoreConfig{
			    ShouldIgnoreErrorFunc: shouldIgnoreErrorTableDefault([]string{"AccessDeniedException", "AccessDenied"}),
		    },
		},

and at table level, I have below Get Config

func tableAwsIamUser(ctx context.Context) *plugin.Table {
	return &plugin.Table{
		Name:        "aws_iam_user",
		Description: "AWS IAM User",
		Get: &plugin.GetConfig{
			KeyColumns: plugin.AnyColumn([]string{"name", "arn"}),
			Hydrate: getIamUser,
		},

On running query select name from aws_osborn.aws_iam_user where name = 'lalit123' I get below error

Error: NoSuchEntity: The user with name lalit123 cannot be found.
	status code: 404, request id: bfdfdb51-11ff-412f-9704-3ad1adde95f0 (SQLSTATE HV000)

But if I add the NoSuchEntity error to DefaultIgnoreConfig in the plugin it works fine and ignores the error

		    DefaultIgnoreConfig: &plugin.IgnoreConfig{
			    ShouldIgnoreErrorFunc: shouldIgnoreErrorTableDefault([]string{"AccessDeniedException", "AccessDenied","NoSuchEntity"}),
		    },
select name from aws_osborn.aws_iam_user where name = 'lalit123'
+------+
| name |
+------+
+------+

I have the below question on the above:

  1. Is it the expected behavior?
  2. Is there any precedent between the default plugin config, the table config, and the hydrate config that we should be aware of?
@kaidaguerre
Copy link
Contributor

closed by 348c461

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants