From c7668da9a0304f8d7ad5a48f0b719ed3436cd894 Mon Sep 17 00:00:00 2001 From: Menghua Xiao Date: Thu, 19 Apr 2018 10:52:34 +0800 Subject: [PATCH 1/5] Default resource group handling, refactor the ResourceId and InputObject handling --- .../Cmdlets/GetAzureRmSignalR.cs | 21 ++++---- .../Cmdlets/GetAzureRmSignalRKey.cs | 21 +++----- .../Cmdlets/IWithInputObject.cs | 25 +++++++++ .../Cmdlets/IWithResourceGroupAndName.cs | 14 +++++ .../Cmdlets/IWithResourceId.cs | 24 +++++++++ .../Cmdlets/NewAzureRmSignalR.cs | 53 ++++++++----------- .../Cmdlets/NewAzureRmSignalRKey.cs | 21 +++----- .../Cmdlets/RemoveAzureRmSignalR.cs | 19 +++---- .../Cmdlets/SignalRCmdletBase.cs | 31 +++++++++++ .../Commands.SignalR/Commands.SignalR.csproj | 3 ++ .../Properties/Resources.Designer.cs | 9 ++++ .../Properties/Resources.resx | 3 ++ .../Strategies/SignalRRp/SignalRStrategy.cs | 4 +- 13 files changed, 166 insertions(+), 82 deletions(-) create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithInputObject.cs create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithResourceGroupAndName.cs create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithResourceId.cs diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalR.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalR.cs index a9dc4d1f2ff2..c697e53a1a9e 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalR.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalR.cs @@ -10,25 +10,22 @@ namespace Microsoft.Azure.Commands.SignalR { [Cmdlet(VerbsCommon.Get, SignalRNoun, DefaultParameterSetName = ListSignalRServiceParameterSet)] [OutputType(typeof(PSSignalRResource))] - public class GetAzureRmSignalR : SignalRCmdletBase + public class GetAzureRmSignalR : SignalRCmdletBase, IWithResourceId { [Parameter(Position = 0, Mandatory = false, ParameterSetName = ListSignalRServiceParameterSet, - ValueFromPipelineByPropertyName = true, HelpMessage = "Resource group name.")] [Parameter(Position = 0, - Mandatory = true, + Mandatory = false, ParameterSetName = ResourceGroupParameterSet, - ValueFromPipelineByPropertyName = true, HelpMessage = "Resource group name.")] [ResourceGroupCompleter()] [ValidateNotNullOrEmpty] - public string ResourceGroupName { get; set; } + public override string ResourceGroupName { get; set; } [Parameter(Position = 1, Mandatory = true, - ValueFromPipelineByPropertyName = true, ParameterSetName = ResourceGroupParameterSet, HelpMessage = "SignalR service name.")] [ValidateNotNullOrEmpty] @@ -58,15 +55,17 @@ public override void ExecuteCmdlet() WriteObject(new PSSignalRResource(s)); } break; + case ResourceIdParameterSet: + this.LoadFromResourceId(); + var signalrById = Client.Signalr.Get(ResourceGroupName, Name); + WriteObject(new PSSignalRResource(signalrById)); + break; case ResourceGroupParameterSet: + ResolveResourceGroupName(); var signalr = Client.Signalr.Get(ResourceGroupName, Name); WriteObject(new PSSignalRResource(signalr)); break; - case ResourceIdParameterSet: - var resource = new ResourceIdentifier(ResourceId); - var idSignalR = Client.Signalr.Get(resource.ResourceGroupName, resource.ResourceName); - WriteObject(new PSSignalRResource(idSignalR)); - break; + default: throw new ArgumentException(Resources.ParameterSetError); } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalRKey.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalRKey.cs index a938e8fca783..b9ffdaf9723b 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalRKey.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalRKey.cs @@ -6,19 +6,19 @@ using System; using System.Management.Automation; -namespace Microsoft.Azure.Commands.SignalR.Cmdlets +namespace Microsoft.Azure.Commands.SignalR { [Cmdlet(VerbsCommon.Get, SignalRKeyNoun, DefaultParameterSetName = ResourceGroupParameterSet)] [OutputType(typeof(PSSignalRKeys))] - public class GetAzureRmSignalRKey : SignalRCmdletBase + public class GetAzureRmSignalRKey : SignalRCmdletBase, IWithInputObject, IWithResourceId { [Parameter(Position = 0, - Mandatory = true, + Mandatory = false, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "Resource group name.")] + HelpMessage = "Resource group name. Default one will be used if not specified.")] [ResourceGroupCompleter()] [ValidateNotNullOrEmpty] - public string ResourceGroupName { get; set; } + public override string ResourceGroupName { get; set; } [Parameter(Position = 1, Mandatory = true, @@ -47,25 +47,20 @@ public override void ExecuteCmdlet() RunCmdlet(() => { - ResourceIdentifier resourceId = null; switch (ParameterSetName) { case ResourceGroupParameterSet: + ResolveResourceGroupName(); break; case ResourceIdParameterSet: - resourceId = new ResourceIdentifier(ResourceId); + this.LoadFromResourceId(); break; case InputObjectParameterSet: - resourceId = new ResourceIdentifier(InputObject.Id); + this.LoadFromInputObject(); break; default: throw new ArgumentException(Resources.ParameterSetError); } - if (resourceId != null) - { - ResourceGroupName = resourceId.ResourceGroupName; - Name = resourceId.ResourceName; - } var keys = Client.Signalr.ListKeys(ResourceGroupName, Name); WriteObject(new PSSignalRKeys(Name, keys)); diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithInputObject.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithInputObject.cs new file mode 100644 index 000000000000..0205d74e0515 --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithInputObject.cs @@ -0,0 +1,25 @@ +using Microsoft.Azure.Commands.SignalR.Models; +using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.SignalR +{ + public interface IWithInputObject : IWithResourceGroupAndName + { + PSSignalRResource InputObject { get; } + } + + public static class IWithInputObjectExtensions + { + public static void LoadFromInputObject(this IWithInputObject cmdlet) + { + var resourceId = new ResourceIdentifier(cmdlet.InputObject.Id); + cmdlet.ResourceGroupName = resourceId.ResourceGroupName; + cmdlet.Name = resourceId.ResourceName; + } + } +} diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithResourceGroupAndName.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithResourceGroupAndName.cs new file mode 100644 index 000000000000..bf9d1745b0f6 --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithResourceGroupAndName.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.SignalR +{ + public interface IWithResourceGroupAndName + { + string ResourceGroupName { get; set; } + string Name { get; set; } + } +} diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithResourceId.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithResourceId.cs new file mode 100644 index 000000000000..6931633dc397 --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/IWithResourceId.cs @@ -0,0 +1,24 @@ +using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Commands.SignalR +{ + public interface IWithResourceId : IWithResourceGroupAndName + { + string ResourceId { get; } + } + + public static class IWithResourceIdExtensions + { + public static void LoadFromResourceId(this IWithResourceId cmdlet) + { + var resourceId = new ResourceIdentifier(cmdlet.ResourceId); + cmdlet.ResourceGroupName = resourceId.ResourceGroupName; + cmdlet.Name = resourceId.ResourceName; + } + } +} diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs index 5d8b9df769da..a614361e31ed 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs @@ -27,51 +27,40 @@ namespace Microsoft.Azure.Commands.SignalR { - [Cmdlet(VerbsCommon.New, "AzureRmSignalR", SupportsShouldProcess = true)] + [Cmdlet(VerbsCommon.New, SignalRNoun, SupportsShouldProcess = true)] [OutputType(typeof(PSSignalRResource))] - public sealed class NewAzureRmSignalR : AzureRMCmdlet + public sealed class NewAzureRmSignalR : SignalRCmdletBase { - /// - /// TODO: smart command with default resource group name - /// + private const string DefaultSku = "Basic_DS2"; + [Parameter( Mandatory = false, - Position = 0)] + Position = 0, + HelpMessage = "The resource group name. The default one will be used if not specified.")] [ValidateNotNullOrEmpty()] - public string ResourceGroupName { get; set; } + public override string ResourceGroupName { get; set; } [Parameter( Mandatory = true, - Position = 1)] + Position = 1, + HelpMessage = "SignalR service name.")] [ValidateNotNullOrEmpty()] public string Name { get; set; } - /// - /// TODO: smart command with default location based on ResourceGroupName - /// [Parameter( Mandatory = false, - Position = 2)] - [LocationCompleter("Microsoft.SignalR/signalRs")] + Position = 2, + HelpMessage = "The SignalR service location.")] + [LocationCompleter("Microsoft.SignalR/SignalR")] [ValidateNotNullOrEmpty()] public string Location { get; set; } - /// - /// TODO: - /// - Assign default value. - /// - validation set or tab completion - /// - [Parameter(Mandatory = false)] + [Parameter( + Mandatory = false, + HelpMessage = "The SignalR service SKU. The default is " + DefaultSku)] + [PSArgumentCompleter("Basic_DS2")] public string Sku { get; set; } - /// - /// TODO: - /// - Default host name prefix. - /// - alias `DomainNameLabel` - /// - [Parameter(Mandatory = false)] - public string HostNamePrefix { get; set; } - [Parameter(Mandatory = false)] public IDictionary Tag { get; set; } @@ -106,8 +95,10 @@ public Parameters(NewAzureRmSignalR cmdlet) public async Task> CreateConfigAsync() { _cmdlet.ResourceGroupName = _cmdlet.ResourceGroupName ?? _cmdlet.Name; - - var resourceGroup = ResourceGroupStrategy.CreateResourceGroupConfig( + _cmdlet.ResolveResourceGroupName(); + _cmdlet.Sku = _cmdlet.Sku ?? DefaultSku; + + var resourceGroup = ResourceGroupStrategy.CreateResourceGroupConfig( _cmdlet.ResourceGroupName); return SignalRStrategy.Strategy.CreateResourceConfig( @@ -115,8 +106,8 @@ public async Task> CreateConfigAsync() name: _cmdlet.Name, createModel: engine => new SignalRResource( tags: _cmdlet.Tag, - signalrsku: _cmdlet.Sku == null ? null : new ResourceSku(name: _cmdlet.Sku), - hostNamePrefix: _cmdlet.HostNamePrefix)); + signalrsku: new ResourceSku(_cmdlet.Sku, capacity: 1), // we only allow capacity 1 in public preview, this may be a parameter in future. + hostNamePrefix: _cmdlet.Name)); // hostNamePrefix is just a placeholder and ignored in the resource provider. } } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs index 247b46b6c7f4..77ca99d1552c 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs @@ -7,19 +7,19 @@ using System; using System.Management.Automation; -namespace Microsoft.Azure.Commands.SignalR.Cmdlets +namespace Microsoft.Azure.Commands.SignalR { [Cmdlet(VerbsCommon.New, SignalRKeyNoun, SupportsShouldProcess = true, DefaultParameterSetName = ResourceGroupParameterSet)] [OutputType(typeof(PSSignalRKeys))] - public class NewAzureRmSignalRKey : SignalRCmdletBase + public class NewAzureRmSignalRKey : SignalRCmdletBase, IWithInputObject, IWithResourceId { [Parameter(Position = 0, - Mandatory = true, + Mandatory = false, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "Resource group name.")] + HelpMessage = "Resource group name. Default one will be used if not specified.")] [ResourceGroupCompleter()] [ValidateNotNullOrEmpty] - public string ResourceGroupName { get; set; } + public override string ResourceGroupName { get; set; } [Parameter(Position = 1, Mandatory = true, @@ -53,25 +53,20 @@ public override void ExecuteCmdlet() RunCmdlet(() => { - ResourceIdentifier resourceId = null; switch (ParameterSetName) { case ResourceGroupParameterSet: + ResolveResourceGroupName(); break; case ResourceIdParameterSet: - resourceId = new ResourceIdentifier(ResourceId); + this.LoadFromResourceId(); break; case InputObjectParameterSet: - resourceId = new ResourceIdentifier(InputObject.Id); + this.LoadFromInputObject(); break; default: throw new ArgumentException(Resources.ParameterSetError); } - if (resourceId != null) - { - ResourceGroupName = resourceId.ResourceGroupName; - Name = resourceId.ResourceName; - } if (ShouldProcess($"{KeyType} key for {ResourceGroupName}/{Name}", "regenerate")) { diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs index ddeaae658c58..69fbeeb72011 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs @@ -9,15 +9,15 @@ namespace Microsoft.Azure.Commands.SignalR { [Cmdlet(VerbsCommon.Remove, SignalRNoun, SupportsShouldProcess = true, DefaultParameterSetName = ResourceGroupParameterSet)] - public class RemoveAzureRmSignalR : SignalRCmdletBase + public class RemoveAzureRmSignalR : SignalRCmdletBase, IWithInputObject, IWithResourceId { [Parameter(Position = 0, - Mandatory = true, + Mandatory = false, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "Resource group name.")] + HelpMessage = "Resource group name. Default one will be used if not specified.")] [ResourceGroupCompleter()] [ValidateNotNullOrEmpty] - public string ResourceGroupName { get; set; } + public override string ResourceGroupName { get; set; } [Parameter(Position = 1, Mandatory = true, @@ -52,25 +52,20 @@ public override void ExecuteCmdlet() RunCmdlet(() => { - ResourceIdentifier resourceId = null; switch (ParameterSetName) { case ResourceGroupParameterSet: + ResolveResourceGroupName(); break; case ResourceIdParameterSet: - resourceId = new ResourceIdentifier(ResourceId); + this.LoadFromResourceId(); break; case InputObjectParameterSet: - resourceId = new ResourceIdentifier(InputObject.Id); + this.LoadFromInputObject(); break; default: throw new ArgumentException(Resources.ParameterSetError); } - if (resourceId != null) - { - ResourceGroupName = resourceId.ResourceGroupName; - Name = resourceId.ResourceName; - } if (ShouldProcess($"SignalR service {ResourceGroupName}/{Name}", "remove")) { diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/SignalRCmdletBase.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/SignalRCmdletBase.cs index 3719a3d5c003..27aa99f7f1cc 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/SignalRCmdletBase.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/SignalRCmdletBase.cs @@ -1,6 +1,7 @@ using Microsoft.Azure.Commands.Common.Authentication; using Microsoft.Azure.Commands.Common.Authentication.Abstractions; using Microsoft.Azure.Commands.ResourceManager.Common; +using Microsoft.Azure.Commands.SignalR.Properties; using Microsoft.Azure.Management.SignalR; using Microsoft.Rest; using System; @@ -43,5 +44,35 @@ private T BuildClient(string endpoint = null, Func postBuild = null) wh DefaultProfile.DefaultContext, endpoint ?? AzureEnvironment.Endpoint.ResourceManager); return postBuild == null ? instance : postBuild(instance); } + + public abstract string ResourceGroupName { get; set; } + + /// + /// Returns the default resource group set by Set-AzureRmDefault, if present. + /// + protected string DefaultResourceGroupName + { + get + { + IAzureContext context; + TryGetDefaultContext(out context); + return context?.GetProperty(Resources.DefaultResourceGroupKey); + } + } + + /// + /// Use the DefaultResourceGroupName for ResourceGroupName if not specified, and optionally validate it. + /// + protected void ResolveResourceGroupName(bool required = true) + { + if (string.IsNullOrEmpty(ResourceGroupName)) + { + ResourceGroupName = DefaultResourceGroupName; + } + if (required && string.IsNullOrEmpty(ResourceGroupName)) + { + throw new ArgumentException("ResourceGroupName is not specified and the default value is not present."); + } + } } } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Commands.SignalR.csproj b/src/ResourceManager/SignalR/Commands.SignalR/Commands.SignalR.csproj index 8d224e9c554b..8c99b57f9d36 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Commands.SignalR.csproj +++ b/src/ResourceManager/SignalR/Commands.SignalR/Commands.SignalR.csproj @@ -15,6 +15,9 @@ + + + diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Properties/Resources.Designer.cs b/src/ResourceManager/SignalR/Commands.SignalR/Properties/Resources.Designer.cs index a45506ffaf3f..7c632d6e722a 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Properties/Resources.Designer.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Properties/Resources.Designer.cs @@ -60,6 +60,15 @@ internal Resources() { } } + /// + /// Looks up a localized string similar to Default Resource Group. + /// + internal static string DefaultResourceGroupKey { + get { + return ResourceManager.GetString("DefaultResourceGroupKey", resourceCulture); + } + } + /// /// Looks up a localized string similar to The parameter set could not be determined from the provided parameters. Please check the documentation for appropriate parameters, and report this issue at https://github.com/azure/azure-powershell/issues. /// diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Properties/Resources.resx b/src/ResourceManager/SignalR/Commands.SignalR/Properties/Resources.resx index 16fe6716db3b..9c3041abf941 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Properties/Resources.resx +++ b/src/ResourceManager/SignalR/Commands.SignalR/Properties/Resources.resx @@ -117,6 +117,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + Default Resource Group + The parameter set could not be determined from the provided parameters. Please check the documentation for appropriate parameters, and report this issue at https://github.com/azure/azure-powershell/issues diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs b/src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs index cb6076b79057..66d11fb20f12 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs @@ -8,14 +8,14 @@ static class SignalRStrategy { public static ResourceStrategy Strategy { get; } = ResourceStrategy.Create( - type: new ResourceType("Microsoft.SignalRService", "signalRs"), + type: new ResourceType("Microsoft.SignalR", "SignalR"), getOperations: (SignalRManagementClient client) => client.Signalr, getAsync: (o, p) => o.GetAsync(p.ResourceGroupName, p.Name, p.CancellationToken), createOrUpdateAsync: (o, p) => o.CreateOrUpdateAsync( p.ResourceGroupName, p.Name, new SignalRCreateParameters( - p.Model.Location, + p.Model.Location, p.Model.Tags, p.Model.Signalrsku, new SignalRCreateOrUpdateProperties(p.Model.HostNamePrefix)), From 40423924238d89b1bcf0bbd5c31ef82cc45a9332 Mon Sep 17 00:00:00 2001 From: Menghua Xiao Date: Thu, 19 Apr 2018 13:25:11 +0800 Subject: [PATCH 2/5] Basic markdown documentation without examples --- .../Cmdlets/GetAzureRmSignalR.cs | 6 +- .../Cmdlets/GetAzureRmSignalRKey.cs | 4 +- .../Cmdlets/NewAzureRmSignalR.cs | 21 +- .../Cmdlets/NewAzureRmSignalRKey.cs | 4 +- .../Cmdlets/RemoveAzureRmSignalR.cs | 7 +- .../Commands.SignalR/Commands.SignalR.csproj | 6 + .../Commands.SignalR/help/AzureRM.SignalR.md | 28 +++ .../help/Get-AzureRmSignalR.md | 119 +++++++++++ .../help/Get-AzureRmSignalRKey.md | 135 ++++++++++++ .../help/New-AzureRmSignalR.md | 184 ++++++++++++++++ .../help/New-AzureRmSignalRKey.md | 183 ++++++++++++++++ .../help/Remove-AzureRmSignalR.md | 197 ++++++++++++++++++ 12 files changed, 875 insertions(+), 19 deletions(-) create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/help/AzureRM.SignalR.md create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalR.md create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalRKey.md create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalR.md create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalRKey.md create mode 100644 src/ResourceManager/SignalR/Commands.SignalR/help/Remove-AzureRmSignalR.md diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalR.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalR.cs index c697e53a1a9e..9f441969aebb 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalR.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalR.cs @@ -15,11 +15,11 @@ public class GetAzureRmSignalR : SignalRCmdletBase, IWithResourceId [Parameter(Position = 0, Mandatory = false, ParameterSetName = ListSignalRServiceParameterSet, - HelpMessage = "Resource group name.")] + HelpMessage = "The resource group name.")] [Parameter(Position = 0, Mandatory = false, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "Resource group name.")] + HelpMessage = "The resource group name. The default one will be used if not specified.")] [ResourceGroupCompleter()] [ValidateNotNullOrEmpty] public override string ResourceGroupName { get; set; } @@ -27,7 +27,7 @@ public class GetAzureRmSignalR : SignalRCmdletBase, IWithResourceId [Parameter(Position = 1, Mandatory = true, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "SignalR service name.")] + HelpMessage = "The SignalR service name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalRKey.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalRKey.cs index b9ffdaf9723b..a898b4807b52 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalRKey.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/GetAzureRmSignalRKey.cs @@ -15,7 +15,7 @@ public class GetAzureRmSignalRKey : SignalRCmdletBase, IWithInputObject, IWithRe [Parameter(Position = 0, Mandatory = false, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "Resource group name. Default one will be used if not specified.")] + HelpMessage = "The resource group name. The default one will be used if not specified.")] [ResourceGroupCompleter()] [ValidateNotNullOrEmpty] public override string ResourceGroupName { get; set; } @@ -23,7 +23,7 @@ public class GetAzureRmSignalRKey : SignalRCmdletBase, IWithInputObject, IWithRe [Parameter(Position = 1, Mandatory = true, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "SignalR service name.")] + HelpMessage = "The SignalR service name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs index a614361e31ed..c50d75c86b7c 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs @@ -36,14 +36,14 @@ public sealed class NewAzureRmSignalR : SignalRCmdletBase [Parameter( Mandatory = false, Position = 0, - HelpMessage = "The resource group name. The default one will be used if not specified.")] + HelpMessage = "The resource group name. The default one will be used if not specified.")] [ValidateNotNullOrEmpty()] public override string ResourceGroupName { get; set; } [Parameter( Mandatory = true, Position = 1, - HelpMessage = "SignalR service name.")] + HelpMessage = "The SignalR service name.")] [ValidateNotNullOrEmpty()] public string Name { get; set; } @@ -57,14 +57,18 @@ public sealed class NewAzureRmSignalR : SignalRCmdletBase [Parameter( Mandatory = false, - HelpMessage = "The SignalR service SKU. The default is " + DefaultSku)] + HelpMessage = "The SignalR service SKU.")] [PSArgumentCompleter("Basic_DS2")] - public string Sku { get; set; } + public string Sku { get; set; } = DefaultSku; - [Parameter(Mandatory = false)] + [Parameter( + Mandatory = false, + HelpMessage = "The tags for the SignalR service.")] public IDictionary Tag { get; set; } - [Parameter(Mandatory = false)] + [Parameter( + Mandatory = false, + HelpMessage = "Run the cmdlet in background job.")] public SwitchParameter AsJob { get; set; } public override void ExecuteCmdlet() @@ -96,9 +100,8 @@ public async Task> CreateConfigAsync() { _cmdlet.ResourceGroupName = _cmdlet.ResourceGroupName ?? _cmdlet.Name; _cmdlet.ResolveResourceGroupName(); - _cmdlet.Sku = _cmdlet.Sku ?? DefaultSku; - - var resourceGroup = ResourceGroupStrategy.CreateResourceGroupConfig( + + var resourceGroup = ResourceGroupStrategy.CreateResourceGroupConfig( _cmdlet.ResourceGroupName); return SignalRStrategy.Strategy.CreateResourceConfig( diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs index 77ca99d1552c..6d06c9ef1d1b 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs @@ -16,7 +16,7 @@ public class NewAzureRmSignalRKey : SignalRCmdletBase, IWithInputObject, IWithRe [Parameter(Position = 0, Mandatory = false, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "Resource group name. Default one will be used if not specified.")] + HelpMessage = "The resource group name. The default one will be used if not specified.")] [ResourceGroupCompleter()] [ValidateNotNullOrEmpty] public override string ResourceGroupName { get; set; } @@ -24,7 +24,7 @@ public class NewAzureRmSignalRKey : SignalRCmdletBase, IWithInputObject, IWithRe [Parameter(Position = 1, Mandatory = true, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "SignalR service name.")] + HelpMessage = "The SignalR service name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs index 69fbeeb72011..2cf8cb970a46 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs @@ -9,12 +9,13 @@ namespace Microsoft.Azure.Commands.SignalR { [Cmdlet(VerbsCommon.Remove, SignalRNoun, SupportsShouldProcess = true, DefaultParameterSetName = ResourceGroupParameterSet)] + [OutputType(typeof(bool))] public class RemoveAzureRmSignalR : SignalRCmdletBase, IWithInputObject, IWithResourceId { [Parameter(Position = 0, Mandatory = false, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "Resource group name. Default one will be used if not specified.")] + HelpMessage = "The resource group name. The default one will be used if not specified.")] [ResourceGroupCompleter()] [ValidateNotNullOrEmpty] public override string ResourceGroupName { get; set; } @@ -22,7 +23,7 @@ public class RemoveAzureRmSignalR : SignalRCmdletBase, IWithInputObject, IWithRe [Parameter(Position = 1, Mandatory = true, ParameterSetName = ResourceGroupParameterSet, - HelpMessage = "SignalR service name.")] + HelpMessage = "The SignalR service name.")] [ValidateNotNullOrEmpty] public string Name { get; set; } @@ -40,7 +41,7 @@ public class RemoveAzureRmSignalR : SignalRCmdletBase, IWithInputObject, IWithRe [ValidateNotNull] public PSSignalRResource InputObject { get; set; } - [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in the background")] + [Parameter(Mandatory = false, HelpMessage = "Run cmdlet in background.")] public SwitchParameter AsJob { get; set; } [Parameter(Mandatory = false)] diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Commands.SignalR.csproj b/src/ResourceManager/SignalR/Commands.SignalR/Commands.SignalR.csproj index 8c99b57f9d36..9d1a6132a9f1 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Commands.SignalR.csproj +++ b/src/ResourceManager/SignalR/Commands.SignalR/Commands.SignalR.csproj @@ -83,6 +83,12 @@ PreserveNewest + + + + + + PreserveNewest diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/AzureRM.SignalR.md b/src/ResourceManager/SignalR/Commands.SignalR/help/AzureRM.SignalR.md new file mode 100644 index 000000000000..20ea4cba9688 --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/AzureRM.SignalR.md @@ -0,0 +1,28 @@ +--- +Module Name: AzureRM.SignalR +Module Guid: 7aa1b2c0-72cb-448a-9c12-c45bdf3e088d +Download Help Link: {{Please enter FwLink manually}} +Help Version: 0.0.1 +Locale: en-US +--- + +# AzureRM.SignalR Module +## Description +Cmdlets to interact with the Azure SignalR service. + +## AzureRM.SignalR Cmdlets +### [Get-AzureRmSignalR](Get-AzureRmSignalR.md) +Get a specific SignalR service or all the SignalR services in a resource group or a subscription. + +### [Get-AzureRmSignalRKey](Get-AzureRmSignalRKey.md) +Get the access keys of a SignalR service. + +### [New-AzureRmSignalR](New-AzureRmSignalR.md) +Create a SignalR service. + +### [New-AzureRmSignalRKey](New-AzureRmSignalRKey.md) +Regenerate an access key for a SignalR service. + +### [Remove-AzureRmSignalR](Remove-AzureRmSignalR.md) +Remove a SignalR service. + diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalR.md b/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalR.md new file mode 100644 index 000000000000..0948dd6c7eb1 --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalR.md @@ -0,0 +1,119 @@ +--- +external help file: Microsoft.Azure.Commands.SignalR.dll-Help.xml +Module Name: AzureRM.SignalR +online version: +schema: 2.0.0 +--- + +# Get-AzureRmSignalR + +## SYNOPSIS +Get a specific SignalR service or all the SignalR services in a resource group or a subscription. + +## SYNTAX + +### ListSignalRServiceParameterSet (Default) +``` +Get-AzureRmSignalR [[-ResourceGroupName] ] [-DefaultProfile ] + [] +``` + +### ResourceGroupParameterSet +``` +Get-AzureRmSignalR [[-ResourceGroupName] ] [-Name] [-DefaultProfile ] + [] +``` + +### ResourceIdParameterSet +``` +Get-AzureRmSignalR -ResourceId [-DefaultProfile ] [] +``` + +## DESCRIPTION +Get a specific SignalR service or all the SignalR services in a resource group or a subscription. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: IAzureContextContainer +Parameter Sets: (All) +Aliases: AzureRmContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +SignalR service name. + +```yaml +Type: String +Parameter Sets: ResourceGroupParameterSet +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Resource group name. + +```yaml +Type: String +Parameter Sets: ListSignalRServiceParameterSet, ResourceGroupParameterSet +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The SignalR service resource ID. + +```yaml +Type: String +Parameter Sets: ResourceIdParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String + +## OUTPUTS + +### Microsoft.Azure.Commands.SignalR.Models.PSSignalRResource + +## NOTES + +## RELATED LINKS diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalRKey.md b/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalRKey.md new file mode 100644 index 000000000000..ea9c27ac9e55 --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalRKey.md @@ -0,0 +1,135 @@ +--- +external help file: Microsoft.Azure.Commands.SignalR.dll-Help.xml +Module Name: AzureRM.SignalR +online version: +schema: 2.0.0 +--- + +# Get-AzureRmSignalRKey + +## SYNOPSIS +Get the access keys of a SignalR service. + +## SYNTAX + +### ResourceGroupParameterSet (Default) +``` +Get-AzureRmSignalRKey [[-ResourceGroupName] ] [-Name] + [-DefaultProfile ] [] +``` + +### ResourceIdParameterSet +``` +Get-AzureRmSignalRKey -ResourceId [-DefaultProfile ] [] +``` + +### InputObjectParameterSet +``` +Get-AzureRmSignalRKey -InputObject [-DefaultProfile ] + [] +``` + +## DESCRIPTION +Get the access keys of a SignalR service. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: IAzureContextContainer +Parameter Sets: (All) +Aliases: AzureRmContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +The SignalR resource object. + +```yaml +Type: PSSignalRResource +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +SignalR service name. + +```yaml +Type: String +Parameter Sets: ResourceGroupParameterSet +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Resource group name. + +```yaml +Type: String +Parameter Sets: ResourceGroupParameterSet +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The SignalR service resource ID. + +```yaml +Type: String +Parameter Sets: ResourceIdParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String +Microsoft.Azure.Commands.SignalR.Models.PSSignalRResource + +## OUTPUTS + +### Microsoft.Azure.Commands.SignalR.Models.PSSignalRKeys + +## NOTES + +## RELATED LINKS diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalR.md b/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalR.md new file mode 100644 index 000000000000..5741bc6f8968 --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalR.md @@ -0,0 +1,184 @@ +--- +external help file: Microsoft.Azure.Commands.SignalR.dll-Help.xml +Module Name: AzureRM.SignalR +online version: +schema: 2.0.0 +--- + +# New-AzureRmSignalR + +## SYNOPSIS +Create a SignalR service. + +## SYNTAX + +``` +New-AzureRmSignalR [[-ResourceGroupName] ] [-Name] [[-Location] ] [-Sku ] + [-Tag ] [-AsJob] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Create a SignalR service. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -AsJob +Run the cmdlet in background job. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: IAzureContextContainer +Parameter Sets: (All) +Aliases: AzureRmContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Location +The SignalR service location. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +The SignalR service name. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +The resource group name. The default one will be used if not specified. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Sku +The SignalR service SKU. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: Basic_DS2 +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Tag +The tags for the SignalR service. + +```yaml +Type: System.Collections.Generic.IDictionary`2[System.String,System.String] +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. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### None + +## OUTPUTS + +### Microsoft.Azure.Commands.SignalR.Models.PSSignalRResource + +## NOTES + +## RELATED LINKS diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalRKey.md b/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalRKey.md new file mode 100644 index 000000000000..13a4ad685828 --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalRKey.md @@ -0,0 +1,183 @@ +--- +external help file: Microsoft.Azure.Commands.SignalR.dll-Help.xml +Module Name: AzureRM.SignalR +online version: +schema: 2.0.0 +--- + +# New-AzureRmSignalRKey + +## SYNOPSIS +Regenerate an access key for a SignalR service. + +## SYNTAX + +### ResourceGroupParameterSet (Default) +``` +New-AzureRmSignalRKey [[-ResourceGroupName] ] [-Name] -KeyType + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ResourceIdParameterSet +``` +New-AzureRmSignalRKey -ResourceId -KeyType [-DefaultProfile ] + [-WhatIf] [-Confirm] [] +``` + +### InputObjectParameterSet +``` +New-AzureRmSignalRKey -InputObject -KeyType + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Regenerate an access key for a SignalR service. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: IAzureContextContainer +Parameter Sets: (All) +Aliases: AzureRmContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +The SignalR resource object. + +```yaml +Type: PSSignalRResource +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -KeyType +The key type, either Primary or Secondary. + +```yaml +Type: String +Parameter Sets: (All) +Aliases: +Accepted values: Primary, Secondary + +Required: True +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Name +SignalR service name. + +```yaml +Type: String +Parameter Sets: ResourceGroupParameterSet +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Resource group name. + +```yaml +Type: String +Parameter Sets: ResourceGroupParameterSet +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The SignalR service resource ID. + +```yaml +Type: String +Parameter Sets: ResourceIdParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String +Microsoft.Azure.Commands.SignalR.Models.PSSignalRResource + +## OUTPUTS + +### Microsoft.Azure.Commands.SignalR.Models.PSSignalRKeys + +## NOTES + +## RELATED LINKS diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/Remove-AzureRmSignalR.md b/src/ResourceManager/SignalR/Commands.SignalR/help/Remove-AzureRmSignalR.md new file mode 100644 index 000000000000..b734e37626ce --- /dev/null +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/Remove-AzureRmSignalR.md @@ -0,0 +1,197 @@ +--- +external help file: Microsoft.Azure.Commands.SignalR.dll-Help.xml +Module Name: AzureRM.SignalR +online version: +schema: 2.0.0 +--- + +# Remove-AzureRmSignalR + +## SYNOPSIS +Remove a SignalR service. + +## SYNTAX + +### ResourceGroupParameterSet (Default) +``` +Remove-AzureRmSignalR [[-ResourceGroupName] ] [-Name] [-AsJob] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +### ResourceIdParameterSet +``` +Remove-AzureRmSignalR -ResourceId [-AsJob] [-PassThru] [-DefaultProfile ] + [-WhatIf] [-Confirm] [] +``` + +### InputObjectParameterSet +``` +Remove-AzureRmSignalR -InputObject [-AsJob] [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] +``` + +## DESCRIPTION +Remove a SignalR service. + +## EXAMPLES + +### Example 1 +```powershell +PS C:\> {{ Add example code here }} +``` + +{{ Add example description here }} + +## PARAMETERS + +### -AsJob +Run cmdlet in the background + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: IAzureContextContainer +Parameter Sets: (All) +Aliases: AzureRmContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +The SignalR resource object. + +```yaml +Type: PSSignalRResource +Parameter Sets: InputObjectParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +SignalR service name. + +```yaml +Type: String +Parameter Sets: ResourceGroupParameterSet +Aliases: + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -PassThru +Returns true if removal was completed successfully. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Resource group name. + +```yaml +Type: String +Parameter Sets: ResourceGroupParameterSet +Aliases: + +Required: False +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +The SignalR service resource ID. + +```yaml +Type: String +Parameter Sets: ResourceIdParameterSet +Aliases: + +Required: True +Position: Named +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. +The cmdlet is not run. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### System.String +Microsoft.Azure.Commands.SignalR.Models.PSSignalRResource + +## OUTPUTS + +### System.Object + +## NOTES + +## RELATED LINKS From 6b4ef42d5a9827cb0fe302ce6fcd3207d908b4d4 Mon Sep 17 00:00:00 2001 From: Menghua Xiao Date: Thu, 19 Apr 2018 16:46:05 +0800 Subject: [PATCH 3/5] Add examples in documents and format SignalR resource output --- .../Cmdlets/NewAzureRmSignalR.cs | 2 +- .../Cmdlets/NewAzureRmSignalRKey.cs | 13 ++++-- .../Cmdlets/RemoveAzureRmSignalR.cs | 8 ++-- ...osoft.Azure.Commands.SignalR.format.ps1xml | 24 +++-------- .../help/Get-AzureRmSignalR.md | 43 +++++++++++++++++-- .../help/Get-AzureRmSignalRKey.md | 18 ++++++-- .../help/New-AzureRmSignalR.md | 18 +++++--- .../help/New-AzureRmSignalRKey.md | 31 +++++++++---- .../help/Remove-AzureRmSignalR.md | 13 ++++-- 9 files changed, 121 insertions(+), 49 deletions(-) diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs index c50d75c86b7c..e49772c4d8c7 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalR.cs @@ -50,7 +50,7 @@ public sealed class NewAzureRmSignalR : SignalRCmdletBase [Parameter( Mandatory = false, Position = 2, - HelpMessage = "The SignalR service location.")] + HelpMessage = "The SignalR service location. The resource group location will be used if not specified.")] [LocationCompleter("Microsoft.SignalR/SignalR")] [ValidateNotNullOrEmpty()] public string Location { get; set; } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs index 6d06c9ef1d1b..f9e59b6430b8 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/NewAzureRmSignalRKey.cs @@ -10,7 +10,7 @@ namespace Microsoft.Azure.Commands.SignalR { [Cmdlet(VerbsCommon.New, SignalRKeyNoun, SupportsShouldProcess = true, DefaultParameterSetName = ResourceGroupParameterSet)] - [OutputType(typeof(PSSignalRKeys))] + [OutputType(typeof(bool))] public class NewAzureRmSignalRKey : SignalRCmdletBase, IWithInputObject, IWithResourceId { [Parameter(Position = 0, @@ -47,6 +47,9 @@ public class NewAzureRmSignalRKey : SignalRCmdletBase, IWithInputObject, IWithRe [ValidateSet("Primary", "Secondary", IgnoreCase = true)] public string KeyType { get; set; } + [Parameter(Mandatory = false)] + public SwitchParameter PassThru { get; set; } + public override void ExecuteCmdlet() { base.ExecuteCmdlet(); @@ -70,8 +73,12 @@ public override void ExecuteCmdlet() if (ShouldProcess($"{KeyType} key for {ResourceGroupName}/{Name}", "regenerate")) { - var keys = Client.Signalr.RegenerateKey(ResourceGroupName, Name, new RegenerateKeyParameters(KeyType)); - WriteObject(new PSSignalRKeys(Name, keys)); + Client.Signalr.RegenerateKey(ResourceGroupName, Name, new RegenerateKeyParameters(KeyType)); + + if (PassThru) + { + WriteObject(true); + } } }); } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs index 2cf8cb970a46..4509b9192db6 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Cmdlets/RemoveAzureRmSignalR.cs @@ -71,11 +71,11 @@ public override void ExecuteCmdlet() if (ShouldProcess($"SignalR service {ResourceGroupName}/{Name}", "remove")) { Client.Signalr.Delete(ResourceGroupName, Name); - } - if (PassThru) - { - WriteObject(true); + if (PassThru) + { + WriteObject(true); + } } }); } diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Microsoft.Azure.Commands.SignalR.format.ps1xml b/src/ResourceManager/SignalR/Commands.SignalR/Microsoft.Azure.Commands.SignalR.format.ps1xml index 0edf61654409..bec612672a05 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Microsoft.Azure.Commands.SignalR.format.ps1xml +++ b/src/ResourceManager/SignalR/Commands.SignalR/Microsoft.Azure.Commands.SignalR.format.ps1xml @@ -6,25 +6,16 @@ Microsoft.Azure.Commands.SignalR.Models.PSSignalRResource - - $_.Location - - - - 17 + + 50 Left - - 10 - Left - - - - 25 + + 14 Left @@ -47,13 +38,10 @@ - $_.Name - - - $_.Sku + $_.HostName - $_.HostName + $_.Location $_.ServerPort diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalR.md b/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalR.md index 0948dd6c7eb1..f0eeb4b02113 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalR.md +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalR.md @@ -34,12 +34,49 @@ Get a specific SignalR service or all the SignalR services in a resource group o ## EXAMPLES -### Example 1 +### Get all SignalR services in the subscription ```powershell -PS C:\> {{ Add example code here }} +PS C:\> Get-AzureRmSignalR + +HostName Location ServerPort PublicPort ProvisioningState +-------- -------- ---------- ---------- ----------------- +mysignalr1.servicedev.signalr.net eastus 5002 5001 Succeeded +mysignalr2.servicedev.signalr.net eastus 5002 5001 Succeeded +mysignalr3.servicedev.signalr.net eastus 5002 5001 Creating +``` + +### Get all SignalR services in a resource group + +```powershell +PS C:\> Get-AzureRmSignalR -ResourceGroupName myResourceGroup + +HostName Location ServerPort PublicPort ProvisioningState +-------- -------- ---------- ---------- ----------------- +mysignalr1.servicedev.signalr.net eastus 5002 5001 Succeeded +mysignalr2.servicedev.signalr.net eastus 5002 5001 Succeeded +``` + +### Get a specific SignalR service + +```powershell +PS C:\> Get-AzureRmSignalR -ResourceGroupName myResourceGroup -Name mysignalr1 + +HostName Location ServerPort PublicPort ProvisioningState +-------- -------- ---------- ---------- ----------------- +mysignalr1.servicedev.signalr.net eastus 5002 5001 Succeeded +``` + +### Get a specific SignalR service from the default resource group + +```powershell +PS C:\> Get-AzureRmSignalR -Name mysignalr2 + +HostName Location ServerPort PublicPort ProvisioningState +-------- -------- ---------- ---------- ----------------- +mysignalr2.servicedev.signalr.net eastus 5002 5001 Succeeded ``` -{{ Add example description here }} +The default resource group can be set by `Set-AzureRmDefault -ResourceGroupName myResourceGroup`. ## PARAMETERS diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalRKey.md b/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalRKey.md index ea9c27ac9e55..ea7fdd1765fe 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalRKey.md +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/Get-AzureRmSignalRKey.md @@ -34,12 +34,24 @@ Get the access keys of a SignalR service. ## EXAMPLES -### Example 1 +### Get access keys of a specific SignalR service ```powershell -PS C:\> {{ Add example code here }} +PS C:\> Get-AzureRmSignalRKey -ResourceGroupName myResourceGroup -Name mysignalr1 + +Name PrimaryKey SecondaryKey +---- ---------- ------------ +mysignalr1 vmYRhoM62PMkNe/CSSPdMSxokn+WZEFmOQNt77PovDs= 2+HkuxAA34xiZFFiDsVM0uDyzCsg6GKsdXSjN4C/YFQ= ``` -{{ Add example description here }} +### Get access keys from a SignalR service object in pipe + +```powershell +PS C:\> Get-AzureRmSignalR -ResourceGroupName myResourceGroup -Name mysignalr1 | Get-AzureRmSignalRKey + +Name PrimaryKey SecondaryKey +---- ---------- ------------ +mysignalr1 vmYRhoM62PMkNe/CSSPdMSxokn+WZEFmOQNt77PovDs= 2+HkuxAA34xiZFFiDsVM0uDyzCsg6GKsdXSjN4C/YFQ= +``` ## PARAMETERS diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalR.md b/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalR.md index 5741bc6f8968..0bc690960361 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalR.md +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalR.md @@ -21,14 +21,22 @@ New-AzureRmSignalR [[-ResourceGroupName] ] [-Name] [[-Location] ## DESCRIPTION Create a SignalR service. +The following values will be used for the parameters if not specified: + +* `ResourceGroupName`: the default resource group set by `Set-AzureRmDefault -ResourceGroupName`. +* `Location`: the location of the resource group +* `Sku`: Basic_DS2 + ## EXAMPLES -### Example 1 +### Create a SignalR serivce ```powershell -PS C:\> {{ Add example code here }} -``` +PS C:\> New-AzureRmSignalR -ResourceGroupName myResourceGroup1 -Name mysignalr1 -Location eastus -Sku Basic_DS2 -{{ Add example description here }} +HostName Location ServerPort PublicPort ProvisioningState +-------- -------- ---------- ---------- ----------------- +mysignalr1.servicedev.signalr.net eastus 5002 5001 Succeeded +``` ## PARAMETERS @@ -63,7 +71,7 @@ Accept wildcard characters: False ``` ### -Location -The SignalR service location. +The SignalR service location. The resource group location will be used if not specified. ```yaml Type: String diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalRKey.md b/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalRKey.md index 13a4ad685828..5b822ea192a2 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalRKey.md +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/New-AzureRmSignalRKey.md @@ -14,19 +14,19 @@ Regenerate an access key for a SignalR service. ### ResourceGroupParameterSet (Default) ``` -New-AzureRmSignalRKey [[-ResourceGroupName] ] [-Name] -KeyType +New-AzureRmSignalRKey [[-ResourceGroupName] ] [-Name] -KeyType [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ResourceIdParameterSet ``` -New-AzureRmSignalRKey -ResourceId -KeyType [-DefaultProfile ] - [-WhatIf] [-Confirm] [] +New-AzureRmSignalRKey -ResourceId -KeyType [-PassThru] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### InputObjectParameterSet ``` -New-AzureRmSignalRKey -InputObject -KeyType +New-AzureRmSignalRKey -InputObject -KeyType [-PassThru] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` @@ -35,12 +35,12 @@ Regenerate an access key for a SignalR service. ## EXAMPLES -### Example 1 +### Regenerate the primary key ```powershell -PS C:\> {{ Add example code here }} -``` +PS C:\> New-AzureRmSignalRKey -ResourceGroupName myResourceGroup -Name mysignalr1 -KeyType Primary -PassThru -{{ Add example description here }} +True +``` ## PARAMETERS @@ -105,6 +105,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -PassThru +Returns true if the regeneration was completed successfully. + +```yaml +Type: SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ResourceGroupName Resource group name. diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/Remove-AzureRmSignalR.md b/src/ResourceManager/SignalR/Commands.SignalR/help/Remove-AzureRmSignalR.md index b734e37626ce..ad012589b757 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/help/Remove-AzureRmSignalR.md +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/Remove-AzureRmSignalR.md @@ -35,12 +35,17 @@ Remove a SignalR service. ## EXAMPLES -### Example 1 +### Remove a SignalR service ```powershell -PS C:\> {{ Add example code here }} +PS C:\> Remove-AzureRmSignalR -ResourceGroupName myResourceGroup -Name mysignalr1 -PassThru + +True ``` -{{ Add example description here }} +### Remove all SignalR service from pipe +```powershell +PS C:\> Get-AzureRmSignalR -ResourceGroupName myResourceGroup | Remove-AzureRmSignalR +``` ## PARAMETERS @@ -105,7 +110,7 @@ Accept wildcard characters: False ``` ### -PassThru -Returns true if removal was completed successfully. +Returns true if the removal was completed successfully. ```yaml Type: SwitchParameter From bf1ea85eb0c56a42d49e15dd9d9cc6288dbc4bab Mon Sep 17 00:00:00 2001 From: Menghua Xiao Date: Thu, 19 Apr 2018 16:50:20 +0800 Subject: [PATCH 4/5] Update version info --- .../SignalR/Commands.SignalR/AzureRM.SignalR.psd1 | 2 +- .../SignalR/Commands.SignalR/Properties/AssemblyInfo.cs | 4 ++-- .../SignalR/Commands.SignalR/help/AzureRM.SignalR.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ResourceManager/SignalR/Commands.SignalR/AzureRM.SignalR.psd1 b/src/ResourceManager/SignalR/Commands.SignalR/AzureRM.SignalR.psd1 index 65c60fd560cb..8c0c2e9b7269 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/AzureRM.SignalR.psd1 +++ b/src/ResourceManager/SignalR/Commands.SignalR/AzureRM.SignalR.psd1 @@ -12,7 +12,7 @@ # RootModule = '' # Version number of this module. -ModuleVersion = '0.0.1' +ModuleVersion = '0.1.0' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Properties/AssemblyInfo.cs b/src/ResourceManager/SignalR/Commands.SignalR/Properties/AssemblyInfo.cs index dbdaa7c04f5f..2e61c9431cc4 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Properties/AssemblyInfo.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Properties/AssemblyInfo.cs @@ -46,5 +46,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.0.1")] -[assembly: AssemblyFileVersion("0.0.1")] +[assembly: AssemblyVersion("0.1.0")] +[assembly: AssemblyFileVersion("0.1.0")] diff --git a/src/ResourceManager/SignalR/Commands.SignalR/help/AzureRM.SignalR.md b/src/ResourceManager/SignalR/Commands.SignalR/help/AzureRM.SignalR.md index 20ea4cba9688..7f469a70cbd7 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/help/AzureRM.SignalR.md +++ b/src/ResourceManager/SignalR/Commands.SignalR/help/AzureRM.SignalR.md @@ -2,7 +2,7 @@ Module Name: AzureRM.SignalR Module Guid: 7aa1b2c0-72cb-448a-9c12-c45bdf3e088d Download Help Link: {{Please enter FwLink manually}} -Help Version: 0.0.1 +Help Version: 0.1.0 Locale: en-US --- From daae454f26147aa4d6f54f1a64e6d4713144ea23 Mon Sep 17 00:00:00 2001 From: Menghua Xiao Date: Thu, 19 Apr 2018 16:59:09 +0800 Subject: [PATCH 5/5] Fix resource type --- .../Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs b/src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs index 66d11fb20f12..6cb831e22337 100644 --- a/src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs +++ b/src/ResourceManager/SignalR/Commands.SignalR/Strategies/SignalRRp/SignalRStrategy.cs @@ -8,7 +8,7 @@ static class SignalRStrategy { public static ResourceStrategy Strategy { get; } = ResourceStrategy.Create( - type: new ResourceType("Microsoft.SignalR", "SignalR"), + type: new ResourceType("Microsoft.SignalRService", "SignalR"), getOperations: (SignalRManagementClient client) => client.Signalr, getAsync: (o, p) => o.GetAsync(p.ResourceGroupName, p.Name, p.CancellationToken), createOrUpdateAsync: (o, p) => o.CreateOrUpdateAsync(