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

Add support for DefaultHydrateConfig to allow use of ShouldIgnoreError capability centrally instead of defining at each table level. #257

Closed
LalitLab opened this issue Feb 8, 2022 · 0 comments · Fixed by #304
Assignees

Comments

@LalitLab
Copy link

LalitLab commented Feb 8, 2022

Needed for turbot/steampipe-plugin-aws#878

currently, plugin-sdk allows defining hydrate config for each hydrate function at table level. like below:

func tableAwsKmsKey(ctx context.Context) *plugin.Table {
	return &plugin.Table{
		Name:        "aws_kms_key",
		Description: "AWS KMS Key",
		Get: &plugin.GetConfig{
			KeyColumns:        plugin.SingleColumn("id"),
			ShouldIgnoreError: isNotFoundError([]string{"NotFoundException", "InvalidParameter", "AccessDeniedException"}),
			Hydrate:           getKmsKey,
		},
		HydrateConfig: []plugin.HydrateConfig{
			{
				Func:              getAwsKmsKeyData,
				ShouldIgnoreError: ignoreAccessDeniedError(ctx, []string{"AccessDeniedException"}),
			},
			{
				Func:              getAwsKmsKeyPolicy,
				ShouldIgnoreError: ignoreAccessDeniedError(ctx, []string{"AccessDeniedException"}),
			},
			{
				Func:              getAwsKmsKeyRotationStatus,
				ShouldIgnoreError: ignoreAccessDeniedError(ctx, []string{"AccessDeniedException"}),
			},
			{
				Func:              getAwsKmsKeyTagging,
				ShouldIgnoreError: ignoreAccessDeniedError(ctx, []string{"AccessDeniedException"}),
			},
			{
				Func:              getAwsKmsKeyAliases,
				ShouldIgnoreError: ignoreAccessDeniedError(ctx, []string{"AccessDeniedException"}),
			},
		},

If possible to add something similar to DefaultRetryConfig could be added that would allow users to define DefaultHydrateConfig where users can common functionalities for all the hydrate functions.

Also, to add the ignore_access_denied_errors flag to handle AccessDenied Errors. It would be easier for users if they would be able to call GetConfig to get connection config details. GetConfig function requires *plugin.Connection which is not available for the ShouldIgnoreError currently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment