Skip to content

Commit 2e85ebd

Browse files
authored
Merge pull request Azure#3193 from alfantp/dev
Adding retirement message for managed cache customers who will perform powershell commands on managed cache post retirement date
2 parents 38ab463 + 83773e5 commit 2e85ebd

File tree

17 files changed

+125
-13
lines changed

17 files changed

+125
-13
lines changed

src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/Commands.ManagedCache.Test.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@
184184
<None Include="SessionRecords\Microsoft.Azure.Commands.ManagedCache.Test.ScenarioTests.ManagedCacheTests\TestManagedCacheNamedCacheStandard.json">
185185
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
186186
</None>
187+
<None Include="SessionRecords\Microsoft.Azure.Commands.ManagedCache.Test.ScenarioTests.ManagedCacheTests\TestRetirementWarningMessage.json">
188+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
189+
</None>
187190
</ItemGroup>
188191
<ItemGroup>
189192
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
@@ -229,4 +232,4 @@
229232
<ItemGroup />
230233
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
231234
<Import Project="..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets" Condition="Exists('..\..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" />
232-
</Project>
235+
</Project>

src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,12 @@ public void TestManagedCacheNamedCacheDoNotExists()
5050
{
5151
this.RunPowerShellTest("Test-ManagedCacheNamedCacheDoNotExists");
5252
}
53+
54+
[Fact]
55+
[Trait(Category.AcceptanceType, Category.CheckIn)]
56+
public void TestRetirementWarningMessage()
57+
{
58+
this.RunPowerShellTest("Test-RetirementWarningMessage");
59+
}
5360
}
5461
}

src/ServiceManagement/ManagedCache/Commands.ManagedCache.Test/ScenarioTests/ManagedCacheTests.ps1

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function Test-ListLocationsSupportCaching
5454
{
5555
$allLocations = Get-AzureManagedCacheLocation
5656

57-
Assert-AreNotEqual 0 $allLocations.Count
57+
Assert-AreNotEqual 0 $allLocations.Count
5858

5959
$found = $FALSE
6060
foreach ($location in $allLocations)
@@ -68,6 +68,34 @@ function Test-ListLocationsSupportCaching
6868
Assert-True {$found}
6969
}
7070

71+
72+
########################## Cache Retirement Warning message test #############################
73+
<#
74+
.SYNOPSIS
75+
Cache Retirement Warning message test
76+
#>
77+
function Test-RetirementWarningMessage
78+
{
79+
$warningBeforeRetirement = "The Azure Managed Cache Service will be retired on 11/30/2016. Please migrate to the Azure Redis Cache Service. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458"
80+
$warningAfterRetirement = "The Azure Managed Cache Service has been retired as of 11/30/2016. Please migrate to the Azure Redis Cache Service. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458"
81+
82+
$datetime = Get-Date
83+
$datetime = $datetime.ToUniversalTime()
84+
$cacheRetired = $datetime -gt "2016-12-01 00:00:00Z"
85+
86+
#Test warning
87+
Get-AzureManagedCacheLocation -WarningVariable warning
88+
89+
if($cacheRetired)
90+
{
91+
Assert-AreEqual $warningAfterRetirement $warning
92+
}
93+
else
94+
{
95+
Assert-AreEqual $warningBeforeRetirement $warning
96+
}
97+
}
98+
7199
########################## Managed Cache (Named cache) Scenario Tests #############################
72100
<#
73101
.SYNOPSIS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"Entries": [
3+
{
4+
"RequestUri": "/67db6ec8-1e63-4a12-a263-eb3b69b7588f/cloudservices/mycloudservice/resources/cacheservice/~/Caching/mycacheservice/Options/Regions",
5+
"EncodedRequestUri": "LzY3ZGI2ZWM4LTFlNjMtNGExMi1hMjYzLWViM2I2OWI3NTg4Zi9jbG91ZHNlcnZpY2VzL215Y2xvdWRzZXJ2aWNlL3Jlc291cmNlcy9jYWNoZXNlcnZpY2Uvfi9DYWNoaW5nL215Y2FjaGVzZXJ2aWNlL09wdGlvbnMvUmVnaW9ucw==",
6+
"RequestMethod": "GET",
7+
"RequestBody": "",
8+
"RequestHeaders": {
9+
"x-ms-version": [
10+
"2012-08-01"
11+
],
12+
"User-Agent": [
13+
"Microsoft.Azure.Management.ManagedCache.ManagedCacheClient/3.1.0.0"
14+
]
15+
},
16+
"ResponseBody": "<Regions xmlns=\"http://schemas.microsoft.com/windowsazure\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n <Region>East Asia</Region>\r\n <Region>East US</Region>\r\n <Region>East US 2</Region>\r\n <Region>North Central US</Region>\r\n <Region>North Europe</Region>\r\n <Region>Southeast Asia</Region>\r\n <Region>West Europe</Region>\r\n <Region>West US</Region>\r\n <Region>South Central US</Region>\r\n</Regions>",
17+
"ResponseHeaders": {
18+
"Content-Length": [
19+
"375"
20+
],
21+
"Content-Type": [
22+
"application/xml; charset=utf-8"
23+
],
24+
"x-ms-servedbyregion": [
25+
"ussouth3"
26+
],
27+
"Strict-Transport-Security": [
28+
"max-age=31536000; includeSubDomains"
29+
],
30+
"x-ms-request-id": [
31+
"08e394601bbb330d861c6431434ee1e8"
32+
],
33+
"Cache-Control": [
34+
"no-cache"
35+
],
36+
"Date": [
37+
"Tue, 15 Nov 2016 00:48:34 GMT"
38+
],
39+
"Server": [
40+
"1.0.6198.442",
41+
"(rd_rdfe_stable.161012-2349)",
42+
"Microsoft-HTTPAPI/2.0"
43+
]
44+
},
45+
"StatusCode": 200
46+
}
47+
],
48+
"Names": {},
49+
"Variables": {
50+
"SubscriptionId": "67db6ec8-1e63-4a12-a263-eb3b69b7588f"
51+
}
52+
}

src/ServiceManagement/ManagedCache/Commands.ManagedCache/PSCacheClient.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ public CloudServiceResource SetNamedCache(string cacheServiceName, string namedC
284284
return cacheResource;
285285
}
286286

287+
public string GetManagedCacheRetirementMessage()
288+
{
289+
var managedCacheRetirementDate = new DateTime(2016, 12, 01, 00, 00, 00, DateTimeKind.Utc);
290+
return DateTime.UtcNow > managedCacheRetirementDate
291+
? "The Azure Managed Cache Service has been retired as of 11/30/2016. Please migrate to the Azure Redis Cache Service. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458"
292+
: "The Azure Managed Cache Service will be retired on 11/30/2016. Please migrate to the Azure Redis Cache Service. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458";
293+
}
294+
287295
public void RemoveNamedCache(string cacheServiceName, string namedCacheName, Action<bool, string, string, string, Action> ConfirmAction, bool force)
288296
{
289297
if ("default".Equals(namedCacheName))

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/GetAzureManagedCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class GetAzureManagedCache : ManagedCacheCmdletBase
2828

2929
public override void ExecuteCmdlet()
3030
{
31-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
31+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
3232

3333
List<PSCacheService> cacheServices = CacheClient.GetCacheServices(Name);
3434
if (!string.IsNullOrEmpty(Name) && cacheServices.Count == 0)

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/GetAzureManagedCacheAccessKey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class GetAzureManagedCacheAccessKey : ManagedCacheCmdletBase
2727

2828
public override void ExecuteCmdlet()
2929
{
30-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
30+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
3131

3232
CachingKeysResponse response = CacheClient.GetAccessKeys(Name);
3333
WriteObject(new CacheAccessKeys(Name, response));

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/GetAzureManagedCacheLocation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class AzureManagedCacheLocation : ManagedCacheCmdletBase
2424
{
2525
public override void ExecuteCmdlet()
2626
{
27-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
27+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
2828

2929
List<Microsoft.Azure.Management.ManagedCache.Models.RegionsResponse.Region> locations = CacheClient.GetLocations();
3030
WriteObject(locations);

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/GetAzureManagedCacheNamedCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class GetAzureManagedCacheNamedCache : ManagedCacheCmdletBase
3030

3131
public override void ExecuteCmdlet()
3232
{
33-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
33+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
3434

3535
string cacheServiceName = CacheClient.NormalizeCacheServiceName(Name);
3636
CacheClient.ProgressRecorder = (p) => { WriteVerbose(p); };

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/NewAzureManagedCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class NewAzureManagedCache : ManagedCacheCmdletBase, IDynamicParameters
3737

3838
public override void ExecuteCmdlet()
3939
{
40-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
40+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
4141

4242
cacheServiceName = CacheClient.NormalizeCacheServiceName(Name);
4343

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/NewAzureManagedCacheAccessKey.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class NewAzureManagedCacheAccessKey : ManagedCacheCmdletBase
3434

3535
public override void ExecuteCmdlet()
3636
{
37-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
37+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
3838

3939
if (string.IsNullOrEmpty(KeyType))
4040
{

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/NewAzureManagedCacheNamedCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public class NewAzureManagedCacheNamedCache : ManagedCacheCmdletBase
5050

5151
public override void ExecuteCmdlet()
5252
{
53-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
53+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
5454

5555
if (string.IsNullOrEmpty(ExpiryPolicy))
5656
{

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/RemoveAzureManagedCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class RemoveAzureManagedCache : ManagedCacheCmdletBase
3131

3232
public override void ExecuteCmdlet()
3333
{
34-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
34+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
3535

3636
ConfirmAction(
3737
Force.IsPresent,

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/RemoveAzureManagedCacheNamedCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public class RemoveAzureManagedCacheNamedCache : ManagedCacheCmdletBase
3737

3838
public override void ExecuteCmdlet()
3939
{
40-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
40+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
4141

4242
string cacheServiceName = CacheClient.NormalizeCacheServiceName(Name);
4343
CacheClient.ProgressRecorder = (p) => { WriteVerbose(p); };

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/SetAzureManagedCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class SetAzureManagedCache : ManagedCacheCmdletBase, IDynamicParameters
3838

3939
public override void ExecuteCmdlet()
4040
{
41-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
41+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
4242

4343
CacheClient.ProgressRecorder = (message) => { WriteVerbose(message); };
4444
string memory = memoryDynamicParameterSet.GetMemoryValue(Sku);

src/ServiceManagement/ManagedCache/Commands.ManagedCache/Service/SetAzureManagedCacheNamedCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class SetAzureManagedCacheNamedCache : ManagedCacheCmdletBase
5353

5454
public override void ExecuteCmdlet()
5555
{
56-
WriteWarning("Managed Cache will be retired on 11/30/2016. Please migrate to Azure Redis Cache. For more information, see http://go.microsoft.com/fwlink/?LinkID=717458");
56+
WriteWarning(CacheClient.GetManagedCacheRetirementMessage());
5757

5858
if (string.IsNullOrEmpty(ExpiryPolicy))
5959
{

src/ServiceManagement/Services/Commands.Utilities/ChangeLog.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,19 @@
1818
- Additional information about change #1
1919
-->
2020
## Current Release
21+
* Updating Managed Cache warning message which notifies customer about service deprecation on the following cmdlets :
22+
Get-AzureManagedCache
23+
Get-AzureManagedCacheAccessKey
24+
Get-AzureManagedCacheLocation
25+
Get-AzureManagedCacheNamedCache
26+
New-AzureManagedCache
27+
New-AzureManagedCacheAccessKey
28+
New-AzureManagedCacheNamedCache
29+
Remove-AzureManagedCache
30+
Remove-AzureManagedCacheNamedCache
31+
Set-AzureManagedCache
32+
Set-AzureManagedCacheNamedCache
33+
34+
For more information about Managed Cache service deprecation, see http://go.microsoft.com/fwlink/?LinkID=717458
2135

2236
## Version 3.1.0

0 commit comments

Comments
 (0)