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

com.azure.resourcemanager.botservice.models.DirectLineSite Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for BotService Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Bot Service is a platform for creating smart conversational agents. Package tag package-2021-03-01.

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.botservice.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * A site for the Direct Line channel.
 */
@Fluent
public final class DirectLineSite extends Site {
    /*
     * Whether this site is token enabled for channel
     */
    private Boolean isTokenEnabled;

    /*
     * Secondary key. Value only returned through POST to the action Channel List API, otherwise empty.
     */
    private String key2;

    /*
     * Primary key. Value only returned through POST to the action Channel List API, otherwise empty.
     */
    private String key;

    /*
     * Site Id
     */
    private String siteId;

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

    /**
     * Get the isTokenEnabled property: Whether this site is token enabled for channel.
     * 
     * @return the isTokenEnabled value.
     */
    @Override
    public Boolean isTokenEnabled() {
        return this.isTokenEnabled;
    }

    /**
     * Get the key2 property: Secondary key. Value only returned through POST to the action Channel List API, otherwise
     * empty.
     * 
     * @return the key2 value.
     */
    @Override
    public String key2() {
        return this.key2;
    }

    /**
     * Get the key property: Primary key. Value only returned through POST to the action Channel List API, otherwise
     * empty.
     * 
     * @return the key value.
     */
    @Override
    public String key() {
        return this.key;
    }

    /**
     * Get the siteId property: Site Id.
     * 
     * @return the siteId value.
     */
    @Override
    public String siteId() {
        return this.siteId;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withTenantId(String tenantId) {
        super.withTenantId(tenantId);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withSiteName(String siteName) {
        super.withSiteName(siteName);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsEnabled(boolean isEnabled) {
        super.withIsEnabled(isEnabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsEndpointParametersEnabled(Boolean isEndpointParametersEnabled) {
        super.withIsEndpointParametersEnabled(isEndpointParametersEnabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsDetailedLoggingEnabled(Boolean isDetailedLoggingEnabled) {
        super.withIsDetailedLoggingEnabled(isDetailedLoggingEnabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsBlockUserUploadEnabled(Boolean isBlockUserUploadEnabled) {
        super.withIsBlockUserUploadEnabled(isBlockUserUploadEnabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsNoStorageEnabled(Boolean isNoStorageEnabled) {
        super.withIsNoStorageEnabled(isNoStorageEnabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withEtag(String etag) {
        super.withEtag(etag);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withAppId(String appId) {
        super.withAppId(appId);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsV1Enabled(Boolean isV1Enabled) {
        super.withIsV1Enabled(isV1Enabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsV3Enabled(Boolean isV3Enabled) {
        super.withIsV3Enabled(isV3Enabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsSecureSiteEnabled(Boolean isSecureSiteEnabled) {
        super.withIsSecureSiteEnabled(isSecureSiteEnabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withTrustedOrigins(List trustedOrigins) {
        super.withTrustedOrigins(trustedOrigins);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsWebChatSpeechEnabled(Boolean isWebChatSpeechEnabled) {
        super.withIsWebChatSpeechEnabled(isWebChatSpeechEnabled);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DirectLineSite withIsWebchatPreviewEnabled(Boolean isWebchatPreviewEnabled) {
        super.withIsWebchatPreviewEnabled(isWebchatPreviewEnabled);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (siteName() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property siteName in model DirectLineSite"));
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(DirectLineSite.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("siteName", siteName());
        jsonWriter.writeBooleanField("isEnabled", isEnabled());
        jsonWriter.writeStringField("tenantId", tenantId());
        jsonWriter.writeBooleanField("isEndpointParametersEnabled", isEndpointParametersEnabled());
        jsonWriter.writeBooleanField("isDetailedLoggingEnabled", isDetailedLoggingEnabled());
        jsonWriter.writeBooleanField("isBlockUserUploadEnabled", isBlockUserUploadEnabled());
        jsonWriter.writeBooleanField("isNoStorageEnabled", isNoStorageEnabled());
        jsonWriter.writeStringField("eTag", etag());
        jsonWriter.writeStringField("appId", appId());
        jsonWriter.writeBooleanField("isV1Enabled", isV1Enabled());
        jsonWriter.writeBooleanField("isV3Enabled", isV3Enabled());
        jsonWriter.writeBooleanField("isSecureSiteEnabled", isSecureSiteEnabled());
        jsonWriter.writeArrayField("trustedOrigins", trustedOrigins(),
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeBooleanField("isWebChatSpeechEnabled", isWebChatSpeechEnabled());
        jsonWriter.writeBooleanField("isWebchatPreviewEnabled", isWebchatPreviewEnabled());
        return jsonWriter.writeEndObject();
    }

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

                if ("siteName".equals(fieldName)) {
                    deserializedDirectLineSite.withSiteName(reader.getString());
                } else if ("isEnabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsEnabled(reader.getBoolean());
                } else if ("tenantId".equals(fieldName)) {
                    deserializedDirectLineSite.withTenantId(reader.getString());
                } else if ("siteId".equals(fieldName)) {
                    deserializedDirectLineSite.siteId = reader.getString();
                } else if ("key".equals(fieldName)) {
                    deserializedDirectLineSite.key = reader.getString();
                } else if ("key2".equals(fieldName)) {
                    deserializedDirectLineSite.key2 = reader.getString();
                } else if ("isTokenEnabled".equals(fieldName)) {
                    deserializedDirectLineSite.isTokenEnabled = reader.getNullable(JsonReader::getBoolean);
                } else if ("isEndpointParametersEnabled".equals(fieldName)) {
                    deserializedDirectLineSite
                        .withIsEndpointParametersEnabled(reader.getNullable(JsonReader::getBoolean));
                } else if ("isDetailedLoggingEnabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsDetailedLoggingEnabled(reader.getNullable(JsonReader::getBoolean));
                } else if ("isBlockUserUploadEnabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsBlockUserUploadEnabled(reader.getNullable(JsonReader::getBoolean));
                } else if ("isNoStorageEnabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsNoStorageEnabled(reader.getNullable(JsonReader::getBoolean));
                } else if ("eTag".equals(fieldName)) {
                    deserializedDirectLineSite.withEtag(reader.getString());
                } else if ("appId".equals(fieldName)) {
                    deserializedDirectLineSite.withAppId(reader.getString());
                } else if ("isV1Enabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsV1Enabled(reader.getNullable(JsonReader::getBoolean));
                } else if ("isV3Enabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsV3Enabled(reader.getNullable(JsonReader::getBoolean));
                } else if ("isSecureSiteEnabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsSecureSiteEnabled(reader.getNullable(JsonReader::getBoolean));
                } else if ("trustedOrigins".equals(fieldName)) {
                    List trustedOrigins = reader.readArray(reader1 -> reader1.getString());
                    deserializedDirectLineSite.withTrustedOrigins(trustedOrigins);
                } else if ("isWebChatSpeechEnabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsWebChatSpeechEnabled(reader.getNullable(JsonReader::getBoolean));
                } else if ("isWebchatPreviewEnabled".equals(fieldName)) {
                    deserializedDirectLineSite.withIsWebchatPreviewEnabled(reader.getNullable(JsonReader::getBoolean));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDirectLineSite;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy