Skip to content

Commit

Permalink
Merge pull request #276 from PlagueHO/Issue-274
Browse files Browse the repository at this point in the history
Added support for PartitionKey in *-CosmosDBAttachment functions - Fixes #274
  • Loading branch information
PlagueHO authored Feb 22, 2019
2 parents 2733377 + 9a91438 commit 718a917
Show file tree
Hide file tree
Showing 25 changed files with 568 additions and 91 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## Unreleased

- Added support for `PartitionKey` in `*-CosmosDBAttachment`
functions - fixes [Issue #274](https://github.com/PlagueHO/CosmosDB/issues/274).
- Update `cosmosdb.psdepend.psd1` to install modules `Az.Resources` 1.1.2 and
`Az.Accounts` 1.3.0.

## 3.2.0.320

- Convert module name to be a variable in PSake file to make it more
Expand Down
11 changes: 11 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Release Notes

## What is New in CosmosDB Unreleased

February 22, 2018

- Added support for `PartitionKey` in `*-CosmosDBAttachment`
functions - fixes [Issue #274](https://github.com/PlagueHO/CosmosDB/issues/274).
- Update `cosmosdb.psdepend.psd1` to install modules `Az.Resources` 1.1.2 and
`Az.Accounts` 1.3.0.
- Suppress verbose output when loading module during automated
testing to reduce output.

## What is New in CosmosDB 3.2.0.320

February 6, 2018
Expand Down
4 changes: 2 additions & 2 deletions cosmosdb.depend.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '1.2.1'
Version = '1.3.0'
Tags = 'Test','Deploy'
}

Expand All @@ -91,7 +91,7 @@
SkipPublisherCheck = $true
}
Target = 'CurrentUser'
Version = '1.1.1'
Version = '1.1.2'
Tags = 'Test','Deploy'
}
}
40 changes: 38 additions & 2 deletions docs/Get-CosmosDbAttachment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Return the attachments for a Cosmos DB document.

```powershell
Get-CosmosDbAttachment -Context <Context> [-Key <SecureString>] [-KeyType <String>] [-Database <String>]
-CollectionId <String> -DocumentId <String> [-Id <String>] [<CommonParameters>]
-CollectionId <String> -DocumentId <String> [-Id <String>] [-PartitionKey <String[]>] [<CommonParameters>]
```

### Account

```powershell
Get-CosmosDbAttachment -Account <String> [-Key <SecureString>] [-KeyType <String>] [-Database <String>]
-CollectionId <String> -DocumentId <String> [-Id <String>] [<CommonParameters>]
-CollectionId <String> -DocumentId <String> [-Id <String>] [-PartitionKey <String[]>] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -51,6 +51,24 @@ PS C:\> Get-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNewCol

Get an attachment by Id for a document in a collection.

### Example 3

```powershell
PS C:\> Get-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNewCollection' -DocumentId 'ac12345' -PartitionKey 'Id'
```

Get all attachments for a document in a collection that contains a
partition key.

### Example 4

```powershell
PS C:\> Get-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNewCollection' -DocumentId 'ac12345' -Id 'image_1' -PartitionKey 'Id'
```

Get an attachment by Id for a document in a collection that contains a
partition key.

## PARAMETERS

### -Account
Expand Down Expand Up @@ -183,6 +201,24 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -PartitionKey
The partition keys for the collection that the attachment is in.
Must be included if and only if the collection is created with
a partitionKey definition.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

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).
Expand Down
39 changes: 37 additions & 2 deletions docs/New-CosmosDbAttachment.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ New-CosmosDbAttachment -Context <Context> [-KeyType <String>] [-Key <SecureStrin

```powershell
New-CosmosDbAttachment -Account <String> [-KeyType <String>] [-Key <SecureString>] [-Database <String>]
-CollectionId <String> -DocumentId <String> [-Id <String>] [-ContentType <String>] [-Media <String>]
[-Slug <String>] [<CommonParameters>]
-CollectionId <String> -DocumentId <String> [-Id <String>] [-PartitionKey <String[]>]
[-ContentType <String>] [-Media <String>] [-Slug <String>] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -43,6 +43,15 @@ PS C:\> New-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNewCol

Create an attachment on a document in a collection.

### Example 2

```powershell
PS C:\> New-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNewCollection' -DocumentId 'ac12345' -Id 'image_1' -ContentType 'image/jpg' -Media 'www.bing.com' -PartitionKey 'id'
```

Create an attachment on a document in a collection that is in a collection with
a partition key.

## PARAMETERS

### -Account
Expand Down Expand Up @@ -214,6 +223,32 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -PartitionKey
The partition keys for the collection that the attachment should
be created in.
Must be included if and only if the collection is created with
a partitionKey definition.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Upsert
Include adds the document to the index.
Exclude omits the document from indexing.
The default for indexing behavior is determined by the automatic
property's value in the indexing policy for the collection.
### -Slug
The name of the attachment.
Expand Down
30 changes: 28 additions & 2 deletions docs/Remove-CosmosDbAttachment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Delete an attachment from a Cosmos DB document.

```powershell
Remove-CosmosDbAttachment -Context <Context> [-Database <String>] [-Key <SecureString>] [-KeyType <String>]
-CollectionId <String> -DocumentId <String> -Id <String> [<CommonParameters>]
-CollectionId <String> -DocumentId <String> -Id <String> [-PartitionKey <String[]>] [<CommonParameters>]
```

### Account

```powershell
Remove-CosmosDbAttachment -Account <String> [-Database <String>] [-Key <SecureString>] [-KeyType <String>]
-CollectionId <String> -DocumentId <String> -Id <String> [<CommonParameters>]
-CollectionId <String> -DocumentId <String> -Id <String> [-PartitionKey <String[]>] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -41,6 +41,14 @@ PS C:\> Remove-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNew

Delete an attachment from a document in collection.

### Example 2

```powershell
PS C:\> Remove-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNewCollection' -Id 'ac12345' -Id 'Image_2' -PartitionKey 'Id'
```

Delete an attachment from a document in collection that has a parttion key.

## PARAMETERS

### -Account
Expand Down Expand Up @@ -173,6 +181,24 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -PartitionKey
The partition keys for the collection that the attachment is in.
Must be included if and only if the collection is created with
a partitionKey definition.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

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).
Expand Down
35 changes: 31 additions & 4 deletions docs/Set-CosmosDbAttachment.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ Update am attachment for a Cosmos DB document.

```powershell
Set-CosmosDbAttachment -Context <Context> [-Database <String>] [-Key <SecureString>] -CollectionId <String>
-DocumentId <String> -Id <String> [-NewId <String>] [-ContentType <String>] [-Media <String>] [-Slug <String>]
[<CommonParameters>]
-DocumentId <String> -Id <String> [-NewId <String>] [-PartitionKey <String[]>] [-ContentType <String>]
[-Media <String>] [-Slug <String>] [<CommonParameters>]
```

### Account

```powershell
Set-CosmosDbAttachment -Account <String> [-Database <String>] [-Key <SecureString>] [-KeyType <String>]
-CollectionId <String> -DocumentId <String> -Id <String> [-NewId <String>] [-ContentType <String>]
[-Media <String>] [-Slug <String>] [<CommonParameters>]
-CollectionId <String> -DocumentId <String> -Id <String> [-NewId <String>] [-PartitionKey <String[]>]
[-ContentType <String>] [-Media <String>] [-Slug <String>] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -44,6 +44,15 @@ PS C:\> Set-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNewCol

Rename the Id of an attachment for a document in a collection.

### Example 2

```powershell
PS C:\> Set-CosmosDbAttachment -Context $cosmosDbContext -CollectionId 'MyNewCollection' -DocumentId 'ac12345' -Id 'image_1' -NewId 'Image_2' -PartitionKey 'Id'
```

Rename the Id of an attachment for a document in a collection that
has a partition key.

## PARAMETERS

### -Account
Expand Down Expand Up @@ -227,6 +236,24 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -PartitionKey
The partition keys for the collection that the attachment is in.
Must be included if and only if the collection is created with
a partitionKey definition.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Slug
The name of the attachment.
Expand Down
Loading

0 comments on commit 718a917

Please sign in to comment.