Skip to content

New cmdlets added for patch schedule #2643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
##2016.07.11 version 1.6.0
* Azure Redis Cache
* New cmdlet added for New-AzureRmRedisCacheScheduleEntry
* New cmdlet added for New-AzureRmRedisCachePatchSchedule
* New cmdlet added for Get-AzureRmRedisCachePatchSchedule
* New cmdlet added for Remove-AzureRmRedisCachePatchSchedule
##2016.07.11 version 1.6.0
* **Behavioral change for -Force, –Confirm and $ConfirmPreference parameters for all cmdlets. We are changing this implementation to be in line with PowerShell guidelines. For most cmdlets, this means removing the Force parameter and to skip the ShouldProcess prompt, users will need to include the parameter: ‘-Confirm:$false’ in their PowerShell scripts.** This changes are addressing following issues:
* Correct implementation of –WhatIf functionality, allowing a user to determine the effects of a cmdlet or script without making any actual changes
* Control over prompting using a session-wide $ConfirmPreference, so that the user is prompted based on the impact of a prospective change (as reported in the ConfirmImpact setting in the cmdlet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@
<None Include="SessionRecords\Microsoft.Azure.Commands.RedisCache.Test.ScenarioTests.RedisCacheTests\TestRedisCacheClustering.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.RedisCache.Test.ScenarioTests.RedisCacheTests\TestRedisCachePatchSchedules.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="SessionRecords\Microsoft.Azure.Commands.RedisCache.Test.ScenarioTests.RedisCacheTests\TestRedisCachePipeline.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,12 @@ public void TestImportAzureRmRedisCache()
{
RedisCacheController.NewInstance.RunPowerShellTest("Test-ImportAzureRmRedisCache");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRedisCachePatchSchedules()
{
RedisCacheController.NewInstance.RunPowerShellTest("Test-RedisCachePatchSchedules");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,63 @@ function Test-ImportAzureRmRedisCache
Import-AzureRmRedisCache -ResourceGroupName $resourceGroupName -Name $cacheName -Files $files -Force
}

<#
.SYNOPSIS
Tests schedule patching
#>
function Test-RedisCachePatchSchedules
{
$resourceGroupName = "SiddharthsSub"
$cacheName = "sunny-premium"

$weekend = New-AzureRmRedisCacheScheduleEntry -DayOfWeek "Weekend" -StartHourUtc 2 -MaintenanceWindow "06:00:00"
$thursday = New-AzureRmRedisCacheScheduleEntry -DayOfWeek "Thursday" -StartHourUtc 10 -MaintenanceWindow "09:00:00"

$createResult = New-AzureRmRedisCachePatchSchedule -ResourceGroupName $resourceGroupName -Name $cacheName -Entries @($weekend, $thursday)
Assert-True {$createResult.Count -eq 3}
foreach ($scheduleEntry in $createResult)
{
if($scheduleEntry.DayOfWeek -eq "Thursday")
{
Assert-AreEqual 10 $scheduleEntry.StartHourUtc
Assert-AreEqual "09:00:00" $scheduleEntry.MaintenanceWindow
}
elseif($scheduleEntry.DayOfWeek -eq "Saturday" -or $scheduleEntry.DayOfWeek -eq "Sunday")
{
Assert-AreEqual 2 $scheduleEntry.StartHourUtc
Assert-AreEqual "06:00:00" $scheduleEntry.MaintenanceWindow
}
else
{
Assert-True $false "Unknown DayOfWeek."
}
}

$getResult = Get-AzureRmRedisCachePatchSchedule -ResourceGroupName $resourceGroupName -Name $cacheName
Assert-True {$getResult.Count -eq 3}
foreach ($scheduleEntry in $getResult)
{
if($scheduleEntry.DayOfWeek -eq "Thursday")
{
Assert-AreEqual 10 $scheduleEntry.StartHourUtc
Assert-AreEqual "09:00:00" $scheduleEntry.MaintenanceWindow
}
elseif($scheduleEntry.DayOfWeek -eq "Saturday" -or $scheduleEntry.DayOfWeek -eq "Sunday")
{
Assert-AreEqual 2 $scheduleEntry.StartHourUtc
Assert-AreEqual "06:00:00" $scheduleEntry.MaintenanceWindow
}
else
{
Assert-True $false "Unknown DayOfWeek."
}
}

Remove-AzureRmRedisCachePatchSchedule -ResourceGroupName $resourceGroupName -Name $cacheName

Assert-ThrowsContains {Get-AzureRmRedisCachePatchSchedule -ResourceGroupName $resourceGroupName -Name $cacheName} "There are no patch schedules found for redis cache 'sunny-premium'"
}

<#
.SYNOPSIS
Sleeps but only during recording.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
{
"Entries": [
{
"RequestUri": "/subscriptions/592cc9de-a3cd-4d70-9bc1-c1a28a3625b5/resourceGroups/SiddharthsSub/providers/Microsoft.Cache/Redis/sunny-premium/patchSchedules/default?api-version=2016-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTkyY2M5ZGUtYTNjZC00ZDcwLTliYzEtYzFhMjhhMzYyNWI1L3Jlc291cmNlR3JvdXBzL1NpZGRoYXJ0aHNTdWIvcHJvdmlkZXJzL01pY3Jvc29mdC5DYWNoZS9SZWRpcy9zdW5ueS1wcmVtaXVtL3BhdGNoU2NoZWR1bGVzL2RlZmF1bHQ/YXBpLXZlcnNpb249MjAxNi0wNC0wMQ==",
"RequestMethod": "PUT",
"RequestBody": "{\r\n \"properties\": {\r\n \"scheduleEntries\": [\r\n {\r\n \"dayOfWeek\": \"Saturday\",\r\n \"startHourUtc\": 2,\r\n \"maintenanceWindow\": \"PT6H\"\r\n },\r\n {\r\n \"dayOfWeek\": \"Sunday\",\r\n \"startHourUtc\": 2,\r\n \"maintenanceWindow\": \"PT6H\"\r\n },\r\n {\r\n \"dayOfWeek\": \"Thursday\",\r\n \"startHourUtc\": 10,\r\n \"maintenanceWindow\": \"PT9H\"\r\n }\r\n ]\r\n }\r\n}",
"RequestHeaders": {
"Content-Type": [
"application/json; charset=utf-8"
],
"Content-Length": [
"413"
],
"x-ms-client-request-id": [
"42cd27d7-4e09-47d7-b7f8-9b0393d75ee9"
],
"accept-language": [
"en-US"
],
"User-Agent": [
"Microsoft.Azure.Management.Redis.RedisManagementClient/3.1.0.0"
]
},
"ResponseBody": "{\r\n \"id\": \"/subscriptions/592cc9de-a3cd-4d70-9bc1-c1a28a3625b5/resourceGroups/SiddharthsSub/providers/Microsoft.Cache/Redis/sunny-premium/patchSchedules/default\",\r\n \"location\": \"West US\",\r\n \"name\": \"sunny-premium/default\",\r\n \"type\": \"Microsoft.Cache/Redis/PatchSchedules\",\r\n \"properties\": {\r\n \"scheduleEntries\": [\r\n {\r\n \"dayOfWeek\": \"Saturday\",\r\n \"startHourUtc\": 2,\r\n \"maintenanceWindow\": \"PT6H\"\r\n },\r\n {\r\n \"dayOfWeek\": \"Sunday\",\r\n \"startHourUtc\": 2,\r\n \"maintenanceWindow\": \"PT6H\"\r\n },\r\n {\r\n \"dayOfWeek\": \"Thursday\",\r\n \"startHourUtc\": 10,\r\n \"maintenanceWindow\": \"PT9H\"\r\n }\r\n ]\r\n }\r\n}",
"ResponseHeaders": {
"Content-Length": [
"497"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"d640bc6c-2bce-4439-81e0-adaad9bddd1f"
],
"x-rp-server-mvid": [
"ee94f66d-6cbf-4677-9102-16a91b3a282c"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1199"
],
"x-ms-correlation-request-id": [
"5421c08b-3f59-4cd9-ae7b-4d06d65330fa"
],
"x-ms-routing-request-id": [
"CENTRALUS:20160708T184237Z:5421c08b-3f59-4cd9-ae7b-4d06d65330fa"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Fri, 08 Jul 2016 18:42:37 GMT"
],
"Server": [
"Microsoft-HTTPAPI/2.0"
]
},
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/592cc9de-a3cd-4d70-9bc1-c1a28a3625b5/resourceGroups/SiddharthsSub/providers/Microsoft.Cache/Redis/sunny-premium/patchSchedules/default?api-version=2016-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTkyY2M5ZGUtYTNjZC00ZDcwLTliYzEtYzFhMjhhMzYyNWI1L3Jlc291cmNlR3JvdXBzL1NpZGRoYXJ0aHNTdWIvcHJvdmlkZXJzL01pY3Jvc29mdC5DYWNoZS9SZWRpcy9zdW5ueS1wcmVtaXVtL3BhdGNoU2NoZWR1bGVzL2RlZmF1bHQ/YXBpLXZlcnNpb249MjAxNi0wNC0wMQ==",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"x-ms-client-request-id": [
"324e4dce-c420-43f0-b675-78b30f26b77a"
],
"accept-language": [
"en-US"
],
"User-Agent": [
"Microsoft.Azure.Management.Redis.RedisManagementClient/3.1.0.0"
]
},
"ResponseBody": "{\r\n \"id\": \"/subscriptions/592cc9de-a3cd-4d70-9bc1-c1a28a3625b5/resourceGroups/SiddharthsSub/providers/Microsoft.Cache/Redis/sunny-premium/patchSchedules/default\",\r\n \"location\": \"West US\",\r\n \"name\": \"sunny-premium/default\",\r\n \"type\": \"Microsoft.Cache/Redis/PatchSchedules\",\r\n \"properties\": {\r\n \"scheduleEntries\": [\r\n {\r\n \"dayOfWeek\": \"Saturday\",\r\n \"startHourUtc\": 2,\r\n \"maintenanceWindow\": \"PT6H\"\r\n },\r\n {\r\n \"dayOfWeek\": \"Sunday\",\r\n \"startHourUtc\": 2,\r\n \"maintenanceWindow\": \"PT6H\"\r\n },\r\n {\r\n \"dayOfWeek\": \"Thursday\",\r\n \"startHourUtc\": 10,\r\n \"maintenanceWindow\": \"PT9H\"\r\n }\r\n ]\r\n }\r\n}",
"ResponseHeaders": {
"Content-Length": [
"497"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"1a881c23-8a3b-426f-89b7-704393c01584"
],
"x-rp-server-mvid": [
"ee94f66d-6cbf-4677-9102-16a91b3a282c"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-reads": [
"14999"
],
"x-ms-correlation-request-id": [
"b88c1321-5d7e-4de7-b5af-4a6d82d9cc29"
],
"x-ms-routing-request-id": [
"CENTRALUS:20160708T184237Z:b88c1321-5d7e-4de7-b5af-4a6d82d9cc29"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Fri, 08 Jul 2016 18:42:37 GMT"
],
"Server": [
"Microsoft-HTTPAPI/2.0"
]
},
"StatusCode": 200
},
{
"RequestUri": "/subscriptions/592cc9de-a3cd-4d70-9bc1-c1a28a3625b5/resourceGroups/SiddharthsSub/providers/Microsoft.Cache/Redis/sunny-premium/patchSchedules/default?api-version=2016-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTkyY2M5ZGUtYTNjZC00ZDcwLTliYzEtYzFhMjhhMzYyNWI1L3Jlc291cmNlR3JvdXBzL1NpZGRoYXJ0aHNTdWIvcHJvdmlkZXJzL01pY3Jvc29mdC5DYWNoZS9SZWRpcy9zdW5ueS1wcmVtaXVtL3BhdGNoU2NoZWR1bGVzL2RlZmF1bHQ/YXBpLXZlcnNpb249MjAxNi0wNC0wMQ==",
"RequestMethod": "GET",
"RequestBody": "",
"RequestHeaders": {
"x-ms-client-request-id": [
"14a4a385-a71c-47af-a95f-7bbf6d014e83"
],
"accept-language": [
"en-US"
],
"User-Agent": [
"Microsoft.Azure.Management.Redis.RedisManagementClient/3.1.0.0"
]
},
"ResponseBody": "{\r\n \"error\": {\r\n \"code\": \"ResourceNotFound\",\r\n \"message\": \"There are no patch schedules found for redis cache 'sunny-premium'.\\r\\nRequestID=391c4d63-ee26-4815-aa51-95ef2e2e1014\",\r\n \"target\": null\r\n }\r\n}",
"ResponseHeaders": {
"Content-Length": [
"181"
],
"Content-Type": [
"application/json; charset=utf-8"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"391c4d63-ee26-4815-aa51-95ef2e2e1014"
],
"x-rp-server-mvid": [
"ee94f66d-6cbf-4677-9102-16a91b3a282c"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-reads": [
"14998"
],
"x-ms-correlation-request-id": [
"ad39410b-e1a7-4591-bb67-f7f63cbae0fa"
],
"x-ms-routing-request-id": [
"CENTRALUS:20160708T184238Z:ad39410b-e1a7-4591-bb67-f7f63cbae0fa"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Fri, 08 Jul 2016 18:42:37 GMT"
],
"Server": [
"Microsoft-HTTPAPI/2.0"
]
},
"StatusCode": 404
},
{
"RequestUri": "/subscriptions/592cc9de-a3cd-4d70-9bc1-c1a28a3625b5/resourceGroups/SiddharthsSub/providers/Microsoft.Cache/Redis/sunny-premium/patchSchedules/default?api-version=2016-04-01",
"EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvNTkyY2M5ZGUtYTNjZC00ZDcwLTliYzEtYzFhMjhhMzYyNWI1L3Jlc291cmNlR3JvdXBzL1NpZGRoYXJ0aHNTdWIvcHJvdmlkZXJzL01pY3Jvc29mdC5DYWNoZS9SZWRpcy9zdW5ueS1wcmVtaXVtL3BhdGNoU2NoZWR1bGVzL2RlZmF1bHQ/YXBpLXZlcnNpb249MjAxNi0wNC0wMQ==",
"RequestMethod": "DELETE",
"RequestBody": "",
"RequestHeaders": {
"x-ms-client-request-id": [
"bf82e809-a66d-4b73-84a0-24c63a1a32df"
],
"accept-language": [
"en-US"
],
"User-Agent": [
"Microsoft.Azure.Management.Redis.RedisManagementClient/3.1.0.0"
]
},
"ResponseBody": "",
"ResponseHeaders": {
"Content-Length": [
"0"
],
"Expires": [
"-1"
],
"Pragma": [
"no-cache"
],
"x-ms-request-id": [
"186590eb-25c0-40bf-81c6-7804aa2f11aa"
],
"x-rp-server-mvid": [
"ee94f66d-6cbf-4677-9102-16a91b3a282c"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains"
],
"x-ms-ratelimit-remaining-subscription-writes": [
"1198"
],
"x-ms-correlation-request-id": [
"afecf077-f66b-479b-9f2d-28762401276d"
],
"x-ms-routing-request-id": [
"CENTRALUS:20160708T184237Z:afecf077-f66b-479b-9f2d-28762401276d"
],
"Cache-Control": [
"no-cache"
],
"Date": [
"Fri, 08 Jul 2016 18:42:37 GMT"
],
"Server": [
"Microsoft-HTTPAPI/2.0"
]
},
"StatusCode": 200
}
],
"Names": {},
"Variables": {
"SubscriptionId": "592cc9de-a3cd-4d70-9bc1-c1a28a3625b5"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\RemoveAzureRedisCachePatchSchedule.cs" />
<Compile Include="Commands\NewAzureRedisCacheScheduleEntry.cs" />
<Compile Include="Commands\GetAzureRedisCachePatchSchedule.cs" />
<Compile Include="Commands\NewAzureRedisCachePatchSchedule.cs" />
<Compile Include="Commands\ResetAzureRedisCache.cs" />
<Compile Include="Commands\ExportAzureRedisCache.cs" />
<Compile Include="Commands\ImportAzureRedisCache.cs" />
Expand All @@ -164,6 +168,7 @@
<Compile Include="Commands\GetAzureRedisCache.cs" />
<Compile Include="Commands\RemoveAzureRedisCache.cs" />
<Compile Include="Commands\NewAzureRedisCache.cs" />
<Compile Include="Models\PSScheduleEntry.cs" />
<Compile Include="Models\RedisCacheAttributesWithAccessKeys.cs" />
<Compile Include="Models\RedisCacheAttributes.cs" />
<Compile Include="Models\RedisCacheClient.cs" />
Expand Down
Loading