Skip to content

Commit

Permalink
Fixed mgmt, support convenience API for publicNetworkAccess
Browse files Browse the repository at this point in the history
  • Loading branch information
v-hongli1 committed Mar 22, 2024
1 parent 7f05103 commit 5b6d47e
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/resourcemanager/azure-resourcemanager-appservice",
"Tag": "java/resourcemanager/azure-resourcemanager-appservice_12f37b1142"
"Tag": "java/resourcemanager/azure-resourcemanager-appservice_6d9bee9aaa"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1838,15 +1838,19 @@ public FluentImplT withoutIpAddressRangeAccess(String ipAddressCidr) {
@Override
@SuppressWarnings("unchecked")
public FluentImplT enablePublicNetworkAccess() {
this.ensureIpSecurityRestrictions();
if (Objects.isNull(this.siteConfig)) {
this.siteConfig = new SiteConfigResourceInner();
}
this.siteConfig.withPublicNetworkAccess("Enabled");
return (FluentImplT) this;
}

@Override
@SuppressWarnings("unchecked")
public FluentImplT disablePublicNetworkAccess() {
this.ensureIpSecurityRestrictions();
if (Objects.isNull(this.siteConfig)) {
this.siteConfig = new SiteConfigResourceInner();
}
this.siteConfig.withPublicNetworkAccess("Disabled");
return (FluentImplT) this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/resourcemanager/azure-resourcemanager-containerservice",
"Tag": "java/resourcemanager/azure-resourcemanager-containerservice_526a0eef6a"
"Tag": "java/resourcemanager/azure-resourcemanager-containerservice_bb2ea4e1ac"
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -303,7 +302,7 @@ public String agentPoolResourceGroup() {

@Override
public PublicNetworkAccess publicNetworkAccess() {
return Objects.isNull(this.innerModel().publicNetworkAccess()) ? null : this.innerModel().publicNetworkAccess();
return this.innerModel().publicNetworkAccess();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/resourcemanager/azure-resourcemanager-cosmos",
"Tag": "java/resourcemanager/azure-resourcemanager-cosmos_df14ca8256"
"Tag": "java/resourcemanager/azure-resourcemanager-cosmos_dbcf178bc8"
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import com.azure.resourcemanager.resources.fluentcore.utils.PagedConverter;
Expand Down Expand Up @@ -84,7 +83,7 @@ public DatabaseAccountOfferType databaseAccountOfferType() {

@Override
public PublicNetworkAccess publicNetworkAccess() {
return Objects.isNull(this.innerModel().publicNetworkAccess()) ? null : this.innerModel().publicNetworkAccess();
return this.innerModel().publicNetworkAccess();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public interface CosmosDBAccount
DatabaseAccountOfferType databaseAccountOfferType();

/**
* Whether the cosmos db can be accessed from public network.
* Whether the CosmosD account can be accessed from public network.
*
* @return whether the cosmos db can be accessed from public network.
* @return whether the CosmosD account can be accessed from public network.
*/
PublicNetworkAccess publicNetworkAccess();

Expand Down Expand Up @@ -405,10 +405,10 @@ PrivateEndpointConnection.DefinitionStages.Blank<WithCreate> defineNewPrivateEnd
String name);
}

/** The stage of cosmos db definition allowing to configure network access settings. */
/** The stage of CosmosDB account definition allowing to configure network access settings. */
interface WithPublicNetworkAccess {
/**
* Disables public network access for the cosmos db.
* Disables public network access for the CosmosDB account.
*
* @return the next stage of the definition
*/
Expand Down Expand Up @@ -633,16 +633,16 @@ PrivateEndpointConnection.UpdateDefinitionStages.Blank<WithOptionals> defineNewP
WithOptionals withoutPrivateEndpointConnection(String name);
}

/** The stage of cosmos db update allowing to configure network access settings. */
/** The stage of CosmosDB account update allowing to configure network access settings. */
interface WithPublicNetworkAccess {
/**
* Enables public network access for the cosmos db.
* Enables public network access for the CosmosDB account.
*
* @return the next stage of the update
*/
Update enablePublicNetworkAccess();
/**
* Disables public network access for the cosmos db.
* Disables public network access for the CosmosDB account.
*
* @return the next stage of the update
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/resourcemanager/azure-resourcemanager-redis",
"Tag": "java/resourcemanager/azure-resourcemanager-redis_40e6247ac9"
"Tag": "java/resourcemanager/azure-resourcemanager-redis_50169e9af1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;

/** Implementation for Redis Cache and its parent interfaces. */
Expand Down Expand Up @@ -200,7 +199,7 @@ public RedisAccessKeys regenerateKey(RedisKeyType keyType) {

@Override
public PublicNetworkAccess publicNetworkAccess() {
return Objects.isNull(this.innerModel().publicNetworkAccess()) ? null : this.innerModel().publicNetworkAccess();
return this.innerModel().publicNetworkAccess();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "java",
"TagPrefix": "java/resourcemanager/azure-resourcemanager-storage",
"Tag": "java/resourcemanager/azure-resourcemanager-storage_c87db8bc2f"
"Tag": "java/resourcemanager/azure-resourcemanager-storage_3aaa86972f"
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -284,7 +283,7 @@ public String userAssignedIdentityIdForCustomerEncryptionKey() {

@Override
public PublicNetworkAccess publicNetworkAccess() {
return Objects.isNull(this.innerModel().publicNetworkAccess()) ? null : this.innerModel().publicNetworkAccess();
return this.innerModel().publicNetworkAccess();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,9 @@ public interface StorageAccount
*/
String userAssignedIdentityIdForCustomerEncryptionKey();
/**
* Whether the storage can be accessed from public network.
* Whether the storage account can be accessed from public network.
*
* @return whether the storage can be accessed from public network.
* @return whether the storage account can be accessed from public network.
*/
PublicNetworkAccess publicNetworkAccess();

Expand Down Expand Up @@ -563,10 +563,10 @@ interface WithBlobAccess {
WithCreate disableSharedKeyAccess();
}

/** The stage of storage definition allowing to configure network access settings. */
/** The stage of storage account definition allowing to configure network access settings. */
interface WithNetworkAccess {
/**
* Disables public network access for the storage.
* Disables public network access for the storage account.
*
* @return the next stage of the definition
*/
Expand Down Expand Up @@ -999,17 +999,17 @@ interface WithBlobAccess {
Update disableSharedKeyAccess();
}

/** The stage of storage update allowing to configure network access. */
/** The stage of storage account update allowing to configure network access. */
interface WithNetworkAccess {
/**
* Enables public network access for the storage.
* Enables public network access for the storage account.
*
* @return the next stage of the update
*/
Update enablePublicNetworkAccess();

/**
* Disables public network access for the storage.
* Disables public network access for the storage account.
*
* @return the next stage of the update
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ public void updateIdentityFromNoneToSystemUserAssigned() {
}

@Test
public void createStorageAccountWithDisabledPublicNetworkAccess() {
public void canCreateStorageAccountWithDisabledPublicNetworkAccess() {
resourceManager.resourceGroups().define(rgName).withRegion(Region.US_EAST).create();
StorageAccount storageAccount = storageManager
.storageAccounts()
Expand All @@ -731,7 +731,7 @@ public void createStorageAccountWithDisabledPublicNetworkAccess() {
}

@Test
public void updatePublicNetworkAccess() {
public void canUpdatePublicNetworkAccess() {
resourceManager.resourceGroups().define(rgName).withRegion(Region.US_EAST).create();
StorageAccount storageAccount = storageManager
.storageAccounts()
Expand Down

0 comments on commit 5b6d47e

Please sign in to comment.