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

com.azure.resourcemanager.relay.fluent.models.HybridConnectionProperties 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.relay.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
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.time.OffsetDateTime;

/**
 * Properties of the HybridConnection.
 */
@Fluent
public final class HybridConnectionProperties implements JsonSerializable {
    /*
     * The time the hybrid connection was created.
     */
    private OffsetDateTime createdAt;

    /*
     * The time the namespace was updated.
     */
    private OffsetDateTime updatedAt;

    /*
     * The number of listeners for this hybrid connection. Note that min : 1 and max:25 are supported.
     */
    private Integer listenerCount;

    /*
     * Returns true if client authorization is needed for this hybrid connection; otherwise, false.
     */
    private Boolean requiresClientAuthorization;

    /*
     * The usermetadata is a placeholder to store user-defined string data for the hybrid connection endpoint. For
     * example, it can be used to store descriptive data, such as a list of teams and their contact information. Also,
     * user-defined configuration settings can be stored.
     */
    private String userMetadata;

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

    /**
     * Get the createdAt property: The time the hybrid connection was created.
     * 
     * @return the createdAt value.
     */
    public OffsetDateTime createdAt() {
        return this.createdAt;
    }

    /**
     * Get the updatedAt property: The time the namespace was updated.
     * 
     * @return the updatedAt value.
     */
    public OffsetDateTime updatedAt() {
        return this.updatedAt;
    }

    /**
     * Get the listenerCount property: The number of listeners for this hybrid connection. Note that min : 1 and max:25
     * are supported.
     * 
     * @return the listenerCount value.
     */
    public Integer listenerCount() {
        return this.listenerCount;
    }

    /**
     * Get the requiresClientAuthorization property: Returns true if client authorization is needed for this hybrid
     * connection; otherwise, false.
     * 
     * @return the requiresClientAuthorization value.
     */
    public Boolean requiresClientAuthorization() {
        return this.requiresClientAuthorization;
    }

    /**
     * Set the requiresClientAuthorization property: Returns true if client authorization is needed for this hybrid
     * connection; otherwise, false.
     * 
     * @param requiresClientAuthorization the requiresClientAuthorization value to set.
     * @return the HybridConnectionProperties object itself.
     */
    public HybridConnectionProperties withRequiresClientAuthorization(Boolean requiresClientAuthorization) {
        this.requiresClientAuthorization = requiresClientAuthorization;
        return this;
    }

    /**
     * Get the userMetadata property: The usermetadata is a placeholder to store user-defined string data for the hybrid
     * connection endpoint. For example, it can be used to store descriptive data, such as a list of teams and their
     * contact information. Also, user-defined configuration settings can be stored.
     * 
     * @return the userMetadata value.
     */
    public String userMetadata() {
        return this.userMetadata;
    }

    /**
     * Set the userMetadata property: The usermetadata is a placeholder to store user-defined string data for the hybrid
     * connection endpoint. For example, it can be used to store descriptive data, such as a list of teams and their
     * contact information. Also, user-defined configuration settings can be stored.
     * 
     * @param userMetadata the userMetadata value to set.
     * @return the HybridConnectionProperties object itself.
     */
    public HybridConnectionProperties withUserMetadata(String userMetadata) {
        this.userMetadata = userMetadata;
        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.writeBooleanField("requiresClientAuthorization", this.requiresClientAuthorization);
        jsonWriter.writeStringField("userMetadata", this.userMetadata);
        return jsonWriter.writeEndObject();
    }

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

                if ("createdAt".equals(fieldName)) {
                    deserializedHybridConnectionProperties.createdAt = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("updatedAt".equals(fieldName)) {
                    deserializedHybridConnectionProperties.updatedAt = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("listenerCount".equals(fieldName)) {
                    deserializedHybridConnectionProperties.listenerCount = reader.getNullable(JsonReader::getInt);
                } else if ("requiresClientAuthorization".equals(fieldName)) {
                    deserializedHybridConnectionProperties.requiresClientAuthorization
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("userMetadata".equals(fieldName)) {
                    deserializedHybridConnectionProperties.userMetadata = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedHybridConnectionProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy