com.azure.resourcemanager.servicefabricmanagedclusters.models.ServiceEndpoint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-servicefabricmanagedclusters Show documentation
Show all versions of azure-resourcemanager-servicefabricmanagedclusters Show documentation
This package contains Microsoft Azure SDK for Service Fabric Managed Clusters Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Service Fabric Managed Clusters Management Client. Package tag package-2024-04.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.servicefabricmanagedclusters.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;
import java.util.List;
/**
* The service endpoint properties.
*/
@Fluent
public final class ServiceEndpoint implements JsonSerializable {
/*
* The type of the endpoint service.
*/
private String service;
/*
* A list of locations.
*/
private List locations;
/**
* Creates an instance of ServiceEndpoint class.
*/
public ServiceEndpoint() {
}
/**
* Get the service property: The type of the endpoint service.
*
* @return the service value.
*/
public String service() {
return this.service;
}
/**
* Set the service property: The type of the endpoint service.
*
* @param service the service value to set.
* @return the ServiceEndpoint object itself.
*/
public ServiceEndpoint withService(String service) {
this.service = service;
return this;
}
/**
* Get the locations property: A list of locations.
*
* @return the locations value.
*/
public List locations() {
return this.locations;
}
/**
* Set the locations property: A list of locations.
*
* @param locations the locations value to set.
* @return the ServiceEndpoint object itself.
*/
public ServiceEndpoint withLocations(List locations) {
this.locations = locations;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (service() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property service in model ServiceEndpoint"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(ServiceEndpoint.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("service", this.service);
jsonWriter.writeArrayField("locations", this.locations, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ServiceEndpoint from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ServiceEndpoint 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 ServiceEndpoint.
*/
public static ServiceEndpoint fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ServiceEndpoint deserializedServiceEndpoint = new ServiceEndpoint();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("service".equals(fieldName)) {
deserializedServiceEndpoint.service = reader.getString();
} else if ("locations".equals(fieldName)) {
List locations = reader.readArray(reader1 -> reader1.getString());
deserializedServiceEndpoint.locations = locations;
} else {
reader.skipChildren();
}
}
return deserializedServiceEndpoint;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy