com.azure.resourcemanager.botservice.models.Channel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-botservice Show documentation
Show all versions of azure-resourcemanager-botservice Show documentation
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;
/**
* Channel definition.
*/
@Fluent
public class Channel implements JsonSerializable {
/*
* The channel name
*/
private String channelName = "Channel";
/*
* Entity Tag of the resource
*/
private String etag;
/*
* Provisioning state of the resource
*/
private String provisioningState;
/*
* Specifies the location of the resource.
*/
private String location;
/**
* Creates an instance of Channel class.
*/
public Channel() {
}
/**
* Get the channelName property: The channel name.
*
* @return the channelName value.
*/
public String channelName() {
return this.channelName;
}
/**
* Get the etag property: Entity Tag of the resource.
*
* @return the etag value.
*/
public String etag() {
return this.etag;
}
/**
* Set the etag property: Entity Tag of the resource.
*
* @param etag the etag value to set.
* @return the Channel object itself.
*/
public Channel withEtag(String etag) {
this.etag = etag;
return this;
}
/**
* Get the provisioningState property: Provisioning state of the resource.
*
* @return the provisioningState value.
*/
public String provisioningState() {
return this.provisioningState;
}
/**
* Set the provisioningState property: Provisioning state of the resource.
*
* @param provisioningState the provisioningState value to set.
* @return the Channel object itself.
*/
Channel withProvisioningState(String provisioningState) {
this.provisioningState = provisioningState;
return this;
}
/**
* Get the location property: Specifies the location of the resource.
*
* @return the location value.
*/
public String location() {
return this.location;
}
/**
* Set the location property: Specifies the location of the resource.
*
* @param location the location value to set.
* @return the Channel object itself.
*/
public Channel withLocation(String location) {
this.location = location;
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.writeStringField("channelName", this.channelName);
jsonWriter.writeStringField("etag", this.etag);
jsonWriter.writeStringField("location", this.location);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Channel from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Channel 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 Channel.
*/
public static Channel fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String discriminatorValue = null;
try (JsonReader readerToUse = reader.bufferObject()) {
readerToUse.nextToken(); // Prepare for reading
while (readerToUse.nextToken() != JsonToken.END_OBJECT) {
String fieldName = readerToUse.getFieldName();
readerToUse.nextToken();
if ("channelName".equals(fieldName)) {
discriminatorValue = readerToUse.getString();
break;
} else {
readerToUse.skipChildren();
}
}
// Use the discriminator value to determine which subtype should be deserialized.
if ("AlexaChannel".equals(discriminatorValue)) {
return AlexaChannel.fromJson(readerToUse.reset());
} else if ("FacebookChannel".equals(discriminatorValue)) {
return FacebookChannel.fromJson(readerToUse.reset());
} else if ("EmailChannel".equals(discriminatorValue)) {
return EmailChannel.fromJson(readerToUse.reset());
} else if ("OutlookChannel".equals(discriminatorValue)) {
return OutlookChannel.fromJson(readerToUse.reset());
} else if ("MsTeamsChannel".equals(discriminatorValue)) {
return MsTeamsChannel.fromJson(readerToUse.reset());
} else if ("SkypeChannel".equals(discriminatorValue)) {
return SkypeChannel.fromJson(readerToUse.reset());
} else if ("KikChannel".equals(discriminatorValue)) {
return KikChannel.fromJson(readerToUse.reset());
} else if ("WebChatChannel".equals(discriminatorValue)) {
return WebChatChannel.fromJson(readerToUse.reset());
} else if ("DirectLineChannel".equals(discriminatorValue)) {
return DirectLineChannel.fromJson(readerToUse.reset());
} else if ("TelegramChannel".equals(discriminatorValue)) {
return TelegramChannel.fromJson(readerToUse.reset());
} else if ("SmsChannel".equals(discriminatorValue)) {
return SmsChannel.fromJson(readerToUse.reset());
} else if ("SlackChannel".equals(discriminatorValue)) {
return SlackChannel.fromJson(readerToUse.reset());
} else if ("LineChannel".equals(discriminatorValue)) {
return LineChannel.fromJson(readerToUse.reset());
} else if ("DirectLineSpeechChannel".equals(discriminatorValue)) {
return DirectLineSpeechChannel.fromJson(readerToUse.reset());
} else if ("Omnichannel".equals(discriminatorValue)) {
return Omnichannel.fromJson(readerToUse.reset());
} else if ("TelephonyChannel".equals(discriminatorValue)) {
return TelephonyChannel.fromJson(readerToUse.reset());
} else if ("AcsChatChannel".equals(discriminatorValue)) {
return AcsChatChannel.fromJson(readerToUse.reset());
} else if ("SearchAssistant".equals(discriminatorValue)) {
return SearchAssistant.fromJson(readerToUse.reset());
} else if ("M365Extensions".equals(discriminatorValue)) {
return M365Extensions.fromJson(readerToUse.reset());
} else {
return fromJsonKnownDiscriminator(readerToUse.reset());
}
}
});
}
static Channel fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Channel deserializedChannel = new Channel();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("channelName".equals(fieldName)) {
deserializedChannel.channelName = reader.getString();
} else if ("etag".equals(fieldName)) {
deserializedChannel.etag = reader.getString();
} else if ("provisioningState".equals(fieldName)) {
deserializedChannel.provisioningState = reader.getString();
} else if ("location".equals(fieldName)) {
deserializedChannel.location = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedChannel;
});
}
}