Skip to content

Commit

Permalink
Merge pull request #383 from PlagueHO/Issue-370
Browse files Browse the repository at this point in the history
Added Get-CosmosDbDocumentJson function - Fixes #370
  • Loading branch information
PlagueHO authored May 31, 2020
2 parents 31c0188 + 967bf6f commit f37edad
Show file tree
Hide file tree
Showing 15 changed files with 868 additions and 183 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Added `Get-CosmosDbDocumentJson` function - Fixes [Issue #370](https://github.com/PlagueHO/CosmosDB/issues/370).

### Changed

- Changed build jobs `Unit_Test_PSCore6_Ubuntu1604` and
Expand All @@ -17,6 +21,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
`*-CosmosDbCollection` functions - Fixes [Issue #375](https://github.com/PlagueHO/CosmosDB/issues/375).
- Added `Name` as an alias for `Id` parameters in
`*-CosmosDbDatabase` functions - Fixes [Issue #374](https://github.com/PlagueHO/CosmosDB/issues/374).
- Refactored `Get-CosmosDbDocument` to be a wrapper for
new function `Get-CosmosDbDocumentJson`.

### Fixed

- Fixed `Get-CosmosDbDocument` function partition key formatting
when an `Id` parameter is passed.

## [4.1.0] - 2020-05-15

Expand Down
12 changes: 6 additions & 6 deletions Resolve-Dependency.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ param
(

[Parameter()]
[String]
[System.String]
$DependencyFile = 'RequiredModules.psd1',

[Parameter()]
[String]
[System.String]
# Path for PSDepend to be bootstrapped and save other dependencies.
# Can also be CurrentUser or AllUsers if you wish to install the modules in such scope
# Default to $PWD.Path/output/modules
Expand All @@ -24,12 +24,12 @@ param

[Parameter()]
[ValidateSet('CurrentUser', 'AllUsers')]
[String]
[System.String]
# Scope to bootstrap the PackageProvider and PSGet if not available
$Scope = 'CurrentUser',

[Parameter()]
[String]
[System.String]
# Gallery to use when bootstrapping PackageProvider, PSGet and when calling PSDepend (can be overridden in Dependency files)
$Gallery = 'PSGallery',

Expand All @@ -45,7 +45,7 @@ param
$AllowOldPowerShellGetModule,

[Parameter()]
[String]
[System.String]
# Allow you to specify a minimum version fo PSDepend, if you're after specific features.
$MinimumPSDependVersion,

Expand Down Expand Up @@ -77,7 +77,7 @@ try
try
{
$variableValue = $ResolveDependencyDefaults[$ParamName]
if ($variableValue -is [string])
if ($variableValue -is [System.String])
{
$variableValue = $ExecutionContext.InvokeCommand.ExpandString($variableValue)
}
Expand Down
58 changes: 29 additions & 29 deletions STYLEGUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -1136,12 +1136,12 @@ function New-Event
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Message,
[Parameter()]
[ValidateSet('operational', 'debug', 'analytic')]
[String]
[System.String]
$Channel = 'operational'
)
# Implementation...
Expand Down Expand Up @@ -1170,12 +1170,12 @@ function New-Event
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Message,
[Parameter()]
[ValidateSet('operational', 'debug', 'analytic')]
[String]
[System.String]
$Channel = 'operational'
)
# Implementation
Expand All @@ -1192,7 +1192,7 @@ Functions with no parameters should still display an empty parameter block.
**Bad:**

```powershell
function Write-Text([Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][String]$Text)
function Write-Text([Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][System.String]$Text)
{
Write-Verbose -Message $Text
}
Expand All @@ -1216,7 +1216,7 @@ function Write-Text
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Text
)
Expand Down Expand Up @@ -1272,7 +1272,7 @@ function Write-Text
{
param([Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String] $Text )
[System.String] $Text )
Write-Verbose -Message $Text
}
Expand All @@ -1287,12 +1287,12 @@ function Write-Text
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Text
[Parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$PrefixText
[Boolean]
Expand Down Expand Up @@ -1330,7 +1330,7 @@ function Write-Text
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Text
)
Expand All @@ -1347,12 +1347,12 @@ function Write-Text
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Text
[Parameter()]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$PrefixText
[Parameter()]
Expand Down Expand Up @@ -1428,10 +1428,10 @@ function New-Event
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Message,
[ValidateSet('operational', 'debug', 'analytic')]
[String]
[System.String]
$Channel = 'operational'
)
}
Expand All @@ -1446,12 +1446,12 @@ function New-Event
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Message,
[Parameter()]
[ValidateSet('operational', 'debug', 'analytic')]
[String]
[System.String]
$Channel = 'operational'
)
}
Expand All @@ -1471,7 +1471,7 @@ function Get-TargetResource
[CmdletBinding()]
param
(
[String] $SourcePath = 'c:\'
[System.String] $SourcePath = 'c:\'
)
}
```
Expand All @@ -1485,7 +1485,7 @@ function Get-TargetResource
param
(
[Parameter()]
[String]
[System.String]
$SourcePath = 'c:\'
)
}
Expand Down Expand Up @@ -1516,12 +1516,12 @@ function New-Event
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Message,
[Parameter()]
[ValidateSet('operational', 'debug', 'analytic')]
[String]
[System.String]
$Channel = 'operational'
)
}
Expand All @@ -1540,10 +1540,10 @@ function New-Event
{
param
(
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][String]
[Parameter(Mandatory = $true)][ValidateNotNullOrEmpty()][System.String]
$Message,
[ValidateSet('operational', 'debug', 'analytic')][String]
[ValidateSet('operational', 'debug', 'analytic')][System.String]
$Channel = 'operational'
)
}
Expand All @@ -1558,12 +1558,12 @@ function New-Event
(
[Parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]
[System.String]
$Message,
[Parameter()]
[ValidateSet('operational', 'debug', 'analytic')]
[String]
[System.String]
$Channel = 'operational'
)
}
Expand Down Expand Up @@ -1762,10 +1762,10 @@ function Get-Settings
{
param
(
[String]
[System.String]
$Username
[String]
[System.String]
$Password
)
...
Expand Down Expand Up @@ -1819,7 +1819,7 @@ Extra type declarations can clutter the code.
**Bad:**

```powershell
[String] $myString = 'My String'
[System.String] $myString = 'My String'
```

**Bad:**
Expand Down Expand Up @@ -1971,7 +1971,7 @@ function Get-Something
param
(
[Parameter(Mandatory = $true)]
[String]
[System.String]
$Name = 'My Name'
)
Expand All @@ -1987,7 +1987,7 @@ function Get-Something
param
(
[Parameter(Mandatory = $true)]
[String]
[System.String]
$Name
)
Expand Down
2 changes: 1 addition & 1 deletion build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ param
[string[]]$Tasks = '.',

[Parameter()]
[String]
[System.String]
$CodeCoverageThreshold = '',

[Parameter()]
Expand Down
10 changes: 9 additions & 1 deletion docs/CosmosDB.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ Return the collections in a Cosmos DB database.

Return the resource path for a collection object.

### [Get-CosmosDbContinuationToken](Get-CosmosDbContinuationToken.md)

Return the continuation token from a response header object.

### [Get-CosmosDbDatabase](Get-CosmosDbDatabase.md)

Return the databases in a Cosmos DB account.
Expand All @@ -57,7 +61,11 @@ Return the resource path for a database object.

### [Get-CosmosDbDocument](Get-CosmosDbDocument.md)

Return the documents for a Cosmos DB database collection.
Return documents from a Cosmos DB database collection.

### [Get-CosmosDbDocumentJson](Get-CosmosDbDocumentJson.md)

Return documents from a Cosmos DB database collection as a JSON string.

### [Get-CosmosDbDocumentResourcePath](Get-CosmosDbDocumentResourcePath.md)

Expand Down
6 changes: 3 additions & 3 deletions docs/Get-CosmosDbDocument.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ schema: 2.0.0

## SYNOPSIS

Return the documents for a Cosmos DB database collection.
Return documents from a Cosmos DB database collection.

## SYNTAX

Expand Down Expand Up @@ -41,7 +41,7 @@ This cmdlet will return the documents for a specified collection in a
Cosmos DB database. If an Id is specified then only the specified
documents will be returned.

A maxiumum of 100 document will be returned if an Id is not
A maximum of 100 document will be returned if an Id is not
specified. To retrieve more than 100 documents a continuation
token will need to be used.

Expand Down Expand Up @@ -82,7 +82,7 @@ PS C:\> $query = "SELECT * FROM customers c WHERE (c.id = '[email protected]')"
PS C:\> Get-CosmosDbDocument -Context $cosmosDbContext -CollectionId 'MyNewCollection' -Query $query
```

Querying the documents in a collection.
Query the documents in a collection.

### Example 5

Expand Down
Loading

0 comments on commit f37edad

Please sign in to comment.