@@ -24,30 +24,30 @@ public class PSApplicationInsightsComponent
24
24
{
25
25
public PSApplicationInsightsComponent ( ApplicationInsightsComponent component )
26
26
{
27
- this . ResourceGroupName = ParseResourceGroupFromId ( component . Id ) ;
28
- this . Name = component . Name ;
29
- this . Id = component . Id ;
30
- this . Location = component . Location ;
31
- this . Tags = component . Tag . Keys . ToDictionary ( x => x , x => component . Tag [ x ] ) ;
32
- this . Kind = component . Kind ;
33
- this . Type = component . Type ;
34
- this . AppId = component . AppId ;
35
- this . ApplicationId = component . ApplicationId ;
36
- this . ApplicationType = component . ApplicationType ;
37
- this . CreationDate = component . CreationDate ;
38
- this . FlowType = component . FlowType ;
39
- this . HockeyAppId = component . HockeyAppId ;
40
- this . HockeyAppToken = component . HockeyAppToken ;
41
- this . InstrumentationKey = component . InstrumentationKey ;
42
- this . ProvisioningState = component . ProvisioningState ;
43
- this . RequestSource = component . RequestSource ;
44
- this . SamplingPercentage = component . SamplingPercentage ;
45
- this . TenantId = component . TenantId ;
46
- this . PublicNetworkAccessForIngestion = component . PublicNetworkAccessForIngestion ;
47
- this . PublicNetworkAccessForQuery = component . PublicNetworkAccessForQuery ;
48
- this . PrivateLinkScopedResources = component . PrivateLinkScopedResource . ToList ( ) ;
49
- this . RetentionInDays = component . RetentionInDay ;
50
- this . ConnectionString = component . ConnectionString ;
27
+ this . ResourceGroupName = ParseResourceGroupFromId ( component ? . Id ) ;
28
+ this . Name = component ? . Name ;
29
+ this . Id = component ? . Id ;
30
+ this . Location = component ? . Location ;
31
+ this . Tags = component ? . Tag ? . Keys ? . ToDictionary ( x => x , x => component . Tag [ x ] ) ;
32
+ this . Kind = component ? . Kind ;
33
+ this . Type = component ? . Type ;
34
+ this . AppId = component ? . AppId ;
35
+ this . ApplicationId = component ? . ApplicationId ;
36
+ this . ApplicationType = component ? . ApplicationType ;
37
+ this . CreationDate = component ? . CreationDate ;
38
+ this . FlowType = component ? . FlowType ;
39
+ this . HockeyAppId = component ? . HockeyAppId ;
40
+ this . HockeyAppToken = component ? . HockeyAppToken ;
41
+ this . InstrumentationKey = component ? . InstrumentationKey ;
42
+ this . ProvisioningState = component ? . ProvisioningState ;
43
+ this . RequestSource = component ? . RequestSource ;
44
+ this . SamplingPercentage = component ? . SamplingPercentage ;
45
+ this . TenantId = component ? . TenantId ;
46
+ this . PublicNetworkAccessForIngestion = component ? . PublicNetworkAccessForIngestion ;
47
+ this . PublicNetworkAccessForQuery = component ? . PublicNetworkAccessForQuery ;
48
+ this . PrivateLinkScopedResources = component ? . PrivateLinkScopedResource ? . ToList ( ) ;
49
+ this . RetentionInDays = component ? . RetentionInDay ;
50
+ this . ConnectionString = component ? . ConnectionString ;
51
51
}
52
52
53
53
public string Id { get ; set ; }
@@ -145,7 +145,7 @@ public PSApplicationInsightsComponentWithPricingPlan(ApplicationInsightsComponen
145
145
ApplicationInsightsComponentQuotaStatus status )
146
146
: base ( component )
147
147
{
148
- if ( billing . CurrentBillingFeature . Any ( f => f . Contains ( "Enterprise" ) ) )
148
+ if ( billing != null && billing . CurrentBillingFeature != null && billing . CurrentBillingFeature . Any ( f => f . Contains ( "Enterprise" ) ) )
149
149
{
150
150
this . PricingPlan = "Application Insights Enterprise" ;
151
151
}
@@ -154,11 +154,13 @@ public PSApplicationInsightsComponentWithPricingPlan(ApplicationInsightsComponen
154
154
this . PricingPlan = billing . CurrentBillingFeature . FirstOrDefault ( ) ;
155
155
}
156
156
157
- this . Cap = billing . DataVolumeCap . Cap ;
158
- this . ResetTime = billing . DataVolumeCap . ResetTime ;
159
- this . StopSendNotificationWhenHitCap = billing . DataVolumeCap . StopSendNotificationWhenHitCap . Value ;
160
- this . CapExpirationTime = status . ExpirationTime ;
161
- this . IsCapped = status . ShouldBeThrottled != null ? status . ShouldBeThrottled . Value : false ;
157
+ this . Cap = billing ? . DataVolumeCap ? . Cap ;
158
+ this . ResetTime = billing ? . DataVolumeCap ? . ResetTime ;
159
+ if ( billing != null && billing . DataVolumeCap != null && billing . DataVolumeCap . StopSendNotificationWhenHitCap != null ) {
160
+ this . StopSendNotificationWhenHitCap = billing . DataVolumeCap . StopSendNotificationWhenHitCap . Value ;
161
+ }
162
+ this . CapExpirationTime = status ? . ExpirationTime ;
163
+ this . IsCapped = status ? . ShouldBeThrottled != null ? status . ShouldBeThrottled . Value : false ;
162
164
}
163
165
}
164
166
}
0 commit comments