public IList <ResourceMetric> GetAppServicePlanHistoricalUsageMetrics(string resourceGroupName, string appServicePlanName, IReadOnlyList <string> metricNames,
                                                                              DateTime?startTime, DateTime?endTime, string timeGrain, bool instanceDetails)
        {
            var response = WrappedWebsitesClient.ServerFarms.GetServerFarmMetrics(resourceGroupName, appServicePlanName, instanceDetails, CmdletHelpers.BuildMetricFilter(startTime, endTime, timeGrain, metricNames));

            return(response.Value);
        }
Beispiel #2
0
        public void UpdateWebAppConfiguration(string resourceGroupName, string location, string webSiteName, string slotName, SiteConfig siteConfig = null, IDictionary <string, string> appSettings = null, IDictionary <string, ConnStringValueTypePair> connectionStrings = null, AzureStoragePropertyDictionaryResource azureStorageSettings = null)
        {
            string qualifiedSiteName;
            var    useSlot = CmdletHelpers.ShouldUseDeploymentSlot(webSiteName, slotName, out qualifiedSiteName);

            if (useSlot)
            {
                if (appSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateApplicationSettingsSlot(
                        resourceGroupName,
                        webSiteName,
                        new StringDictionary {
                        Properties = appSettings
                    },
                        slotName);
                }

                if (siteConfig != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateConfigurationSlot(
                        resourceGroupName,
                        webSiteName,
                        siteConfig.ConvertToSiteConfigResource(),
                        slotName);
                }

                if (connectionStrings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateConnectionStringsSlot(
                        resourceGroupName,
                        webSiteName,
                        new ConnectionStringDictionary {
                        Properties = connectionStrings
                    },
                        slotName);
                }

                if (azureStorageSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateAzureStorageAccountsSlot(
                        resourceGroupName,
                        webSiteName,
                        azureStorageSettings,
                        slotName);
                }
            }
            else
            {
                if (appSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateApplicationSettings(
                        resourceGroupName,
                        webSiteName,
                        new StringDictionary {
                        Properties = appSettings
                    });
                }

                if (siteConfig != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateConfiguration(resourceGroupName, webSiteName, siteConfig.ConvertToSiteConfigResource());
                }

                if (connectionStrings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateConnectionStrings(
                        resourceGroupName,
                        webSiteName,
                        new ConnectionStringDictionary {
                        Properties = connectionStrings
                    });
                }

                if (azureStorageSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateAzureStorageAccounts(
                        resourceGroupName,
                        webSiteName,
                        azureStorageSettings);
                }
            }
        }
        public IList <ResourceMetric> GetWebAppUsageMetrics(string resourceGroupName, string webSiteName, string slotName, IReadOnlyList <string> metricNames,
                                                            DateTime?startTime, DateTime?endTime, string timeGrain, bool instanceDetails)
        {
            string qualifiedSiteName;
            var    usageMetrics = CmdletHelpers.ShouldUseDeploymentSlot(webSiteName, slotName, out qualifiedSiteName) ?
                                  WrappedWebsitesClient.Sites.GetSiteMetricsSlot(resourceGroupName, webSiteName, slotName, instanceDetails, CmdletHelpers.BuildMetricFilter(startTime, endTime ?? DateTime.Now, timeGrain, metricNames)) :
                                  WrappedWebsitesClient.Sites.GetSiteMetrics(resourceGroupName, webSiteName, instanceDetails, CmdletHelpers.BuildMetricFilter(startTime, endTime ?? DateTime.Now, timeGrain, metricNames));

            return(usageMetrics.Value);
        }
        public void UpdateWebAppConfiguration(string resourceGroupName, string location, string webSiteName, string slotName, SiteConfig siteConfig = null, IDictionary <string, string> appSettings = null, IDictionary <string, ConnStringValueTypePair> connectionStrings = null)
        {
            string qualifiedSiteName;
            var    useSlot = CmdletHelpers.ShouldUseDeploymentSlot(webSiteName, slotName, out qualifiedSiteName);

            if (useSlot)
            {
                if (siteConfig != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateSiteConfigSlot(
                        resourceGroupName,
                        webSiteName,
                        siteConfig,
                        slotName);
                }

                if (appSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateSiteAppSettingsSlot(
                        resourceGroupName,
                        webSiteName,
                        new StringDictionary {
                        Location = location, Properties = appSettings
                    },
                        slotName);
                }

                if (connectionStrings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateSiteConnectionStringsSlot(
                        resourceGroupName,
                        webSiteName,
                        new ConnectionStringDictionary {
                        Location = location, Properties = connectionStrings
                    },
                        slotName);
                }
            }
            else
            {
                if (siteConfig != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateSiteConfig(resourceGroupName, webSiteName, siteConfig);
                }

                if (appSettings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateSiteAppSettings(
                        resourceGroupName,
                        webSiteName,
                        new StringDictionary {
                        Location = location, Properties = appSettings
                    });
                }

                if (connectionStrings != null)
                {
                    WrappedWebsitesClient.WebApps().UpdateSiteConnectionStrings(
                        resourceGroupName,
                        webSiteName,
                        new ConnectionStringDictionary {
                        Location = location, Properties = connectionStrings
                    });
                }
            }
        }