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

Fix misspelling in User struct and add JSON tags #34

Merged
merged 2 commits into from
Sep 19, 2016
Merged

Fix misspelling in User struct and add JSON tags #34

merged 2 commits into from
Sep 19, 2016

Conversation

heimweh
Copy link
Contributor

@heimweh heimweh commented Sep 17, 2016

Hi,
I'm using this library in a Terraform provider and noticed that I can't really create a user with the current User struct.

I modified the User struct like this to get it to work.

Please note that I'm very new to Go and my code might have faults in it,
but at least I got it to work with this change.

@heimweh
Copy link
Contributor Author

heimweh commented Sep 17, 2016

The original error I got from the API without the modified struct.

$ terraform apply
pagerduty_user.foo: Creating...
  email:     "" => "[email protected]"
  job_title: "" => "Job title"
  name:      "" => "Foo Bar"
Error applying plan:

1 error(s) occurred:

* pagerduty_user.foo: Failed call API endpoint. HTTP response code: 400. Error: &{2001 Invalid Input Provided [Name must be a String.]}

https://github.com/heimweh/terraform-provider-pagerduty

@heimweh heimweh changed the title Fix misspelling and add JSON tags Fix misspelling in User struct and add JSON tags Sep 17, 2016
Role string
AvatarURL string `json:"avatar_url"`
Description string
ID string `json:"id"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@heimweh ID comes from APIObject struct, which we are embedding here. You can omit this attribute

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, missed that completely. I'll omit that attribute :) Thanks!

@ranjib
Copy link
Contributor

ranjib commented Sep 19, 2016

@heimweh looks good to me. Just remove the ID field.

@heimweh
Copy link
Contributor Author

heimweh commented Sep 19, 2016

@ranjib thanks for the response, I'll have a look at getting this fixed asap.

@heimweh
Copy link
Contributor Author

heimweh commented Sep 19, 2016

@ranjib should be fixed now

@ranjib ranjib merged commit d1f3081 into PagerDuty:master Sep 19, 2016
@ranjib
Copy link
Contributor

ranjib commented Sep 19, 2016

thank you :-)

mLupine pushed a commit to mLupine/go-pagerduty that referenced this pull request May 27, 2020
* adding event_rules endpoint and user-agent header

* removing options from event_rule

* removing options from event_rule

* adding ruleset and ruleset_test

* cleaning up rulesets a bit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants