Exemple #1
0
        public static Site GetSite(this IWebsitesServiceManagement proxy, string subscriptionId, string website, string propertiesToInclude)
        {
            // Try to find webspace for site from cache
            Site site = Cache.GetSite(subscriptionId, website, propertiesToInclude);

            if (site != null)
            {
                try
                {
                    return(proxy.GetSite(subscriptionId, site.WebSpace, site.Name, propertiesToInclude));
                }
                catch
                {
                    Cache.RemoveSite(subscriptionId, site);
                    throw;
                }
            }

            // If site was not in cache, find out in which webspace it could be
            var webspaces = proxy.GetWebSpacesWithCache(subscriptionId);

            foreach (var webspace in webspaces)
            {
                var websites     = proxy.GetSites(subscriptionId, webspace.Name, propertiesToInclude);
                var matchWebsite = websites.FirstOrDefault(w => w.Name.Equals(website, System.StringComparison.InvariantCultureIgnoreCase));
                if (matchWebsite != null)
                {
                    return(matchWebsite);
                }
            }

            return(null);
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the GetAzureWebsiteLogCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 /// <param name="deploymentChannel">
 /// Channel used for communication with the git repository.
 /// </param>
 public GetAzureWebsiteLogCommand(
     IWebsitesServiceManagement channel,
     IDeploymentServiceManagement deploymentChannel)
 {
     Channel           = channel;
     DeploymentChannel = deploymentChannel;
     WebsiteClient     = null;
 }
 /// <summary>
 /// Initializes a new instance of the GetAzureWebsiteLogCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 /// <param name="deploymentChannel">
 /// Channel used for communication with the git repository.
 /// </param>
 public GetAzureWebsiteLogCommand(
     IWebsitesServiceManagement channel,
     IDeploymentServiceManagement deploymentChannel)
 {
     Channel = channel;
     DeploymentChannel = deploymentChannel;
     WebsiteClient = null;
 }
Exemple #4
0
        public static WebSpaces GetWebSpacesWithCache(this IWebsitesServiceManagement proxy, string subscriptionId)
        {
            WebSpaces webSpaces = Cache.GetWebSpaces(subscriptionId);

            if (webSpaces != null && webSpaces.Count > 0)
            {
                return(webSpaces);
            }

            webSpaces = GetWebSpaces(proxy, subscriptionId);
            Cache.SaveSpaces(subscriptionId, webSpaces);

            return(webSpaces);
        }
Exemple #5
0
        public static Site GetSiteWithCache(
            this IWebsitesServiceManagement proxy,
            string subscriptionId,
            string website,
            string propertiesToInclude)
        {
            // Try to get the website's webspace from the cache
            Site site = Cache.GetSite(subscriptionId, website, propertiesToInclude);

            if (site != null)
            {
                try
                {
                    return(proxy.GetSite(subscriptionId, site.WebSpace, site.Name, propertiesToInclude));
                }
                catch
                {
                    // The website is removed or it's webspace changed.
                    Cache.RemoveSite(subscriptionId, site);
                    throw;
                }
            }

            // Get all available webspace using REST API
            WebSpaces webspaces = proxy.GetWebSpaces(subscriptionId);

            // Iterate over all the webspaces until finding the website.
            foreach (WebSpace webspace in webspaces)
            {
                Sites websites     = proxy.GetSites(subscriptionId, webspace.Name, propertiesToInclude);
                var   matchWebsite = websites.FirstOrDefault(w => w.Name.Equals(website, System.StringComparison.InvariantCultureIgnoreCase));
                if (matchWebsite != null)
                {
                    return(matchWebsite);
                }
            }

            // The website does not exist.
            return(null);
        }
Exemple #6
0
 public static Site CreateSite(this IWebsitesServiceManagement proxy, string subscriptionId, string webspaceName, Site site)
 {
     return(proxy.EndCreateSite(proxy.BeginCreateSite(subscriptionId, webspaceName, site, null, null)));
 }
Exemple #7
0
 public static string[] GetSubscriptionPublishingUsers(this IWebsitesServiceManagement proxy, string subscriptionId)
 {
     return(proxy.EndGetSubscriptionPublishingUsers(proxy.BeginGetSubscriptionPublishingUsers(subscriptionId, null, null)));
 }
Exemple #8
0
 public static Site GetSite(this IWebsitesServiceManagement proxy, string subscriptionId, string webspaceName, string name, string propertiesToInclude)
 {
     return(proxy.EndGetSite(proxy.BeginGetSite(subscriptionId, webspaceName, name, propertiesToInclude, null, null)));
 }
Exemple #9
0
 public static WebSpace UpdateWebSpace(this IWebsitesServiceManagement proxy, string subscriptionId, string name, bool allowPendingState, WebSpace webSpace)
 {
     return(proxy.EndUpdateWebSpace(proxy.BeginUpdateWebSpace(subscriptionId, name, allowPendingState, webSpace, null, null)));
 }
Exemple #10
0
 public static void DeleteWebSpace(this IWebsitesServiceManagement proxy, string subscriptionId, string name)
 {
     proxy.EndDeleteWebSpace(proxy.BeginDeleteWebSpace(subscriptionId, name, null, null));
 }
Exemple #11
0
 public static void UpdateSiteConfig(this IWebsitesServiceManagement proxy, string subscriptionId, string webspaceName, string name, SiteConfig siteConfig)
 {
     proxy.EndUpdateSiteConfig(proxy.BeginUpdateSiteConfig(subscriptionId, webspaceName, name, siteConfig, null, null));
 }
Exemple #12
0
 /// <summary>
 /// Initializes a new instance of the RestoreAzureWebsiteDeploymentCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 /// <param name="deploymentChannel">
 /// Channel used for communication with the git repository.
 /// </param>
 public RestoreAzureWebsiteDeploymentCommand(IWebsitesServiceManagement channel, IDeploymentServiceManagement deploymentChannel)
 {
     Channel           = channel;
     DeploymentChannel = deploymentChannel;
 }
Exemple #13
0
 public static GeoRegions GetRegions(this IWebsitesServiceManagement proxy, bool listOnlyOnline)
 {
     return(proxy.EndGetRegions(proxy.BeginGetRegions(listOnlyOnline, null, null)));
 }
 /// <summary>
 /// Initializes a new instance of the GetAzureWebsiteLocationCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 public GetAzureWebsiteLocationCommand(IWebsitesServiceManagement channel)
 {
     Channel = channel;
 }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of the NewAzureWebsiteCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 /// <param name="githubChannel">
 /// Channel used for communication with the github APIs.
 /// </param>
 public NewAzureWebsiteCommand(IWebsitesServiceManagement channel, IGithubServiceManagement githubChannel)
 {
     Channel       = channel;
     GithubChannel = githubChannel;
 }
 public DisableAzureWebsiteDiagnosticCommand(IWebsitesServiceManagement channel)
 {
     Channel = channel;
 }
 public EnableAzureWebsiteApplicationDiagnosticCommand(IWebsitesServiceManagement channel)
 {
     Channel = channel;
 }
Exemple #18
0
 public DisableAzureWebsiteDiagnosticCommand(IWebsitesServiceManagement channel)
 {
     Channel = channel;
 }
 /// <summary>
 /// Initializes a new instance of the SaveAzureWebsiteLogCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 /// <param name="deploymentChannel">
 /// Channel used for communication with the git repository.
 /// </param>
 public SaveAzureWebsiteLogCommand(IWebsitesServiceManagement channel, IDeploymentServiceManagement deploymentChannel)
 {
     Channel = channel;
     DeploymentChannel = deploymentChannel;
 }
Exemple #20
0
 public static void DeleteSite(this IWebsitesServiceManagement proxy, string subscriptionId, string webspaceName, string name, string deleteMetrics)
 {
     proxy.EndDeleteSite(proxy.BeginDeleteSite(subscriptionId, webspaceName, name, deleteMetrics, null, null));
 }
 /// <summary>
 /// Initializes a new instance of the NewAzureWebsiteCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 /// <param name="githubChannel">
 /// Channel used for communication with the github APIs.
 /// </param>
 public NewAzureWebsiteCommand(IWebsitesServiceManagement channel, IGithubServiceManagement githubChannel)
 {
     Channel = channel;
     GithubChannel = githubChannel;
 }
Exemple #22
0
 public static SiteConfig GetSiteConfig(this IWebsitesServiceManagement proxy, string subscriptionId, string webspaceName, string name)
 {
     return(proxy.EndGetSiteConfig(proxy.BeginGetSiteConfig(subscriptionId, webspaceName, name, null, null)));
 }
Exemple #23
0
 /// <summary>
 /// Initializes a new instance of the GetAzureWebsiteLocationCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 public GetAzureWebsiteLocationCommand(IWebsitesServiceManagement channel)
 {
     Channel = channel;
 }
Exemple #24
0
 public static void CreateSiteRepository(this IWebsitesServiceManagement proxy, string subscriptionId, string webspaceName, string name)
 {
     proxy.EndCreateSiteRepository(proxy.BeginCreateSiteRepository(subscriptionId, webspaceName, name, null, null));
 }
 public EnableAzureWebsiteApplicationDiagnosticCommand(IWebsitesServiceManagement channel)
 {
     Channel = channel;
 }
Exemple #26
0
 public static GeoLocations GetLocations(this IWebsitesServiceManagement proxy, string regionName)
 {
     return(proxy.EndGetLocations(proxy.BeginGetLocations(regionName, null, null)));
 }
Exemple #27
0
 /// <summary>
 /// Initializes a new instance of the ShowAzureWebsiteCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 public ShowAzureWebsiteCommand(IWebsitesServiceManagement channel)
 {
     Channel = channel;
 }
 /// <summary>
 /// Initializes a new instance of the RestoreAzureWebsiteDeploymentCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 /// <param name="deploymentChannel">
 /// Channel used for communication with the git repository.
 /// </param>
 public RestoreAzureWebsiteDeploymentCommand(IWebsitesServiceManagement channel, IDeploymentServiceManagement deploymentChannel)
 {
     Channel = channel;
     DeploymentChannel = deploymentChannel;
 }
Exemple #29
0
 public static WebSpace GetWebSpace(this IWebsitesServiceManagement proxy, string subscriptionId, string name)
 {
     return(proxy.EndGetWebSpace(proxy.BeginGetWebSpace(subscriptionId, name, null, null)));
 }
 /// <summary>
 /// Initializes a new instance of the RemoveAzureWebsiteCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 public RemoveAzureWebsiteCommand(IWebsitesServiceManagement channel)
 {
     Channel = channel;
 }
Exemple #31
0
 /// <summary>
 /// Initializes a new instance of the SaveAzureWebsiteLogCommand class.
 /// </summary>
 /// <param name="channel">
 /// Channel used for communication with Azure's service management APIs.
 /// </param>
 /// <param name="deploymentChannel">
 /// Channel used for communication with the git repository.
 /// </param>
 public SaveAzureWebsiteLogCommand(IWebsitesServiceManagement channel, IDeploymentServiceManagement deploymentChannel)
 {
     Channel           = channel;
     DeploymentChannel = deploymentChannel;
 }