From 418f022a620003aeae7f6af8c86e3e2ecc6ab0b4 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 7 Feb 2022 01:54:32 +0000 Subject: [PATCH] CodeGen from PR 17553 in Azure/azure-rest-api-specs Fix update PublicNetworkAccess not work in Factory Update API (#17553) * Fix update PublicNetworkAccess not work in Factory Update API * fix an issue * update --- .../CHANGELOG.md | 4 +- .../README.md | 22 ++++---- .../datafactory/DataFactoryManager.java | 2 +- .../models/FactoryUpdateProperties.java | 51 +++++++++++++++++++ .../models/FactoryUpdateParameters.java | 26 ++++++++-- 5 files changed, 87 insertions(+), 18 deletions(-) create mode 100644 sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FactoryUpdateProperties.java diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/CHANGELOG.md b/sdk/datafactory/azure-resourcemanager-datafactory/CHANGELOG.md index d31e2ed5f06ca..9bc0e96a237a3 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/CHANGELOG.md +++ b/sdk/datafactory/azure-resourcemanager-datafactory/CHANGELOG.md @@ -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 diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/README.md b/sdk/datafactory/azure-resourcemanager-datafactory/README.md index 69178ff347eb6..0b9221e1f369d 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/README.md +++ b/sdk/datafactory/azure-resourcemanager-datafactory/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-datafactory - 1.0.0-beta.10 + 1.0.0-beta.11 ``` [//]: # ({x-version-update-end}) @@ -78,7 +78,7 @@ 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()); @@ -86,7 +86,7 @@ final String connectionString = getStorageConnectionString(STORAGE_ACCOUNT, stor // container final String containerName = "adf"; storageManager.blobContainers().defineContainer(containerName) - .withExistingBlobService(RESOURCE_GROUP, STORAGE_ACCOUNT) + .withExistingStorageAccount(resourceGroup, STORAGE_ACCOUNT) .withPublicAccess(PublicAccess.NONE) .create(); @@ -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 @@ -111,7 +111,7 @@ 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(); @@ -119,7 +119,7 @@ manager.linkedServices().define(linkedServiceName) // 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) @@ -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) @@ -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()) @@ -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(); } ``` diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/DataFactoryManager.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/DataFactoryManager.java index e0dd4199138f8..8eed8312d3981 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/DataFactoryManager.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/DataFactoryManager.java @@ -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(" (") diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FactoryUpdateProperties.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FactoryUpdateProperties.java new file mode 100644 index 0000000000000..587715a3adf15 --- /dev/null +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/fluent/models/FactoryUpdateProperties.java @@ -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() { + } +} diff --git a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FactoryUpdateParameters.java b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FactoryUpdateParameters.java index ee779d40c7d57..ba407e8a6eae9 100644 --- a/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FactoryUpdateParameters.java +++ b/sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/FactoryUpdateParameters.java @@ -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; @@ -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. @@ -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(); } /** @@ -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; } @@ -104,5 +117,8 @@ public void validate() { if (identity() != null) { identity().validate(); } + if (innerProperties() != null) { + innerProperties().validate(); + } } }