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

com.azure.resourcemanager.sql.models.NetworkIsolationSettings Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Sql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

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

package com.azure.resourcemanager.sql.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * Contains the ARM resources for which to create private endpoint connection.
 */
@Fluent
public final class NetworkIsolationSettings implements JsonSerializable {
    /*
     * The resource id for the storage account used to store BACPAC file. If set, private endpoint connection will be
     * created for the storage account. Must match storage account used for StorageUri parameter.
     */
    private String storageAccountResourceId;

    /*
     * The resource id for the SQL server which is the target of this request. If set, private endpoint connection will
     * be created for the SQL server. Must match server which is target of the operation.
     */
    private String sqlServerResourceId;

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

    /**
     * Get the storageAccountResourceId property: The resource id for the storage account used to store BACPAC file. If
     * set, private endpoint connection will be created for the storage account. Must match storage account used for
     * StorageUri parameter.
     * 
     * @return the storageAccountResourceId value.
     */
    public String storageAccountResourceId() {
        return this.storageAccountResourceId;
    }

    /**
     * Set the storageAccountResourceId property: The resource id for the storage account used to store BACPAC file. If
     * set, private endpoint connection will be created for the storage account. Must match storage account used for
     * StorageUri parameter.
     * 
     * @param storageAccountResourceId the storageAccountResourceId value to set.
     * @return the NetworkIsolationSettings object itself.
     */
    public NetworkIsolationSettings withStorageAccountResourceId(String storageAccountResourceId) {
        this.storageAccountResourceId = storageAccountResourceId;
        return this;
    }

    /**
     * Get the sqlServerResourceId property: The resource id for the SQL server which is the target of this request. If
     * set, private endpoint connection will be created for the SQL server. Must match server which is target of the
     * operation.
     * 
     * @return the sqlServerResourceId value.
     */
    public String sqlServerResourceId() {
        return this.sqlServerResourceId;
    }

    /**
     * Set the sqlServerResourceId property: The resource id for the SQL server which is the target of this request. If
     * set, private endpoint connection will be created for the SQL server. Must match server which is target of the
     * operation.
     * 
     * @param sqlServerResourceId the sqlServerResourceId value to set.
     * @return the NetworkIsolationSettings object itself.
     */
    public NetworkIsolationSettings withSqlServerResourceId(String sqlServerResourceId) {
        this.sqlServerResourceId = sqlServerResourceId;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("storageAccountResourceId", this.storageAccountResourceId);
        jsonWriter.writeStringField("sqlServerResourceId", this.sqlServerResourceId);
        return jsonWriter.writeEndObject();
    }

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

                if ("storageAccountResourceId".equals(fieldName)) {
                    deserializedNetworkIsolationSettings.storageAccountResourceId = reader.getString();
                } else if ("sqlServerResourceId".equals(fieldName)) {
                    deserializedNetworkIsolationSettings.sqlServerResourceId = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedNetworkIsolationSettings;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy