classlib all types implemented
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
namespace PS.IPAM;
|
namespace PS.IPAM;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
public class Address {
|
public class Address {
|
||||||
public int Id { get; }
|
public int Id { get; }
|
||||||
public int SubnetId { get; }
|
public int SubnetId { get; }
|
||||||
@@ -13,11 +14,11 @@ public class Address {
|
|||||||
public int TagId { get; }
|
public int TagId { get; }
|
||||||
public int DeviceId { get; }
|
public int DeviceId { get; }
|
||||||
public string Location { get; }
|
public string Location { get; }
|
||||||
public int Port { get; }
|
public string Port { get; }
|
||||||
public string Note { get; }
|
public string Note { get; }
|
||||||
public DateTime? LastSeen { get; }
|
public DateTime? LastSeen { get; }
|
||||||
public bool ExcludePing { get; }
|
public bool ExcludePing { get; }
|
||||||
public int PTRignore { get; }
|
public bool PTRignore { get; }
|
||||||
public int PTR { get; }
|
public int PTR { get; }
|
||||||
public string FirewallAddressObject { get; }
|
public string FirewallAddressObject { get; }
|
||||||
public DateTime? EditDate { get; }
|
public DateTime? EditDate { get; }
|
||||||
@@ -35,11 +36,11 @@ public class Address {
|
|||||||
int tag,
|
int tag,
|
||||||
int deviceId,
|
int deviceId,
|
||||||
string location,
|
string location,
|
||||||
int port,
|
string port,
|
||||||
string note,
|
string note,
|
||||||
DateTime? lastSeen,
|
DateTime? lastSeen,
|
||||||
bool excludePing,
|
bool excludePing,
|
||||||
int PTRignore,
|
bool PTRignore,
|
||||||
int PTR,
|
int PTR,
|
||||||
string firewallAddressObject,
|
string firewallAddressObject,
|
||||||
DateTime? editDate,
|
DateTime? editDate,
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net7.0</TargetFramework>
|
<TargetFramework>netstandard2.1</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
27
classlib/domain.cs
Normal file
27
classlib/domain.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
namespace PS.IPAM;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Domain {
|
||||||
|
public int Id { get; }
|
||||||
|
public string Name { get; }
|
||||||
|
public string Description { get; }
|
||||||
|
public string Sections { get; }
|
||||||
|
|
||||||
|
public Domain (
|
||||||
|
int id,
|
||||||
|
string name,
|
||||||
|
string description,
|
||||||
|
string sections
|
||||||
|
) {
|
||||||
|
this.Id = id;
|
||||||
|
this.Name = name;
|
||||||
|
this.Description = description;
|
||||||
|
this.Sections = sections;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return this.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace PS.IPAM;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
enum Parameters {
|
|
||||||
IsGateway = "is_gateway";
|
|
||||||
}
|
|
||||||
54
classlib/section.cs
Normal file
54
classlib/section.cs
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
namespace PS.IPAM;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Section {
|
||||||
|
public int Id { get; }
|
||||||
|
public string Name { get; }
|
||||||
|
public string Description { get; }
|
||||||
|
public int MasterSectionId { get; }
|
||||||
|
public string Permissions { get; }
|
||||||
|
public bool StrictMode { get; }
|
||||||
|
public string SubnetOrdering { get; }
|
||||||
|
public int Order { get; }
|
||||||
|
public DateTime? EditDate { get; }
|
||||||
|
public bool ShowVlan { get; }
|
||||||
|
public bool ShowVRF { get; }
|
||||||
|
public bool ShowSupernetOnly { get; }
|
||||||
|
public int DNSId { get; }
|
||||||
|
|
||||||
|
public Section (
|
||||||
|
int id,
|
||||||
|
string name,
|
||||||
|
string description,
|
||||||
|
int masterSectionId,
|
||||||
|
string permissions,
|
||||||
|
bool strictMode,
|
||||||
|
string subnetOrdering,
|
||||||
|
int order,
|
||||||
|
DateTime? editDate,
|
||||||
|
bool showVlan,
|
||||||
|
bool showVRF,
|
||||||
|
bool showSupernetOnly,
|
||||||
|
int dnsId
|
||||||
|
) {
|
||||||
|
this.Id = id;
|
||||||
|
this.Name = name;
|
||||||
|
this.Description = description;
|
||||||
|
this.MasterSectionId = masterSectionId;
|
||||||
|
this.Permissions = permissions;
|
||||||
|
this.StrictMode = strictMode;
|
||||||
|
this.SubnetOrdering = subnetOrdering;
|
||||||
|
this.Order = order;
|
||||||
|
this.EditDate = editDate;
|
||||||
|
this.ShowVlan = showVlan;
|
||||||
|
this.ShowVRF = showVRF;
|
||||||
|
this.ShowSupernetOnly = showSupernetOnly;
|
||||||
|
this.DNSId = dnsId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return this.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
namespace PS.IPAM;
|
namespace PS.IPAM;
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
public class Subnetwork {
|
public class Subnetwork {
|
||||||
public int Id { get; }
|
public int Id { get; }
|
||||||
public string Subnet { get; }
|
public string Subnet { get; }
|
||||||
@@ -55,41 +56,12 @@ public class Subnetwork {
|
|||||||
this.ResolveDNS = resolveDNS;
|
this.ResolveDNS = resolveDNS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public string GetCIDR() {
|
||||||
{
|
|
||||||
return $"{this.Subnet}/{this.Mask}";
|
return $"{this.Subnet}/{this.Mask}";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
id : 1
|
public override string ToString()
|
||||||
subnet : fd13:6d20:29dc:cf27::
|
{
|
||||||
mask : 64
|
return this.GetCIDR();
|
||||||
sectionId : 2
|
}
|
||||||
description : Private subnet 1
|
}
|
||||||
linked_subnet :
|
|
||||||
firewallAddressObject :
|
|
||||||
vrfId : 0
|
|
||||||
masterSubnetId : 0
|
|
||||||
allowRequests : 1
|
|
||||||
vlanId : 1
|
|
||||||
showName : 1
|
|
||||||
device : 0
|
|
||||||
permissions : {"3":"1","2":"2"}
|
|
||||||
pingSubnet : 0
|
|
||||||
discoverSubnet : 0
|
|
||||||
resolveDNS : 0
|
|
||||||
DNSrecursive : 0
|
|
||||||
DNSrecords : 0
|
|
||||||
nameserverId : 0
|
|
||||||
scanAgent :
|
|
||||||
customer_id :
|
|
||||||
isFolder : 0
|
|
||||||
isFull : 0
|
|
||||||
isPool : 0
|
|
||||||
tag : 2
|
|
||||||
threshold : 0
|
|
||||||
location :
|
|
||||||
editDate :
|
|
||||||
lastScan :
|
|
||||||
lastDiscovery :
|
|
||||||
calculation : @{Type=IPv6; Host address=/; Host address (uncompressed)=/; Subnet prefix=fd13:6d20:29dc:cf27::/64; Prefix length=64; Subnet Reverse DNS=7.2.f.c.c.d.9.2.0.2.d.6.3.1.d.f.ip6.arpa; Min host IP=fd13:6d20:29dc:cf27::; Max host IP=fd13:6d20:29dc:cf27:ffff:ffff:ffff:ffff; Number of hosts=18446744073709551616; Address type=NET_IPV6}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
namespace PS.IPAM;
|
namespace PS.IPAM;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
public class Tag {
|
public class Tag {
|
||||||
public int Id { get; }
|
public int Id { get; }
|
||||||
public string Type { get; }
|
public string Type { get; }
|
||||||
|
|||||||
32
classlib/vlan.cs
Normal file
32
classlib/vlan.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
namespace PS.IPAM;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Vlan {
|
||||||
|
public int Id { get; }
|
||||||
|
public int DomainId { get; }
|
||||||
|
public string Name { get; }
|
||||||
|
public int Number { get; }
|
||||||
|
public string Description { get; }
|
||||||
|
public DateTime? EditDate { get; }
|
||||||
|
public Vlan (
|
||||||
|
int id,
|
||||||
|
int domainId,
|
||||||
|
string name,
|
||||||
|
int number,
|
||||||
|
string description,
|
||||||
|
DateTime? editDate
|
||||||
|
) {
|
||||||
|
this.Id = id;
|
||||||
|
this.DomainId = domainId;
|
||||||
|
this.Name = name;
|
||||||
|
this.Number = number;
|
||||||
|
this.Description = description;
|
||||||
|
this.EditDate = editDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"{this.Number}";
|
||||||
|
}
|
||||||
|
}
|
||||||
32
classlib/vrf.cs
Normal file
32
classlib/vrf.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
namespace PS.IPAM;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class Vrf {
|
||||||
|
public int Id { get; }
|
||||||
|
public string Name { get; }
|
||||||
|
public string RouteDistinguisher { get; }
|
||||||
|
public string Description { get; }
|
||||||
|
public string Sections { get; }
|
||||||
|
public DateTime? EditDate { get; }
|
||||||
|
|
||||||
|
public Vrf(
|
||||||
|
int id,
|
||||||
|
string name,
|
||||||
|
string rd,
|
||||||
|
string description,
|
||||||
|
string sections,
|
||||||
|
DateTime? editDate
|
||||||
|
) {
|
||||||
|
this.Id = id;
|
||||||
|
this.Name = name;
|
||||||
|
this.RouteDistinguisher = rd;
|
||||||
|
this.Description = description;
|
||||||
|
this.Sections = sections;
|
||||||
|
this.EditDate = editDate;
|
||||||
|
}
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return this.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ function New-Session {
|
|||||||
param (
|
param (
|
||||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
|
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
|
[validatescript({$_.startswith("http")})]
|
||||||
[string]$URL,
|
[string]$URL,
|
||||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=1)]
|
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=1)]
|
||||||
[ValidateNotNullOrEmpty()]
|
[ValidateNotNullOrEmpty()]
|
||||||
|
|||||||
@@ -1,75 +0,0 @@
|
|||||||
Add-Type @'
|
|
||||||
using System;
|
|
||||||
namespace ps.ipam {
|
|
||||||
public class address {
|
|
||||||
public int Id { get; set; }
|
|
||||||
public int SubnetId { get; set; }
|
|
||||||
public string Ip { get; set; }
|
|
||||||
public bool IsGateway { get; set; }
|
|
||||||
public string Description { get; set; }
|
|
||||||
public string Hostname { get; set; }
|
|
||||||
public string MAC { get; set; }
|
|
||||||
public string Owner { get; set; }
|
|
||||||
public int TagId { get; set; }
|
|
||||||
public int DeviceId { get; set; }
|
|
||||||
public string Location { get; set; }
|
|
||||||
public int Port { get; set; }
|
|
||||||
public string Note { get; set; }
|
|
||||||
public DateTime? LastSeen { get; set; }
|
|
||||||
public bool ExcludePing { get; set; }
|
|
||||||
public int PTRignore { get; set; }
|
|
||||||
public int PTR { get; set; }
|
|
||||||
public string FirewallAddressObject { get; set; }
|
|
||||||
public DateTime? EditDate { get; set; }
|
|
||||||
public int CustomerId { get; set; }
|
|
||||||
|
|
||||||
public address(
|
|
||||||
int id,
|
|
||||||
int subnetId,
|
|
||||||
string ip,
|
|
||||||
bool is_gateway,
|
|
||||||
string description,
|
|
||||||
string hostname,
|
|
||||||
string mac,
|
|
||||||
string owner,
|
|
||||||
int tag,
|
|
||||||
int deviceId,
|
|
||||||
string location,
|
|
||||||
int port,
|
|
||||||
string note,
|
|
||||||
DateTime? lastSeen,
|
|
||||||
bool excludePing,
|
|
||||||
int PTRignore,
|
|
||||||
int PTR,
|
|
||||||
string firewallAddressObject,
|
|
||||||
DateTime? editDate,
|
|
||||||
int customer_id
|
|
||||||
) {
|
|
||||||
this.Id = id;
|
|
||||||
this.SubnetId = subnetId;
|
|
||||||
this.Ip = ip;
|
|
||||||
this.IsGateway = is_gateway;
|
|
||||||
this.Description = description;
|
|
||||||
this.Hostname = hostname;
|
|
||||||
this.MAC = mac;
|
|
||||||
this.Owner = owner;
|
|
||||||
this.TagId = tag;
|
|
||||||
this.DeviceId = deviceId;
|
|
||||||
this.Location = location;
|
|
||||||
this.Port = port;
|
|
||||||
this.Note = note;
|
|
||||||
this.EditDate = lastSeen;
|
|
||||||
this.ExcludePing = excludePing;
|
|
||||||
this.PTRignore = PTRignore;
|
|
||||||
this.PTR = PTR;
|
|
||||||
this.FirewallAddressObject = firewallAddressObject;
|
|
||||||
this.EditDate = editDate;
|
|
||||||
this.CustomerId = customer_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToString() {
|
|
||||||
return this.Ip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'@
|
|
||||||
33
old/tag.ps1
33
old/tag.ps1
@@ -1,33 +0,0 @@
|
|||||||
class tag {
|
|
||||||
[int]$id
|
|
||||||
[string]$Type
|
|
||||||
[bool]$ShowTag
|
|
||||||
[System.Drawing.Color]$BGColor
|
|
||||||
[System.Drawing.Color]$FGColor
|
|
||||||
[bool]$Compress
|
|
||||||
[bool]$Locked
|
|
||||||
[bool]$UpdateTag
|
|
||||||
|
|
||||||
tag ([int]$id,[string]$type,[bool]$showTag,[string]$BGColor,[string]$FGColor,[string]$compress,[string]$locked,[bool]$updateTag) {
|
|
||||||
$this.id = $id
|
|
||||||
$this.Type = $type
|
|
||||||
$this.ShowTag = $showTag
|
|
||||||
$this.BGColor = $BGColor
|
|
||||||
$this.FGColor = $FGColor
|
|
||||||
$this.Compress = $this.ToBool($compress)
|
|
||||||
$this.Locked = $this.ToBool($locked)
|
|
||||||
$this.UpdateTag = $updateTag
|
|
||||||
}
|
|
||||||
|
|
||||||
[string] ToString() {
|
|
||||||
return $this.Type
|
|
||||||
}
|
|
||||||
|
|
||||||
hidden [bool]ToBool([string]$str) {
|
|
||||||
if ($str -eq "Yes") {
|
|
||||||
return $true
|
|
||||||
} else {
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
BIN
ps.ipam.psd1
BIN
ps.ipam.psd1
Binary file not shown.
@@ -48,4 +48,125 @@
|
|||||||
</MemberSet>
|
</MemberSet>
|
||||||
</Members>
|
</Members>
|
||||||
</Type>
|
</Type>
|
||||||
|
<Type>
|
||||||
|
<Name>ps.ipam.domain</Name>
|
||||||
|
<Members>
|
||||||
|
<MemberSet>
|
||||||
|
<Name>PSStandardMembers</Name>
|
||||||
|
<Members>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultDisplayPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
<Name>Name</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultKeyPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
</Members>
|
||||||
|
</MemberSet>
|
||||||
|
</Members>
|
||||||
|
</Type>
|
||||||
|
<Type>
|
||||||
|
<Name>ps.ipam.section</Name>
|
||||||
|
<Members>
|
||||||
|
<MemberSet>
|
||||||
|
<Name>PSStandardMembers</Name>
|
||||||
|
<Members>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultDisplayPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
<Name>Name</Name>
|
||||||
|
<Name>MasterSectionId</Name>
|
||||||
|
<Name>StrictMode</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultKeyPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
</Members>
|
||||||
|
</MemberSet>
|
||||||
|
</Members>
|
||||||
|
</Type>
|
||||||
|
<Type>
|
||||||
|
<Name>ps.ipam.vlan</Name>
|
||||||
|
<Members>
|
||||||
|
<MemberSet>
|
||||||
|
<Name>PSStandardMembers</Name>
|
||||||
|
<Members>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultDisplayPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
<Name>Name</Name>
|
||||||
|
<Name>DomainId</Name>
|
||||||
|
<Name>Number</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultKeyPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
</Members>
|
||||||
|
</MemberSet>
|
||||||
|
</Members>
|
||||||
|
</Type>
|
||||||
|
<Type>
|
||||||
|
<Name>ps.ipam.vrf</Name>
|
||||||
|
<Members>
|
||||||
|
<MemberSet>
|
||||||
|
<Name>PSStandardMembers</Name>
|
||||||
|
<Members>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultDisplayPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
<Name>Name</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultKeyPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
</Members>
|
||||||
|
</MemberSet>
|
||||||
|
</Members>
|
||||||
|
</Type>
|
||||||
|
<Type>
|
||||||
|
<Name>ps.ipam.subnet</Name>
|
||||||
|
<Members>
|
||||||
|
<MemberSet>
|
||||||
|
<Name>PSStandardMembers</Name>
|
||||||
|
<Members>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultDisplayPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
<Name>Name</Name>
|
||||||
|
<Name>DomainId</Name>
|
||||||
|
<Name>Number</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
<PropertySet>
|
||||||
|
<Name>DefaultKeyPropertySet</Name>
|
||||||
|
<ReferencedProperties>
|
||||||
|
<Name>Id</Name>
|
||||||
|
</ReferencedProperties>
|
||||||
|
</PropertySet>
|
||||||
|
</Members>
|
||||||
|
</MemberSet>
|
||||||
|
</Members>
|
||||||
|
</Type>
|
||||||
</Types>
|
</Types>
|
||||||
Reference in New Issue
Block a user