diff --git a/.github/workflows/cleanup-xapi-environment/action.yml b/.github/workflows/cleanup-xapi-environment/action.yml new file mode 100644 index 00000000000..96323007e4e --- /dev/null +++ b/.github/workflows/cleanup-xapi-environment/action.yml @@ -0,0 +1,13 @@ +name: Cleanup XenAPI environment +description: Cleanup XenAPI environment created using the setup-xapi-environment composite action + +runs: + using: "composite" + steps: + - name: Uninstall unversioned packages and remove pins + shell: bash + # This should purge them from the cache, unversioned package have + # 'master' as its version + run: | + opam list | awk -F " " '$2 == "master" { print $1 }' | xargs opam uninstall + opam pin list | cut -f1 -d "." | xargs opam unpin diff --git a/.github/workflows/generate-and-build-sdks.yml b/.github/workflows/generate-and-build-sdks.yml new file mode 100644 index 00000000000..92f0f52b854 --- /dev/null +++ b/.github/workflows/generate-and-build-sdks.yml @@ -0,0 +1,211 @@ +name: Generate and Build SDKs + +on: + workflow_call: + inputs: + xapi_version: + required: true + type: string + +jobs: + generate-sdk-sources: + name: Generate SDK sources + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup XenAPI environment + uses: ./.github/workflows/setup-xapi-environment + with: + xapi_version: ${{ inputs.xapi_version }} + + - name: Generate SDKs + shell: bash + run: opam exec -- make sdk + + - name: Store C# SDK source + uses: actions/upload-artifact@v3 + with: + name: SDK_Source_CSharp + path: _build/install/default/xapi/sdk/csharp/* + + - name: Store PowerShell SDK source + uses: actions/upload-artifact@v3 + with: + name: SDK_Source_PowerShell + path: _build/install/default/xapi/sdk/powershell/* + + - name: Cleanup XenAPI environment + uses: ./.github/workflows/cleanup-xapi-environment + + build-csharp-sdk: + name: Build C# SDK + runs-on: windows-2022 + needs: generate-sdk-sources + steps: + - name: Strip 'v' prefix from xapi version + shell: pwsh + run: echo "XAPI_VERSION_NUMBER=$("${{ inputs.xapi_version }}".TrimStart('v'))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Retrieve C# SDK source + uses: actions/download-artifact@v3 + with: + name: SDK_Source_CSharp + path: source/ + + - name: Build C# SDK + shell: pwsh + run: | + dotnet build source/src ` + --disable-build-servers ` + --configuration Release ` + -p:Version=${{ env.XAPI_VERSION_NUMBER }}-prerelease-unsigned ` + --verbosity=normal + + - name: Store C# SDK + uses: actions/upload-artifact@v3 + with: + name: SDK_Binaries_CSharp + path: source/src/bin/Release/XenServer.NET.${{ env.XAPI_VERSION_NUMBER }}-prerelease-unsigned.nupkg + + build-powershell-5x-sdk: + name: Build PowerShell 5.x SDK (.NET Framework 4.5) + needs: build-csharp-sdk + # PowerShell SDK for PowerShell 5.x needs to run on windows-2019 because + # windows-2022 doesn't contain .NET Framework 4.x dev tools + runs-on: windows-2019 + steps: + - name: Strip 'v' prefix from xapi version + shell: pwsh + run: echo "XAPI_VERSION_NUMBER=$("${{ inputs.xapi_version }}".TrimStart('v'))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Retrieve PowerShell SDK source + uses: actions/download-artifact@v3 + with: + name: SDK_Source_PowerShell + path: source/ + + - name: Retrieve C# SDK binaries + uses: actions/download-artifact@v3 + with: + name: SDK_Binaries_CSharp + path: csharp/ + + # Following needed for restoring packages + # when calling dotnet add package + - name: Set up dotnet CLI (.NET 6.0 and 8.0) + uses: actions/setup-dotnet@v3 + with: + dotnet-version: | + 6 + 8 + + - name: Setup project and dotnet CLI + shell: pwsh + run: | + dotnet nuget add source --name local ${{ github.workspace }}\csharp + dotnet add source/src package XenServer.NET --version ${{ env.XAPI_VERSION_NUMBER }}-prerelease-unsigned + + - name: Build PowerShell SDK (.NET Framework 4.5) + shell: pwsh + run: | + dotnet build source/src/XenServerPowerShell.csproj ` + --disable-build-servers ` + --configuration Release ` + -p:Version=${{ env.XAPI_VERSION_NUMBER }}-prerelease-unsigned ` + -p:TargetFramework=net45 ` + --verbosity=normal` + + - name: Update SDK and PS versions in "XenServerPSModule.psd1" + shell: pwsh + run: | + (Get-Content "source\XenServerPSModule.psd1") -replace "@SDK_VERSION@","${{ env.XAPI_VERSION_NUMBER }}" | Set-Content -Path "source\XenServerPSModule.psd1" + (Get-Content "source\XenServerPSModule.psd1") -replace "@PS_VERSION@","5.0" | Set-Content -Path "source\XenServerPSModule.psd1" + + - name: Move binaries to destination folder + shell: pwsh + run: | + New-Item -Path "." -Name "output" -ItemType "directory" + Copy-Item -Verbose "source\README_51.md" -Destination "output" -Force + Copy-Item -Verbose "source\LICENSE" -Destination "output" -Force + Copy-Item -Path "source\src\bin\Release\net45\*" -Include "*.dll" "output\" + Get-ChildItem -Path "source" |` + Where-Object { $_.Extension -eq ".ps1" -or $_.Extension -eq ".ps1xml" -or $_.Extension -eq ".psd1" -or $_.Extension -eq ".txt" } |` + ForEach-Object -Process { Copy-Item -Verbose $_.FullName -Destination "output" } + + - name: Store PowerShell SDK (.NET Framework 4.5) + uses: actions/upload-artifact@v3 + with: + name: SDK_Binaries_XenServerPowerShell_NET45 + path: output/**/* + + build-powershell-7x-sdk: + name: Build PowerShell 7.x SDK + strategy: + fail-fast: false + matrix: + dotnet: ["6", "8"] + needs: build-csharp-sdk + runs-on: windows-2022 + + steps: + - name: Strip 'v' prefix from xapi version + shell: pwsh + run: echo "XAPI_VERSION_NUMBER=$("${{ inputs.xapi_version }}".TrimStart('v'))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + + - name: Retrieve PowerShell SDK source + uses: actions/download-artifact@v3 + with: + name: SDK_Source_PowerShell + path: source/ + + - name: Retrieve C# SDK binaries + uses: actions/download-artifact@v3 + with: + name: SDK_Binaries_CSharp + path: csharp/ + + - name: Set up dotnet CLI (.NET ${{ matrix.dotnet }}) + uses: actions/setup-dotnet@v3 + with: + dotnet-version: ${{ matrix.dotnet }} + + - name: Setup project and NuGet source + shell: pwsh + run: | + dotnet nuget add source --name local ${{ github.workspace }}\csharp + dotnet add source/src package XenServer.NET --version ${{ env.XAPI_VERSION_NUMBER }}-prerelease-unsigned + + - name: Build PowerShell SDK (.NET ${{ matrix.dotnet }}) + shell: pwsh + run: | + dotnet build source/src/XenServerPowerShell.csproj ` + --disable-build-servers ` + --configuration Release ` + -p:Version=${{ env.XAPI_VERSION_NUMBER }}-prerelease-unsigned ` + -p:TargetFramework=net${{ matrix.dotnet }}.0 ` + --verbosity=normal` + + - name: Update SDK and PS versions in "XenServerPSModule.psd1" + shell: pwsh + run: | + (Get-Content "source\XenServerPSModule.psd1") -replace "@SDK_VERSION@","${{ env.XAPI_VERSION_NUMBER }}" | Set-Content -Path "source\XenServerPSModule.psd1" + (Get-Content "source\XenServerPSModule.psd1") -replace "@PS_VERSION@","7.0" | Set-Content -Path "source\XenServerPSModule.psd1" + + - name: Move binaries to destination folder + shell: pwsh + run: | + New-Item -Path "." -Name "output" -ItemType "directory" + Copy-Item -Verbose "source\README.md" -Destination "output" -Force + Copy-Item -Verbose "source\LICENSE" -Destination "output" -Force + Copy-Item -Path "source\src\bin\Release\net${{ matrix.dotnet }}.0\*" -Include "*.dll" "output\" + Get-ChildItem -Path "source" |` + Where-Object { $_.Extension -eq ".ps1" -or $_.Extension -eq ".ps1xml" -or $_.Extension -eq ".psd1" -or $_.Extension -eq ".txt" } |` + ForEach-Object -Process { Copy-Item -Verbose $_.FullName -Destination "output" } + + - name: Store PowerShell SDK (.NET ${{ matrix.dotnet }}) + uses: actions/upload-artifact@v3 + with: + name: SDK_Binaries_XenServerPowerShell_NET${{ matrix.dotnet }} + path: output/**/* diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6662dc218ea..d38a825a23b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,9 +5,9 @@ on: pull_request: schedule: # run daily, this refreshes the cache - - cron: '13 2 * * *' + - cron: "13 2 * * *" -concurrency: # On new push, cancel old workflows from the same PR, branch or tag: +concurrency: # On new push, cancel old workflows from the same PR, branch or tag: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -18,12 +18,12 @@ jobs: strategy: fail-fast: false matrix: - python-version: ['2.7', '3.11'] + python-version: ["2.7", "3.11"] steps: - name: Checkout code uses: actions/checkout@v3 with: - fetch-depth: 0 # To check which files changed: origin/master..HEAD + fetch-depth: 0 # To check which files changed: origin/master..HEAD - uses: LizardByte/setup-python-action@master with: python-version: ${{matrix.python-version}} @@ -31,8 +31,8 @@ jobs: - uses: actions/cache@v3 name: Setup cache for running pre-commit fast with: - path: ~/.cache/pre-commit - key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} + path: ~/.cache/pre-commit + key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} - run: echo "::add-matcher::.github/workflows/python-warning-matcher.json" name: "Setup GitHub for reporting Python warnings as annotations in pull request code review" @@ -116,55 +116,24 @@ jobs: # Fails for user workflows without permissions(fork-based pull requests): continue-on-error: true with: - message-path: .git/pytype-summary.md # Add the content of it as comment + message-path: .git/pytype-summary.md # Add the content of it as comment - ocaml-test: - name: Ocaml tests + ocaml-tests: + name: Run OCaml tests runs-on: ubuntu-20.04 env: + # Ensure you also update test-sdk-builds + # when changing this value, to keep builds + # consistent XAPI_VERSION: "v0.0.0" - steps: - name: Checkout code uses: actions/checkout@v3 - - name: Free space - run: sudo rm -rf /usr/local/lib/android - - - name: Pull configuration from xs-opam - run: | - curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env - - - name: Load environment file - id: dotenv - uses: falti/dotenv-action@v1.0.4 - - - name: Update Ubuntu repositories - run: sudo apt-get update - - - name: Use disk with more space for TMPDIR and XDG_CACHE_HOME - run: | - df -h || true - export TMPDIR="/mnt/build/tmp" - export XDG_CACHE_HOME="/mnt/build/cache" - sudo mkdir -p "${TMPDIR}" "${XDG_CACHE_HOME}" - sudo chown "$(id -u):$(id -g)" "${TMPDIR}" "${XDG_CACHE_HOME}" - echo "TMPDIR=${TMPDIR}" >>"$GITHUB_ENV" - echo "XDG_CACHE_HOME=${XDG_CACHE_HOME}" >>"$GITHUB_ENV" - - - name: Use ocaml - uses: ocaml/setup-ocaml@v2 + - name: Setup XenAPI environment + uses: ./.github/workflows/setup-xapi-environment with: - ocaml-compiler: ${{ steps.dotenv.outputs.ocaml_version_full }} - opam-repositories: | - xs-opam: ${{ steps.dotenv.outputs.repository }} - dune-cache: true - - - name: Install dependencies - run: opam install . --deps-only --with-test -v - - - name: Configure - run: opam exec -- ./configure --xapi_version="$XAPI_VERSION" + xapi_version: ${{ env.XAPI_VERSION }} - name: Build run: opam exec -- make @@ -179,30 +148,16 @@ jobs: run: opam exec -- make stresstest if: ${{ github.event_name == 'schedule' }} - - name: Build SDK - run: | - mkdir -p /opt/xensource/sm - wget -O /opt/xensource/sm/XE_SR_ERRORCODES.xml https://raw.githubusercontent.com/xapi-project/sm/master/drivers/XE_SR_ERRORCODES.xml - opam exec -- make sdk - - name: Make install smoketest run: | opam exec -- make install DESTDIR=$(mktemp -d) opam exec -- make install DESTDIR=$(mktemp -d) BUILD_PY2=NO - - name: Sanity test SDK - run: | - opam exec -- make sdksanity - - name: Check disk space run: df -h || true - - name: Uninstall unversioned packages and remove pins - # This should purge them from the cache, unversioned package have - # 'master' as its version - run: | - opam list | awk -F " " '$2 == "master" { print $1 }' | xargs opam uninstall - opam pin list | cut -f1 -d "." | xargs opam unpin + - name: Cleanup XenAPI environment + uses: ./.github/workflows/cleanup-xapi-environment deprecation-test: name: Deprecation tests @@ -224,3 +179,12 @@ jobs: github_token: ${{ secrets.github_token }} reporter: github-pr-review level: error + + test-sdk-builds: + name: Test SDK builds + uses: ./.github/workflows/generate-and-build-sdks.yml + with: + # Ensure you also update ocaml-tests + # when changing this value, to keep builds + # consistent + xapi_version: "v0.0.0" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f55374239b..9045949aea2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,10 +3,11 @@ name: Create release from tag on: push: tags: - - 'v*' + - "v*" jobs: build-python: + name: Build and upload Python artifacts runs-on: ubuntu-latest steps: @@ -16,7 +17,7 @@ jobs: - name: Use python uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: "3.x" - name: Install build dependencies run: | @@ -34,23 +35,60 @@ jobs: name: XenAPI path: scripts/examples/python/dist/ + build-sdks: + name: Build and upload SDK artifacts + uses: ./.github/workflows/generate-and-build-sdks.yml + with: + xapi_version: ${{ github.ref_name }} release: + name: "Create and package release" runs-on: ubuntu-latest - needs: build-python + needs: [build-python, build-sdks] steps: - - name: Retrieve python distribution artifacts + - name: Retrieve Python SDK distribution artifacts uses: actions/download-artifact@v3 with: name: XenAPI path: dist/ + - name: Retrieve C# SDK distribution artifacts + uses: actions/download-artifact@v3 + with: + name: SDK_Binaries_CSharp + path: dist/ + + - name: Retrieve PowerShell 5.x SDK distribution artifacts + uses: actions/download-artifact@v3 + with: + name: SDK_Binaries_XenServerPowerShell_NET45 + path: sdk_powershell_5x/ + + - name: Retrieve PowerShell 7.x SDK distribution artifacts + uses: actions/download-artifact@v3 + with: + name: SDK_Binaries_XenServerPowerShell_NET6 + path: sdk_powershell_7x/ + + - name: Zip PowerShell 5.x SDK artifacts for deployment + shell: bash + run: zip PowerShell-SDK-5.x-prerelease-unsigned.zip ./sdk_powershell_5x -r + + - name: Zip PowerShell 7.x SDK artifacts for deployment + shell: bash + run: zip PowerShell-SDK-7.x-prerelease-unsigned.zip ./sdk_powershell_7x -r + - name: Create release ${{ github.ref_name }} - run: gh release create ${{ github.ref_name }} --repo ${{ github.repository }} --generate-notes dist/* + shell: bash + run: | + gh release create ${{ github.ref_name }} --repo ${{ github.repository }} --generate-notes dist/* \ + PowerShell-SDK-5.x-prerelease-unsigned.zip \ + PowerShell-SDK-7.x-prerelease-unsigned.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} publish-pypi: + name: Publish Python release to PyPI runs-on: ubuntu-latest needs: release environment: pypi @@ -63,5 +101,5 @@ jobs: name: XenAPI path: dist/ - - name: Publish the Python release to PyPI + - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/setup-xapi-environment/action.yml b/.github/workflows/setup-xapi-environment/action.yml new file mode 100644 index 00000000000..702162d42f3 --- /dev/null +++ b/.github/workflows/setup-xapi-environment/action.yml @@ -0,0 +1,59 @@ +name: Setup XenAPI environment +description: Setup a XenAPI environment for making opam calls. + +inputs: + xapi_version: + description: "XenAPI version, pass to configure as --xapi_version=" + required: true +runs: + using: "composite" + steps: + - name: Free space + shell: bash + run: sudo rm -rf /usr/local/lib/android + + - name: Pull configuration from xs-opam + shell: bash + run: | + curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env + + - name: Download XE_SR_ERRORCODES.xml + shell: bash + run: | + mkdir -p /opt/xensource/sm + wget -O /opt/xensource/sm/XE_SR_ERRORCODES.xml https://raw.githubusercontent.com/xapi-project/sm/master/drivers/XE_SR_ERRORCODES.xml + + - name: Load environment file + id: dotenv + uses: falti/dotenv-action@v1.0.4 + + - name: Update Ubuntu repositories + shell: bash + run: sudo apt-get update + + - name: Use disk with more space for TMPDIR and XDG_CACHE_HOME + shell: bash + run: | + df -h || true + export TMPDIR="/mnt/build/tmp" + export XDG_CACHE_HOME="/mnt/build/cache" + sudo mkdir -p "${TMPDIR}" "${XDG_CACHE_HOME}" + sudo chown "$(id -u):$(id -g)" "${TMPDIR}" "${XDG_CACHE_HOME}" + echo "TMPDIR=${TMPDIR}" >>"$GITHUB_ENV" + echo "XDG_CACHE_HOME=${XDG_CACHE_HOME}" >>"$GITHUB_ENV" + + - name: Use ocaml + uses: ocaml/setup-ocaml@v2 + with: + ocaml-compiler: ${{ steps.dotenv.outputs.ocaml_version_full }} + opam-repositories: | + xs-opam: ${{ steps.dotenv.outputs.repository }} + dune-cache: true + + - name: Install dependencies + shell: bash + run: opam install . --deps-only --with-test -v + + - name: Configure + shell: bash + run: opam exec -- ./configure --xapi_version="${{ inputs.xapi_version }}" diff --git a/Makefile b/Makefile index 921e65923de..f272cd8e766 100644 --- a/Makefile +++ b/Makefile @@ -112,11 +112,6 @@ sdk: sh ocaml/sdk-gen/windows-line-endings.sh $(XAPISDK)/csharp sh ocaml/sdk-gen/windows-line-endings.sh $(XAPISDK)/powershell -# workaround for no .resx generation, just for compilation testing -sdksanity: sdk - sed -i 's/FriendlyErrorNames.ResourceManager/null/g' ./_build/install/default/xapi/sdk/csharp/src/Failure.cs - cd _build/install/default/xapi/sdk/csharp/src && dotnet add package Newtonsoft.Json && dotnet build -f netstandard2.0 - .PHONY: sdk-build-java sdk-build-java: sdk diff --git a/ocaml/sdk-gen/csharp/FriendlyErrorNames.resx b/ocaml/sdk-gen/csharp/FriendlyErrorNames.resx index 133e457a3c4..737b0a20d65 100644 --- a/ocaml/sdk-gen/csharp/FriendlyErrorNames.resx +++ b/ocaml/sdk-gen/csharp/FriendlyErrorNames.resx @@ -114,7 +114,7 @@ Server cannot attach network (in the case of NIC bonding, this may be because attaching the network on this server would require other networks [that are currently active] to be taken down). - + Cannot attach network @@ -123,7 +123,7 @@ The VM could not start because the CD drive is empty. - + Disabled @@ -147,13 +147,13 @@ Not enough server memory is available to perform this operation - + Not enough free memory The restore could not be performed because the server is not in recovery mode - + Unreachable @@ -806,7 +806,7 @@ Authorized Roles: {1} The VM's Virtual Hardware Platform version is incompatible with this host. - + HVM not supported @@ -824,19 +824,19 @@ Authorized Roles: {1} You attempted to run a VM on a host which does not have a GPU available in the GPU group needed by the VM. - + GPU not available This VM needs a network that cannot be seen from that server - + Cannot see required network This VM needs storage that cannot be seen from that server - + Cannot see required storage diff --git a/ocaml/sdk-gen/csharp/autogen/.gitignore b/ocaml/sdk-gen/csharp/autogen/.gitignore new file mode 100644 index 00000000000..e60f54f7f19 --- /dev/null +++ b/ocaml/sdk-gen/csharp/autogen/.gitignore @@ -0,0 +1,423 @@ +# Created by https://www.toptal.com/developers/gitignore/api/dotnetcore,visualstudio,visualstudiocode +# Edit at https://www.toptal.com/developers/gitignore?templates=dotnetcore,visualstudio,visualstudiocode + +### DotnetCore ### +# .NET Core build folders +bin/ +obj/ + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +*.code-workspace + +# Local History for Visual Studio Code + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/dotnetcore,visualstudio,visualstudiocode \ No newline at end of file diff --git a/ocaml/sdk-gen/csharp/README.dist b/ocaml/sdk-gen/csharp/autogen/README.md similarity index 61% rename from ocaml/sdk-gen/csharp/README.dist rename to ocaml/sdk-gen/csharp/autogen/README.md index e841c8f1d48..bd75fb5ffd2 100644 --- a/ocaml/sdk-gen/csharp/README.dist +++ b/ocaml/sdk-gen/csharp/autogen/README.md @@ -1,7 +1,6 @@ -XenServer.NET -============= +# XenServer.NET -Copyright (c) 2007-2023 Cloud Software Group, Inc. All Rights Reserved. +Copyright (c) 2007-2024 Cloud Software Group, Inc. All Rights Reserved. XenServer.NET is a complete SDK for XenServer, exposing the XenServer API as .NET classes. It is written in C#. @@ -14,64 +13,54 @@ 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. +## Reference -Reference ---------- - -For XenServer documentation see https://docs.xenserver.com +For XenServer documentation see The XenServer Management API Reference is available at -https://docs.xenserver.com/en-us/xenserver/8/developer/management-api + The XenServer Software Development Kit Guide is available at -https://docs.xenserver.com/en-us/xenserver/8/developer/sdk-guide + A number of examples to help you get started with the SDK is available at -https://github.com/xenserver/xenserver-samples + For community content, blogs, and downloads, visit -https://www.xenserver.com/blogs and https://www.citrix.com/community/ + and To network with other developers using XenServer visit -https://discussions.citrix.com/forum/101-hypervisor-formerly-xenserver/ - + -Prerequisites -------------- +## Prerequisites This library requires .NET Standard 2.0. - -Dependencies ------------- +## 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. - +- Newtonsoft JSON.NET by James Newton-King (see ). + JSON.NET is licensed under the MIT license. -Downloads ---------- +## Downloads This archive contains the following folders that are relevant to .NET developers: + - 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. - -Getting Started ---------------- +## Getting Started Extract the contents of this archive. 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 use the NuGet package in your code (offline): + 1. Add the location of the package as a NuGet source: ```pwsh diff --git a/ocaml/sdk-gen/csharp/autogen/dune b/ocaml/sdk-gen/csharp/autogen/dune index e65414c7297..d5e542936ad 100644 --- a/ocaml/sdk-gen/csharp/autogen/dune +++ b/ocaml/sdk-gen/csharp/autogen/dune @@ -1,34 +1,15 @@ (rule - (targets LICENSE.txt) + (targets LICENSE) (deps ../../LICENSE ) (action (copy %{deps} %{targets})) ) -(rule - (targets README.txt) - (deps - ../README.dist - ) - (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 + LICENSE (source_tree .) ) -) - +) \ No newline at end of file diff --git a/ocaml/sdk-gen/csharp/autogen/src/Failure.cs b/ocaml/sdk-gen/csharp/autogen/src/Failure.cs index d165fa93947..b877dfa6de1 100644 --- a/ocaml/sdk-gen/csharp/autogen/src/Failure.cs +++ b/ocaml/sdk-gen/csharp/autogen/src/Failure.cs @@ -145,7 +145,7 @@ where trimmed.Length > 0 try { - shortError = errorDescriptions.GetString(ErrorDescription[0] + "-SHORT") ?? errorText; + shortError = errorDescriptions.GetString(ErrorDescription[0] + "_SHORT") ?? errorText; } catch (Exception) { diff --git a/ocaml/sdk-gen/csharp/README-NuGet.dist b/ocaml/sdk-gen/csharp/autogen/src/README-NuGet.md similarity index 74% rename from ocaml/sdk-gen/csharp/README-NuGet.dist rename to ocaml/sdk-gen/csharp/autogen/src/README-NuGet.md index 6994c933cab..47ccad8037b 100644 --- a/ocaml/sdk-gen/csharp/README-NuGet.dist +++ b/ocaml/sdk-gen/csharp/autogen/src/README-NuGet.md @@ -1,7 +1,6 @@ -XenServer.NET -============= +# XenServer.NET -Copyright (c) 2007-2023 Cloud Software Group, Inc. All Rights Reserved. +Copyright (c) 2007-2024 Cloud Software Group, Inc. All Rights Reserved. XenServer.NET is a complete SDK for XenServer, exposing the XenServer API as .NET classes. It is written in C#. @@ -15,8 +14,7 @@ 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. -Reference ---------- +## Reference For XenServer documentation see https://docs.xenserver.com @@ -30,25 +28,20 @@ A number of examples to help you get started with the SDK is available at https://github.com/xenserver/xenserver-samples For community content, blogs, and downloads, visit -https://www.xenserver.com/blogs and https://www.citrix.com/community/ +https://www.xenserver.com/blogs and https://www.citrix.com/community To network with other developers using XenServer visit -https://discussions.citrix.com/forum/101-hypervisor-formerly-xenserver/ +https://discussions.citrix.com/forum/101-hypervisor-formerly-xenserver -Prerequisites -------------- +## Prerequisites This library requires .NET Standard 2.0. -Dependencies ------------- +## 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. +- Newtonsoft JSON.NET by James Newton-King (see https://www.newtonsoft.com). + JSON.NET is licensed under the MIT license. \ No newline at end of file diff --git a/ocaml/sdk-gen/csharp/dune b/ocaml/sdk-gen/csharp/dune index 8a0ba5d6179..417dca4d4b1 100644 --- a/ocaml/sdk-gen/csharp/dune +++ b/ocaml/sdk-gen/csharp/dune @@ -22,6 +22,7 @@ mustache xapi-datamodel xmllight2 + str ) ) diff --git a/ocaml/sdk-gen/csharp/friendly_error_names.ml b/ocaml/sdk-gen/csharp/friendly_error_names.ml index 4fe041a298f..adad6f4feef 100644 --- a/ocaml/sdk-gen/csharp/friendly_error_names.ml +++ b/ocaml/sdk-gen/csharp/friendly_error_names.ml @@ -95,6 +95,7 @@ let parse_resx filename = let _ = let resx_file = "FriendlyErrorNames.resx" in + let designer_file = "FriendlyErrorNames.Designer.cs" in parse_resx resx_file ; parse_sr_xml sr_xml ; let errors = friendly_names_all Datamodel.errors in @@ -109,6 +110,12 @@ let _ = [ ("i18n_error_key", `String x) ; ("i18n_error_description", `String y) + ; ( "i8in_error_description_replace_newlines" + , `String + (Str.global_replace (Str.regexp_string "\n") + "\n /// " y + ) + ) ] ) errors @@ -116,4 +123,7 @@ let _ = ) ] in - render_file ("FriendlyErrorNames.mustache", resx_file) json templdir destdir + render_file ("FriendlyErrorNames.mustache", resx_file) json templdir destdir ; + render_file + ("FriendlyErrorNames.Designer.mustache", designer_file) + json templdir destdir diff --git a/ocaml/sdk-gen/csharp/templates/FriendlyErrorNames.Designer.mustache b/ocaml/sdk-gen/csharp/templates/FriendlyErrorNames.Designer.mustache new file mode 100644 index 00000000000..f73b3aa50d1 --- /dev/null +++ b/ocaml/sdk-gen/csharp/templates/FriendlyErrorNames.Designer.mustache @@ -0,0 +1,75 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace XenAPI { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + public class FriendlyErrorNames { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal FriendlyErrorNames() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("XenAPI.FriendlyErrorNames", typeof(FriendlyErrorNames).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + public static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + {{#i18n_errors}} + /// + /// Looks up a localized string similar to {{i8in_error_description_replace_newlines}}. + /// + public static string {{i18n_error_key}} { + get { + return ResourceManager.GetString("{{i18n_error_key}}", resourceCulture); + } + } + + {{/i18n_errors}} + } +} diff --git a/ocaml/sdk-gen/csharp/templates/XenServer.csproj.mustache b/ocaml/sdk-gen/csharp/templates/XenServer.csproj.mustache index 4006046d879..bf387509141 100644 --- a/ocaml/sdk-gen/csharp/templates/XenServer.csproj.mustache +++ b/ocaml/sdk-gen/csharp/templates/XenServer.csproj.mustache @@ -11,7 +11,7 @@ $(AssemblyName).NET $(AssemblyName).NET .NET wrapper for the XenServer API - Copyright (c) 2007-2023 Cloud Software Group, Inc. All Rights Reserved. + Copyright (c) 2007-2024 Cloud Software Group, Inc. All Rights Reserved. citrix hypervisor virtualization sdk jsonrpc .net c# xen xenserver BSD-2-Clause https://github.com/xapi-project/xen-api @@ -20,40 +20,26 @@ README-NuGet.md - - - - + true - - - False - .\lib\netstandard2.0\Newtonsoft.Json.CH.dll - - - - - False - .\lib\net45\Newtonsoft.Json.CH.dll - + + - True True + True FriendlyErrorNames.resx - Designer ResXFileCodeGenerator - XenAPI FriendlyErrorNames.Designer.cs diff --git a/ocaml/sdk-gen/powershell/README.dist b/ocaml/sdk-gen/powershell/README.dist deleted file mode 100644 index e343f9778a8..00000000000 --- a/ocaml/sdk-gen/powershell/README.dist +++ /dev/null @@ -1,171 +0,0 @@ -XenServer PowerShell Module -=========================== - -Copyright (c) 2013-2023 Cloud Software Group, Inc. All Rights Reserved. - -The XenServer PowerShell Module is a complete SDK for XenServer, -exposing the XenServer API as Windows PowerShell cmdlets. - -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. - -This module is free software. You can redistribute and modify it under the -terms of the BSD 2-Clause license. See LICENSE.txt for details. - - -Reference ---------- - -For XenServer documentation see https://docs.xenserver.com - -The XenServer Management API Reference is available at -https://docs.xenserver.com/en-us/xenserver/8/developer/management-api - -The XenServer Software Development Kit Guide is available at -https://docs.xenserver.com/en-us/xenserver/8/developer/sdk-guide - -A number of examples to help you get started with the SDK is available at -https://github.com/xenserver/xenserver-samples - -For community content, blogs, and downloads, visit -https://www.xenserver.com/blogs and https://www.citrix.com/community/ - -To network with other developers using XenServer visit -https://discussions.citrix.com/forum/101-hypervisor-formerly-xenserver/ - - -Prerequisites -------------- - -This library requires .NET 6.0 and PowerShell 7.2 or greater. - - -Dependencies ------------- - -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 XenServer PowerShell Module. - -- XenServer.NET by Cloud Software Group, Inc. - XenServer.NET is a complete SDK for XenServer, exposing the XenServer - API as .NET classes. It is written in C#. - - -Folder Structure ----------------- - -This archive contains the following folders that are relevant to PowerShell users: - -- XenServerPowerShell\XenServerPSModule: this is the XenServer PowerShell - Module -- XenServerPowerShell\src: contains the C# source code for the XenServer - cmdlets shipped as a Visual Studio project. - - -Getting Started ---------------- - -1. Extract the contents of this archive. - - Note that some web browsers may mark the SDK ZIP file as "blocked" during - the download. To import the module successfully you will need to unblock the - archive before extracting its contents. To unblock the archive, right-click - on it and launch the Properties dialog. Click the Unblock button, then the - Apply or OK button. - -2. Navigate to the extracted XenServerPowerShell directory and copy the whole - folder XenServerPSModule into your PowerShell modules directory. - - - On Windows this will normally be $env:UserProfile\Documents\PowerShell\Modules - for per-user configuration, or $env:ProgramFiles\PowerShell\7\Modules for - system-wide configuration (note that $env:ProgramFiles\WindowsPowerShell\Modules - is also acceptable). - - - On Linux this will be ~/.local/share/powershell/Modules for per-user - configuration, or /usr/local/share/powershell/Modules for system-wide - configuration. - - For more information see PowerShell's documentation on module paths: - - PS> Get-Help about_PSModulePath - -3. Open a PowerShell 7 prompt as administrator. - - To do this, open the Windows Start menu by clicking the Start icon, find - the item PowerShell 7, right click it and select Run as administrator. - -4. Determine the current execution policy: - - PS> Get-ExecutionPolicy - - If the current policy is Restricted, you need to set it to RemoteSigned: - - PS> Set-ExecutionPolicy RemoteSigned - - You should understand the security implications of this change. If you are - unsure, see PowerShell's documentation on execution policies: - - PS> Get-Help about_Execution_Policies - - If the current policy is AllSigned, you will be able to use the XenServer - PowerShell module, but it will be inconvenient because this policy requires - even scripts that you write on the local computer to be signed. You may want - to change it to RemoteSigned, as above. - - If the current policy is RemoteSigned, ByPass, or Unrestricted there is - nothing to do. - -5. Exit the privileged instance of PowerShell. - -6. Open a PowerShell 7 prompt as a regular user (click Start > PowerShell 7) - and import the XenServer PowerShell Module: - - PS> Import-Module XenServerPSModule - -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 the folder containing your $PROFILE file for per-user configuration, or - in $PSHOME for system-wide configuration. - - - On Windows these will normally be $env:UserProfile\Documents\PowerShell - for per-user configuration, or $env:ProgramFiles\PowerShell\7 for - system-wide configuration. - - - On Linux these will be ~/.config/powershell for per-user configuration, - or /opt/microsoft/powershell/7 for system-wide configuration. - -8. For an overview of the XenServer PowerShell Module type: - - PS> Get-Help about_XenServer - - You can obtain a list of all available cmdlets by typing: - - PS> Get-Command -Module XenServerPSModule - - For help with a specific command use: - - PS> Get-Help [CommandName] - -9. Here is a quick example of opening a session and making a call to a server: - - PS> Connect-XenServer -Url https:// - PS> Get-XenVM - PS> Disconnect-XenServer - - -Building and Debugging the Source Code --------------------------------------- - -1. Open the project XenServerPowerShell.csproj in Visual Studio 2022. You should - now be ready to build the source code. - -2. If in Debug mode, clicking Start will launch a PowerShell 7 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/README_51.dist b/ocaml/sdk-gen/powershell/README_51.dist deleted file mode 100644 index 5806368881c..00000000000 --- a/ocaml/sdk-gen/powershell/README_51.dist +++ /dev/null @@ -1,163 +0,0 @@ -XenServer PowerShell Module -=========================== - -Copyright (c) 2013-2023 Cloud Software Group, Inc. All Rights Reserved. - -The XenServer PowerShell Module is a complete SDK for XenServer, -exposing the XenServer API as Windows PowerShell cmdlets. - -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. - -This module is free software. You can redistribute and modify it under the -terms of the BSD 2-Clause license. See LICENSE.txt for details. - - -Reference ---------- - -For XenServer documentation see https://docs.xenserver.com - -The XenServer Management API Reference is available at -https://docs.xenserver.com/en-us/xenserver/8/developer/management-api - -The XenServer Software Development Kit Guide is available at -https://docs.xenserver.com/en-us/xenserver/8/developer/sdk-guide - -A number of examples to help you get started with the SDK is available at -https://github.com/xenserver/xenserver-samples - -For community content, blogs, and downloads, visit -https://www.xenserver.com/blogs and https://www.citrix.com/community/ - -To network with other developers using XenServer visit -https://discussions.citrix.com/forum/101-hypervisor-formerly-xenserver/ - - -Prerequisites -------------- - -This library requires .NET Framework 4.5 or greater and PowerShell 5.1 or greater. - - -Dependencies ------------- - -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 XenServer PowerShell Module. - -- XenServer.NET by Cloud Software Group, Inc. - XenServer.NET is a complete SDK for XenServer, exposing the XenServer - API as .NET classes. It is written in C#. - - -Folder Structure ----------------- - -This archive contains the following folders that are relevant to PowerShell users: - -- XenServerPowerShell\XenServerPSModule: this is the XenServer PowerShell - Module -- XenServerPowerShell\src: contains the C# source code for the XenServer - cmdlets shipped as a Visual Studio project. - - -Getting Started ---------------- - -1. Extract the contents of this archive. - - Note that some web browsers may mark the SDK ZIP file as "blocked" during - the download. To import the module successfully you will need to unblock the - archive before extracting its contents. To unblock the archive, right-click - on it and launch the Properties dialog. Click the Unblock button, then the - Apply or OK button. - -2. Navigate to the extracted XenServerPowerShell directory and copy the whole - folder XenServerPSModule into your PowerShell modules directory. - - - On Windows this will normally be $env:UserProfile\Documents\WindowsPowerShell\Modules - for per-user configuration, or $env:windir\system32\WindowsPowerShell\v1.0\Modules for - system-wide configuration. - - For more information see PowerShell's documentation on module paths: - - PS> Get-Help about_PSModulePath - -3. Open a PowerShell prompt as administrator. - - To do this, open the Windows Start menu by clicking the Start icon, find - the item PowerShell, right click it and select Run as administrator. - -4. Determine the current execution policy: - - PS> Get-ExecutionPolicy - - If the current policy is Restricted, you need to set it to RemoteSigned: - - PS> Set-ExecutionPolicy RemoteSigned - - You should understand the security implications of this change. If you are - unsure, see PowerShell's documentation on execution policies: - - PS> Get-Help about_Execution_Policies - - If the current policy is AllSigned, you will be able to use the XenServer - PowerShell module, but it will be inconvenient because this policy requires - even scripts that you write on the local computer to be signed. You may want - to change it to RemoteSigned, as above. - - If the current policy is RemoteSigned, ByPass, or Unrestricted there is - nothing to do. - -5. Exit the privileged instance of PowerShell. - -6. Open a PowerShell prompt as a regular user (click Start > PowerShell) - and import the XenServer PowerShell Module: - - PS> Import-Module XenServerPSModule - -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 the folder containing your $PROFILE file for per-user configuration, or - in $PSHOME for system-wide configuration. - - - On Windows these will normally be $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 XenServer PowerShell Module type: - - PS> Get-Help about_XenServer - - You can obtain a list of all available cmdlets by typing: - - PS> Get-Command -Module XenServerPSModule - - For help with a specific command use: - - PS> Get-Help [CommandName] - -9. Here is a quick example of opening a session and making a call to a server: - - PS> Connect-XenServer -Url https:// - PS> Get-XenVM - PS> Disconnect-XenServer - - -Building and Debugging the Source Code --------------------------------------- - -1. Open the project XenServerPowerShell.csproj in Visual Studio 2022. You should - now be ready to build the source code. - -2. 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/.gitignore b/ocaml/sdk-gen/powershell/autogen/.gitignore new file mode 100644 index 00000000000..f6a6481aa75 --- /dev/null +++ b/ocaml/sdk-gen/powershell/autogen/.gitignore @@ -0,0 +1,434 @@ +# Created by https://www.toptal.com/developers/gitignore/api/visualstudio,visualstudiocode,dotnetcore,powershell +# Edit at https://www.toptal.com/developers/gitignore?templates=visualstudio,visualstudiocode,dotnetcore,powershell + +### DotnetCore ### +# .NET Core build folders +bin/ +obj/ + +# Common node modules locations +/node_modules +/wwwroot/node_modules + +### PowerShell ### +# Exclude packaged modules +*.zip + +# Exclude .NET assemblies from source +*.dll + +### VisualStudioCode ### +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.vscode/*.code-snippets + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +### VisualStudioCode Patch ### +# Ignore all local history of files +.history +.ionide + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.tlog +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio 6 auto-generated project file (contains which files were open etc.) +*.vbp + +# Visual Studio 6 workspace and project file (working project files containing files to include in project) +*.dsw +*.dsp + +# Visual Studio 6 technical files + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# Visual Studio History (VSHistory) files +.vshistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +# VS Code files for those working on multiple tools +*.code-workspace + +# Local History for Visual Studio Code + +# Windows Installer files from build outputs +*.cab +*.msi +*.msix +*.msm +*.msp + +# JetBrains Rider +*.sln.iml + +### VisualStudio Patch ### +# Additional files built by Visual Studio + +# End of https://www.toptal.com/developers/gitignore/api/visualstudio,visualstudiocode,dotnetcore,powershell \ No newline at end of file diff --git a/ocaml/sdk-gen/powershell/autogen/README.md b/ocaml/sdk-gen/powershell/autogen/README.md new file mode 100644 index 00000000000..cbe06791bad --- /dev/null +++ b/ocaml/sdk-gen/powershell/autogen/README.md @@ -0,0 +1,172 @@ +# XenServer PowerShell Module + +Copyright (c) 2013-2024 Cloud Software Group, Inc. All Rights Reserved. + +The XenServer PowerShell Module is a complete SDK for XenServer, +exposing the XenServer API as Windows PowerShell cmdlets. + +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. + +This module is free software. You can redistribute and modify it under the +terms of the BSD 2-Clause license. See LICENSE.txt for details. + +## Reference + +For XenServer documentation see + +The XenServer Management API Reference is available at + + +The XenServer Software Development Kit Guide is available at + + +A number of examples to help you get started with the SDK is available at + + +For community content, blogs, and downloads, visit + and + +To network with other developers using XenServer visit + + +## Prerequisites + +This library requires .NET 6.0 and PowerShell 7.2 or greater. + +## Dependencies + +The XenServer PowerShell Module is dependent upon the following libraries: + +- Newtonsoft JSON.NET by James Newton-King (see ). + JSON.NET is licensed under the MIT license. + +- XenServer.NET by Cloud Software Group, Inc. + XenServer.NET is a complete SDK for XenServer, exposing the XenServer + API as .NET classes. It is written in C#. + +## Folder Structure + +This archive contains the following folders that are relevant to PowerShell users: + +- `XenServerPowerShell\XenServerPSModule`: this is the XenServer PowerShell + Module +- `XenServerPowerShell\src`: contains the C# source code for the XenServer + cmdlets shipped as a Visual Studio project. + +## Getting Started + +1. Extract the contents of this archive. + + Note that some web browsers may mark the SDK ZIP file as "blocked" during + the download. To import the module successfully you will need to unblock the + archive before extracting its contents. To unblock the archive, right-click + on it and launch the Properties dialog. Click the Unblock button, then the + Apply or OK button. + +2. Navigate to the extracted XenServerPowerShell directory and copy the whole + folder XenServerPSModule into your PowerShell modules directory. + + - On Windows this will normally be `$env:UserProfile\Documents\PowerShell\Modules` + for per-user configuration, or `$env:ProgramFiles\PowerShell\7\Modules` for + system-wide configuration (note that `$env:ProgramFiles\WindowsPowerShell\Modules` + is also acceptable). + + - On Linux this will be `~/.local/share/powershell/Modules` for per-user + configuration, or `/usr/local/share/powershell/Modules` for system-wide + configuration. + + For more information see PowerShell's documentation on module paths: + + PS> Get-Help about_PSModulePath + +3. Open a PowerShell 7 prompt as administrator. + + To do this, open the Windows Start menu by clicking the Start icon, find + the item PowerShell 7, right click it and select Run as administrator. + +4. Determine the current execution policy: + +```ps + PS> Get-ExecutionPolicy +``` + + If the current policy is Restricted, you need to set it to `RemoteSigned`: + +```ps + PS> Set-ExecutionPolicy RemoteSigned +``` + + You should understand the security implications of this change. If you are + unsure, see PowerShell's documentation on execution policies: + +```ps + PS> Get-Help about_Execution_Policies +``` + + If the current policy is AllSigned, you will be able to use the XenServer + PowerShell module, but it will be inconvenient because this policy requires + even scripts that you write on the local computer to be signed. You may want + to change it to `RemoteSigned`, as above. + + If the current policy is `RemoteSigned`, `ByPass`, or `Unrestricted` there is + nothing to do. + +5. Exit the privileged instance of PowerShell. + +6. Open a PowerShell 7 prompt as a regular user (click Start > PowerShell 7) + and import the XenServer PowerShell Module: + +```ps + PS> Import-Module XenServerPSModule +``` + +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 the folder containing your `$PROFILE` file for per-user configuration, or + in `$PSHOME` for system-wide configuration. + + - On Windows these will normally be `$env:UserProfile\Documents\PowerShell` + for per-user configuration, or `$env:ProgramFiles\PowerShell\7` for + system-wide configuration. + + - On Linux these will be `~/.config/powershell` for per-user configuration, + or `/opt/microsoft/powershell/7` for system-wide configuration. + +8. For an overview of the XenServer PowerShell Module type: + +```ps + PS> Get-Help about_XenServer +``` + + You can obtain a list of all available cmdlets by typing: + +```ps + PS> Get-Command -Module XenServerPSModule +``` + + For help with a specific command use: + +```ps + PS> Get-Help [CommandName] +``` + +9. Here is a quick example of opening a session and making a call to a server: + +```ps + PS> Connect-XenServer -Url https:// + PS> Get-XenVM + PS> Disconnect-XenServer +``` + +## Building and Debugging the Source Code + +1. Open the project `XenServerPowerShell.csproj` in Visual Studio 2022. You should + now be ready to build the source code. + +2. If in Debug mode, clicking Start will launch a PowerShell 7 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/README_51.md b/ocaml/sdk-gen/powershell/autogen/README_51.md new file mode 100644 index 00000000000..8088982ff47 --- /dev/null +++ b/ocaml/sdk-gen/powershell/autogen/README_51.md @@ -0,0 +1,164 @@ +# XenServer PowerShell Module + +Copyright (c) 2013-2024 Cloud Software Group, Inc. All Rights Reserved. + +The XenServer PowerShell Module is a complete SDK for XenServer, +exposing the XenServer API as Windows PowerShell cmdlets. + +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. + +This module is free software. You can redistribute and modify it under the +terms of the BSD 2-Clause license. See LICENSE.txt for details. + +## Reference + +For XenServer documentation see + +The XenServer Management API Reference is available at + + +The XenServer Software Development Kit Guide is available at + + +A number of examples to help you get started with the SDK is available at + + +For community content, blogs, and downloads, visit + and + +To network with other developers using XenServer visit + + +## Prerequisites + +This library requires .NET Framework 4.5 or greater and PowerShell 5.1 or greater. + +## Dependencies + +The XenServer PowerShell Module is dependent upon the following libraries: + +- Newtonsoft JSON.NET by James Newton-King (see ). + JSON.NET is licensed under the MIT license. + +- XenServer.NET by Cloud Software Group, Inc. + XenServer.NET is a complete SDK for XenServer, exposing the XenServer + API as .NET classes. It is written in C#. + +## Folder Structure + +This archive contains the following folders that are relevant to PowerShell users: + +- `XenServerPowerShell\XenServerPSModule`: this is the XenServer PowerShell + Module +- `XenServerPowerShell\src`: contains the C# source code for the XenServer + cmdlets shipped as a Visual Studio project. + +## Getting Started + +1. Extract the contents of this archive. + + Note that some web browsers may mark the SDK ZIP file as "blocked" during + the download. To import the module successfully you will need to unblock the + archive before extracting its contents. To unblock the archive, right-click + on it and launch the Properties dialog. Click the Unblock button, then the + Apply or OK button. + +2. Navigate to the extracted XenServerPowerShell directory and copy the whole + folder XenServerPSModule into your PowerShell modules directory. + + - On Windows this will normally be `$env:UserProfile\Documents\WindowsPowerShell\Modules` + for per-user configuration, or `$env:windir\system32\WindowsPowerShell\v1.0\Modules` for + system-wide configuration. + + For more information see PowerShell's documentation on module paths: + + PS> Get-Help about_PSModulePath + +3. Open a PowerShell 5.1 prompt as administrator. + + To do this, open the Windows Start menu by clicking the Start icon, find + the item PowerShell 5.1, right click it and select Run as administrator. + +4. Determine the current execution policy: + +```ps + PS> Get-ExecutionPolicy +``` + + If the current policy is Restricted, you need to set it to `RemoteSigned`: + +```ps + PS> Set-ExecutionPolicy RemoteSigned +``` + + You should understand the security implications of this change. If you are + unsure, see PowerShell's documentation on execution policies: + +```ps + PS> Get-Help about_Execution_Policies +``` + + If the current policy is AllSigned, you will be able to use the XenServer + PowerShell module, but it will be inconvenient because this policy requires + even scripts that you write on the local computer to be signed. You may want + to change it to `RemoteSigned`, as above. + + If the current policy is `RemoteSigned`, `ByPass`, or `Unrestricted` there is + nothing to do. + +5. Exit the privileged instance of PowerShell. + +6. Open a PowerShell 5.1 prompt as a regular user (click Start > PowerShell) + and import the XenServer PowerShell Module: + +```ps + PS> Import-Module XenServerPSModule +``` + +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 the folder containing your `$PROFILE` file for per-user configuration, or + in `$PSHOME` for system-wide configuration. + + - On Windows these will normally be `$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 XenServer PowerShell Module type: + +```ps + PS> Get-Help about_XenServer +``` + + You can obtain a list of all available cmdlets by typing: + +```ps + PS> Get-Command -Module XenServerPSModule +``` + + For help with a specific command use: + +```ps + PS> Get-Help [CommandName] +``` + +9. Here is a quick example of opening a session and making a call to a server: + +```ps + PS> Connect-XenServer -Url https:// + PS> Get-XenVM + PS> Disconnect-XenServer +``` + +## Building and Debugging the Source Code + +1. Open the project `XenServerPowerShell.csproj` in Visual Studio 2022. You should + now be ready to build the source code. + +2. 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/XenServerPSModule.psd1 b/ocaml/sdk-gen/powershell/autogen/XenServerPSModule.psd1 index 153595f4afe..87edaa0214f 100644 --- a/ocaml/sdk-gen/powershell/autogen/XenServerPSModule.psd1 +++ b/ocaml/sdk-gen/powershell/autogen/XenServerPSModule.psd1 @@ -37,7 +37,7 @@ GUID = 'D695A8B9-039A-443C-99A4-0D48D7C6AD76' #Copyright Author = '' CompanyName = 'Cloud Software Group, Inc' -Copyright = 'Copyright (c) 2013-2023 Cloud Software Group, Inc. All rights reserved.' +Copyright = 'Copyright (c) 2013-2024 Cloud Software Group, Inc. All rights reserved.' # Requirements PowerShellVersion = '@PS_VERSION@' @@ -49,17 +49,16 @@ ProcessorArchitecture = 'None' RootModule = 'XenServerPowerShell.dll' RequiredModules = @() NestedModules = @() -RequiredAssemblies = @('Newtonsoft.Json.CH.dll', +RequiredAssemblies = @('Newtonsoft.Json.dll', 'XenServer.dll') ScriptsToProcess = @('Initialize-Environment.ps1') TypesToProcess = @('XenServer.types.ps1xml') FormatsToProcess = @('XenServer.format.ps1xml') FileList = @('about_XenServer.help.txt', - 'Newtonsoft.Json.CH.dll', + 'Newtonsoft.Json.dll', 'Initialize-Environment.ps1', - 'LICENSE.Newtonsoft.Json.txt', - 'LICENSE.txt', - 'README.txt', + 'LICENSE', + 'README.md', 'XenServer.dll', 'XenServer.format.ps1xml', 'XenServer.types.ps1xml', diff --git a/ocaml/sdk-gen/powershell/autogen/dune b/ocaml/sdk-gen/powershell/autogen/dune index 96bedf2fd99..56eb4c8480a 100644 --- a/ocaml/sdk-gen/powershell/autogen/dune +++ b/ocaml/sdk-gen/powershell/autogen/dune @@ -1,34 +1,15 @@ (rule - (targets LICENSE.txt) + (targets LICENSE) (deps ../../LICENSE ) (action (copy %{deps} %{targets})) ) -(rule - (targets README.txt) - (deps - ../README.dist - ) - (action (copy %{deps} %{targets})) -) - -(rule - (targets README_51.txt) - (deps - ../README_51.dist - ) - (action (copy %{deps} %{targets})) -) - (alias (name generate) (deps - LICENSE.txt - README.txt - README_51.txt + LICENSE (source_tree .) ) ) - diff --git a/ocaml/sdk-gen/powershell/templates/XenServerPowerShell.csproj.mustache b/ocaml/sdk-gen/powershell/autogen/src/XenServerPowerShell.csproj similarity index 73% rename from ocaml/sdk-gen/powershell/templates/XenServerPowerShell.csproj.mustache rename to ocaml/sdk-gen/powershell/autogen/src/XenServerPowerShell.csproj index 17498994073..85ea0dc72b4 100644 --- a/ocaml/sdk-gen/powershell/templates/XenServerPowerShell.csproj.mustache +++ b/ocaml/sdk-gen/powershell/autogen/src/XenServerPowerShell.csproj @@ -1,10 +1,14 @@ 0.0.0 - net6.0;net45 + net8.0;net6.0;net45 Library True + + + true + True Program @@ -17,8 +21,11 @@ C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoLogo -NoExit -Command "Import-Module '.\XenServerPowerShell.dll'" + + + - + @@ -27,9 +34,7 @@ - - False - .\XenServer.dll - + + diff --git a/ocaml/sdk-gen/powershell/gen_powershell_binding.ml b/ocaml/sdk-gen/powershell/gen_powershell_binding.ml index 2701e190767..2e1fb55e5fb 100644 --- a/ocaml/sdk-gen/powershell/gen_powershell_binding.ml +++ b/ocaml/sdk-gen/powershell/gen_powershell_binding.ml @@ -79,21 +79,7 @@ let rec main () = |> List.map gen_http_action in let all_cmdlets = cmdlets @ http_cmdlets in - List.iter (fun x -> write_file x.filename x.content) all_cmdlets ; - - let fnames = all_cmdlets |> List.map (fun x -> x.filename) in - let sorted_members = List.sort String.compare fnames in - let json = - `O - [ - ( "cmdlets" - , `A (List.map (fun x -> `O [("cmdlet", `String x)]) sorted_members) - ) - ] - in - render_file - ("XenServerPowerShell.csproj.mustache", "XenServerPowerShell.csproj") - json templdir destdir + List.iter (fun x -> write_file x.filename x.content) all_cmdlets (****************) (* Http actions *)