Azure自动缩放管理API
我目前正在运行一个控制台应用程序来更新azure订阅上的自动缩放,但是我遇到了日夜配置文件的问题 我有两个配置文件,运行在夜间和白天的工作日。我把它放在一起玩api,但是我得到了非常好的结果Azure自动缩放管理API,azure,azure-autoscaling-block,Azure,Azure Autoscaling Block,我目前正在运行一个控制台应用程序来更新azure订阅上的自动缩放,但是我遇到了日夜配置文件的问题 我有两个配置文件,运行在夜间和白天的工作日。我把它放在一起玩api,但是我得到了非常好的结果 var weekDayProfile = new AutoscaleProfile { Capacity = new ScaleCapacity { Default = settings.Default.ToS
var weekDayProfile = new AutoscaleProfile
{
Capacity = new ScaleCapacity
{
Default = settings.Default.ToString(),
Maximum = settings.Maximum.ToString(),
Minimum = settings.Minimum.ToString()
},
Name = "Day",
Recurrence = new Recurrence
{
Frequency = RecurrenceFrequency.Week,
Schedule = new RecurrentSchedule
{
Days = new List<String> { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" },
Hours = { 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 },
Minutes = new List<int> { 0 },
TimeZone = "Central Standard Time"
}
},
Rules = GenerateScaleRules(cloudServiceName, roleName, isProduction, settings)
};
settings.SetProfileSettings(ProfileEnum.NonProdWeekNight);
var weekNightProfile = new AutoscaleProfile
{
Capacity = new ScaleCapacity
{
Default = settings.Default.ToString(),
Maximum = settings.Maximum.ToString(),
Minimum = settings.Minimum.ToString()
},
Name = "Night",
Recurrence = new Recurrence
{
Frequency = RecurrenceFrequency.Week,
Schedule = new RecurrentSchedule
{
Days = new List<String> { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" },
Hours = {0, 1, 2, 3, 4, 5, 6, 7, 21, 22, 23},
Minutes = new List<int> { 0 },
TimeZone = "Central Standard Time"
}
},
Rules = GenerateScaleRules(cloudServiceName, roleName, isProduction, settings)
};
settings.SetProfileSettings(ProfileEnum.NonProdWeekEnd);
现在,当我将配置文件加载到云中时,会显示两个配置文件,但它们在各个方面都完全相同。我想知道是不是因为我的日子重叠了。我认为这是可能的,因为您可以通过门户手动设置白天和夜间时间。我是否缺少开关或设置之类的东西。显然,我把错误周围的json搞乱了。我不明白时间到底意味着什么 运行应用程序以获取手动配置文件,并将其与我生成的配置文件相匹配。看起来小时并不是真正的小时。任何人谁是这样做,通过api它是好的,只是下来的配置文件,并匹配它
AutoscaleClient autoscaleClient = new AutoscaleClient(new CertificateCloudCredentials(publishSettings.Id, publishSettings.Certificate));
AutoscaleSettingGetResponse get = autoscaleClient.Settings.Get(AutoscaleResourceIdBuilder.BuildCloudServiceResourceId("<clound name", "role name", true));
AutoscaleSetting setting = get.Setting;
string profileJson = JsonConvert.SerializeObject(setting);
Console.WriteLine(profileJson);