diff --git a/ProxmoxConnector.sln b/ProxmoxConnector.sln index 2aaf220..195a89e 100644 --- a/ProxmoxConnector.sln +++ b/ProxmoxConnector.sln @@ -22,13 +22,19 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FA6E3503-ADF EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "server", "server", "{2D975A5D-3612-4536-A501-248F6B9A5AC2}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Server", "src\server\ProxmoxConnector.Server\ProxmoxConnector.Server.csproj", "{340A176C-AE9F-4F01-A82F-AAAAF140A728}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxmoxConnector.Server", "src\server\ProxmoxConnector.Server\ProxmoxConnector.Server.csproj", "{340A176C-AE9F-4F01-A82F-AAAAF140A728}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Server.Application", "src\server\ProxmoxConnector.Server.Application\ProxmoxConnector.Server.Application.csproj", "{96718232-FFFA-4E3C-B068-53C679B60669}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxmoxConnector.Server.Application", "src\server\ProxmoxConnector.Server.Application\ProxmoxConnector.Server.Application.csproj", "{96718232-FFFA-4E3C-B068-53C679B60669}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Server.Domain", "src\server\ProxmoxConnector.Server.Domain\ProxmoxConnector.Server.Domain.csproj", "{57F68716-671A-476C-9F07-E0E86FDE6940}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxmoxConnector.Server.Domain", "src\server\ProxmoxConnector.Server.Domain\ProxmoxConnector.Server.Domain.csproj", "{57F68716-671A-476C-9F07-E0E86FDE6940}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Server.Domain.Data", "src\server\ProxmoxConnector.Server.Domain.Data\ProxmoxConnector.Server.Domain.Data.csproj", "{65C2410A-57CA-45A1-9E98-A12633A32A3E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ProxmoxConnector.Server.Domain.Data", "src\server\ProxmoxConnector.Server.Domain.Data\ProxmoxConnector.Server.Domain.Data.csproj", "{65C2410A-57CA-45A1-9E98-A12633A32A3E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "integration", "integration", "{9E74B673-1931-4E5F-8BEF-122B742A3261}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Integration.Corsinvest", "src\integration\ProxmoxConnector.Integration.Corsinvest\ProxmoxConnector.Integration.Corsinvest.csproj", "{A39B9288-3D3D-41FD-B18C-C5805E6A9CAC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProxmoxConnector.Integration.Abstractions", "src\integration\ProxmoxConnector.Integration.Abstractions\ProxmoxConnector.Integration.Abstractions.csproj", "{A5998190-6649-4C43-BB6A-226C2BF76E11}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -56,6 +62,14 @@ Global {65C2410A-57CA-45A1-9E98-A12633A32A3E}.Debug|Any CPU.Build.0 = Debug|Any CPU {65C2410A-57CA-45A1-9E98-A12633A32A3E}.Release|Any CPU.ActiveCfg = Release|Any CPU {65C2410A-57CA-45A1-9E98-A12633A32A3E}.Release|Any CPU.Build.0 = Release|Any CPU + {A39B9288-3D3D-41FD-B18C-C5805E6A9CAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A39B9288-3D3D-41FD-B18C-C5805E6A9CAC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A39B9288-3D3D-41FD-B18C-C5805E6A9CAC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A39B9288-3D3D-41FD-B18C-C5805E6A9CAC}.Release|Any CPU.Build.0 = Release|Any CPU + {A5998190-6649-4C43-BB6A-226C2BF76E11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5998190-6649-4C43-BB6A-226C2BF76E11}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5998190-6649-4C43-BB6A-226C2BF76E11}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5998190-6649-4C43-BB6A-226C2BF76E11}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -67,6 +81,9 @@ Global {96718232-FFFA-4E3C-B068-53C679B60669} = {2D975A5D-3612-4536-A501-248F6B9A5AC2} {57F68716-671A-476C-9F07-E0E86FDE6940} = {2D975A5D-3612-4536-A501-248F6B9A5AC2} {65C2410A-57CA-45A1-9E98-A12633A32A3E} = {2D975A5D-3612-4536-A501-248F6B9A5AC2} + {9E74B673-1931-4E5F-8BEF-122B742A3261} = {FA6E3503-ADFD-46D3-912B-D4A05BF4407F} + {A39B9288-3D3D-41FD-B18C-C5805E6A9CAC} = {9E74B673-1931-4E5F-8BEF-122B742A3261} + {A5998190-6649-4C43-BB6A-226C2BF76E11} = {9E74B673-1931-4E5F-8BEF-122B742A3261} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2BE248DF-16B1-42EF-9A34-C3FE5359D418} diff --git a/notes/pve-api.txt b/notes/pve-api.txt index d04a960..2d63702 100644 --- a/notes/pve-api.txt +++ b/notes/pve-api.txt @@ -15,4 +15,9 @@ URLS: https://pve.proxmox.com/wiki/Proxmox_VE_API https://forum.proxmox.com/threads/shutdown-the-server-via-api.98125/ -https://github.com/Corsinvest/cv4pve-api-dotnet \ No newline at end of file +https://github.com/Corsinvest/cv4pve-api-dotnet + + +***REMOVED*** +https://***REMOVED******REMOVED***/ +https://***REMOVED******REMOVED***/api2/extjs/access/ticket \ No newline at end of file diff --git a/src/integration/ProxmoxConnector.Integration.Abstractions/IPveConnector.cs b/src/integration/ProxmoxConnector.Integration.Abstractions/IPveConnector.cs new file mode 100644 index 0000000..0f11bff --- /dev/null +++ b/src/integration/ProxmoxConnector.Integration.Abstractions/IPveConnector.cs @@ -0,0 +1,6 @@ +namespace ProxmoxConnector.Integration.Abstractions +{ + public interface IPveConnector + { + } +} diff --git a/src/integration/ProxmoxConnector.Integration.Abstractions/ProxmoxConnector.Integration.Abstractions.csproj b/src/integration/ProxmoxConnector.Integration.Abstractions/ProxmoxConnector.Integration.Abstractions.csproj new file mode 100644 index 0000000..f208d30 --- /dev/null +++ b/src/integration/ProxmoxConnector.Integration.Abstractions/ProxmoxConnector.Integration.Abstractions.csproj @@ -0,0 +1,7 @@ + + + + net5.0 + + + diff --git a/src/integration/ProxmoxConnector.Integration.Corsinvest/DependencyInjectionExtensions.cs b/src/integration/ProxmoxConnector.Integration.Corsinvest/DependencyInjectionExtensions.cs new file mode 100644 index 0000000..db522b6 --- /dev/null +++ b/src/integration/ProxmoxConnector.Integration.Corsinvest/DependencyInjectionExtensions.cs @@ -0,0 +1,15 @@ +using Microsoft.Extensions.DependencyInjection; +using ProxmoxConnector.Integration.Abstractions; +using ProxmoxConnector.Integration.Corsinvest.Services; +using System; + +namespace ProxmoxConnector.Integration.Corsinvest +{ + public static class DependencyInjectionExtensions + { + public static void AddCorsinvestPveConnector(this IServiceCollection services) + { + services.AddScoped(); + } + } +} diff --git a/src/integration/ProxmoxConnector.Integration.Corsinvest/ProxmoxConnector.Integration.Corsinvest.csproj b/src/integration/ProxmoxConnector.Integration.Corsinvest/ProxmoxConnector.Integration.Corsinvest.csproj new file mode 100644 index 0000000..f7db579 --- /dev/null +++ b/src/integration/ProxmoxConnector.Integration.Corsinvest/ProxmoxConnector.Integration.Corsinvest.csproj @@ -0,0 +1,16 @@ + + + + net5.0 + + + + + + + + + + + + diff --git a/src/integration/ProxmoxConnector.Integration.Corsinvest/Services/PveConnector.cs b/src/integration/ProxmoxConnector.Integration.Corsinvest/Services/PveConnector.cs new file mode 100644 index 0000000..740b2ab --- /dev/null +++ b/src/integration/ProxmoxConnector.Integration.Corsinvest/Services/PveConnector.cs @@ -0,0 +1,51 @@ +using Corsinvest.ProxmoxVE.Api; +using Newtonsoft.Json; +using ProxmoxConnector.Integration.Abstractions; +using System; +using System.Threading.Tasks; + +namespace ProxmoxConnector.Integration.Corsinvest.Services +{ + internal class PveConnector : IPveConnector + { + public async Task Test() + { + var client = new PveClient("***REMOVED***"); ***REMOVED*** + if (await client.Login("root", "password")) + { + var vm = client.Nodes["pve1"].Qemu[100]; + + //config vm + var config = await vm.Config.VmConfig(); + Console.WriteLine(JsonConvert.SerializeObject(config.Response, Formatting.Indented)); + + //create snapshot + var response = await vm.Snapshot.Snapshot("pippo2311"); + + //update snapshot description + await vm.Snapshot["pippo2311"].Config.UpdateSnapshotConfig("description"); + + //delete snapshot + await vm.Snapshot["pippo2311"].Delsnapshot(); + + //list of snapshot + foreach (var snapshot in (await vm.Snapshot.SnapshotList()).Response.data) + { + Console.WriteLine(JsonConvert.SerializeObject(snapshot, Formatting.Indented)); + Console.WriteLine(snapshot.name); + } + + //change response type from json to png + client.ResponseType = ResponseType.Png; + var dataImg = (await client.Nodes["pve1"].Rrd.Rrd("cpu", "day")).Response; + Console.WriteLine(""); + } + + //using Api Token + var client2 = new PveClient("10.92.100.33"); + client2.ApiToken = "root@pam!qqqqqq=***REMOVED***"; + var version = await client2.Version.Version(); + Console.WriteLine(JsonConvert.SerializeObject(version.Response.data, Formatting.Indented)); + } + } +} diff --git a/src/integration/ProxmoxConnector.Integration.Corsinvest/notes/Corsinvest.ProxmoxVE.txt b/src/integration/ProxmoxConnector.Integration.Corsinvest/notes/Corsinvest.ProxmoxVE.txt new file mode 100644 index 0000000..9ae9a49 --- /dev/null +++ b/src/integration/ProxmoxConnector.Integration.Corsinvest/notes/Corsinvest.ProxmoxVE.txt @@ -0,0 +1,5 @@ +Corsinvest.ProxmoxVE.Api +https://github.com/Corsinvest/cv4pve-api-dotnet + +Corsinvest.ProxmoxVE.Api.Extension +https://www.nuget.org/packages/Corsinvest.ProxmoxVE.Api.Extension/3.2.0#show-readme-container \ No newline at end of file diff --git a/src/server/ProxmoxConnector.Server/ProxmoxConnector.Server.csproj b/src/server/ProxmoxConnector.Server/ProxmoxConnector.Server.csproj index c38a043..d870710 100644 --- a/src/server/ProxmoxConnector.Server/ProxmoxConnector.Server.csproj +++ b/src/server/ProxmoxConnector.Server/ProxmoxConnector.Server.csproj @@ -7,7 +7,6 @@ -