Skip to content

Commit

Permalink
Add new Remove-nb* commands.
Browse files Browse the repository at this point in the history
Update Create Commands for better warning on nbx stuff.
  • Loading branch information
BatmanAMA committed Mar 8, 2019
1 parent 0f7871a commit c5342f9
Show file tree
Hide file tree
Showing 7 changed files with 1,330 additions and 8 deletions.
10 changes: 8 additions & 2 deletions module/Private/CreateCommands.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Function createcommands {
Name = 'New'
OutFile = '..\public\New-nbx.ps1'
InFile = 'New.txt'
},
[PSCustomObject]@{
Name = 'Remove'
OutFile = '..\public\Remove-nbx.ps1'
InFile = 'Remove.txt'
}
)
)
Expand All @@ -32,8 +37,8 @@ Function createcommands {
foreach ($command in $commands) {
$ScriptPath = Join-Path -Path $cwd -ChildPath $command.Outfile -Resolve
("#" * 80 + "`n" +
"## AUTO GENERATED FILE" + "#" * 57 + "`n" +
"## Regenerate using CreateCommands.ps1 from private functions" + "#" * 17 + "`n" +
"## AUTO GENERATED FILE".PadRight(79,' ') + "#`n" +
"## Regenerate using CreateCommands.ps1 from private functions".PadRight(79,' ') + "#`n" +
"#" * 80 + "`n") | Out-File -FilePath $ScriptPath -Encoding default -Force
foreach ($key in $ResourceMap.Keys) {
$defPath = (Join-Path -Path $cwd -ChildPath $command.InFile)
Expand All @@ -46,3 +51,4 @@ Function createcommands {
end {
}
}
createcommands
22 changes: 22 additions & 0 deletions module/Private/Remove.txt
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
}
4 changes: 2 additions & 2 deletions module/Public/Get-nbx.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################
## AUTO GENERATED FILE#########################################################
## Regenerate using CreateCommands.ps1 from private functions#################
## AUTO GENERATED FILE #
## Regenerate using CreateCommands.ps1 from private functions #
################################################################################

<#
Expand Down
4 changes: 2 additions & 2 deletions module/Public/New-nbx.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
################################################################################
## AUTO GENERATED FILE#########################################################
## Regenerate using CreateCommands.ps1 from private functions#################
## AUTO GENERATED FILE #
## Regenerate using CreateCommands.ps1 from private functions #
################################################################################

<#
Expand Down
Loading

0 comments on commit c5342f9

Please sign in to comment.