Esempio n. 1
0
        public async Task PostRefreshZone()
        {
            string query = $"https://eu.api.ovh.com/1.0/domain/zone/{DomainName}/refresh";

            string timestamp = await GetOvhTimestamp();

            using ManagedHttpClient managedHttpClient = new ManagedHttpClient(ApplicationKey, ApplicationSecret, ConsumerKey, timestamp);
            managedHttpClient.BuildSignature("POST", query, string.Empty, timestamp);

            await managedHttpClient.PostAsync(query, null);
        }
Esempio n. 2
0
        public async Task <PartialRecord> GetRecordDetails(long recordId)
        {
            string query = $"https://eu.api.ovh.com/1.0/domain/zone/{DomainName}/record/{recordId}";

            string timestamp = await GetOvhTimestamp();

            using ManagedHttpClient managedHttpClient = new ManagedHttpClient(ApplicationKey, ApplicationSecret, ConsumerKey, timestamp);
            managedHttpClient.BuildSignature("GET", query, string.Empty, timestamp);

            string result = await managedHttpClient.GetStringAsync(query);

            return(JsonConvert.DeserializeObject <PartialRecord>(result));
        }
Esempio n. 3
0
        public async Task PutRecordDetails(long dnsRecordId, PartialRecord partialRecord)
        {
            string query = $"https://eu.api.ovh.com/1.0/domain/zone/{DomainName}/record/{dnsRecordId}";

            JsonSerializerSettings jsonSerializerSettings = new JsonSerializerSettings
            {
                ContractResolver = new DefaultContractResolver {
                    NamingStrategy = new CamelCaseNamingStrategy()
                }
            };

            string        jsonRecord    = JsonConvert.SerializeObject(partialRecord, jsonSerializerSettings);
            StringContent stringContent = new StringContent(jsonRecord, Encoding.UTF8, "application/json");

            string timestamp = await GetOvhTimestamp();

            using ManagedHttpClient managedHttpClient = new ManagedHttpClient(ApplicationKey, ApplicationSecret, ConsumerKey, timestamp);
            managedHttpClient.BuildSignature("PUT", query, await stringContent.ReadAsStringAsync(), timestamp);

            await managedHttpClient.PutAsync(query, stringContent);
        }