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

com.azure.resourcemanager.network.fluent.models.VpnSiteInner 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.network.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.management.Resource;
import com.azure.core.management.SubResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.network.models.AddressSpace;
import com.azure.resourcemanager.network.models.BgpSettings;
import com.azure.resourcemanager.network.models.DeviceProperties;
import com.azure.resourcemanager.network.models.O365PolicyProperties;
import com.azure.resourcemanager.network.models.ProvisioningState;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * VpnSite Resource.
 */
@Fluent
public final class VpnSiteInner extends Resource {
    /*
     * Properties of the VPN site.
     */
    private VpnSiteProperties innerProperties;

    /*
     * A unique read-only string that changes whenever the resource is updated.
     */
    private String etag;

    /*
     * Resource ID.
     */
    private String id;

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

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

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

    /**
     * Get the innerProperties property: Properties of the VPN site.
     * 
     * @return the innerProperties value.
     */
    private VpnSiteProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the etag property: A unique read-only string that changes whenever the resource is updated.
     * 
     * @return the etag value.
     */
    public String etag() {
        return this.etag;
    }

    /**
     * Get the id property: Resource ID.
     * 
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Set the id property: Resource ID.
     * 
     * @param id the id value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withId(String id) {
        this.id = id;
        return this;
    }

    /**
     * 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;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public VpnSiteInner withLocation(String location) {
        super.withLocation(location);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public VpnSiteInner withTags(Map tags) {
        super.withTags(tags);
        return this;
    }

    /**
     * Get the virtualWan property: The VirtualWAN to which the vpnSite belongs.
     * 
     * @return the virtualWan value.
     */
    public SubResource virtualWan() {
        return this.innerProperties() == null ? null : this.innerProperties().virtualWan();
    }

    /**
     * Set the virtualWan property: The VirtualWAN to which the vpnSite belongs.
     * 
     * @param virtualWan the virtualWan value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withVirtualWan(SubResource virtualWan) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withVirtualWan(virtualWan);
        return this;
    }

    /**
     * Get the deviceProperties property: The device properties.
     * 
     * @return the deviceProperties value.
     */
    public DeviceProperties deviceProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().deviceProperties();
    }

    /**
     * Set the deviceProperties property: The device properties.
     * 
     * @param deviceProperties the deviceProperties value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withDeviceProperties(DeviceProperties deviceProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withDeviceProperties(deviceProperties);
        return this;
    }

    /**
     * Get the ipAddress property: The ip-address for the vpn-site.
     * 
     * @return the ipAddress value.
     */
    public String ipAddress() {
        return this.innerProperties() == null ? null : this.innerProperties().ipAddress();
    }

    /**
     * Set the ipAddress property: The ip-address for the vpn-site.
     * 
     * @param ipAddress the ipAddress value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withIpAddress(String ipAddress) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withIpAddress(ipAddress);
        return this;
    }

    /**
     * Get the siteKey property: The key for vpn-site that can be used for connections.
     * 
     * @return the siteKey value.
     */
    public String siteKey() {
        return this.innerProperties() == null ? null : this.innerProperties().siteKey();
    }

    /**
     * Set the siteKey property: The key for vpn-site that can be used for connections.
     * 
     * @param siteKey the siteKey value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withSiteKey(String siteKey) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withSiteKey(siteKey);
        return this;
    }

    /**
     * Get the addressSpace property: The AddressSpace that contains an array of IP address ranges.
     * 
     * @return the addressSpace value.
     */
    public AddressSpace addressSpace() {
        return this.innerProperties() == null ? null : this.innerProperties().addressSpace();
    }

    /**
     * Set the addressSpace property: The AddressSpace that contains an array of IP address ranges.
     * 
     * @param addressSpace the addressSpace value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withAddressSpace(AddressSpace addressSpace) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withAddressSpace(addressSpace);
        return this;
    }

    /**
     * Get the bgpProperties property: The set of bgp properties.
     * 
     * @return the bgpProperties value.
     */
    public BgpSettings bgpProperties() {
        return this.innerProperties() == null ? null : this.innerProperties().bgpProperties();
    }

    /**
     * Set the bgpProperties property: The set of bgp properties.
     * 
     * @param bgpProperties the bgpProperties value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withBgpProperties(BgpSettings bgpProperties) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withBgpProperties(bgpProperties);
        return this;
    }

    /**
     * Get the provisioningState property: The provisioning state of the VPN site resource.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the isSecuritySite property: IsSecuritySite flag.
     * 
     * @return the isSecuritySite value.
     */
    public Boolean isSecuritySite() {
        return this.innerProperties() == null ? null : this.innerProperties().isSecuritySite();
    }

    /**
     * Set the isSecuritySite property: IsSecuritySite flag.
     * 
     * @param isSecuritySite the isSecuritySite value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withIsSecuritySite(Boolean isSecuritySite) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withIsSecuritySite(isSecuritySite);
        return this;
    }

    /**
     * Get the vpnSiteLinks property: List of all vpn site links.
     * 
     * @return the vpnSiteLinks value.
     */
    public List vpnSiteLinks() {
        return this.innerProperties() == null ? null : this.innerProperties().vpnSiteLinks();
    }

    /**
     * Set the vpnSiteLinks property: List of all vpn site links.
     * 
     * @param vpnSiteLinks the vpnSiteLinks value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withVpnSiteLinks(List vpnSiteLinks) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withVpnSiteLinks(vpnSiteLinks);
        return this;
    }

    /**
     * Get the o365Policy property: Office365 Policy.
     * 
     * @return the o365Policy value.
     */
    public O365PolicyProperties o365Policy() {
        return this.innerProperties() == null ? null : this.innerProperties().o365Policy();
    }

    /**
     * Set the o365Policy property: Office365 Policy.
     * 
     * @param o365Policy the o365Policy value to set.
     * @return the VpnSiteInner object itself.
     */
    public VpnSiteInner withO365Policy(O365PolicyProperties o365Policy) {
        if (this.innerProperties() == null) {
            this.innerProperties = new VpnSiteProperties();
        }
        this.innerProperties().withO365Policy(o365Policy);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("location", location());
        jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("properties", this.innerProperties);
        jsonWriter.writeStringField("id", this.id);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of VpnSiteInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of VpnSiteInner 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 VpnSiteInner.
     */
    public static VpnSiteInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            VpnSiteInner deserializedVpnSiteInner = new VpnSiteInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("name".equals(fieldName)) {
                    deserializedVpnSiteInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedVpnSiteInner.type = reader.getString();
                } else if ("location".equals(fieldName)) {
                    deserializedVpnSiteInner.withLocation(reader.getString());
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedVpnSiteInner.withTags(tags);
                } else if ("properties".equals(fieldName)) {
                    deserializedVpnSiteInner.innerProperties = VpnSiteProperties.fromJson(reader);
                } else if ("etag".equals(fieldName)) {
                    deserializedVpnSiteInner.etag = reader.getString();
                } else if ("id".equals(fieldName)) {
                    deserializedVpnSiteInner.id = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedVpnSiteInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy