-
Notifications
You must be signed in to change notification settings - Fork 14
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
Feat: custom flow support #558
Conversation
type CustomFlowCreatePayload struct { | ||
Name string `json:"name"` | ||
Repository string `json:"repository"` | ||
Path string `json:"path,omitempty"` | ||
Revision string `json:"revision,omitempty"` | ||
TokenId string `json:"tokenId,omitempty"` | ||
SshKeys []TemplateSshKey `json:"sshKeys,omitempty"` | ||
GithubInstallationId int `json:"githubInstallationId,omitempty"` | ||
BitbucketClientKey string `json:"bitbucketClientKey,omitempty"` | ||
IsBitbucketServer bool `json:"isBitbucketServer"` | ||
IsGitlabEnterprise bool `json:"isGitLabEnterprise"` | ||
IsGithubEnterprise bool `json:"isGitHubEnterprise"` | ||
IsGitLab bool `json:"isGitLab"` | ||
IsAzureDevOps bool `json:"isAzureDevOps" tfschema:"is_azure_devops"` | ||
IsTerragruntRunAll bool `json:"isTerragruntRunAll"` | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add some composition with the already existing attribute of the template resource?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! It's possible. Your suggestion makes sense.
Embedded composition in golang is explicit. See this for an explanation:
https://blog.dlow.me/programming/golang/struct-embedding/#golang-struct-embedding
This means that I will have to make changes in all the code locations where Template is initialized
E.g.:
template := client.Template{
Id: "id0",
Name: "template",
...
It's not an issue - just additional (many) cosmetic changes in the PR.
Let me know if I should proceed. Another option is to apply it as a follow-up PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's probably not worth it...
IsTerragruntRunAll bool `json:"isTerragruntRunAll"` | ||
} | ||
|
||
type CustomFlow struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be great to DRY this a bit and add a shared struct
between this one and CustomFlowCreatePayload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They vary from a "tagging" perspective. (json and tfschema).
Trying to merge may become cumbersome, and the benefit is small. It is currently consistent with the rest of the code.
Solution
Part of the effort is to add custom-flow support #550.
In this PR I added API client support for CRUD operations on custom flows.
Unit tests were added as well.