diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/DefaultAction.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/DefaultAction.java new file mode 100644 index 0000000000000..442aea8a23e9c --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/DefaultAction.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.eventhub.v2018_01_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for DefaultAction. + */ +public final class DefaultAction extends ExpandableStringEnum { + /** Static value Allow for DefaultAction. */ + public static final DefaultAction ALLOW = fromString("Allow"); + + /** Static value Deny for DefaultAction. */ + public static final DefaultAction DENY = fromString("Deny"); + + /** + * Creates or finds a DefaultAction from its string representation. + * @param name a name to look for + * @return the corresponding DefaultAction + */ + @JsonCreator + public static DefaultAction fromString(String name) { + return fromString(name, DefaultAction.class); + } + + /** + * @return known DefaultAction values + */ + public static Collection values() { + return values(DefaultAction.class); + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NWRuleSetIpRules.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NWRuleSetIpRules.java new file mode 100644 index 0000000000000..df670d2e1c0d5 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NWRuleSetIpRules.java @@ -0,0 +1,69 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response from the List namespace operation. + */ +public class NWRuleSetIpRules { + /** + * IP Mask. + */ + @JsonProperty(value = "ipMask") + private String ipMask; + + /** + * The IP Filter Action. Possible values include: 'Allow'. + */ + @JsonProperty(value = "action") + private NetworkRuleIPAction action; + + /** + * Get iP Mask. + * + * @return the ipMask value + */ + public String ipMask() { + return this.ipMask; + } + + /** + * Set iP Mask. + * + * @param ipMask the ipMask value to set + * @return the NWRuleSetIpRules object itself. + */ + public NWRuleSetIpRules withIpMask(String ipMask) { + this.ipMask = ipMask; + return this; + } + + /** + * Get the IP Filter Action. Possible values include: 'Allow'. + * + * @return the action value + */ + public NetworkRuleIPAction action() { + return this.action; + } + + /** + * Set the IP Filter Action. Possible values include: 'Allow'. + * + * @param action the action value to set + * @return the NWRuleSetIpRules object itself. + */ + public NWRuleSetIpRules withAction(NetworkRuleIPAction action) { + this.action = action; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NWRuleSetVirtualNetworkRules.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NWRuleSetVirtualNetworkRules.java new file mode 100644 index 0000000000000..e549780547d4a --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NWRuleSetVirtualNetworkRules.java @@ -0,0 +1,69 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The response from the List namespace operation. + */ +public class NWRuleSetVirtualNetworkRules { + /** + * Subnet properties. + */ + @JsonProperty(value = "subnet") + private Subnet subnet; + + /** + * Value that indicates whether to ignore missing Vnet Service Endpoint. + */ + @JsonProperty(value = "ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /** + * Get subnet properties. + * + * @return the subnet value + */ + public Subnet subnet() { + return this.subnet; + } + + /** + * Set subnet properties. + * + * @param subnet the subnet value to set + * @return the NWRuleSetVirtualNetworkRules object itself. + */ + public NWRuleSetVirtualNetworkRules withSubnet(Subnet subnet) { + this.subnet = subnet; + return this; + } + + /** + * Get value that indicates whether to ignore missing Vnet Service Endpoint. + * + * @return the ignoreMissingVnetServiceEndpoint value + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set value that indicates whether to ignore missing Vnet Service Endpoint. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set + * @return the NWRuleSetVirtualNetworkRules object itself. + */ + public NWRuleSetVirtualNetworkRules withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Namespaces.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Namespaces.java index e0d565252a107..5cd16f9d63fd7 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Namespaces.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Namespaces.java @@ -20,6 +20,7 @@ import com.microsoft.azure.management.eventhub.v2018_01_01_preview.IpFilterRule; import rx.Completable; import com.microsoft.azure.management.eventhub.v2018_01_01_preview.VirtualNetworkRule; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.NetworkRuleSetInner; /** * Type representing Namespaces. @@ -103,4 +104,25 @@ public interface Namespaces extends SupportsCreating createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters); + + /** + * Gets NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable for the request + */ + Observable getNetworkRuleSetAsync(String resourceGroupName, String namespaceName); + } diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleIPAction.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleIPAction.java new file mode 100644 index 0000000000000..007eccc43f24f --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleIPAction.java @@ -0,0 +1,38 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import java.util.Collection; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.microsoft.rest.ExpandableStringEnum; + +/** + * Defines values for NetworkRuleIPAction. + */ +public final class NetworkRuleIPAction extends ExpandableStringEnum { + /** Static value Allow for NetworkRuleIPAction. */ + public static final NetworkRuleIPAction ALLOW = fromString("Allow"); + + /** + * Creates or finds a NetworkRuleIPAction from its string representation. + * @param name a name to look for + * @return the corresponding NetworkRuleIPAction + */ + @JsonCreator + public static NetworkRuleIPAction fromString(String name) { + return fromString(name, NetworkRuleIPAction.class); + } + + /** + * @return known NetworkRuleIPAction values + */ + public static Collection values() { + return values(NetworkRuleIPAction.class); + } +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleSet.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleSet.java new file mode 100644 index 0000000000000..2c0d133892d5e --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleSet.java @@ -0,0 +1,51 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.EventHubManager; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.NetworkRuleSetInner; +import java.util.List; + +/** + * Type representing NetworkRuleSet. + */ +public interface NetworkRuleSet extends HasInner, HasManager { + /** + * @return the defaultAction value. + */ + DefaultAction defaultAction(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the ipRules value. + */ + List ipRules(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the virtualNetworkRules value. + */ + List virtualNetworkRules(); + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleSets.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleSets.java new file mode 100644 index 0000000000000..d9d379f063081 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/NetworkRuleSets.java @@ -0,0 +1,51 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import com.microsoft.azure.arm.model.HasInner; +import com.microsoft.azure.arm.resources.models.HasManager; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.EventHubManager; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.implementation.NetworkRuleSetsInner; +import java.util.List; + +/** + * Type representing NetworkRuleSets. + */ +public interface NetworkRuleSets extends HasInner, HasManager { + /** + * @return the defaultAction value. + */ + DefaultAction defaultAction(); + + /** + * @return the id value. + */ + String id(); + + /** + * @return the ipRules value. + */ + List ipRules(); + + /** + * @return the name value. + */ + String name(); + + /** + * @return the type value. + */ + String type(); + + /** + * @return the virtualNetworkRules value. + */ + List virtualNetworkRules(); + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Subnet.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Subnet.java new file mode 100644 index 0000000000000..73766a300749a --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/Subnet.java @@ -0,0 +1,43 @@ +/** + * 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.eventhub.v2018_01_01_preview; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties supplied for Subnet. + */ +public class Subnet { + /** + * Resource ID of Virtual Network Subnet. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get resource ID of Virtual Network Subnet. + * + * @return the id value + */ + public String id() { + return this.id; + } + + /** + * Set resource ID of Virtual Network Subnet. + * + * @param id the id value to set + * @return the Subnet object itself. + */ + public Subnet withId(String id) { + this.id = id; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesImpl.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesImpl.java index a9547aef7b548..4c18803ec5d02 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesImpl.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesImpl.java @@ -24,6 +24,7 @@ import com.microsoft.azure.Page; import com.microsoft.azure.management.eventhub.v2018_01_01_preview.IpFilterRule; import com.microsoft.azure.management.eventhub.v2018_01_01_preview.VirtualNetworkRule; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NetworkRuleSet; class NamespacesImpl extends GroupableResourcesCoreImpl implements Namespaces { protected NamespacesImpl(EventHubManager manager) { @@ -251,4 +252,28 @@ public Completable deleteVirtualNetworkRuleAsync(String resourceGroupName, Strin return client.deleteVirtualNetworkRuleAsync(resourceGroupName, namespaceName, virtualNetworkRuleName).toCompletable(); } + @Override + public Observable createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { + NamespacesInner client = this.inner(); + return client.createOrUpdateNetworkRuleSetAsync(resourceGroupName, namespaceName, parameters) + .map(new Func1() { + @Override + public NetworkRuleSet call(NetworkRuleSetInner inner) { + return new NetworkRuleSetImpl(inner, manager()); + } + }); + } + + @Override + public Observable getNetworkRuleSetAsync(String resourceGroupName, String namespaceName) { + NamespacesInner client = this.inner(); + return client.getNetworkRuleSetAsync(resourceGroupName, namespaceName) + .map(new Func1() { + @Override + public NetworkRuleSet call(NetworkRuleSetInner inner) { + return new NetworkRuleSetImpl(inner, manager()); + } + }); + } + } diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesInner.java index d1707a6c63576..19417d46574aa 100644 --- a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesInner.java +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NamespacesInner.java @@ -129,6 +129,14 @@ interface NamespacesService { @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/virtualnetworkrules/{virtualNetworkRuleName}") Observable> getVirtualNetworkRule(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("virtualNetworkRuleName") String virtualNetworkRuleName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @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.eventhub.v2018_01_01_preview.Namespaces createOrUpdateNetworkRuleSet" }) + @PUT("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default") + Observable> createOrUpdateNetworkRuleSet(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @Body NetworkRuleSetInner 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.eventhub.v2018_01_01_preview.Namespaces getNetworkRuleSet" }) + @GET("subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets/default") + Observable> getNetworkRuleSet(@Path("resourceGroupName") String resourceGroupName, @Path("namespaceName") String namespaceName, @Path("subscriptionId") String subscriptionId, @Query("api-version") String apiVersion, @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.eventhub.v2018_01_01_preview.Namespaces listNext" }) @GET Observable> listNext(@Url String nextUrl, @Header("accept-language") String acceptLanguage, @Header("User-Agent") String userAgent); @@ -1787,6 +1795,186 @@ private ServiceResponse getVirtualNetworkRuleDelegate(R .build(response); } + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters The Namespace IpFilterRule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NetworkRuleSetInner object if successful. + */ + public NetworkRuleSetInner createOrUpdateNetworkRuleSet(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { + return createOrUpdateNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).toBlocking().single().body(); + } + + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters The Namespace IpFilterRule. + * @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 createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(createOrUpdateNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName, parameters), serviceCallback); + } + + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters The Namespace IpFilterRule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetworkRuleSetInner object + */ + public Observable createOrUpdateNetworkRuleSetAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { + return createOrUpdateNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName, parameters).map(new Func1, NetworkRuleSetInner>() { + @Override + public NetworkRuleSetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Create or update NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @param parameters The Namespace IpFilterRule. + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetworkRuleSetInner object + */ + public Observable> createOrUpdateNetworkRuleSetWithServiceResponseAsync(String resourceGroupName, String namespaceName, NetworkRuleSetInner parameters) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName 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.createOrUpdateNetworkRuleSet(resourceGroupName, namespaceName, 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 = createOrUpdateNetworkRuleSetDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse createOrUpdateNetworkRuleSetDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + + /** + * Gets NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @throws ErrorResponseException thrown if the request is rejected by server + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent + * @return the NetworkRuleSetInner object if successful. + */ + public NetworkRuleSetInner getNetworkRuleSet(String resourceGroupName, String namespaceName) { + return getNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName).toBlocking().single().body(); + } + + /** + * Gets NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @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 getNetworkRuleSetAsync(String resourceGroupName, String namespaceName, final ServiceCallback serviceCallback) { + return ServiceFuture.fromResponse(getNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName), serviceCallback); + } + + /** + * Gets NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetworkRuleSetInner object + */ + public Observable getNetworkRuleSetAsync(String resourceGroupName, String namespaceName) { + return getNetworkRuleSetWithServiceResponseAsync(resourceGroupName, namespaceName).map(new Func1, NetworkRuleSetInner>() { + @Override + public NetworkRuleSetInner call(ServiceResponse response) { + return response.body(); + } + }); + } + + /** + * Gets NetworkRuleSet for a Namespace. + * + * @param resourceGroupName Name of the resource group within the Azure subscription. + * @param namespaceName The Namespace name + * @throws IllegalArgumentException thrown if parameters fail the validation + * @return the observable to the NetworkRuleSetInner object + */ + public Observable> getNetworkRuleSetWithServiceResponseAsync(String resourceGroupName, String namespaceName) { + if (resourceGroupName == null) { + throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); + } + if (namespaceName == null) { + throw new IllegalArgumentException("Parameter namespaceName 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."); + } + return service.getNetworkRuleSet(resourceGroupName, namespaceName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) + .flatMap(new Func1, Observable>>() { + @Override + public Observable> call(Response response) { + try { + ServiceResponse clientResponse = getNetworkRuleSetDelegate(response); + return Observable.just(clientResponse); + } catch (Throwable t) { + return Observable.error(t); + } + } + }); + } + + private ServiceResponse getNetworkRuleSetDelegate(Response response) throws ErrorResponseException, IOException, IllegalArgumentException { + return this.client.restClient().responseBuilderFactory().newInstance(this.client.serializerAdapter()) + .register(200, new TypeToken() { }.getType()) + .registerError(ErrorResponseException.class) + .build(response); + } + /** * Lists all the available Namespaces within a subscription, irrespective of the resource groups. * diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetImpl.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetImpl.java new file mode 100644 index 0000000000000..93b0c1d6bfb93 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetImpl.java @@ -0,0 +1,60 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NetworkRuleSet; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.DefaultAction; +import java.util.List; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NWRuleSetIpRules; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NWRuleSetVirtualNetworkRules; + +class NetworkRuleSetImpl extends WrapperImpl implements NetworkRuleSet { + private final EventHubManager manager; + NetworkRuleSetImpl(NetworkRuleSetInner inner, EventHubManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public EventHubManager manager() { + return this.manager; + } + + @Override + public DefaultAction defaultAction() { + return this.inner().defaultAction(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List ipRules() { + return this.inner().ipRules(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public List virtualNetworkRules() { + return this.inner().virtualNetworkRules(); + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetInner.java new file mode 100644 index 0000000000000..ab6d0fa5645f8 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetInner.java @@ -0,0 +1,103 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.DefaultAction; +import java.util.List; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NWRuleSetVirtualNetworkRules; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NWRuleSetIpRules; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of topic resource. + */ +@JsonFlatten +public class NetworkRuleSetInner extends ProxyResource { + /** + * Default Action for Network Rule Set. Possible values include: 'Allow', + * 'Deny'. + */ + @JsonProperty(value = "properties.defaultAction") + private DefaultAction defaultAction; + + /** + * List VirtualNetwork Rules. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + + /** + * List of IpRules. + */ + @JsonProperty(value = "properties.ipRules") + private List ipRules; + + /** + * Get default Action for Network Rule Set. Possible values include: 'Allow', 'Deny'. + * + * @return the defaultAction value + */ + public DefaultAction defaultAction() { + return this.defaultAction; + } + + /** + * Set default Action for Network Rule Set. Possible values include: 'Allow', 'Deny'. + * + * @param defaultAction the defaultAction value to set + * @return the NetworkRuleSetInner object itself. + */ + public NetworkRuleSetInner withDefaultAction(DefaultAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get list VirtualNetwork Rules. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set list VirtualNetwork Rules. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the NetworkRuleSetInner object itself. + */ + public NetworkRuleSetInner withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get list of IpRules. + * + * @return the ipRules value + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set list of IpRules. + * + * @param ipRules the ipRules value to set + * @return the NetworkRuleSetInner object itself. + */ + public NetworkRuleSetInner withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetsImpl.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetsImpl.java new file mode 100644 index 0000000000000..9dd6895ba4463 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetsImpl.java @@ -0,0 +1,60 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NetworkRuleSets; +import com.microsoft.azure.arm.model.implementation.WrapperImpl; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.DefaultAction; +import java.util.List; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NWRuleSetIpRules; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NWRuleSetVirtualNetworkRules; + +class NetworkRuleSetsImpl extends WrapperImpl implements NetworkRuleSets { + private final EventHubManager manager; + NetworkRuleSetsImpl(NetworkRuleSetsInner inner, EventHubManager manager) { + super(inner); + this.manager = manager; + } + + @Override + public EventHubManager manager() { + return this.manager; + } + + @Override + public DefaultAction defaultAction() { + return this.inner().defaultAction(); + } + + @Override + public String id() { + return this.inner().id(); + } + + @Override + public List ipRules() { + return this.inner().ipRules(); + } + + @Override + public String name() { + return this.inner().name(); + } + + @Override + public String type() { + return this.inner().type(); + } + + @Override + public List virtualNetworkRules() { + return this.inner().virtualNetworkRules(); + } + +} diff --git a/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetsInner.java b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetsInner.java new file mode 100644 index 0000000000000..e5777f902a843 --- /dev/null +++ b/eventhub/resource-manager/v2018_01_01_preview/src/main/java/com/microsoft/azure/management/eventhub/v2018_01_01_preview/implementation/NetworkRuleSetsInner.java @@ -0,0 +1,103 @@ +/** + * 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.eventhub.v2018_01_01_preview.implementation; + +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.DefaultAction; +import java.util.List; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NWRuleSetVirtualNetworkRules; +import com.microsoft.azure.management.eventhub.v2018_01_01_preview.NWRuleSetIpRules; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.microsoft.rest.serializer.JsonFlatten; +import com.microsoft.azure.ProxyResource; + +/** + * Description of topic resource. + */ +@JsonFlatten +public class NetworkRuleSetsInner extends ProxyResource { + /** + * Default Action for Network Rule Set. Possible values include: 'Allow', + * 'Deny'. + */ + @JsonProperty(value = "properties.defaultAction") + private DefaultAction defaultAction; + + /** + * List VirtualNetwork Rules. + */ + @JsonProperty(value = "properties.virtualNetworkRules") + private List virtualNetworkRules; + + /** + * List of IpRules. + */ + @JsonProperty(value = "properties.ipRules") + private List ipRules; + + /** + * Get default Action for Network Rule Set. Possible values include: 'Allow', 'Deny'. + * + * @return the defaultAction value + */ + public DefaultAction defaultAction() { + return this.defaultAction; + } + + /** + * Set default Action for Network Rule Set. Possible values include: 'Allow', 'Deny'. + * + * @param defaultAction the defaultAction value to set + * @return the NetworkRuleSetsInner object itself. + */ + public NetworkRuleSetsInner withDefaultAction(DefaultAction defaultAction) { + this.defaultAction = defaultAction; + return this; + } + + /** + * Get list VirtualNetwork Rules. + * + * @return the virtualNetworkRules value + */ + public List virtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** + * Set list VirtualNetwork Rules. + * + * @param virtualNetworkRules the virtualNetworkRules value to set + * @return the NetworkRuleSetsInner object itself. + */ + public NetworkRuleSetsInner withVirtualNetworkRules(List virtualNetworkRules) { + this.virtualNetworkRules = virtualNetworkRules; + return this; + } + + /** + * Get list of IpRules. + * + * @return the ipRules value + */ + public List ipRules() { + return this.ipRules; + } + + /** + * Set list of IpRules. + * + * @param ipRules the ipRules value to set + * @return the NetworkRuleSetsInner object itself. + */ + public NetworkRuleSetsInner withIpRules(List ipRules) { + this.ipRules = ipRules; + return this; + } + +}