internal FirewallRule(XElement xml, DatabaseServer parent) { Parent = parent; xml.HydrateObject(XmlNamespaces.WindowsAzure, this); var startIpAddressElement = xml.Element(XmlNamespaces.WindowsAzure + "StartIPAddress"); if (startIpAddressElement != null) { StartIpAddress = startIpAddressElement.Value; } var endIpAddressElement = xml.Element(XmlNamespaces.WindowsAzure + "EndIPAddress"); if (endIpAddressElement != null) { EndIpAddress = endIpAddressElement.Value; } }
internal async Task CreateAsync(DatabaseServer server) { Contract.Requires(Parent == null); Contract.Requires(server != null); Contract.Requires(!string.IsNullOrWhiteSpace(Name)); Contract.Requires(!string.IsNullOrWhiteSpace(StartIpAddress)); Contract.Requires(!string.IsNullOrWhiteSpace(EndIpAddress)); var ns = XmlNamespaces.SqlAzure; var content = new XElement(ns + "FirewallRule", new XElement(ns + "StartIpAddress", StartIpAddress), new XElement(ns + "EndIpAddress", EndIpAddress) ); var hc = GetRestClient(server); await hc.PutAsync(content); Parent = server; }
internal Database(XElement xml, DatabaseServer databaseServer) { xml.HydrateObject(XmlNamespaces.WindowsAzure, this); DatabaseServer = databaseServer; }
public Task <Replica> CreateOfflineReplica(DatabaseServer partnerServer) { return(CreateReplica(partnerServer, Name, true, true)); }
public Task <Replica> CreateLiveReplica(DatabaseServer partnerServer) { return(CreateReplica(partnerServer, Name, true, false)); }
public Task <Replica> CreateCopy(DatabaseServer partnerServer, string partnerDatabase) { return(CreateReplica(partnerServer, partnerDatabase, false, false)); }
internal Database(XElement xml, DatabaseServer databaseServer) { xml.HydrateObject(XmlNamespaces.WindowsAzure, this); DatabaseServer = databaseServer; Replicas = new LatentSequence <Replica>(GetReplicasAsync); }
AzureRestClient GetRestClient(DatabaseServer server, string pathSuffix = null) { string servicePath = "servers/" + server.Name + "/firewallrules/" + Name; if (!string.IsNullOrEmpty(pathSuffix)) servicePath += pathSuffix; return server.Subscription.GetDatabaseRestClient(servicePath); }
public async Task DeleteAsync() { Contract.Requires(Parent != null); await GetRestClient().DeleteAsync(); Parent = null; }
internal FirewallRule(XElement xml, DatabaseServer parent) { Parent = parent; xml.HydrateObject(XmlNamespaces.SqlAzure, this); }
public Task CreateDatabaseServerAsync(DatabaseServer server, string adminPassword) { return server.CreateAsync(this, adminPassword); }
private AzureRestClient GetRestClient(DatabaseServer server, string databaseName) { var servicePath = "services/sqlservers/servers/" + server.Name + "/databases/" + databaseName + "/databasecopies/" + Name; return(server.Subscription.GetDatabaseRestClient(servicePath)); }