com.azure.resourcemanager.resourcehealth.models.Link 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.resourcehealth.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;
/**
* Useful links for service health event.
*/
@Fluent
public final class Link implements JsonSerializable {
/*
* Type of link.
*/
private LinkTypeValues type;
/*
* Display text of link.
*/
private LinkDisplayText displayText;
/*
* It provides the name of portal extension to produce link for given service health event.
*/
private String extensionName;
/*
* It provides the name of portal extension blade to produce link for given service health event.
*/
private String bladeName;
/*
* It provides a map of parameter name and value for portal extension blade to produce lik for given service health
* event.
*/
private Object parameters;
/**
* Creates an instance of Link class.
*/
public Link() {
}
/**
* Get the type property: Type of link.
*
* @return the type value.
*/
public LinkTypeValues type() {
return this.type;
}
/**
* Set the type property: Type of link.
*
* @param type the type value to set.
* @return the Link object itself.
*/
public Link withType(LinkTypeValues type) {
this.type = type;
return this;
}
/**
* Get the displayText property: Display text of link.
*
* @return the displayText value.
*/
public LinkDisplayText displayText() {
return this.displayText;
}
/**
* Set the displayText property: Display text of link.
*
* @param displayText the displayText value to set.
* @return the Link object itself.
*/
public Link withDisplayText(LinkDisplayText displayText) {
this.displayText = displayText;
return this;
}
/**
* Get the extensionName property: It provides the name of portal extension to produce link for given service health
* event.
*
* @return the extensionName value.
*/
public String extensionName() {
return this.extensionName;
}
/**
* Set the extensionName property: It provides the name of portal extension to produce link for given service health
* event.
*
* @param extensionName the extensionName value to set.
* @return the Link object itself.
*/
public Link withExtensionName(String extensionName) {
this.extensionName = extensionName;
return this;
}
/**
* Get the bladeName property: It provides the name of portal extension blade to produce link for given service
* health event.
*
* @return the bladeName value.
*/
public String bladeName() {
return this.bladeName;
}
/**
* Set the bladeName property: It provides the name of portal extension blade to produce link for given service
* health event.
*
* @param bladeName the bladeName value to set.
* @return the Link object itself.
*/
public Link withBladeName(String bladeName) {
this.bladeName = bladeName;
return this;
}
/**
* Get the parameters property: It provides a map of parameter name and value for portal extension blade to produce
* lik for given service health event.
*
* @return the parameters value.
*/
public Object parameters() {
return this.parameters;
}
/**
* Set the parameters property: It provides a map of parameter name and value for portal extension blade to produce
* lik for given service health event.
*
* @param parameters the parameters value to set.
* @return the Link object itself.
*/
public Link withParameters(Object parameters) {
this.parameters = parameters;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (displayText() != null) {
displayText().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString());
jsonWriter.writeJsonField("displayText", this.displayText);
jsonWriter.writeStringField("extensionName", this.extensionName);
jsonWriter.writeStringField("bladeName", this.bladeName);
jsonWriter.writeUntypedField("parameters", this.parameters);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of Link from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of Link 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 Link.
*/
public static Link fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
Link deserializedLink = new Link();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("type".equals(fieldName)) {
deserializedLink.type = LinkTypeValues.fromString(reader.getString());
} else if ("displayText".equals(fieldName)) {
deserializedLink.displayText = LinkDisplayText.fromJson(reader);
} else if ("extensionName".equals(fieldName)) {
deserializedLink.extensionName = reader.getString();
} else if ("bladeName".equals(fieldName)) {
deserializedLink.bladeName = reader.getString();
} else if ("parameters".equals(fieldName)) {
deserializedLink.parameters = reader.readUntyped();
} else {
reader.skipChildren();
}
}
return deserializedLink;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy