Skip to content

Commit

Permalink
Change StorageCache folder name to HPCCache and modify Upgrade cache …
Browse files Browse the repository at this point in the history
…cmdlet … (Azure#539)

* Change StorageCache folder name to HPCCache and modify Upgrade cache cmdlet.

* Update Az.HPCCache.psd1

Co-authored-by: Yunchi Wang <54880216+wyunchi-ms@users.noreply.github.com>
  • Loading branch information
romahamu and wyunchi-ms committed May 4, 2020
1 parent 609e1bf commit 7448539
Show file tree
Hide file tree
Showing 79 changed files with 65 additions and 53 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# RootModule = ''

# Version number of this module.
ModuleVersion = '0.1.0'
ModuleVersion = '0.1.1'

# Supported PSEditions
CompatiblePSEditions = 'Core', 'Desktop'
Expand Down Expand Up @@ -57,28 +57,27 @@ RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '1.7.0'; })
RequiredAssemblies = 'Microsoft.Azure.Management.StorageCache.dll'

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
#ScriptsToProcess = @()
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
#FormatsToProcess = @()
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
NestedModules = @('Microsoft.Azure.PowerShell.Cmdlets.HPCCache.dll')

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
#FunctionsToExport = @()
FunctionsToExport = @()

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = 'Get-AzHpcCacheSku' , 'Get-AzHpcCacheUsageModel',
'Get-AzHpcCache', 'New-AzHpcCache',
'Remove-AzHpcCache', 'Set-AzHpcCache',
'Start-AzHpcCache', 'Flush-AzHpcCache',
'Stop-AzHpcCache', 'Upgrade-AzHpcCache',
'Remove-AzHpcCacheStorageTarget', 'New-AzHpcCacheStorageTarget',
'Get-AzHpcCacheStorageTarget', 'Set-AzHpcCacheStorageTarget'
CmdletsToExport = 'Get-AzHpcCacheSku', 'Get-AzHpcCacheUsageModel', 'Get-AzHpcCache',
'New-AzHpcCache', 'Remove-AzHpcCache', 'Set-AzHpcCache',
'Start-AzHpcCache', 'Flush-AzHpcCache', 'Stop-AzHpcCache',
'Update-AzHpcCache', 'Remove-AzHpcCacheStorageTarget',
'New-AzHpcCacheStorageTarget', 'Get-AzHpcCacheStorageTarget',
'Set-AzHpcCacheStorageTarget'

# Variables to export from this module
# VariablesToExport = @()
Expand All @@ -101,7 +100,7 @@ PrivateData = @{
PSData = @{

# Tags applied to this module. These help with module discovery in online galleries.
Tags = 'Azure','ResourceManager','ARM','HPC','HPCCache', 'StorageCache'
Tags = 'Azure','ResourceManager','ARM','HPC','HPCCache','StorageCache'

# A URL to the license for this module.
LicenseUri = 'https://aka.ms/azps-license'
Expand All @@ -113,7 +112,7 @@ PrivateData = @{
# IconUri = ''

# ReleaseNotes of this module
ReleaseNotes = '* Update references in .psd1 to use relative path'
ReleaseNotes = '* Preview of ''Az.HPCCache'' module'

# Prerelease string of this module
Prerelease = 'preview'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
- Additional information about change #1
-->
## Upcoming Release

## Version 0.1.1
* Preview of `Az.HPCCache` module

## Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@ namespace Microsoft.Azure.Commands.HPCCache
using Microsoft.Azure.Management.StorageCache.Models;
using Microsoft.Azure.PowerShell.Cmdlets.HPCCache.Models;
using Microsoft.Rest.Azure;

/// <summary>
/// Upgrade HPC Cache.
/// </summary>
[Cmdlet("Upgrade", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "HpcCache", DefaultParameterSetName = FieldsParameterSet, SupportsShouldProcess = true)]
[Cmdlet("Update", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "HpcCache", DefaultParameterSetName = FieldsParameterSet, SupportsShouldProcess = true)]
[OutputType(typeof(bool))]
public class UpgradeAzHpcCache : HpcCacheBaseCmdlet
public class UpdateAzHpcCache : HpcCacheBaseCmdlet
{
/// <summary>
/// Gets or sets ResourceGroupName.
Expand All @@ -36,7 +35,6 @@ public class UpgradeAzHpcCache : HpcCacheBaseCmdlet
[ResourceGroupCompleter]
[ValidateNotNullOrEmpty]
public string ResourceGroupName { get; set; }

/// <summary>
/// Gets or sets Name.
/// </summary>
Expand All @@ -45,40 +43,39 @@ public class UpgradeAzHpcCache : HpcCacheBaseCmdlet
[ResourceNameCompleter("Microsoft.StorageCache/caches", nameof(ResourceGroupName))]
[ValidateNotNullOrEmpty]
public string Name { get; set; }

/// <summary>
/// Gets or sets resource id of the cache.
/// </summary>
[Parameter(Mandatory = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The resource id of the Cache", ParameterSetName = ResourceIdParameterSet)]
[ValidateNotNullOrEmpty]
public string ResourceId { get; set; }

/// <summary>
/// Gets or sets Upgrade Flag.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "Upgrade HpcCache.")]
[ValidateNotNullOrEmpty]
public SwitchParameter Upgrade { get; set; }
/// <summary>
/// Gets or sets cache object.
/// </summary>
[Parameter(ParameterSetName = ObjectParameterSet, Mandatory = true, ValueFromPipeline = true, HelpMessage = "The cache object to upgrade.")]
[ValidateNotNullOrEmpty]
public PSHPCCache InputObject { get; set; }

/// <summary>
/// Gets or sets switch parameter force.
/// </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 upgrade the cache.")]
public SwitchParameter Force { get; set; }

/// <summary>
/// Gets or sets switch parameter passthru.
/// </summary>
[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>
/// Gets or sets Job to run job in background.
/// </summary>
[Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")]

public SwitchParameter AsJob { get; set; }

/// <summary>
/// Execution Cmdlet.
/// </summary>
Expand All @@ -95,7 +92,6 @@ public override void ExecuteCmdlet()
this.ResourceGroupName = this.InputObject.ResourceGroupName;
this.Name = this.InputObject.CacheName;
}

this.ConfirmAction(
this.Force.IsPresent,
string.Format(Resources.ConfirmUpgradeHpcCache, this.Name),
Expand All @@ -106,34 +102,34 @@ public override void ExecuteCmdlet()
this.UpgradeHpcCache();
});
}

/// <summary>
/// Upgrade HPC Cache.
/// Updates HPC Cache by doing upgrade.
/// </summary>
public void UpgradeHpcCache()
{
if (string.IsNullOrWhiteSpace(this.ResourceGroupName))
{
throw new PSArgumentNullException("ResourceGroupName");
}

if (string.IsNullOrWhiteSpace(this.Name))
{
throw new PSArgumentNullException("CacheName");
}

try
if (this.Upgrade.IsPresent)
{
this.HpcCacheClient.Caches.UpgradeFirmware(this.ResourceGroupName, this.Name);
if (this.PassThru)
try
{
this.WriteObject(true);
this.HpcCacheClient.Caches.UpgradeFirmware(this.ResourceGroupName, this.Name);
if (this.PassThru)
{
this.WriteObject(true);
}
}
catch (CloudErrorException ex)
{
throw new CloudException(string.Format("Exception: {0}", ex.Body.Error.Message));
}
}
catch (CloudErrorException ex)
{
throw new CloudException(string.Format("Exception: {0}", ex.Body.Error.Message));
}
}
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: Guid("77c1e905-4cc3-4a3d-bf4e-b42ad50bb2ba")]
[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyVersion("0.1.1")]
[assembly: AssemblyFileVersion("0.1.1")]
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ Starts HPC cache.
### [Stop-AzHpcCache](Stop-AzHpcCache.md)
Stops HPC cache.

### [Upgrade-AzHpcCache](Upgrade-AzHpcCache.md)
Upgrades a HPC Cache.
### [Update-AzHpcCache](Update-AzHpcCache.md)
Updates a HPC Cache.

Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
---
external help file: Microsoft.Azure.PowerShell.Cmdlets.HPCCache.dll-Help.xml
Module Name: Az.HPCCache
online version: https://docs.microsoft.com/en-us/powershell/module/az.hpccache/upgrade-azhpccache
online version: https://docs.microsoft.com/en-us/powershell/module/az.hpccache/update-azhpccache
schema: 2.0.0
---

# Upgrade-AzHpcCache
# Update-AzHpcCache

## SYNOPSIS
Upgrades a HPC Cache.
Updates a HPC Cache.

## SYNTAX

### ByFieldsParameterSet (Default)
```
Upgrade-AzHpcCache -ResourceGroupName <String> -Name <String> [-Force] [-PassThru] [-AsJob]
Update-AzHpcCache -ResourceGroupName <String> -Name <String> [-Upgrade] [-Force] [-PassThru] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### ByResourceIdParameterSet
```
Upgrade-AzHpcCache -ResourceId <String> [-Force] [-PassThru] [-AsJob]
Update-AzHpcCache -ResourceId <String> [-Upgrade] [-Force] [-PassThru] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

### ByObjectParameterSet
```
Upgrade-AzHpcCache -InputObject <PSHPCCache> [-Force] [-PassThru] [-AsJob]
Update-AzHpcCache [-Upgrade] -InputObject <PSHPCCache> [-Force] [-PassThru] [-AsJob]
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
The **Upgrade-AzHpcCache** cmdlet upgrades a Azure HPC Cache.
The **Update-AzHpcCache** cmdlet updates a Azure HPC Cache.

## EXAMPLES

### Example 1
```powershell
PS C:\> Upgrade-AzHpcCache -ResourceGroupName testRG -CacheName testCache
PS C:\> Update-AzHpcCache -ResourceGroupName testRG -CacheName testCache
```

## PARAMETERS
Expand Down Expand Up @@ -73,7 +73,7 @@ Accept wildcard characters: False
```

### -Force
Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to upgrade the cache.
Indicates that the cmdlet does not prompt you for confirmation. By default, this cmdlet prompts you to confirm that you want to update the cache.

```yaml
Type: System.Management.Automation.SwitchParameter
Expand All @@ -88,7 +88,7 @@ Accept wildcard characters: False
```

### -InputObject
The cache object to upgrade.
The cache object to update.

```yaml
Type: Microsoft.Azure.PowerShell.Cmdlets.HPCCache.Models.PSHPCCache
Expand Down Expand Up @@ -134,7 +134,7 @@ Accept wildcard characters: False
```

### -ResourceGroupName
Name of resource group under which you want to upgrade cache.
Name of resource group under which you want to update cache.

```yaml
Type: System.String
Expand Down Expand Up @@ -163,6 +163,21 @@ Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
```

### -Upgrade
Upgrade HpcCache.

```yaml
Type: System.Management.Automation.SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```

### -Confirm
Prompts you for confirmation before running the cmdlet.

Expand Down

0 comments on commit 7448539

Please sign in to comment.