Skip to content

Commit

Permalink
CodeGen from PR 17553 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Fix update PublicNetworkAccess not work in Factory Update API (Azure#17553)

* Fix update PublicNetworkAccess not work in Factory Update API

* fix an issue

* update
  • Loading branch information
SDKAuto committed Feb 7, 2022
1 parent 58c802a commit 418f022
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.11 (Unreleased)
## 1.0.0-beta.1 (2022-02-07)

- Azure Resource Manager DataFactory client library for Java. This package contains Microsoft Azure SDK for DataFactory Management SDK. The Azure Data Factory V2 management API provides a RESTful set of web services that interact with Azure Data Factory V2 services. Package tag package-2018-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Features Added

Expand Down
22 changes: 11 additions & 11 deletions sdk/datafactory/azure-resourcemanager-datafactory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-datafactory</artifactId>
<version>1.0.0-beta.10</version>
<version>1.0.0-beta.11</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -78,15 +78,15 @@ See [API design][design] for general introduction on design and key concepts on
// storage account
StorageAccount storageAccount = storageManager.storageAccounts().define(STORAGE_ACCOUNT)
.withRegion(REGION)
.withExistingResourceGroup(RESOURCE_GROUP)
.withExistingResourceGroup(resourceGroup)
.create();
final String storageAccountKey = storageAccount.getKeys().iterator().next().value();
final String connectionString = getStorageConnectionString(STORAGE_ACCOUNT, storageAccountKey, storageManager.environment());

// container
final String containerName = "adf";
storageManager.blobContainers().defineContainer(containerName)
.withExistingBlobService(RESOURCE_GROUP, STORAGE_ACCOUNT)
.withExistingStorageAccount(resourceGroup, STORAGE_ACCOUNT)
.withPublicAccess(PublicAccess.NONE)
.create();

Expand All @@ -99,9 +99,9 @@ BlobClient blobClient = new BlobClientBuilder()
blobClient.upload(BinaryData.fromString("data"));

// data factory
manager.factories().define(DATA_FACTORY)
Factory dataFactory = manager.factories().define(DATA_FACTORY)
.withRegion(REGION)
.withExistingResourceGroup(RESOURCE_GROUP)
.withExistingResourceGroup(resourceGroup)
.create();

// linked service
Expand All @@ -111,15 +111,15 @@ connectionStringProperty.put("value", connectionString);

final String linkedServiceName = "LinkedService";
manager.linkedServices().define(linkedServiceName)
.withExistingFactory(RESOURCE_GROUP, DATA_FACTORY)
.withExistingFactory(resourceGroup, DATA_FACTORY)
.withProperties(new AzureStorageLinkedService()
.withConnectionString(connectionStringProperty))
.create();

// input dataset
final String inputDatasetName = "InputDataset";
manager.datasets().define(inputDatasetName)
.withExistingFactory(RESOURCE_GROUP, DATA_FACTORY)
.withExistingFactory(resourceGroup, DATA_FACTORY)
.withProperties(new AzureBlobDataset()
.withLinkedServiceName(new LinkedServiceReference().withReferenceName(linkedServiceName))
.withFolderPath(containerName)
Expand All @@ -130,7 +130,7 @@ manager.datasets().define(inputDatasetName)
// output dataset
final String outputDatasetName = "OutputDataset";
manager.datasets().define(outputDatasetName)
.withExistingFactory(RESOURCE_GROUP, DATA_FACTORY)
.withExistingFactory(resourceGroup, DATA_FACTORY)
.withProperties(new AzureBlobDataset()
.withLinkedServiceName(new LinkedServiceReference().withReferenceName(linkedServiceName))
.withFolderPath(containerName)
Expand All @@ -140,7 +140,7 @@ manager.datasets().define(outputDatasetName)

// pipeline
PipelineResource pipeline = manager.pipelines().define("CopyBlobPipeline")
.withExistingFactory(RESOURCE_GROUP, DATA_FACTORY)
.withExistingFactory(resourceGroup, DATA_FACTORY)
.withActivities(Collections.singletonList(new CopyActivity()
.withName("CopyBlob")
.withSource(new BlobSource())
Expand All @@ -153,11 +153,11 @@ PipelineResource pipeline = manager.pipelines().define("CopyBlobPipeline")
CreateRunResponse createRun = pipeline.createRun();

// wait for completion
PipelineRun pipelineRun = manager.pipelineRuns().get(RESOURCE_GROUP, DATA_FACTORY, createRun.runId());
PipelineRun pipelineRun = manager.pipelineRuns().get(resourceGroup, DATA_FACTORY, createRun.runId());
String runStatus = pipelineRun.status();
while ("InProgress".equals(runStatus)) {
sleepIfRunningAgainstService(10 * 1000); // wait 10 seconds
pipelineRun = manager.pipelineRuns().get(RESOURCE_GROUP, DATA_FACTORY, createRun.runId());
pipelineRun = manager.pipelineRuns().get(resourceGroup, DATA_FACTORY, createRun.runId());
runStatus = pipelineRun.status();
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ public DataFactoryManager authenticate(TokenCredential credential, AzureProfile
.append("-")
.append("com.azure.resourcemanager.datafactory")
.append("/")
.append("1.0.0-beta.10");
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datafactory.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datafactory.models.PublicNetworkAccess;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Factory update resource properties. */
@Fluent
public final class FactoryUpdateProperties {
@JsonIgnore private final ClientLogger logger = new ClientLogger(FactoryUpdateProperties.class);

/*
* Whether or not public network access is allowed for the data factory.
*/
@JsonProperty(value = "publicNetworkAccess")
private PublicNetworkAccess publicNetworkAccess;

/**
* Get the publicNetworkAccess property: Whether or not public network access is allowed for the data factory.
*
* @return the publicNetworkAccess value.
*/
public PublicNetworkAccess publicNetworkAccess() {
return this.publicNetworkAccess;
}

/**
* Set the publicNetworkAccess property: Whether or not public network access is allowed for the data factory.
*
* @param publicNetworkAccess the publicNetworkAccess value to set.
* @return the FactoryUpdateProperties object itself.
*/
public FactoryUpdateProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
this.publicNetworkAccess = publicNetworkAccess;
return this;
}

/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datafactory.fluent.models.FactoryUpdateProperties;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand All @@ -30,10 +31,10 @@ public final class FactoryUpdateParameters {
private FactoryIdentity identity;

/*
* Whether or not public network access is allowed for the data factory.
* Properties of update the factory.
*/
@JsonProperty(value = "publicNetworkAccess")
private PublicNetworkAccess publicNetworkAccess;
@JsonProperty(value = "properties")
private FactoryUpdateProperties innerProperties;

/**
* Get the tags property: The resource tags.
Expand Down Expand Up @@ -75,13 +76,22 @@ public FactoryUpdateParameters withIdentity(FactoryIdentity identity) {
return this;
}

/**
* Get the innerProperties property: Properties of update the factory.
*
* @return the innerProperties value.
*/
private FactoryUpdateProperties innerProperties() {
return this.innerProperties;
}

/**
* Get the publicNetworkAccess property: Whether or not public network access is allowed for the data factory.
*
* @return the publicNetworkAccess value.
*/
public PublicNetworkAccess publicNetworkAccess() {
return this.publicNetworkAccess;
return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess();
}

/**
Expand All @@ -91,7 +101,10 @@ public PublicNetworkAccess publicNetworkAccess() {
* @return the FactoryUpdateParameters object itself.
*/
public FactoryUpdateParameters withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
this.publicNetworkAccess = publicNetworkAccess;
if (this.innerProperties() == null) {
this.innerProperties = new FactoryUpdateProperties();
}
this.innerProperties().withPublicNetworkAccess(publicNetworkAccess);
return this;
}

Expand All @@ -104,5 +117,8 @@ public void validate() {
if (identity() != null) {
identity().validate();
}
if (innerProperties() != null) {
innerProperties().validate();
}
}
}

0 comments on commit 418f022

Please sign in to comment.