-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When passing a slice as a query arg, ensure it is strongly typed so P…
- Loading branch information
1 parent
daf952c
commit b1c1c4e
Showing
106 changed files
with
283 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
pkg/steampipeconfig/testdata/manual testing /report/.mod.cache.json
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
pkg/steampipeconfig/testdata/manual testing /report/manual_control.sql
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...ipeconfig/testdata/manual testing /steampipe-mod-reports-poc/queries/aws_iam_entities.sql
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
pkg/steampipeconfig/testdata/manual testing /steampipe-mod-reports-poc/reports.sp
This file was deleted.
Oops, something went wrong.
188 changes: 188 additions & 0 deletions
188
pkg/steampipeconfig/testdata/manual_testing/args/with1/dashboard.sp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
|
||
dashboard "bug_column_does_not_exist" { | ||
title = "column does not exist" | ||
|
||
|
||
input "policy_arn" { | ||
title = "Select a policy:" | ||
query = query.test1_aws_iam_policy_input | ||
width = 4 | ||
} | ||
|
||
|
||
container { | ||
|
||
graph { | ||
title = "Relationships" | ||
type = "graph" | ||
direction = "left_right" //"TD" | ||
|
||
with "attached_users" { | ||
sql = <<-EOQ | ||
select | ||
u.arn as user_arn | ||
--,policy_arn | ||
from | ||
aws_iam_user as u, | ||
jsonb_array_elements_text(attached_policy_arns) as policy_arn | ||
where | ||
policy_arn = $1; | ||
--policy_arn = 'arn:aws:iam::aws:policy/AdministratorAccess' | ||
EOQ | ||
|
||
param policy_arn { | ||
// commented out becuase input not working here yet.. | ||
// default = self.input.policy_arn.value | ||
default = "arn:aws:iam::aws:policy/AdministratorAccess" | ||
} | ||
|
||
} | ||
|
||
with "attached_roles" { | ||
sql = <<-EOQ | ||
select | ||
arn as role_arn | ||
from | ||
aws_iam_role, | ||
jsonb_array_elements_text(attached_policy_arns) as policy_arn | ||
where | ||
policy_arn = $1; | ||
EOQ | ||
|
||
#args = [self.input.policy_arn.value] | ||
#args = ["arn:aws:iam::aws:policy/AdministratorAccess"] | ||
|
||
param policy_arn { | ||
//default = self.input.policy_arn.value | ||
default = "arn:aws:iam::aws:policy/AdministratorAccess" | ||
} | ||
} | ||
|
||
|
||
nodes = [ | ||
node.test1_aws_iam_policy_node, | ||
node.test1_aws_iam_user_nodes, | ||
] | ||
|
||
edges = [ | ||
edge.test1_aws_iam_policy_from_iam_user_edges, | ||
] | ||
|
||
args = { | ||
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess" //self.input.policy_arn.value | ||
|
||
//// works if you hardcode the list | ||
policy_arns = ["arn:aws:iam::aws:policy/AdministratorAccess"] | ||
|
||
// this causes cannot serialize unknown values | ||
//policy_arns = [self.input.policy_arn.value] | ||
|
||
user_arns = with.attached_users.rows[*].user_arn | ||
role_arns = with.attached_roles.rows[*].role_arn | ||
|
||
} | ||
} | ||
|
||
} | ||
} | ||
|
||
query "test1_aws_iam_policy_input" { | ||
sql = <<-EOQ | ||
with policies as ( | ||
select | ||
title as label, | ||
arn as value, | ||
json_build_object( | ||
'account_id', account_id | ||
) as tags | ||
from | ||
aws_iam_policy | ||
where | ||
not is_aws_managed | ||
union all select | ||
distinct on (arn) | ||
title as label, | ||
arn as value, | ||
json_build_object( | ||
'account_id', 'AWS Managed' | ||
) as tags | ||
from | ||
aws_iam_policy | ||
where | ||
is_aws_managed | ||
) | ||
select | ||
* | ||
from | ||
policies | ||
order by | ||
label; | ||
EOQ | ||
} | ||
|
||
|
||
|
||
node "test1_aws_iam_policy_node" { | ||
sql = <<-EOQ | ||
select | ||
distinct on (arn) | ||
arn as id, | ||
name as title, | ||
jsonb_build_object( | ||
'ARN', arn, | ||
'AWS Managed', is_aws_managed::text, | ||
'Attached', is_attached::text, | ||
'Create Date', create_date, | ||
'Account ID', account_id | ||
) as properties | ||
from | ||
aws_iam_policy | ||
where | ||
arn = $1; | ||
EOQ | ||
|
||
param "policy_arn" {} | ||
} | ||
|
||
|
||
node "test1_aws_iam_user_nodes" { | ||
|
||
sql = <<-EOQ | ||
select | ||
arn as id, | ||
name as title, | ||
jsonb_build_object( | ||
'ARN', arn, | ||
'Path', path, | ||
'Create Date', create_date, | ||
'MFA Enabled', mfa_enabled::text, | ||
'Account ID', account_id | ||
) as properties | ||
from | ||
aws_iam_user | ||
where | ||
arn = any($1::text[]); | ||
EOQ | ||
|
||
param "user_arns" {} | ||
} | ||
|
||
|
||
|
||
edge "test1_aws_iam_policy_from_iam_user_edges" { | ||
title = "attaches" | ||
|
||
sql = <<-EOQ | ||
select | ||
policy_arns as to_id, | ||
user_arns as from_id | ||
from | ||
unnest($1::text[]) as policy_arns, | ||
unnest($2::text[]) as user_arns | ||
EOQ | ||
|
||
param "policy_arns" {} | ||
param "user_arns" {} | ||
|
||
} |
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
pkg/steampipeconfig/testdata/manual_testing/args/with1/query.sp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
query "q1" { | ||
description = "test array argument" | ||
sql = <<-EOQ | ||
select | ||
name | ||
from | ||
aws_iam_user | ||
where | ||
arn = any($1::text[]); | ||
EOQ | ||
|
||
param arns{ | ||
default = [ | ||
"arn:aws:iam::876515858155:user/lalit", | ||
"arn:aws:iam::876515858155:user/mike" | ||
] | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
pkg/steampipeconfig/testdata/manual_testing/steampipe-mod-reports-poc/mod.sp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod reports_poc { | ||
title = "Reports POC" | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.