Skip to content

Commit 511727c

Browse files
authored
[DataFactory]Added PublicNetworkAccess to Update_AzDataFactoryV2 Command (Azure#16087)
* [DataFactory]Added PublicNetworkAccess to Update_AzDataFactoryV2 Command * update * update * update * remove * update * update * update
1 parent b7de19a commit 511727c

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

src/DataFactory/DataFactoryV2/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Added PublicNetworkAccess to Update_AzDataFactoryV2 Command
2122
* Updated ADF .Net SDK version to 4.26.0
2223

2324
## Version 1.15.0

src/DataFactory/DataFactoryV2/DataFactories/UpdateAzureDataFactoryCommand.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
namespace Microsoft.Azure.Commands.DataFactoryV2
2525
{
26-
[Cmdlet("Update", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2", DefaultParameterSetName = ParameterSetNames.ByFactoryName, SupportsShouldProcess = true),OutputType(typeof(PSDataFactory))]
26+
[Cmdlet("Update", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "DataFactoryV2", DefaultParameterSetName = ParameterSetNames.ByFactoryName, SupportsShouldProcess = true), OutputType(typeof(PSDataFactory))]
2727
public class UpdateAzureDataFactoryCommand : DataFactoryBaseCmdlet
2828
{
2929
[Parameter(ParameterSetName = ParameterSetNames.ByFactoryName, Position = 0, Mandatory = true,
@@ -42,6 +42,11 @@ public class UpdateAzureDataFactoryCommand : DataFactoryBaseCmdlet
4242
#endregion
4343
public string IdentityType { get; set; }
4444

45+
#region Attributes
46+
[Parameter(Mandatory = false, HelpMessage = Constants.HelpPublicNetworkAccess)]
47+
#endregion
48+
public string PublicNetworkAccess { get; set; }
49+
4550
#region Attributes
4651
[Parameter(Mandatory = false, HelpMessage = Constants.HelpUserAssignedIdenty)]
4752
#endregion
@@ -121,9 +126,16 @@ public override void ExecuteCmdlet()
121126
encryption = new EncryptionConfiguration(this.EncryptionKeyName, this.EncryptionVaultBaseUrl, this.EncryptionKeyVersion, cmkIdentity);
122127
}
123128

129+
string publicNetworkAccess = Management.DataFactory.Models.PublicNetworkAccess.Enabled;
130+
if (!string.IsNullOrWhiteSpace(this.PublicNetworkAccess))
131+
{
132+
publicNetworkAccess = this.PublicNetworkAccess;
133+
}
134+
124135
var parameters = new UpdatePSDataFactoryParameters()
125136
{
126137
ResourceGroupName = ResourceGroupName,
138+
PublicNetworkAccess = publicNetworkAccess,
127139
DataFactoryName = Name,
128140
EncryptionConfiguration = encryption,
129141
FactoryIdentity = factoryIdentity,

src/DataFactory/DataFactoryV2/Models/DataFactoryClient.DataFactories.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public List<PSDataFactory> ListDataFactoriesBySubscription(DataFactoryFilterOpti
8686

8787
if (response != null)
8888
{
89-
dataFactories.AddRange(response.Select(df =>
89+
dataFactories.AddRange(response.Select(df =>
9090
{
9191
var parsedResourceId = new ResourceIdentifier(df.Id);
9292
var ResourceGroupName = parsedResourceId.ResourceGroupName;
@@ -115,7 +115,7 @@ public List<PSDataFactory> FilterPSDataFactories(DataFactoryFilterOptions filter
115115
}
116116
else
117117
{
118-
if(filterOptions.ResourceGroupName == null && filterOptions.DataFactoryName != null)
118+
if (filterOptions.ResourceGroupName == null && filterOptions.DataFactoryName != null)
119119
{
120120
throw new Exception("ResourceGroupName name can't be null if factory name is not due to parameter sets. Should never reach this point");
121121
}
@@ -173,7 +173,7 @@ public PSDataFactory CreatePSDataFactory(CreatePSDataFactoryParameters parameter
173173

174174
public PSDataFactory UpdatePSDataFactory(UpdatePSDataFactoryParameters parameters)
175175
{
176-
var updateParams = new FactoryUpdateParameters(parameters.Tags?.ToDictionary());
176+
var updateParams = new FactoryUpdateParameters(parameters.Tags?.ToDictionary(), publicNetworkAccess: parameters.PublicNetworkAccess);
177177
return new PSDataFactory(
178178
this.DataFactoryManagementClient.Factories.Update(
179179
parameters.ResourceGroupName,

src/DataFactory/DataFactoryV2/Models/UpdatePSDataFactoryParameters.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,7 @@ namespace Microsoft.Azure.Commands.DataFactoryV2
2020
public class UpdatePSDataFactoryParameters : DataFactoryParametersBase
2121
{
2222
public Hashtable Tags { get; set; }
23+
24+
public string PublicNetworkAccess { get; set; }
2325
}
2426
}

src/DataFactory/DataFactoryV2/help/Update-AzDataFactoryV2.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,20 @@ Accept pipeline input: False
157157
Accept wildcard characters: False
158158
```
159159
160+
### -PublicNetworkAccess
161+
Whether or not public network access is allowed for the data factory. Options are 'Enabled' or 'Disabled'
162+
163+
```yaml
164+
Type: System.String
165+
Parameter Sets: (All)
166+
Aliases:
167+
Required: False
168+
Position: Named
169+
Default value: Enabled
170+
Accept pipeline input: False
171+
Accept wildcard characters: False
172+
```
173+
160174
### -InputObject
161175
The data factory object.
162176

0 commit comments

Comments
 (0)