Skip to content

Commit

Permalink
+ added identity store methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Sluzhivoy committed May 22, 2024
1 parent ba4b983 commit 68dc5e8
Show file tree
Hide file tree
Showing 5 changed files with 379 additions and 4 deletions.
7 changes: 3 additions & 4 deletions PSTableauREST/PSTableauREST.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RootModule = 'PSTableauREST.psm1'

# Version number of this module.
ModuleVersion = '0.7.8'
ModuleVersion = '0.7.9'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand Down Expand Up @@ -171,9 +171,7 @@ FunctionsToExport = @(
'Get-TableauAuthConfiguration', 'Set-TableauAuthConfiguration', 'New-TableauAuthConfiguration', 'Remove-TableauAuthConfiguration',
'Get-TableauIdentityPool', 'Set-TableauIdentityPool', 'New-TableauIdentityPool', 'Remove-TableauIdentityPool',
'Add-TableauUserToIdentityPool', 'Remove-TableauUserFromIdentityPool',
# List Identity Stores
# Configure Identity Store
# Delete Identity Store
'Get-TableauIdentityStore', 'New-TableauIdentityStore', 'Remove-TableauIdentityStore',

### Metadata methods - introduced in API API 3.5
'Get-TableauDatabase', 'Get-TableauTable', 'Get-TableauTableColumn', 'Get-TableauMetadataObject'
Expand Down Expand Up @@ -277,6 +275,7 @@ AliasesToExport = @('Login-TableauServer', 'Logout-TableauServer',
'Add-TableauPulseSubscription', 'Generate-TableauPulseInsightBundle'
'Register-TableauAuthConfiguration', 'Update-TableauAuthConfiguration',
'Register-TableauIdentityPool', 'Update-TableauIdentityPool',
'Register-TableauIdentityStore',
'Run-TableauMetadataGraphQL', 'Query-TableauMetadata')

# DSC resources to export from this module
Expand Down
105 changes: 105 additions & 0 deletions PSTableauREST/PSTableauREST.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -13232,6 +13232,111 @@ Param(
}
}

function Get-TableauIdentityStore {
<#
.SYNOPSIS
List Identity Stores

.DESCRIPTION
List information about all identity store instances used to provision users.
This method can only be called by server administrators.
This method returns a PSCustomObject from JSON - see online help for more details.

.EXAMPLE
$stores = Get-TableauIdentityStore

.LINK
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_identity_pools.htm#AuthnService_ListIdentityStoresTAG
#>
[OutputType([PSCustomObject])]
Param()
Assert-TableauAuthToken
Assert-TableauRestVersion -AtLeast 3.19
$response = Invoke-TableauRestMethod -Uri (Get-TableauRequestUri -Endpoint Versionless -Param authn-service/identity-stores) -Method Get # -ContentType 'application/json'
return $response.instances
}

function New-TableauIdentityStore {
<#
.SYNOPSIS
Configure Identity Store

.DESCRIPTION
Configure a new local identity store to provision users.
This method can only be called by server administrators.
This method returns a PSCustomObject from JSON - see online help for more details.

.PARAMETER Name
The new identity pool name. Must be unique. This name is visible on the Tableau Server landing page when users sign in.

.PARAMETER Type
Identity store type used to provision users. Use 0 to configure a new local identity store.
Note: Creating a new identity store of type Active Directory or LDAP is not supported.

.PARAMETER DisplayName
(Optional) Identity store display name.

.EXAMPLE
$result = Set-TableauIdentityStore -Name $name

.LINK
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_identity_pools.htm#AuthnService_RegisterIdentityStoreTAG
#>
[CmdletBinding(SupportsShouldProcess)]
[Alias('Register-TableauIdentityStore')]
[OutputType([PSCustomObject])]
Param(
[Parameter(Mandatory)][string] $Name,
[Parameter()][string] $Type = '0',
[Parameter()][string] $DisplayName
)
Assert-TableauAuthToken
Assert-TableauRestVersion -AtLeast 3.19
$request = @{
type=$Type;
name=$Name;
}
if ($DisplayName) {
$request.display_name = $DisplayName
}
$jsonBody = $request | ConvertTo-Json -Compress -Depth 4
# Write-Debug $jsonBody
if ($PSCmdlet.ShouldProcess($Name)) {
$response = Invoke-TableauRestMethod -Uri (Get-TableauRequestUri -Endpoint Versionless -Param authn-service/identity-stores) -Body $jsonBody -Method Post -ContentType 'application/json'
return $response.store_instance
}
}

function Remove-TableauIdentityStore {
<#
.SYNOPSIS
Delete Identity Store

.DESCRIPTION
Delete an identity store.
This method can only be called by server administrators.

.PARAMETER IdentityStoreId
Identity store ID.

.EXAMPLE
$result = Remove-TableauIdentityStore -IdentityStoreId $uuid

.LINK
https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_identity_pools.htm#AuthnService_DeleteIdentityStoreTAG
#>
[CmdletBinding(SupportsShouldProcess)]
[OutputType([PSCustomObject])]
Param(
[Parameter(Mandatory)][string] $IdentityStoreId
)
Assert-TableauAuthToken
Assert-TableauRestVersion -AtLeast 3.19
if ($PSCmdlet.ShouldProcess($IdentityStoreId)) {
Invoke-TableauRestMethod -Uri (Get-TableauRequestUri -Endpoint Versionless -Param authn-service/identity-stores/$IdentityStoreId) -Method Delete
}
}

### Metadata methods
function Get-TableauDatabase {
<#
Expand Down
36 changes: 36 additions & 0 deletions docs/Get-TableauIdentityStore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Get-TableauIdentityStore

## SYNOPSIS
List Identity Stores

## SYNTAX

```
Get-TableauIdentityStore
```

## DESCRIPTION
List information about all identity store instances used to provision users.
This method can only be called by server administrators.
This method returns a PSCustomObject from JSON - see online help for more details.

## EXAMPLES

### EXAMPLE 1
```
$stores = Get-TableauIdentityStore
```

## PARAMETERS

## INPUTS

## OUTPUTS

### System.Management.Automation.PSObject
## NOTES

## RELATED LINKS

[https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_identity_pools.htm#AuthnService_ListIdentityStoresTAG](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_identity_pools.htm#AuthnService_ListIdentityStoresTAG)

135 changes: 135 additions & 0 deletions docs/New-TableauIdentityStore.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# New-TableauIdentityStore

## SYNOPSIS
Configure Identity Store

## SYNTAX

```
New-TableauIdentityStore [-Name] <String> [[-Type] <String>] [[-DisplayName] <String>]
[-ProgressAction <ActionPreference>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Configure a new local identity store to provision users.
This method can only be called by server administrators.
This method returns a PSCustomObject from JSON - see online help for more details.

## EXAMPLES

### EXAMPLE 1
```
$result = Set-TableauIdentityStore -Name $name
```

## PARAMETERS

### -Name
The new identity pool name.
Must be unique.
This name is visible on the Tableau Server landing page when users sign in.

```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Type
Identity store type used to provision users.
Use 0 to configure a new local identity store.
Note: Creating a new identity store of type Active Directory or LDAP is not supported.
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: 0
Accept pipeline input: False
Accept wildcard characters: False
```
### -DisplayName
(Optional) Identity store display name.
```yaml
Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Confirm
Prompts you for confirmation before running the cmdlet.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -ProgressAction
{{ Fill ProgressAction Description }}
```yaml
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
## INPUTS
## OUTPUTS
### System.Management.Automation.PSObject
## NOTES
## RELATED LINKS
[https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_identity_pools.htm#AuthnService_RegisterIdentityStoreTAG](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_identity_pools.htm#AuthnService_RegisterIdentityStoreTAG)
Loading

0 comments on commit 68dc5e8

Please sign in to comment.