-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #178 from Seekatar/add-membership-functions
add membership functions
- Loading branch information
Showing
63 changed files
with
1,335 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!-- #include "./common/header.md" --> | ||
|
||
# Add-VSTeamMembership | ||
|
||
## SYNOPSIS | ||
|
||
<!-- #include "./synopsis/Add-VSTeamMembership.md" --> | ||
|
||
## SYNTAX | ||
|
||
## DESCRIPTION | ||
|
||
<!-- #include "./synopsis/Add-VSTeamMembership.md" --> | ||
|
||
## EXAMPLES | ||
|
||
### -------------------------- EXAMPLE 1 -------------------------- | ||
|
||
```PowerShell | ||
PS C:\> $user = Get-VSTeamUser | ? DisplayName -eq 'Test User' | ||
PS C:\> $group = Get-VSTeamGroup | ? DisplayName -eq 'Endpoint Administrators' | ||
PS C:\> Add-VSTeamMembership -MemberDescriptor $user.Descriptor -ContainerDescriptor $group.Descriptor | ||
``` | ||
|
||
Adds Test User to the Endpoint Administrators group. | ||
|
||
## PARAMETERS | ||
|
||
<!-- #include "./params/memberDescriptor.md" --> | ||
|
||
<!-- #include "./params/containerDescriptor.md" --> | ||
|
||
## INPUTS | ||
|
||
## OUTPUTS | ||
|
||
## NOTES | ||
|
||
## RELATED LINKS | ||
|
||
[Get-VsTeamUser](Get-VsTeamUser.md) | ||
|
||
[Get-VsTeamGroup](Get-VsTeamGroup.md) | ||
|
||
[Get-VsTeamMembership](Get-VsTeamMembership.md) | ||
|
||
[Remove-VsTeamMembership](Remove-VsTeamMembership.md) | ||
|
||
[Test-VsTeamMembership](Test-VsTeamMembership.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!-- #include "./common/header.md" --> | ||
|
||
# Get-VSTeamMembership | ||
|
||
## SYNOPSIS | ||
|
||
<!-- #include "./synopsis/Get-VSTeamMembership.md" --> | ||
|
||
## SYNTAX | ||
|
||
## DESCRIPTION | ||
|
||
<!-- #include "./synopsis/Get-VSTeamMembership.md" --> | ||
|
||
## EXAMPLES | ||
|
||
### -------------------------- EXAMPLE 1 -------------------------- | ||
|
||
```PowerShell | ||
(Get-VSTeamMembership -MemberDescriptor $user.ID).value | % { Get-VSTeamGroup -Descriptor $_.containerDescriptor } | ||
``` | ||
|
||
Get all the groups for a user | ||
|
||
### -------------------------- EXAMPLE 2 -------------------------- | ||
|
||
```PowerShell | ||
(Get-VSTeamMembership -ContainerDescriptor $group.id).value | % {Get-VSTeamUser -Descriptor $_.memberDescriptor } | ||
``` | ||
|
||
Get all the members for a group | ||
|
||
## PARAMETERS | ||
|
||
### -ContainerDescriptor | ||
|
||
A container descriptor retrieved by Get-VsTeamGroup | ||
|
||
```yaml | ||
Type: String | ||
Required: True | ||
Parameter Sets: ByContainerId | ||
Position: 0 | ||
``` | ||
### -MemberDescriptor | ||
A member descriptor retrieved by Get-VsTeamUser | ||
```yaml | ||
Type: String | ||
Required: True | ||
Parameter Sets: ByMemberId | ||
Position: 0 | ||
``` | ||
## INPUTS | ||
## OUTPUTS | ||
## NOTES | ||
## RELATED LINKS | ||
[Get-VsTeamUser](Get-VsTeamUser.md) | ||
[Get-VsTeamGroup](Get-VsTeamGroup.md) | ||
[Add-VsTeamMembership](Add-VsTeamMembership.md) | ||
[Remove-VsTeamMembership](Remove-VsTeamMembership.md) | ||
[Test-VsTeamMembership](Test-VsTeamMembership.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!-- #include "./common/header.md" --> | ||
|
||
# Remove-VSTeamMembership | ||
|
||
## SYNOPSIS | ||
|
||
<!-- #include "./synopsis/Remove-VSTeamMembership.md" --> | ||
|
||
## SYNTAX | ||
|
||
## DESCRIPTION | ||
|
||
<!-- #include "./synopsis/Remove-VSTeamMembership.md" --> | ||
|
||
## EXAMPLES | ||
|
||
### -------------------------- EXAMPLE 1 -------------------------- | ||
|
||
```PowerShell | ||
PS C:\> $user = Get-VSTeamUser | ? DisplayName -eq 'Test User' | ||
PS C:\> $group = Get-VSTeamGroup | ? DisplayName -eq 'Endpoint Administrators' | ||
PS C:\> Remove-VSTeamMembership -MemberDescriptor $user.Descriptor -ContainerDescriptor $group.Descriptor | ||
``` | ||
|
||
Removes Test User from the Endpoint Administrators group. | ||
|
||
## PARAMETERS | ||
|
||
<!-- #include "./params/memberDescriptor.md" --> | ||
|
||
<!-- #include "./params/containerDescriptor.md" --> | ||
|
||
## INPUTS | ||
|
||
## OUTPUTS | ||
|
||
## NOTES | ||
|
||
## RELATED LINKS | ||
|
||
[Get-VsTeamUser](Get-VsTeamUser.md) | ||
|
||
[Get-VsTeamGroup](Get-VsTeamGroup.md) | ||
|
||
[Add-VsTeamMembership](Add-VsTeamMembership.md) | ||
|
||
[Get-VsTeamMembership](Get-VsTeamMembership.md) | ||
|
||
[Test-VsTeamMembership](Test-VsTeamMembership.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!-- #include "./common/header.md" --> | ||
|
||
# Test-VSTeamMembership | ||
|
||
## SYNOPSIS | ||
|
||
<!-- #include "./synopsis/Test-VSTeamMembership.md" --> | ||
|
||
## SYNTAX | ||
|
||
## DESCRIPTION | ||
|
||
<!-- #include "./synopsis/Test-VSTeamMembership.md" --> | ||
|
||
## EXAMPLES | ||
|
||
## PARAMETERS | ||
|
||
<!-- #include "./params/memberDescriptor.md" --> | ||
|
||
<!-- #include "./params/containerDescriptor.md" --> | ||
|
||
## INPUTS | ||
|
||
## OUTPUTS | ||
|
||
### System.Boolean | ||
|
||
## NOTES | ||
|
||
## RELATED LINKS | ||
|
||
[Get-VsTeamUser](Get-VsTeamUser.md) | ||
|
||
[Get-VsTeamGroup](Get-VsTeamGroup.md) | ||
|
||
[Add-VsTeamMembership](Add-VsTeamMembership.md) | ||
|
||
[Get-VsTeamMembership](Get-VsTeamMembership.md) | ||
|
||
[Remove-VsTeamMembership](Remove-VsTeamMembership.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### -ContainerDescriptor | ||
|
||
A container descriptor retrieved by Get-VsTeamGroup | ||
|
||
```yaml | ||
Type: String | ||
Required: True | ||
Position: 1 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### -MemberDescriptor | ||
|
||
A member descriptor retrieved by Get-VsTeamUser | ||
|
||
```yaml | ||
Type: String | ||
Required: True | ||
Position: 0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Adds a membership to a container. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Gets a memberships for a container or member. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Removes a membership to a container. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Tests the membership in a container. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
function _callMembershipAPI { | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[string] $Id, | ||
[ValidateSet('Get', 'Post', 'Patch', 'Delete', 'Options', 'Put', 'Default', 'Head', 'Merge', 'Trace')] | ||
[string] $Method, | ||
[ValidateSet('', 'Up', 'Down')] | ||
[string] $Direction | ||
) | ||
Set-StrictMode -Version Latest | ||
|
||
# This will throw if this account does not support the graph API | ||
_supportsGraph | ||
|
||
Write-Verbose "Getting members for $Id" | ||
|
||
$query = @{} | ||
if ($Direction) { | ||
$query['direction'] = $Direction | ||
} | ||
|
||
# Call the REST API | ||
$resp = _callAPI -Area 'graph' -Resource 'memberships' ` | ||
-Id $Id ` | ||
-SubDomain "vssps" ` | ||
-Method $Method ` | ||
-Version $([VSTeamVersions]::Graph) ` | ||
-QueryString $query | ||
|
||
return $resp | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.