Skip to content

Commit

Permalink
Deprecate AZURE_GERMANY in Spring Cloud Azure (Azure#34682)
Browse files Browse the repository at this point in the history
* deprecate `AZURE_GERMANY`
  • Loading branch information
Netyyyy authored Apr 27, 2023
1 parent ffc96a8 commit facfb86
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,11 @@
"code": "java\\.annotation\\.removed",
"old": ".*? com\\.azure\\.search\\.documents(\\.indexes)?\\.models.*",
"justification": "Removing Jackson annotations from Search in transition to stream-style."
},
{
"code": "java.field.removed",
"old": "field com.azure.spring.cloud.core.properties.profile.AzureEnvironmentProperties.AZURE_GERMANY",
"justification": "Remove this because AZURE_GERMANY is deprecated."
}
]
}
Expand Down
14 changes: 14 additions & 0 deletions sdk/spring/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Release History

## 4.8.0-beta.1 (unreleased)

### Spring Cloud Azure Core
This section includes changes in `spring-cloud-azure-core`, `spring-cloud-azure-service`, and `spring-cloud-azure-resourcemanager` modules.

#### Breaking Changes
- Deprecated `CloudType.AZURE_GERMANY`, `JDBC_SCOPE_AZURE_GERMANY`, `REDIS_SCOPE_AZURE_GERMANY`, `AzureEnvironmentProperties.AZURE_GERMANY` [#34682](https://github.com/Azure/azure-sdk-for-java/pull/34682).

### Spring Cloud Azure Autoconfigure
This section includes changes in `spring-cloud-azure-autoconfigure` module.

#### Breaking Changes
- Deprecated `SERVICE_BUS_SCOPE_AZURE_GERMANY` [#34682](https://github.com/Azure/azure-sdk-for-java/pull/34682).

## 4.7.0 (2023-03-23)
- This release is compatible with Spring Boot 2.5.0-2.5.14, 2.6.0-2.6.14, 2.7.0-2.7.9. (Note: 2.5.x (x>14), 2.6.y (y>14) and 2.7.z (z>9) should be supported, but they aren't tested with this release.)
- This release is compatible with Spring Cloud 2020.0.3-2020.0.6, 2021.0.0-2021.0.5. (Note: 2020.0.x (x>6) and 2021.0.y (y>5) should be supported, but they aren't tested with this release.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class AadProfileProperties {
*/
private String tenantId; // tenantId can not set to "common" here, otherwise we can not know whether it's set by customer or it is the default value.
/**
* Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_GERMANY, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.
* Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.
*/
private AzureProfileOptionsProvider.CloudType cloudType;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ public class AzureServiceBusJmsProperties implements InitializingBean, Passwordl

private static final String SERVICE_BUS_SCOPE_AZURE = "https://servicebus.azure.net/.default";
private static final String SERVICE_BUS_SCOPE_AZURE_CHINA = SERVICE_BUS_SCOPE_AZURE;
/**
* @deprecated AZURE_GERMANY is deprecated. Please use other Service Bus scopes.
*/
@Deprecated
private static final String SERVICE_BUS_SCOPE_AZURE_GERMANY = SERVICE_BUS_SCOPE_AZURE;
private static final String SERVICE_BUS_SCOPE_AZURE_US_GOVERNMENT = SERVICE_BUS_SCOPE_AZURE;

private static final Map<CloudType, String> SERVICEBUS_SCOPE_MAP = new HashMap<CloudType, String>() {
{
put(CloudType.AZURE, SERVICE_BUS_SCOPE_AZURE);
put(CloudType.AZURE_CHINA, SERVICE_BUS_SCOPE_AZURE_CHINA);
put(CloudType.AZURE_GERMANY, SERVICE_BUS_SCOPE_AZURE_GERMANY);
put(CloudType.AZURE_US_GOVERNMENT, SERVICE_BUS_SCOPE_AZURE_US_GOVERNMENT);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class AzureProfileConfigurationProperties extends AzureProfileOptionsAdap
*/
private String subscriptionId;
/**
* Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_GERMANY, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.
* Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.
*/
private AzureProfileOptionsProvider.CloudType cloudType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1301,7 +1301,7 @@
{
"name": "spring.cloud.azure.keyvault.secret.property-sources[0].profile.cloud-type",
"type": "com.azure.spring.cloud.core.provider.AzureProfileOptionsProvider$CloudType",
"description": "Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_GERMANY, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.",
"description": "Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.",
"sourceType": "com.azure.spring.cloud.autoconfigure.properties.core.profile.AzureProfileConfigurationProperties"
},
{
Expand Down Expand Up @@ -1590,7 +1590,7 @@
{
"name": "spring.datasource.azure.profile.cloud-type",
"type": "java.lang.String",
"description": "Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_GERMANY, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.",
"description": "Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.",
"sourceType": "com.azure.spring.cloud.service.implementation.passwordless.AzureJdbcPasswordlessProperties"
},
{
Expand Down Expand Up @@ -1658,7 +1658,7 @@
{
"name": "spring.redis.azure.profile.cloud-type",
"type": "java.lang.String",
"description": "Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_GERMANY, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.",
"description": "Name of the Azure cloud to connect to. Supported types are: AZURE, AZURE_CHINA, AZURE_US_GOVERNMENT, OTHER. The default value is `AZURE`.",
"sourceType": "com.azure.spring.cloud.service.implementation.passwordless.AzureRedisPasswordlessProperties"
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void configureAzureEventHubsPropertiesWithGlobalDefaults() {
@Test
void configureEventHubsDomainNameOverrideGlobalDefault() {
AzureGlobalProperties azureProperties = new AzureGlobalProperties();
azureProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
azureProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);

this.contextRunner
.withBean(AzureGlobalProperties.class, () -> azureProperties)
Expand All @@ -140,8 +140,8 @@ void configureEventHubsDomainNameOverrideGlobalDefault() {
.run(context -> {
assertThat(context).hasSingleBean(AzureEventHubsProperties.class);
final AzureEventHubsProperties properties = context.getBean(AzureEventHubsProperties.class);
assertThat(properties.getProfile().getCloudType()).isEqualTo(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
assertThat(properties.getProfile().getEnvironment().getServiceBusDomainName()).isEqualTo(AzureEnvironmentProperties.AZURE_GERMANY.getServiceBusDomainName());
assertThat(properties.getProfile().getCloudType()).isEqualTo(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);
assertThat(properties.getProfile().getEnvironment().getServiceBusDomainName()).isEqualTo(AzureEnvironmentProperties.AZURE_US_GOVERNMENT.getServiceBusDomainName());
assertThat(properties.getDomainName()).isEqualTo(AzureEnvironmentProperties.AZURE_CHINA.getServiceBusDomainName());
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ void getDomainNameFromCloud() {
@Test
void domainNameOverrideCloud() {
AzureEventHubsProperties eventHubsProperties = new AzureEventHubsProperties();
eventHubsProperties.setDomainName(AzureEnvironmentProperties.AZURE_GERMANY.getServiceBusDomainName());
eventHubsProperties.setDomainName(AzureEnvironmentProperties.AZURE_US_GOVERNMENT.getServiceBusDomainName());
eventHubsProperties.getProfile().setCloudType(AZURE_CHINA);
assertEquals(AzureEnvironmentProperties.AZURE_GERMANY.getServiceBusDomainName(),
assertEquals(AzureEnvironmentProperties.AZURE_US_GOVERNMENT.getServiceBusDomainName(),
eventHubsProperties.getDomainName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ void getDomainNameFromCloud() {
@Test
void domainNameOverrideCloud() {
AzureServiceBusProperties serviceBusProperties = new AzureServiceBusProperties();
serviceBusProperties.setDomainName(AzureEnvironmentProperties.AZURE_GERMANY.getServiceBusDomainName());
serviceBusProperties.setDomainName(AzureEnvironmentProperties.AZURE_US_GOVERNMENT.getServiceBusDomainName());
serviceBusProperties.getProfile().setCloudType(AZURE_CHINA);
assertEquals(AzureEnvironmentProperties.AZURE_GERMANY.getServiceBusDomainName(),
assertEquals(AzureEnvironmentProperties.AZURE_US_GOVERNMENT.getServiceBusDomainName(),
serviceBusProperties.getDomainName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@ void testScopes() {
Assertions.assertEquals(REDIS_SCOPE_CHINA, properties.getScopes());
});

this.contextRunner.withPropertyValues("spring.redis.azure.profile.cloud-type = AZURE_GERMANY").run((context) -> {
AzureRedisPasswordlessProperties properties = context.getBean(AzureRedisPasswordlessProperties.class);
Assertions.assertEquals(REDIS_SCOPE_GERMANY, properties.getScopes());
});

this.contextRunner.withPropertyValues("spring.redis.azure.profile.cloud-type = AZURE_US_GOVERNMENT").run((context) -> {
AzureRedisPasswordlessProperties properties = context.getBean(AzureRedisPasswordlessProperties.class);
Assertions.assertEquals(REDIS_SCOPE_US_GOVERNMENT, properties.getScopes());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void configureAzureServiceBusPropertiesWithGlobalDefaults() {
@Test
void configureServiceBusDomainNameOverrideGlobalDefault() {
AzureGlobalProperties azureProperties = new AzureGlobalProperties();
azureProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
azureProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);

this.contextRunner
.withBean("azureProperties", AzureGlobalProperties.class, () -> azureProperties)
Expand All @@ -114,8 +114,8 @@ void configureServiceBusDomainNameOverrideGlobalDefault() {
.run(context -> {
assertThat(context).hasSingleBean(AzureServiceBusProperties.class);
final AzureServiceBusProperties properties = context.getBean(AzureServiceBusProperties.class);
assertThat(properties.getProfile().getCloudType()).isEqualTo(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
assertThat(properties.getProfile().getEnvironment().getServiceBusDomainName()).isEqualTo(AzureEnvironmentProperties.AZURE_GERMANY.getServiceBusDomainName());
assertThat(properties.getProfile().getCloudType()).isEqualTo(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);
assertThat(properties.getProfile().getEnvironment().getServiceBusDomainName()).isEqualTo(AzureEnvironmentProperties.AZURE_US_GOVERNMENT.getServiceBusDomainName());
assertThat(properties.getDomainName()).isEqualTo(AzureEnvironmentProperties.AZURE_CHINA.getServiceBusDomainName());
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public class AzureEnvironmentProperties implements AzureProfileOptionsProvider.A

/**
* Provides the environment instance for Azure Germany.
* @deprecated AZURE_GERMANY is deprecated. Please use other environment instances.
*/
@Deprecated
public static final AzureEnvironmentProperties AZURE_GERMANY = new AzureEnvironmentProperties(AzureEnvironment.AZURE_GERMANY) {{
setServiceBusDomainName("servicebus.cloudapi.de");
}};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ private AzureProfileOptionsProvider.AzureEnvironmentOptions decideAzureEnvironme
return AzureEnvironmentProperties.AZURE_CHINA;
case AZURE_US_GOVERNMENT:
return AzureEnvironmentProperties.AZURE_US_GOVERNMENT;
case AZURE_GERMANY:
return AzureEnvironmentProperties.AZURE_GERMANY;
case AZURE:
return AzureEnvironmentProperties.AZURE;
default:
Expand All @@ -61,8 +59,6 @@ public static AzureEnvironment decideAzureManagementEnvironment(AzureProfileOpti
return AzureEnvironment.AZURE_CHINA;
case AZURE_US_GOVERNMENT:
return AzureEnvironment.AZURE_US_GOVERNMENT;
case AZURE_GERMANY:
return AzureEnvironment.AZURE_GERMANY;
case AZURE:
return AzureEnvironment.AZURE;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ enum CloudType {

/**
* Azure Germany
* @deprecated AZURE_GERMANY is deprecated. Please use other CloudTypes.
*/
@Deprecated
AZURE_GERMANY,

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ public class AzureJdbcPasswordlessProperties implements PasswordlessProperties {

private static final String JDBC_SCOPE_AZURE = "https://ossrdbms-aad.database.windows.net/.default";
private static final String JDBC_SCOPE_AZURE_CHINA = "https://ossrdbms-aad.database.chinacloudapi.cn/.default";
/**
* @deprecated AZURE_GERMANY is deprecated. Please use other JDBC scopes.
*/
@Deprecated
private static final String JDBC_SCOPE_AZURE_GERMANY = "https://ossrdbms-aad.database.cloudapi.de/.default";
private static final String JDBC_SCOPE_AZURE_US_GOVERNMENT = "https://ossrdbms-aad.database.usgovcloudapi.net/.default";

private static final Map<CloudType, String> JDBC_SCOPE_MAP = new HashMap<CloudType, String>() {
{
put(CloudType.AZURE, JDBC_SCOPE_AZURE);
put(CloudType.AZURE_CHINA, JDBC_SCOPE_AZURE_CHINA);
put(CloudType.AZURE_GERMANY, JDBC_SCOPE_AZURE_GERMANY);
put(CloudType.AZURE_US_GOVERNMENT, JDBC_SCOPE_AZURE_US_GOVERNMENT);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ public class AzureRedisPasswordlessProperties implements PasswordlessProperties

private static final String REDIS_SCOPE_AZURE = "https://*.cacheinfra.windows.net:10225/appid/.default";
private static final String REDIS_SCOPE_AZURE_CHINA = "https://*.cacheinfra.windows.net.china:10225/appid/.default";
private static final String REDIS_SCOPE_AZURE_GERMANY = "https://*.cacheinfra.windows.net.germany:10225/appid/.default";
/**
* @deprecated AZURE_GERMANY is deprecated. Please use other Redis scopes.
*/
@Deprecated
static final String REDIS_SCOPE_AZURE_GERMANY = "https://*.cacheinfra.windows.net.germany:10225/appid/.default";
private static final String REDIS_SCOPE_AZURE_US_GOVERNMENT = "https://*.cacheinfra.windows.us.government.net:10225/appid/.default";

private static final Map<CloudType, String> REDIS_SCOPE_MAP = new HashMap<CloudType, String>() {
{
put(AzureProfileOptionsProvider.CloudType.AZURE, REDIS_SCOPE_AZURE);
put(AzureProfileOptionsProvider.CloudType.AZURE_CHINA, REDIS_SCOPE_AZURE_CHINA);
put(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY, REDIS_SCOPE_AZURE_GERMANY);
put(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT, REDIS_SCOPE_AZURE_US_GOVERNMENT);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class AzureRedisPasswordlessPropertiesTest {

private static final String REDIS_SCOPE_GLOBAL = "https://*.cacheinfra.windows.net:10225/appid/.default";
private static final String REDIS_SCOPE_CHINA = "https://*.cacheinfra.windows.net.china:10225/appid/.default";
private static final String REDIS_SCOPE_GERMANY = "https://*.cacheinfra.windows.net.germany:10225/appid/.default";
private static final String REDIS_SCOPE_US_GOVERNMENT = "https://*.cacheinfra.windows.us.government.net:10225/appid/.default";

@Test
Expand All @@ -31,11 +30,6 @@ void testGetScopes() {
String scopes = properties.getScopes();
Assertions.assertEquals(REDIS_SCOPE_GLOBAL, scopes);

profile.setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
properties.setProfile(profile);
scopes = properties.getScopes();
Assertions.assertEquals(REDIS_SCOPE_GERMANY, scopes);

profile.setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_CHINA);
properties.setProfile(profile);
scopes = properties.getScopes();
Expand Down Expand Up @@ -64,7 +58,7 @@ void testToProperties() {

AzureProfileProperties profile = new AzureProfileProperties();
profile.setTenantId("fake-tenantId");
profile.setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
profile.setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);

AzureRedisPasswordlessProperties azureRedisPasswordlessProperties = new AzureRedisPasswordlessProperties();
azureRedisPasswordlessProperties.setScopes("fake-scopes");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ void domainNameDefaultsToNull() {

@Test
void domainNameConfigureAsCloud() {
consumerProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY, consumerProperties.getProfile().getCloudType());
assertEquals(AzureEnvironmentProperties.AZURE_GERMANY.getServiceBusDomainName(), consumerProperties.getDomainName());
consumerProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);
assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT, consumerProperties.getProfile().getCloudType());
assertEquals(AzureEnvironmentProperties.AZURE_US_GOVERNMENT.getServiceBusDomainName(), consumerProperties.getDomainName());
}

@Test
void customDomainNameShouldSet() {
consumerProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
consumerProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);
consumerProperties.setDomainName("new.servicebus.windows.net");
assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY, consumerProperties.getProfile().getCloudType());
assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT, consumerProperties.getProfile().getCloudType());
assertEquals("new.servicebus.windows.net", consumerProperties.getDomainName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ void domainNameDefaultsToNull() {

@Test
void domainNameConfigureAsCloud() {
producerProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY, producerProperties.getProfile().getCloudType());
assertEquals(AzureEnvironmentProperties.AZURE_GERMANY.getServiceBusDomainName(), producerProperties.getDomainName());
producerProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);
assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT, producerProperties.getProfile().getCloudType());
assertEquals(AzureEnvironmentProperties.AZURE_US_GOVERNMENT.getServiceBusDomainName(), producerProperties.getDomainName());
}

@Test
void customDomainNameShouldSet() {
producerProperties.setDomainName("new.servicebus.windows.net");
producerProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY);
assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_GERMANY, producerProperties.getProfile().getCloudType());
producerProperties.getProfile().setCloudType(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT);
assertEquals(AzureProfileOptionsProvider.CloudType.AZURE_US_GOVERNMENT, producerProperties.getProfile().getCloudType());
assertEquals("new.servicebus.windows.net", producerProperties.getDomainName());
}

Expand Down
Loading

0 comments on commit facfb86

Please sign in to comment.