Skip to content

Commit 57b8331

Browse files
author
Nicholas King
committed
Address Mark's code review comments - add copyright headers, document classes, remove excessive positional parameters
1 parent 51cd62f commit 57b8331

File tree

9 files changed

+174
-10
lines changed

9 files changed

+174
-10
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,112 @@
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+
// ----------------------------------------------------------------------------------
114

215
using System;
316
using Microsoft.Azure.Management.WebSites.Models;
417

518
namespace Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps
619
{
20+
/// <summary>
21+
/// A simple class containing fields for all metadata associated with a backup.
22+
/// </summary>
723
public class AzureWebAppBackup
824
{
25+
/// <summary>
26+
/// The resource group of the web app
27+
/// </summary>
928
public string ResourceGroupName { get; set; }
29+
30+
/// <summary>
31+
/// The name of the web app
32+
/// </summary>
1033
public string Name { get; set; }
34+
35+
/// <summary>
36+
/// The name of the web app slot
37+
/// </summary>
1138
public string Slot { get; set; }
39+
40+
/// <summary>
41+
/// SAS URL for the storage account container which contains this backup
42+
/// </summary>
1243
public string StorageAccountUrl { get; set; }
44+
45+
/// <summary>
46+
/// Name of the blob which contains data for this backup
47+
/// </summary>
1348
public string BlobName { get; set; }
49+
50+
/// <summary>
51+
/// Databases that are included in this backup
52+
/// </summary>
1453
public DatabaseBackupSetting[] Databases { get; set; }
54+
55+
/// <summary>
56+
/// The numberic ID of this backup
57+
/// </summary>
1558
public int? BackupId { get; set; }
59+
60+
/// <summary>
61+
/// The user-friendly name of this backup
62+
/// </summary>
1663
public string BackupName { get; set; }
64+
65+
/// <summary>
66+
/// The status of the backup. Possible values are InProgress, Failed, Succeeded,
67+
/// TimedOut, Created, Skipped, PartiallySucceeded, DeleteInProgress, DeleteFailed,
68+
/// Deleted.
69+
/// </summary>
1770
public string BackupStatus { get; set; }
71+
72+
/// <summary>
73+
/// True if this backup was automatically created due to a backup schedule
74+
/// </summary>
1875
public bool? Scheduled { get; set; }
76+
77+
/// <summary>
78+
/// The size of this backup in bytes
79+
/// </summary>
1980
public long? BackupSizeInBytes { get; set; }
81+
82+
/// <summary>
83+
/// Size of the original web app which has been backed up
84+
/// </summary>
2085
public long? WebsiteSizeInBytes { get; set; }
86+
87+
/// <summary>
88+
/// Time when the backup was requested
89+
/// </summary>
2190
public DateTime? Created { get; set; }
91+
92+
/// <summary>
93+
/// Time when the web app was last restored from this backup
94+
/// </summary>
2295
public DateTime? LastRestored { get; set; }
96+
97+
/// <summary>
98+
/// Time when the backup finished
99+
/// </summary>
23100
public DateTime? Finished { get; set; }
101+
102+
/// <summary>
103+
/// Log of any failures or warnings associated with this backup
104+
/// </summary>
24105
public string Log { get; set; }
106+
107+
/// <summary>
108+
/// Unique correlation identifier. Please use this along with the timestamp while communicating with Azure support.
109+
/// </summary>
25110
public string CorrelationId { get; set; }
26111
}
27112
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,75 @@
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+
// ----------------------------------------------------------------------------------
114

215
using System;
316
using Microsoft.Azure.Management.WebSites.Models;
417

518
namespace Microsoft.Azure.Commands.WebApps.Cmdlets.WebApps
619
{
20+
/// <summary>
21+
/// A simple class containing fields for all metadata associated with a backup configuration.
22+
/// </summary>
723
public class AzureWebAppBackupConfiguration
824
{
25+
/// <summary>
26+
/// The name of the web app
27+
/// </summary>
928
public string Name { get; set; }
29+
30+
/// <summary>
31+
/// The resource group of the web app
32+
/// </summary>
1033
public string ResourceGroupName { get; set; }
34+
35+
/// <summary>
36+
/// SAS URL for the storage account container to use for scheduled backups
37+
/// </summary>
1138
public string StorageAccountUrl { get; set; }
39+
40+
/// <summary>
41+
/// Numeric part of backup frequency. For example, for weekly backups, FrequencyInterval = 7 and FrequencyUnit = Day.
42+
/// </summary>
1243
public int? FrequencyInterval { get; set; }
44+
45+
/// <summary>
46+
/// Unit of backup frequency. Valid options are Hour and Day. For example, for weekly backups, FrequencyInterval = 7 and FrequencyUnit = Day.
47+
/// </summary>
1348
public string FrequencyUnit { get; set; }
49+
50+
/// <summary>
51+
/// Number of days the automatic backups should be retained before being automatically deleted.
52+
/// </summary>
1453
public int? RetentionPeriodInDays { get; set; }
54+
55+
/// <summary>
56+
/// The time when the first automatic backup should be created.
57+
/// </summary>
1558
public DateTime? StartTime { get; set; }
59+
60+
/// <summary>
61+
/// The databases to be backed up automatically along with the website
62+
/// </summary>
1663
public DatabaseBackupSetting[] Databases { get; set; }
64+
65+
/// <summary>
66+
/// True if one backup should always be left in the storage account regardless of retention period.
67+
/// </summary>
1768
public bool? KeepAtLeastOneBackup { get; set; }
69+
70+
/// <summary>
71+
/// True if the automatic backups are enabled.
72+
/// </summary>
1873
public bool? Enabled { get; set; }
1974
}
2075
}

src/ResourceManager/Websites/Commands.Websites/Cmdlets/BackupRestore/BackupRestoreUtils.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
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+
// ----------------------------------------------------------------------------------
114

215
using System;
316
using System.Linq;

src/ResourceManager/Websites/Commands.Websites/Cmdlets/BackupRestore/EditAzureWebAppBackupConfiguration.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
1615
using System;
1716
using System.Collections.Generic;
1817
using System.Linq;

src/ResourceManager/Websites/Commands.Websites/Cmdlets/BackupRestore/NewAzureRmWebAppDatabaseBackupSetting.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
1-
using System;
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;
216
using System.Collections.Generic;
317
using System.Linq;
418
using System.Management.Automation;

src/ResourceManager/Websites/Commands.Websites/Cmdlets/BackupRestore/NewAzureWebAppBackup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class NewAzureWebAppBackup : WebAppOptionalSlotBaseCmdlet
3333
[Parameter(Position = 4, Mandatory = false, HelpMessage = "The name of the backup.", ValueFromPipelineByPropertyName = true)]
3434
public string BackupName { get; set; }
3535

36-
[Parameter(Position = 5, Mandatory = false, HelpMessage = "The databases to backup.", ValueFromPipelineByPropertyName = true)]
36+
[Parameter(Mandatory = false, HelpMessage = "The databases to backup.", ValueFromPipelineByPropertyName = true)]
3737
public DatabaseBackupSetting[] Databases;
3838

3939
public override void ExecuteCmdlet()

src/ResourceManager/Websites/Commands.Websites/Cmdlets/BackupRestore/RemoveAzureWebAppBackup.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
1615
using System;
1716
using System.Collections.Generic;
1817
using System.Linq;

src/ResourceManager/Websites/Commands.Websites/Cmdlets/BackupRestore/RestoreAzureWebAppBackup.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
1615
using System.Collections.Generic;
1716
using System.Management.Automation;
1817
using Microsoft.Azure.Commands.WebApps.Utilities;
@@ -34,13 +33,13 @@ public class RestoreAzureWebAppBackup : WebAppOptionalSlotBaseCmdlet
3433
[ValidateNotNullOrEmpty]
3534
public string BlobName;
3635

37-
[Parameter(Position = 5, Mandatory = false, HelpMessage = "The databases to restore. Must match the list of databases in the backup.", ValueFromPipelineByPropertyName = true)]
36+
[Parameter(Mandatory = false, HelpMessage = "The databases to restore. Must match the list of databases in the backup.", ValueFromPipelineByPropertyName = true)]
3837
public DatabaseBackupSetting[] Databases { get; set; }
3938

40-
[Parameter(Position = 6, Mandatory = false, HelpMessage = "If specified, an existing web app will be overwritten by the contents of the backup.", ValueFromPipelineByPropertyName = true)]
39+
[Parameter(Mandatory = false, HelpMessage = "If specified, an existing web app will be overwritten by the contents of the backup.", ValueFromPipelineByPropertyName = true)]
4140
public SwitchParameter Overwrite;
4241

43-
[Parameter(Position = 7, Mandatory = false, HelpMessage = "If specified, custom domains are removed automatically during restore. Otherwise, custom domains are added to the site object when it is being restored, but the restore might fail due to conflicts.", ValueFromPipelineByPropertyName = true)]
42+
[Parameter(Mandatory = false, HelpMessage = "If specified, custom domains are removed automatically during restore. Otherwise, custom domains are added to the site object when it is being restored, but the restore might fail due to conflicts.", ValueFromPipelineByPropertyName = true)]
4443
public SwitchParameter IgnoreConflictingHostNames { get; set; }
4544

4645
public override void ExecuteCmdlet()

src/ResourceManager/Websites/Commands.Websites/Models.WebApp/WebAppOptionalSlotBaseCmdlet.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ namespace Microsoft.Azure.Commands.WebApps
88
// For some cmdlets, the slot is optional, but will be used if specified.
99
public class WebAppOptionalSlotBaseCmdlet : WebAppBaseClientCmdLet
1010
{
11-
protected const string ParameterSet1Name = "S1";
12-
protected const string ParameterSet2Name = "S2";
11+
protected const string ParameterSet1Name = "FromResourceName";
12+
protected const string ParameterSet2Name = "FromWebApp";
1313

1414
[Parameter(ParameterSetName = ParameterSet1Name, Position = 0, Mandatory = true,
1515
HelpMessage = "The name of the resource group.", ValueFromPipelineByPropertyName = true)]

0 commit comments

Comments
 (0)