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

com.azure.resourcemanager.deviceupdate.models.PrivateLinkServiceConnection 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.deviceupdate.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;
import java.util.List;

/**
 * Private link service connection details.
 */
@Fluent
public final class PrivateLinkServiceConnection implements JsonSerializable {
    /*
     * Private link service connection name.
     */
    private String name;

    /*
     * List of group IDs.
     */
    private List groupIds;

    /*
     * Request message.
     */
    private String requestMessage;

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

    /**
     * Get the name property: Private link service connection name.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Private link service connection name.
     * 
     * @param name the name value to set.
     * @return the PrivateLinkServiceConnection object itself.
     */
    public PrivateLinkServiceConnection withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the groupIds property: List of group IDs.
     * 
     * @return the groupIds value.
     */
    public List groupIds() {
        return this.groupIds;
    }

    /**
     * Set the groupIds property: List of group IDs.
     * 
     * @param groupIds the groupIds value to set.
     * @return the PrivateLinkServiceConnection object itself.
     */
    public PrivateLinkServiceConnection withGroupIds(List groupIds) {
        this.groupIds = groupIds;
        return this;
    }

    /**
     * Get the requestMessage property: Request message.
     * 
     * @return the requestMessage value.
     */
    public String requestMessage() {
        return this.requestMessage;
    }

    /**
     * Set the requestMessage property: Request message.
     * 
     * @param requestMessage the requestMessage value to set.
     * @return the PrivateLinkServiceConnection object itself.
     */
    public PrivateLinkServiceConnection withRequestMessage(String requestMessage) {
        this.requestMessage = requestMessage;
        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("name", this.name);
        jsonWriter.writeArrayField("groupIds", this.groupIds, (writer, element) -> writer.writeString(element));
        jsonWriter.writeStringField("requestMessage", this.requestMessage);
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedPrivateLinkServiceConnection.name = reader.getString();
                } else if ("groupIds".equals(fieldName)) {
                    List groupIds = reader.readArray(reader1 -> reader1.getString());
                    deserializedPrivateLinkServiceConnection.groupIds = groupIds;
                } else if ("requestMessage".equals(fieldName)) {
                    deserializedPrivateLinkServiceConnection.requestMessage = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedPrivateLinkServiceConnection;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy