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

Feat: custom flow support #558

Merged
merged 2 commits into from
Dec 27, 2022
Merged

Feat: custom flow support #558

merged 2 commits into from
Dec 27, 2022

Conversation

TomerHeber
Copy link
Collaborator

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.

Comment on lines +3 to +18
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"`
}
Copy link
Contributor

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?

Copy link
Collaborator Author

@TomerHeber TomerHeber Dec 25, 2022

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.

Copy link
Contributor

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 {
Copy link
Contributor

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

Copy link
Collaborator Author

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.

@github-actions github-actions bot added the ready to merge PR approved - can be merged once the PR owner is ready label Dec 27, 2022
@TomerHeber TomerHeber merged commit 655e56f into main Dec 27, 2022
@TomerHeber TomerHeber deleted the feat-custom-flow-#550 branch December 27, 2022 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-client feature ready to merge PR approved - can be merged once the PR owner is ready
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants