From 68dc5e8c8d454e6479ee39886c0e3135428bedfa Mon Sep 17 00:00:00 2001 From: Andrey Sluzhivoy Date: Wed, 22 May 2024 08:27:43 +0200 Subject: [PATCH] + added identity store methods --- PSTableauREST/PSTableauREST.psd1 | 7 +- PSTableauREST/PSTableauREST.psm1 | 105 ++++++++++++++++++++++ docs/Get-TableauIdentityStore.md | 36 ++++++++ docs/New-TableauIdentityStore.md | 135 ++++++++++++++++++++++++++++ docs/Remove-TableauIdentityStore.md | 100 +++++++++++++++++++++ 5 files changed, 379 insertions(+), 4 deletions(-) create mode 100644 docs/Get-TableauIdentityStore.md create mode 100644 docs/New-TableauIdentityStore.md create mode 100644 docs/Remove-TableauIdentityStore.md diff --git a/PSTableauREST/PSTableauREST.psd1 b/PSTableauREST/PSTableauREST.psd1 index 42c2eba..9e32f98 100644 --- a/PSTableauREST/PSTableauREST.psd1 +++ b/PSTableauREST/PSTableauREST.psd1 @@ -12,7 +12,7 @@ RootModule = 'PSTableauREST.psm1' # Version number of this module. -ModuleVersion = '0.7.8' +ModuleVersion = '0.7.9' # Supported PSEditions # CompatiblePSEditions = @() @@ -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' @@ -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 diff --git a/PSTableauREST/PSTableauREST.psm1 b/PSTableauREST/PSTableauREST.psm1 index f8035e8..7f7c18d 100644 --- a/PSTableauREST/PSTableauREST.psm1 +++ b/PSTableauREST/PSTableauREST.psm1 @@ -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 { <# diff --git a/docs/Get-TableauIdentityStore.md b/docs/Get-TableauIdentityStore.md new file mode 100644 index 0000000..f6919c8 --- /dev/null +++ b/docs/Get-TableauIdentityStore.md @@ -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) + diff --git a/docs/New-TableauIdentityStore.md b/docs/New-TableauIdentityStore.md new file mode 100644 index 0000000..087b4e9 --- /dev/null +++ b/docs/New-TableauIdentityStore.md @@ -0,0 +1,135 @@ +# New-TableauIdentityStore + +## SYNOPSIS +Configure Identity Store + +## SYNTAX + +``` +New-TableauIdentityStore [-Name] [[-Type] ] [[-DisplayName] ] + [-ProgressAction ] [-WhatIf] [-Confirm] [] +``` + +## 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) + diff --git a/docs/Remove-TableauIdentityStore.md b/docs/Remove-TableauIdentityStore.md new file mode 100644 index 0000000..4aa52e2 --- /dev/null +++ b/docs/Remove-TableauIdentityStore.md @@ -0,0 +1,100 @@ +# Remove-TableauIdentityStore + +## SYNOPSIS +Delete Identity Store + +## SYNTAX + +``` +Remove-TableauIdentityStore [-IdentityStoreId] [-ProgressAction ] [-WhatIf] + [-Confirm] [] +``` + +## DESCRIPTION +Delete an identity store. +This method can only be called by server administrators. + +## EXAMPLES + +### EXAMPLE 1 +``` +$result = Remove-TableauIdentityStore -IdentityStoreId $uuid +``` + +## PARAMETERS + +### -IdentityStoreId +Identity store ID. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +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_DeleteIdentityStoreTAG](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_identity_pools.htm#AuthnService_DeleteIdentityStoreTAG) +