Commit aa7e951
feat: add data sources for querying organization permissions
Add four new data sources (invoke functions) to enable querying and auditing
organization permissions in Pulumi Cloud:
- `getTeams`: List all teams in an organization with their members, stack
permissions, and environment permissions
- `getTeamsForUser`: Find which teams a specific user belongs to by searching
their username or GitHub login
- `getStacks`: List all stacks accessible by the authenticated user with
pagination support
- `getStackPermissions`: Query detailed team and user permissions for a
specific stack
## Implementation Details
### API Client Methods
- Added `ListUserStacks()` to query accessible stacks via `/api/user/stacks`
- Added `ListStackTeamPermissions()` to query team access via
`/api/stacks/{org}/{project}/{stack}/teams`
- Added `ListStackCollaborators()` to query user access via
`/api/stacks/{org}/{project}/{stack}/collaborators`
- Enhanced existing `UserInfo` type to include `AvatarUrl` and `Email` fields
### Provider Changes
- Implemented four invoke function handlers in provider.go
- Added comprehensive property conversion helpers
- Added schema definitions for all four invoke functions with detailed
input/output specifications
### SDK Generation
- Generated SDKs for all supported languages (TypeScript, Python, Go, .NET,
Java)
- All new invoke functions are available across all language SDKs
### Documentation
- Added comprehensive YAML example (`yaml-permissions-query`) demonstrating
all four invoke functions
- Created detailed README with usage examples, use cases, and conversion
instructions
- Updated CHANGELOG.md with feature descriptions
## Testing
- ✅ Added integration test `TestYamlPermissionsQueryExample` in
`examples/examples_yaml_test.go` - **PASSING**
- ✅ All linting passes with zero issues
- ✅ Provider builds successfully
- ✅ All SDKs generate without errors
- ✅ Integration test validates both `getTeams` and `getStacks` data sources
successfully query live data
## Use Cases
These data sources enable several important scenarios:
1. **Audit Organization Access**: Get complete view of teams, members, and
resource access
2. **User Access Review**: Quickly determine what teams and resources a user
has access to
3. **Stack Discovery**: Find all accessible stacks across the organization
4. **Permission Analysis**: Understand exactly who has access to sensitive
stacks
Fixes #509
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent 47a344e commit aa7e951
File tree
27 files changed
+2170
-0
lines changed- examples
- yaml-permissions-query
- provider
- cmd/pulumi-resource-pulumiservice
- pkg
- provider
- pulumiapi
- sdk
- dotnet
- go/pulumiservice
- nodejs
- python/pulumi_pulumiservice
27 files changed
+2170
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
428 | 438 | | |
429 | 439 | | |
430 | 440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
0 commit comments