diff --git a/ocaml/sdk-gen/csharp/README-NuGet.dist b/ocaml/sdk-gen/csharp/README-NuGet.dist new file mode 100644 index 00000000000..66b6fa92b2c --- /dev/null +++ b/ocaml/sdk-gen/csharp/README-NuGet.dist @@ -0,0 +1,53 @@ +XenServer.NET +============= + +XenServer.NET is a complete SDK for XenServer, exposing the XenServer +API as .NET classes. It is written in C#. + +XenServer.NET includes a class for every API class, and a method for each API +call, so API documentation and examples written for other languages will apply +equally well to .NET. In particular, the SDK Guide and the Management API Guide +are ideal for developers wishing to use XenServer.NET. + +XenServer.NET is free software. You can redistribute and modify it under the +terms of the BSD 2-Clause license. See LICENSE.txt for details. + +This library is accompanied by pedagogical examples. These do not form +part of this library, and are licensed for redistribution and modification +under the BSD 2-Clause license. + + +Reference +--------- + +For XenServer documentation see https://docs.citrix.com/en-us/citrix-hypervisor/ + +The XenServer Management API Reference is available at +https://developer-docs.citrix.com/projects/citrix-hypervisor-management-api/en/latest/ + +The XenServer Software Development Kit Guide is available at +https://developer-docs.citrix.com/projects/citrix-hypervisor-sdk/en/latest/ + +For community content, blogs, and downloads, visit +https://www.citrix.com/community/citrix-developer/ + +To network with other developers using XenServer visit +https://discussions.citrix.com/forum/101-hypervisor-formerly-xenserver/ + + +Prerequisites +------------- + +This library requires .NET Standard 2.0. + + +Dependencies +------------ + +XenServer.NET is dependent upon the following libraries: + +- Newtonsoft JSON.NET by James Newton-King (see https://www.newtonsoft.com/). + JSON.NET is licensed under the MIT license; see LICENSE.Newtonsoft.Json.txt + for details. A patched version of the library (Newtonsoft.Json.CH.dll) is + shipped with XenServer.NET. Its source code and license file can be found in + https://github.com/xenserver/dotnet-packages. diff --git a/ocaml/sdk-gen/csharp/README.dist b/ocaml/sdk-gen/csharp/README.dist index a35e923565d..b83d6c43f2d 100644 --- a/ocaml/sdk-gen/csharp/README.dist +++ b/ocaml/sdk-gen/csharp/README.dist @@ -1,8 +1,8 @@ XenServer.NET ============= -XenServer.NET is a complete SDK for Citrix Hypervisor, exposing the Citrix -Hypervisor API as .NET classes. It is written in C#. +XenServer.NET is a complete SDK for XenServer, exposing the XenServer +API as .NET classes. It is written in C#. XenServer.NET includes a class for every API class, and a method for each API call, so API documentation and examples written for other languages will apply @@ -20,18 +20,18 @@ under the BSD 2-Clause license. Reference --------- -For Citrix Hypervisor documentation see https://docs.citrix.com/en-us/citrix-hypervisor/ +For XenServer documentation see https://docs.citrix.com/en-us/citrix-hypervisor/ -The Citrix Hypervisor Management API Reference is available at +The XenServer Management API Reference is available at https://developer-docs.citrix.com/projects/citrix-hypervisor-management-api/en/latest/ -The Citrix Hypervisor Software Development Kit Guide is available at +The XenServer Software Development Kit Guide is available at https://developer-docs.citrix.com/projects/citrix-hypervisor-sdk/en/latest/ For community content, blogs, and downloads, visit https://www.citrix.com/community/citrix-developer/ -To network with other developers using Citrix Hypervisor visit +To network with other developers using XenServer visit https://discussions.citrix.com/forum/101-hypervisor-formerly-xenserver/ @@ -49,14 +49,15 @@ XenServer.NET is dependent upon the following libraries: - Newtonsoft JSON.NET by James Newton-King (see https://www.newtonsoft.com/). JSON.NET is licensed under the MIT license; see LICENSE.Newtonsoft.Json.txt for details. A patched version of the library (Newtonsoft.Json.CH.dll) is - shipped with XenServer.NET. + shipped with XenServer.NET. Its source code and license file can be found in + https://github.com/xenserver/dotnet-packages. Downloads --------- This archive contains the following folders that are relevant to .NET developers: -- XenServer.NET\bin: contains the ready compiled binaries +- XenServer.NET: contains the ready compiled binaries in the form of a NuGet package. - XenServer.NET\src: contains the source code shipped as a Visual Studio project. - XenServer.NET\samples: contains the examples shipped as a Visual studio solution. @@ -66,24 +67,25 @@ Getting Started Extract the contents of this archive. -A. To use the compiled binaries in your code: - 1. Copy XenServer.dll and Newtonsoft.Json.CH.dll - from the bin folder into your own workspace. - 2. In Visual Studio, add references to all DLLs from your own program. - Project > Add Reference > Browse. - 3. You should now be ready to compile against XenServer.NET. +A. To build the source code: + 1. Open the project XenServer.csproj in Visual Studio. + 2. You should now be ready to build the source code. -B. To build the source code: - 1. Copy Newtonsoft.Json.CH.dll from the bin - folder into the source code folder at the same level as the project file - XenServer.csproj - 2. Open the project XenServer.csproj in Visual Studio. - 3. You should now be ready to build the source code. +B. To use the NuGet package in your code (offline): + 1. Add the location of the package as a NuGet source: + + ```pwsh + nuget sources Add -Name "Offline Package" -Source "/full/path/to/package/directory" + ``` + + 2. Install the package + + ```pwsh + nuget install XenServer.NET + ``` C. To run the examples: - 1. Copy XenServer.dll and Newtonsoft.Json.CH.dll - from the bin folder into the samples folder at the same level as the - project file XenSdkSample.csproj. + 1. Follow steps B.1 and B.2 2. Open XenSdkSample.sln inside Visual Studio (2019 or greater). 3. You should now be ready to compile the solution and run the examples. The solution project is a console application expecting the parameters diff --git a/ocaml/sdk-gen/csharp/autogen/dune b/ocaml/sdk-gen/csharp/autogen/dune index 2a844e6a44a..e65414c7297 100644 --- a/ocaml/sdk-gen/csharp/autogen/dune +++ b/ocaml/sdk-gen/csharp/autogen/dune @@ -14,11 +14,20 @@ (action (copy %{deps} %{targets})) ) +(rule + (targets README-NuGet.md) + (deps + ../README-NuGet.dist + ) + (action (copy %{deps} %{targets})) +) + (alias (name generate) (deps LICENSE.txt README.txt + README-NuGet.md (source_tree .) ) ) diff --git a/ocaml/sdk-gen/csharp/autogen/samples/XenSdkSample.csproj b/ocaml/sdk-gen/csharp/autogen/samples/XenSdkSample.csproj index 8a8b965e9ef..f6b259b787c 100644 --- a/ocaml/sdk-gen/csharp/autogen/samples/XenSdkSample.csproj +++ b/ocaml/sdk-gen/csharp/autogen/samples/XenSdkSample.csproj @@ -1,22 +1,7 @@ - - + - Debug - AnyCPU - 8.0.50727 - 2.0 - {869DC514-BCC0-42D7-BFA7-077005B23107} + net6.0 Exe - Properties - XenSdkSample - XenSdkSample - v4.5 - - - - - 2.0 - false publish\ true @@ -32,65 +17,15 @@ 1.0.0.%2a false true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false + false - False .\Newtonsoft.Json.CH.dll - - - .\XenServer.dll - - - - - - - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - - \ No newline at end of file diff --git a/ocaml/sdk-gen/csharp/autogen/src/Properties/AssemblyInfo.cs b/ocaml/sdk-gen/csharp/autogen/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 6c33ec4169a..00000000000 --- a/ocaml/sdk-gen/csharp/autogen/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Citrix Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2) Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("XenServer.NET")] -[assembly: AssemblyDescription("Citrix XenServer C#.NET SDK")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Citrix Systems, Inc.")] -[assembly: AssemblyProduct("XenServer.NET")] -[assembly: AssemblyCopyright("Copyright © Citrix Systems, Inc.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5bac14b7-3480-4ce7-b787-2782bd506de8")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyInformationalVersion("1.0.0.0")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ocaml/sdk-gen/csharp/autogen/src/packageIcon.png b/ocaml/sdk-gen/csharp/autogen/src/packageIcon.png new file mode 100644 index 00000000000..31e4706202d Binary files /dev/null and b/ocaml/sdk-gen/csharp/autogen/src/packageIcon.png differ diff --git a/ocaml/sdk-gen/csharp/templates/XenServer.csproj.mustache b/ocaml/sdk-gen/csharp/templates/XenServer.csproj.mustache index 53d0e23c374..e573b5fa215 100644 --- a/ocaml/sdk-gen/csharp/templates/XenServer.csproj.mustache +++ b/ocaml/sdk-gen/csharp/templates/XenServer.csproj.mustache @@ -1,17 +1,45 @@  - netstandard2.0 + 0.0.0 + netstandard2.0;net45 Library XenAPI - false + True + True + XenServer.NET + Citrix Systems, Inc. + $(AssemblyName).NET + $(AssemblyName).NET + .NET wrapper for the XenServer API + Copyright (c) Citrix Systems, Inc. All rights reserved. + citrix hypervisor virtualization sdk jsonrpc .net c# xen xenserver + BSD-2-Clause + https://github.com/xapi-project/xen-api + packageIcon.png + git + README-NuGet.md + + + + + + + + true - + + + False + .\lib\netstandard2.0\Newtonsoft.Json.CH.dll + + + False - .\Newtonsoft.Json.CH.dll + .\lib\net45\Newtonsoft.Json.CH.dll diff --git a/ocaml/sdk-gen/powershell/README.dist b/ocaml/sdk-gen/powershell/README.dist index a2c173addc1..d3e76543877 100644 --- a/ocaml/sdk-gen/powershell/README.dist +++ b/ocaml/sdk-gen/powershell/README.dist @@ -1,10 +1,10 @@ -Citrix Hypervisor PowerShell Module +XenServer PowerShell Module =================================== -The Citrix Hypervisor PowerShell Module is a complete SDK for Citrix Hypervisor, -exposing the Citrix Hypervisor API as Windows PowerShell cmdlets. +The XenServer PowerShell Module is a complete SDK for XenServer, +exposing the XenServer API as Windows PowerShell cmdlets. -The Citrix Hypervisor PowerShell Module includes a cmdlet for each API call, +The XenServer PowerShell Module includes a cmdlet for each API call, so API documentation and examples written for other languages will apply equally well to PowerShell. In particular, the SDK Guide and the Management API Guide are ideal for developers wishing to use this module. @@ -20,18 +20,18 @@ under the BSD 2-Clause license. Reference --------- -For Citrix Hypervisor documentation see https://docs.citrix.com/en-us/citrix-hypervisor/ +For XenServer documentation see https://docs.citrix.com/en-us/citrix-hypervisor/ -The Citrix Hypervisor Management API Reference is available at +The XenServer Management API Reference is available at https://developer-docs.citrix.com/projects/citrix-hypervisor-management-api/en/latest/ -The Citrix Hypervisor Software Development Kit Guide is available at +The XenServer Software Development Kit Guide is available at https://developer-docs.citrix.com/projects/citrix-hypervisor-sdk/en/latest/ For community content, blogs, and downloads, visit https://www.citrix.com/community/citrix-developer/ -To network with other developers using Citrix Hypervisor visit +To network with other developers using XenServer visit https://discussions.citrix.com/forum/101-hypervisor-formerly-xenserver/ @@ -44,12 +44,16 @@ This library requires .NET 6.0 and PowerShell 7.2. Dependencies ------------ -The Citrix Hypervisor PowerShell Module is dependent upon the following libraries: +The XenServer PowerShell Module is dependent upon the following libraries: - Newtonsoft JSON.NET by James Newton-King (see https://www.newtonsoft.com/). JSON.NET is licensed under the MIT license; see LICENSE.Newtonsoft.Json.txt for details. A patched version of the library (Newtonsoft.Json.CH.dll) is - shipped with the Citrix Hypervisor PowerShell Module. + shipped with the XenServer PowerShell Module. + +- XenServer.NET by Citrix Systems, Inc. + XenServer.NET is a complete SDK for XenServer, exposing the XenServer + API as .NET classes. It is written in C#. Folder Structure @@ -57,9 +61,9 @@ Folder Structure This archive contains the following folders that are relevant to PowerShell users: -- XenServerPowerShell\XenServerPSModule: this is the Citrix Hypervisor PowerShell +- XenServerPowerShell\XenServerPSModule: this is the XenServer PowerShell Module -- XenServerPowerShell\src: contains the C# source code for the Citrix Hypervisor +- XenServerPowerShell\src: contains the C# source code for the XenServer cmdlets shipped as a Visual Studio project. - XenServerPowerShell\samples: contains the sample scripts accompanying the module. @@ -69,14 +73,6 @@ Getting Started 1. Unzip the contents of this archive. - Note that, if you have downloaded this zip file using Internet Explorer, it - is likely that it will have been marked as "blocked" during the download. To - import the module successfully you will need to unblock this zip file before - unzipping it. - - To unblock the zip file, right-click on it and launch the Properties dialog. - Click the "Unblock" button, then the Apply or OK button. - 2. Navigate to the extracted XenServer\XenServerPowerShell directory and copy the whole folder XenServerPSModule into your PowerShell modules directory, which will normally be $env:UserProfile\Documents\WindowsPowerShell\Modules @@ -105,21 +101,21 @@ Getting Started inconvenient. You probably want to change it to RemoteSigned, as above. If the current policy is Unrestricted or RemoteSigned, it is compatible with - the Citrix Hypervisor PowerShell Module, so there is nothing to do. + the XenServer PowerShell Module, so there is nothing to do. 5. Exit the privileged instance of PowerShell. 6. Open a PowerShell prompt as a regular user (click Start > Windows PowerShell) - and import the Citrix Hypervisor PowerShell Module: + and import the XenServer PowerShell Module: PS> Import-Module XenServerPSModule -7. If you wish to load specific environment settings when the Citrix Hypervisor +7. If you wish to load specific environment settings when the XenServer PowerShell Module is loaded, create the file XenServerProfile.ps1 and put it in $env:UserProfile\Documents\WindowsPowerShell for per-user configuration or $env:windir\system32\WindowsPowerShell\v1.0 for system-wide configuration. -8. For an overview of the Citrix Hypervisor PowerShell Module type: +8. For an overview of the XenServer PowerShell Module type: PS> Get-Help about_XenServer @@ -141,15 +137,11 @@ Getting Started Building and Debugging the Source Code -------------------------------------- -1. Copy Newtonsoft.Json.CH.dll and XenServer.dll from the XenServerPSModule - folder into the source code folder at the same level as the project - file XenServerPowerShell.csproj. - -2. Open the project XenServerPowerShell.csproj in Visual Studio (2013 or greater). +1. Open the project XenServerPowerShell.csproj in Visual Studio (2019 or greater). -3. You should now be ready to build the source code. +2. You should now be ready to build the source code. -4. If in Debug mode, clicking Start will launch a PowerShell prompt as an +3. If in Debug mode, clicking Start will launch a PowerShell prompt as an external process, and import the compiled XenServerPowerShell.dll as a module (without, however, processing the scripts, types, and formats shipped within the XenServerPSModule). You should now be ready to debug the cmdlets. diff --git a/ocaml/sdk-gen/powershell/autogen/XenServer.format.ps1xml b/ocaml/sdk-gen/powershell/autogen/XenServer.format.ps1xml index d20e637f757..5cf6f993e1a 100644 --- a/ocaml/sdk-gen/powershell/autogen/XenServer.format.ps1xml +++ b/ocaml/sdk-gen/powershell/autogen/XenServer.format.ps1xml @@ -44,7 +44,7 @@ - uuid + opaque_ref diff --git a/ocaml/sdk-gen/powershell/autogen/XenServerPSModule.psd1 b/ocaml/sdk-gen/powershell/autogen/XenServerPSModule.psd1 index 62b3079b22a..90950901306 100644 --- a/ocaml/sdk-gen/powershell/autogen/XenServerPSModule.psd1 +++ b/ocaml/sdk-gen/powershell/autogen/XenServerPSModule.psd1 @@ -47,7 +47,7 @@ PowerShellHostVersion = '' ProcessorArchitecture = 'None' #Contents -ModuleToProcess = 'XenServerPowerShell.dll' +RootModule = 'XenServerPowerShell.dll' RequiredModules = @() NestedModules = @() RequiredAssemblies = @('Newtonsoft.Json.CH.dll', diff --git a/ocaml/sdk-gen/powershell/autogen/src/Properties/AssemblyInfo.cs b/ocaml/sdk-gen/powershell/autogen/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 12ee4750d2d..00000000000 --- a/ocaml/sdk-gen/powershell/autogen/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) Citrix Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2) Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("XenServerPowerShell")] -[assembly: AssemblyDescription("Citrix XenServer PowerShell Module")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Citrix Systems, Inc.")] -[assembly: AssemblyProduct("XenServerPowerShell")] -[assembly: AssemblyCopyright("Copyright © Citrix Systems, Inc.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("723a56c5-53ab-40b0-90b2-02fd87a3b201")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: AssemblyInformationalVersion("1.0.0.0")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ocaml/sdk-gen/powershell/templates/XenServerPowerShell.csproj.mustache b/ocaml/sdk-gen/powershell/templates/XenServerPowerShell.csproj.mustache index 1646c9bb4a3..cf7d8074d83 100644 --- a/ocaml/sdk-gen/powershell/templates/XenServerPowerShell.csproj.mustache +++ b/ocaml/sdk-gen/powershell/templates/XenServerPowerShell.csproj.mustache @@ -1,11 +1,12 @@ + 0.0.0 net6.0 Library - false + True - true + True Program C:\Program Files\PowerShell\7\pwsh.exe -NoLogo -NoExit -Command "Import-Module '.\XenServerPowerShell.dll'" diff --git a/ocaml/sdk-gen/windows-line-endings.sh b/ocaml/sdk-gen/windows-line-endings.sh index 1b0c3629181..2c5703cc2d0 100644 --- a/ocaml/sdk-gen/windows-line-endings.sh +++ b/ocaml/sdk-gen/windows-line-endings.sh @@ -30,7 +30,7 @@ DIR_TO_FLIP=$1 -for file in `find ${DIR_TO_FLIP} -type f` +for file in `find ${DIR_TO_FLIP} -type f ! -name '*.png'` do sed -i -e 's,\r,,g' $file sed -i -e 's,$,\r,g' $file