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

com.azure.resourcemanager.servicelinker.models.ConfluentBootstrapServer 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.servicelinker.models;

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

/**
 * The service properties when target service type is ConfluentBootstrapServer.
 */
@Fluent
public final class ConfluentBootstrapServer extends TargetServiceBase {
    /*
     * The target service type.
     */
    private TargetServiceType type = TargetServiceType.CONFLUENT_BOOTSTRAP_SERVER;

    /*
     * The endpoint of service.
     */
    private String endpoint;

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

    /**
     * Get the type property: The target service type.
     * 
     * @return the type value.
     */
    @Override
    public TargetServiceType type() {
        return this.type;
    }

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

    /**
     * Set the endpoint property: The endpoint of service.
     * 
     * @param endpoint the endpoint value to set.
     * @return the ConfluentBootstrapServer object itself.
     */
    public ConfluentBootstrapServer withEndpoint(String endpoint) {
        this.endpoint = endpoint;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
        jsonWriter.writeStringField("endpoint", this.endpoint);
        return jsonWriter.writeEndObject();
    }

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

                if ("type".equals(fieldName)) {
                    deserializedConfluentBootstrapServer.type = TargetServiceType.fromString(reader.getString());
                } else if ("endpoint".equals(fieldName)) {
                    deserializedConfluentBootstrapServer.endpoint = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedConfluentBootstrapServer;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy