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

com.azure.resourcemanager.eventhubs.fluent.models.EHNamespaceProperties 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.eventhubs.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 com.azure.resourcemanager.eventhubs.models.Encryption;
import com.azure.resourcemanager.eventhubs.models.PublicNetworkAccess;
import com.azure.resourcemanager.eventhubs.models.TlsVersion;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * Namespace properties supplied for create namespace operation.
 */
@Fluent
public final class EHNamespaceProperties implements JsonSerializable {
    /*
     * The minimum TLS version for the cluster to support, e.g. '1.2'
     */
    private TlsVersion minimumTlsVersion;

    /*
     * Provisioning state of the Namespace.
     */
    private String provisioningState;

    /*
     * Status of the Namespace.
     */
    private String status;

    /*
     * The time the Namespace was created.
     */
    private OffsetDateTime createdAt;

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

    /*
     * Endpoint you can use to perform Service Bus operations.
     */
    private String serviceBusEndpoint;

    /*
     * Cluster ARM ID of the Namespace.
     */
    private String clusterArmId;

    /*
     * Identifier for Azure Insights metrics.
     */
    private String metricId;

    /*
     * Value that indicates whether AutoInflate is enabled for eventhub namespace.
     */
    private Boolean isAutoInflateEnabled;

    /*
     * This determines if traffic is allowed over public network. By default it is enabled.
     */
    private PublicNetworkAccess publicNetworkAccess;

    /*
     * Upper limit of throughput units when AutoInflate is enabled, value should be within 0 to 20 throughput units. (
     * '0' if AutoInflateEnabled = true)
     */
    private Integer maximumThroughputUnits;

    /*
     * Value that indicates whether Kafka is enabled for eventhub namespace.
     */
    private Boolean kafkaEnabled;

    /*
     * Enabling this property creates a Standard Event Hubs Namespace in regions supported availability zones.
     */
    private Boolean zoneRedundant;

    /*
     * Properties of BYOK Encryption description
     */
    private Encryption encryption;

    /*
     * List of private endpoint connections.
     */
    private List privateEndpointConnections;

    /*
     * This property disables SAS authentication for the Event Hubs namespace.
     */
    private Boolean disableLocalAuth;

    /*
     * Alternate name specified when alias and namespace names are same.
     */
    private String alternateName;

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

    /**
     * Get the minimumTlsVersion property: The minimum TLS version for the cluster to support, e.g. '1.2'.
     * 
     * @return the minimumTlsVersion value.
     */
    public TlsVersion minimumTlsVersion() {
        return this.minimumTlsVersion;
    }

    /**
     * Set the minimumTlsVersion property: The minimum TLS version for the cluster to support, e.g. '1.2'.
     * 
     * @param minimumTlsVersion the minimumTlsVersion value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withMinimumTlsVersion(TlsVersion minimumTlsVersion) {
        this.minimumTlsVersion = minimumTlsVersion;
        return this;
    }

    /**
     * Get the provisioningState property: Provisioning state of the Namespace.
     * 
     * @return the provisioningState value.
     */
    public String provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the status property: Status of the Namespace.
     * 
     * @return the status value.
     */
    public String status() {
        return this.status;
    }

    /**
     * Get the createdAt property: The time the Namespace 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 serviceBusEndpoint property: Endpoint you can use to perform Service Bus operations.
     * 
     * @return the serviceBusEndpoint value.
     */
    public String serviceBusEndpoint() {
        return this.serviceBusEndpoint;
    }

    /**
     * Get the clusterArmId property: Cluster ARM ID of the Namespace.
     * 
     * @return the clusterArmId value.
     */
    public String clusterArmId() {
        return this.clusterArmId;
    }

    /**
     * Set the clusterArmId property: Cluster ARM ID of the Namespace.
     * 
     * @param clusterArmId the clusterArmId value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withClusterArmId(String clusterArmId) {
        this.clusterArmId = clusterArmId;
        return this;
    }

    /**
     * Get the metricId property: Identifier for Azure Insights metrics.
     * 
     * @return the metricId value.
     */
    public String metricId() {
        return this.metricId;
    }

    /**
     * Get the isAutoInflateEnabled property: Value that indicates whether AutoInflate is enabled for eventhub
     * namespace.
     * 
     * @return the isAutoInflateEnabled value.
     */
    public Boolean isAutoInflateEnabled() {
        return this.isAutoInflateEnabled;
    }

    /**
     * Set the isAutoInflateEnabled property: Value that indicates whether AutoInflate is enabled for eventhub
     * namespace.
     * 
     * @param isAutoInflateEnabled the isAutoInflateEnabled value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withIsAutoInflateEnabled(Boolean isAutoInflateEnabled) {
        this.isAutoInflateEnabled = isAutoInflateEnabled;
        return this;
    }

    /**
     * Get the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is
     * enabled.
     * 
     * @return the publicNetworkAccess value.
     */
    public PublicNetworkAccess publicNetworkAccess() {
        return this.publicNetworkAccess;
    }

    /**
     * Set the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is
     * enabled.
     * 
     * @param publicNetworkAccess the publicNetworkAccess value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) {
        this.publicNetworkAccess = publicNetworkAccess;
        return this;
    }

    /**
     * Get the maximumThroughputUnits property: Upper limit of throughput units when AutoInflate is enabled, value
     * should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = true).
     * 
     * @return the maximumThroughputUnits value.
     */
    public Integer maximumThroughputUnits() {
        return this.maximumThroughputUnits;
    }

    /**
     * Set the maximumThroughputUnits property: Upper limit of throughput units when AutoInflate is enabled, value
     * should be within 0 to 20 throughput units. ( '0' if AutoInflateEnabled = true).
     * 
     * @param maximumThroughputUnits the maximumThroughputUnits value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withMaximumThroughputUnits(Integer maximumThroughputUnits) {
        this.maximumThroughputUnits = maximumThroughputUnits;
        return this;
    }

    /**
     * Get the kafkaEnabled property: Value that indicates whether Kafka is enabled for eventhub namespace.
     * 
     * @return the kafkaEnabled value.
     */
    public Boolean kafkaEnabled() {
        return this.kafkaEnabled;
    }

    /**
     * Set the kafkaEnabled property: Value that indicates whether Kafka is enabled for eventhub namespace.
     * 
     * @param kafkaEnabled the kafkaEnabled value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withKafkaEnabled(Boolean kafkaEnabled) {
        this.kafkaEnabled = kafkaEnabled;
        return this;
    }

    /**
     * Get the zoneRedundant property: Enabling this property creates a Standard Event Hubs Namespace in regions
     * supported availability zones.
     * 
     * @return the zoneRedundant value.
     */
    public Boolean zoneRedundant() {
        return this.zoneRedundant;
    }

    /**
     * Set the zoneRedundant property: Enabling this property creates a Standard Event Hubs Namespace in regions
     * supported availability zones.
     * 
     * @param zoneRedundant the zoneRedundant value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withZoneRedundant(Boolean zoneRedundant) {
        this.zoneRedundant = zoneRedundant;
        return this;
    }

    /**
     * Get the encryption property: Properties of BYOK Encryption description.
     * 
     * @return the encryption value.
     */
    public Encryption encryption() {
        return this.encryption;
    }

    /**
     * Set the encryption property: Properties of BYOK Encryption description.
     * 
     * @param encryption the encryption value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withEncryption(Encryption encryption) {
        this.encryption = encryption;
        return this;
    }

    /**
     * Get the privateEndpointConnections property: List of private endpoint connections.
     * 
     * @return the privateEndpointConnections value.
     */
    public List privateEndpointConnections() {
        return this.privateEndpointConnections;
    }

    /**
     * Set the privateEndpointConnections property: List of private endpoint connections.
     * 
     * @param privateEndpointConnections the privateEndpointConnections value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties
        withPrivateEndpointConnections(List privateEndpointConnections) {
        this.privateEndpointConnections = privateEndpointConnections;
        return this;
    }

    /**
     * Get the disableLocalAuth property: This property disables SAS authentication for the Event Hubs namespace.
     * 
     * @return the disableLocalAuth value.
     */
    public Boolean disableLocalAuth() {
        return this.disableLocalAuth;
    }

    /**
     * Set the disableLocalAuth property: This property disables SAS authentication for the Event Hubs namespace.
     * 
     * @param disableLocalAuth the disableLocalAuth value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withDisableLocalAuth(Boolean disableLocalAuth) {
        this.disableLocalAuth = disableLocalAuth;
        return this;
    }

    /**
     * Get the alternateName property: Alternate name specified when alias and namespace names are same.
     * 
     * @return the alternateName value.
     */
    public String alternateName() {
        return this.alternateName;
    }

    /**
     * Set the alternateName property: Alternate name specified when alias and namespace names are same.
     * 
     * @param alternateName the alternateName value to set.
     * @return the EHNamespaceProperties object itself.
     */
    public EHNamespaceProperties withAlternateName(String alternateName) {
        this.alternateName = alternateName;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (encryption() != null) {
            encryption().validate();
        }
        if (privateEndpointConnections() != null) {
            privateEndpointConnections().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("minimumTlsVersion",
            this.minimumTlsVersion == null ? null : this.minimumTlsVersion.toString());
        jsonWriter.writeStringField("clusterArmId", this.clusterArmId);
        jsonWriter.writeBooleanField("isAutoInflateEnabled", this.isAutoInflateEnabled);
        jsonWriter.writeStringField("publicNetworkAccess",
            this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString());
        jsonWriter.writeNumberField("maximumThroughputUnits", this.maximumThroughputUnits);
        jsonWriter.writeBooleanField("kafkaEnabled", this.kafkaEnabled);
        jsonWriter.writeBooleanField("zoneRedundant", this.zoneRedundant);
        jsonWriter.writeJsonField("encryption", this.encryption);
        jsonWriter.writeArrayField("privateEndpointConnections", this.privateEndpointConnections,
            (writer, element) -> writer.writeJson(element));
        jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth);
        jsonWriter.writeStringField("alternateName", this.alternateName);
        return jsonWriter.writeEndObject();
    }

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

                if ("minimumTlsVersion".equals(fieldName)) {
                    deserializedEHNamespaceProperties.minimumTlsVersion = TlsVersion.fromString(reader.getString());
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedEHNamespaceProperties.provisioningState = reader.getString();
                } else if ("status".equals(fieldName)) {
                    deserializedEHNamespaceProperties.status = reader.getString();
                } else if ("createdAt".equals(fieldName)) {
                    deserializedEHNamespaceProperties.createdAt = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("updatedAt".equals(fieldName)) {
                    deserializedEHNamespaceProperties.updatedAt = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("serviceBusEndpoint".equals(fieldName)) {
                    deserializedEHNamespaceProperties.serviceBusEndpoint = reader.getString();
                } else if ("clusterArmId".equals(fieldName)) {
                    deserializedEHNamespaceProperties.clusterArmId = reader.getString();
                } else if ("metricId".equals(fieldName)) {
                    deserializedEHNamespaceProperties.metricId = reader.getString();
                } else if ("isAutoInflateEnabled".equals(fieldName)) {
                    deserializedEHNamespaceProperties.isAutoInflateEnabled = reader.getNullable(JsonReader::getBoolean);
                } else if ("publicNetworkAccess".equals(fieldName)) {
                    deserializedEHNamespaceProperties.publicNetworkAccess
                        = PublicNetworkAccess.fromString(reader.getString());
                } else if ("maximumThroughputUnits".equals(fieldName)) {
                    deserializedEHNamespaceProperties.maximumThroughputUnits = reader.getNullable(JsonReader::getInt);
                } else if ("kafkaEnabled".equals(fieldName)) {
                    deserializedEHNamespaceProperties.kafkaEnabled = reader.getNullable(JsonReader::getBoolean);
                } else if ("zoneRedundant".equals(fieldName)) {
                    deserializedEHNamespaceProperties.zoneRedundant = reader.getNullable(JsonReader::getBoolean);
                } else if ("encryption".equals(fieldName)) {
                    deserializedEHNamespaceProperties.encryption = Encryption.fromJson(reader);
                } else if ("privateEndpointConnections".equals(fieldName)) {
                    List privateEndpointConnections
                        = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1));
                    deserializedEHNamespaceProperties.privateEndpointConnections = privateEndpointConnections;
                } else if ("disableLocalAuth".equals(fieldName)) {
                    deserializedEHNamespaceProperties.disableLocalAuth = reader.getNullable(JsonReader::getBoolean);
                } else if ("alternateName".equals(fieldName)) {
                    deserializedEHNamespaceProperties.alternateName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEHNamespaceProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy