Skip to content

Commit 0eca33d

Browse files
author
dragonfly91
committed
Skeleton code for Get-AzureBackupContainer (w/o hydra components)
1 parent 53133ba commit 0eca33d

File tree

6 files changed

+124
-2
lines changed

6 files changed

+124
-2
lines changed

src/ResourceManager/AzureBackup/Commands.AzureBackup/AzureBackupCmdletHelpMessage.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414

1515
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
1616
{
17-
1817
internal static class AzureBackupCmdletHelpMessage
1918
{
2019
public const string Vault = "The vault details";
2120
public const string PolicyName = "The protection policy name.";
2221
public const string ResourceGroupName = "The ResourceGroup name.";
2322
public const string ResourceName = "The Resource name.";
2423
public const string TargetLocation = "The directory where the credentials file will be saved.";
24+
public const string ContainerName = "The container name.";
25+
public const string ContainerId = "The container ID.";
26+
public const string ContainerRegistrationStatus = "The container registration status.";
27+
public const string ContainerType = "The container type.";
2528
}
2629
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Management.Automation;
19+
using System.Text;
20+
using System.Threading.Tasks;
21+
22+
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
23+
{
24+
/// <summary>
25+
/// Get list of containers
26+
/// </summary>
27+
[Cmdlet(VerbsCommon.Get, "AzureBackupContainer"), OutputType(typeof(AzureBackupContainer), typeof(List<AzureBackupContainer>))]
28+
public class GetAzureBackupContainer : AzureBackupVaultCmdletBase
29+
{
30+
[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerName)]
31+
[ValidateNotNullOrEmpty]
32+
public string Name { get; set; }
33+
34+
[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerId)]
35+
[ValidateNotNullOrEmpty]
36+
public string Id { get; set; }
37+
38+
[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerRegistrationStatus)]
39+
[ValidateNotNullOrEmpty]
40+
public AzureBackupContainerStatus Status { get; set; }
41+
42+
[Parameter(Position = 2, Mandatory = false, HelpMessage = AzureBackupCmdletHelpMessage.ContainerType)]
43+
[ValidateNotNullOrEmpty]
44+
public AzureBackupContainerType Type { get; set; }
45+
46+
public override void ExecuteCmdlet()
47+
{
48+
base.ExecuteCmdlet();
49+
50+
ExecutionBlock(() =>
51+
{
52+
IEnumerable<AzureBackupContainer> containers = new List<AzureBackupContainer>();
53+
54+
// TODO: Call Hydra
55+
56+
WriteObject(containers);
57+
});
58+
}
59+
}
60+
}

src/ResourceManager/AzureBackup/Commands.AzureBackup/Cmdlets/ProtectionPolicy/GetAzureBackupProtectionPolicy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
2323
{
2424
/// <summary>
25-
/// Get list of containers
25+
/// Get list of protection policies
2626
/// </summary>
2727
[Cmdlet(VerbsCommon.Get, "AzureBackupProtectionPolicy"), OutputType(typeof(AzureBackupProtectionPolicy), typeof(List<AzureBackupProtectionPolicy>))]
2828
public class GetAzureBackupProtectionPolicy : AzureBackupVaultCmdletBase

src/ResourceManager/AzureBackup/Commands.AzureBackup/Commands.AzureBackup.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@
121121
<Compile Include="AzureBackupCmdletBase.cs" />
122122
<Compile Include="AzureBackupCmdletHelpMessage.cs" />
123123
<Compile Include="Cmdlets\BackUp\TriggerBackUp.cs" />
124+
<Compile Include="Cmdlets\Container\GetAzureBackupContainer.cs" />
124125
<Compile Include="Cmdlets\Jobs\GetAzureBackupJob.cs" />
125126
<Compile Include="Cmdlets\ProtectionPolicy\GetAzureBackupProtectionPolicy.cs" />
126127
<Compile Include="Cmdlets\VaultCredentials\AcsNamespace.cs" />
@@ -130,6 +131,8 @@
130131
<Compile Include="Cmdlets\VaultCredentials\VaultCredentials.cs" />
131132
<Compile Include="Models\AzureBackupBaseObjects.cs" />
132133
<Compile Include="Models\AzureBackupContainer.cs" />
134+
<Compile Include="Models\AzureBackupContainerStatus.cs" />
135+
<Compile Include="Models\AzureBackupContainerType.cs" />
133136
<Compile Include="Models\AzureBackupItem.cs" />
134137
<Compile Include="Models\AzureBackupRecoveryPoint.cs" />
135138
<Compile Include="Models\ProtectionPolicy.cs" />
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
22+
{
23+
public enum AzureBackupContainerStatus
24+
{
25+
Registered,
26+
Registering,
27+
NotRegistered
28+
}
29+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using System;
16+
using System.Collections.Generic;
17+
using System.Linq;
18+
using System.Text;
19+
using System.Threading.Tasks;
20+
21+
namespace Microsoft.Azure.Commands.AzureBackup.Cmdlets
22+
{
23+
public enum AzureBackupContainerType
24+
{
25+
AzureVirtualMachine
26+
}
27+
}

0 commit comments

Comments
 (0)