All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.databricks.fluent.models.VirtualNetworkPeeringInner Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.databricks.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.databricks.models.AddressSpace;
import com.azure.resourcemanager.databricks.models.PeeringProvisioningState;
import com.azure.resourcemanager.databricks.models.PeeringState;
import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork;
import com.azure.resourcemanager.databricks.models.VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork;
import java.io.IOException;

/**
 * Peerings in a VirtualNetwork resource.
 */
@Fluent
public final class VirtualNetworkPeeringInner extends ProxyResource {
    /*
     * List of properties for vNet Peering
     */
    private VirtualNetworkPeeringPropertiesFormat innerProperties = new VirtualNetworkPeeringPropertiesFormat();

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

    /**
     * Creates an instance of VirtualNetworkPeeringInner class.
     */
    public VirtualNetworkPeeringInner() {
    }

    /**
     * Get the innerProperties property: List of properties for vNet Peering.
     * 
     * @return the innerProperties value.
     */
    private VirtualNetworkPeeringPropertiesFormat innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the allowVirtualNetworkAccess property: Whether the VMs in the local virtual network space would be able to
     * access the VMs in remote virtual network space.
     * 
     * @return the allowVirtualNetworkAccess value.
     */
    public Boolean allowVirtualNetworkAccess() {
        return this.innerProperties() == null ? null : this.innerProperties().allowVirtualNetworkAccess();
    }

    /**
     * Set the allowVirtualNetworkAccess property: Whether the VMs in the local virtual network space would be able to
     * access the VMs in remote virtual network space.
     * 
     * @param allowVirtualNetworkAccess the allowVirtualNetworkAccess value to set.
     * @return the VirtualNetworkPeeringInner object itself.
     */
    public VirtualNetworkPeeringInner withAllowVirtualNetworkAccess(Boolean allowVirtualNetworkAccess) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkPeeringPropertiesFormat();
        }
        this.innerProperties().withAllowVirtualNetworkAccess(allowVirtualNetworkAccess);
        return this;
    }

    /**
     * Get the allowForwardedTraffic property: Whether the forwarded traffic from the VMs in the local virtual network
     * will be allowed/disallowed in remote virtual network.
     * 
     * @return the allowForwardedTraffic value.
     */
    public Boolean allowForwardedTraffic() {
        return this.innerProperties() == null ? null : this.innerProperties().allowForwardedTraffic();
    }

    /**
     * Set the allowForwardedTraffic property: Whether the forwarded traffic from the VMs in the local virtual network
     * will be allowed/disallowed in remote virtual network.
     * 
     * @param allowForwardedTraffic the allowForwardedTraffic value to set.
     * @return the VirtualNetworkPeeringInner object itself.
     */
    public VirtualNetworkPeeringInner withAllowForwardedTraffic(Boolean allowForwardedTraffic) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkPeeringPropertiesFormat();
        }
        this.innerProperties().withAllowForwardedTraffic(allowForwardedTraffic);
        return this;
    }

    /**
     * Get the allowGatewayTransit property: If gateway links can be used in remote virtual networking to link to this
     * virtual network.
     * 
     * @return the allowGatewayTransit value.
     */
    public Boolean allowGatewayTransit() {
        return this.innerProperties() == null ? null : this.innerProperties().allowGatewayTransit();
    }

    /**
     * Set the allowGatewayTransit property: If gateway links can be used in remote virtual networking to link to this
     * virtual network.
     * 
     * @param allowGatewayTransit the allowGatewayTransit value to set.
     * @return the VirtualNetworkPeeringInner object itself.
     */
    public VirtualNetworkPeeringInner withAllowGatewayTransit(Boolean allowGatewayTransit) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkPeeringPropertiesFormat();
        }
        this.innerProperties().withAllowGatewayTransit(allowGatewayTransit);
        return this;
    }

    /**
     * Get the useRemoteGateways property: If remote gateways can be used on this virtual network. If the flag is set to
     * true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual
     * network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network
     * already has a gateway.
     * 
     * @return the useRemoteGateways value.
     */
    public Boolean useRemoteGateways() {
        return this.innerProperties() == null ? null : this.innerProperties().useRemoteGateways();
    }

    /**
     * Set the useRemoteGateways property: If remote gateways can be used on this virtual network. If the flag is set to
     * true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual
     * network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network
     * already has a gateway.
     * 
     * @param useRemoteGateways the useRemoteGateways value to set.
     * @return the VirtualNetworkPeeringInner object itself.
     */
    public VirtualNetworkPeeringInner withUseRemoteGateways(Boolean useRemoteGateways) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkPeeringPropertiesFormat();
        }
        this.innerProperties().withUseRemoteGateways(useRemoteGateways);
        return this;
    }

    /**
     * Get the databricksVirtualNetwork property: The remote virtual network should be in the same region. See here to
     * learn more
     * (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering).
     * 
     * @return the databricksVirtualNetwork value.
     */
    public VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork databricksVirtualNetwork() {
        return this.innerProperties() == null ? null : this.innerProperties().databricksVirtualNetwork();
    }

    /**
     * Set the databricksVirtualNetwork property: The remote virtual network should be in the same region. See here to
     * learn more
     * (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering).
     * 
     * @param databricksVirtualNetwork the databricksVirtualNetwork value to set.
     * @return the VirtualNetworkPeeringInner object itself.
     */
    public VirtualNetworkPeeringInner withDatabricksVirtualNetwork(
        VirtualNetworkPeeringPropertiesFormatDatabricksVirtualNetwork databricksVirtualNetwork) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkPeeringPropertiesFormat();
        }
        this.innerProperties().withDatabricksVirtualNetwork(databricksVirtualNetwork);
        return this;
    }

    /**
     * Get the databricksAddressSpace property: The reference to the databricks virtual network address space.
     * 
     * @return the databricksAddressSpace value.
     */
    public AddressSpace databricksAddressSpace() {
        return this.innerProperties() == null ? null : this.innerProperties().databricksAddressSpace();
    }

    /**
     * Set the databricksAddressSpace property: The reference to the databricks virtual network address space.
     * 
     * @param databricksAddressSpace the databricksAddressSpace value to set.
     * @return the VirtualNetworkPeeringInner object itself.
     */
    public VirtualNetworkPeeringInner withDatabricksAddressSpace(AddressSpace databricksAddressSpace) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkPeeringPropertiesFormat();
        }
        this.innerProperties().withDatabricksAddressSpace(databricksAddressSpace);
        return this;
    }

    /**
     * Get the remoteVirtualNetwork property: The remote virtual network should be in the same region. See here to learn
     * more
     * (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering).
     * 
     * @return the remoteVirtualNetwork value.
     */
    public VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork remoteVirtualNetwork() {
        return this.innerProperties() == null ? null : this.innerProperties().remoteVirtualNetwork();
    }

    /**
     * Set the remoteVirtualNetwork property: The remote virtual network should be in the same region. See here to learn
     * more
     * (https://docs.microsoft.com/en-us/azure/databricks/administration-guide/cloud-configurations/azure/vnet-peering).
     * 
     * @param remoteVirtualNetwork the remoteVirtualNetwork value to set.
     * @return the VirtualNetworkPeeringInner object itself.
     */
    public VirtualNetworkPeeringInner
        withRemoteVirtualNetwork(VirtualNetworkPeeringPropertiesFormatRemoteVirtualNetwork remoteVirtualNetwork) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkPeeringPropertiesFormat();
        }
        this.innerProperties().withRemoteVirtualNetwork(remoteVirtualNetwork);
        return this;
    }

    /**
     * Get the remoteAddressSpace property: The reference to the remote virtual network address space.
     * 
     * @return the remoteAddressSpace value.
     */
    public AddressSpace remoteAddressSpace() {
        return this.innerProperties() == null ? null : this.innerProperties().remoteAddressSpace();
    }

    /**
     * Set the remoteAddressSpace property: The reference to the remote virtual network address space.
     * 
     * @param remoteAddressSpace the remoteAddressSpace value to set.
     * @return the VirtualNetworkPeeringInner object itself.
     */
    public VirtualNetworkPeeringInner withRemoteAddressSpace(AddressSpace remoteAddressSpace) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VirtualNetworkPeeringPropertiesFormat();
        }
        this.innerProperties().withRemoteAddressSpace(remoteAddressSpace);
        return this;
    }

    /**
     * Get the peeringState property: The status of the virtual network peering.
     * 
     * @return the peeringState value.
     */
    public PeeringState peeringState() {
        return this.innerProperties() == null ? null : this.innerProperties().peeringState();
    }

    /**
     * Get the provisioningState property: The provisioning state of the virtual network peering resource.
     * 
     * @return the provisioningState value.
     */
    public PeeringProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property innerProperties in model VirtualNetworkPeeringInner"));
        } else {
            innerProperties().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkPeeringInner.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of VirtualNetworkPeeringInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of VirtualNetworkPeeringInner if the JsonReader was pointing to an instance of it, or null if
     * it was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the VirtualNetworkPeeringInner.
     */
    public static VirtualNetworkPeeringInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            VirtualNetworkPeeringInner deserializedVirtualNetworkPeeringInner = new VirtualNetworkPeeringInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedVirtualNetworkPeeringInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedVirtualNetworkPeeringInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedVirtualNetworkPeeringInner.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedVirtualNetworkPeeringInner.innerProperties
                        = VirtualNetworkPeeringPropertiesFormat.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVirtualNetworkPeeringInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy