diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/IPRule.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/IPRule.java new file mode 100644 index 00000000000..4897b314ba8 --- /dev/null +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/IPRule.java @@ -0,0 +1,46 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A rule governing the accesibility of a vault from a specific ip address or + * ip range. + */ +public class IPRule { + /** + * An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + * IP address) or '124.56.78.0/24' (all addresses that start with + * 124.56.78). + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the value value. + * + * @return the value value + */ + public String value() { + return this.value; + } + + /** + * Set the value value. + * + * @param value the value value to set + * @return the IPRule object itself. + */ + public IPRule withValue(String value) { + this.value = value; + return this; + } + +} diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/KeyPermissions.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/KeyPermissions.java index 4596c947713..2651ab4b3d2 100644 --- a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/KeyPermissions.java +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/KeyPermissions.java @@ -8,11 +8,10 @@ package com.microsoft.azure.management.keyvault; +import java.util.Collection; import com.fasterxml.jackson.annotation.JsonCreator; import com.microsoft.rest.ExpandableStringEnum; -import java.util.Collection; - /** * Defines values for KeyPermissions. */ diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleAction.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleAction.java new file mode 100644 index 00000000000..9cec5e041a6 --- /dev/null +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleAction.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkRuleAction. + */ +public final class NetworkRuleAction extends ExpandableStringEnum { + /** Static value Allow for NetworkRuleAction. */ + public static final NetworkRuleAction ALLOW = fromString("Allow"); + + /** Static value Deny for NetworkRuleAction. */ + public static final NetworkRuleAction DENY = fromString("Deny"); + + /** + * Creates or finds a NetworkRuleAction from its string representation. + * @param name a name to look for + * @return the corresponding NetworkRuleAction + */ + @JsonCreator + public static NetworkRuleAction fromString(String name) { + return fromString(name, NetworkRuleAction.class); + } + + /** + * @return known NetworkRuleAction values + */ + public static Collection values() { + return values(NetworkRuleAction.class); + } +} diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleBypassOptions.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleBypassOptions.java new file mode 100644 index 00000000000..618cfb7a6d0 --- /dev/null +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleBypassOptions.java @@ -0,0 +1,41 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkRuleBypassOptions. + */ +public final class NetworkRuleBypassOptions extends ExpandableStringEnum { + /** Static value AzureServices for NetworkRuleBypassOptions. */ + public static final NetworkRuleBypassOptions AZURE_SERVICES = fromString("AzureServices"); + + /** Static value None for NetworkRuleBypassOptions. */ + public static final NetworkRuleBypassOptions NONE = fromString("None"); + + /** + * Creates or finds a NetworkRuleBypassOptions from its string representation. + * @param name a name to look for + * @return the corresponding NetworkRuleBypassOptions + */ + @JsonCreator + public static NetworkRuleBypassOptions fromString(String name) { + return fromString(name, NetworkRuleBypassOptions.class); + } + + /** + * @return known NetworkRuleBypassOptions values + */ + public static Collection values() { + return values(NetworkRuleBypassOptions.class); + } +} diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleSet.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleSet.java new file mode 100644 index 00000000000..fa2482c3214 --- /dev/null +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/NetworkRuleSet.java @@ -0,0 +1,126 @@ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for + * license information. + * + * Code generated by Microsoft (R) AutoRest Code Generator. + */ + +package com.microsoft.azure.management.keyvault; + +import java.util.List; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A set of rules governing the network accessibility of a vault. + */ +public class NetworkRuleSet { + /** + * Tells what traffic can bypass network rules. This can be 'AzureServices' + * or 'None'. If not specified the default is 'AzureServices'. Possible + * values include: 'AzureServices', 'None'. + */ + @JsonProperty(value = "bypass") + private NetworkRuleBypassOptions bypass; + + /** + * The default action when no rule from ipRules and from + * virtualNetworkRules match. This is only used after the bypass property + * has been evaluated. Possible values include: 'Allow', 'Deny'. + */ + @JsonProperty(value = "defaultAction") + private NetworkRuleAction defaultAction; + + /** + * The list of IP address rules. + */ + @JsonProperty(value = "ipRules") + private List ipRules; + + /** + * The list of virtual network rules. + */ + @JsonProperty(value = "virtualNetworkRules") + private List virtualNetworkRules; + + /** + * Get the bypass value. + * + * @return the bypass value + */ + public NetworkRuleBypassOptions bypass() { + return this.bypass; + } + + /** + * Set the bypass value. + * + * @param bypass the bypass value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withBypass(NetworkRuleBypassOptions bypass) { + this.bypass = bypass; + return this; + } + + /** + * Get the defaultAction value. + * + * @return the defaultAction value + */ + public NetworkRuleAction defaultAction() { + return this.defaultAction; + } + + /** + * Set the defaultAction value. + * + * @param defaultAction the defaultAction value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withDefaultAction(NetworkRuleAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get the ipRules value. + * + * @return the ipRules value + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set the ipRules value. + * + * @param ipRules the ipRules value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + + /** + * Get the virtualNetworkRules value. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set the virtualNetworkRules value. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + +} diff --git a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/StoragePermissions.java b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/StoragePermissions.java index cb9fc940e56..f0f1c5be173 100644 --- a/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/StoragePermissions.java +++ b/azure-mgmt-keyvault/src/main/java/com/microsoft/azure/management/keyvault/StoragePermissions.java @@ -34,6 +34,18 @@ public final class StoragePermissions extends ExpandableStringEnum> createOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body VaultCreateOrUpdateParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Vaults beginCreateOrUpdate" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") + Observable> beginCreateOrUpdate(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body VaultCreateOrUpdateParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); + @Headers({ "Content-Type: application/json; charset=utf-8", "x-ms-logging-context: com.microsoft.azure.management.keyvault.Vaults update" }) @PATCH("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") Observable> update(@Path("resourceGroupName") String resourceGroupName, @Path("vaultName") String vaultName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body VaultPatchParametersInner parameters, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -151,7 +154,7 @@ interface VaultsService { * @return the VaultInner object if successful. */ public VaultInner createOrUpdate(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { - return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).toBlocking().single().body(); + return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).toBlocking().last().body(); } /** @@ -175,7 +178,7 @@ public ServiceFuture createOrUpdateAsync(String resourceGroupName, S * @param vaultName Name of the vault * @param parameters Parameters to create or update the vault * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the VaultInner object + * @return the observable for the request */ public Observable createOrUpdateAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).map(new Func1, VaultInner>() { @@ -193,7 +196,7 @@ public VaultInner call(ServiceResponse response) { * @param vaultName Name of the vault * @param parameters Parameters to create or update the vault * @throws IllegalArgumentException thrown if parameters fail the validation - * @return the observable to the VaultInner object + * @return the observable for the request */ public Observable> createOrUpdateWithServiceResponseAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { if (resourceGroupName == null) { @@ -212,12 +215,89 @@ public Observable> createOrUpdateWithServiceResponse throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); } Validator.validate(parameters); - return service.createOrUpdate(resourceGroupName, vaultName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) + Observable> observable = service.createOrUpdate(resourceGroupName, vaultName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()); + return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken() { }.getType()); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws CloudException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the VaultInner object if successful. + */ + public VaultInner beginCreateOrUpdate(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).toBlocking().single().body(); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @param serviceCallback the async ServiceCallback to handle successful and failed responses. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the {@link ServiceFuture} object + */ + public ServiceFuture beginCreateOrUpdateAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters), serviceCallback); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultInner object + */ + public Observable beginCreateOrUpdateAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, vaultName, parameters).map(new Func1, VaultInner>() { + @Override + public VaultInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update a key vault in the specified subscription. + * + * @param resourceGroupName The name of the Resource Group to which the server belongs. + * @param vaultName Name of the vault + * @param parameters Parameters to create or update the vault + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the VaultInner object + */ + public Observable> beginCreateOrUpdateWithServiceResponseAsync(String resourceGroupName, String vaultName, VaultCreateOrUpdateParametersInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (vaultName == null) { + throw new IllegalArgumentException("Parameter vaultName is required and cannot be null."); + } + if (this.client.subscriptionId() == null) { + throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); + } + if (this.client.apiVersion() == null) { + throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); + } + if (parameters == null) { + throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); + } + Validator.validate(parameters); + return service.beginCreateOrUpdate(resourceGroupName, vaultName, this.client.subscriptionId(), this.client.apiVersion(), parameters, this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1, Observable>>() { @Override public Observable> call(Response response) { try { - ServiceResponse clientResponse = createOrUpdateDelegate(response); + ServiceResponse clientResponse = beginCreateOrUpdateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); @@ -226,7 +306,7 @@ public Observable> call(Response respo }); } - private ServiceResponse createOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { + private ServiceResponse beginCreateOrUpdateDelegate(Response response) throws CloudException, IOException, IllegalArgumentException { return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) .register(200, new TypeToken() { }.getType()) .register(201, new TypeToken() { }.getType())