feat(gandi): Gandi Source Plugin#4940
Conversation
| mainTemplate := r.Template + ".go.tpl" | ||
| tpl, err := template.New(mainTemplate).ParseFS(templatesFS, "templates/"+mainTemplate) | ||
| if err != nil { | ||
| log.Fatal(fmt.Errorf("failed to parse gandi templates: %w", err)) |
There was a problem hiding this comment.
Not blocking this PR, but is there some value in sharing this method (by parameterizing the name of the plugin) between all plugins ?
There was a problem hiding this comment.
@cqgaurav How we do things change between plugins especially with complex SDKs. It would mean lots of "flags" to understand and configure per plugin... Maybe a very limited set can be "copied" and configured per plugin (ie. this one was copied from the Cloudflare codegen and slightly modified). Eventually parts of it can be extracted as utilities and put into sdk the codegen package which provides main codegen functionality.
4f09e8e to
eba6b51
Compare
hermanschaaf
left a comment
There was a problem hiding this comment.
Now looks even better 👍 Just left a few comments for things to double-check
| for _, r := range resources { | ||
| r.Infer() | ||
| } | ||
| if err := recipes.SetParentChildRelationships(resources); err != nil { |
There was a problem hiding this comment.
Unless we have resolver/mock templates that handle parent & child relations in this plugin (do we?), we can probably remove this call and the associated function.
There was a problem hiding this comment.
It's used to properly generate child table names, completely optional, but gandi doesn't have 100% of resources covered (or the sdk has 100% implemented) so more resources will pop up and this could help us down the line (we'll eventually have more then a few child tables)
| |_cq_sync_time|Timestamp| | ||
| |_cq_id|UUID| | ||
| |_cq_parent_id|UUID| | ||
| |sharing_id|String| |
There was a problem hiding this comment.
Should sharing_id maybe be part of the PK here?
There was a problem hiding this comment.
This is a "global" table with values like:
sharing_id |
name | cert_std_3_0_0
name_label |
href | https://api.gandi.net/v5/certificate/packages/cert_std_3_0_0
max_domains | 3
type |
type_label |
wildcard | f
it would be the same rows repeated if sharing_id was a key. The sharing_id column is provided because if the user sets it in the config it's passed down to the client automatically so filtering is probably done on the server side.
| |_cq_sync_time|Timestamp| | ||
| |_cq_id|UUID| | ||
| |_cq_parent_id|UUID| | ||
| |sharing_id|String| |
There was a problem hiding this comment.
Should sharing_id be part of the PK here?
There was a problem hiding this comment.
I don't think certificates have clashing ids to warrant for an additional PK.
yevgenypats
left a comment
There was a problem hiding this comment.
I didn't review the code but I think it is good for first version and @hermanschaaf already kindly reviewed. I think you can add to this PR https://github.com/cloudquery/cloudquery/blob/main/contributing/adding_a_new_plugin_to_cq_monorepo.md and then we can merge
Co-authored-by: Herman Schaaf <hermanschaaf@gmail.com>
a2c586c to
69c7b4e
Compare
|
@yevgenypats done |
🤖 I have created a release *beep* *boop* --- ## 1.0.0 (2022-11-30) ### Features * **gandi:** Gandi Source Plugin ([#4940](#4940)) ([5819f6c](5819f6c)) ### Bug Fixes * **deps:** Update module github.com/cloudquery/plugin-sdk to v1.10.0 ([#5153](#5153)) ([ea1f77e](ea1f77e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Implements #4795
Needs a new project in https://sentry.io/organizations/cloudquery-v2/projects/