Skip to content

Commit dc0b6c2

Browse files
change ResourceId to string type
1 parent 46e8dc9 commit dc0b6c2

22 files changed

+95
-84
lines changed

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/GetApplicationInsights.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public class GetApplicationInsightsCommand : ApplicationInsightsBaseCmdlet
4949
ParameterSetName = ResourceIdParameterSet,
5050
ValueFromPipelineByPropertyName = true,
5151
HelpMessage = "Application Insights Component Resource Id.")]
52-
[ValidateNotNull]
53-
public ResourceIdentifier ResourceId { get; set; }
52+
[ValidateNotNullOrEmpty]
53+
public string ResourceId { get; set; }
5454

5555
[Parameter(
5656
Mandatory = false,
@@ -67,10 +67,11 @@ public override void ExecuteCmdlet()
6767
{
6868
base.ExecuteCmdlet();
6969

70-
if (this.ResourceId != null)
70+
if (!string.IsNullOrEmpty(this.ResourceId))
7171
{
72-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
73-
this.Name = this.ResourceId.ResourceName;
72+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
73+
this.ResourceGroupName = identifier.ResourceGroupName;
74+
this.Name = identifier.ResourceName;
7475
}
7576

7677
if (string.IsNullOrEmpty(this.ResourceGroupName))

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/GetApplicationInsightsApiKey.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class GetApplicationInsightsApiKeyCommand : ApplicationInsightsBaseCmdlet
3636
ParameterSetName = ResourceIdParameterSet,
3737
ValueFromPipelineByPropertyName = true,
3838
HelpMessage = "Application Insights Component Resource Id.")]
39-
[ValidateNotNull]
40-
public ResourceIdentifier ResourceId { get; set; }
39+
[ValidateNotNullOrEmpty]
40+
public string ResourceId { get; set; }
4141

4242
[Parameter(
4343
Position = 0,
@@ -73,10 +73,11 @@ public override void ExecuteCmdlet()
7373
this.Name = this.ApplicationInsightsComponent.Name;
7474
}
7575

76-
if (this.ResourceId != null)
76+
if (!string.IsNullOrEmpty(this.ResourceId))
7777
{
78-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
79-
this.Name = this.ResourceId.ResourceName;
78+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
79+
this.ResourceGroupName = identifier.ResourceGroupName;
80+
this.Name = identifier.ResourceName;
8081
}
8182

8283
if (string.IsNullOrEmpty(this.ApiKeyId))

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/GetApplicationInsightsContinuousExport.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public class GetApplicationInsightsContinuousExportCommand : ApplicationInsights
3636
ParameterSetName = ResourceIdParameterSet,
3737
ValueFromPipelineByPropertyName = true,
3838
HelpMessage = "Application Insights Component Resource Id.")]
39-
[ValidateNotNull]
40-
public ResourceIdentifier ResourceId { get; set; }
39+
[ValidateNotNullOrEmpty]
40+
public string ResourceId { get; set; }
4141

4242
[Parameter(
4343
Position = 0,
@@ -73,10 +73,11 @@ public override void ExecuteCmdlet()
7373
this.Name = this.ApplicationInsightsComponent.Name;
7474
}
7575

76-
if (this.ResourceId != null)
76+
if (!string.IsNullOrEmpty(this.ResourceId))
7777
{
78-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
79-
this.Name = this.ResourceId.ResourceName;
78+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
79+
this.ResourceGroupName = identifier.ResourceGroupName;
80+
this.Name = identifier.ResourceName;
8081
}
8182

8283
if (string.IsNullOrEmpty(this.ExportId))

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/NewApplicationInsightsApiKey.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class NewAzureApplicationInsightsApiKeyCommand : ApplicationInsightsBaseC
3838
ParameterSetName = ResourceIdParameterSet,
3939
ValueFromPipelineByPropertyName = true,
4040
HelpMessage = "Application Insights Component Resource Id.")]
41-
[ValidateNotNull]
42-
public ResourceIdentifier ResourceId { get; set; }
41+
[ValidateNotNullOrEmpty]
42+
public string ResourceId { get; set; }
4343

4444
[Parameter(
4545
Position = 0,
@@ -85,10 +85,11 @@ public override void ExecuteCmdlet()
8585
this.Name = this.ApplicationInsightsComponent.Name;
8686
}
8787

88-
if (this.ResourceId != null)
88+
if (!string.IsNullOrEmpty(this.ResourceId))
8989
{
90-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
91-
this.Name = this.ResourceId.ResourceName;
90+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
91+
this.ResourceGroupName = identifier.ResourceGroupName;
92+
this.Name = identifier.ResourceName;
9293
}
9394

9495
APIKeyRequest apiKeyRequest = new APIKeyRequest();

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/NewApplicationInsightsContinuousExport.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class NewAzureApplicationInsightsContinuousExportCommand : ApplicationIns
3838
ParameterSetName = ResourceIdParameterSet,
3939
ValueFromPipelineByPropertyName = true,
4040
HelpMessage = "Application Insights Component Resource Id.")]
41-
[ValidateNotNull]
42-
public ResourceIdentifier ResourceId { get; set; }
41+
[ValidateNotNullOrEmpty]
42+
public string ResourceId { get; set; }
4343

4444
[Parameter(
4545
Position = 0,
@@ -102,10 +102,11 @@ public override void ExecuteCmdlet()
102102
this.Name = this.ApplicationInsightsComponent.Name;
103103
}
104104

105-
if (this.ResourceId != null)
105+
if (!string.IsNullOrEmpty(this.ResourceId))
106106
{
107-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
108-
this.Name = this.ResourceId.ResourceName;
107+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
108+
this.ResourceGroupName = identifier.ResourceGroupName;
109+
this.Name = identifier.ResourceName;
109110
}
110111

111112
ApplicationInsightsComponentExportRequest exportRequest = new ApplicationInsightsComponentExportRequest();

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/RemoveApplicationInsights.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class RemoveApplicationInsightsComponent : ApplicationInsightsBaseCmdlet
3737
ParameterSetName = ResourceIdParameterSet,
3838
ValueFromPipelineByPropertyName = true,
3939
HelpMessage = "Application Insights Component Resource Id.")]
40-
[ValidateNotNull]
41-
public ResourceIdentifier ResourceId { get; set; }
40+
[ValidateNotNullOrEmpty]
41+
public string ResourceId { get; set; }
4242

4343
[Parameter(
4444
Position = 0,
@@ -72,10 +72,11 @@ public override void ExecuteCmdlet()
7272
this.Name = this.ApplicationInsightsComponent.Name;
7373
}
7474

75-
if (this.ResourceId != null)
75+
if (!string.IsNullOrEmpty(this.ResourceId))
7676
{
77-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
78-
this.Name = this.ResourceId.ResourceName;
77+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
78+
this.ResourceGroupName = identifier.ResourceGroupName;
79+
this.Name = identifier.ResourceName;
7980
}
8081

8182
if (ShouldProcess(this.Name, "Remove Application Insights Component"))

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/RemoveApplicationInsightsApiKey.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class RemoveApplicationComponentInsightsApiKey : ApplicationInsightsBaseC
3737
ParameterSetName = ResourceIdParameterSet,
3838
ValueFromPipelineByPropertyName = true,
3939
HelpMessage = "Application Insights Component Resource Id.")]
40-
[ValidateNotNull]
41-
public ResourceIdentifier ResourceId { get; set; }
40+
[ValidateNotNullOrEmpty]
41+
public string ResourceId { get; set; }
4242

4343
[Parameter(
4444
Position = 0,
@@ -80,10 +80,11 @@ public override void ExecuteCmdlet()
8080
this.Name = this.ApplicationInsightsComponent.Name;
8181
}
8282

83-
if (this.ResourceId != null)
83+
if (!string.IsNullOrEmpty(this.ResourceId))
8484
{
85-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
86-
this.Name = this.ResourceId.ResourceName;
85+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
86+
this.ResourceGroupName = identifier.ResourceGroupName;
87+
this.Name = identifier.ResourceName;
8788
}
8889

8990
if (ShouldProcess(this.Name, "Remove Application Insights API key"))

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/RemoveApplicationInsightsContinuousExport.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class RemoveApplicationInsightsComponentContinuousExport : ApplicationIns
3737
ParameterSetName = ResourceIdParameterSet,
3838
ValueFromPipelineByPropertyName = true,
3939
HelpMessage = "Application Insights Component Resource Id.")]
40-
[ValidateNotNull]
41-
public ResourceIdentifier ResourceId { get; set; }
40+
[ValidateNotNullOrEmpty]
41+
public string ResourceId { get; set; }
4242

4343
[Parameter(
4444
Position = 0,
@@ -79,10 +79,11 @@ public override void ExecuteCmdlet()
7979
this.Name = this.ApplicationInsightsComponent.Name;
8080
}
8181

82-
if (this.ResourceId != null)
82+
if (!string.IsNullOrEmpty(this.ResourceId))
8383
{
84-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
85-
this.Name = this.ResourceId.ResourceName;
84+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
85+
this.ResourceGroupName = identifier.ResourceGroupName;
86+
this.Name = identifier.ResourceName;
8687
}
8788

8889
if (ShouldProcess(this.Name, "Remove Application Insights Continuous Export"))

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/SetApplicationInsightsContinuousExport.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class SetApplicationInsightsContinuousExportCommand : ApplicationInsights
3737
ParameterSetName = ResourceIdParameterSet,
3838
ValueFromPipelineByPropertyName = true,
3939
HelpMessage = "Application Insights Component Resource Id.")]
40-
[ValidateNotNull]
41-
public ResourceIdentifier ResourceId { get; set; }
40+
[ValidateNotNullOrEmpty]
41+
public string ResourceId { get; set; }
4242

4343
[Parameter(
4444
Position = 0,
@@ -113,10 +113,11 @@ public override void ExecuteCmdlet()
113113
this.Name = this.ApplicationInsightsComponent.Name;
114114
}
115115

116-
if (this.ResourceId != null)
116+
if (!string.IsNullOrEmpty(this.ResourceId))
117117
{
118-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
119-
this.Name = this.ResourceId.ResourceName;
118+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
119+
this.ResourceGroupName = identifier.ResourceGroupName;
120+
this.Name = identifier.ResourceName;
120121
}
121122

122123
ApplicationInsightsComponentExportRequest exportRequest = new ApplicationInsightsComponentExportRequest();

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/SetApplicationInsightsDailyCap.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class SetApplicationInsightsDailyCapCommand : ApplicationInsightsBaseCmdl
3737
ParameterSetName = ResourceIdParameterSet,
3838
ValueFromPipelineByPropertyName = true,
3939
HelpMessage = "Application Insights Component Resource Id.")]
40-
[ValidateNotNull]
41-
public ResourceIdentifier ResourceId { get; set; }
40+
[ValidateNotNullOrEmpty]
41+
public string ResourceId { get; set; }
4242

4343
[Parameter(
4444
Position = 0,
@@ -77,10 +77,11 @@ public override void ExecuteCmdlet()
7777
this.Name = this.ApplicationInsightsComponent.Name;
7878
}
7979

80-
if (this.ResourceId != null)
80+
if (!string.IsNullOrEmpty(this.ResourceId))
8181
{
82-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
83-
this.Name = this.ResourceId.ResourceName;
82+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
83+
this.ResourceGroupName = identifier.ResourceGroupName;
84+
this.Name = identifier.ResourceName;
8485
}
8586

8687
ApplicationInsightsComponentBillingFeatures features =

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/ApplicationInsights/SetApplicationInsightsPricingPlan.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class SetApplicationInsightsPricingPlanCommand : ApplicationInsightsBaseC
3737
ParameterSetName = ResourceIdParameterSet,
3838
ValueFromPipelineByPropertyName = true,
3939
HelpMessage = "Application Insights Component Resource Id.")]
40-
[ValidateNotNull]
41-
public ResourceIdentifier ResourceId { get; set; }
40+
[ValidateNotNullOrEmpty]
41+
public string ResourceId { get; set; }
4242

4343
[Parameter(
4444
Position = 0,
@@ -87,10 +87,11 @@ public override void ExecuteCmdlet()
8787
this.Name = this.ApplicationInsightsComponent.Name;
8888
}
8989

90-
if (this.ResourceId != null)
90+
if (!string.IsNullOrEmpty(this.ResourceId))
9191
{
92-
this.ResourceGroupName = this.ResourceId.ResourceGroupName;
93-
this.Name = this.ResourceId.ResourceName;
92+
ResourceIdentifier identifier = new ResourceIdentifier(this.ResourceId);
93+
this.ResourceGroupName = identifier.ResourceGroupName;
94+
this.Name = identifier.ResourceName;
9495
}
9596

9697
ApplicationInsightsComponentBillingFeatures features =

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/help/Get-AzureRmApplicationInsights.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Get-AzureRmApplicationInsights [-ResourceGroupName] <String> [-Name] <String> [-
2626

2727
### ResourceIdParameterSet
2828
```
29-
Get-AzureRmApplicationInsights [-ResourceId] <ResourceIdentifier> [-Full]
30-
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
29+
Get-AzureRmApplicationInsights [-ResourceId] <String> [-Full] [-DefaultProfile <IAzureContextContainer>]
30+
[<CommonParameters>]
3131
```
3232

3333
## DESCRIPTION
@@ -172,7 +172,7 @@ Accept wildcard characters: False
172172
Application Insights Component Resource Id.
173173
174174
```yaml
175-
Type: ResourceIdentifier
175+
Type: String
176176
Parameter Sets: ResourceIdParameterSet
177177
Aliases:
178178

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/help/Get-AzureRmApplicationInsightsApiKey.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Get-AzureRmApplicationInsightsApiKey [-ApplicationInsightsComponent] <PSApplicat
2626

2727
### ResourceIdParameterSet
2828
```
29-
Get-AzureRmApplicationInsightsApiKey [-ResourceId] <ResourceIdentifier> [[-ApiKeyId] <String>]
29+
Get-AzureRmApplicationInsightsApiKey [-ResourceId] <String> [[-ApiKeyId] <String>]
3030
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
3131
```
3232

@@ -143,7 +143,7 @@ Accept wildcard characters: False
143143
Application Insights Component Resource Id.
144144
145145
```yaml
146-
Type: ResourceIdentifier
146+
Type: String
147147
Parameter Sets: ResourceIdParameterSet
148148
Aliases:
149149

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/help/Get-AzureRmApplicationInsightsContinuousExport.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Get-AzureRmApplicationInsightsContinuousExport [-ApplicationInsightsComponent] <
2626

2727
### ResourceIdParameterSet
2828
```
29-
Get-AzureRmApplicationInsightsContinuousExport [-ResourceId] <ResourceIdentifier> [[-ExportId] <String>]
29+
Get-AzureRmApplicationInsightsContinuousExport [-ResourceId] <String> [[-ExportId] <String>]
3030
[-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]
3131
```
3232

@@ -145,7 +145,7 @@ Accept wildcard characters: False
145145
Application Insights Component Resource Id.
146146
147147
```yaml
148-
Type: ResourceIdentifier
148+
Type: String
149149
Parameter Sets: ResourceIdParameterSet
150150
Aliases:
151151

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/help/New-AzureRmApplicationInsightsApiKey.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ New-AzureRmApplicationInsightsApiKey [-ApplicationInsightsComponent] <PSApplicat
2727

2828
### ResourceIdParameterSet
2929
```
30-
New-AzureRmApplicationInsightsApiKey [-ResourceId] <ResourceIdentifier> [-Permissions] <String[]>
31-
[-Description] <String> [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
30+
New-AzureRmApplicationInsightsApiKey [-ResourceId] <String> [-Permissions] <String[]> [-Description] <String>
31+
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3232
```
3333

3434
## DESCRIPTION
@@ -163,7 +163,7 @@ Accept wildcard characters: False
163163
Application Insights Component Resource Id.
164164
165165
```yaml
166-
Type: ResourceIdentifier
166+
Type: String
167167
Parameter Sets: ResourceIdParameterSet
168168
Aliases:
169169

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/help/New-AzureRmApplicationInsightsContinuousExport.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ New-AzureRmApplicationInsightsContinuousExport [-ApplicationInsightsComponent] <
2828

2929
### ResourceIdParameterSet
3030
```
31-
New-AzureRmApplicationInsightsContinuousExport [-ResourceId] <ResourceIdentifier> -DocumentType <String[]>
31+
New-AzureRmApplicationInsightsContinuousExport [-ResourceId] <String> -DocumentType <String[]>
3232
-StorageAccountId <String> -StorageLocation <String> -StorageSASUri <String>
3333
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
3434
```
@@ -157,7 +157,7 @@ Accept wildcard characters: False
157157
Application Insights Component Resource Id.
158158
159159
```yaml
160-
Type: ResourceIdentifier
160+
Type: String
161161
Parameter Sets: ResourceIdParameterSet
162162
Aliases:
163163

src/ResourceManager/ApplicationInsights/Commands.ApplicationInsights/help/Remove-AzureRmApplicationInsights.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ Remove-AzureRmApplicationInsights [-ApplicationInsightsComponent] <PSApplication
2626

2727
### ResourceIdParameterSet
2828
```
29-
Remove-AzureRmApplicationInsights [-ResourceId] <ResourceIdentifier> [-PassThru]
30-
[-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
29+
Remove-AzureRmApplicationInsights [-ResourceId] <String> [-PassThru] [-DefaultProfile <IAzureContextContainer>]
30+
[-WhatIf] [-Confirm] [<CommonParameters>]
3131
```
3232

3333
## DESCRIPTION
@@ -139,7 +139,7 @@ Accept wildcard characters: False
139139
Application Insights Component Resource Id.
140140
141141
```yaml
142-
Type: ResourceIdentifier
142+
Type: String
143143
Parameter Sets: ResourceIdParameterSet
144144
Aliases:
145145

0 commit comments

Comments
 (0)