Skip to content
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ public interface Vault extends
*/
@Beta(SinceVersion.V1_11_0)
CreateMode createMode();

/**
* Get the networkAcls value.
*
* @return the networkAcls value
*/
@Beta(SinceVersion.V1_11_0)
NetworkRuleSet networkAcls();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tiffanyachen In Fluent we try to avoid using acronyms especially when these are not needed. In this the method can be replaced with "networkRuleSet()". It's also consistent with a similar class found in Storage management library.


/**************************************************************
* Fluent interfaces to provision a Vault
Expand Down Expand Up @@ -179,6 +187,20 @@ interface WithAccessPolicy {
@Method
AccessPolicy.DefinitionStages.Blank<WithCreate> defineAccessPolicy();
}

/**
* A key vault definition allowing the networkAcl to be set.
*/
interface WithNetworkAcls {

/**
* Set the networkAcls value.
*
* @param networkAcls the networkAcls value to set
* @return the next stage of key vault definition
*/
WithCreate withNetworkAcls(NetworkRuleSet networkAcls);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tiffanyachen Please rename this to "withNetworkRuleSet()". Also in Java we try to avoid passing a whole complex object that needs to be built aside and instead we "decompose" them in place into a sequence of "with...()" methods corresponding to each member of the class that can be set. Think of it similar to setting the AccessPolicy.

Copy link
Member

@anuchandy anuchandy May 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the key vault NetworkRuleSet is EXACTLY same as storage account network rule set. Customer will have consistent experience If we can ensure key vault nw ruleset experience is same as that storage provide.

Storage:

KeyVault:

Take a look at this “stage” in storage account definition

and this “stage” in storage account update

Also this helper https://github.com/Azure/azure-libraries-for-java/blob/kv2018/azure-mgmt-storage/src/main/java/com/microsoft/azure/management/storage/implementation/StorageNetworkRulesHelper.java

It seems you can copy over the helper, stages and implementations from storage. But double check the logic work for key vault as well.

}

/**
* A key vault definition allowing various configurations to be set.
Expand Down Expand Up @@ -252,6 +274,7 @@ interface WithCreate extends
Creatable<Vault>,
GroupableResource.DefinitionWithTags<WithCreate>,
DefinitionStages.WithSku,
DefinitionStages.WithNetworkAcls,
DefinitionStages.WithConfigurations,
DefinitionStages.WithAccessPolicy {
}
Expand Down Expand Up @@ -298,6 +321,20 @@ interface WithAccessPolicy {
AccessPolicy.Update updateAccessPolicy(String objectId);
}

/**
* A key vault update allowing the networkAcl to be set.
*/
interface WithNetworkAcls {

/**
* Set the networkAcls value.
*
* @param networkAcls the networkAcls value to set
* @return the next stage of key vault definition
*/
Update withNetworkAcls(NetworkRuleSet networkAcls);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same feedback as above.

}

/**
* A key vault update allowing various configurations to be set.
*/
Expand Down Expand Up @@ -369,6 +406,7 @@ interface Update extends
GroupableResource.UpdateWithTags<Update>,
Appliable<Vault>,
UpdateStages.WithAccessPolicy,
UpdateStages.WithNetworkAcls,
UpdateStages.WithConfigurations {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.microsoft.azure.management.keyvault.AccessPolicyEntry;
import com.microsoft.azure.management.keyvault.CreateMode;
import com.microsoft.azure.management.keyvault.Keys;
import com.microsoft.azure.management.keyvault.NetworkRuleSet;
import com.microsoft.azure.management.keyvault.Secrets;
import com.microsoft.azure.management.keyvault.Sku;
import com.microsoft.azure.management.keyvault.SkuName;
Expand Down Expand Up @@ -331,4 +332,18 @@ public CreateMode createMode() {
return inner().properties().createMode();
}

@Override
public VaultImpl withNetworkAcls(NetworkRuleSet networkAcls) {
if (inner().properties() == null) {
inner().withProperties(new VaultProperties());
}
inner().properties().withNetworkAcls(networkAcls);
return this;
}

@Override
public NetworkRuleSet networkAcls() {
return inner().properties().networkAcls();
}

}