com.azure.resourcemanager.botservice.models.SmsChannelProperties 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.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* The parameters to provide for the Sms channel.
*/
@Fluent
public final class SmsChannelProperties implements JsonSerializable {
/*
* The Sms phone
*/
private String phone;
/*
* The Sms account SID. Value only returned through POST to the action Channel List API, otherwise empty.
*/
private String accountSid;
/*
* The Sms auth token. Value only returned through POST to the action Channel List API, otherwise empty.
*/
private String authToken;
/*
* Whether this channel is validated for the bot
*/
private Boolean isValidated;
/*
* Whether this channel is enabled for the bot
*/
private boolean isEnabled;
/**
* Creates an instance of SmsChannelProperties class.
*/
public SmsChannelProperties() {
}
/**
* Get the phone property: The Sms phone.
*
* @return the phone value.
*/
public String phone() {
return this.phone;
}
/**
* Set the phone property: The Sms phone.
*
* @param phone the phone value to set.
* @return the SmsChannelProperties object itself.
*/
public SmsChannelProperties withPhone(String phone) {
this.phone = phone;
return this;
}
/**
* Get the accountSid property: The Sms account SID. Value only returned through POST to the action Channel List
* API, otherwise empty.
*
* @return the accountSid value.
*/
public String accountSid() {
return this.accountSid;
}
/**
* Set the accountSid property: The Sms account SID. Value only returned through POST to the action Channel List
* API, otherwise empty.
*
* @param accountSid the accountSid value to set.
* @return the SmsChannelProperties object itself.
*/
public SmsChannelProperties withAccountSid(String accountSid) {
this.accountSid = accountSid;
return this;
}
/**
* Get the authToken property: The Sms auth token. Value only returned through POST to the action Channel List API,
* otherwise empty.
*
* @return the authToken value.
*/
public String authToken() {
return this.authToken;
}
/**
* Set the authToken property: The Sms auth token. Value only returned through POST to the action Channel List API,
* otherwise empty.
*
* @param authToken the authToken value to set.
* @return the SmsChannelProperties object itself.
*/
public SmsChannelProperties withAuthToken(String authToken) {
this.authToken = authToken;
return this;
}
/**
* Get the isValidated property: Whether this channel is validated for the bot.
*
* @return the isValidated value.
*/
public Boolean isValidated() {
return this.isValidated;
}
/**
* Set the isValidated property: Whether this channel is validated for the bot.
*
* @param isValidated the isValidated value to set.
* @return the SmsChannelProperties object itself.
*/
public SmsChannelProperties withIsValidated(Boolean isValidated) {
this.isValidated = isValidated;
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 SmsChannelProperties object itself.
*/
public SmsChannelProperties withIsEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (phone() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property phone in model SmsChannelProperties"));
}
if (accountSid() == null) {
throw LOGGER.atError()
.log(
new IllegalArgumentException("Missing required property accountSid in model SmsChannelProperties"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(SmsChannelProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("phone", this.phone);
jsonWriter.writeStringField("accountSID", this.accountSid);
jsonWriter.writeBooleanField("isEnabled", this.isEnabled);
jsonWriter.writeStringField("authToken", this.authToken);
jsonWriter.writeBooleanField("isValidated", this.isValidated);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SmsChannelProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SmsChannelProperties 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 SmsChannelProperties.
*/
public static SmsChannelProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SmsChannelProperties deserializedSmsChannelProperties = new SmsChannelProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("phone".equals(fieldName)) {
deserializedSmsChannelProperties.phone = reader.getString();
} else if ("accountSID".equals(fieldName)) {
deserializedSmsChannelProperties.accountSid = reader.getString();
} else if ("isEnabled".equals(fieldName)) {
deserializedSmsChannelProperties.isEnabled = reader.getBoolean();
} else if ("authToken".equals(fieldName)) {
deserializedSmsChannelProperties.authToken = reader.getString();
} else if ("isValidated".equals(fieldName)) {
deserializedSmsChannelProperties.isValidated = reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedSmsChannelProperties;
});
}
}