diff --git a/src/CustomLocation/CustomLocation.Autorest/README.md b/src/CustomLocation/CustomLocation.Autorest/README.md index acf8ee9e1675..5ae50da1ff64 100644 --- a/src/CustomLocation/CustomLocation.Autorest/README.md +++ b/src/CustomLocation/CustomLocation.Autorest/README.md @@ -3,7 +3,6 @@ This directory contains the PowerShell module for the CustomLocation service. --- - ## Info - Modifiable: yes - Generated: all diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/Find-AzCustomLocationTargetResourceGroup.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/Find-AzCustomLocationTargetResourceGroup.ps1 index 45ab72e1aef4..31a7183c1df5 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/Find-AzCustomLocationTargetResourceGroup.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/Find-AzCustomLocationTargetResourceGroup.ps1 @@ -77,7 +77,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='FindExpanded')] diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocation.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocation.ps1 index f586000c95aa..aaa2858aca14 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocation.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocation.ps1 @@ -75,7 +75,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocationResourceSyncRule.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocationResourceSyncRule.ps1 index 38aa7cf0fdb8..c1fb35b4eece 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocationResourceSyncRule.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/Get-AzCustomLocationResourceSyncRule.ps1 @@ -87,14 +87,12 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='GetViaIdentityCustomlocation', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ${CustomlocationInputObject}, [Parameter()] diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/New-AzCustomLocationResourceSyncRule.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/New-AzCustomLocationResourceSyncRule.ps1 index e425c2bcb83a..d3bd8ba00968 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/New-AzCustomLocationResourceSyncRule.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/New-AzCustomLocationResourceSyncRule.ps1 @@ -96,14 +96,12 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ${CustomlocationInputObject}, [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='CreateExpanded', Mandatory)] @@ -132,7 +130,6 @@ param( # Valid operators include In, NotIn, Exists, and DoesNotExist. # The values set must be non-empty in the case of In and NotIn. # The values set must be empty in the case of Exists and DoesNotExist. - # To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table. ${SelectorMatchExpression}, [Parameter(ParameterSetName='CreateExpanded')] diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/ProxyCmdletDefinitions.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/ProxyCmdletDefinitions.ps1 index a4b13dfe990f..11b418203af1 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/ProxyCmdletDefinitions.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/ProxyCmdletDefinitions.ps1 @@ -77,7 +77,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='FindExpanded')] @@ -479,14 +478,12 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='GetViaIdentityCustomlocation', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ${CustomlocationInputObject}, [Parameter()] @@ -683,7 +680,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -901,14 +897,12 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ${CustomlocationInputObject}, [Parameter(ParameterSetName='CreateViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='CreateExpanded', Mandatory)] @@ -937,7 +931,6 @@ param( # Valid operators include In, NotIn, Exists, and DoesNotExist. # The values set must be non-empty in the case of In and NotIn. # The values set must be empty in the case of Exists and DoesNotExist. - # To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table. ${SelectorMatchExpression}, [Parameter(ParameterSetName='CreateExpanded')] @@ -1201,14 +1194,12 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='DeleteViaIdentityCustomlocation', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ${CustomlocationInputObject}, [Parameter()] @@ -1406,7 +1397,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] @@ -1648,14 +1638,12 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ${CustomlocationInputObject}, [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='UpdateExpanded')] @@ -1676,7 +1664,6 @@ param( # Valid operators include In, NotIn, Exists, and DoesNotExist. # The values set must be non-empty in the case of In and NotIn. # The values set must be empty in the case of Exists and DoesNotExist. - # To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table. ${SelectorMatchExpression}, [Parameter(ParameterSetName='UpdateExpanded')] @@ -2258,7 +2245,7 @@ COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -INPUTOBJECT : Identity Parameter +INPUTOBJECT : Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table. [ChildResourceName ]: Resource Sync Rule name. [Id ]: Resource identity path [ResourceGroupName ]: The name of the resource group. The name is case insensitive. diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/Remove-AzCustomLocation.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/Remove-AzCustomLocation.ps1 index 33a7f2f33733..c0e59cf34368 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/Remove-AzCustomLocation.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/Remove-AzCustomLocation.ps1 @@ -71,7 +71,6 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter()] diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/Remove-AzCustomLocationResourceSyncRule.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/Remove-AzCustomLocationResourceSyncRule.ps1 index e529707e7b72..4fb0d524fe5d 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/Remove-AzCustomLocationResourceSyncRule.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/Remove-AzCustomLocationResourceSyncRule.ps1 @@ -88,14 +88,12 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='DeleteViaIdentityCustomlocation', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ${CustomlocationInputObject}, [Parameter()] diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/Update-AzCustomLocation.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/Update-AzCustomLocation.ps1 index 9e1406c82572..c1537dc1c500 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/Update-AzCustomLocation.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/Update-AzCustomLocation.ps1 @@ -36,7 +36,7 @@ COMPLEX PARAMETER PROPERTIES To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. -INPUTOBJECT : Identity Parameter +INPUTOBJECT : Identity Parameter To construct, see NOTES section for INPUTOBJECT properties and create a hash table. [ChildResourceName ]: Resource Sync Rule name. [Id ]: Resource identity path [ResourceGroupName ]: The name of the resource group. The name is case insensitive. diff --git a/src/CustomLocation/CustomLocation.Autorest/exports/Update-AzCustomLocationResourceSyncRule.ps1 b/src/CustomLocation/CustomLocation.Autorest/exports/Update-AzCustomLocationResourceSyncRule.ps1 index c0f56a915048..ad06077df030 100644 --- a/src/CustomLocation/CustomLocation.Autorest/exports/Update-AzCustomLocationResourceSyncRule.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/exports/Update-AzCustomLocationResourceSyncRule.ps1 @@ -104,14 +104,12 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ${CustomlocationInputObject}, [Parameter(ParameterSetName='UpdateViaIdentityExpanded', Mandatory, ValueFromPipeline)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, [Parameter(ParameterSetName='UpdateExpanded')] @@ -132,7 +130,6 @@ param( # Valid operators include In, NotIn, Exists, and DoesNotExist. # The values set must be non-empty in the case of In and NotIn. # The values set must be empty in the case of Exists and DoesNotExist. - # To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table. ${SelectorMatchExpression}, [Parameter(ParameterSetName='UpdateExpanded')] diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/Module.cs b/src/CustomLocation/CustomLocation.Autorest/generated/Module.cs index 29d3baddec58..a0d8f771e7b6 100644 --- a/src/CustomLocation/CustomLocation.Autorest/generated/Module.cs +++ b/src/CustomLocation/CustomLocation.Autorest/generated/Module.cs @@ -26,12 +26,20 @@ public partial class Module public global::System.Net.Http.HttpClientHandler _handler = new global::System.Net.Http.HttpClientHandler(); + private static bool _init = false; + + private static readonly global::System.Object _initLock = new global::System.Object(); + + private static Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module _instance; + /// the ISendAsync pipeline instance private Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.HttpPipeline _pipeline; /// the ISendAsync pipeline instance (when proxy is enabled) private Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.HttpPipeline _pipelineWithProxy; + private static readonly global::System.Object _singletonLock = new global::System.Object(); + public bool _useProxy = false; public global::System.Net.WebProxy _webProxy = new global::System.Net.WebProxy(); @@ -51,11 +59,8 @@ public partial class Module /// The delegate to get the telemetry Id. public GetTelemetryIdDelegate GetTelemetryId { get; set; } - /// Backing field for property. - private static Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module _instance; - /// the singleton of this module class - public static Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module Instance => Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module._instance?? (Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module._instance = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module()); + public static Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module Instance { get { if (_instance == null) { lock (_singletonLock) { if (_instance == null) { _instance = new Module(); }}} return _instance; } } /// The Name of this module public string Name => @"Az.CustomLocation"; @@ -117,9 +122,17 @@ public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.HttpPipeline Cr /// Initialization steps performed after the module is loaded. public void Init() { - OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); - OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); - CustomInit(); + if (_init == false) + { + lock (_initLock) { + if (_init == false) { + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipeline.Prepend(step); } , (step)=> { _pipeline.Append(step); } ); + OnModuleLoad?.Invoke( ResourceId, Name ,(step)=> { _pipelineWithProxy.Prepend(step); } , (step)=> { _pipelineWithProxy.Append(step); } ); + CustomInit(); + _init = true; + } + } + } } /// Creates the module instance. diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/NewAzCustomLocation_CreateExpanded.cs b/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/NewAzCustomLocation_CreateExpanded.cs index 2b67f48e2927..3b93b11dbb0f 100644 --- a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/NewAzCustomLocation_CreateExpanded.cs +++ b/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/NewAzCustomLocation_CreateExpanded.cs @@ -126,6 +126,10 @@ public partial class NewAzCustomLocation_CreateExpanded : global::System.Managem PossibleTypes = new [] { typeof(string) })] public string DisplayName { get => _parametersBody.DisplayName ?? null; set => _parametersBody.DisplayName = value; } + /// Decides if enable a system assigned identity for the resource. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Decides if enable a system assigned identity for the resource.")] + public global::System.Management.Automation.SwitchParameter EnableSystemAssignedIdentity { set => _parametersBody.IdentityType = value.IsPresent ? "SystemAssigned": null ; } + /// Accessor for extensibleParameters. public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } @@ -172,18 +176,6 @@ public partial class NewAzCustomLocation_CreateExpanded : global::System.Managem [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } - /// The identity type. - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"The identity type.", - SerializedName = @"type", - PossibleTypes = new [] { typeof(string) })] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.PSArgumentCompleterAttribute("SystemAssigned", "None")] - public string IdentityType { get => _parametersBody.IdentityType ?? null; set => _parametersBody.IdentityType = value; } - /// Accessor for our copy of the InvocationInfo. public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateExpanded.cs b/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateExpanded.cs index aaea03b961ae..46c8dcd57efe 100644 --- a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateExpanded.cs +++ b/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateExpanded.cs @@ -10,18 +10,16 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Cmdlets using Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Cmdlets; using System; - /// - /// Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. - /// + /// Create a Custom Location in the specified Subscription and Resource Group /// - /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}" + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzCustomLocation_UpdateExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation))] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Description(@"Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Description(@"Create a Custom Location in the specified Subscription and Resource Group")] [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.HttpPath(Path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}", ApiVersion = "2021-08-31-preview")] public partial class UpdateAzCustomLocation_UpdateExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IContext @@ -46,8 +44,8 @@ public partial class UpdateAzCustomLocation_UpdateExpanded : global::System.Mana /// A buffer to record first returned object in response. private object _firstResponse = null; - /// The Custom Locations patchable resource definition. - private Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IPatchableCustomLocations _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.PatchableCustomLocations(); + /// Custom Locations definition. + private Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.CustomLocation(); /// /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. @@ -55,6 +53,11 @@ public partial class UpdateAzCustomLocation_UpdateExpanded : global::System.Mana /// private int _responseSize = 0; + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + /// The type of the Custom Locations authentication [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the Custom Locations authentication")] [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Body)] @@ -123,6 +126,10 @@ public partial class UpdateAzCustomLocation_UpdateExpanded : global::System.Mana PossibleTypes = new [] { typeof(string) })] public string DisplayName { get => _parametersBody.DisplayName ?? null; set => _parametersBody.DisplayName = value; } + /// Decides if enable a system assigned identity for the resource. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Decides if enable a system assigned identity for the resource.")] + public System.Boolean? EnableSystemAssignedIdentity { get; set; } + /// Accessor for extensibleParameters. public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } @@ -169,18 +176,6 @@ public partial class UpdateAzCustomLocation_UpdateExpanded : global::System.Mana [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } - /// The identity type. - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"The identity type.", - SerializedName = @"type", - PossibleTypes = new [] { typeof(string) })] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.PSArgumentCompleterAttribute("SystemAssigned", "None")] - public string IdentityType { get => _parametersBody.IdentityType ?? null; set => _parametersBody.IdentityType = value; } - /// Accessor for our copy of the InvocationInfo. public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } @@ -217,6 +212,14 @@ public partial class UpdateAzCustomLocation_UpdateExpanded : global::System.Mana PossibleTypes = new [] { typeof(string) })] public string Namespace { get => _parametersBody.Namespace ?? null; set => _parametersBody.Namespace = value; } + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + /// /// The instance of the that the remote call will use. /// @@ -271,17 +274,17 @@ public partial class UpdateAzCustomLocation_UpdateExpanded : global::System.Mana [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Path)] public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } - /// Resource tags + /// Resource tags. [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ExportAs(typeof(global::System.Collections.Hashtable))] - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Body)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( Required = false, ReadOnly = false, - Description = @"Resource tags", + Description = @"Resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IPatchableCustomLocationsTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IPatchableCustomLocationsTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ITrackedResourceTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what @@ -325,6 +328,30 @@ protected override void BeginProcessing() ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzCustomLocation_UpdateExpanded + public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Cmdlets.UpdateAzCustomLocation_UpdateExpanded Clone() + { + var clone = new UpdateAzCustomLocation_UpdateExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._parametersBody = this._parametersBody; + clone.SubscriptionId = this.SubscriptionId; + clone.ResourceGroupName = this.ResourceGroupName; + clone.Name = this.Name; + return clone; + } + /// Performs clean-up after the command execution protected override void EndProcessing() { @@ -365,8 +392,8 @@ protected override void EndProcessing() } case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Information: { - var data = messageData(); - WriteInformation(data.Message, new string[]{}); + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); return ; } case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Debug: @@ -404,6 +431,40 @@ protected override void EndProcessing() }); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } } await Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) @@ -414,6 +475,29 @@ protected override void EndProcessing() } } + private void PreProcessManagedIdentityParametersWithGetResult() + { + bool supportsSystemAssignedIdentity = (true == this.EnableSystemAssignedIdentity || null == this.EnableSystemAssignedIdentity && true == _parametersBody?.IdentityType?.Contains("SystemAssigned")); + bool supportsUserAssignedIdentity = false; + // calculate IdentityType + if ((supportsUserAssignedIdentity && supportsSystemAssignedIdentity)) + { + _parametersBody.IdentityType = "SystemAssigned,UserAssigned"; + } + else if ((supportsUserAssignedIdentity && !supportsSystemAssignedIdentity)) + { + _parametersBody.IdentityType = "UserAssigned"; + } + else if ((!supportsUserAssignedIdentity && supportsSystemAssignedIdentity)) + { + _parametersBody.IdentityType = "SystemAssigned"; + } + else + { + _parametersBody.IdentityType = "None"; + } + } + /// Performs execution of the command. protected override void ProcessRecord() { @@ -422,11 +506,23 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'CustomLocationsUpdate' operation")) + if (ShouldProcess($"Call remote 'CustomLocationsCreateOrUpdate' operation")) { - using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token) ) + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) { - asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token); + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token); + } } } } @@ -478,7 +574,10 @@ protected override void ProcessRecord() try { await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.CustomLocationsUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SerializationMode.IncludeUpdate); + _parametersBody = await this.Client.CustomLocationsGetWithResult(SubscriptionId, ResourceGroupName, Name, this, Pipeline); + this.PreProcessManagedIdentityParametersWithGetResult(); + this.Update_parametersBody(); + await this.Client.CustomLocationsCreateOrUpdate(SubscriptionId, ResourceGroupName, Name, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SerializationMode.IncludeUpdate); await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } catch (Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.UndeclaredResponseException urexception) @@ -510,6 +609,42 @@ public UpdateAzCustomLocation_UpdateExpanded() } + private void Update_parametersBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Tag"))) + { + this.Tag = (Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ITrackedResourceTags)(this.MyInvocation?.BoundParameters["Tag"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("HostType"))) + { + this.HostType = (string)(this.MyInvocation?.BoundParameters["HostType"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("ClusterExtensionId"))) + { + this.ClusterExtensionId = (string[])(this.MyInvocation?.BoundParameters["ClusterExtensionId"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("DisplayName"))) + { + this.DisplayName = (string)(this.MyInvocation?.BoundParameters["DisplayName"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("HostResourceId"))) + { + this.HostResourceId = (string)(this.MyInvocation?.BoundParameters["HostResourceId"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Namespace"))) + { + this.Namespace = (string)(this.MyInvocation?.BoundParameters["Namespace"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("AuthenticationType"))) + { + this.AuthenticationType = (string)(this.MyInvocation?.BoundParameters["AuthenticationType"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("AuthenticationValue"))) + { + this.AuthenticationValue = (string)(this.MyInvocation?.BoundParameters["AuthenticationValue"]); + } + } + /// /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaIdentityExpanded.cs b/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaIdentityExpanded.cs index 24380fa1e479..15eafdbd635f 100644 --- a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaIdentityExpanded.cs +++ b/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaIdentityExpanded.cs @@ -10,18 +10,16 @@ namespace Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Cmdlets using Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Cmdlets; using System; - /// - /// Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. - /// + /// Create a Custom Location in the specified Subscription and Resource Group /// - /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}" + /// [OpenAPI] Get=>GET:"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}" + /// [OpenAPI] CreateOrUpdate=>PUT:"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}" /// [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.InternalExport] [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzCustomLocation_UpdateViaIdentityExpanded", SupportsShouldProcess = true)] [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation))] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Description(@"Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription.")] + [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Description(@"Create a Custom Location in the specified Subscription and Resource Group")] [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.HttpPath(Path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}", ApiVersion = "2021-08-31-preview")] public partial class UpdateAzCustomLocation_UpdateViaIdentityExpanded : global::System.Management.Automation.PSCmdlet, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IContext @@ -46,8 +44,8 @@ public partial class UpdateAzCustomLocation_UpdateViaIdentityExpanded : global:: /// A buffer to record first returned object in response. private object _firstResponse = null; - /// The Custom Locations patchable resource definition. - private Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IPatchableCustomLocations _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.PatchableCustomLocations(); + /// Custom Locations definition. + private Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation _parametersBody = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.CustomLocation(); /// /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. @@ -55,6 +53,11 @@ public partial class UpdateAzCustomLocation_UpdateViaIdentityExpanded : global:: /// private int _responseSize = 0; + /// when specified, runs this cmdlet as a PowerShell job + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command as a job")] + [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter AsJob { get; set; } + /// The type of the Custom Locations authentication [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The type of the Custom Locations authentication")] [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Body)] @@ -123,6 +126,10 @@ public partial class UpdateAzCustomLocation_UpdateViaIdentityExpanded : global:: PossibleTypes = new [] { typeof(string) })] public string DisplayName { get => _parametersBody.DisplayName ?? null; set => _parametersBody.DisplayName = value; } + /// Decides if enable a system assigned identity for the resource. + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Decides if enable a system assigned identity for the resource.")] + public System.Boolean? EnableSystemAssignedIdentity { get; set; } + /// Accessor for extensibleParameters. public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } @@ -169,18 +176,6 @@ public partial class UpdateAzCustomLocation_UpdateViaIdentityExpanded : global:: [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } - /// The identity type. - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The identity type.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Body)] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = false, - ReadOnly = false, - Description = @"The identity type.", - SerializedName = @"type", - PossibleTypes = new [] { typeof(string) })] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.PSArgumentCompleterAttribute("SystemAssigned", "None")] - public string IdentityType { get => _parametersBody.IdentityType ?? null; set => _parametersBody.IdentityType = value; } - /// Backing field for property. private Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity _inputObject; @@ -211,6 +206,14 @@ public partial class UpdateAzCustomLocation_UpdateViaIdentityExpanded : global:: PossibleTypes = new [] { typeof(string) })] public string Namespace { get => _parametersBody.Namespace ?? null; set => _parametersBody.Namespace = value; } + /// + /// when specified, will make the remote call, and return an AsyncOperationResponse, letting the remote operation continue + /// asynchronously. + /// + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Run the command asynchronously")] + [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] + public global::System.Management.Automation.SwitchParameter NoWait { get; set; } + /// /// The instance of the that the remote call will use. /// @@ -232,17 +235,17 @@ public partial class UpdateAzCustomLocation_UpdateViaIdentityExpanded : global:: [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } - /// Resource tags + /// Resource tags. [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ExportAs(typeof(global::System.Collections.Hashtable))] - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags")] + [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "Resource tags.")] [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Body)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( Required = false, ReadOnly = false, - Description = @"Resource tags", + Description = @"Resource tags.", SerializedName = @"tags", - PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IPatchableCustomLocationsTags) })] - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IPatchableCustomLocationsTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } + PossibleTypes = new [] { typeof(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ITrackedResourceTags) })] + public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ITrackedResourceTags Tag { get => _parametersBody.Tag ?? null /* object */; set => _parametersBody.Tag = value; } /// /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what @@ -286,6 +289,27 @@ protected override void BeginProcessing() ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } + /// Creates a duplicate instance of this cmdlet (via JSON serialization). + /// a duplicate instance of UpdateAzCustomLocation_UpdateViaIdentityExpanded + public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Cmdlets.UpdateAzCustomLocation_UpdateViaIdentityExpanded Clone() + { + var clone = new UpdateAzCustomLocation_UpdateViaIdentityExpanded(); + clone.__correlationId = this.__correlationId; + clone.__processRecordId = this.__processRecordId; + clone.DefaultProfile = this.DefaultProfile; + clone.InvocationInformation = this.InvocationInformation; + clone.Proxy = this.Proxy; + clone.Pipeline = this.Pipeline; + clone.AsJob = this.AsJob; + clone.Break = this.Break; + clone.ProxyCredential = this.ProxyCredential; + clone.ProxyUseDefaultCredentials = this.ProxyUseDefaultCredentials; + clone.HttpPipelinePrepend = this.HttpPipelinePrepend; + clone.HttpPipelineAppend = this.HttpPipelineAppend; + clone._parametersBody = this._parametersBody; + return clone; + } + /// Performs clean-up after the command execution protected override void EndProcessing() { @@ -326,8 +350,8 @@ protected override void EndProcessing() } case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Information: { - var data = messageData(); - WriteInformation(data.Message, new string[]{}); + // When an operation supports asjob, Information messages must go thru verbose. + WriteVerbose($"INFORMATION: {(messageData().Message ?? global::System.String.Empty)}"); return ; } case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Debug: @@ -365,6 +389,40 @@ protected override void EndProcessing() }); return ; } + case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.DelayBeforePolling: + { + var data = messageData(); + if (true == MyInvocation?.BoundParameters?.ContainsKey("NoWait")) + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + var asyncOperation = response.GetFirstHeader(@"Azure-AsyncOperation"); + var location = response.GetFirstHeader(@"Location"); + var uri = global::System.String.IsNullOrEmpty(asyncOperation) ? global::System.String.IsNullOrEmpty(location) ? response.RequestMessage.RequestUri.AbsoluteUri : location : asyncOperation; + WriteObject(new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncOperationResponse { Target = uri }); + // do nothing more. + data.Cancel(); + return; + } + } + else + { + if (data.ResponseMessage is System.Net.Http.HttpResponseMessage response) + { + int delay = (int)(response.Headers.RetryAfter?.Delta?.TotalSeconds ?? 30); + WriteDebug($"Delaying {delay} seconds before polling."); + for (var now = 0; now < delay; ++now) + { + WriteProgress(new global::System.Management.Automation.ProgressRecord(1, "In progress", "Checking operation status") + { + PercentComplete = now * 100 / delay + }); + await global::System.Threading.Tasks.Task.Delay(1000, token); + } + } + } + break; + } } await Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); if (token.IsCancellationRequested) @@ -375,6 +433,29 @@ protected override void EndProcessing() } } + private void PreProcessManagedIdentityParametersWithGetResult() + { + bool supportsSystemAssignedIdentity = (true == this.EnableSystemAssignedIdentity || null == this.EnableSystemAssignedIdentity && true == _parametersBody?.IdentityType?.Contains("SystemAssigned")); + bool supportsUserAssignedIdentity = false; + // calculate IdentityType + if ((supportsUserAssignedIdentity && supportsSystemAssignedIdentity)) + { + _parametersBody.IdentityType = "SystemAssigned,UserAssigned"; + } + else if ((supportsUserAssignedIdentity && !supportsSystemAssignedIdentity)) + { + _parametersBody.IdentityType = "UserAssigned"; + } + else if ((!supportsUserAssignedIdentity && supportsSystemAssignedIdentity)) + { + _parametersBody.IdentityType = "SystemAssigned"; + } + else + { + _parametersBody.IdentityType = "None"; + } + } + /// Performs execution of the command. protected override void ProcessRecord() { @@ -383,11 +464,23 @@ protected override void ProcessRecord() try { // work - if (ShouldProcess($"Call remote 'CustomLocationsUpdate' operation")) + if (ShouldProcess($"Call remote 'CustomLocationsCreateOrUpdate' operation")) { - using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token) ) + if (true == MyInvocation?.BoundParameters?.ContainsKey("AsJob")) { - asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token); + var instance = this.Clone(); + var job = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncJob(instance, this.MyInvocation.Line, this.MyInvocation.MyCommand.Name, this._cancellationTokenSource.Token, this._cancellationTokenSource.Cancel); + JobRepository.Add(job); + var task = instance.ProcessRecordAsync(); + job.Monitor(task); + WriteObject(job); + } + else + { + using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token) ) + { + asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token); + } } } } @@ -441,7 +534,10 @@ protected override void ProcessRecord() await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } if (InputObject?.Id != null) { - await this.Client.CustomLocationsUpdateViaIdentity(InputObject.Id, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SerializationMode.IncludeUpdate); + _parametersBody = await this.Client.CustomLocationsGetViaIdentityWithResult(InputObject.Id, this, Pipeline); + this.PreProcessManagedIdentityParametersWithGetResult(); + this.Update_parametersBody(); + await this.Client.CustomLocationsCreateOrUpdateViaIdentity(InputObject.Id, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SerializationMode.IncludeUpdate); } else { @@ -458,7 +554,10 @@ protected override void ProcessRecord() { ThrowTerminatingError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception("InputObject has null value for InputObject.ResourceName"),string.Empty, global::System.Management.Automation.ErrorCategory.InvalidArgument, InputObject) ); } - await this.Client.CustomLocationsUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ResourceName ?? null, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SerializationMode.IncludeUpdate); + _parametersBody = await this.Client.CustomLocationsGetWithResult(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ResourceName ?? null, this, Pipeline); + this.PreProcessManagedIdentityParametersWithGetResult(); + this.Update_parametersBody(); + await this.Client.CustomLocationsCreateOrUpdate(InputObject.SubscriptionId ?? null, InputObject.ResourceGroupName ?? null, InputObject.ResourceName ?? null, _parametersBody, onOk, onDefault, this, Pipeline, Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SerializationMode.IncludeUpdate); } await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } } @@ -491,6 +590,42 @@ public UpdateAzCustomLocation_UpdateViaIdentityExpanded() } + private void Update_parametersBody() + { + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Tag"))) + { + this.Tag = (Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ITrackedResourceTags)(this.MyInvocation?.BoundParameters["Tag"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("HostType"))) + { + this.HostType = (string)(this.MyInvocation?.BoundParameters["HostType"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("ClusterExtensionId"))) + { + this.ClusterExtensionId = (string[])(this.MyInvocation?.BoundParameters["ClusterExtensionId"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("DisplayName"))) + { + this.DisplayName = (string)(this.MyInvocation?.BoundParameters["DisplayName"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("HostResourceId"))) + { + this.HostResourceId = (string)(this.MyInvocation?.BoundParameters["HostResourceId"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("Namespace"))) + { + this.Namespace = (string)(this.MyInvocation?.BoundParameters["Namespace"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("AuthenticationType"))) + { + this.AuthenticationType = (string)(this.MyInvocation?.BoundParameters["AuthenticationType"]); + } + if ((bool)(true == this.MyInvocation?.BoundParameters.ContainsKey("AuthenticationValue"))) + { + this.AuthenticationValue = (string)(this.MyInvocation?.BoundParameters["AuthenticationValue"]); + } + } + /// /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). /// diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaJsonFilePath.cs b/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaJsonFilePath.cs deleted file mode 100644 index df27b6f5b473..000000000000 --- a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaJsonFilePath.cs +++ /dev/null @@ -1,493 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Cmdlets -{ - using static Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Extensions; - using Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell; - using Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Cmdlets; - using System; - - /// - /// Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. - /// - /// - /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}" - /// - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.InternalExport] - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzCustomLocation_UpdateViaJsonFilePath", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation))] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Description(@"Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.HttpPath(Path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}", ApiVersion = "2021-08-31-preview")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.NotSuggestDefaultParameterSet] - public partial class UpdateAzCustomLocation_UpdateViaJsonFilePath : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener, - Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IContext - { - /// A unique id generatd for the this cmdlet when it is instantiated. - private string __correlationId = System.Guid.NewGuid().ToString(); - - /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) - private global::System.Management.Automation.InvocationInfo __invocationInfo; - - /// A unique id generatd for the this cmdlet when ProcessRecord() is called. - private string __processRecordId; - - /// - /// The for this operation. - /// - private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); - - /// A dictionary to carry over additional data for pipeline. - private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - public global::System.String _jsonString; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - - /// Wait for .NET debugger to attach - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public global::System.Management.Automation.SwitchParameter Break { get; set; } - - /// Accessor for cancellationTokenSource. - public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } - - /// The reference to the client API class. - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.CustomLocation Client => Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.ClientAPI; - - /// - /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet - /// against a different subscription - /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] - [global::System.Management.Automation.ValidateNotNull] - [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Azure)] - public global::System.Management.Automation.PSObject DefaultProfile { get; set; } - - /// Accessor for extensibleParameters. - public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } - - /// SendAsync Pipeline Steps to be appended to the front of the pipeline - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] - [global::System.Management.Automation.ValidateNotNull] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } - - /// SendAsync Pipeline Steps to be prepended to the front of the pipeline - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] - [global::System.Management.Automation.ValidateNotNull] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } - - /// Accessor for our copy of the InvocationInfo. - public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } - - /// Backing field for property. - private string _jsonFilePath; - - /// Path of Json file supplied to the Update operation - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Path of Json file supplied to the Update operation")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"Path of Json file supplied to the Update operation", - SerializedName = @"JsonFilePath", - PossibleTypes = new [] { typeof(string) })] - public string JsonFilePath { get => this._jsonFilePath; set { if (!System.IO.File.Exists(value)) { throw new Exception("Cannot find File " + value); } this._jsonString = System.IO.File.ReadAllText(value); this._jsonFilePath = value; } } - - /// - /// cancellation delegate. Stops the cmdlet when called. - /// - global::System.Action Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - - /// cancellation token. - global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener.Token => _cancellationTokenSource.Token; - - /// Backing field for property. - private string _name; - - /// Custom Locations name. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Custom Locations name.")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"Custom Locations name.", - SerializedName = @"resourceName", - PossibleTypes = new [] { typeof(string) })] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Path)] - public string Name { get => this._name; set => this._name = value; } - - /// - /// The instance of the that the remote call will use. - /// - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.HttpPipeline Pipeline { get; set; } - - /// The URI for the proxy server to use - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public global::System.Uri Proxy { get; set; } - - /// Credentials for a proxy server to use for the remote call - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] - [global::System.Management.Automation.ValidateNotNull] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } - - /// Use the default credentials for the proxy - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } - - /// Backing field for property. - private string _resourceGroupName; - - /// The name of the resource group. The name is case insensitive. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"The name of the resource group. The name is case insensitive.", - SerializedName = @"resourceGroupName", - PossibleTypes = new [] { typeof(string) })] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Path)] - public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } - - /// Backing field for property. - private string _subscriptionId; - - /// The ID of the target subscription. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"The ID of the target subscription.", - SerializedName = @"subscriptionId", - PossibleTypes = new [] { typeof(string) })] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.DefaultInfo( - Name = @"", - Description =@"", - Script = @"(Get-AzContext).Subscription.Id", - SetCondition = @"")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Path)] - public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } - - /// - /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what - /// happens on that response. Implement this method in a partial class to enable this behavior - /// - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IErrorResponse - /// from the remote call - /// /// Determines if the rest of the onDefault method should be processed, or if the method should - /// return immediately (set to true to skip further processing ) - - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); - - /// - /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens - /// on that response. Implement this method in a partial class to enable this behavior - /// - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation - /// from the remote call - /// /// Determines if the rest of the onOk method should be processed, or if the method should return - /// immediately (set to true to skip further processing ) - - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); - - /// - /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) - /// - protected override void BeginProcessing() - { - var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.GetTelemetryId.Invoke(); - if (telemetryId != "" && telemetryId != "internal") - { - __correlationId = telemetryId; - } - Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); - if (Break) - { - Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.AttachDebugger.Break(); - } - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - } - - /// Performs clean-up after the command execution - protected override void EndProcessing() - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } - } - - /// Handles/Dispatches events during the call to the REST service. - /// The message id - /// The message cancellation token. When this call is cancelled, this should be true - /// Detailed message data for the message event. - /// - /// A that will be complete when handling of the message is completed. - /// - async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) - { - using( NoSynchronizationContext ) - { - if (token.IsCancellationRequested) - { - return ; - } - - switch ( id ) - { - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Verbose: - { - WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Warning: - { - WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Information: - { - var data = messageData(); - WriteInformation(data.Message, new string[]{}); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Debug: - { - WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Error: - { - WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Progress: - { - var data = messageData(); - int progress = (int)data.Value; - string activityMessage, statusDescription; - global::System.Management.Automation.ProgressRecordType recordType; - if (progress < 100) - { - activityMessage = "In progress"; - statusDescription = "Checking operation status"; - recordType = System.Management.Automation.ProgressRecordType.Processing; - } - else - { - activityMessage = "Completed"; - statusDescription = "Completed"; - recordType = System.Management.Automation.ProgressRecordType.Completed; - } - WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) - { - PercentComplete = progress, - RecordType = recordType - }); - return ; - } - } - await Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); - if (token.IsCancellationRequested) - { - return ; - } - WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); - } - } - - /// Performs execution of the command. - protected override void ProcessRecord() - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - __processRecordId = System.Guid.NewGuid().ToString(); - try - { - // work - if (ShouldProcess($"Call remote 'CustomLocationsUpdate' operation")) - { - using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token) ) - { - asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token); - } - } - } - catch (global::System.AggregateException aggregateException) - { - // unroll the inner exceptions to get the root cause - foreach( var innerException in aggregateException.Flatten().InnerExceptions ) - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - // Write exception out to error channel. - WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); - } - } - catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - // Write exception out to error channel. - WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); - } - finally - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletProcessRecordEnd).Wait(); - } - } - - /// Performs execution of the command, working asynchronously if required. - /// - /// A that will be complete when handling of the method is completed. - /// - protected async global::System.Threading.Tasks.Task ProcessRecordAsync() - { - using( NoSynchronizationContext ) - { - await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); - if (null != HttpPipelinePrepend) - { - Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); - } - if (null != HttpPipelineAppend) - { - Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); - } - // get the client instance - try - { - await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.CustomLocationsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); - await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - } - catch (Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.UndeclaredResponseException urexception) - { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) - { - ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } - }); - } - finally - { - await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletProcessRecordAsyncEnd); - } - } - } - - /// Interrupts currently running code within the command. - protected override void StopProcessing() - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Cancel(); - base.StopProcessing(); - } - - /// - /// Initializes a new instance of the cmdlet class. - /// - public UpdateAzCustomLocation_UpdateViaJsonFilePath() - { - - } - - /// - /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). - /// - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IErrorResponse - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnDefault(responseMessage, response, ref _returnNow); - // if overrideOnDefault has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // Error Response : default - var code = (await response)?.Code; - var message = (await response)?.Message; - if ((null == code || null == message)) - { - // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) - { - ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } - }); - } - else - { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) - { - ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } - }); - } - } - } - - /// a delegate that is called when the remote service returns 200 (OK). - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnOk(responseMessage, response, ref _returnNow); - // if overrideOnOk has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation - var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } - } - } - } -} \ No newline at end of file diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaJsonString.cs b/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaJsonString.cs deleted file mode 100644 index 838c5e071e99..000000000000 --- a/src/CustomLocation/CustomLocation.Autorest/generated/cmdlets/UpdateAzCustomLocation_UpdateViaJsonString.cs +++ /dev/null @@ -1,491 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -namespace Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Cmdlets -{ - using static Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Extensions; - using Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell; - using Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Cmdlets; - using System; - - /// - /// Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. - /// - /// - /// [OpenAPI] Update=>PATCH:"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}" - /// - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.InternalExport] - [global::System.Management.Automation.Cmdlet(global::System.Management.Automation.VerbsData.Update, @"AzCustomLocation_UpdateViaJsonString", SupportsShouldProcess = true)] - [global::System.Management.Automation.OutputType(typeof(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation))] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Description(@"Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription.")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Generated] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.HttpPath(Path = "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.extendedlocation/customlocations/{resourceName}", ApiVersion = "2021-08-31-preview")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.NotSuggestDefaultParameterSet] - public partial class UpdateAzCustomLocation_UpdateViaJsonString : global::System.Management.Automation.PSCmdlet, - Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener, - Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IContext - { - /// A unique id generatd for the this cmdlet when it is instantiated. - private string __correlationId = System.Guid.NewGuid().ToString(); - - /// A copy of the Invocation Info (necessary to allow asJob to clone this cmdlet) - private global::System.Management.Automation.InvocationInfo __invocationInfo; - - /// A unique id generatd for the this cmdlet when ProcessRecord() is called. - private string __processRecordId; - - /// - /// The for this operation. - /// - private global::System.Threading.CancellationTokenSource _cancellationTokenSource = new global::System.Threading.CancellationTokenSource(); - - /// A dictionary to carry over additional data for pipeline. - private global::System.Collections.Generic.Dictionary _extensibleParameters = new System.Collections.Generic.Dictionary(); - - /// A buffer to record first returned object in response. - private object _firstResponse = null; - - /// - /// A flag to tell whether it is the first returned object in a call. Zero means no response yet. One means 1 returned object. - /// Two means multiple returned objects in response. - /// - private int _responseSize = 0; - - /// Wait for .NET debugger to attach - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Wait for .NET debugger to attach")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public global::System.Management.Automation.SwitchParameter Break { get; set; } - - /// Accessor for cancellationTokenSource. - public global::System.Threading.CancellationTokenSource CancellationTokenSource { get => _cancellationTokenSource ; set { _cancellationTokenSource = value; } } - - /// The reference to the client API class. - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.CustomLocation Client => Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.ClientAPI; - - /// - /// The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet - /// against a different subscription - /// - [global::System.Management.Automation.Parameter(Mandatory = false, HelpMessage = "The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription.")] - [global::System.Management.Automation.ValidateNotNull] - [global::System.Management.Automation.Alias("AzureRMContext", "AzureCredential")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Azure)] - public global::System.Management.Automation.PSObject DefaultProfile { get; set; } - - /// Accessor for extensibleParameters. - public global::System.Collections.Generic.IDictionary ExtensibleParameters { get => _extensibleParameters ; } - - /// SendAsync Pipeline Steps to be appended to the front of the pipeline - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be appended to the front of the pipeline")] - [global::System.Management.Automation.ValidateNotNull] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SendAsyncStep[] HttpPipelineAppend { get; set; } - - /// SendAsync Pipeline Steps to be prepended to the front of the pipeline - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "SendAsync Pipeline Steps to be prepended to the front of the pipeline")] - [global::System.Management.Automation.ValidateNotNull] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.SendAsyncStep[] HttpPipelinePrepend { get; set; } - - /// Accessor for our copy of the InvocationInfo. - public global::System.Management.Automation.InvocationInfo InvocationInformation { get => __invocationInfo = __invocationInfo ?? this.MyInvocation ; set { __invocationInfo = value; } } - - /// Backing field for property. - private string _jsonString; - - /// Json string supplied to the Update operation - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Json string supplied to the Update operation")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"Json string supplied to the Update operation", - SerializedName = @"JsonString", - PossibleTypes = new [] { typeof(string) })] - public string JsonString { get => this._jsonString; set => this._jsonString = value; } - - /// - /// cancellation delegate. Stops the cmdlet when called. - /// - global::System.Action Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener.Cancel => _cancellationTokenSource.Cancel; - - /// cancellation token. - global::System.Threading.CancellationToken Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener.Token => _cancellationTokenSource.Token; - - /// Backing field for property. - private string _name; - - /// Custom Locations name. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "Custom Locations name.")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"Custom Locations name.", - SerializedName = @"resourceName", - PossibleTypes = new [] { typeof(string) })] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Path)] - public string Name { get => this._name; set => this._name = value; } - - /// - /// The instance of the that the remote call will use. - /// - public Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.HttpPipeline Pipeline { get; set; } - - /// The URI for the proxy server to use - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "The URI for the proxy server to use")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public global::System.Uri Proxy { get; set; } - - /// Credentials for a proxy server to use for the remote call - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Credentials for a proxy server to use for the remote call")] - [global::System.Management.Automation.ValidateNotNull] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public global::System.Management.Automation.PSCredential ProxyCredential { get; set; } - - /// Use the default credentials for the proxy - [global::System.Management.Automation.Parameter(Mandatory = false, DontShow = true, HelpMessage = "Use the default credentials for the proxy")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Runtime)] - public global::System.Management.Automation.SwitchParameter ProxyUseDefaultCredentials { get; set; } - - /// Backing field for property. - private string _resourceGroupName; - - /// The name of the resource group. The name is case insensitive. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The name of the resource group. The name is case insensitive.")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"The name of the resource group. The name is case insensitive.", - SerializedName = @"resourceGroupName", - PossibleTypes = new [] { typeof(string) })] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Path)] - public string ResourceGroupName { get => this._resourceGroupName; set => this._resourceGroupName = value; } - - /// Backing field for property. - private string _subscriptionId; - - /// The ID of the target subscription. - [global::System.Management.Automation.Parameter(Mandatory = true, HelpMessage = "The ID of the target subscription.")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info( - Required = true, - ReadOnly = false, - Description = @"The ID of the target subscription.", - SerializedName = @"subscriptionId", - PossibleTypes = new [] { typeof(string) })] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.DefaultInfo( - Name = @"", - Description =@"", - Script = @"(Get-AzContext).Subscription.Id", - SetCondition = @"")] - [global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category(global::Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.ParameterCategory.Path)] - public string SubscriptionId { get => this._subscriptionId; set => this._subscriptionId = value; } - - /// - /// overrideOnDefault will be called before the regular onDefault has been processed, allowing customization of what - /// happens on that response. Implement this method in a partial class to enable this behavior - /// - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IErrorResponse - /// from the remote call - /// /// Determines if the rest of the onDefault method should be processed, or if the method should - /// return immediately (set to true to skip further processing ) - - partial void overrideOnDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); - - /// - /// overrideOnOk will be called before the regular onOk has been processed, allowing customization of what happens - /// on that response. Implement this method in a partial class to enable this behavior - /// - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation - /// from the remote call - /// /// Determines if the rest of the onOk method should be processed, or if the method should return - /// immediately (set to true to skip further processing ) - - partial void overrideOnOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response, ref global::System.Threading.Tasks.Task returnNow); - - /// - /// (overrides the default BeginProcessing method in global::System.Management.Automation.PSCmdlet) - /// - protected override void BeginProcessing() - { - var telemetryId = Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.GetTelemetryId.Invoke(); - if (telemetryId != "" && telemetryId != "internal") - { - __correlationId = telemetryId; - } - Module.Instance.SetProxyConfiguration(Proxy, ProxyCredential, ProxyUseDefaultCredentials); - if (Break) - { - Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.AttachDebugger.Break(); - } - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletBeginProcessing).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - } - - /// Performs clean-up after the command execution - protected override void EndProcessing() - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse); - } - } - - /// Handles/Dispatches events during the call to the REST service. - /// The message id - /// The message cancellation token. When this call is cancelled, this should be true - /// Detailed message data for the message event. - /// - /// A that will be complete when handling of the message is completed. - /// - async global::System.Threading.Tasks.Task Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener.Signal(string id, global::System.Threading.CancellationToken token, global::System.Func messageData) - { - using( NoSynchronizationContext ) - { - if (token.IsCancellationRequested) - { - return ; - } - - switch ( id ) - { - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Verbose: - { - WriteVerbose($"{(messageData().Message ?? global::System.String.Empty)}"); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Warning: - { - WriteWarning($"{(messageData().Message ?? global::System.String.Empty)}"); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Information: - { - var data = messageData(); - WriteInformation(data.Message, new string[]{}); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Debug: - { - WriteDebug($"{(messageData().Message ?? global::System.String.Empty)}"); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Error: - { - WriteError(new global::System.Management.Automation.ErrorRecord( new global::System.Exception(messageData().Message), string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null ) ); - return ; - } - case Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.Progress: - { - var data = messageData(); - int progress = (int)data.Value; - string activityMessage, statusDescription; - global::System.Management.Automation.ProgressRecordType recordType; - if (progress < 100) - { - activityMessage = "In progress"; - statusDescription = "Checking operation status"; - recordType = System.Management.Automation.ProgressRecordType.Processing; - } - else - { - activityMessage = "Completed"; - statusDescription = "Completed"; - recordType = System.Management.Automation.ProgressRecordType.Completed; - } - WriteProgress(new global::System.Management.Automation.ProgressRecord(1, activityMessage, statusDescription) - { - PercentComplete = progress, - RecordType = recordType - }); - return ; - } - } - await Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.Signal(id, token, messageData, (i, t, m) => ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(i, t, () => Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.EventDataConverter.ConvertFrom(m()) as Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.EventData), InvocationInformation, this.ParameterSetName, __correlationId, __processRecordId, null ); - if (token.IsCancellationRequested) - { - return ; - } - WriteDebug($"{id}: {(messageData().Message ?? global::System.String.Empty)}"); - } - } - - /// Performs execution of the command. - protected override void ProcessRecord() - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletProcessRecordStart).Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - __processRecordId = System.Guid.NewGuid().ToString(); - try - { - // work - if (ShouldProcess($"Call remote 'CustomLocationsUpdate' operation")) - { - using( var asyncCommandRuntime = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.AsyncCommandRuntime(this, ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token) ) - { - asyncCommandRuntime.Wait( ProcessRecordAsync(),((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token); - } - } - } - catch (global::System.AggregateException aggregateException) - { - // unroll the inner exceptions to get the root cause - foreach( var innerException in aggregateException.Flatten().InnerExceptions ) - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletException, $"{innerException.GetType().Name} - {innerException.Message} : {innerException.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - // Write exception out to error channel. - WriteError( new global::System.Management.Automation.ErrorRecord(innerException,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); - } - } - catch (global::System.Exception exception) when ((exception as System.Management.Automation.PipelineStoppedException)== null || (exception as System.Management.Automation.PipelineStoppedException).InnerException != null) - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletException, $"{exception.GetType().Name} - {exception.Message} : {exception.StackTrace}").Wait(); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - // Write exception out to error channel. - WriteError( new global::System.Management.Automation.ErrorRecord(exception,string.Empty, global::System.Management.Automation.ErrorCategory.NotSpecified, null) ); - } - finally - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletProcessRecordEnd).Wait(); - } - } - - /// Performs execution of the command, working asynchronously if required. - /// - /// A that will be complete when handling of the method is completed. - /// - protected async global::System.Threading.Tasks.Task ProcessRecordAsync() - { - using( NoSynchronizationContext ) - { - await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletGetPipeline); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - Pipeline = Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Module.Instance.CreatePipeline(InvocationInformation, __correlationId, __processRecordId, this.ParameterSetName, this.ExtensibleParameters); - if (null != HttpPipelinePrepend) - { - Pipeline.Prepend((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelinePrepend) ?? HttpPipelinePrepend); - } - if (null != HttpPipelineAppend) - { - Pipeline.Append((this.CommandRuntime as Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.PowerShell.IAsyncCommandRuntimeExtensions)?.Wrap(HttpPipelineAppend) ?? HttpPipelineAppend); - } - // get the client instance - try - { - await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletBeforeAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - await this.Client.CustomLocationsUpdateViaJsonString(SubscriptionId, ResourceGroupName, Name, _jsonString, onOk, onDefault, this, Pipeline); - await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletAfterAPICall); if( ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Token.IsCancellationRequested ) { return; } - } - catch (Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.UndeclaredResponseException urexception) - { - WriteError(new global::System.Management.Automation.ErrorRecord(urexception, urexception.StatusCode.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { SubscriptionId=SubscriptionId,ResourceGroupName=ResourceGroupName,Name=Name}) - { - ErrorDetails = new global::System.Management.Automation.ErrorDetails(urexception.Message) { RecommendedAction = urexception.Action } - }); - } - finally - { - await ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Signal(Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Events.CmdletProcessRecordAsyncEnd); - } - } - } - - /// Interrupts currently running code within the command. - protected override void StopProcessing() - { - ((Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.IEventListener)this).Cancel(); - base.StopProcessing(); - } - - /// - /// Initializes a new instance of the cmdlet class. - /// - public UpdateAzCustomLocation_UpdateViaJsonString() - { - - } - - /// - /// a delegate that is called when the remote service returns default (any response code not handled elsewhere). - /// - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IErrorResponse - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onDefault(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnDefault(responseMessage, response, ref _returnNow); - // if overrideOnDefault has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // Error Response : default - var code = (await response)?.Code; - var message = (await response)?.Message; - if ((null == code || null == message)) - { - // Unrecognized Response. Create an error record based on what we have. - var ex = new Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.RestException(responseMessage, await response); - WriteError( new global::System.Management.Automation.ErrorRecord(ex, ex.Code, global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) - { - ErrorDetails = new global::System.Management.Automation.ErrorDetails(ex.Message) { RecommendedAction = ex.Action } - }); - } - else - { - WriteError( new global::System.Management.Automation.ErrorRecord(new global::System.Exception($"[{code}] : {message}"), code?.ToString(), global::System.Management.Automation.ErrorCategory.InvalidOperation, new { }) - { - ErrorDetails = new global::System.Management.Automation.ErrorDetails(message) { RecommendedAction = global::System.String.Empty } - }); - } - } - } - - /// a delegate that is called when the remote service returns 200 (OK). - /// the raw response message as an global::System.Net.Http.HttpResponseMessage. - /// the body result as a Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation - /// from the remote call - /// - /// A that will be complete when handling of the method is completed. - /// - private async global::System.Threading.Tasks.Task onOk(global::System.Net.Http.HttpResponseMessage responseMessage, global::System.Threading.Tasks.Task response) - { - using( NoSynchronizationContext ) - { - var _returnNow = global::System.Threading.Tasks.Task.FromResult(false); - overrideOnOk(responseMessage, response, ref _returnNow); - // if overrideOnOk has returned true, then return right away. - if ((null != _returnNow && await _returnNow)) - { - return ; - } - // onOk - response for 200 / application/json - // (await response) // should be Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation - var result = (await response); - if (null != result) - { - if (0 == _responseSize) - { - _firstResponse = result; - _responseSize = 1; - } - else - { - if (1 ==_responseSize) - { - // Flush buffer - WriteObject(_firstResponse.AddMultipleTypeNameIntoPSObject()); - } - WriteObject(result.AddMultipleTypeNameIntoPSObject()); - _responseSize = 2; - } - } - } - } - } -} \ No newline at end of file diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs b/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs index 366a26b5cabb..6a3fc8df9e1d 100644 --- a/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs +++ b/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Cmdlets/ExportProxyCmdlet.cs @@ -70,9 +70,8 @@ protected override void ProcessRecord() var variantGroups = profileGroups.SelectMany(pg => pg.Variants .GroupBy(v => new { v.CmdletName, v.IsInternal }) .Select(vg => new VariantGroup(ModuleName, vg.Key.CmdletName, vg.Select(v => v).ToArray(), - Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) + Path.Combine(vg.Key.IsInternal ? InternalFolder : ExportsFolder, pg.ProfileFolder), pg.ProfileName, isInternal: vg.Key.IsInternal))) .ToArray(); - var license = new StringBuilder(); license.Append(@" # ---------------------------------------------------------------------------------- @@ -114,6 +113,7 @@ protected override void ProcessRecord() sb.Append("param("); sb.Append($"{(parameterGroups.Any() ? Environment.NewLine : String.Empty)}"); + foreach (var parameterGroup in parameterGroups) { var parameters = parameterGroup.HasAllVariants ? parameterGroup.Parameters.Take(1) : parameterGroup.Parameters; diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs b/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs index bbacbbde396d..a42cd64e10b0 100644 --- a/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs +++ b/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/MarkdownRenderer.cs @@ -94,7 +94,7 @@ public static void WriteMarkdowns(IEnumerable variantGroups, PsMod sb.Append($"## RELATED LINKS{Environment.NewLine}{Environment.NewLine}"); foreach (var relatedLink in markdownInfo.RelatedLinks) { - sb.Append($"{relatedLink}{Environment.NewLine}{Environment.NewLine}"); + sb.Append($"[{relatedLink}]({relatedLink}){Environment.NewLine}{Environment.NewLine}"); } File.WriteAllText(Path.Combine(docsFolder, $"{markdownInfo.CmdletName}.md"), sb.ToString()); diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs b/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs index 67b3cb7e0340..a898d8192a73 100644 --- a/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs +++ b/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Models/PsProxyOutputs.cs @@ -188,6 +188,7 @@ internal class BaseOutput public VariantGroup VariantGroup { get; } protected static readonly bool IsAzure = Convert.ToBoolean(@"true"); + public BaseOutput(VariantGroup variantGroup) { VariantGroup = variantGroup; @@ -295,6 +296,7 @@ private string GetDefaultValuesStatements() } return sb.ToString(); } + } internal class ProcessOutput : BaseOutput diff --git a/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs b/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs index 1b0780c7b695..7024b7c9b80f 100644 --- a/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs +++ b/src/CustomLocation/CustomLocation.Autorest/generated/runtime/BuildTime/Models/PsProxyTypes.cs @@ -31,7 +31,7 @@ internal class VariantGroup { public string ModuleName { get; } - public string RootModuleName {get => @"";} + public string RootModuleName { get => @""; } public string CmdletName { get; } public string CmdletVerb { get; } public string CmdletNoun { get; } @@ -49,7 +49,6 @@ internal class VariantGroup public PsHelpInfo HelpInfo { get; } public bool IsGenerated { get; } public bool IsInternal { get; } - public string OutputFolder { get; } public string FileName { get; } public string FilePath { get; } @@ -84,7 +83,6 @@ public VariantGroup(string moduleName, string cmdletName, Variant[] variants, st HelpInfo = Variants.Select(v => v.HelpInfo).FirstOrDefault() ?? new PsHelpInfo(); IsGenerated = Variants.All(v => v.Attributes.OfType().Any()); IsInternal = isInternal; - OutputFolder = outputFolder; FileName = $"{CmdletName}{(isTest ? ".Tests" : String.Empty)}.ps1"; FilePath = Path.Combine(OutputFolder, FileName); @@ -258,7 +256,6 @@ internal class Parameter public ParameterMetadata Metadata { get; } public PsParameterHelpInfo HelpInfo { get; } public Type ParameterType { get; } - public Attribute[] Attributes { get; } public ParameterCategory[] Categories { get; } public ParameterCategory OrderCategory { get; } @@ -311,10 +308,10 @@ public Parameter(string variantName, string parameterName, ParameterMetadata met IsMandatory = ParameterAttribute.Mandatory; var complexParameterName = ParameterName.ToUpperInvariant(); - var complexMessage = $"{Environment.NewLine}To construct, see NOTES section for {complexParameterName} properties and create a hash table."; + var complexMessage = $"{Environment.NewLine}"; var description = ParameterAttribute.HelpMessage.NullIfEmpty() ?? HelpInfo.Description.NullIfEmpty() ?? InfoAttribute?.Description.NullIfEmpty() ?? String.Empty; // Remove the complex type message as it will be reinserted if this is a complex type - description = description.NormalizeNewLines().Replace(complexMessage, String.Empty).Replace(complexMessage.ToPsSingleLine(), String.Empty); + description = description.NormalizeNewLines(); // Make an InfoAttribute for processing only if one isn't provided InfoAttribute = Attributes.OfType().FirstOrDefault() ?? new InfoAttribute { PossibleTypes = new[] { ParameterType.Unwrap() }, Required = IsMandatory }; // Set the description if the InfoAttribute does not have one since they are exported without a description @@ -334,7 +331,7 @@ internal class ComplexInterfaceInfo public bool Required { get; } public bool ReadOnly { get; } public string Description { get; } - + public ComplexInterfaceInfo[] NestedInfos { get; } public bool IsComplexInterface { get; } @@ -351,7 +348,7 @@ public ComplexInterfaceInfo(string name, Type type, InfoAttribute infoAttribute, var unwrappedType = Type.Unwrap(); var hasBeenSeen = seenTypes?.Contains(unwrappedType) ?? false; (seenTypes ?? (seenTypes = new List())).Add(unwrappedType); - NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[]{} : + NestedInfos = hasBeenSeen ? new ComplexInterfaceInfo[] { } : unwrappedType.GetInterfaces() .Concat(InfoAttribute.PossibleTypes) .SelectMany(pt => pt.GetProperties() @@ -440,7 +437,7 @@ public CompleterInfo(ArgumentCompleterAttribute completerAttribute) } } - internal class PSArgumentCompleterInfo: CompleterInfo + internal class PSArgumentCompleterInfo : CompleterInfo { public string[] ResourceTypes { get; } @@ -511,7 +508,8 @@ public static Parameter[] ToParameters(this Variant variant) parameterHelp = parameterHelp.Where(ph => (!ph.ParameterSetNames.Any() || ph.ParameterSetNames.Any(psn => psn == variant.VariantName || psn == AllParameterSets)) && ph.Name != "IncludeTotalCount"); } var result = parameters.Select(p => new Parameter(variant.VariantName, p.Key, p.Value, parameterHelp.FirstOrDefault(ph => ph.Name == p.Key))); - if (variant.SupportsPaging) { + if (variant.SupportsPaging) + { // If supportsPaging is set, we will need to add First and Skip parameters since they are treated as common parameters which as not contained on Metadata>parameters variant.Info.Parameters["First"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Gets only the first 'n' objects."; variant.Info.Parameters["Skip"].Attributes.OfType().FirstOrDefault(pa => pa.ParameterSetName == variant.VariantName || pa.ParameterSetName == AllParameterSets).HelpMessage = "Ignores the first 'n' objects and then gets the remaining objects."; diff --git a/src/CustomLocation/CustomLocation.Autorest/help/Find-AzCustomLocationTargetResourceGroup.md b/src/CustomLocation/CustomLocation.Autorest/help/Find-AzCustomLocationTargetResourceGroup.md index 1b0c7c8c06cf..8cccd0277b40 100644 --- a/src/CustomLocation/CustomLocation.Autorest/help/Find-AzCustomLocationTargetResourceGroup.md +++ b/src/CustomLocation/CustomLocation.Autorest/help/Find-AzCustomLocationTargetResourceGroup.md @@ -102,7 +102,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity diff --git a/src/CustomLocation/CustomLocation.Autorest/help/Get-AzCustomLocation.md b/src/CustomLocation/CustomLocation.Autorest/help/Get-AzCustomLocation.md index f39249f0ee09..a7799049faa4 100644 --- a/src/CustomLocation/CustomLocation.Autorest/help/Get-AzCustomLocation.md +++ b/src/CustomLocation/CustomLocation.Autorest/help/Get-AzCustomLocation.md @@ -98,7 +98,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity diff --git a/src/CustomLocation/CustomLocation.Autorest/help/Get-AzCustomLocationResourceSyncRule.md b/src/CustomLocation/CustomLocation.Autorest/help/Get-AzCustomLocationResourceSyncRule.md index 707d586c65f6..0163cb66d7b8 100644 --- a/src/CustomLocation/CustomLocation.Autorest/help/Get-AzCustomLocationResourceSyncRule.md +++ b/src/CustomLocation/CustomLocation.Autorest/help/Get-AzCustomLocationResourceSyncRule.md @@ -71,7 +71,6 @@ Get the detail of the resourceSyncRule with a specified resource group, subscrip ### -CustomlocationInputObject Identity Parameter -To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity @@ -118,7 +117,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity diff --git a/src/CustomLocation/CustomLocation.Autorest/help/New-AzCustomLocationResourceSyncRule.md b/src/CustomLocation/CustomLocation.Autorest/help/New-AzCustomLocationResourceSyncRule.md index 98f6616f63f2..6b7b6815a654 100644 --- a/src/CustomLocation/CustomLocation.Autorest/help/New-AzCustomLocationResourceSyncRule.md +++ b/src/CustomLocation/CustomLocation.Autorest/help/New-AzCustomLocationResourceSyncRule.md @@ -89,7 +89,6 @@ Accept wildcard characters: False ### -CustomlocationInputObject Identity Parameter -To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity @@ -136,7 +135,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity @@ -261,7 +259,6 @@ MatchExpressions is a list of resource selector requirements. Valid operators include In, NotIn, Exists, and DoesNotExist. The values set must be non-empty in the case of In and NotIn. The values set must be empty in the case of Exists and DoesNotExist. -To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IMatchExpressionsProperties[] diff --git a/src/CustomLocation/CustomLocation.Autorest/help/Remove-AzCustomLocation.md b/src/CustomLocation/CustomLocation.Autorest/help/Remove-AzCustomLocation.md index 6c807a774a10..93df95bf1bc7 100644 --- a/src/CustomLocation/CustomLocation.Autorest/help/Remove-AzCustomLocation.md +++ b/src/CustomLocation/CustomLocation.Autorest/help/Remove-AzCustomLocation.md @@ -79,7 +79,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity diff --git a/src/CustomLocation/CustomLocation.Autorest/help/Remove-AzCustomLocationResourceSyncRule.md b/src/CustomLocation/CustomLocation.Autorest/help/Remove-AzCustomLocationResourceSyncRule.md index 39af97e7aeca..a50a1cca586b 100644 --- a/src/CustomLocation/CustomLocation.Autorest/help/Remove-AzCustomLocationResourceSyncRule.md +++ b/src/CustomLocation/CustomLocation.Autorest/help/Remove-AzCustomLocationResourceSyncRule.md @@ -63,7 +63,6 @@ Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custo ### -CustomlocationInputObject Identity Parameter -To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity @@ -110,7 +109,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity diff --git a/src/CustomLocation/CustomLocation.Autorest/help/Update-AzCustomLocationResourceSyncRule.md b/src/CustomLocation/CustomLocation.Autorest/help/Update-AzCustomLocationResourceSyncRule.md index 83128589036c..ed0166949bdb 100644 --- a/src/CustomLocation/CustomLocation.Autorest/help/Update-AzCustomLocationResourceSyncRule.md +++ b/src/CustomLocation/CustomLocation.Autorest/help/Update-AzCustomLocationResourceSyncRule.md @@ -119,7 +119,6 @@ Accept wildcard characters: False ### -CustomlocationInputObject Identity Parameter -To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity @@ -166,7 +165,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity @@ -276,7 +274,6 @@ MatchExpressions is a list of resource selector requirements. Valid operators include In, NotIn, Exists, and DoesNotExist. The values set must be non-empty in the case of In and NotIn. The values set must be empty in the case of Exists and DoesNotExist. -To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IMatchExpressionsProperties[] diff --git a/src/CustomLocation/CustomLocation.Autorest/internal/New-AzCustomLocation.ps1 b/src/CustomLocation/CustomLocation.Autorest/internal/New-AzCustomLocation.ps1 index b37c0061bf47..8d99c534b291 100644 --- a/src/CustomLocation/CustomLocation.Autorest/internal/New-AzCustomLocation.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/internal/New-AzCustomLocation.ps1 @@ -86,17 +86,16 @@ param( [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [System.String] - # Connected Cluster or AKS Cluster. - # The Custom Locations RP will perform a checkAccess API for listAdminCredentials permissions. - ${HostResourceId}, + [System.Management.Automation.SwitchParameter] + # Decides if enable a system assigned identity for the resource. + ${EnableSystemAssignedIdentity}, [Parameter(ParameterSetName='CreateExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.PSArgumentCompleterAttribute("SystemAssigned", "None")] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] - # The identity type. - ${IdentityType}, + # Connected Cluster or AKS Cluster. + # The Custom Locations RP will perform a checkAccess API for listAdminCredentials permissions. + ${HostResourceId}, [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] diff --git a/src/CustomLocation/CustomLocation.Autorest/internal/ProxyCmdletDefinitions.ps1 b/src/CustomLocation/CustomLocation.Autorest/internal/ProxyCmdletDefinitions.ps1 index a2d7beb7dda6..b349f95e0451 100644 --- a/src/CustomLocation/CustomLocation.Autorest/internal/ProxyCmdletDefinitions.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/internal/ProxyCmdletDefinitions.ps1 @@ -196,17 +196,16 @@ param( [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [System.String] - # Connected Cluster or AKS Cluster. - # The Custom Locations RP will perform a checkAccess API for listAdminCredentials permissions. - ${HostResourceId}, + [System.Management.Automation.SwitchParameter] + # Decides if enable a system assigned identity for the resource. + ${EnableSystemAssignedIdentity}, [Parameter(ParameterSetName='CreateExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.PSArgumentCompleterAttribute("SystemAssigned", "None")] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] - # The identity type. - ${IdentityType}, + # Connected Cluster or AKS Cluster. + # The Custom Locations RP will perform a checkAccess API for listAdminCredentials permissions. + ${HostResourceId}, [Parameter(ParameterSetName='CreateExpanded')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] @@ -346,9 +345,9 @@ end { <# .Synopsis -Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. +Create a Custom Location in the specified Subscription and Resource Group .Description -Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. +Create a Custom Location in the specified Subscription and Resource Group .Example $HostResourceId = (Get-AzConnectedKubernetes -ClusterName azps-connect -ResourceGroupName azps_test_cluster).Id $ClusterExtensionId = (Get-AzKubernetesExtension -ClusterName azps-connect -ClusterType ConnectedClusters -ResourceGroupName azps_test_cluster -Name azps-extension).Id @@ -380,16 +379,12 @@ function Update-AzCustomLocation { [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] - [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] - [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [System.String] # Custom Locations name. ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] - [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] - [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [System.String] # The name of the resource group. @@ -397,8 +392,6 @@ param( ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaJsonFilePath')] - [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -409,81 +402,59 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # The type of the Custom Locations authentication ${AuthenticationType}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # The kubeconfig value. ${AuthenticationValue}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String[]] # Contains the reference to the add-on that contains charts to deploy CRDs and operators. ${ClusterExtensionId}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # Display name for the Custom Locations location. ${DisplayName}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] + [System.Nullable[System.Boolean]] + # Decides if enable a system assigned identity for the resource. + ${EnableSystemAssignedIdentity}, + + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # Connected Cluster or AKS Cluster. # The Custom Locations RP will perform a checkAccess API for listAdminCredentials permissions. ${HostResourceId}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.PSArgumentCompleterAttribute("SystemAssigned", "None")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [System.String] - # The identity type. - ${IdentityType}, - - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # Kubernetes namespace that will be created on the specified cluster. ${Namespace}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IPatchableCustomLocationsTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] - # Resource tags + # Resource tags. ${Tag}, - [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [System.String] - # Path of Json file supplied to the Update operation - ${JsonFilePath}, - - [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [System.String] - # Json string supplied to the Update operation - ${JsonString}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -493,6 +464,12 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -513,6 +490,12 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Runtime')] [System.Uri] @@ -544,10 +527,8 @@ begin { $mapping = @{ UpdateExpanded = 'Az.CustomLocation.private\Update-AzCustomLocation_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.CustomLocation.private\Update-AzCustomLocation_UpdateViaIdentityExpanded'; - UpdateViaJsonFilePath = 'Az.CustomLocation.private\Update-AzCustomLocation_UpdateViaJsonFilePath'; - UpdateViaJsonString = 'Az.CustomLocation.private\Update-AzCustomLocation_UpdateViaJsonString'; } - if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } if (('UpdateExpanded', 'UpdateViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('HostType') ) { diff --git a/src/CustomLocation/CustomLocation.Autorest/internal/Update-AzCustomLocation.ps1 b/src/CustomLocation/CustomLocation.Autorest/internal/Update-AzCustomLocation.ps1 index 15c75ef2e44a..24d9c191049f 100644 --- a/src/CustomLocation/CustomLocation.Autorest/internal/Update-AzCustomLocation.ps1 +++ b/src/CustomLocation/CustomLocation.Autorest/internal/Update-AzCustomLocation.ps1 @@ -16,9 +16,9 @@ <# .Synopsis -Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. +Create a Custom Location in the specified Subscription and Resource Group .Description -Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. +Create a Custom Location in the specified Subscription and Resource Group .Example $HostResourceId = (Get-AzConnectedKubernetes -ClusterName azps-connect -ResourceGroupName azps_test_cluster).Id $ClusterExtensionId = (Get-AzKubernetesExtension -ClusterName azps-connect -ClusterType ConnectedClusters -ResourceGroupName azps_test_cluster -Name azps-extension).Id @@ -50,16 +50,12 @@ function Update-AzCustomLocation { [CmdletBinding(DefaultParameterSetName='UpdateExpanded', PositionalBinding=$false, SupportsShouldProcess, ConfirmImpact='Medium')] param( [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] - [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] - [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [System.String] # Custom Locations name. ${Name}, [Parameter(ParameterSetName='UpdateExpanded', Mandatory)] - [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] - [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [System.String] # The name of the resource group. @@ -67,8 +63,6 @@ param( ${ResourceGroupName}, [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaJsonFilePath')] - [Parameter(ParameterSetName='UpdateViaJsonString')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.DefaultInfo(Script='(Get-AzContext).Subscription.Id')] [System.String] @@ -79,81 +73,59 @@ param( [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Path')] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity] # Identity Parameter - # To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ${InputObject}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # The type of the Custom Locations authentication ${AuthenticationType}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # The kubeconfig value. ${AuthenticationValue}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [AllowEmptyCollection()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String[]] # Contains the reference to the add-on that contains charts to deploy CRDs and operators. ${ClusterExtensionId}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # Display name for the Custom Locations location. ${DisplayName}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] + [System.Nullable[System.Boolean]] + # Decides if enable a system assigned identity for the resource. + ${EnableSystemAssignedIdentity}, + + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # Connected Cluster or AKS Cluster. # The Custom Locations RP will perform a checkAccess API for listAdminCredentials permissions. ${HostResourceId}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.PSArgumentCompleterAttribute("SystemAssigned", "None")] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [System.String] - # The identity type. - ${IdentityType}, - - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] [System.String] # Kubernetes namespace that will be created on the specified cluster. ${Namespace}, - [Parameter(ParameterSetName='UpdateExpanded')] - [Parameter(ParameterSetName='UpdateViaIdentityExpanded')] + [Parameter()] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IPatchableCustomLocationsTags]))] + [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Runtime.Info(PossibleTypes=([Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ITrackedResourceTags]))] [System.Collections.Hashtable] - # Resource tags + # Resource tags. ${Tag}, - [Parameter(ParameterSetName='UpdateViaJsonFilePath', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [System.String] - # Path of Json file supplied to the Update operation - ${JsonFilePath}, - - [Parameter(ParameterSetName='UpdateViaJsonString', Mandatory)] - [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Body')] - [System.String] - # Json string supplied to the Update operation - ${JsonString}, - [Parameter()] [Alias('AzureRMContext', 'AzureCredential')] [ValidateNotNull()] @@ -163,6 +135,12 @@ param( # Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ${DefaultProfile}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command as a job + ${AsJob}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Runtime')] [System.Management.Automation.SwitchParameter] @@ -183,6 +161,12 @@ param( # SendAsync Pipeline Steps to be prepended to the front of the pipeline ${HttpPipelinePrepend}, + [Parameter()] + [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Runtime')] + [System.Management.Automation.SwitchParameter] + # Run the command asynchronously + ${NoWait}, + [Parameter(DontShow)] [Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Category('Runtime')] [System.Uri] @@ -214,10 +198,8 @@ begin { $mapping = @{ UpdateExpanded = 'Az.CustomLocation.private\Update-AzCustomLocation_UpdateExpanded'; UpdateViaIdentityExpanded = 'Az.CustomLocation.private\Update-AzCustomLocation_UpdateViaIdentityExpanded'; - UpdateViaJsonFilePath = 'Az.CustomLocation.private\Update-AzCustomLocation_UpdateViaJsonFilePath'; - UpdateViaJsonString = 'Az.CustomLocation.private\Update-AzCustomLocation_UpdateViaJsonString'; } - if (('UpdateExpanded', 'UpdateViaJsonFilePath', 'UpdateViaJsonString') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { + if (('UpdateExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('SubscriptionId') ) { $PSBoundParameters['SubscriptionId'] = (Get-AzContext).Subscription.Id } if (('UpdateExpanded', 'UpdateViaIdentityExpanded') -contains $parameterSet -and -not $PSBoundParameters.ContainsKey('HostType') ) { diff --git a/src/CustomLocation/CustomLocation/Az.CustomLocation.psd1 b/src/CustomLocation/CustomLocation/Az.CustomLocation.psd1 index f106142e9772..abb1190ceafa 100644 --- a/src/CustomLocation/CustomLocation/Az.CustomLocation.psd1 +++ b/src/CustomLocation/CustomLocation/Az.CustomLocation.psd1 @@ -3,7 +3,7 @@ # # Generated by: Microsoft Corporation # -# Generated on: 12/27/2023 +# Generated on: 3/17/2024 # @{ @@ -51,16 +51,16 @@ DotNetFrameworkVersion = '4.7.2' # ProcessorArchitecture = '' # Modules that must be imported into the global environment prior to importing this module -RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.15.0'; }) +RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.16.0'; }) # Assemblies that must be loaded prior to importing this module RequiredAssemblies = 'CustomLocation.Autorest/bin/Az.CustomLocation.private.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 = @() +TypesToProcess = @() # Format files (.ps1xml) to be loaded when importing this module FormatsToProcess = 'CustomLocation.Autorest/Az.CustomLocation.format.ps1xml' @@ -102,7 +102,7 @@ PrivateData = @{ PSData = @{ # Tags applied to this module. These help with module discovery in online galleries. - Tags = 'Azure','ResourceManager','ARM','PSModule','CustomLocation' + Tags = 'Azure', 'ResourceManager', 'ARM', 'PSModule', 'CustomLocation' # A URL to the license for this module. LicenseUri = 'https://aka.ms/azps-license' @@ -127,7 +127,7 @@ PrivateData = @{ } # End of PSData hashtable - } # End of PrivateData hashtable +} # End of PrivateData hashtable # HelpInfo URI of this module # HelpInfoURI = '' diff --git a/src/CustomLocation/CustomLocation/help/Az.CustomLocation.md b/src/CustomLocation/CustomLocation/help/Az.CustomLocation.md index 5f3cf23e1de1..fc9074a6c882 100644 --- a/src/CustomLocation/CustomLocation/help/Az.CustomLocation.md +++ b/src/CustomLocation/CustomLocation/help/Az.CustomLocation.md @@ -11,18 +11,36 @@ Locale: en-US Microsoft Azure PowerShell: CustomLocation cmdlets ## Az.CustomLocation Cmdlets +### [Find-AzCustomLocationTargetResourceGroup](Find-AzCustomLocationTargetResourceGroup.md) +Returns the target resource group associated with the resource sync rules of the Custom Location that match the rules passed in with the Find Target Resource Group Request. + ### [Get-AzCustomLocation](Get-AzCustomLocation.md) Gets the details of the customLocation with a specified resource group and name. ### [Get-AzCustomLocationEnabledResourceType](Get-AzCustomLocationEnabledResourceType.md) Gets the list of the Enabled Resource Types. +### [Get-AzCustomLocationResourceSyncRule](Get-AzCustomLocationResourceSyncRule.md) +Gets the details of the resourceSyncRule with a specified resource group, subscription id Custom Location resource name and Resource Sync Rule name. + ### [New-AzCustomLocation](New-AzCustomLocation.md) -Creates or updates a Custom Location in the specified Subscription and Resource Group +Create a Custom Location in the specified Subscription and Resource Group + +### [New-AzCustomLocationMatchExpressionsObject](New-AzCustomLocationMatchExpressionsObject.md) +Create an in-memory object for MatchExpressionsProperties. + +### [New-AzCustomLocationResourceSyncRule](New-AzCustomLocationResourceSyncRule.md) +Create a Resource Sync Rule in the parent Custom Location, Subscription Id and Resource Group ### [Remove-AzCustomLocation](Remove-AzCustomLocation.md) Deletes the Custom Location with the specified Resource Name, Resource Group, and Subscription Id. +### [Remove-AzCustomLocationResourceSyncRule](Remove-AzCustomLocationResourceSyncRule.md) +Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id. + ### [Update-AzCustomLocation](Update-AzCustomLocation.md) Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. +### [Update-AzCustomLocationResourceSyncRule](Update-AzCustomLocationResourceSyncRule.md) +Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource Group, Subscription and Custom Location name. + diff --git a/src/CustomLocation/CustomLocation/help/Find-AzCustomLocationTargetResourceGroup.md b/src/CustomLocation/CustomLocation/help/Find-AzCustomLocationTargetResourceGroup.md index 99c786806873..de79c6a7c32b 100644 --- a/src/CustomLocation/CustomLocation/help/Find-AzCustomLocationTargetResourceGroup.md +++ b/src/CustomLocation/CustomLocation/help/Find-AzCustomLocationTargetResourceGroup.md @@ -15,28 +15,29 @@ Returns the target resource group associated with the resource sync rules of the ### FindExpanded (Default) ``` Find-AzCustomLocationTargetResourceGroup -CustomLocationName -ResourceGroupName - [-SubscriptionId ] [-Label ] [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] - [] + [-SubscriptionId ] [-Label ] [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### FindViaJsonString ``` Find-AzCustomLocationTargetResourceGroup -CustomLocationName -ResourceGroupName - [-SubscriptionId ] -JsonString [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] - [] + [-SubscriptionId ] -JsonString [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### FindViaJsonFilePath ``` Find-AzCustomLocationTargetResourceGroup -CustomLocationName -ResourceGroupName - [-SubscriptionId ] -JsonFilePath [-DefaultProfile ] [-PassThru] [-WhatIf] - [-Confirm] [] + [-SubscriptionId ] -JsonFilePath [-DefaultProfile ] [-PassThru] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### FindViaIdentityExpanded ``` Find-AzCustomLocationTargetResourceGroup -InputObject [-Label ] - [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-PassThru] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -44,24 +45,36 @@ Returns the target resource group associated with the resource sync rules of the ## EXAMPLES -### EXAMPLE 1 -``` +### Example 1: Returns the target resource group associated with the resource sync rules of the Custom Location that match the rules passed in with the Find Target Resource Group Request. +```powershell Find-AzCustomLocationTargetResourceGroup -ResourceGroupName azps_test_cluster -CustomLocationName azps-customlocation -Label @{"Key1"="Value1"} -PassThru ``` -### EXAMPLE 2 +```output +True ``` + +Returns the target resource group associated with the resource sync rules of the Custom Location that match the rules passed in with the Find Target Resource Group Request. + +### Example 2: Returns the target resource group associated with the resource sync rules of the Custom Location that match the rules passed in with the Find Target Resource Group Request. +```powershell $obj = Get-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation Find-AzCustomLocationTargetResourceGroup -InputObject $obj -Label @{"Key1"="Value1"} -PassThru ``` +```output +True +``` + +Returns the target resource group associated with the resource sync rules of the Custom Location that match the rules passed in with the Find Target Resource Group Request. + ## PARAMETERS ### -CustomLocationName Custom Locations name. ```yaml -Type: String +Type: System.String Parameter Sets: FindExpanded, FindViaJsonString, FindViaJsonFilePath Aliases: @@ -77,7 +90,7 @@ The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml -Type: PSObject +Type: System.Management.Automation.PSObject Parameter Sets: (All) Aliases: AzureRMContext, AzureCredential @@ -90,10 +103,9 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: FindViaIdentityExpanded Aliases: @@ -108,7 +120,7 @@ Accept wildcard characters: False Path of Json file supplied to the Find operation ```yaml -Type: String +Type: System.String Parameter Sets: FindViaJsonFilePath Aliases: @@ -123,7 +135,7 @@ Accept wildcard characters: False Json string supplied to the Find operation ```yaml -Type: String +Type: System.String Parameter Sets: FindViaJsonString Aliases: @@ -138,7 +150,7 @@ Accept wildcard characters: False Labels of the custom resource, this is a map of {key,value} pairs. ```yaml -Type: Hashtable +Type: System.Collections.Hashtable Parameter Sets: FindExpanded, FindViaIdentityExpanded Aliases: @@ -153,13 +165,28 @@ Accept wildcard characters: False Returns true when the command succeeds ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named -Default value: False +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -169,7 +196,7 @@ The name of the resource group. The name is case insensitive. ```yaml -Type: String +Type: System.String Parameter Sets: FindExpanded, FindViaJsonString, FindViaJsonFilePath Aliases: @@ -184,13 +211,13 @@ Accept wildcard characters: False The ID of the target subscription. ```yaml -Type: String +Type: System.String Parameter Sets: FindExpanded, FindViaJsonString, FindViaJsonFilePath Aliases: Required: False Position: Named -Default value: None +Default value: (Get-AzContext).Subscription.Id Accept pipeline input: False Accept wildcard characters: False ``` @@ -199,7 +226,7 @@ Accept wildcard characters: False Prompts you for confirmation before running the cmdlet. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: cf @@ -215,7 +242,7 @@ Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: wi @@ -232,24 +259,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity + ## OUTPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationFindTargetResourceGroupResult -## NOTES -COMPLEX PARAMETER PROPERTIES -To create the parameters described below, construct a hash table containing the appropriate properties. -For information on hash tables, run Get-Help about_Hash_Tables. - -INPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. +## NOTES ## RELATED LINKS - -[https://learn.microsoft.com/powershell/module/az.customlocation/find-azcustomlocationtargetresourcegroup](https://learn.microsoft.com/powershell/module/az.customlocation/find-azcustomlocationtargetresourcegroup) - diff --git a/src/CustomLocation/CustomLocation/help/Get-AzCustomLocation.md b/src/CustomLocation/CustomLocation/help/Get-AzCustomLocation.md index d817bb03ba6b..a07b3ed3ee06 100644 --- a/src/CustomLocation/CustomLocation/help/Get-AzCustomLocation.md +++ b/src/CustomLocation/CustomLocation/help/Get-AzCustomLocation.md @@ -14,24 +14,26 @@ Gets the details of the customLocation with a specified resource group and name. ### List (Default) ``` -Get-AzCustomLocation [-SubscriptionId ] [-DefaultProfile ] [] +Get-AzCustomLocation [-SubscriptionId ] [-DefaultProfile ] + [-ProgressAction ] [] ``` ### Get ``` Get-AzCustomLocation -Name -ResourceGroupName [-SubscriptionId ] - [-DefaultProfile ] [] + [-DefaultProfile ] [-ProgressAction ] [] ``` ### List1 ``` Get-AzCustomLocation -ResourceGroupName [-SubscriptionId ] [-DefaultProfile ] - [] + [-ProgressAction ] [] ``` ### GetViaIdentity ``` -Get-AzCustomLocation -InputObject [-DefaultProfile ] [] +Get-AzCustomLocation -InputObject [-DefaultProfile ] + [-ProgressAction ] [] ``` ## DESCRIPTION @@ -45,56 +47,44 @@ Get-AzCustomLocation ``` ```output -Location Name Namespace --------- ---- ---- -eastus azps_test_cluster arc +Location Name Namespace ResourceGroupName +-------- ---- --------- ----------------- +eastus azps-customlocation azps-namespace azps_test_cluster ``` List the details of the customLocation. ### Example 2: List the details of the customLocation with a specified resource group. ```powershell -Get-AzCustomLocation -ResourceGroupName azps_test_group +Get-AzCustomLocation -ResourceGroupName azps_test_cluster ``` ```output -Location Name Namespace --------- ---- ---- -eastus azps_test_cluster arc +Location Name Namespace ResourceGroupName +-------- ---- --------- ----------------- +eastus azps-customlocation azps-namespace azps_test_cluster ``` List the details of the customLocation with a specified resource group. ### Example 3: Gets the details of the customLocation with a specified resource group and name. ```powershell -Get-AzCustomLocation -ResourceGroupName azps_test_group -Name azps_test_cluster +Get-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation ``` ```output -Location Name Namespace --------- ---- ---- -eastus azps_test_cluster arc +Location Name Namespace ResourceGroupName +-------- ---- --------- ----------------- +eastus azps-customlocation azps-namespace azps_test_cluster ``` Gets the details of the customLocation with a specified resource group and name. -### Example 4: Gets the details of the customLocation. -```powershell -New-AzCustomLocation -ResourceGroupName azps_test_group -Name azps_test_cluster -Location eastus -ClusterExtensionId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/azps_test_group/providers/Microsoft.Kubernetes/connectedClusters/azps_test_cluster/providers/Microsoft.KubernetesConfiguration/extensions/azps_test_extension" -HostResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/azps_test_group/providers/Microsoft.Kubernetes/connectedClusters/azps_test_cluster" -Namespace arc | Get-AzCustomLocation -``` - -```output -Location Name Namespace --------- ---- ---- -eastus azps_test_cluster arc -``` - -Gets the details of the customLocation. - ## PARAMETERS ### -DefaultProfile -The credentials, account, tenant, and subscription used for communication with Azure. +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml Type: System.Management.Automation.PSObject @@ -110,7 +100,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity @@ -139,6 +128,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ResourceGroupName The name of the resource group. The name is case insensitive. @@ -179,21 +183,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.Api20210815.ICustomLocation +### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -INPUTOBJECT ``: Identity Parameter - - `[Id ]`: Resource identity path - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[ResourceName ]`: Custom Locations name. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/CustomLocation/CustomLocation/help/Get-AzCustomLocationEnabledResourceType.md b/src/CustomLocation/CustomLocation/help/Get-AzCustomLocationEnabledResourceType.md index e6b3b965311a..f3cbaded130f 100644 --- a/src/CustomLocation/CustomLocation/help/Get-AzCustomLocationEnabledResourceType.md +++ b/src/CustomLocation/CustomLocation/help/Get-AzCustomLocationEnabledResourceType.md @@ -14,7 +14,7 @@ Gets the list of the Enabled Resource Types. ``` Get-AzCustomLocationEnabledResourceType -Name -ResourceGroupName [-SubscriptionId ] - [-DefaultProfile ] [] + [-DefaultProfile ] [-ProgressAction ] [] ``` ## DESCRIPTION @@ -28,9 +28,9 @@ Get-AzCustomLocationEnabledResourceType -ResourceGroupName azps_test_group -Name ``` ```output -Name Type ----- ---- -017e563408cfcbaad0604875fef1f0e5a36d5fefa5e81a4c1c212c5a77fbcbde Microsoft.ExtendedLocation/customLocations/enabledResourceTypes +Name ExtensionType +---- ------------- +435b5e8926f937f7a473d48f25731707c20916dfb52a47e0401a40181cb28217 microsoft.arcdataservices ``` Gets the list of the Enabled Resource Types. @@ -38,7 +38,8 @@ Gets the list of the Enabled Resource Types. ## PARAMETERS ### -DefaultProfile -The credentials, account, tenant, and subscription used for communication with Azure. +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml Type: System.Management.Automation.PSObject @@ -67,6 +68,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ResourceGroupName The name of the resource group. The name is case insensitive. @@ -105,10 +121,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.Api20210815.IEnabledResourceType +### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IEnabledResourceType ## NOTES -ALIASES - ## RELATED LINKS diff --git a/src/CustomLocation/CustomLocation/help/Get-AzCustomLocationResourceSyncRule.md b/src/CustomLocation/CustomLocation/help/Get-AzCustomLocationResourceSyncRule.md index fc175eb4ad30..108e8b4e35ea 100644 --- a/src/CustomLocation/CustomLocation/help/Get-AzCustomLocationResourceSyncRule.md +++ b/src/CustomLocation/CustomLocation/help/Get-AzCustomLocationResourceSyncRule.md @@ -15,25 +15,27 @@ Gets the details of the resourceSyncRule with a specified resource group, subscr ### List (Default) ``` Get-AzCustomLocationResourceSyncRule -CustomLocationName -ResourceGroupName - [-SubscriptionId ] [-DefaultProfile ] [] + [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ] + [] ``` ### Get ``` Get-AzCustomLocationResourceSyncRule -CustomLocationName -Name -ResourceGroupName - [-SubscriptionId ] [-DefaultProfile ] [] + [-SubscriptionId ] [-DefaultProfile ] [-ProgressAction ] + [] ``` ### GetViaIdentityCustomlocation ``` Get-AzCustomLocationResourceSyncRule -Name -CustomlocationInputObject - [-DefaultProfile ] [] + [-DefaultProfile ] [-ProgressAction ] [] ``` ### GetViaIdentity ``` Get-AzCustomLocationResourceSyncRule -InputObject [-DefaultProfile ] - [] + [-ProgressAction ] [] ``` ## DESCRIPTION @@ -41,24 +43,39 @@ Gets the details of the resourceSyncRule with a specified resource group, subscr ## EXAMPLES -### EXAMPLE 1 -``` +### Example 1: List Resource Sync Rule by Custom Location name. +```powershell Get-AzCustomLocationResourceSyncRule -ResourceGroupName azps_test_cluster -CustomLocationName azps-customlocation ``` -### EXAMPLE 2 +```output +Location Name ResourceGroupName +-------- ---- ----------------- +eastus azps-resourcesyncrule azps_test_cluster ``` + +List Resource Sync Rule by Custom Location name. + +### Example 2: Get the detail of the resourceSyncRule with a specified resource group, subscription id Custom Location resource name and Resource Sync Rule name. +```powershell Get-AzCustomLocationResourceSyncRule -ResourceGroupName azps_test_cluster -CustomLocationName azps-customlocation -Name azps-resourcesyncrule ``` +```output +Location Name ResourceGroupName +-------- ---- ----------------- +eastus azps-resourcesyncrule azps_test_cluster +``` + +Get the detail of the resourceSyncRule with a specified resource group, subscription id Custom Location resource name and Resource Sync Rule name. + ## PARAMETERS ### -CustomlocationInputObject Identity Parameter -To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: GetViaIdentityCustomlocation Aliases: @@ -73,7 +90,7 @@ Accept wildcard characters: False Custom Locations name. ```yaml -Type: String +Type: System.String Parameter Sets: List, Get Aliases: @@ -89,7 +106,7 @@ The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml -Type: PSObject +Type: System.Management.Automation.PSObject Parameter Sets: (All) Aliases: AzureRMContext, AzureCredential @@ -102,10 +119,9 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: GetViaIdentity Aliases: @@ -120,7 +136,7 @@ Accept wildcard characters: False Resource Sync Rule name. ```yaml -Type: String +Type: System.String Parameter Sets: Get, GetViaIdentityCustomlocation Aliases: @@ -131,12 +147,27 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ResourceGroupName The name of the resource group. The name is case insensitive. ```yaml -Type: String +Type: System.String Parameter Sets: List, Get Aliases: @@ -151,13 +182,13 @@ Accept wildcard characters: False The ID of the target subscription. ```yaml -Type: String[] +Type: System.String[] Parameter Sets: List, Get Aliases: Required: False Position: Named -Default value: None +Default value: (Get-AzContext).Subscription.Id Accept pipeline input: False Accept wildcard characters: False ``` @@ -168,32 +199,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity + ## OUTPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IResourceSyncRule -## NOTES -COMPLEX PARAMETER PROPERTIES -To create the parameters described below, construct a hash table containing the appropriate properties. -For information on hash tables, run Get-Help about_Hash_Tables. - -CUSTOMLOCATIONINPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. - -INPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. +## NOTES ## RELATED LINKS - -[https://learn.microsoft.com/powershell/module/az.customlocation/get-azcustomlocationresourcesyncrule](https://learn.microsoft.com/powershell/module/az.customlocation/get-azcustomlocationresourcesyncrule) - diff --git a/src/CustomLocation/CustomLocation/help/New-AzCustomLocation.md b/src/CustomLocation/CustomLocation/help/New-AzCustomLocation.md index a18c5cb06d3d..74109d743ba6 100644 --- a/src/CustomLocation/CustomLocation/help/New-AzCustomLocation.md +++ b/src/CustomLocation/CustomLocation/help/New-AzCustomLocation.md @@ -8,7 +8,7 @@ schema: 2.0.0 # New-AzCustomLocation ## SYNOPSIS -Creates or updates a Custom Location in the specified Subscription and Resource Group +Create a Custom Location in the specified Subscription and Resource Group ## SYNTAX @@ -17,39 +17,43 @@ Creates or updates a Custom Location in the specified Subscription and Resource New-AzCustomLocation -Name -ResourceGroupName [-SubscriptionId ] -Location -ClusterExtensionId -HostResourceId -Namespace [-AuthenticationType ] [-AuthenticationValue ] [-DisplayName ] [-IdentityType ] [-Tag ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-AsJob] [-NoWait] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### CreateViaJsonFilePath ``` New-AzCustomLocation -Name -ResourceGroupName [-SubscriptionId ] - -JsonFilePath [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] - [] + -JsonFilePath [-DefaultProfile ] [-AsJob] [-NoWait] [-ProgressAction ] + [-WhatIf] [-Confirm] [] ``` ### CreateViaJsonString ``` New-AzCustomLocation -Name -ResourceGroupName [-SubscriptionId ] -JsonString - [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-AsJob] [-NoWait] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION -Creates or updates a Custom Location in the specified Subscription and Resource Group +Create a Custom Location in the specified Subscription and Resource Group ## EXAMPLES -### Example 1: Creates or updates a Custom Location in the specified Subscription and Resource Group +### Example 1: Creates or updates a Custom Location in the specified Subscription and Resource Group. ```powershell -New-AzCustomLocation -ResourceGroupName azps_test_group -Name azps_test_cluster -Location eastus -ClusterExtensionId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/azps_test_group/providers/Microsoft.Kubernetes/connectedClusters/azps_test_cluster/providers/Microsoft.KubernetesConfiguration/extensions/azps_test_extension" -HostResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/azps_test_group/providers/Microsoft.Kubernetes/connectedClusters/azps_test_cluster" -Namespace arc +$HostResourceId = (Get-AzConnectedKubernetes -ClusterName azps-connect -ResourceGroupName azps_test_cluster).Id +$ClusterExtensionId = (Get-AzKubernetesExtension -ClusterName azps-connect -ClusterType ConnectedClusters -ResourceGroupName azps_test_cluster -Name azps-extension).Id +New-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation -Location eastus -ClusterExtensionId $ClusterExtensionId -HostResourceId $HostResourceId -Namespace azps-namespace ``` ```output -Location Name Namespace --------- ---- ---- -eastus azps_test_cluster arc +Location Name Namespace ResourceGroupName +-------- ---- --------- ----------------- +eastus azps-customlocation azps-namespace azps_test_cluster ``` -Creates or updates a Custom Location in the specified Subscription and Resource Group +Creates or updates a Custom Location in the specified Subscription and Resource Group. ## PARAMETERS @@ -114,7 +118,8 @@ Accept wildcard characters: False ``` ### -DefaultProfile -The credentials, account, tenant, and subscription used for communication with Azure. +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml Type: System.Management.Automation.PSObject @@ -264,6 +269,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ResourceGroupName The name of the resource group. The name is case insensitive. @@ -346,12 +366,12 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS +### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity + ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.Api20210815.ICustomLocation +### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation ## NOTES -ALIASES - ## RELATED LINKS diff --git a/src/CustomLocation/CustomLocation/help/New-AzCustomLocationMatchExpressionsObject.md b/src/CustomLocation/CustomLocation/help/New-AzCustomLocationMatchExpressionsObject.md index f28612fca828..370cf93f46f1 100644 --- a/src/CustomLocation/CustomLocation/help/New-AzCustomLocationMatchExpressionsObject.md +++ b/src/CustomLocation/CustomLocation/help/New-AzCustomLocationMatchExpressionsObject.md @@ -14,7 +14,7 @@ Create an in-memory object for MatchExpressionsProperties. ``` New-AzCustomLocationMatchExpressionsObject [-Key ] [-Operator ] [-Value ] - [] + [-ProgressAction ] [] ``` ## DESCRIPTION @@ -22,18 +22,26 @@ Create an in-memory object for MatchExpressionsProperties. ## EXAMPLES -### EXAMPLE 1 -``` +### Example 1: Create an in-memory object for MatchExpressionsProperties. +```powershell New-AzCustomLocationMatchExpressionsObject -Key "key4" -Operator "In" -Value "value4" ``` +```output +Key Operator +--- -------- +key4 In +``` + +Create an in-memory object for MatchExpressionsProperties. + ## PARAMETERS ### -Key Key is the label key that the selector applies to. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -49,7 +57,7 @@ The Operator field represents a key's relationship to a set of values. Valid operators are In, NotIn, Exists and DoesNotExist. ```yaml -Type: String +Type: System.String Parameter Sets: (All) Aliases: @@ -60,11 +68,26 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -Value The label value. ```yaml -Type: String[] +Type: System.String[] Parameter Sets: (All) Aliases: @@ -83,9 +106,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.MatchExpressionsProperties + ## NOTES ## RELATED LINKS - -[https://learn.microsoft.com/powershell/module/Az.CustomLocation/new-azcustomlocationmatchexpressionsobject](https://learn.microsoft.com/powershell/module/Az.CustomLocation/new-azcustomlocationmatchexpressionsobject) - diff --git a/src/CustomLocation/CustomLocation/help/New-AzCustomLocationResourceSyncRule.md b/src/CustomLocation/CustomLocation/help/New-AzCustomLocationResourceSyncRule.md index e054980648c9..05c7f01a4405 100644 --- a/src/CustomLocation/CustomLocation/help/New-AzCustomLocationResourceSyncRule.md +++ b/src/CustomLocation/CustomLocation/help/New-AzCustomLocationResourceSyncRule.md @@ -17,22 +17,22 @@ Create a Resource Sync Rule in the parent Custom Location, Subscription Id and R New-AzCustomLocationResourceSyncRule -CustomLocationName -Name -ResourceGroupName [-SubscriptionId ] -Location [-Priority ] [-SelectorMatchExpression ] [-SelectorMatchLabel ] - [-Tag ] [-TargetResourceGroup ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] - [-Confirm] [] + [-Tag ] [-TargetResourceGroup ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### CreateViaJsonString ``` New-AzCustomLocationResourceSyncRule -CustomLocationName -Name -ResourceGroupName - [-SubscriptionId ] -JsonString [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] - [-Confirm] [] + [-SubscriptionId ] -JsonString [-DefaultProfile ] [-AsJob] [-NoWait] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### CreateViaJsonFilePath ``` New-AzCustomLocationResourceSyncRule -CustomLocationName -Name -ResourceGroupName - [-SubscriptionId ] -JsonFilePath [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] - [-Confirm] [] + [-SubscriptionId ] -JsonFilePath [-DefaultProfile ] [-AsJob] [-NoWait] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### CreateViaIdentityCustomlocationExpanded @@ -40,7 +40,8 @@ New-AzCustomLocationResourceSyncRule -CustomLocationName -Name New-AzCustomLocationResourceSyncRule -Name -CustomlocationInputObject -Location [-Priority ] [-SelectorMatchExpression ] [-SelectorMatchLabel ] [-Tag ] [-TargetResourceGroup ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-AsJob] [-NoWait] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### CreateViaIdentityExpanded @@ -48,7 +49,8 @@ New-AzCustomLocationResourceSyncRule -Name -CustomlocationInputObject < New-AzCustomLocationResourceSyncRule -InputObject -Location [-Priority ] [-SelectorMatchExpression ] [-SelectorMatchLabel ] [-Tag ] [-TargetResourceGroup ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-AsJob] [-NoWait] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ## DESCRIPTION @@ -56,35 +58,42 @@ Create a Resource Sync Rule in the parent Custom Location, Subscription Id and R ## EXAMPLES -### EXAMPLE 1 -``` +### Example 1: Create a Resource Sync Rule in the parent Custom Location, Subscription Id and Resource Group. +```powershell $MatchExpressions = New-AzCustomLocationMatchExpressionsObject -Key "key4" -Operator "In" -Value "value4" New-AzCustomLocationResourceSyncRule -Name azps-resourcesyncrule -ResourceGroupName azps_test_cluster -CustomLocationName azps-customlocation -Location eastus -Priority 999 -SelectorMatchExpression $MatchExpressions -SelectorMatchLabel @{"Key1"="Value1"} -TargetResourceGroup "/subscriptions/{subId}/resourceGroups/azps_test_cluster" ``` +```output +Location Name ResourceGroupName +-------- ---- ----------------- +eastus azps-resourcesyncrule azps_test_cluster +``` + +Create a Resource Sync Rule in the parent Custom Location, Subscription Id and Resource Group. + ## PARAMETERS ### -AsJob Run the command as a job ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -CustomlocationInputObject Identity Parameter -To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: CreateViaIdentityCustomlocationExpanded Aliases: @@ -99,7 +108,7 @@ Accept wildcard characters: False Custom Locations name. ```yaml -Type: String +Type: System.String Parameter Sets: CreateExpanded, CreateViaJsonString, CreateViaJsonFilePath Aliases: @@ -115,7 +124,7 @@ The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml -Type: PSObject +Type: System.Management.Automation.PSObject Parameter Sets: (All) Aliases: AzureRMContext, AzureCredential @@ -128,10 +137,9 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: CreateViaIdentityExpanded Aliases: @@ -146,7 +154,7 @@ Accept wildcard characters: False Path of Json file supplied to the Create operation ```yaml -Type: String +Type: System.String Parameter Sets: CreateViaJsonFilePath Aliases: @@ -161,7 +169,7 @@ Accept wildcard characters: False Json string supplied to the Create operation ```yaml -Type: String +Type: System.String Parameter Sets: CreateViaJsonString Aliases: @@ -176,7 +184,7 @@ Accept wildcard characters: False The geo-location where the resource lives ```yaml -Type: String +Type: System.String Parameter Sets: CreateExpanded, CreateViaIdentityCustomlocationExpanded, CreateViaIdentityExpanded Aliases: @@ -191,7 +199,7 @@ Accept wildcard characters: False Resource Sync Rule name. ```yaml -Type: String +Type: System.String Parameter Sets: CreateExpanded, CreateViaJsonString, CreateViaJsonFilePath, CreateViaIdentityCustomlocationExpanded Aliases: @@ -206,13 +214,13 @@ Accept wildcard characters: False Run the command asynchronously ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -221,13 +229,28 @@ Accept wildcard characters: False Priority represents a priority of the Resource Sync Rule ```yaml -Type: Int32 +Type: System.Int32 Parameter Sets: CreateExpanded, CreateViaIdentityCustomlocationExpanded, CreateViaIdentityExpanded Aliases: Required: False Position: Named -Default value: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -237,7 +260,7 @@ The name of the resource group. The name is case insensitive. ```yaml -Type: String +Type: System.String Parameter Sets: CreateExpanded, CreateViaJsonString, CreateViaJsonFilePath Aliases: @@ -253,10 +276,9 @@ MatchExpressions is a list of resource selector requirements. Valid operators include In, NotIn, Exists, and DoesNotExist. The values set must be non-empty in the case of In and NotIn. The values set must be empty in the case of Exists and DoesNotExist. -To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table. ```yaml -Type: IMatchExpressionsProperties[] +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IMatchExpressionsProperties[] Parameter Sets: CreateExpanded, CreateViaIdentityCustomlocationExpanded, CreateViaIdentityExpanded Aliases: @@ -272,7 +294,7 @@ MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is 'key', the operator is 'In', and the values array contains only 'value'. ```yaml -Type: Hashtable +Type: System.Collections.Hashtable Parameter Sets: CreateExpanded, CreateViaIdentityCustomlocationExpanded, CreateViaIdentityExpanded Aliases: @@ -287,13 +309,13 @@ Accept wildcard characters: False The ID of the target subscription. ```yaml -Type: String +Type: System.String Parameter Sets: CreateExpanded, CreateViaJsonString, CreateViaJsonFilePath Aliases: Required: False Position: Named -Default value: None +Default value: (Get-AzContext).Subscription.Id Accept pipeline input: False Accept wildcard characters: False ``` @@ -302,7 +324,7 @@ Accept wildcard characters: False Resource tags. ```yaml -Type: Hashtable +Type: System.Collections.Hashtable Parameter Sets: CreateExpanded, CreateViaIdentityCustomlocationExpanded, CreateViaIdentityExpanded Aliases: @@ -319,7 +341,7 @@ If this resource sync rule is one of the matching rules with highest priority, t The user creating this resource sync rule should have write permissions on the target resource group and this write permission will be validated when creating the resource sync rule. ```yaml -Type: String +Type: System.String Parameter Sets: CreateExpanded, CreateViaIdentityCustomlocationExpanded, CreateViaIdentityExpanded Aliases: @@ -334,7 +356,7 @@ Accept wildcard characters: False Prompts you for confirmation before running the cmdlet. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: cf @@ -350,7 +372,7 @@ Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: wi @@ -367,41 +389,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity + ## OUTPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IResourceSyncRule -## NOTES -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. -For information on hash tables, run Get-Help about_Hash_Tables. - -CUSTOMLOCATIONINPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. -INPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. - -SELECTORMATCHEXPRESSION \: MatchExpressions is a list of resource selector requirements. -Valid operators include In, NotIn, Exists, and DoesNotExist. -The values set must be non-empty in the case of In and NotIn. -The values set must be empty in the case of Exists and DoesNotExist. - \[Key \\]: Key is the label key that the selector applies to. - \[Operator \\]: The Operator field represents a key's relationship to a set of values. -Valid operators are In, NotIn, Exists and DoesNotExist. - \[Value \\>\]: The label value +## NOTES ## RELATED LINKS - -[https://learn.microsoft.com/powershell/module/az.customlocation/new-azcustomlocationresourcesyncrule](https://learn.microsoft.com/powershell/module/az.customlocation/new-azcustomlocationresourcesyncrule) - diff --git a/src/CustomLocation/CustomLocation/help/Remove-AzCustomLocation.md b/src/CustomLocation/CustomLocation/help/Remove-AzCustomLocation.md index 03fb057b3096..df9bdb9e6251 100644 --- a/src/CustomLocation/CustomLocation/help/Remove-AzCustomLocation.md +++ b/src/CustomLocation/CustomLocation/help/Remove-AzCustomLocation.md @@ -15,13 +15,14 @@ Deletes the Custom Location with the specified Resource Name, Resource Group, an ### Delete (Default) ``` Remove-AzCustomLocation -Name -ResourceGroupName [-SubscriptionId ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-AsJob] [-NoWait] [-PassThru] [-ProgressAction ] [-WhatIf] + [-Confirm] [] ``` ### DeleteViaIdentity ``` Remove-AzCustomLocation -InputObject [-DefaultProfile ] [-AsJob] [-NoWait] - [-PassThru] [-WhatIf] [-Confirm] [] + [-PassThru] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -31,14 +32,15 @@ Deletes the Custom Location with the specified Resource Name, Resource Group, an ### Example 1: Deletes the Custom Location. ```powershell -Remove-AzCustomLocation -ResourceGroupName azps_test_group -Name azps_test_cluster +Remove-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation ``` Deletes the Custom Location. ### Example 2: Deletes the Custom Location. ```powershell -Get-AzCustomLocation -ResourceGroupName azps_test_group -Name azps_test_cluster | Remove-AzCustomLocation +$obj = Get-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation +Remove-AzCustomLocation -InputObject $obj ``` Deletes the Custom Location. @@ -61,7 +63,8 @@ Accept wildcard characters: False ``` ### -DefaultProfile -The credentials, account, tenant, and subscription used for communication with Azure. +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml Type: System.Management.Automation.PSObject @@ -77,7 +80,6 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity @@ -136,6 +138,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ResourceGroupName The name of the resource group. The name is case insensitive. @@ -211,17 +228,4 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -INPUTOBJECT ``: Identity Parameter - - `[Id ]`: Resource identity path - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[ResourceName ]`: Custom Locations name. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/CustomLocation/CustomLocation/help/Remove-AzCustomLocationResourceSyncRule.md b/src/CustomLocation/CustomLocation/help/Remove-AzCustomLocationResourceSyncRule.md index f6e501a5ad07..82525ac53444 100644 --- a/src/CustomLocation/CustomLocation/help/Remove-AzCustomLocationResourceSyncRule.md +++ b/src/CustomLocation/CustomLocation/help/Remove-AzCustomLocationResourceSyncRule.md @@ -15,19 +15,21 @@ Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custo ### Delete (Default) ``` Remove-AzCustomLocationResourceSyncRule -CustomLocationName -Name -ResourceGroupName - [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] [] + [-SubscriptionId ] [-DefaultProfile ] [-PassThru] [-ProgressAction ] + [-WhatIf] [-Confirm] [] ``` ### DeleteViaIdentityCustomlocation ``` Remove-AzCustomLocationResourceSyncRule -Name -CustomlocationInputObject - [-DefaultProfile ] [-PassThru] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-PassThru] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### DeleteViaIdentity ``` Remove-AzCustomLocationResourceSyncRule -InputObject [-DefaultProfile ] - [-PassThru] [-WhatIf] [-Confirm] [] + [-PassThru] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -35,31 +37,36 @@ Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custo ## EXAMPLES -### EXAMPLE 1 -``` +### Example 1: Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id. +```powershell Remove-AzCustomLocationResourceSyncRule -CustomLocationName azps-customlocation -Name azps-resourcesyncrule -ResourceGroupName azps_test_cluster ``` -### EXAMPLE 2 -``` +Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id. + +### Example 2: Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id. +```powershell $obj = Get-AzCustomLocationResourceSyncRule -ResourceGroupName azps_test_cluster -CustomLocationName azps-customlocation -Name azps-resourcesyncrule Remove-AzCustomLocationResourceSyncRule -InputObject $obj ``` -### EXAMPLE 3 -``` +Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id. + +### Example 3: Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id. +```powershell $obj = Get-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation Remove-AzCustomLocationResourceSyncRule -CustomlocationInputObject $obj -Name azps-resourcesyncrule ``` +Deletes the Resource Sync Rule with the specified Resource Sync Rule Name, Custom Location Resource Name, Resource Group, and Subscription Id. + ## PARAMETERS ### -CustomlocationInputObject Identity Parameter -To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: DeleteViaIdentityCustomlocation Aliases: @@ -74,7 +81,7 @@ Accept wildcard characters: False Custom Locations name. ```yaml -Type: String +Type: System.String Parameter Sets: Delete Aliases: @@ -90,7 +97,7 @@ The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml -Type: PSObject +Type: System.Management.Automation.PSObject Parameter Sets: (All) Aliases: AzureRMContext, AzureCredential @@ -103,10 +110,9 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: DeleteViaIdentity Aliases: @@ -121,7 +127,7 @@ Accept wildcard characters: False Resource Sync Rule name. ```yaml -Type: String +Type: System.String Parameter Sets: Delete, DeleteViaIdentityCustomlocation Aliases: @@ -136,13 +142,28 @@ Accept wildcard characters: False Returns true when the command succeeds ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named -Default value: False +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -152,7 +173,7 @@ The name of the resource group. The name is case insensitive. ```yaml -Type: String +Type: System.String Parameter Sets: Delete Aliases: @@ -167,13 +188,13 @@ Accept wildcard characters: False The ID of the target subscription. ```yaml -Type: String +Type: System.String Parameter Sets: Delete Aliases: Required: False Position: Named -Default value: None +Default value: (Get-AzContext).Subscription.Id Accept pipeline input: False Accept wildcard characters: False ``` @@ -182,7 +203,7 @@ Accept wildcard characters: False Prompts you for confirmation before running the cmdlet. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: cf @@ -198,7 +219,7 @@ Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: wi @@ -215,32 +236,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity + ## OUTPUTS ### System.Boolean -## NOTES -COMPLEX PARAMETER PROPERTIES -To create the parameters described below, construct a hash table containing the appropriate properties. -For information on hash tables, run Get-Help about_Hash_Tables. - -CUSTOMLOCATIONINPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. - -INPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. +## NOTES ## RELATED LINKS - -[https://learn.microsoft.com/powershell/module/az.customlocation/remove-azcustomlocationresourcesyncrule](https://learn.microsoft.com/powershell/module/az.customlocation/remove-azcustomlocationresourcesyncrule) - diff --git a/src/CustomLocation/CustomLocation/help/Update-AzCustomLocation.md b/src/CustomLocation/CustomLocation/help/Update-AzCustomLocation.md index bdbfac1127f7..c4f5f639a499 100644 --- a/src/CustomLocation/CustomLocation/help/Update-AzCustomLocation.md +++ b/src/CustomLocation/CustomLocation/help/Update-AzCustomLocation.md @@ -17,19 +17,22 @@ Updates a Custom Location with the specified Resource Name in the specified Reso Update-AzCustomLocation -Name -ResourceGroupName [-SubscriptionId ] [-AuthenticationType ] [-AuthenticationValue ] [-ClusterExtensionId ] [-DisplayName ] [-HostResourceId ] [-IdentityType ] [-Namespace ] - [-Tag ] [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-Tag ] [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### UpdateViaJsonFilePath ``` Update-AzCustomLocation -Name -ResourceGroupName [-SubscriptionId ] - -JsonFilePath [-DefaultProfile ] [-WhatIf] [-Confirm] [] + -JsonFilePath [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### UpdateViaJsonString ``` Update-AzCustomLocation -Name -ResourceGroupName [-SubscriptionId ] - -JsonString [-DefaultProfile ] [-WhatIf] [-Confirm] [] + -JsonString [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### UpdateViaIdentityExpanded @@ -37,7 +40,7 @@ Update-AzCustomLocation -Name -ResourceGroupName [-Subscriptio Update-AzCustomLocation -InputObject [-AuthenticationType ] [-AuthenticationValue ] [-ClusterExtensionId ] [-DisplayName ] [-HostResourceId ] [-IdentityType ] [-Namespace ] [-Tag ] - [-DefaultProfile ] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -47,26 +50,29 @@ Updates a Custom Location with the specified Resource Name in the specified Reso ### Example 1: Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. ```powershell -Update-AzCustomLocation -ResourceGroupName azps_test_group -Name azps_test_cluster_1 -ClusterExtensionId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/azps_test_group/providers/Microsoft.Kubernetes/connectedClusters/azps_test_cluster/providers/Microsoft.KubernetesConfiguration/extensions/azps_test_extension" -HostResourceId "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/azps_test_group/providers/Microsoft.Kubernetes/connectedClusters/azps_test_cluster" -Namespace arc +$HostResourceId = (Get-AzConnectedKubernetes -ClusterName azps-connect -ResourceGroupName azps_test_cluster).Id +$ClusterExtensionId = (Get-AzKubernetesExtension -ClusterName azps-connect -ClusterType ConnectedClusters -ResourceGroupName azps_test_cluster -Name azps-extension).Id +Update-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation -ClusterExtensionId $ClusterExtensionId -HostResourceId $HostResourceId -Namespace azps-namespace -Tag @{"Key1"="Value1"} ``` ```output -Location Name Namespace --------- ---- ---- -eastus azps_test_cluster_1 arc +Location Name Namespace ResourceGroupName +-------- ---- --------- ----------------- +eastus azps-customlocation azps-namespace azps_test_cluster ``` Updates a Custom Location with the specified Resource Name in the specified Resource Group and Subscription. ### Example 2: Updates a Custom Location. ```powershell -Get-AzCustomLocation -ResourceGroupName azps_test_group -Name azps_test_cluster | Update-AzCustomLocation +$obj = Get-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation +Update-AzCustomLocation -InputObject $obj -Tag @{"Key1"="Value1"} ``` ```output -Location Name Namespace --------- ---- ---- -eastus azps_test_cluster_1 arc +Location Name Namespace ResourceGroupName +-------- ---- --------- ----------------- +eastus azps-customlocation azps-namespace azps_test_cluster ``` Updates a Custom Location. @@ -119,7 +125,8 @@ Accept wildcard characters: False ``` ### -DefaultProfile -The credentials, account, tenant, and subscription used for communication with Azure. +The DefaultProfile parameter is not functional. +Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml Type: System.Management.Automation.PSObject @@ -255,6 +262,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -ResourceGroupName The name of the resource group. The name is case insensitive. @@ -341,21 +363,8 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## OUTPUTS -### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.Api20210815.ICustomLocation +### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocation ## NOTES -ALIASES - -COMPLEX PARAMETER PROPERTIES - -To create the parameters described below, construct a hash table containing the appropriate properties. For information on hash tables, run Get-Help about_Hash_Tables. - - -INPUTOBJECT ``: Identity Parameter - - `[Id ]`: Resource identity path - - `[ResourceGroupName ]`: The name of the resource group. The name is case insensitive. - - `[ResourceName ]`: Custom Locations name. - - `[SubscriptionId ]`: The ID of the target subscription. - ## RELATED LINKS diff --git a/src/CustomLocation/CustomLocation/help/Update-AzCustomLocationResourceSyncRule.md b/src/CustomLocation/CustomLocation/help/Update-AzCustomLocationResourceSyncRule.md index 1e59bba78415..006556b1b9fc 100644 --- a/src/CustomLocation/CustomLocation/help/Update-AzCustomLocationResourceSyncRule.md +++ b/src/CustomLocation/CustomLocation/help/Update-AzCustomLocationResourceSyncRule.md @@ -17,21 +17,22 @@ Updates a Resource Sync Rule with the specified Resource Sync Rule name in the s Update-AzCustomLocationResourceSyncRule -CustomLocationName -Name -ResourceGroupName [-SubscriptionId ] [-Priority ] [-SelectorMatchExpression ] [-SelectorMatchLabel ] [-Tag ] [-TargetResourceGroup ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-AsJob] [-NoWait] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### UpdateViaJsonString ``` Update-AzCustomLocationResourceSyncRule -CustomLocationName -Name -ResourceGroupName - [-SubscriptionId ] -JsonString [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] - [-Confirm] [] + [-SubscriptionId ] -JsonString [-DefaultProfile ] [-AsJob] [-NoWait] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### UpdateViaJsonFilePath ``` Update-AzCustomLocationResourceSyncRule -CustomLocationName -Name -ResourceGroupName - [-SubscriptionId ] -JsonFilePath [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] - [-Confirm] [] + [-SubscriptionId ] -JsonFilePath [-DefaultProfile ] [-AsJob] [-NoWait] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ### UpdateViaIdentityCustomlocationExpanded @@ -39,15 +40,16 @@ Update-AzCustomLocationResourceSyncRule -CustomLocationName -Name -CustomlocationInputObject [-Priority ] [-SelectorMatchExpression ] [-SelectorMatchLabel ] [-Tag ] [-TargetResourceGroup ] - [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] [-Confirm] [] + [-DefaultProfile ] [-AsJob] [-NoWait] [-ProgressAction ] [-WhatIf] [-Confirm] + [] ``` ### UpdateViaIdentityExpanded ``` Update-AzCustomLocationResourceSyncRule -InputObject [-Priority ] [-SelectorMatchExpression ] [-SelectorMatchLabel ] - [-Tag ] [-TargetResourceGroup ] [-DefaultProfile ] [-AsJob] [-NoWait] [-WhatIf] - [-Confirm] [] + [-Tag ] [-TargetResourceGroup ] [-DefaultProfile ] [-AsJob] [-NoWait] + [-ProgressAction ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -55,49 +57,72 @@ Updates a Resource Sync Rule with the specified Resource Sync Rule name in the s ## EXAMPLES -### EXAMPLE 1 -``` +### Example 1: Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource Group, Subscription and Custom Location name. +```powershell $MatchExpressions = New-AzCustomLocationMatchExpressionsObject -Key "key4" -Operator "In" -Value "value4" Update-AzCustomLocationResourceSyncRule -Name azps-resourcesyncrule -ResourceGroupName azps_test_cluster -CustomLocationName azps-customlocation -Priority 999 -SelectorMatchExpression $MatchExpressions -SelectorMatchLabel @{"Key1"="Value1"} -TargetResourceGroup "/subscriptions/{subId}/resourceGroups/azps_test_cluster" -Tag @{"abc"="123"} ``` -### EXAMPLE 2 +```output +Location Name ResourceGroupName +-------- ---- ----------------- +eastus azps-resourcesyncrule azps_test_cluster ``` + +Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource Group, Subscription and Custom Location name. + +### Example 2: Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource Group, Subscription and Custom Location name. +```powershell $MatchExpressions = New-AzCustomLocationMatchExpressionsObject -Key "key4" -Operator "In" -Value "value4" $obj = Get-AzCustomLocationResourceSyncRule -ResourceGroupName azps_test_cluster -CustomLocationName azps-customlocation -Name azps-resourcesyncrule Update-AzCustomLocationResourceSyncRule -InputObject $obj -Priority 999 -SelectorMatchExpression $MatchExpressions -SelectorMatchLabel @{"Key1"="Value1"} -TargetResourceGroup "/subscriptions/{subId}/resourceGroups/azps_test_cluster" -Tag @{"abc"="123"} ``` -### EXAMPLE 3 +```output +Location Name ResourceGroupName +-------- ---- ----------------- +eastus azps-resourcesyncrule azps_test_cluster ``` + +Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource Group, Subscription and Custom Location name. + +### Example 3: Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource Group, Subscription and Custom Location name. +```powershell $MatchExpressions = New-AzCustomLocationMatchExpressionsObject -Key "key4" -Operator "In" -Value "value4" $obj = Get-AzCustomLocation -ResourceGroupName azps_test_cluster -Name azps-customlocation Update-AzCustomLocationResourceSyncRule -CustomlocationInputObject $obj -Name azps-resourcesyncrule -Priority 999 -SelectorMatchExpression $MatchExpressions -SelectorMatchLabel @{"Key1"="Value1"} -TargetResourceGroup "/subscriptions/{subId}/resourceGroups/azps_test_cluster" -Tag @{"abc"="123"} ``` +```output +Location Name ResourceGroupName +-------- ---- ----------------- +eastus azps-resourcesyncrule azps_test_cluster +``` + +Updates a Resource Sync Rule with the specified Resource Sync Rule name in the specified Resource Group, Subscription and Custom Location name. + ## PARAMETERS ### -AsJob Run the command as a job ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` ### -CustomlocationInputObject Identity Parameter -To construct, see NOTES section for CUSTOMLOCATIONINPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: UpdateViaIdentityCustomlocationExpanded Aliases: @@ -112,7 +137,7 @@ Accept wildcard characters: False Custom Locations name. ```yaml -Type: String +Type: System.String Parameter Sets: UpdateExpanded, UpdateViaJsonString, UpdateViaJsonFilePath Aliases: @@ -128,7 +153,7 @@ The DefaultProfile parameter is not functional. Use the SubscriptionId parameter when available if executing the cmdlet against a different subscription. ```yaml -Type: PSObject +Type: System.Management.Automation.PSObject Parameter Sets: (All) Aliases: AzureRMContext, AzureCredential @@ -141,10 +166,9 @@ Accept wildcard characters: False ### -InputObject Identity Parameter -To construct, see NOTES section for INPUTOBJECT properties and create a hash table. ```yaml -Type: ICustomLocationIdentity +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity Parameter Sets: UpdateViaIdentityExpanded Aliases: @@ -159,7 +183,7 @@ Accept wildcard characters: False Path of Json file supplied to the Update operation ```yaml -Type: String +Type: System.String Parameter Sets: UpdateViaJsonFilePath Aliases: @@ -174,7 +198,7 @@ Accept wildcard characters: False Json string supplied to the Update operation ```yaml -Type: String +Type: System.String Parameter Sets: UpdateViaJsonString Aliases: @@ -189,7 +213,7 @@ Accept wildcard characters: False Resource Sync Rule name. ```yaml -Type: String +Type: System.String Parameter Sets: UpdateExpanded, UpdateViaJsonString, UpdateViaJsonFilePath, UpdateViaIdentityCustomlocationExpanded Aliases: @@ -204,13 +228,13 @@ Accept wildcard characters: False Run the command asynchronously ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: Required: False Position: Named -Default value: False +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -219,13 +243,28 @@ Accept wildcard characters: False Priority represents a priority of the Resource Sync Rule ```yaml -Type: Int32 +Type: System.Int32 Parameter Sets: UpdateExpanded, UpdateViaIdentityCustomlocationExpanded, UpdateViaIdentityExpanded Aliases: Required: False Position: Named -Default value: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ProgressAction +{{ Fill ProgressAction Description }} + +```yaml +Type: System.Management.Automation.ActionPreference +Parameter Sets: (All) +Aliases: proga + +Required: False +Position: Named +Default value: None Accept pipeline input: False Accept wildcard characters: False ``` @@ -235,7 +274,7 @@ The name of the resource group. The name is case insensitive. ```yaml -Type: String +Type: System.String Parameter Sets: UpdateExpanded, UpdateViaJsonString, UpdateViaJsonFilePath Aliases: @@ -251,10 +290,9 @@ MatchExpressions is a list of resource selector requirements. Valid operators include In, NotIn, Exists, and DoesNotExist. The values set must be non-empty in the case of In and NotIn. The values set must be empty in the case of Exists and DoesNotExist. -To construct, see NOTES section for SELECTORMATCHEXPRESSION properties and create a hash table. ```yaml -Type: IMatchExpressionsProperties[] +Type: Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IMatchExpressionsProperties[] Parameter Sets: UpdateExpanded, UpdateViaIdentityCustomlocationExpanded, UpdateViaIdentityExpanded Aliases: @@ -270,7 +308,7 @@ MatchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels map is equivalent to an element of matchExpressions, whose key field is 'key', the operator is 'In', and the values array contains only 'value'. ```yaml -Type: Hashtable +Type: System.Collections.Hashtable Parameter Sets: UpdateExpanded, UpdateViaIdentityCustomlocationExpanded, UpdateViaIdentityExpanded Aliases: @@ -285,13 +323,13 @@ Accept wildcard characters: False The ID of the target subscription. ```yaml -Type: String +Type: System.String Parameter Sets: UpdateExpanded, UpdateViaJsonString, UpdateViaJsonFilePath Aliases: Required: False Position: Named -Default value: None +Default value: (Get-AzContext).Subscription.Id Accept pipeline input: False Accept wildcard characters: False ``` @@ -300,7 +338,7 @@ Accept wildcard characters: False Resource tags ```yaml -Type: Hashtable +Type: System.Collections.Hashtable Parameter Sets: UpdateExpanded, UpdateViaIdentityCustomlocationExpanded, UpdateViaIdentityExpanded Aliases: @@ -317,7 +355,7 @@ If this resource sync rule is one of the matching rules with highest priority, t The user creating this resource sync rule should have write permissions on the target resource group and this write permission will be validated when creating the resource sync rule. ```yaml -Type: String +Type: System.String Parameter Sets: UpdateExpanded, UpdateViaIdentityCustomlocationExpanded, UpdateViaIdentityExpanded Aliases: @@ -332,7 +370,7 @@ Accept wildcard characters: False Prompts you for confirmation before running the cmdlet. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: cf @@ -348,7 +386,7 @@ Shows what would happen if the cmdlet runs. The cmdlet is not run. ```yaml -Type: SwitchParameter +Type: System.Management.Automation.SwitchParameter Parameter Sets: (All) Aliases: wi @@ -365,41 +403,11 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable ## INPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.ICustomLocationIdentity + ## OUTPUTS ### Microsoft.Azure.PowerShell.Cmdlets.CustomLocation.Models.IResourceSyncRule -## NOTES -COMPLEX PARAMETER PROPERTIES -To create the parameters described below, construct a hash table containing the appropriate properties. -For information on hash tables, run Get-Help about_Hash_Tables. - -CUSTOMLOCATIONINPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. - -INPUTOBJECT \: Identity Parameter - \[ChildResourceName \\]: Resource Sync Rule name. - \[Id \\]: Resource identity path - \[ResourceGroupName \\]: The name of the resource group. -The name is case insensitive. - \[ResourceName \\]: Custom Locations name. - \[SubscriptionId \\]: The ID of the target subscription. - -SELECTORMATCHEXPRESSION \: MatchExpressions is a list of resource selector requirements. -Valid operators include In, NotIn, Exists, and DoesNotExist. -The values set must be non-empty in the case of In and NotIn. -The values set must be empty in the case of Exists and DoesNotExist. - \[Key \\]: Key is the label key that the selector applies to. - \[Operator \\]: The Operator field represents a key's relationship to a set of values. -Valid operators are In, NotIn, Exists and DoesNotExist. - \[Value \\>\]: The label value +## NOTES ## RELATED LINKS - -[https://learn.microsoft.com/powershell/module/az.customlocation/update-azcustomlocationresourcesyncrule](https://learn.microsoft.com/powershell/module/az.customlocation/update-azcustomlocationresourcesyncrule) -