Skip to content

[AutoPR azure-resourcemanager-datafactory] Fix headers setting on Web, AzureFunction and WebHook activities #7710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.24 (Unreleased)
## 1.0.0-beta.1 (2023-10-22)

- 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
6 changes: 3 additions & 3 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.23</version>
<version>1.0.0-beta.24</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -45,7 +45,7 @@ Azure Management Libraries require a `TokenCredential` implementation for authen

### Authentication

By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables.
By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
Expand Down Expand Up @@ -181,7 +181,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
<!-- LINKS -->
[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
[docs]: https://azure.github.io/azure-sdk-for-java/
[jdk]: https://docs.microsoft.com/java/azure/jdk/
[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public DataFactoryManager authenticate(TokenCredential credential, AzureProfile
.append("-")
.append("com.azure.resourcemanager.datafactory")
.append("/")
.append("1.0.0-beta.23");
.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
Expand Up @@ -7,7 +7,9 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datafactory.models.AzureFunctionActivityMethod;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** Azure Function activity type properties. */
@Fluent
Expand All @@ -31,7 +33,8 @@ public final class AzureFunctionActivityTypeProperties {
* resultType string).
*/
@JsonProperty(value = "headers")
private Object headers;
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
private Map<String, String> headers;

/*
* Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET
Expand Down Expand Up @@ -93,7 +96,7 @@ public AzureFunctionActivityTypeProperties withFunctionName(Object functionName)
*
* @return the headers value.
*/
public Object headers() {
public Map<String, String> headers() {
return this.headers;
}

Expand All @@ -105,7 +108,7 @@ public Object headers() {
* @param headers the headers value to set.
* @return the AzureFunctionActivityTypeProperties object itself.
*/
public AzureFunctionActivityTypeProperties withHeaders(Object headers) {
public AzureFunctionActivityTypeProperties withHeaders(Map<String, String> headers) {
this.headers = headers;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
import com.azure.resourcemanager.datafactory.models.LinkedServiceReference;
import com.azure.resourcemanager.datafactory.models.WebActivityAuthentication;
import com.azure.resourcemanager.datafactory.models.WebActivityMethod;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/** Web activity type properties. */
@Fluent
Expand All @@ -35,7 +37,8 @@ public final class WebActivityTypeProperties {
* resultType string).
*/
@JsonProperty(value = "headers")
private Object headers;
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
private Map<String, String> headers;

/*
* Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET
Expand Down Expand Up @@ -125,7 +128,7 @@ public WebActivityTypeProperties withUrl(Object url) {
*
* @return the headers value.
*/
public Object headers() {
public Map<String, String> headers() {
return this.headers;
}

Expand All @@ -137,7 +140,7 @@ public Object headers() {
* @param headers the headers value to set.
* @return the WebActivityTypeProperties object itself.
*/
public WebActivityTypeProperties withHeaders(Object headers) {
public WebActivityTypeProperties withHeaders(Map<String, String> headers) {
this.headers = headers;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.datafactory.models.WebActivityAuthentication;
import com.azure.resourcemanager.datafactory.models.WebhookActivityMethod;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;

/** WebHook activity type properties. */
@Fluent
Expand Down Expand Up @@ -38,7 +40,8 @@ public final class WebhookActivityTypeProperties {
* resultType string).
*/
@JsonProperty(value = "headers")
private Object headers;
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
private Map<String, String> headers;

/*
* Represents the payload that will be sent to the endpoint. Required for POST/PUT method, not allowed for GET
Expand Down Expand Up @@ -138,7 +141,7 @@ public WebhookActivityTypeProperties withTimeout(String timeout) {
*
* @return the headers value.
*/
public Object headers() {
public Map<String, String> headers() {
return this.headers;
}

Expand All @@ -150,7 +153,7 @@ public Object headers() {
* @param headers the headers value to set.
* @return the WebhookActivityTypeProperties object itself.
*/
public WebhookActivityTypeProperties withHeaders(Object headers) {
public WebhookActivityTypeProperties withHeaders(Map<String, String> headers) {
this.headers = headers;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import reactor.core.publisher.Flux;

final class Utils {
private Utils() {
}

static String getValueFromIdByName(String id, String name) {
if (id == null) {
return null;
Expand Down Expand Up @@ -60,7 +63,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri
segments.add(idSegment);
idItrReverted.forEachRemaining(segments::add);
Collections.reverse(segments);
if (segments.size() > 0 && segments.get(0).isEmpty()) {
if (!segments.isEmpty() && segments.get(0).isEmpty()) {
segments.remove(0);
}
return String.join("/", segments);
Expand All @@ -74,7 +77,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri
}

static <T, S> PagedIterable<S> mapPage(PagedIterable<T> pageIterable, Function<T, S> mapper) {
return new PagedIterableImpl<T, S>(pageIterable, mapper);
return new PagedIterableImpl<>(pageIterable, mapper);
}

private static final class PagedIterableImpl<T, S> extends PagedIterable<S> {
Expand Down Expand Up @@ -133,30 +136,27 @@ public Stream<PagedResponse<S>> streamByPage(String continuationToken, int prefe

@Override
public Iterator<S> iterator() {
return new IteratorImpl<T, S>(pagedIterable.iterator(), mapper);
return new IteratorImpl<>(pagedIterable.iterator(), mapper);
}

@Override
public Iterable<PagedResponse<S>> iterableByPage() {
return new IterableImpl<PagedResponse<T>, PagedResponse<S>>(pagedIterable.iterableByPage(), pageMapper);
return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper);
}

@Override
public Iterable<PagedResponse<S>> iterableByPage(String continuationToken) {
return new IterableImpl<PagedResponse<T>, PagedResponse<S>>(
pagedIterable.iterableByPage(continuationToken), pageMapper);
return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper);
}

@Override
public Iterable<PagedResponse<S>> iterableByPage(int preferredPageSize) {
return new IterableImpl<PagedResponse<T>, PagedResponse<S>>(
pagedIterable.iterableByPage(preferredPageSize), pageMapper);
return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper);
}

@Override
public Iterable<PagedResponse<S>> iterableByPage(String continuationToken, int preferredPageSize) {
return new IterableImpl<PagedResponse<T>, PagedResponse<S>>(
pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper);
return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper);
}
}

Expand Down Expand Up @@ -198,7 +198,7 @@ private IterableImpl(Iterable<T> iterable, Function<T, S> mapper) {

@Override
public Iterator<S> iterator() {
return new IteratorImpl<T, S>(iterable.iterator(), mapper);
return new IteratorImpl<>(iterable.iterator(), mapper);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;
import java.util.Map;

/** Azure Function activity. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
Expand Down Expand Up @@ -147,7 +148,7 @@ public AzureFunctionActivity withFunctionName(Object functionName) {
*
* @return the headers value.
*/
public Object headers() {
public Map<String, String> headers() {
return this.innerTypeProperties() == null ? null : this.innerTypeProperties().headers();
}

Expand All @@ -159,7 +160,7 @@ public Object headers() {
* @param headers the headers value to set.
* @return the AzureFunctionActivity object itself.
*/
public AzureFunctionActivity withHeaders(Object headers) {
public AzureFunctionActivity withHeaders(Map<String, String> headers) {
if (this.innerTypeProperties() == null) {
this.innerTypeProperties = new AzureFunctionActivityTypeProperties();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;
import java.util.Map;

/** Web activity. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
Expand Down Expand Up @@ -145,7 +146,7 @@ public WebActivity withUrl(Object url) {
*
* @return the headers value.
*/
public Object headers() {
public Map<String, String> headers() {
return this.innerTypeProperties() == null ? null : this.innerTypeProperties().headers();
}

Expand All @@ -157,7 +158,7 @@ public Object headers() {
* @param headers the headers value to set.
* @return the WebActivity object itself.
*/
public WebActivity withHeaders(Object headers) {
public WebActivity withHeaders(Map<String, String> headers) {
if (this.innerTypeProperties() == null) {
this.innerTypeProperties = new WebActivityTypeProperties();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonTypeName;
import java.util.List;
import java.util.Map;

/** WebHook activity. */
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
Expand All @@ -23,6 +24,12 @@ public final class WebhookActivity extends ControlActivity {
@JsonProperty(value = "typeProperties", required = true)
private WebhookActivityTypeProperties innerTypeProperties = new WebhookActivityTypeProperties();

/*
* Activity policy.
*/
@JsonProperty(value = "policy")
private SecureInputOutputPolicy policy;

/** Creates an instance of WebhookActivity class. */
public WebhookActivity() {
}
Expand All @@ -36,6 +43,26 @@ private WebhookActivityTypeProperties innerTypeProperties() {
return this.innerTypeProperties;
}

/**
* Get the policy property: Activity policy.
*
* @return the policy value.
*/
public SecureInputOutputPolicy policy() {
return this.policy;
}

/**
* Set the policy property: Activity policy.
*
* @param policy the policy value to set.
* @return the WebhookActivity object itself.
*/
public WebhookActivity withPolicy(SecureInputOutputPolicy policy) {
this.policy = policy;
return this;
}

/** {@inheritDoc} */
@Override
public WebhookActivity withName(String name) {
Expand Down Expand Up @@ -160,7 +187,7 @@ public WebhookActivity withTimeout(String timeout) {
*
* @return the headers value.
*/
public Object headers() {
public Map<String, String> headers() {
return this.innerTypeProperties() == null ? null : this.innerTypeProperties().headers();
}

Expand All @@ -172,7 +199,7 @@ public Object headers() {
* @param headers the headers value to set.
* @return the WebhookActivity object itself.
*/
public WebhookActivity withHeaders(Object headers) {
public WebhookActivity withHeaders(Map<String, String> headers) {
if (this.innerTypeProperties() == null) {
this.innerTypeProperties = new WebhookActivityTypeProperties();
}
Expand Down Expand Up @@ -271,6 +298,9 @@ public void validate() {
} else {
innerTypeProperties().validate();
}
if (policy() != null) {
policy().validate();
}
}

private static final ClientLogger LOGGER = new ClientLogger(WebhookActivity.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ [ "com.azure.resourcemanager.datafactory.implementation.OperationsClientImpl$OperationsService" ], [ "com.azure.resourcemanager.datafactory.implementation.FactoriesClientImpl$FactoriesService" ], [ "com.azure.resourcemanager.datafactory.implementation.ExposureControlsClientImpl$ExposureControlsService" ], [ "com.azure.resourcemanager.datafactory.implementation.IntegrationRuntimesClientImpl$IntegrationRuntimesService" ], [ "com.azure.resourcemanager.datafactory.implementation.IntegrationRuntimeObjectMetadatasClientImpl$IntegrationRuntimeObjectMetadatasService" ], [ "com.azure.resourcemanager.datafactory.implementation.IntegrationRuntimeNodesClientImpl$IntegrationRuntimeNodesService" ], [ "com.azure.resourcemanager.datafactory.implementation.LinkedServicesClientImpl$LinkedServicesService" ], [ "com.azure.resourcemanager.datafactory.implementation.DatasetsClientImpl$DatasetsService" ], [ "com.azure.resourcemanager.datafactory.implementation.PipelinesClientImpl$PipelinesService" ], [ "com.azure.resourcemanager.datafactory.implementation.PipelineRunsClientImpl$PipelineRunsService" ], [ "com.azure.resourcemanager.datafactory.implementation.ActivityRunsClientImpl$ActivityRunsService" ], [ "com.azure.resourcemanager.datafactory.implementation.TriggersClientImpl$TriggersService" ], [ "com.azure.resourcemanager.datafactory.implementation.TriggerRunsClientImpl$TriggerRunsService" ], [ "com.azure.resourcemanager.datafactory.implementation.DataFlowsClientImpl$DataFlowsService" ], [ "com.azure.resourcemanager.datafactory.implementation.DataFlowDebugSessionsClientImpl$DataFlowDebugSessionsService" ], [ "com.azure.resourcemanager.datafactory.implementation.ManagedVirtualNetworksClientImpl$ManagedVirtualNetworksService" ], [ "com.azure.resourcemanager.datafactory.implementation.ManagedPrivateEndpointsClientImpl$ManagedPrivateEndpointsService" ], [ "com.azure.resourcemanager.datafactory.implementation.CredentialOperationsClientImpl$CredentialOperationsService" ], [ "com.azure.resourcemanager.datafactory.implementation.PrivateEndPointConnectionsClientImpl$PrivateEndPointConnectionsService" ], [ "com.azure.resourcemanager.datafactory.implementation.PrivateEndpointConnectionOperationsClientImpl$PrivateEndpointConnectionOperationsService" ], [ "com.azure.resourcemanager.datafactory.implementation.PrivateLinkResourcesClientImpl$PrivateLinkResourcesService" ], [ "com.azure.resourcemanager.datafactory.implementation.GlobalParametersClientImpl$GlobalParametersService" ], [ "com.azure.resourcemanager.datafactory.implementation.ChangeDataCapturesClientImpl$ChangeDataCapturesService" ] ]
Loading