Skip to content

Commit

Permalink
Fix formatting / Fix Descriptions / Fix Typos (AzureRT#32)
Browse files Browse the repository at this point in the history
* Fix formatting using stylecon

* Flush cmdlet updates

* Get-AzHpcCache cmdlet updates

* Get-AzHpcCacheSku cmdlet updates

* Get-AzHpcCacheStorageTarget cmdlet updates

* Get-AzHpcCacheUsageModels cmdlet updates

* New-AzHpcCache cmdlet updates

* Remove-AzHpcCache cmdlet updates

* Remove-AzHpcCacheStorageCache cmdlet updates

* Set-AzHpcCache cmdlet updates

* Start-AzHpcCache cmdlet updates

* Stop-AzHpcCache cmdlet updates

* Upgrade-AzHpcCache cmdlet updates

* New-AzHpcCacheStorageTarget and Set-AzHpcCacheStorageTarget cmdlet updates
  • Loading branch information
rebecca-makar authored Mar 12, 2020
1 parent c307861 commit 02d241b
Show file tree
Hide file tree
Showing 31 changed files with 242 additions and 83 deletions.
2 changes: 1 addition & 1 deletion src/StorageCache/HPCCache/Commands/FlushAzHpcCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class FlushAzHpcCache : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets switch parameter passthru.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "This Cmdlet does not return an object by default. If this switch is specified, it returns true if successful.")]
[Parameter(Mandatory = false, HelpMessage = "Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.")]
public SwitchParameter PassThru { get; set; }

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/StorageCache/HPCCache/Commands/GetAzHpcCacheSku.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Microsoft.Azure.Commands.HPCCache
using Microsoft.Azure.PowerShell.Cmdlets.HPCCache.Models;

/// <summary>
/// Get SKUs related to HPC Cache service.
/// Get SKUs related to HPC Cache that are available in subscription
/// </summary>
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "HpcCacheSku")]
[OutputType(typeof(PSSku))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class GetAzHpcCacheStorageTarget : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets storage target name.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false, HelpMessage = "Name of storageTarget.")]
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = false, HelpMessage = "Name of storage target.")]
[ValidateNotNullOrEmpty]
public string StorageTargetName { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Commands.HPCCache
using Microsoft.Azure.PowerShell.Cmdlets.HPCCache.Models;

/// <summary>
/// Get UsageModels related to HPC Cache Storage Target.
/// Get usage models related to HPC Cache NFS Storage Target.
/// </summary>
[Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "HpcCacheUsageModels")]
public class GetAzHpcCacheUsageModels : HpcCacheBaseCmdlet
Expand Down
10 changes: 5 additions & 5 deletions src/StorageCache/HPCCache/Commands/NewAzHpcCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ namespace Microsoft.Azure.Commands.HPCCache
using Microsoft.Rest.Azure;

/// <summary>
/// NewHPCCache comandlet.
/// Creates a HPC Cache.
/// </summary>
[Cmdlet("New", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "HpcCache")]
[OutputType(typeof(PSHPCCache))]
public class NewAzHpcCache : HpcCacheBaseCmdlet
{
/// <summary>
/// Gets or sets resource Group Name.
/// Gets or sets resource group name.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of resource group under which you want to create cache.")]
[ValidateNotNullOrEmpty]
public string ResourceGroupName { get; set; }

/// <summary>
/// Gets or sets resource CacheName.
/// Gets or sets cache name.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of cache.")]
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of cache.")]
[ValidateNotNullOrEmpty]
public string CacheName { get; set; }

Expand Down Expand Up @@ -112,7 +112,7 @@ public override void ExecuteCmdlet()
catch (CloudErrorException ex)
{
throw new CloudException(string.Format("Exception: {0}", ex.Body.Error.Message));
}
}
}
}
}
15 changes: 14 additions & 1 deletion src/StorageCache/HPCCache/Commands/NewAzHpcStorageTarget.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
namespace Microsoft.Azure.Commands.HPCCache
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
namespace Microsoft.Azure.Commands.HPCCache
{
using System;
using System.Collections;
Expand Down
6 changes: 3 additions & 3 deletions src/StorageCache/HPCCache/Commands/RemoveAzHpcCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class RemoveAzHpcCache : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets ResourceGroupName.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of resource group under which you want to delete cache.")]
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of resource group under which you want to remove cache.")]
[ValidateNotNullOrEmpty]
public string ResourceGroupName { get; set; }

Expand All @@ -44,13 +44,13 @@ public class RemoveAzHpcCache : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets Delete Force - always set to false.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to delete the cache.")]
[Parameter(Mandatory = false, HelpMessage = "Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to remove the cache.")]
public SwitchParameter Force { get; set; }

/// <summary>
/// Gets or sets Switch parameter if you do not want to wait till success.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "This Cmdlet does not return an object by default. If this switch is specified, it returns true if successful.")]
[Parameter(Mandatory = false, HelpMessage = "Returns an object representing the item with which you are working.By default, this cmdlet does not generate any output.")]
public SwitchParameter PassThru { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class RemoveAzHpcCacheStorageTarget : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets ResourceGroupName.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of resource group under which you want to delete storagetarget from cache.")]
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of resource group under which you want to remove storage target from cache.")]
[ValidateNotNullOrEmpty]
public string ResourceGroupName { get; set; }

Expand All @@ -51,13 +51,13 @@ public class RemoveAzHpcCacheStorageTarget : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets Delete Force - always set to false.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to delete the storage target.")]
[Parameter(Mandatory = false, HelpMessage = "Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to remove the storage target.")]
public SwitchParameter Force { get; set; }

/// <summary>
/// Gets or sets Switch parameter if you do not want to wait till success.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "This Cmdlet does not return an object by default. If this switch is specified, it returns true if successful.")]
[Parameter(Mandatory = false, HelpMessage = "Returns an object representing the item with which you are working.By default, this cmdlet does not generate any output.")]
public SwitchParameter PassThru { get; set; }

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions src/StorageCache/HPCCache/Commands/SetAzHpcCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public class SetAzHpcCache : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets resource CacheName.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of cache you want to update.")]
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of cache.")]
[ValidateNotNullOrEmpty]
public string CacheName { get; set; }

/// <summary>
/// Gets or sets the tags to associate with HPC Cache.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "The tags to associate with HPC Cache that are getting updated.")]
[Parameter(Mandatory = false, HelpMessage = "The tags to associate with HPC Cache.")]
public Hashtable Tag { get; set; }

/// <summary>
Expand Down
29 changes: 20 additions & 9 deletions src/StorageCache/HPCCache/Commands/SetAzHpcStorageTarget.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
namespace Microsoft.Azure.Commands.HPCCache
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
namespace Microsoft.Azure.Commands.HPCCache
{
using System;
using System.Collections;
Expand Down Expand Up @@ -29,21 +42,21 @@ public class SetAzHpcStorageTarget : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets resource Group Name.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of resource group under which you want to update cache.")]
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of resource group under which you want to update storage target.")]
[ValidateNotNullOrEmpty]
public string ResourceGroupName { get; set; }

/// <summary>
/// Gets or sets resource CacheName.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of cache.")]
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of cache.")]
[ValidateNotNullOrEmpty]
public string CacheName { get; set; }

/// <summary>
/// Gets or sets resource storage target name.
/// </summary>
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of storage target.")]
[Parameter(ValueFromPipelineByPropertyName = true, Mandatory = true, HelpMessage = "Name of storage target.")]
[ValidateNotNullOrEmpty]
public string StorageTargetName { get; set; }

Expand All @@ -61,7 +74,6 @@ public class SetAzHpcStorageTarget : HpcCacheBaseCmdlet
[ValidateNotNullOrEmpty]
public SwitchParameter NFS { get; set; }


/// <summary>
/// Gets or sets junctions. Note: only junctions can be updated as of now.
/// </summary>
Expand Down Expand Up @@ -116,7 +128,6 @@ public override void ExecuteCmdlet()
}
}


var results = new List<PSHpcStorageTarget>() { this.CreateStorageTargetModel() };
this.WriteObject(results, enumerateCollection: true);
}
Expand All @@ -133,13 +144,12 @@ private PSHpcStorageTarget CreateStorageTargetModel()
}
catch (CloudErrorException ex)
{

// Fix for update storage target, until Swagger is updated with correct response code.
if (ex.Response.StatusCode == HttpStatusCode.Accepted)
{
try
{
storageTarget = Rest.Serialization.SafeJsonConvert.DeserializeObject<StorageTarget>(ex.Response.Content, this.HpcCacheClient.DeserializationSettings);
this.storageTarget = Rest.Serialization.SafeJsonConvert.DeserializeObject<StorageTarget>(ex.Response.Content, this.HpcCacheClient.DeserializationSettings);
}
catch (JsonException jsonEx)
{
Expand All @@ -151,7 +161,8 @@ private PSHpcStorageTarget CreateStorageTargetModel()
throw;
}
}
return new PSHpcStorageTarget(storageTarget);

return new PSHpcStorageTarget(this.storageTarget);
}

private StorageTarget DoesStorageTargetExists()
Expand Down
1 change: 1 addition & 0 deletions src/StorageCache/HPCCache/Commands/StopAzHpcCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ private void StopHpcCache()
{
throw new PSArgumentNullException("CacheName");
}

try
{
this.HpcCacheClient.Caches.Stop(this.ResourceGroupName, this.CacheName);
Expand Down
3 changes: 2 additions & 1 deletion src/StorageCache/HPCCache/Commands/UpgradeAzHpcCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class UpgradeAzHpcCache : HpcCacheBaseCmdlet
/// <summary>
/// Gets or sets switch parameter passthru.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "This Cmdlet does not return an object by default. If this switch is specified, it returns true if successful.")]
[Parameter(Mandatory = false, HelpMessage = "Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.")]
public SwitchParameter PassThru { get; set; }

/// <summary>
Expand Down Expand Up @@ -90,6 +90,7 @@ public void UpgradeHpcCache()
{
throw new PSArgumentNullException("CacheName");
}

try
{
this.HpcCacheClient.Caches.UpgradeFirmware(this.ResourceGroupName, this.CacheName);
Expand Down
1 change: 1 addition & 0 deletions src/StorageCache/HPCCache/Models/PSHpcCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public PSHPCCache(StorageCacheModels.Cache cache)
/// Gets or Sets CacheSize.
/// </summary>
public int? CacheSize { get; set; }

/// <summary>
/// Gets or Sets Tags.
/// </summary>
Expand Down
9 changes: 4 additions & 5 deletions src/StorageCache/HPCCache/Models/PSHpcCacheHealth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// limitations under the License.
// ----------------------------------------------------------------------------------


namespace Microsoft.Azure.PowerShell.Cmdlets.HPCCache.Models
{
using System;
Expand All @@ -28,21 +27,21 @@ public class PSHpcCacheHealth
/// <summary>
/// Gets cache health state.
/// </summary>
public string state;
public string State;

/// <summary>
/// Gets cache health status description.
/// </summary>
public string statusDescription;
public string StatusDescription;

/// <summary>
/// Initializes a new instance of the <see cref="PSHpcCacheHealth"/> class.
/// </summary>
/// <param name="health"> cache health object.</param>
public PSHpcCacheHealth(StorageCacheModels.CacheHealth health)
{
this.state = health.State;
this.statusDescription = health.StatusDescription;
this.State = health.State;
this.StatusDescription = health.StatusDescription;
}
}
}
4 changes: 1 addition & 3 deletions src/StorageCache/HPCCache/Models/PSHpcCacheSku.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

namespace Microsoft.Azure.PowerShell.Cmdlets.HPCCache.Models
{

using StorageCacheModels = Microsoft.Azure.Management.StorageCache.Models;

/// <summary>
Expand All @@ -35,9 +34,8 @@ public PSHpcCacheSku(StorageCacheModels.CacheSku sku)
}

/// <summary>
/// Gets Sku name.
/// Gets or Sets Sku name.
/// </summary>
public string Name { get; set; }
}

}
8 changes: 4 additions & 4 deletions src/StorageCache/HPCCache/Models/PSHpcCacheUpgradeStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@ public PSHpcCacheUpgradeStatus(StorageCacheModels.CacheUpgradeStatus upgradeStat
public string CurrentFirmwareVersion { get; private set; }

/// <summary>
/// Gets true if there is a firmware update ready to install on this Cache. The firmware
/// Gets or sets true if there is a firmware update ready to install on this Cache. The firmware
/// will automatically be installed after firmwareUpdateDeadline if not triggered
/// earlier via the upgrade operation. Possible values include: 'available', 'unavailable'.
/// </summary>
public string FirmwareUpdateStatus { get; set; }

/// <summary>
/// Gets time at which the pending firmware update will automatically be installed
/// Gets or sets time at which the pending firmware update will automatically be installed
/// on the Cache.
/// </summary>
public DateTime? FirmwareUpdateDeadline { get; set; }

/// <summary>
/// Gets time of the last successful firmware update.
/// Gets or Sets time of the last successful firmware update.
/// </summary>
public DateTime? LastFirmwareUpdate { get; set; }

/// <summary>
/// Gets when firmwareUpdateAvailable is true, this field holds the version string
/// Gets or Sets when firmwareUpdateAvailable is true, this field holds the version string
/// for the update.
/// </summary>
public string PendingFirmwareVersion { get; set; }
Expand Down
1 change: 0 additions & 1 deletion src/StorageCache/HPCCache/Models/PSSku.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public PSSku(ResourceSku sku)
this.ResourceType = sku.ResourceType;
this.Restrictions = sku.Restrictions;
this.Capabilities = sku.Capabilities;

}
}

Expand Down
6 changes: 3 additions & 3 deletions src/StorageCache/HPCCache/help/Flush-AzHpcCache.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Flush-AzHpcCache -ResourceGroupName <String> -CacheName <String> [-PassThru] [-F
```

## DESCRIPTION
The **Flush-AzHpcCache** cmdlet flushes a Azure HPC Cache.
The **Flush-AzHpcCache** cmdlet flushes an Azure HPC Cache.

## EXAMPLES

Expand All @@ -31,7 +31,7 @@ PS C:\> Flush-AzHpcCache -ResourceGroupName testRG -CacheName testCache
## PARAMETERS

### -CacheName
Name of cache.
Name of cache.

```yaml
Type: System.String
Expand All @@ -46,7 +46,7 @@ Accept wildcard characters: False
```
### -Force
Forces the command to run without asking for user confirmation.
Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to flush the cache.
```yaml
Type: System.Management.Automation.SwitchParameter
Expand Down
Loading

0 comments on commit 02d241b

Please sign in to comment.