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

com.azure.resourcemanager.botservice.models.ChannelSettings 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.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;

/**
 * Channel settings definition.
 */
@Fluent
public final class ChannelSettings implements JsonSerializable {
    /*
     * The extensionKey1
     */
    private String extensionKey1;

    /*
     * The extensionKey2
     */
    private String extensionKey2;

    /*
     * The list of sites
     */
    private List sites;

    /*
     * The channel id
     */
    private String channelId;

    /*
     * The channel display name
     */
    private String channelDisplayName;

    /*
     * The bot id
     */
    private String botId;

    /*
     * The bot icon url
     */
    private String botIconUrl;

    /*
     * Whether this channel is enabled for the bot
     */
    private Boolean isEnabled;

    /*
     * Opt-out of local authentication and ensure only MSI and AAD can be used exclusively for authentication.
     */
    private Boolean disableLocalAuth;

    /*
     * Whether customer needs to agree to new terms.
     */
    private Boolean requireTermsAgreement;

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

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

    /**
     * Set the extensionKey1 property: The extensionKey1.
     * 
     * @param extensionKey1 the extensionKey1 value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withExtensionKey1(String extensionKey1) {
        this.extensionKey1 = extensionKey1;
        return this;
    }

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

    /**
     * Set the extensionKey2 property: The extensionKey2.
     * 
     * @param extensionKey2 the extensionKey2 value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withExtensionKey2(String extensionKey2) {
        this.extensionKey2 = extensionKey2;
        return this;
    }

    /**
     * Get the sites property: The list of sites.
     * 
     * @return the sites value.
     */
    public List sites() {
        return this.sites;
    }

    /**
     * Set the sites property: The list of sites.
     * 
     * @param sites the sites value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withSites(List sites) {
        this.sites = sites;
        return this;
    }

    /**
     * Get the channelId property: The channel id.
     * 
     * @return the channelId value.
     */
    public String channelId() {
        return this.channelId;
    }

    /**
     * Set the channelId property: The channel id.
     * 
     * @param channelId the channelId value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withChannelId(String channelId) {
        this.channelId = channelId;
        return this;
    }

    /**
     * Get the channelDisplayName property: The channel display name.
     * 
     * @return the channelDisplayName value.
     */
    public String channelDisplayName() {
        return this.channelDisplayName;
    }

    /**
     * Set the channelDisplayName property: The channel display name.
     * 
     * @param channelDisplayName the channelDisplayName value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withChannelDisplayName(String channelDisplayName) {
        this.channelDisplayName = channelDisplayName;
        return this;
    }

    /**
     * Get the botId property: The bot id.
     * 
     * @return the botId value.
     */
    public String botId() {
        return this.botId;
    }

    /**
     * Set the botId property: The bot id.
     * 
     * @param botId the botId value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withBotId(String botId) {
        this.botId = botId;
        return this;
    }

    /**
     * Get the botIconUrl property: The bot icon url.
     * 
     * @return the botIconUrl value.
     */
    public String botIconUrl() {
        return this.botIconUrl;
    }

    /**
     * Set the botIconUrl property: The bot icon url.
     * 
     * @param botIconUrl the botIconUrl value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withBotIconUrl(String botIconUrl) {
        this.botIconUrl = botIconUrl;
        return this;
    }

    /**
     * Get the isEnabled property: Whether this channel is enabled for the bot.
     * 
     * @return the isEnabled value.
     */
    public Boolean isEnabled() {
        return this.isEnabled;
    }

    /**
     * Set the isEnabled property: Whether this channel is enabled for the bot.
     * 
     * @param isEnabled the isEnabled value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withIsEnabled(Boolean isEnabled) {
        this.isEnabled = isEnabled;
        return this;
    }

    /**
     * Get the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used
     * exclusively for authentication.
     * 
     * @return the disableLocalAuth value.
     */
    public Boolean disableLocalAuth() {
        return this.disableLocalAuth;
    }

    /**
     * Set the disableLocalAuth property: Opt-out of local authentication and ensure only MSI and AAD can be used
     * exclusively for authentication.
     * 
     * @param disableLocalAuth the disableLocalAuth value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withDisableLocalAuth(Boolean disableLocalAuth) {
        this.disableLocalAuth = disableLocalAuth;
        return this;
    }

    /**
     * Get the requireTermsAgreement property: Whether customer needs to agree to new terms.
     * 
     * @return the requireTermsAgreement value.
     */
    public Boolean requireTermsAgreement() {
        return this.requireTermsAgreement;
    }

    /**
     * Set the requireTermsAgreement property: Whether customer needs to agree to new terms.
     * 
     * @param requireTermsAgreement the requireTermsAgreement value to set.
     * @return the ChannelSettings object itself.
     */
    public ChannelSettings withRequireTermsAgreement(Boolean requireTermsAgreement) {
        this.requireTermsAgreement = requireTermsAgreement;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("extensionKey1", this.extensionKey1);
        jsonWriter.writeStringField("extensionKey2", this.extensionKey2);
        jsonWriter.writeArrayField("sites", this.sites, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("channelId", this.channelId);
        jsonWriter.writeStringField("channelDisplayName", this.channelDisplayName);
        jsonWriter.writeStringField("botId", this.botId);
        jsonWriter.writeStringField("botIconUrl", this.botIconUrl);
        jsonWriter.writeBooleanField("isEnabled", this.isEnabled);
        jsonWriter.writeBooleanField("disableLocalAuth", this.disableLocalAuth);
        jsonWriter.writeBooleanField("requireTermsAgreement", this.requireTermsAgreement);
        return jsonWriter.writeEndObject();
    }

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

                if ("extensionKey1".equals(fieldName)) {
                    deserializedChannelSettings.extensionKey1 = reader.getString();
                } else if ("extensionKey2".equals(fieldName)) {
                    deserializedChannelSettings.extensionKey2 = reader.getString();
                } else if ("sites".equals(fieldName)) {
                    List sites = reader.readArray(reader1 -> Site.fromJson(reader1));
                    deserializedChannelSettings.sites = sites;
                } else if ("channelId".equals(fieldName)) {
                    deserializedChannelSettings.channelId = reader.getString();
                } else if ("channelDisplayName".equals(fieldName)) {
                    deserializedChannelSettings.channelDisplayName = reader.getString();
                } else if ("botId".equals(fieldName)) {
                    deserializedChannelSettings.botId = reader.getString();
                } else if ("botIconUrl".equals(fieldName)) {
                    deserializedChannelSettings.botIconUrl = reader.getString();
                } else if ("isEnabled".equals(fieldName)) {
                    deserializedChannelSettings.isEnabled = reader.getNullable(JsonReader::getBoolean);
                } else if ("disableLocalAuth".equals(fieldName)) {
                    deserializedChannelSettings.disableLocalAuth = reader.getNullable(JsonReader::getBoolean);
                } else if ("requireTermsAgreement".equals(fieldName)) {
                    deserializedChannelSettings.requireTermsAgreement = reader.getNullable(JsonReader::getBoolean);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedChannelSettings;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy