public static void TestEditCustomHostnameAsync() { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zoneId = client.GetZonesAsync().Result.Result.First().Id; var customHostname = client.GetCustomHostnamesAsync(zoneId).Result.Result.First(); var patchData = new PatchCustomHostname { Ssl = new CustomHostnameSsl { Method = MethodType.Http, Settings = new CustomHostnameSslSettings { Ciphers = new List <string> { "ECDHE-RSA-AES128-GCM-SHA256", "AES128-SHA" }, Http2 = FeatureStatus.On, MinTlsVersion = TlsVersion.Tls12, Tls13 = FeatureStatus.On }, } }; var editCustomHostname = client.EditCustomHostnameAsync(zoneId, customHostname.Id, patchData).Result; Assert.NotNull(editCustomHostname); Assert.Empty(editCustomHostname.Errors); Assert.True(editCustomHostname.Success); var updatedCustomHostname = client.GetCustomHostnamesAsync(zoneId, customHostname.Hostname).Result.Result.First(); Assert.Equal(MethodType.Http, updatedCustomHostname.Ssl.Method); }
public async Task TestDeleteZoneAsync() { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zonesQueryResult = (await client.GetZonesAsync()).Result.First(); var deletedZoneQueryResult = await client.DeleteZoneAsync(zonesQueryResult.Id); Assert.NotNull(deletedZoneQueryResult); Assert.Empty(deletedZoneQueryResult.Errors); Assert.True(deletedZoneQueryResult.Success); }
public async Task TestGetZonesAsync(string name, ZoneStatus?status, int?page, int?perPage, OrderType?order, bool?match) { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zonesQueryResult = await client.GetZonesAsync(name, status, page, perPage, order, match); Assert.NotNull(zonesQueryResult); Assert.Empty(zonesQueryResult.Errors); Assert.True(zonesQueryResult.Success); }
public async Task TestPurgeAllFilesAsync() { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zonesQueryResult = (await client.GetZonesAsync()).Result.First(); var purgeAllFilesAsyncQueryResult = await client.PurgeAllFilesAsync(zonesQueryResult.Id, true); Assert.NotNull(purgeAllFilesAsyncQueryResult); Assert.Empty(purgeAllFilesAsyncQueryResult.Errors); Assert.True(purgeAllFilesAsyncQueryResult.Success); }
public void TestGetZoneDetailsAsync() { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zonesQueryResult = client.GetZonesAsync().Result.Result.First(); var zoneDetailsQueryResult = client.GetZoneDetailsAsync(zonesQueryResult.Id).Result; Assert.NotNull(zoneDetailsQueryResult); Assert.Empty(zoneDetailsQueryResult.Errors); Assert.True(zoneDetailsQueryResult.Success); }
public static void TestGetCustomHostnameDetailsAsync() { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zoneId = client.GetZonesAsync().Result.Result.First().Id; var customHostnameId = client.GetCustomHostnamesAsync(zoneId).Result.Result.First().Id; var customHostnameDetails = client.GetCustomHostnameDetailsAsync(zoneId, customHostnameId).Result; Assert.NotNull(customHostnameDetails); Assert.Empty(customHostnameDetails.Errors); Assert.True(customHostnameDetails.Success); }
public static void TestGetCustomHostnamesAsync(string hostname, int?page, int?perPage, CustomHostnameOrderType?type, OrderType?order, bool?ssl) { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zoneId = client.GetZonesAsync().Result.Result.First().Id; var customHostnames = client.GetCustomHostnamesAsync(zoneId, hostname, page, perPage, type, order, ssl).Result; Assert.NotNull(customHostnames); Assert.Empty(customHostnames.Errors); Assert.True(customHostnames.Success); }
public static void TestDeleteCustomHostnameAsync() { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zoneId = client.GetZonesAsync().Result.Result.First().Id; var customHostname = client.GetCustomHostnamesAsync(zoneId).Result.Result.First(); var deleteCustomHostname = client.DeleteCustomHostnameAsync(zoneId, customHostname.Hostname).Result; Assert.NotNull(deleteCustomHostname); Assert.Empty(deleteCustomHostname.Errors); Assert.True(deleteCustomHostname.Success); }
public async Task TestGetCustomHostnamesByIdAsync(string id, int?page, int?perPage, CustomHostnameOrderType?type, OrderType?order, bool?ssl) { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zoneId = (await client.GetZonesAsync()).Result.First().Id; var customHostnameId = (await client.GetCustomHostnamesByIdAsync(zoneId, id, page, perPage, type, order, ssl)).Result.First().Id; var customHostnameDetails = await client.GetCustomHostnameDetailsAsync(zoneId, customHostnameId); Assert.NotNull(customHostnameDetails); Assert.Empty(customHostnameDetails.Errors); Assert.True(customHostnameDetails.Success); }
public async Task TestEditZoneAsync() { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zonesQueryResult = (await client.GetZonesAsync()).Result.First(); var editZoneQueryResult = await client.EditZoneAsync(zonesQueryResult.Id, new PatchZone { Paused = false, Plan = new Plan { Id = "e592fd9519420ba7405e1307bff33214" }, VanityNameServers = new List <string> { "ns1.example.com", "ns2.example.com" } }); Assert.NotNull(editZoneQueryResult); Assert.Empty(editZoneQueryResult.Errors); Assert.True(editZoneQueryResult.Success); }
public async Task TestZoneActivationCheckAsync() { using var client = new CloudFlareClient(Credentials.Credentials.Authentication); var zonesQueryResult = (await client.GetZonesAsync()).Result.First(); var zoneActivationCheckQueryResult = await client.ZoneActivationCheckAsync(zonesQueryResult.Id); Assert.NotNull(zoneActivationCheckQueryResult); var notAvailable = new List <int> { 1224, // You may only perform this action once per hour. }; if (!zoneActivationCheckQueryResult.Errors.Any(x => notAvailable.Contains(x.Code))) { Assert.True(zoneActivationCheckQueryResult.Success); if (zoneActivationCheckQueryResult.Errors != null) { Assert.Empty(zoneActivationCheckQueryResult.Errors); } } }