diff --git a/CHANGES.md b/CHANGES.md index af54497..54da0b0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,15 @@ # Release notes +## 2.4.0 +May 28, 2021 + +- Fix **PSCouchDBRequest** constructor. +- Fix *SetServer* method on **PSCouchDBRequest** class. +- Fix *AddAuthorization* method on **PSCouchDBRequest** class. +- Fix *SetDatabase/Document/Attachment* method on **PSCouchDBRequest** class. +- Add positional parameters value for some cmdlets. +- Remove *Username* and *Password* in *ToString* method on **PSCouchDBRequest** for security reason. + ## 2.3.0 May 28, 2021 diff --git a/PSCouchDB/PSCouchDB.psd1 b/PSCouchDB/PSCouchDB.psd1 index 136b685..f502bbb 100755 --- a/PSCouchDB/PSCouchDB.psd1 +++ b/PSCouchDB/PSCouchDB.psd1 @@ -28,7 +28,7 @@ ) # Version number of this module. - ModuleVersion = '2.3.2' + ModuleVersion = '2.4' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PSCouchDB/PSCouchDB.psm1 b/PSCouchDB/PSCouchDB.psm1 index d10abf9..7b11897 100755 --- a/PSCouchDB/PSCouchDB.psm1 +++ b/PSCouchDB/PSCouchDB.psm1 @@ -1573,13 +1573,16 @@ class PSCouchDBRequest { } [string] ToString () { + $stringUri = New-Object -TypeName System.UriBuilder -ArgumentList $this.uri.Uri + # Remove Username and Password in string mode for security reason + $stringUri.Password = $stringUri.UserName = $null $str = " {0} {1} Host: {2} Param: {3} Uri: {4} -{5}" -f $this.method, $this.uri.Path, $this.uri.Host, $this.uri.Query, $this.uri, $this.data +{5}" -f $this.method, $this.uri.Path, $this.uri.Host, $this.uri.Query, $stringUri.Uri, $this.data return $str } } diff --git a/PSCouchDB/functions/CouchDBauthentication.ps1 b/PSCouchDB/functions/CouchDBauthentication.ps1 index d86b6d5..9d29d0b 100644 --- a/PSCouchDB/functions/CouchDBauthentication.ps1 +++ b/PSCouchDB/functions/CouchDBauthentication.ps1 @@ -18,9 +18,9 @@ function Set-CouchDBSession () { https://pscouchdb.readthedocs.io/en/latest/auth.html #> param( - [Parameter(mandatory = $true)] + [Parameter(mandatory = $true, Position = 0)] [string] $UserId, - [Parameter(mandatory = $true)] + [Parameter(mandatory = $true, Position = 1)] [SecureString] $Password ) [PSCredential]$credOject = New-Object System.Management.Automation.PSCredential ($UserId, $Password) diff --git a/PSCouchDB/functions/CouchDBconfiguration.ps1 b/PSCouchDB/functions/CouchDBconfiguration.ps1 index 8862e91..233f881 100644 --- a/PSCouchDB/functions/CouchDBconfiguration.ps1 +++ b/PSCouchDB/functions/CouchDBconfiguration.ps1 @@ -341,7 +341,9 @@ function Get-CouchDBConfiguration () { [string] $Server, [int] $Port, [string] $Node = (Get-CouchDBNode -Server $Server -Port $Port -Authorization $Authorization -Ssl:$Ssl -ProxyServer $ProxyServer -ProxyCredential $ProxyCredential).name, + [Parameter(Position = 0)] [string] $Session, + [Parameter(Position = 1)] [string] $Key, $Authorization, [switch] $Ssl, @@ -407,10 +409,13 @@ function Set-CouchDBConfiguration () { [int] $Port, [string] $Node = $(if ((Get-CouchDBNode -Server $Server -Port $Port -Authorization $Authorization -Ssl:$Ssl -ProxyServer $ProxyServer -ProxyCredential $ProxyCredential).name -contains "couchdb@localhost") { "couchdb@localhost" } else { "couchdb@127.0.0.1" }), [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Element, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Key, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Value, $Authorization, [switch] $Ssl, diff --git a/PSCouchDB/functions/CouchDBdatabase.ps1 b/PSCouchDB/functions/CouchDBdatabase.ps1 index b36507e..8d8361a 100644 --- a/PSCouchDB/functions/CouchDBdatabase.ps1 +++ b/PSCouchDB/functions/CouchDBdatabase.ps1 @@ -45,6 +45,7 @@ function Test-CouchDBDatabase () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch] $Ssl, @@ -111,7 +112,9 @@ function Copy-CouchDBDatabase () { [int] $Port, [int] $RemotePort, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, + [Parameter(Position = 1)] [string] $Destination = $(if ($RemoteServer) {$Database} else {$Database + "_new"}), [array] $ExcludeIds, $Authorization, @@ -237,6 +240,7 @@ function Get-CouchDBDatabase () { [int] $Port, [Parameter(ParameterSetName = "Database")] [Parameter(ParameterSetName = "AllDatabase")] + [Parameter(Position = 0)] [string] $Database, [Parameter(ParameterSetName = "AllDatabase")] [switch] $AllDatabase, @@ -343,7 +347,9 @@ function New-CouchDBDatabase () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, + [Parameter(Position = 1)] [switch] $Partition, $Authorization, [switch] $Ssl, @@ -394,6 +400,7 @@ function Remove-CouchDBDatabase () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch]$Force, @@ -444,6 +451,7 @@ function Get-CouchDBIndex () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch] $Ssl, @@ -498,10 +506,13 @@ function New-CouchDBIndex () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Name, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [array] $Fields, $Authorization, [switch] $Ssl, @@ -566,10 +577,13 @@ function Remove-CouchDBIndex () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $DesignDoc, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 2)] [string] $Name, $Authorization, [switch]$Force, @@ -591,7 +605,7 @@ function Get-CouchDBDatabaseInfo () { Returns information of a list of the specified databases in the CouchDB instance. .NOTES CouchDB API: - GET /_purged_infos_limit + GET /_dbs_info .PARAMETER Server The CouchDB server name. Default is localhost. .PARAMETER Port @@ -621,6 +635,7 @@ function Get-CouchDBDatabaseInfo () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [array] $Keys, $Authorization, [switch] $Ssl, @@ -675,7 +690,9 @@ function Get-CouchDBDatabaseShards () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, + [Parameter(Position = 1)] [string] $Document, $Authorization, [switch] $Ssl, @@ -724,6 +741,7 @@ function Sync-CouchDBDatabaseShards () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch] $Ssl, @@ -775,6 +793,7 @@ function Compress-CouchDBDatabase () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch] $Ssl, @@ -827,6 +846,7 @@ function Write-CouchDBFullCommit () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch]$Force, @@ -879,6 +899,7 @@ function Clear-CouchDBView () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch] $Ssl, @@ -927,6 +948,7 @@ function Get-CouchDBDatabasePurgedLimit () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch] $Ssl, @@ -977,8 +999,10 @@ function Set-CouchDBDatabasePurgedLimit () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [int] $Limit, $Authorization, [switch] $Ssl, @@ -1031,10 +1055,13 @@ function Get-CouchDBMissingRevision () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 2)] [array] $Revision, $Authorization, [switch] $Ssl, @@ -1088,10 +1115,13 @@ function Get-CouchDBRevisionDifference () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 2)] [array] $Revision, $Authorization, [switch] $Ssl, @@ -1141,6 +1171,7 @@ function Get-CouchDBRevisionLimit () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch] $Ssl, @@ -1190,7 +1221,9 @@ function Set-CouchDBRevisionLimit () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, + [Parameter(Position = 1)] [int] $Limit = 1000, $Authorization, [switch] $Ssl, @@ -1244,7 +1277,9 @@ function Export-CouchDBDatabase () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, + [Parameter(Position = 1)] [string] $Path = $(Join-Path -Path "$($PWD.path)" -ChildPath "$($Database)_$(Get-Date -Format 'MM-dd-yyyy_HH_mm_ss').json"), $Authorization, [switch] $Ssl, @@ -1336,8 +1371,10 @@ function Import-CouchDBDatabase () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Path, [switch] $RemoveRevision, $Authorization, @@ -1402,6 +1439,7 @@ function Connect-CouchDBDatabase () { [string] $Server = 'localhost', [int] $Port = 5984, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization ) diff --git a/PSCouchDB/functions/CouchDBdesigndocument.ps1 b/PSCouchDB/functions/CouchDBdesigndocument.ps1 index ce0cbb5..78b41f1 100644 --- a/PSCouchDB/functions/CouchDBdesigndocument.ps1 +++ b/PSCouchDB/functions/CouchDBdesigndocument.ps1 @@ -64,6 +64,7 @@ function Get-CouchDBDatabaseDesignDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Alias('Desc')] [switch] $Descending, @@ -202,8 +203,10 @@ function Get-CouchDBDesignDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [switch] $Info, $Authorization, @@ -302,10 +305,12 @@ function Get-CouchDBDesignDocumentAttachment () { [Parameter(ParameterSetName = "Attachment")] [Parameter(ParameterSetName = "Info")] [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(ParameterSetName = "Attachment")] [Parameter(ParameterSetName = "Info")] [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(ParameterSetName = "Attachment")] [Parameter(ParameterSetName = "Info")] @@ -315,6 +320,7 @@ function Get-CouchDBDesignDocumentAttachment () { [Parameter(ParameterSetName = "Attachment")] [Parameter(ParameterSetName = "Info")] [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Attachment, [Parameter(ParameterSetName = "Attachment")] [string] $OutFile, @@ -407,12 +413,16 @@ function Add-CouchDBDesignDocumentAttachment () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] $Attachment, [Parameter(mandatory = $true)] + [Parameter(Position = 3)] [string] $Revision, $Authorization, [switch] $Ssl, @@ -500,10 +510,12 @@ function New-CouchDBDesignDocument () { [Parameter(ParameterSetName = "View")] [Parameter(ParameterSetName = "CustomData")] [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(ParameterSetName = "View")] [Parameter(ParameterSetName = "CustomData")] [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(ParameterSetName = "View")] [string] $ViewName, @@ -625,14 +637,17 @@ function Set-CouchDBDesignDocument () { [Parameter(ParameterSetName = "View")] [Parameter(ParameterSetName = "CustomData")] [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(ParameterSetName = "View")] [Parameter(ParameterSetName = "CustomData")] [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(ParameterSetName = "View")] [Parameter(ParameterSetName = "CustomData")] [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Revision, [Parameter(ParameterSetName = "View")] [string] $ViewName, @@ -729,8 +744,10 @@ function Compress-CouchDBDesignDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $DesignDoc, $Authorization, [switch] $Ssl, @@ -786,10 +803,13 @@ function Remove-CouchDBDesignDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(Mandatory = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(Mandatory = $true)] + [Parameter(Position = 2)] [string] $Revision, $Authorization, [switch]$Force, @@ -847,12 +867,16 @@ function Remove-CouchDBDesignDocumentAttachment () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Attachment, [Parameter(mandatory = $true)] + [Parameter(Position = 3)] [string] $Revision, $Authorization, [switch]$Force, diff --git a/PSCouchDB/functions/CouchDBdocument.ps1 b/PSCouchDB/functions/CouchDBdocument.ps1 index 53509f9..943e2b4 100644 --- a/PSCouchDB/functions/CouchDBdocument.ps1 +++ b/PSCouchDB/functions/CouchDBdocument.ps1 @@ -145,9 +145,11 @@ function Get-CouchDBDocument () { [Parameter(ParameterSetName = "Document")] [Parameter(ParameterSetName = "Info")] [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(ParameterSetName = "Document")] [Parameter(ParameterSetName = "Info")] + [Parameter(Position = 1)] [string] $Document, [Parameter(ParameterSetName = "AllDocuments")] [switch] $AllDocument, @@ -157,6 +159,7 @@ function Get-CouchDBDocument () { [string] $Partition, [Parameter(ParameterSetName = "Document")] [Parameter(ParameterSetName = "Info")] + [Parameter(Position = 2)] [string] $Revision, [Parameter(ParameterSetName = "Info")] [switch] $Info, @@ -511,11 +514,14 @@ function New-CouchDBDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [string] $Partition, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] $Data, [string] $Attachment, [switch] $BatchMode, @@ -614,10 +620,13 @@ function Set-CouchDBDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Revision, $Data, [string] $Partition, @@ -733,10 +742,13 @@ function Remove-CouchDBDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Revision, $Authorization, [switch]$Force, @@ -798,11 +810,15 @@ function Copy-CouchDBDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Destination, + [Parameter(Position = 3)] [string] $Revision, $Authorization, [switch] $Ssl, @@ -880,7 +896,9 @@ function Get-CouchDBBulkDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, + [Parameter(Position = 1)] $Data, $Authorization, [switch] $Ssl, @@ -960,7 +978,9 @@ function New-CouchDBBulkDocument () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, + [Parameter(Position = 1)] $Data, $Authorization, [switch] $Ssl, @@ -1044,10 +1064,12 @@ function Get-CouchDBAttachment () { [Parameter(ParameterSetName = "Attachment")] [Parameter(ParameterSetName = "Info")] [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(ParameterSetName = "Attachment")] [Parameter(ParameterSetName = "Info")] [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(ParameterSetName = "Attachment")] [Parameter(ParameterSetName = "Info")] @@ -1057,6 +1079,7 @@ function Get-CouchDBAttachment () { [Parameter(ParameterSetName = "Attachment")] [Parameter(ParameterSetName = "Info")] [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Attachment, [Parameter(ParameterSetName = "Attachment")] [string] $OutFile, @@ -1148,12 +1171,16 @@ function Add-CouchDBAttachment () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] $Attachment, [Parameter(mandatory = $true)] + [Parameter(Position = 3)] [string] $Revision, $Authorization, [switch] $Ssl, @@ -1221,12 +1248,16 @@ function Remove-CouchDBAttachment () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Document, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Attachment, [Parameter(mandatory = $true)] + [Parameter(Position = 3)] [string] $Revision, $Authorization, [switch]$Force, @@ -1281,8 +1312,10 @@ function Clear-CouchDBDocuments () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 1)] [array] $Document, $Authorization, [switch] $Force, @@ -1350,8 +1383,10 @@ function Search-CouchDBFullText () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [array] $Patterns, [switch] $UseQueries, $Authorization, @@ -1526,6 +1561,7 @@ function Find-CouchDBDocuments () { [Parameter(ParameterSetName = "PSCouchDB")] [Parameter(ParameterSetName = "Native")] [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [Parameter(ParameterSetName = "PSCouchDB")] [Parameter(ParameterSetName = "Native")] @@ -1564,6 +1600,7 @@ function Find-CouchDBDocuments () { [ValidateSet('lt', 'lte', 'eq', 'ne', 'gte', 'gt', 'exists', 'type', 'in', 'nin', 'size', 'mod', 'regex')] [string] $Operator, [Parameter(ParameterSetName = "Native")] + [Parameter(Position = 1)] [string] $Find, [Parameter(ParameterSetName = "PSCouchDB")] [Parameter(ParameterSetName = "Native")] diff --git a/PSCouchDB/functions/CouchDBpermission.ps1 b/PSCouchDB/functions/CouchDBpermission.ps1 index d050bd9..c21a4a0 100644 --- a/PSCouchDB/functions/CouchDBpermission.ps1 +++ b/PSCouchDB/functions/CouchDBpermission.ps1 @@ -45,8 +45,10 @@ function New-CouchDBAdmin () { [int] $Port, [string] $Node, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Userid, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [SecureString] $Password, $Authorization, [switch] $Ssl, @@ -112,8 +114,10 @@ function New-CouchDBUser () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Userid, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [SecureString] $Password, [array] $Roles, $Authorization, @@ -198,7 +202,9 @@ function Grant-CouchDBDatabasePermission () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, + [Parameter(Position = 1)] $Data, $Authorization, [switch] $Ssl, @@ -253,6 +259,7 @@ function Get-CouchDBDatabaseSecurity () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [string] $Variable, $Authorization, @@ -311,6 +318,7 @@ function Revoke-CouchDBDatabasePermission () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, $Authorization, [switch]$Force, @@ -374,6 +382,7 @@ function Remove-CouchDBAdmin () { [int] $Port, [string] $Node = $(if ((Get-CouchDBNode -Server $Server -Port $Port -Authorization $Authorization -Ssl:$Ssl -ProxyServer $ProxyServer -ProxyCredential $ProxyCredential).all_nodes -contains "couchdb@localhost") { "couchdb@localhost" } else { "couchdb@127.0.0.1" }), [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Userid, $Authorization, [switch]$Force, @@ -431,8 +440,10 @@ function Remove-CouchDBUser () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Userid, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Revision, $Authorization, [switch]$Force, @@ -492,11 +503,14 @@ function Set-CouchDBUser () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Userid, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [SecureString] $Password, [array] $Roles, [Parameter(mandatory = $true)] + [Parameter(Position = 2)] [string] $Revision, $Authorization, [switch] $Ssl, @@ -568,8 +582,10 @@ function Set-CouchDBAdmin () { [int] $Port, [string] $Node = $(if ((Get-CouchDBNode -Server $Server -Port $Port -Authorization $Authorization -Ssl:$Ssl).all_nodes -contains "couchdb@localhost") { "couchdb@localhost" } else { "couchdb@127.0.0.1" }), [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Userid, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [SecureString] $Password, $Authorization, [switch] $Ssl, diff --git a/PSCouchDB/functions/CouchDBreplication.ps1 b/PSCouchDB/functions/CouchDBreplication.ps1 index dcf44c6..a770ab9 100644 --- a/PSCouchDB/functions/CouchDBreplication.ps1 +++ b/PSCouchDB/functions/CouchDBreplication.ps1 @@ -42,6 +42,7 @@ function Get-CouchDBReplication () { [string] $Server, [int] $Port, [Parameter(ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Document = '_all_docs', $Authorization, [switch] $Ssl, @@ -169,8 +170,10 @@ function Get-CouchDBReplicationDocument () { [int] $Port, [int] $Limit, [int] $Skip, + [Parameter(Position = 0)] [string] $ReplicatorDatabase, [ValidateScript( { if ($ReplicatorDatabase) { $true } else { $false } })] + [Parameter(Position = 1)] [string] $ReplicatorDocuments, $Authorization, [switch] $Ssl, @@ -248,6 +251,7 @@ function New-CouchDBReplication () { [Parameter(ValueFromPipeline = $true)] [string] $Server, [int] $Port, + [Parameter(Position = 0)] $Data, $Authorization, [switch] $Ssl, @@ -310,6 +314,7 @@ function Get-CouchDBDatabaseChanges () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Database, [array] $Filter, [switch] $Continuous , @@ -379,6 +384,7 @@ function Set-CouchDBReplication () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] $Data, $Authorization, [switch] $Ssl, @@ -439,8 +445,10 @@ function Remove-CouchDBReplication () { [string] $Server, [int] $Port, [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Document, [Parameter(mandatory = $true)] + [Parameter(Position = 1)] [string] $Revision, $Authorization, [switch] $Force, diff --git a/PSCouchDB/functions/CouchDBserver.ps1 b/PSCouchDB/functions/CouchDBserver.ps1 index 679bebd..11f89d3 100644 --- a/PSCouchDB/functions/CouchDBserver.ps1 +++ b/PSCouchDB/functions/CouchDBserver.ps1 @@ -38,7 +38,9 @@ function Get-CouchDBServer () { #> [CmdletBinding()] param( + [Parameter(Position = 0)] [string] $Server, + [Parameter(Position = 1)] [int] $Port, $Authorization, [switch] $Status, @@ -90,6 +92,7 @@ function Get-CouchDBUser () { [string] $Server, [int] $Port, [Parameter(mandatory = $true, ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Userid, $Authorization, [switch] $Ssl, @@ -405,6 +408,7 @@ function New-CouchDBUuids () { [string] $Server, [int] $Port, [Parameter(ValueFromPipeline = $true)] + [Parameter(Position = 0)] [int] $Count, $Authorization, [switch] $Ssl, @@ -462,8 +466,10 @@ function Search-CouchDBAnalyze () { [string] $Server, [int] $Port, [Parameter(Mandatory = $true)] + [Parameter(Position = 0)] [string] $Field, [Parameter(Mandatory = $true)] + [Parameter(Position = 1)] [string] $Text, $Authorization, [switch] $Ssl, @@ -730,6 +736,7 @@ function Remove-CouchDBReshards () { [string] $Server, [int] $Port, [Parameter(Mandatory = $true)] + [Parameter(Position = 0)] [string] $JobId, $Authorization, [switch] $Ssl, @@ -786,9 +793,11 @@ function Read-CouchDBLog () { #> [CmdletBinding()] param( + [Parameter(Position = 0)] [string] $Path, [ValidateSet("debug", "info", "notice", "warning", "error", "critical", "alert", "emergency")] [Parameter(ValueFromPipeline = $true)] + [Parameter(Position = 1)] [string] $Level = "info", [switch] $Follow, [int] $Tail, @@ -892,6 +901,7 @@ function Clear-CouchDBLog () { [CmdletBinding()] param( [Parameter(ValueFromPipeline = $true)] + [Parameter(Position = 0)] [string] $Path, [switch] $Rotate, $Authorization, @@ -1019,7 +1029,9 @@ function Set-CouchDBProxy () { [CmdletBinding()] param( [Parameter(mandatory = $true)] + [Parameter(Position = 0)] [string] $Server, + [Parameter(Position = 1)] [pscredential] $Credential ) # Check credential