diff --git a/NetboxPS/NetboxPS.psd1 b/NetboxPS/NetboxPS.psd1 index 3cb6799..b0db719 100644 --- a/NetboxPS/NetboxPS.psd1 +++ b/NetboxPS/NetboxPS.psd1 @@ -3,7 +3,7 @@ # # Generated by: Ben Claussen # -# Generated on: 2021-07-23 +# Generated on: 2022-12-06 # @{ @@ -12,7 +12,7 @@ RootModule = 'NetboxPS.psm1' # Version number of this module. -ModuleVersion = '1.5.0' +ModuleVersion = '1.5.5' # Supported PSEditions # CompatiblePSEditions = @() @@ -54,7 +54,7 @@ CLRVersion = '2.0.50727' # RequiredModules = @() # Assemblies that must be loaded prior to importing this module -RequiredAssemblies = 'System.Web' +# RequiredAssemblies = @() # Script files (.ps1) that are run in the caller's environment prior to importing this module. # ScriptsToProcess = @() @@ -69,7 +69,40 @@ RequiredAssemblies = 'System.Web' NestedModules = @() # Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export. -FunctionsToExport = '*' +FunctionsToExport = 'Add-NetboxDCIMInterface', 'Add-NetboxDCIMInterfaceConnection', + 'Add-NetboxVirtualMachineInterface', 'BuildNewURI', + 'BuildURIComponents', 'CheckNetboxIsConnected', + 'Clear-NetboxCredential', 'Connect-NetboxAPI', 'CreateEnum', + 'Get-ModelDefinition', 'Get-NetboxAPIDefinition', + 'GetNetboxAPIErrorBody', 'Get-NetboxCircuit', + 'Get-NetboxCircuitProvider', 'Get-NetboxCircuitTermination', + 'Get-NetboxCircuitType', 'GetNetboxConfigVariable', + 'Get-NetboxCredential', 'Get-NetboxDCIMDevice', + 'Get-NetboxDCIMDeviceRole', 'Get-NetboxDCIMDeviceType', + 'Get-NetboxDCIMInterface', 'Get-NetboxDCIMInterfaceConnection', + 'Get-NetboxDCIMPlatform', 'Get-NetboxDCIMSite', 'Get-NetboxHostname', + 'Get-NetboxHostPort', 'Get-NetboxHostScheme', + 'Get-NetboxInvokeParams', 'Get-NetboxIPAMAddress', + 'Get-NetboxIPAMAggregate', 'Get-NetboxIPAMAvailableIP', + 'Get-NetboxIPAMPrefix', 'Get-NetboxIPAMRole', 'Get-NetboxIPAMVLAN', + 'Get-NetboxTenant', 'Get-NetboxTimeout', 'Get-NetboxVersion', + 'Get-NetboxVirtualizationCluster', + 'Get-NetboxVirtualizationClusterGroup', 'Get-NetboxVirtualMachine', + 'Get-NetboxVirtualMachineInterface', 'InvokeNetboxRequest', + 'New-NetboxCircuit', 'New-NetboxDCIMDevice', 'New-NetboxDCIMSite', + 'New-NetboxIPAMAddress', 'New-NetboxIPAMPrefix', 'New-NetboxIPAMVLAN', + 'New-NetboxVirtualMachine', 'Remove-NetboxDCIMDevice', + 'Remove-NetboxDCIMInterface', + 'Remove-NetboxDCIMInterfaceConnection', 'Remove-NetboxDCIMSite', + 'Remove-NetboxIPAMAddress', 'Remove-NetboxVirtualMachine', + 'Set-NetboxCipherSSL', 'Set-NetboxCredential', 'Set-NetboxDCIMDevice', + 'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection', + 'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme', + 'Set-NetboxInvokeParams', 'Set-NetboxIPAMAddress', + 'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout', + 'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine', + 'Set-NetboxVirtualMachineInterface', 'SetupNetboxConfigVariable', + 'VerifyAPIConnectivity' # Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export. CmdletsToExport = '*' diff --git a/NetboxPS/NetboxPS.psm1 b/NetboxPS/NetboxPS.psm1 index 7505c90..db99c47 100644 --- a/NetboxPS/NetboxPS.psm1 +++ b/NetboxPS/NetboxPS.psm1 @@ -2,19 +2,6 @@ #region File Add-NetboxDCIMInterface.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:10 - Created by: Claussen - Organization: NEOnet - Filename: Add-NetboxDCIMInterface.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Add-NetboxDCIMInterface { [CmdletBinding()] @@ -91,19 +78,6 @@ function Add-NetboxDCIMInterface { #region File Add-NetboxDCIMInterfaceConnection.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:10 - Created by: Claussen - Organization: NEOnet - Filename: Add-NetboxDCIMInterfaceConnection.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Add-NetboxDCIMInterfaceConnection { <# @@ -163,19 +137,6 @@ function Add-NetboxDCIMInterfaceConnection { #region File Add-NetboxVirtualMachineInterface.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 12:46 - Created by: Claussen - Organization: NEOnet - Filename: Add-NetboxVirtualMachineInterface.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Add-NetboxVirtualMachineInterface { [CmdletBinding()] @@ -213,19 +174,6 @@ function Add-NetboxVirtualMachineInterface { #region File BuildNewURI.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/26/2020 14:22 - Created by: Claussen - Organization: NEOnet - Filename: BuildNewURI.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function BuildNewURI { <# @@ -311,19 +259,6 @@ function BuildNewURI { #region File BuildURIComponents.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/26/2020 14:23 - Created by: Claussen - Organization: NEOnet - Filename: BuildURIComponents.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function BuildURIComponents { [CmdletBinding()] @@ -404,19 +339,6 @@ function BuildURIComponents { #region File CheckNetboxIsConnected.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/26/2020 14:22 - Created by: Claussen - Organization: NEOnet - Filename: CheckNetboxIsConnected.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function CheckNetboxIsConnected { [CmdletBinding()] @@ -535,6 +457,8 @@ function Connect-NetboxAPI { #for PowerShell (<=) 5 (Desktop), Enable TLS 1.1, 1.2 and Disable SSL chain trust if ("Desktop" -eq $PSVersionTable.PsEdition) { + #Add System.web (Need for ParseQueryString) + Add-Type -AssemblyName System.Web #Enable TLS 1.1 and 1.2 Set-NetboxCipherSSL if ($SkipCertificateCheck) { @@ -612,19 +536,6 @@ function Connect-NetboxAPI { #region File CreateEnum.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/26/2020 14:25 - Created by: Claussen - Organization: NEOnet - Filename: CreateEnum.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function CreateEnum { [CmdletBinding()] @@ -658,20 +569,6 @@ public enum $EnumName #region File Get-ModelDefinition.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181 - Created on: 2020-11-04 14:23 - Created by: Claussen - Organization: NEOnet - Filename: Get-ModelDefinition.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - function Get-ModelDefinition { [CmdletBinding(DefaultParameterSetName = 'ByName')] @@ -727,20 +624,6 @@ function Get-ModelDefinition { #region File Get-NetboxAPIDefinition.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.174 - Created on: 4/28/2020 11:57 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxAPIDefinition.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - function Get-NetboxAPIDefinition { [CmdletBinding()] @@ -761,19 +644,6 @@ function Get-NetboxAPIDefinition { #region File GetNetboxAPIErrorBody.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/26/2020 14:23 - Created by: Claussen - Organization: NEOnet - Filename: GetNetboxAPIErrorBody.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function GetNetboxAPIErrorBody { param @@ -795,19 +665,6 @@ function GetNetboxAPIErrorBody { #region File Get-NetboxCircuit.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:15 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxCircuit.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxCircuit { <# @@ -933,20 +790,6 @@ function Get-NetboxCircuit { #region File Get-NetboxCircuitProvider.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181 - Created on: 2020-11-04 12:06 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxCircuitProvider.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - function Get-NetboxCircuitProvider { [CmdletBinding(DefaultParameterSetName = 'Query')] @@ -1010,20 +853,6 @@ function Get-NetboxCircuitProvider { #region File Get-NetboxCircuitTermination.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181 - Created on: 2020-11-04 10:22 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxCircuitTermination.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - function Get-NetboxCircuitTermination { [CmdletBinding(DefaultParameterSetName = 'Query')] @@ -1094,20 +923,6 @@ function Get-NetboxCircuitTermination { #region File Get-NetboxCircuitType.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181 - Created on: 2020-11-04 12:34 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxCircuitType.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - function Get-NetboxCircuitType { [CmdletBinding(DefaultParameterSetName = 'Query')] @@ -1187,19 +1002,6 @@ function Get-NetboxCredential { #region File Get-NetboxDCIMDevice.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:06 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxDCIMDevice.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxDCIMDevice { [CmdletBinding()] @@ -1293,19 +1095,6 @@ function Get-NetboxDCIMDevice { #region File Get-NetboxDCIMDeviceRole.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:07 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxDCIMDeviceRole.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxDCIMDeviceRole { [CmdletBinding()] @@ -1360,19 +1149,6 @@ function Get-NetboxDCIMDeviceRole { #region File Get-NetboxDCIMDeviceType.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:07 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxDCIMDeviceType.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxDCIMDeviceType { [CmdletBinding()] @@ -1426,19 +1202,6 @@ function Get-NetboxDCIMDeviceType { #region File Get-NetboxDCIMInterface.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:09 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxDCIMInterface.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxDCIMInterface { [CmdletBinding()] @@ -1494,19 +1257,6 @@ function Get-NetboxDCIMInterface { #region File Get-NetboxDCIMInterfaceConnection.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:10 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxDCIMInterfaceConnection.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxDCIMInterfaceConnection { [CmdletBinding()] @@ -1545,19 +1295,6 @@ function Get-NetboxDCIMInterfaceConnection { #region File Get-NetboxDCIMPlatform.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:13 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxDCIMPlatform.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxDCIMPlatform { [CmdletBinding()] @@ -1613,23 +1350,9 @@ function Get-NetboxDCIMPlatform { #region File Get-NetboxDCIMSite.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181 - Created on: 2020-10-02 15:52 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxDCIMSite.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - function Get-NetboxDCIMSite { - [CmdletBinding()] + [CmdletBinding(DefaultParameterSetName = 'Query')] [OutputType([pscustomobject])] param ( @@ -1723,7 +1446,6 @@ function Get-NetboxDCIMSite { } } - #endregion #region File Get-NetboxHostname.ps1 @@ -1810,7 +1532,7 @@ function Get-NetboxIPAMAddress { [object]$Family, [Parameter(ParameterSetName = 'Query')] - [uint32]$Parent, + [string]$Parent, [Parameter(ParameterSetName = 'Query')] [byte]$Mask_Length, @@ -1890,19 +1612,6 @@ function Get-NetboxIPAMAddress { #region File Get-NetboxIPAMAggregate.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 11:49 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxIPAMAggregate.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxIPAMAggregate { [CmdletBinding(DefaultParameterSetName = 'Query')] @@ -1974,19 +1683,6 @@ function Get-NetboxIPAMAggregate { #region File Get-NetboxIPAMAvailableIP.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 11:50 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxIPAMAvailableIP.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxIPAMAvailableIP { <# @@ -2052,19 +1748,6 @@ function Get-NetboxIPAMAvailableIP { #region File Get-NetboxIPAMPrefix.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 11:51 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxIPAMPrefix.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxIPAMPrefix { <# @@ -2363,19 +2046,6 @@ function Get-NetboxIPAMRole { #region File Get-NetboxIPAMVLAN.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/16/2020 16:34 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxIPAMVLAN.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxIPAMVLAN { [CmdletBinding()] @@ -2481,19 +2151,6 @@ function Get-NetboxIPAMVLAN { #region File Get-NetboxTenant.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 11:56 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxTenant.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxTenant { <# @@ -2645,19 +2302,6 @@ function Get-NetboxVersion { #region File Get-NetboxVirtualizationCluster.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 14:10 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxVirtualizationCluster.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxVirtualizationCluster { <# @@ -2752,19 +2396,6 @@ function Get-NetboxVirtualizationCluster { #region File Get-NetboxVirtualizationClusterGroup.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 14:11 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxVirtualizationClusterGroup.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxVirtualizationClusterGroup { [CmdletBinding()] @@ -2800,19 +2431,6 @@ function Get-NetboxVirtualizationClusterGroup { #region File Get-NetboxVirtualMachine.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 12:44 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxVirtualMachine.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxVirtualMachine { <# @@ -2962,19 +2580,6 @@ function Get-NetboxVirtualMachine { #region File Get-NetboxVirtualMachineInterface.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 12:47 - Created by: Claussen - Organization: NEOnet - Filename: Get-NetboxVirtualMachineInterface.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Get-NetboxVirtualMachineInterface { <# @@ -3063,19 +2668,6 @@ function Get-NetboxVirtualMachineInterface { #region File InvokeNetboxRequest.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/26/2020 14:24 - Created by: Claussen - Organization: NEOnet - Filename: InvokeNetboxRequest.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function InvokeNetboxRequest { [CmdletBinding()] @@ -3175,20 +2767,6 @@ function InvokeNetboxRequest { #region File New-NetboxCircuit.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181 - Created on: 2020-11-04 11:48 - Created by: Claussen - Organization: NEOnet - Filename: New-NetboxCircuit.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - function New-NetboxCircuit { [CmdletBinding(ConfirmImpact = 'Low', @@ -3249,19 +2827,6 @@ function New-NetboxCircuit { #region File New-NetboxDCIMDevice.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:08 - Created by: Claussen - Organization: NEOnet - Filename: New-NetboxDCIMDevice.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function New-NetboxDCIMDevice { [CmdletBinding(ConfirmImpact = 'low', @@ -3345,22 +2910,100 @@ function New-NetboxDCIMDevice { #endregion -#region File New-NetboxIPAMAddress.ps1 +#region File New-NetboxDCIMSite.ps1 <# .NOTES =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 11:51 + Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181 + Created on: 2020-10-02 15:52 Created by: Claussen Organization: NEOnet - Filename: New-NetboxIPAMAddress.ps1 + Filename: New-NetboxDCIMSite.ps1 =========================================================================== .DESCRIPTION A description of the file. #> + +function New-NetboxDCIMSite { + <# + .SYNOPSIS + Create a new Site to Netbox + + .DESCRIPTION + Create a new Site to Netbox + + .EXAMPLE + New-NetboxDCIMSite -name MySite + + Add new Site MySite on Netbox + + #> + + [CmdletBinding(ConfirmImpact = 'Low', + SupportsShouldProcess = $true)] + [OutputType([pscustomobject])] + param + ( + [Parameter(Mandatory = $true)] + [string]$Name, + + [string]$Slug, + + [string]$Facility, + + [uint32]$ASN, + + [decimal]$Latitude, + + [decimal]$Longitude, + + [string]$Contact_Name, + + [string]$Contact_Phone, + + [string]$Contact_Email, + + [int]$Tenant_Group, + + [int]$Tenant, + + [string]$Status, + + [uint32]$Region, + + [string]$Description, + + [string]$Comments, + + [switch]$Raw + ) + + process { + $Segments = [System.Collections.ArrayList]::new(@('dcim', 'sites')) + $Method = 'POST' + + if (-not $PSBoundParameters.ContainsKey('slug')) { + $PSBoundParameters.Add('slug', $name) + } + + $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters + + $URI = BuildNewURI -Segments $URIComponents.Segments + + if ($PSCmdlet.ShouldProcess($name, 'Create new Site')) { + InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw + } + } +} + +#endregion + +#region File New-NetboxIPAMAddress.ps1 + + function New-NetboxIPAMAddress { <# .SYNOPSIS @@ -3475,19 +3118,6 @@ function New-NetboxIPAMAddress { #region File New-NetboxIPAMPrefix.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 11:52 - Created by: Claussen - Organization: NEOnet - Filename: New-NetboxIPAMPrefix.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function New-NetboxIPAMPrefix { [CmdletBinding(ConfirmImpact = 'low', @@ -3630,19 +3260,6 @@ function New-NetboxIPAMVLAN { #region File New-NetboxVirtualMachine.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 12:44 - Created by: Claussen - Organization: NEOnet - Filename: New-NetboxVirtualMachine.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function New-NetboxVirtualMachine { [CmdletBinding(ConfirmImpact = 'low', @@ -3654,6 +3271,8 @@ function New-NetboxVirtualMachine { [string]$Name, [Parameter(Mandatory = $true)] + [uint16]$Site, + [uint16]$Cluster, [uint16]$Tenant, @@ -3688,6 +3307,10 @@ function New-NetboxVirtualMachine { #$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus + if ($PSBoundParameters.ContainsKey('Cluster') -and (-not $PSBoundParameters.ContainsKey('Site'))) { + throw "You must specify a site ID with a cluster ID" + } + $Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines')) $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters @@ -3707,19 +3330,6 @@ function New-NetboxVirtualMachine { #region File Remove-NetboxDCIMDevice.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:08 - Created by: Claussen - Organization: NEOnet - Filename: Remove-NetboxDCIMDevice.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Remove-NetboxDCIMDevice { <# @@ -3780,19 +3390,6 @@ function Remove-NetboxDCIMDevice { #region File Remove-NetboxDCIMInterface.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:11 - Created by: Claussen - Organization: NEOnet - Filename: Remove-NetboxDCIMInterface.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Remove-NetboxDCIMInterface { <# @@ -3853,19 +3450,6 @@ function Remove-NetboxDCIMInterface { #region File Remove-NetboxDCIMInterfaceConnection.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:12 - Created by: Claussen - Organization: NEOnet - Filename: Remove-NetboxDCIMInterfaceConnection.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Remove-NetboxDCIMInterfaceConnection { [CmdletBinding(ConfirmImpact = 'High', @@ -3907,21 +3491,78 @@ function Remove-NetboxDCIMInterfaceConnection { #endregion -#region File Remove-NetboxIPAMAddress.ps1 +#region File Remove-NetboxDCIMSite.ps1 <# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 11:52 - Created by: Claussen - Organization: NEOnet - Filename: Remove-NetboxIPAMAddress.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. + .NOTES + =========================================================================== + Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181 + Created on: 2020-10-02 15:52 + Created by: Claussen + Organization: NEOnet + Filename: New-NetboxDCIMSite.ps1 + =========================================================================== + .DESCRIPTION + A description of the file. #> + +function Remove-NetboxDCIMSite { + <# + .SYNOPSIS + Remove a Site + + .DESCRIPTION + Remove a DCIM Site from Netbox + + .EXAMPLE + Remove-NetboxDCIMSite -Id 1 + + Remove DCM Site with id 1 + + .EXAMPLE + Get-NetboxDCIMSite -name My Site | Remove-NetboxDCIMSite -confirm:$false + + Remove DCM Site with name My Site without confirmation + + #> + + [CmdletBinding(ConfirmImpact = 'High', + SupportsShouldProcess = $true)] + param + ( + [Parameter(Mandatory = $true, + ValueFromPipelineByPropertyName = $true)] + [uint]$Id + + ) + + begin { + + } + + process { + $CurrentSite = Get-NetboxDCIMSite -Id $Id -ErrorAction Stop + + if ($pscmdlet.ShouldProcess("$($CurrentSite.Name)/$($CurrentSite.Id)", "Remove Site")) { + $Segments = [System.Collections.ArrayList]::new(@('dcim', 'sites', $CurrentSite.Id)) + + $URI = BuildNewURI -Segments $Segments + + InvokeNetboxRequest -URI $URI -Method DELETE + } + } + + end { + + } +} + +#endregion + +#region File Remove-NetboxIPAMAddress.ps1 + + function Remove-NetboxIPAMAddress { <# .SYNOPSIS @@ -3973,19 +3614,6 @@ function Remove-NetboxIPAMAddress { #region File Remove-NetboxVirtualMachine.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 12:45 - Created by: Claussen - Organization: NEOnet - Filename: Remove-NetboxVirtualMachine.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Remove-NetboxVirtualMachine { <# @@ -4096,19 +3724,6 @@ function Set-NetboxCredential { #region File Set-NetboxDCIMDevice.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:08 - Created by: Claussen - Organization: NEOnet - Filename: Set-NetboxDCIMDevice.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Set-NetboxDCIMDevice { [CmdletBinding(SupportsShouldProcess = $true)] @@ -4196,19 +3811,6 @@ function Set-NetboxDCIMDevice { #region File Set-NetboxDCIMInterface.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:11 - Created by: Claussen - Organization: NEOnet - Filename: Set-NetboxDCIMInterface.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Set-NetboxDCIMInterface { [CmdletBinding(ConfirmImpact = 'Medium', @@ -4302,19 +3904,6 @@ function Set-NetboxDCIMInterface { #region File Set-NetboxDCIMInterfaceConnection.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/23/2020 12:11 - Created by: Claussen - Organization: NEOnet - Filename: Set-NetboxDCIMInterfaceConnection.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Set-NetboxDCIMInterfaceConnection { <# @@ -4483,19 +4072,6 @@ function Set-NetboxInvokeParams { #region File Set-NetboxIPAMAddress.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 11:53 - Created by: Claussen - Organization: NEOnet - Filename: Set-NetboxIPAMAddress.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Set-NetboxIPAMAddress { [CmdletBinding(ConfirmImpact = 'Medium', @@ -4584,19 +4160,6 @@ function Set-NetboxIPAMAddress { #region File Set-NetboxIPAMPrefix.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2021 v5.8.186 - Created on: 2021-03-23 13:54 - Created by: Claussen - Organization: NEOnet - Filename: Set-NetboxIPAMPrefix.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Set-NetboxIPAMPrefix { [CmdletBinding(ConfirmImpact = 'Medium', @@ -4727,19 +4290,6 @@ Function Set-NetboxUntrustedSSL { #region File Set-NetboxVirtualMachine.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 12:45 - Created by: Claussen - Organization: NEOnet - Filename: Set-NetboxVirtualMachine.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Set-NetboxVirtualMachine { [CmdletBinding(ConfirmImpact = 'Medium', @@ -4806,19 +4356,6 @@ function Set-NetboxVirtualMachine { #region File Set-NetboxVirtualMachineInterface.ps1 -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/19/2020 12:47 - Created by: Claussen - Organization: NEOnet - Filename: Set-NetboxVirtualMachineInterface.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - function Set-NetboxVirtualMachineInterface { [CmdletBinding(ConfirmImpact = 'Medium', @@ -4899,35 +4436,6 @@ function SetupNetboxConfigVariable { #endregion -#region File ThrowNetboxRESTError.ps1 - -<# - .NOTES - =========================================================================== - Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Created on: 3/26/2020 14:25 - Created by: Claussen - Organization: NEOnet - Filename: ThrowNetboxRESTError.ps1 - =========================================================================== - .DESCRIPTION - A description of the file. -#> - - -function ThrowNetboxRESTError { - $uriSegments = [System.Collections.ArrayList]::new(@('fake', 'url')) - - $URIParameters = @{ - } - - $uri = BuildNewURI -Segments $uriSegments -Parameters $URIParameters - - InvokeNetboxRequest -URI $uri -Raw -} - -#endregion - #region File VerifyAPIConnectivity.ps1 function VerifyAPIConnectivity { @@ -4943,17 +4451,6 @@ function VerifyAPIConnectivity { #endregion -<# - .NOTES - -------------------------------------------------------------------------------- - Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172 - Generated on: 3/26/2020 15:16 - Generated by: Claussen - Organization: NEOnet - -------------------------------------------------------------------------------- - .DESCRIPTION - Script generated by PowerShell Studio 2020 -#> # Build a list of common parameters so we can omit them to build URI parameters $script:CommonParameterNames = New-Object System.Collections.ArrayList @@ -4962,6 +4459,3 @@ $script:CommonParameterNames = New-Object System.Collections.ArrayList [void]$script:CommonParameterNames.Add('Raw') SetupNetboxConfigVariable - -Export-ModuleMember -Function * -#Export-ModuleMember -Function *-*