Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ocaml/idl/datamodel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11037,7 +11037,7 @@ let http_actions =
; ( "get_vm_rrds"
, ( Get
, "/vm_rrds"
, true
, false
, [String_query_arg "uuid"; Bool_query_arg "json"]
, _R_READ_ONLY
, []
Expand All @@ -11054,7 +11054,7 @@ let http_actions =
)
(* For XC < 8460 compatibility, remove when out of support *)
; ( "get_host_rrds"
, (Get, "/host_rrds", true, [Bool_query_arg "json"], _R_READ_ONLY, [])
, (Get, "/host_rrds", false, [Bool_query_arg "json"], _R_READ_ONLY, [])
)
; ( Constants.get_sr_rrd
, ( Get
Expand Down
8 changes: 4 additions & 4 deletions ocaml/sdk-gen/c/README.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
libxenserver
============

Copyright (c) 2007-2025 Cloud Software Group, Inc. All Rights Reserved.
Copyright (c) 2007-2026 Cloud Software Group, Inc. All Rights Reserved.

libxenserver is a complete SDK for XenServer exposing the XenServer API to
C developers.
Expand All @@ -20,10 +20,10 @@ 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
https://docs.xenserver.com/en-us/xenserver/developer/api-reference

The XenServer Software Development Kit Guide is available at
https://docs.xenserver.com/en-us/xenserver/8/developer/sdk-guide
https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide

A number of examples to help you get started with the SDK is available at
https://github.com/xenserver/xenserver-samples
Expand All @@ -32,7 +32,7 @@ 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/
https://community.citrix.com/forums/forum/1118-xenserver-sdk/


Dependencies
Expand Down
2 changes: 1 addition & 1 deletion ocaml/sdk-gen/csharp/FriendlyErrorNames.resx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<value>The GPU group contains active virtual GPUs and cannot be deleted.</value>
</data>
<data name="HANDLE_INVALID" xml:space="preserve">
<value>Object has been deleted.{0}:{1}</value>
<value>Could not find the specified object. If it existed before, it may have recently been deleted. {0} {1}</value>
</data>
<data name="HA_CONSTRAINT_VIOLATION_NETWORK_NOT_SHARED" xml:space="preserve">
<value>This operation cannot be performed because the referenced network is not properly shared. The network must either be entirely virtual or must be physically present via a currently attached PIF on every server.</value>
Expand Down
10 changes: 5 additions & 5 deletions ocaml/sdk-gen/csharp/autogen/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# XenServer.NET

Copyright (c) 2007-2025 Cloud Software Group, Inc. All Rights Reserved.
Copyright (c) 2007-2026 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#.
Expand All @@ -18,10 +18,10 @@ terms of the BSD 2-Clause license. See LICENSE.txt for details.
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>
<https://docs.xenserver.com/en-us/xenserver/developer/api-reference>

The XenServer Software Development Kit Guide is available at
<https://docs.xenserver.com/en-us/xenserver/8/developer/sdk-guide>
<https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide>

A number of examples to help you get started with the SDK is available at
<https://github.com/xenserver/xenserver-samples>
Expand All @@ -30,11 +30,11 @@ 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>
<https://community.citrix.com/forums/forum/1118-xenserver-sdk/>

## Prerequisites

This library requires .NET Standard 2.0.
This library targets .NET Framework 4.6.2, .NET Standard 2.0, and .NET 8.0.

## Dependencies

Expand Down
16 changes: 0 additions & 16 deletions ocaml/sdk-gen/csharp/autogen/src/Event.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ public override void UpdateFrom(Event update)
id = update.id;
}

[Obsolete("Use the calls setting individual fields of the API object instead.")]
public override string SaveChanges(Session session, string opaqueRef, Event serverObject)
{
if (opaqueRef == null)
{
throw new InvalidOperationException("There is no constructor available for this type; you cannot directly create one on the server.");
}

Event server = serverObject;

if (!_id.Equals(server._id))
set_id(session, opaqueRef, _id);

return null;
}

public static Event get_record(Session session, string _event)
{
return session.JsonRpcClient.event_get_record(session.opaque_ref, _event);
Expand Down
48 changes: 38 additions & 10 deletions ocaml/sdk-gen/csharp/autogen/src/HTTP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,21 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
[Serializable]
public class BadServerResponseException : Exception
{
public int StatusCode { get; }
public string InitialLine { get; }
public string Body { get; }

public BadServerResponseException() { }

public BadServerResponseException(string message) : base(message) { }

public BadServerResponseException(string message, int statusCode, string initialLine, string body) : base(message)
{
StatusCode = statusCode;
InitialLine = initialLine;
Body = body;
}

public BadServerResponseException(string message, Exception exception) : base(message, exception) { }

#if !(NET8_0_OR_GREATER)
Expand Down Expand Up @@ -195,11 +206,16 @@ private static string ReadLine(Stream stream)
private static bool ReadHttpHeaders(ref Stream stream, IWebProxy proxy, bool nodelay, int timeout_ms, List<string> headers = null)
{
// read headers/fields
string line = ReadLine(stream), initialLine = line, transferEncodingField = null;
string line = ReadLine(stream);
string initialLine = line;
string transferEncodingField = null;

if (string.IsNullOrEmpty(initialLine)) // sanity check
return false;

if (headers == null)
headers = new List<string>();

while (!string.IsNullOrWhiteSpace(line)) // IsNullOrWhiteSpace also checks for empty string
{
line = line.TrimEnd('\r', '\n');
Expand All @@ -211,6 +227,7 @@ private static bool ReadHttpHeaders(ref Stream stream, IWebProxy proxy, bool nod

// read chunks
string entityBody = "";

if (!string.IsNullOrEmpty(transferEncodingField))
{
int lastChunkSize = -1;
Expand Down Expand Up @@ -246,13 +263,9 @@ private static bool ReadHttpHeaders(ref Stream stream, IWebProxy proxy, bool nod
entityBody = entityBody.TrimEnd('\r', '\n');
headers.Add(entityBody); // keep entityBody if it's needed for Digest authentication (when qop="auth-int")
}
else
{
// todo: handle other transfer types, in case "Transfer-Encoding: Chunked" isn't used
}

// handle server response
int code = getResultCode(initialLine);
int code = GetResultCode(initialLine);
switch (code)
{
case 407: // authentication error; caller must handle this case
Expand All @@ -268,17 +281,32 @@ private static bool ReadHttpHeaders(ref Stream stream, IWebProxy proxy, bool nod
return true; // headers need to be sent again

default:
var contentLengthHeader = headers
.FirstOrDefault(h => h.StartsWith("Content-Length:", StringComparison.InvariantCultureIgnoreCase));

if (contentLengthHeader != null && int.TryParse(contentLengthHeader.Substring(15).Trim(), out var len))
{
byte[] bytes = new byte[len];
int total = 0;
int read;

while (total < len && (read = stream.Read(bytes, total, len - total)) > 0)
total += read;

entityBody = Encoding.ASCII.GetString(bytes);
}

stream.Close();
throw new BadServerResponseException(string.Format("Received error code {0} from the server", initialLine));
throw new BadServerResponseException(string.Format("Received error code {0} from the server", initialLine), code, initialLine, entityBody);
}

return false;
}

private static int getResultCode(string line)
private static int GetResultCode(string line)
{
string[] bits = line.Split(' ');
return (bits.Length < 2 ? 0 : Int32.Parse(bits[1]));
return bits.Length < 2 ? 0 : Int32.Parse(bits[1]);
}

public static bool UseSSL(Uri uri)
Expand Down Expand Up @@ -651,7 +679,7 @@ private static void AuthenticateProxy(ref Stream stream, Uri uri, IWebProxy prox
if (authenticatedResponse.Count == 0)
throw new BadServerResponseException("No response from the proxy server after authentication attempt.");

switch (getResultCode(authenticatedResponse[0]))
switch (GetResultCode(authenticatedResponse[0]))
{
case 200:
break;
Expand Down
17 changes: 14 additions & 3 deletions ocaml/sdk-gen/csharp/autogen/src/JsonRpc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ public override string ToString()
public partial class JsonRpcClient
{
private int _globalId;
private string _userAgent;

#if (NET8_0_OR_GREATER)
private static readonly Type ClassType = typeof(JsonRpcClient);
Expand Down Expand Up @@ -205,6 +206,10 @@ public JsonRpcClient(string baseUrl)
Url = baseUrl;
JsonRpcUrl = new Uri(new Uri(baseUrl), "/jsonrpc").ToString();
JsonRpcVersion = JsonRpcVersion.v1;
Timeout = Session.STANDARD_TIMEOUT;
UserAgent = Session.DefaultUserAgent;
KeepAlive = true;
AllowAutoRedirect = true;
}

/// <summary>
Expand All @@ -215,7 +220,13 @@ public JsonRpcClient(string baseUrl)
public event Action<string> RequestEvent;

public JsonRpcVersion JsonRpcVersion { get; set; }
public string UserAgent { get; set; }

public string UserAgent
{
get => _userAgent;
set => _userAgent = string.IsNullOrEmpty(value) ? Session.DefaultUserAgent : value;
}

public bool KeepAlive { get; set; }
public IWebProxy WebProxy { get; set; }
public int Timeout { get; set; }
Expand All @@ -239,7 +250,7 @@ public JsonRpcClient(string baseUrl)

public string JsonRpcUrl { get; private set; }

private void Rpc(string callName, JToken parameters, JsonSerializer serializer)
protected void Rpc(string callName, JToken parameters, JsonSerializer serializer)
{
Rpc<object>(callName, parameters, serializer);
}
Expand Down Expand Up @@ -516,7 +527,7 @@ private JsonSerializerSettings CreateSettings(IList<JsonConverter> converters)
};
}

private JsonSerializer CreateSerializer(IList<JsonConverter> converters)
protected JsonSerializer CreateSerializer(IList<JsonConverter> converters)
{
var settings = CreateSettings(converters);
return JsonSerializer.Create(settings);
Expand Down
21 changes: 9 additions & 12 deletions ocaml/sdk-gen/csharp/autogen/src/README-NuGet.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# XenServer.NET

Copyright (c) 2007-2025 Cloud Software Group, Inc. All Rights Reserved.
Copyright (c) 2007-2026 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#.
Expand All @@ -13,35 +13,32 @@ 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

For XenServer documentation see https://docs.xenserver.com
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
<https://docs.xenserver.com/en-us/xenserver/developer/api-reference>

The XenServer Software Development Kit Guide is available at
https://docs.xenserver.com/en-us/xenserver/8/developer/sdk-guide
<https://docs.xenserver.com/en-us/xenserver/developer/sdk-guide>

A number of examples to help you get started with the SDK is available at
https://github.com/xenserver/xenserver-samples
<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://community.citrix.com/forums/forum/1118-xenserver-sdk/>

## Prerequisites

This library requires .NET Standard 2.0.

This library targets .NET Framework 4.6.2, .NET Standard 2.0, and .NET 8.0.

## Dependencies

XenServer.NET is dependent upon the following libraries:

- Newtonsoft JSON.NET by James Newton-King (see https://www.newtonsoft.com).
- Newtonsoft JSON.NET by James Newton-King (see <https://www.newtonsoft.com>).
JSON.NET is licensed under the MIT license.
Loading
Loading