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

Adding page access group and page access user #66

Merged
merged 3 commits into from
Oct 1, 2021

Conversation

grierj
Copy link
Collaborator

@grierj grierj commented Sep 29, 2021

We need these for audience manipulation. Trying to follow the standard
patterns established here. Updated to the latest client version to pick
up all the page access user endpoints and api fixes

Full acceptance tests appear to be working

$ go test -v -run TestAccStatuspagePageAccessUser_Basic ./statuspage
=== RUN   TestAccStatuspagePageAccessUser_Basic
2021/09/15 10:26:41 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:26:43 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:26:49 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:26:55 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:27:00 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/464plwpsc06c
2021/09/15 10:27:00 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:27:00 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:27:05 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:27:20 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/vk7dqyyrvm74
2021/09/15 10:27:20 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/vk7dqyyrvm74
--- PASS: TestAccStatuspagePageAccessUser_Basic (49.15s)
PASS
ok      github.com/sbecker59/terraform-provider-statuspage/statuspage   50.163s

$ go test -v -run TestAccStatuspagePageAccessGroup_Basic ./statuspage
=== RUN   TestAccStatuspagePageAccessGroup_Basic
2021/09/15 10:45:13 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components
2021/09/15 10:45:13 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:15 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:20 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:20 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups
2021/09/15 10:45:20 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:26 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:26 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:26 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:34 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:34 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:34 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:38 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:38 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components
2021/09/15 10:45:39 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:42 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/g8vbb5rlym1v
2021/09/15 10:45:42 [DEBUG] PATCH https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:42 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:48 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:48 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:48 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/g8vbb5rlym1v
2021/09/15 10:45:48 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:49 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/4yk5kdxm491d
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/m9t0f543n1h5
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/g8vbb5rlym1v
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:57 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/4yk5kdxm491d
2021/09/15 10:45:58 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/m9t0f543n1h5
2021/09/15 10:45:58 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sbdh4734hzvm
2021/09/15 10:45:58 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/g8vbb5rlym1v
2021/09/15 10:45:58 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
--- PASS: TestAccStatuspagePageAccessGroup_Basic (56.00s)
PASS
ok      github.com/sbecker59/terraform-provider-statuspage/statuspage   57.259s

I occasionally got 404 on deletes for users, but running it again
deletes them successfully. I think there's some sort of lag inbetween
systems on big deletes.

Sorry about the whitespace changes, my IDE decided to go fmt them I think.

We need these for audience manipulation.  Trying to follow the standard
patterns established here.  Updated to the latest client version to pick
up all the page access user endpoints and api fixes

Full acceptance tests appear to be working

```
$ go test -v -run TestAccStatuspagePageAccessUser_Basic ./statuspage
=== RUN   TestAccStatuspagePageAccessUser_Basic
2021/09/15 10:26:41 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:26:43 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:26:49 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:26:55 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:27:00 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/464plwpsc06c
2021/09/15 10:27:00 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:27:00 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:27:05 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:27:20 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/vk7dqyyrvm74
2021/09/15 10:27:20 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/vk7dqyyrvm74
--- PASS: TestAccStatuspagePageAccessUser_Basic (49.15s)
PASS
ok      github.com/sbecker59/terraform-provider-statuspage/statuspage   50.163s

$ go test -v -run TestAccStatuspagePageAccessGroup_Basic ./statuspage
=== RUN   TestAccStatuspagePageAccessGroup_Basic
2021/09/15 10:45:13 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components
2021/09/15 10:45:13 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:15 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:20 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:20 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups
2021/09/15 10:45:20 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:26 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:26 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:26 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:34 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:34 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:34 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:38 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:38 [DEBUG] POST https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components
2021/09/15 10:45:39 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:42 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/g8vbb5rlym1v
2021/09/15 10:45:42 [DEBUG] PATCH https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:42 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:48 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:48 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users
2021/09/15 10:45:48 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/g8vbb5rlym1v
2021/09/15 10:45:48 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:49 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/4yk5kdxm491d
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_users/m9t0f543n1h5
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/g8vbb5rlym1v
2021/09/15 10:45:56 [DEBUG] DELETE https://api.statuspage.io/v1/pages/3szhmzxmsgd4/components/sbdh4734hzvm
2021/09/15 10:45:57 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/4yk5kdxm491d
2021/09/15 10:45:58 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/m9t0f543n1h5
2021/09/15 10:45:58 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sbdh4734hzvm
2021/09/15 10:45:58 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/g8vbb5rlym1v
2021/09/15 10:45:58 [DEBUG] GET https://api.statuspage.io/v1/pages/3szhmzxmsgd4/page_access_groups/sqzknzr8ysk0
--- PASS: TestAccStatuspagePageAccessGroup_Basic (56.00s)
PASS
ok      github.com/sbecker59/terraform-provider-statuspage/statuspage   57.259s
```

I occasionally got 404 on deletes for users, but running it again
deletes them successfully.  I think there's some sort of lag inbetween
systems on big deletes.
@sbecker59 sbecker59 added enhancement New feature or request go Pull requests that update Go code labels Sep 29, 2021
Copy link
Owner

@sbecker59 sbecker59 left a comment

Choose a reason for hiding this comment

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

Can you create two examples in examples/resources for the resources you added please?
This allows to have the documentation up to date in registry.terraform.io
You can also generate the documentation files via make docs. This command uses tfplugindocs

You should also have received a github invitation to become a collaborator of the project.

Thanks in advance.

@grierj
Copy link
Collaborator Author

grierj commented Sep 30, 2021

Can you create two examples in examples/resources for the resources you added please?

Absolutely. I'll do that today. Sorry I missed that part.

@grierj
Copy link
Collaborator Author

grierj commented Sep 30, 2021

@sbecker59 ok, examples added and docs generated. Thanks for being so responsive!

@sbecker59 sbecker59 merged commit 48d7a3f into sbecker59:main Oct 1, 2021
@sbecker59
Copy link
Owner

Hi @grierj , I made a mistake while merging. Which means that you will not appear as a contributor to the project 😕 .
Could you please merge your 3 commits into 1, then redo a pull request.
Sorry for the inconvenience 😕

@grierj
Copy link
Collaborator Author

grierj commented Oct 1, 2021

Hi @grierj , I made a mistake while merging. Which means that you will not appear as a contributor to the project 😕 . Could you please merge your 3 commits into 1, then redo a pull request. Sorry for the inconvenience 😕

No problem! I'll squash those commits and recreate the pull request.

@grierj
Copy link
Collaborator Author

grierj commented Oct 1, 2021

created #68 to replace this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go Pull requests that update Go code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants