-
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
Add team API calls #136
Add team API calls #136
Conversation
provider "env0" { | ||
api_key = var.env0_api_key # or use ENV0_API_KEY | ||
api_secret = var.env0_api_secret # or use ENV0_API_SECRET | ||
api_key = var.env0_api_key # or use ENV0_API_KEY | ||
api_secret = var.env0_api_secret # or use ENV0_API_SECRET | ||
} |
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.
go fmt
@@ -10,5 +10,5 @@ data "env0_project" "project" { | |||
|
|||
resource "env0_cloud_credentials_project_assignment" "example" { | |||
credential_id = env0_aws_credentials.credentials.id | |||
project_id = data.env0_project.project.id | |||
project_id = data.env0_project.project.id |
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.
go fmt
enum = [ | ||
enum = [ |
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.
go fmt
client/team.go
Outdated
} | ||
// AREL TODO: Check this | ||
if payload.OrganizationId != "" { |
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.
Done?
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.
Whoops
client/team_test.go
Outdated
createTeamPayload := TeamCreatePayload{} | ||
copier.Copy(&createTeamPayload, &mockTeam) |
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.
Why creating a copy? isn't it immutable?
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.
var result Team | ||
err := self.http.Get("/teams/"+id, nil, &result) |
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.
a little out of scope, but why there is a diff between get-team to get-teams in our API? is there a special reason that you know?
In general I expected to see /team?id={id}&orgId{org_id}... where an empty id triggers get-all
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.
It's a design choice we've made. I think it's technically more RESTful but I'm not sure.
One difference, for example, is that the by-id API returns a single team (not an array), and returns 404 if there's no such team
client/team_test.go
Outdated
Describe("Teams", func() { | ||
var returnedTeams []Team | ||
mockTeams := []Team{mockTeam} |
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.
Do we want to add validation tests? to those not_empty
conditions..
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.
@RLRabinowitz do you want to add integration tests also? |
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.
Nice work 👍 . maybe ask for another 👀 , since that it's the first time I'm reviewing go
in general and our provider in particular.
client/team_test.go
Outdated
Name: "team-name", | ||
} | ||
|
||
Describe("Team", func() { |
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.
Get Team
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.
client/team_test.go
Outdated
}) | ||
}) | ||
|
||
Describe("Teams", func() { |
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.
Get All Teams
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.
Issue & Steps to Reproduce / Feature Request
Feature request: Support Teams in the provider.
For starters, we need to implement the team API calls relevant for the team resource and data
Solution
Implement get/create/update/delete/get-all API calls