public override void Execute() { base.Execute(); if (this.IsParameterBound(c => c.PrivateLinkResourceId)) { var resourceIdentifier = new ResourceIdentifier(this.PrivateLinkResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.ServiceName = resourceIdentifier.ResourceName; this.PrivateLinkResourceType = resourceIdentifier.ResourceType; this.Subscription = resourceIdentifier.Subscription; } else { this.Subscription = DefaultProfile.DefaultContext.Subscription.Id; this.PrivateLinkResourceType = DynamicParameters[privateEndpointTypeName].Value as string; } IPrivateLinkProvider provider = PrivateLinkProviderFactory.CreatePrivateLinkProvder(this, Subscription, PrivateLinkResourceType); if (provider == null) { throw new ArgumentException(string.Format(Properties.Resources.InvalidResourceId, this.PrivateLinkResourceId)); } if (this.IsParameterBound(c => c.Name)) { var plr = provider.GetPrivateLinkResource(ResourceGroupName, ServiceName, Name); WriteObject(plr); } else { var plrs = provider.ListPrivateLinkResource(ResourceGroupName, ServiceName); WriteObject(plrs, true); } }
public override void Execute() { base.Execute(); var resourceIdentifier = new ResourceIdentifier(this.PrivateLinkResourceId); string ResourceGroupName = resourceIdentifier.ResourceGroupName; string Name = resourceIdentifier.ResourceName; string ResourceType = resourceIdentifier.ResourceType; IPrivateLinkProvider provider = PrivateLinkProviderFactory.CreatePrivateLinkProvder(this, resourceIdentifier.Subscription, ResourceType); if (provider == null) { throw new ArgumentException(string.Format(Properties.Resources.InvalidResourceId, this.PrivateLinkResourceId)); } var plrs = provider.ListPrivateLinkResource(ResourceGroupName, Name); WriteObject(plrs, true); }
public override void Execute() { base.Execute(); if (this.IsParameterBound(c => c.PrivateLinkResourceId)) { var resourceIdentifier = new ResourceIdentifier(this.PrivateLinkResourceId); this.ResourceGroupName = resourceIdentifier.ResourceGroupName; this.ServiceName = resourceIdentifier.ResourceName; this.PrivateLinkResourceType = resourceIdentifier.ResourceType; this.Subscription = resourceIdentifier.Subscription; } else { this.Subscription = DefaultProfile.DefaultContext.Subscription.Id; this.PrivateLinkResourceType = DynamicParameters[privateEndpointTypeName].Value as string; } // First check resource type whether support private link feature, if support then check whether support private link resource feature. if (!GenericProvider.SupportsPrivateLinkFeature(this.PrivateLinkResourceType) || !ProviderConfiguration.GetProviderConfiguration(this.PrivateLinkResourceType).SupportListPrivateLinkResource) { throw new AzPSApplicationException(string.Format(Properties.Resources.UnsupportPrivateLinkResourceType, this.PrivateLinkResourceType)); } IPrivateLinkProvider provider = PrivateLinkProviderFactory.CreatePrivateLinkProvder(this, Subscription, PrivateLinkResourceType); if (provider == null) { throw new ArgumentException(string.Format(Properties.Resources.InvalidResourceId, this.PrivateLinkResourceId)); } if (this.IsParameterBound(c => c.Name)) { var plr = provider.GetPrivateLinkResource(ResourceGroupName, ServiceName, Name); WriteObject(plr); } else { var plrs = provider.ListPrivateLinkResource(ResourceGroupName, ServiceName); WriteObject(plrs, true); } }