Skip to content

Commit a60c201

Browse files
committed
vault cmdlets
2 parents ab44b21 + c97c5c3 commit a60c201

File tree

4 files changed

+44
-7
lines changed

4 files changed

+44
-7
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<runtime>
4+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5+
<dependentAssembly>
6+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
7+
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0"/>
8+
</dependentAssembly>
9+
</assemblyBinding>
10+
</runtime>
11+
</configuration>

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Container/GetAzureBackupContainer.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ public override void ExecuteCmdlet()
5757
queryFilterString = ConstructQueryFilterString();
5858
var containerList = AzureBackupClient.ListContainers(queryFilterString);
5959

60+
<<<<<<< HEAD
6061
WriteDebug(string.Format("Fetched {0} containers", containerList.Count()));
62+
=======
63+
WriteDebug(string.Format("# of fetched containers = {0}", listContainerResponse.Objects.Count));
64+
>>>>>>> dev
6165

6266
List<ContainerInfo> containerInfos = containerList.ToList();
6367

@@ -69,17 +73,23 @@ public override void ExecuteCmdlet()
6973
{
7074
return containerInfo.ParentContainerName != ContainerResourceGroupName;
7175
});
76+
WriteDebug(string.Format("# of containers after resource group filter = {0}", containerInfos.Count));
7277
}
7378

79+
<<<<<<< HEAD
7480
WriteDebug(string.Format("Count of containers after resource group filter = {0}", containerInfos.Count));
7581

7682
// TODO: Container friendly name is not captures in Container response
7783
// BUG: Friendly name was previously assigned to ResourceName (vault name)
84+
=======
85+
>>>>>>> dev
7886
List<AzureBackupContainer> containers = containerInfos.ConvertAll(containerInfo =>
7987
{
8088
return new AzureBackupContainer(vault, containerInfo);
8189
});
8290

91+
// When container resource name and container resource group name are specified, this parameter set
92+
// identifies a container uniquely. Thus, we return just one container instead of a list.
8393
if (!string.IsNullOrEmpty(ContainerResourceName) & !string.IsNullOrEmpty(ContainerResourceGroupName))
8494
{
8595
if (containers.Any())

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/GetAzureBackupVaultCredentials/GetAzureBackupVaultCredentials.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ public override void ExecuteCmdlet()
5454
string resourceType = "resourceType";
5555
string displayName = subscriptionId + "_" + ResourceGroupName + "_" + ResourceName;
5656

57-
WriteVerbose(string.Format(CultureInfo.InvariantCulture,
58-
"Executing cmdlet with SubscriptionId = {0}, ResourceGroupName = {1}, ResourceName = {2}, TargetLocation = {3}",
59-
subscriptionId, ResourceGroupName, ResourceName, TargetLocation));
57+
WriteDebug(string.Format(CultureInfo.InvariantCulture,
58+
"Executing cmdlet with SubscriptionId = {0}, ResourceGroupName = {1}, ResourceName = {2}, TargetLocation = {3}",
59+
subscriptionId, ResourceGroupName, ResourceName, TargetLocation));
6060

6161
X509Certificate2 cert = CertUtils.CreateSelfSignedCert(CertUtils.DefaultIssuer,
6262
CertUtils.GenerateCertFriendlyName(subscriptionId, ResourceName),
@@ -69,9 +69,9 @@ public override void ExecuteCmdlet()
6969
try
7070
{
7171
// Upload cert into ID Mgmt
72-
WriteVerbose(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Going to upload the certificate"));
72+
WriteDebug(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Going to upload the certificate"));
7373
acsNamespace = UploadCert(cert, subscriptionId, ResourceName, resourceType, ResourceGroupName);
74-
WriteVerbose(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Successfully uploaded the certificate"));
74+
WriteDebug(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Successfully uploaded the certificate"));
7575
}
7676
catch (Exception exception)
7777
{
@@ -90,7 +90,7 @@ public override void ExecuteCmdlet()
9090
directoryPath = TargetLocation;
9191
}
9292
string filePath = Path.Combine(directoryPath, fileName);
93-
WriteVerbose(string.Format("Saving Vault Credentials to file : {0}", filePath));
93+
WriteDebug(string.Format("Saving Vault Credentials to file : {0}", filePath));
9494

9595
File.WriteAllBytes(filePath, Encoding.UTF8.GetBytes(vaultCredsFileContent));
9696

@@ -187,7 +187,7 @@ private string GenerateVaultCredsForBackup(X509Certificate2 cert, string subscri
187187
DataContractSerializer serializer = new DataContractSerializer(typeof(BackupVaultCreds));
188188
serializer.WriteObject(writer, backupVaultCreds);
189189

190-
WriteVerbose(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Backup Vault - Successfully serialized the file content"));
190+
WriteDebug(string.Format(CultureInfo.InvariantCulture, "RecoveryService - Backup Vault - Successfully serialized the file content"));
191191
}
192192

193193
return Encoding.UTF8.GetString(output.ToArray());

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/Vault/SetAzureBackupVaultStorageType.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,24 @@ public override void ExecuteCmdlet()
4141
throw new ArgumentException("Invalid storage type.");
4242
}
4343

44+
<<<<<<< HEAD
4445
WriteVerbose(String.Format("Updating the storage type. Type:{0}", Type));
4546
AzureBackupClient.UpdateStorageType(Type.ToString());
47+
=======
48+
WriteDebug("Updating the storage type.");
49+
50+
UpdateVaultStorageTypeRequest updateVaultStorageTypeRequest = new UpdateVaultStorageTypeRequest()
51+
{
52+
StorageTypeProperties = new StorageTypeProperties()
53+
{
54+
StorageModelType = Type.ToString(),
55+
},
56+
};
57+
58+
AzureBackupClient.Vault.UpdateStorageTypeAsync(updateVaultStorageTypeRequest, GetCustomRequestHeaders(), CmdletCancellationToken).Wait();
59+
60+
WriteDebug("Update successful.");
61+
>>>>>>> dev
4662
});
4763
}
4864
}

0 commit comments

Comments
 (0)