diff --git a/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/RecoveryServicesTestBase.cs b/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/RecoveryServicesTestBase.cs index dc77ce8c6597b..f33e4061102be 100644 --- a/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/RecoveryServicesTestBase.cs +++ b/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/RecoveryServicesTestBase.cs @@ -101,6 +101,15 @@ public List ListVaultUsages(string vaultName) return VaultClient.VaultUsages.List(vaultName, resourceGroup).ToList(); } + /// + /// List vault replication usages. + /// + /// List of vault replication usages. + public List ListVaultReplicationUsages(string vaultName) + { + return VaultClient.ReplicationUsages.List(vaultName, resourceGroup).ToList(); + } + #endregion VaultUsages public void Dispose() diff --git a/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/ScenarioTests/VaultUsageScenarioTests.cs b/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/ScenarioTests/VaultUsageScenarioTests.cs index d138c5eae8569..2dbd5e5841a10 100644 --- a/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/ScenarioTests/VaultUsageScenarioTests.cs +++ b/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/ScenarioTests/VaultUsageScenarioTests.cs @@ -54,5 +54,36 @@ public void RetrieveVaultUsages() } } } + + [Fact] + public void RetrieveVaultReplicationUsages() + { + using (var context = MockContext.Start(this.GetType().FullName)) + { + using (RecoveryServicesTestBase _testFixture = new RecoveryServicesTestBase(context)) + { + string vaultName = VaultDefinition.TestCrud.VaultName; + + _testFixture.CreateVault(vaultName); + var vault = _testFixture.GetVault(vaultName); + Assert.NotNull(vault); + + var vaults = _testFixture.ListVaults(); + Assert.NotNull(vaults); + Assert.NotEmpty(vaults); + Assert.True(vaults.Any(v => v.Name == vaultName)); + + var response = _testFixture.ListVaultReplicationUsages(vaultName); + + Assert.NotNull(response); + foreach (var replicationUsage in response) + { + Assert.NotNull(replicationUsage.JobsSummary); + Assert.NotNull(replicationUsage.MonitoringSummary); + Assert.True(replicationUsage.ProtectedItemCount >=0 ); + } + } + } + } } } diff --git a/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/SessionRecords/Microsoft.Azure.Management.RecoveryServices.Tests.VaultUsageScenarioTests/RetrieveVaultReplicationUsages.json b/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/SessionRecords/Microsoft.Azure.Management.RecoveryServices.Tests.VaultUsageScenarioTests/RetrieveVaultReplicationUsages.json new file mode 100644 index 0000000000000..9dca90bbb2283 --- /dev/null +++ b/src/ResourceManagement/RecoveryServices/RecoveryServices.Tests/SessionRecords/Microsoft.Azure.Management.RecoveryServices.Tests.VaultUsageScenarioTests/RetrieveVaultReplicationUsages.json @@ -0,0 +1,454 @@ +{ + "Entries": [ + { + "RequestUri": "/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourcegroups/RecoveryServicesTestRg?api-version=2015-11-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjc0MjQ0MzAtMTAzYi00YmEzLWJkOWUtYjZmMDk4NmY4NDhhL3Jlc291cmNlZ3JvdXBzL1JlY292ZXJ5U2VydmljZXNUZXN0Umc/YXBpLXZlcnNpb249MjAxNS0xMS0wMQ==", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "28" + ], + "x-ms-client-request-id": [ + "f5e9c6f8-8ffa-4e36-82ab-f8e566b50160" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.24410.01", + "Microsoft.Azure.Management.Resources.ResourceManagementClient/1.0.0-preview" + ] + }, + "ResponseBody": "{\r\n \"id\": \"/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg\",\r\n \"name\": \"RecoveryServicesTestRg\",\r\n \"location\": \"westus\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "197" + ], + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 01 Mar 2017 12:21:49 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1195" + ], + "x-ms-request-id": [ + "04402415-7cc5-4044-86df-81037fda2add" + ], + "x-ms-correlation-request-id": [ + "04402415-7cc5-4044-86df-81037fda2add" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20170301T122149Z:04402415-7cc5-4044-86df-81037fda2add" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults/SDKTestRsVault?api-version=2016-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjc0MjQ0MzAtMTAzYi00YmEzLWJkOWUtYjZmMDk4NmY4NDhhL3Jlc291cmNlR3JvdXBzL1JlY292ZXJ5U2VydmljZXNUZXN0UmcvcHJvdmlkZXJzL01pY3Jvc29mdC5SZWNvdmVyeVNlcnZpY2VzL3ZhdWx0cy9TREtUZXN0UnNWYXVsdD9hcGktdmVyc2lvbj0yMDE2LTA2LTAx", + "RequestMethod": "PUT", + "RequestBody": "{\r\n \"properties\": {},\r\n \"sku\": {\r\n \"name\": \"Standard\"\r\n },\r\n \"location\": \"westus\"\r\n}", + "RequestHeaders": { + "Content-Type": [ + "application/json; charset=utf-8" + ], + "Content-Length": [ + "91" + ], + "x-ms-client-request-id": [ + "636e73e1-03cb-454c-b433-5d7d54fac7f2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.24410.01", + "Microsoft.Azure.Management.RecoveryServices.RecoveryServicesClient/4.0.1-preview" + ] + }, + "ResponseBody": "{\r\n \"location\": \"westus\",\r\n \"name\": \"SDKTestRsVault\",\r\n \"etag\": \"W/\\\"datetime'2017-03-01T12%3A21%3A56.7529534Z'\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"id\": \"/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults/SDKTestRsVault\",\r\n \"type\": \"Microsoft.RecoveryServices/vaults\",\r\n \"sku\": {\r\n \"name\": \"Standard\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Length": [ + "375" + ], + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 01 Mar 2017 12:21:57 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "x-ms-request-id": [ + "4c40212d-1e61-4d85-b92d-c9aa5b22b8e7" + ], + "x-ms-client-request-id": [ + "636e73e1-03cb-454c-b433-5d7d54fac7f2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1198" + ], + "x-ms-correlation-request-id": [ + "4c40212d-1e61-4d85-b92d-c9aa5b22b8e7" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20170301T122158Z:4c40212d-1e61-4d85-b92d-c9aa5b22b8e7" + ] + }, + "StatusCode": 201 + }, + { + "RequestUri": "/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults/SDKTestRsVault?api-version=2016-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjc0MjQ0MzAtMTAzYi00YmEzLWJkOWUtYjZmMDk4NmY4NDhhL3Jlc291cmNlR3JvdXBzL1JlY292ZXJ5U2VydmljZXNUZXN0UmcvcHJvdmlkZXJzL01pY3Jvc29mdC5SZWNvdmVyeVNlcnZpY2VzL3ZhdWx0cy9TREtUZXN0UnNWYXVsdD9hcGktdmVyc2lvbj0yMDE2LTA2LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "9a59c4c8-c010-4a70-bb6d-f14fae0083eb" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.24410.01", + "Microsoft.Azure.Management.RecoveryServices.RecoveryServicesClient/4.0.1-preview" + ] + }, + "ResponseBody": "{\r\n \"location\": \"westus\",\r\n \"name\": \"SDKTestRsVault\",\r\n \"etag\": \"W/\\\"datetime'2017-03-01T12%3A21%3A56.7529534Z'\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"id\": \"/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults/SDKTestRsVault\",\r\n \"type\": \"Microsoft.RecoveryServices/vaults\",\r\n \"sku\": {\r\n \"name\": \"Standard\"\r\n }\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 01 Mar 2017 12:21:58 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "d212fc0f-0177-4fe1-b94e-2849dd5c2411" + ], + "x-ms-client-request-id": [ + "9a59c4c8-c010-4a70-bb6d-f14fae0083eb" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14890" + ], + "x-ms-correlation-request-id": [ + "d212fc0f-0177-4fe1-b94e-2849dd5c2411" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20170301T122158Z:d212fc0f-0177-4fe1-b94e-2849dd5c2411" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults?api-version=2016-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjc0MjQ0MzAtMTAzYi00YmEzLWJkOWUtYjZmMDk4NmY4NDhhL3Jlc291cmNlR3JvdXBzL1JlY292ZXJ5U2VydmljZXNUZXN0UmcvcHJvdmlkZXJzL01pY3Jvc29mdC5SZWNvdmVyeVNlcnZpY2VzL3ZhdWx0cz9hcGktdmVyc2lvbj0yMDE2LTA2LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "79ff8eae-1a56-458e-a86b-c9462aab7370" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.24410.01", + "Microsoft.Azure.Management.RecoveryServices.RecoveryServicesClient/4.0.1-preview" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SDKTestRsVault\",\r\n \"etag\": \"W/\\\"datetime'2017-03-01T12%3A21%3A56.7529534Z'\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"id\": \"/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults/SDKTestRsVault\",\r\n \"type\": \"Microsoft.RecoveryServices/vaults\",\r\n \"sku\": {\r\n \"name\": \"Standard\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 01 Mar 2017 12:21:58 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "42cda68e-d398-4ab5-af5d-a9b7418e3d47" + ], + "x-ms-client-request-id": [ + "79ff8eae-1a56-458e-a86b-c9462aab7370" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14889" + ], + "x-ms-correlation-request-id": [ + "42cda68e-d398-4ab5-af5d-a9b7418e3d47" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20170301T122158Z:42cda68e-d398-4ab5-af5d-a9b7418e3d47" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults?api-version=2016-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjc0MjQ0MzAtMTAzYi00YmEzLWJkOWUtYjZmMDk4NmY4NDhhL3Jlc291cmNlR3JvdXBzL1JlY292ZXJ5U2VydmljZXNUZXN0UmcvcHJvdmlkZXJzL01pY3Jvc29mdC5SZWNvdmVyeVNlcnZpY2VzL3ZhdWx0cz9hcGktdmVyc2lvbj0yMDE2LTA2LTAx", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "cbda2c41-4f5f-42da-825e-eed5708153c6" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.24410.01", + "Microsoft.Azure.Management.RecoveryServices.RecoveryServicesClient/4.0.1-preview" + ] + }, + "ResponseBody": "{\r\n \"value\": [\r\n {\r\n \"location\": \"westus\",\r\n \"name\": \"SDKTestRsVault\",\r\n \"etag\": \"W/\\\"datetime'2017-03-01T12%3A21%3A56.7529534Z'\\\"\",\r\n \"properties\": {\r\n \"provisioningState\": \"Succeeded\"\r\n },\r\n \"id\": \"/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults/SDKTestRsVault\",\r\n \"type\": \"Microsoft.RecoveryServices/vaults\",\r\n \"sku\": {\r\n \"name\": \"Standard\"\r\n }\r\n }\r\n ]\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 01 Mar 2017 12:22:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-IIS/8.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "53c56c17-53f7-40d7-8fa6-a25c78742225" + ], + "x-ms-client-request-id": [ + "cbda2c41-4f5f-42da-825e-eed5708153c6" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14887" + ], + "x-ms-correlation-request-id": [ + "53c56c17-53f7-40d7-8fa6-a25c78742225" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20170301T122200Z:53c56c17-53f7-40d7-8fa6-a25c78742225" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/Subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults/SDKTestRsVault/replicationUsages?api-version=2015-11-10", + "EncodedRequestUri": "L1N1YnNjcmlwdGlvbnMvZjc0MjQ0MzAtMTAzYi00YmEzLWJkOWUtYjZmMDk4NmY4NDhhL3Jlc291cmNlR3JvdXBzL1JlY292ZXJ5U2VydmljZXNUZXN0UmcvcHJvdmlkZXJzL01pY3Jvc29mdC5SZWNvdmVyeVNlcnZpY2VzL3ZhdWx0cy9TREtUZXN0UnNWYXVsdC9yZXBsaWNhdGlvblVzYWdlcz9hcGktdmVyc2lvbj0yMDE1LTExLTEw", + "RequestMethod": "GET", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "eb7feba6-86b3-401a-9450-2dc6ce2ee740" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.24410.01", + "Microsoft.Azure.Management.RecoveryServices.RecoveryServicesClient/4.0.1-preview" + ] + }, + "ResponseBody": "{\r\n \"monitoringSummary\": {\r\n \"unHealthyVmCount\": 0,\r\n \"unHealthyProviderCount\": 0,\r\n \"eventsCount\": 0,\r\n \"deprecatedProviderCount\": 0,\r\n \"supportedProviderCount\": 0,\r\n \"unsupportedProviderCount\": 0\r\n },\r\n \"jobsSummary\": {\r\n \"failedJobs\": 0,\r\n \"suspendedJobs\": 0,\r\n \"inProgressJobs\": 0\r\n },\r\n \"protectedItemCount\": 0,\r\n \"registeredServersCount\": 0,\r\n \"recoveryPlanCount\": 0\r\n}", + "ResponseHeaders": { + "Content-Type": [ + "application/json" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 01 Mar 2017 12:22:00 GMT" + ], + "Pragma": [ + "no-cache" + ], + "Transfer-Encoding": [ + "chunked" + ], + "Server": [ + "Microsoft-IIS/8.0", + "Microsoft-IIS/8.0" + ], + "Vary": [ + "Accept-Encoding" + ], + "x-ms-request-id": [ + "eb7feba6-86b3-401a-9450-2dc6ce2ee740 3/1/2017 12:21:59 PM" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "X-AspNet-Version": [ + "4.0.30319" + ], + "X-Powered-By": [ + "ASP.NET" + ], + "x-ms-client-request-id": [ + "eb7feba6-86b3-401a-9450-2dc6ce2ee740" + ], + "x-ms-ratelimit-remaining-subscription-reads": [ + "14888" + ], + "x-ms-correlation-request-id": [ + "1f97aca4-e373-435d-8506-9fcfcfda3606" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20170301T122200Z:1f97aca4-e373-435d-8506-9fcfcfda3606" + ] + }, + "StatusCode": 200 + }, + { + "RequestUri": "/subscriptions/f7424430-103b-4ba3-bd9e-b6f0986f848a/resourceGroups/RecoveryServicesTestRg/providers/Microsoft.RecoveryServices/vaults/SDKTestRsVault?api-version=2016-06-01", + "EncodedRequestUri": "L3N1YnNjcmlwdGlvbnMvZjc0MjQ0MzAtMTAzYi00YmEzLWJkOWUtYjZmMDk4NmY4NDhhL3Jlc291cmNlR3JvdXBzL1JlY292ZXJ5U2VydmljZXNUZXN0UmcvcHJvdmlkZXJzL01pY3Jvc29mdC5SZWNvdmVyeVNlcnZpY2VzL3ZhdWx0cy9TREtUZXN0UnNWYXVsdD9hcGktdmVyc2lvbj0yMDE2LTA2LTAx", + "RequestMethod": "DELETE", + "RequestBody": "", + "RequestHeaders": { + "x-ms-client-request-id": [ + "484e99d9-a889-4ba6-ae74-e2c90d4e0fb2" + ], + "accept-language": [ + "en-US" + ], + "User-Agent": [ + "FxVersion/4.6.24410.01", + "Microsoft.Azure.Management.RecoveryServices.RecoveryServicesClient/4.0.1-preview" + ] + }, + "ResponseBody": "", + "ResponseHeaders": { + "Content-Length": [ + "0" + ], + "Expires": [ + "-1" + ], + "Cache-Control": [ + "no-cache" + ], + "Date": [ + "Wed, 01 Mar 2017 12:22:04 GMT" + ], + "Pragma": [ + "no-cache" + ], + "x-ms-request-id": [ + "65555711-8150-4194-8331-e1638a334f5d" + ], + "x-ms-client-request-id": [ + "484e99d9-a889-4ba6-ae74-e2c90d4e0fb2" + ], + "Strict-Transport-Security": [ + "max-age=31536000; includeSubDomains" + ], + "x-ms-ratelimit-remaining-subscription-writes": [ + "1197" + ], + "x-ms-correlation-request-id": [ + "65555711-8150-4194-8331-e1638a334f5d" + ], + "x-ms-routing-request-id": [ + "SOUTHINDIA:20170301T122204Z:65555711-8150-4194-8331-e1638a334f5d" + ] + }, + "StatusCode": 200 + } + ], + "Names": {}, + "Variables": { + "SubscriptionId": "f7424430-103b-4ba3-bd9e-b6f0986f848a" + } +} \ No newline at end of file