-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v2.3.2 - March 2019 - Patch #19 (Add remove methods) - Merge in #21 (Make sure HTTPS link handling doesn't break when handling paging) - Merge in #20 (Add support for ports in the netbox API url)
- Loading branch information
Showing
13 changed files
with
1,580 additions
and
193 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<# | ||
.SYNOPSIS | ||
Deletes a |short| in Netbox | ||
.DESCRIPTION | ||
Deletes a netbox |short| by ID or via the pipeline. | ||
.EXAMPLE | ||
# Remove the |short| by id | ||
Remove-nb|short| -id 1 | ||
.EXAMPLE | ||
#Remove |short| returned from a get-nb|short| | ||
Get-Nb|short| -search mything.contoso.com -Resource 'virtualization/virtual-machines' | | ||
Remove-nb|short| -Resource 'virtualization/virtual-machines' | ||
#> | ||
Function Remove-nb|short| { | ||
Param ( | ||
# ID of the |short| to delete | ||
[Parameter()] | ||
[Int] | ||
$Id | ||
) | ||
Remove-nbObject -Resource '|long|' -id $id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<# | ||
.SYNOPSIS | ||
Deletes an object from netbox | ||
.DESCRIPTION | ||
Deletes a netbox object by ID or via the pipeline. | ||
.EXAMPLE | ||
# Remove the object by id | ||
Remove-nbObject -id 1 -Resource 'virtualization/virtual-machines' | ||
.EXAMPLE | ||
#Remove an object from a get-nbobject | ||
Get-NbObject -search mything.contoso.com -Resource 'virtualization/virtual-machines' | | ||
Remove-nbObject -Resource 'virtualization/virtual-machines' | ||
#> | ||
function Remove-nbObject { | ||
[CmdletBinding()] | ||
param ( | ||
# Which resource to delete | ||
[Parameter(Mandatory = $true, Position = 0, ValueFromPipelineByPropertyName = $true)] | ||
[Int] | ||
$Id, | ||
# Which resource type to delete | ||
[Parameter(Mandatory = $true, Position = 1)] | ||
[String] | ||
[Alias("type")] | ||
$Resource | ||
) | ||
|
||
|
||
process { | ||
Invoke-nbApi -Resource "$Resource/$id" -HttpVerb Delete | ||
} | ||
} |
Oops, something went wrong.