Skip to content

Commit

Permalink
Feat/remove app binary (#38)
Browse files Browse the repository at this point in the history
* adding new cmdlet Remove-ApplicationBinary

* adding note about deleting active bianry

* updating powershell docs
  • Loading branch information
reubenmiller authored Jan 24, 2021
1 parent 3eed444 commit cc04527
Show file tree
Hide file tree
Showing 11 changed files with 662 additions and 8 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,25 @@ No unreleased features
* 22 => 422 (Unprocessable entity / invalid request)
* 50 => 500 (Internal server error)

* Added `Remove-ApplicationBinary` command

**Example: Remove all application binaries related to an application**

**PowerShell**

```powershell
Remove-ApplicationBinary -Application 12345 -BinaryId 9876
# Or remove all application binaries (except the active one) for an application
Get-ApplicationBinaryCollection -Id 12345 | Remove-ApplicationBinary -Application 12345
```
**Bash/zsh**
```sh
c8y applications deleteApplicationBinary --application 12345 --binaryId 9876
```
### New Features (PSc8y)
* Added support for saving meta information about the requests to the in-built PowerShell InformationVariable common parameter
Expand Down
63 changes: 63 additions & 0 deletions api/spec/json/applications.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,69 @@
"description": "Application id"
}
]
},
{
"name": "deleteApplicationBinary",
"skip": false,
"description": "Remove application binary",
"descriptionLong": "Remove an application binaries related to the given application\nThe active version can not be deleted and the server will throw an error if you try.\n",
"method": "DELETE",
"path": "/application/applications/{application}/binaries/{binaryId}",
"alias": {
"go": "deleteApplicationBinary",
"powershell": "Remove-ApplicationBinary"
},
"examples": {
"powershell": [
{
"description": "Remove an application binary related to a Hosted (web) application",
"beforeEach": [
"$app = New-TestHostedApplication",
"New-ApplicationBinary -Id $app -File",
"$appBinary = Get-ApplicationBinaryCollection -Id $App.id"
],
"command": "Remove-ApplicationBinary -Application $app.id -BinaryId $appBinary.id",
"skipTest": true,
"afterEach": [
"Remove-Application -Id $app.id"
]
},
{
"description": "Remove all application binaries (except for the active one) for an application (using pipeline)",
"beforeEach": [
"$app = New-TestHostedApplication"
],
"command": "Get-ApplicationBinaryCollection -Id $app.id | Remove-ApplicationBinary -Application $app.id",
"skipTest": true,
"afterEach": [
"Remove-Application -Id $app.id"
]
}
],
"go": [
{
"description": "Remove an application binary related to a Hosted (web) application",
"command": "c8y applications deleteApplicationBinary --application 12345 --binaryId 9876"
}
]
},
"pathParameters": [
{
"name": "application",
"type": "application",
"pipeline": false,
"required": true,
"description": "Application id"
},
{
"name": "binaryId",
"alias": "id",
"type": "[]string",
"pipeline": true,
"required": true,
"description": "Application binary id"
}
]
}
]
}
48 changes: 48 additions & 0 deletions api/spec/yaml/applications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,51 @@ endpoints:
pipeline: true
required: true
description: Application id

- name: deleteApplicationBinary
skip: false
description: 'Remove application binary'
descriptionLong: >
Remove an application binaries related to the given application
The active version can not be deleted and the server will throw an error if you try.
method: DELETE
path: /application/applications/{application}/binaries/{binaryId}
alias:
go: deleteApplicationBinary
powershell: Remove-ApplicationBinary
examples:
powershell:
# TODO: Create a test function to update an application binary
- description: Remove an application binary related to a Hosted (web) application
beforeEach:
- $app = New-TestHostedApplication
- New-ApplicationBinary -Id $app -File
- $appBinary = Get-ApplicationBinaryCollection -Id $App.id
command: Remove-ApplicationBinary -Application $app.id -BinaryId $appBinary.id
skipTest: true
afterEach:
- Remove-Application -Id $app.id
- description: Remove all application binaries (except for the active one) for an application (using pipeline)
beforeEach:
- $app = New-TestHostedApplication
command: Get-ApplicationBinaryCollection -Id $app.id | Remove-ApplicationBinary -Application $app.id
skipTest: true
afterEach:
- Remove-Application -Id $app.id
go:
- description: Remove an application binary related to a Hosted (web) application
command: c8y applications deleteApplicationBinary --application 12345 --binaryId 9876
pathParameters:
- name: application
type: application
pipeline: false
required: true
description: Application id

- name: binaryId
alias: id
type: '[]string'
pipeline: true
required: true
description: Application binary id
10 changes: 5 additions & 5 deletions docs/_pwsh/cmdlets/New-Device.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Create a device

```
New-Device
[-Name] <String[]>
[[-Name] <String>]
[[-Type] <String>]
[[-Data] <Object>]
[[-ProcessingMode] <String>]
Expand Down Expand Up @@ -56,17 +56,17 @@ Create device with custom properties
## PARAMETERS

### -Name
Device name (required)
Device name

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

Required: True
Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept pipeline input: False
Accept wildcard characters: False
```
Expand Down
Loading

0 comments on commit cc04527

Please sign in to comment.