ovh / csharp-ovh Goto Github PK
View Code? Open in Web Editor NEWThin wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing
License: Other
Thin wrapper around OVH's APIs. Handles all the hard work including credential creation and requests signing
License: Other
Everything's in the title, simply delete them
Hello,
is there any option to change the provider inside the code without declaring a new client?
"Client client = new Client("stringprovider")"
works.
However, "client.Endpoint = "ovh-eu"" for example does not work?
Best regards
Currently, to send an object as the data, it is mandatory to use the <T,Y> override, which isn't providing anything useful.
Using and passing an object without type checking would be way simpler, and allows to give anonymous objects to simplifies PUT calls (partial payloads)
Timeout param currently works in a strange way.
Ovh.Client._httpClient
is static and instantiated at the first construction of an Ovh.Client
.
During that first instantiation, _httpClient.Timeout
is set to Ovh.Client
constuctor's timeout param.
It means that during subsequent instantiations, the timeout
param is effectively ignore.
CredentialRequestResult credentialRequestResult = client.RequestConsumerKey(requestPayload);
seems to be obsolete? I'm trying to get the consumer key but "RequestConsumerKey" seems like it does not exist.
This would override the Ovh.Client.Timeout
param for that specific call
I'm trying to use this library with .NET Core 3.1 but all the calls throw the following exception:
Cannot deserialize the current JSON object (e.g. {"name":"value"}) into type 'System.Int64' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.
To fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
at Ovh.Api.Client.CallAsync[T](String method, String path, String data, Boolean needAuth, Boolean isBatch, Nullable`1 timeout)
at Ovh.Api.Client.ComputeTimeDelta()
at Ovh.Api.Client.GetTimeDelta()
at Ovh.Api.Client.SetHeaders(HttpRequestMessage msg, String method, String target, String data, Boolean needAuth, Boolean isBatch)
at Ovh.Api.Client.CallAsync(String method, String path, String data, Boolean needAuth, Boolean isBatch, Nullable`1 timeout)
at Ovh.Api.Client.CallAsync[T](String method, String path, String data, Boolean needAuth, Boolean isBatch, Nullable`1 timeout)
Right from the start , the documentation says :
CredentialRequest requestPayload = new CredentialRequest(
new List<AccessRight>(){
new AccessRight("GET", "/me"),
}
);
This method takes 2 parameters.
Goal: achieve some mechanism that would fetch an array from a route ("/route/thing") and then issue automatic calls to "/route/thing/", enabling code like this:
foreach (var thing in Client.GetEnumerator("/route/thing"))
Instead of HTTP 200, some APIs return HTTP 204 No Content
as success (like PUT /services/{serviceId}/billing/engagement/endRule).
In this situation, 204 will be treated as an error. Since there is no HTTP body, finally a NULL exception will be occurred at Ovh.Api.Client.ExtractExceptionFromHttpResponse
Reference:
https://github.com/ovh/csharp-ovh/blob/16459d3b0699892ebb656df8d548dbf1007a3160/csharp-ovh/Client/Client.cs#L360C1-L361C1
See travis' documentation about this.
We'll then use these releases for nuget, so that the build is verifiable by anyone.
Hello,
I've created a script token and using it to authenticate my app (eu ovh).
But I'm not getting any response from the api to any request I send.
For example, I'm doing PartialMe me = await client.GetAsync("/me"); and my app freezes because there is no response. Same for any other endpoint.
Is there a way to get any help with this?
It would be great to have a basic example app (full solution) that I could use to try and pinpoint the issue.
Thank you
Andrew
Even with the simple example (bellow) I alway receive the error An exception occured while trying to issue the HTTP call
How can I debug this issue?
public static async Task<string> MyInfo()
{
try
{
Log.Info($"Connecting to OVH...");
Client client = new Client();
Log.Info($"Connected");
PartialMe me = await client.GetAsync<PartialMe>("/me");
Log.Info($"Hello {me.firstname}!");
return me.firstname;
}
catch (Exception ex)
{
Log.Warn(ex.Message);
return null;
}
}
I have a .ovh.conf
file
Hi,
I´m getting some exceptions with WebClients not supporting concurrent I/O operations.
11.07.2019 09:46:26 WebClient unterstützt keine gleichzeitigen E/A-Vorgänge. 11.07.2019 09:46:26 bei System.Net.WebClient.ClearWebClientState() bei System.Net.WebClient.DownloadString(Uri address) bei System.Net.WebClient.DownloadString(String address) bei Ovh.Api.Client.Call(String method, String path, String data, Boolean needAuth, Boolean isBatch) bei Ovh.Api.Client.Call[T](String method, String path, String data, Boolean needAuth, Boolean isBatch) bei Ovh.Api.Client.Get[T](String target, QueryStringParams kwargs, Boolean needAuth) bei OVHDomainSwitcher.Service.<>c__DisplayClass8_0.<OnStart>b__0(Object state) in E:\workspace\vs2017\ovhdomainswitcher\OVHDomainSwitcher\OVHDomainSwitcher\Service.cs:Zeile 172.
I use the "Get<>" method so I don´t think it´s async and I run it in sync on a for loop so a call and only execute when the pevious already finished, that causes some confusion on my side.
Could you check if the issue might be caused inside the API in any way ?
That´s my logic in pseudo-code:
ovh.getDomains()
foreach(domain in domains){
ovh.Get(RecordIDs)
ovh.Get(RecordID/Target)
if(ping target != success) {
ovh.Post(RecordID/Target, newIP)
}
}
Best regards,
Fabian
I'm using Dot Net Core 3.1. I installed csharp-ovh
by using the following command:
dotnet add package csharp-ovh
Then I tried using Ovh.Api
. Ovh
can not be found/resolved.
The project should be available in .NET Standard 2.0 more than in .NET Core 2.0.
.NET Standard 2.0 support .NET Core 2.0, .NET Framework 4.6.1+, Mono, Xamarin and UWP - ref
Should I go for it ?
EDIT: It seems that ini-parser 2.5.2 does not support .NET Core nor .NET Standard (Warning NU1701). The ini-parser team planned support for version 3.
I have just developed a .Net (Net Standard 2.0) lib to play with the OVH Object Storage services.
This might be useful for some people reaching this repository:
https://github.com/JeanCollas/OpenStack.NetSwiftClient
This is probably not an issue but how do I error log the response? I did not find anything regarding "error logging" inside the doc.
Batch calls require a HTTP header X-Ovh-Batch specifying the split character (e.g. ,) and allows to send calls like that:
GET /domain/zone/example.com/record/123456788,123456789,...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.