feat: Implement EC2 Key Pairs (#1403)#1404
feat: Implement EC2 Key Pairs (#1403)#1404jhudson10x wants to merge 5 commits intocloudquery:mainfrom
Conversation
- Add entry to gen.hcl for KeyPairInfo - Add generate instruction comment to func Ec2KeyPairs() - Change error handler to client.IgnoreAccessDeniedServiceDisabled - Use key_pair_id for table primary key
| primary_keys = ["key_pair_id"] | ||
| } | ||
|
|
||
| userDefinedColumn "account_id" { |
There was a problem hiding this comment.
does Key Pair have ARN?
There was a problem hiding this comment.
I didn't think so but your question prompted me to dig a little deeper and the answer is yes. The format of the arn is: arn:${Partition}:ec2:${Region}:${Account}:key-pair/${KeyPairName}
There was a problem hiding this comment.
Then you should add a resolver for it, too.
Basically, you should add (and specify this column to e primary key, see lots of examples in the reources):
userDefinedColumn "arn" {
type = "string"
description = "The Amazon Resource Name (ARN) of the Key Pair"
generate_resolver = true
}Then you'll need to regenerate the implementation and implement the newly generated resolver.
You can find examples of resolvers utilizing helper functions like this one throughout the codebase.
There was a problem hiding this comment.
The func signature that cq-gen has a return type of error. Should I change the sig to return schema.ColumnResolver like the example you linked, or should I keep the generated sig and do like resources/services/iot/iot_topic_rules.go#L1337 and write into the resource?
There was a problem hiding this comment.
You should do something like https://github.com/cloudquery/cq-provider-aws/blob/main/resources/services/ec2/images.go#L42-L44
I suppose you can just fill in the proper func body for the generated func.
|
Hi @jhudson10x and @candiduslynx, I moved this PR to our monorepo (including original commits) via cloudquery/cloudquery#1325. Since cloudquery/cloudquery#1325 was approved and merged I suggest to do any follow up changes in another PR. |
|
Closing in favor cloudquery/cloudquery#1325 |
Summary
Add new resource for EC2 Key Pairs
#1403
Use the following steps to ensure your PR is ready to be reviewed
go fmtto format your code 🖊golangci-lint run🚨 (install golangci-lint here)go run ./docs/docs.goand committing the changes 📃