
com.azure.resourcemanager.appcontainers.models.ScgRoute Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-appcontainers Show documentation
Show all versions of azure-resourcemanager-appcontainers Show documentation
This package contains Microsoft Azure SDK for ContainerAppsApi Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-03.
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.appcontainers.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;
/**
* Spring Cloud Gateway route definition.
*/
@Fluent
public final class ScgRoute implements JsonSerializable {
/*
* Id of the route
*/
private String id;
/*
* Uri of the route
*/
private String uri;
/*
* Predicates of the route
*/
private List predicates;
/*
* Filters of the route
*/
private List filters;
/*
* Order of the route
*/
private Long order;
/**
* Creates an instance of ScgRoute class.
*/
public ScgRoute() {
}
/**
* Get the id property: Id of the route.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Set the id property: Id of the route.
*
* @param id the id value to set.
* @return the ScgRoute object itself.
*/
public ScgRoute withId(String id) {
this.id = id;
return this;
}
/**
* Get the uri property: Uri of the route.
*
* @return the uri value.
*/
public String uri() {
return this.uri;
}
/**
* Set the uri property: Uri of the route.
*
* @param uri the uri value to set.
* @return the ScgRoute object itself.
*/
public ScgRoute withUri(String uri) {
this.uri = uri;
return this;
}
/**
* Get the predicates property: Predicates of the route.
*
* @return the predicates value.
*/
public List predicates() {
return this.predicates;
}
/**
* Set the predicates property: Predicates of the route.
*
* @param predicates the predicates value to set.
* @return the ScgRoute object itself.
*/
public ScgRoute withPredicates(List predicates) {
this.predicates = predicates;
return this;
}
/**
* Get the filters property: Filters of the route.
*
* @return the filters value.
*/
public List filters() {
return this.filters;
}
/**
* Set the filters property: Filters of the route.
*
* @param filters the filters value to set.
* @return the ScgRoute object itself.
*/
public ScgRoute withFilters(List filters) {
this.filters = filters;
return this;
}
/**
* Get the order property: Order of the route.
*
* @return the order value.
*/
public Long order() {
return this.order;
}
/**
* Set the order property: Order of the route.
*
* @param order the order value to set.
* @return the ScgRoute object itself.
*/
public ScgRoute withOrder(Long order) {
this.order = order;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (id() == null) {
throw LOGGER.atError().log(new IllegalArgumentException("Missing required property id in model ScgRoute"));
}
if (uri() == null) {
throw LOGGER.atError().log(new IllegalArgumentException("Missing required property uri in model ScgRoute"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(ScgRoute.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("id", this.id);
jsonWriter.writeStringField("uri", this.uri);
jsonWriter.writeArrayField("predicates", this.predicates, (writer, element) -> writer.writeString(element));
jsonWriter.writeArrayField("filters", this.filters, (writer, element) -> writer.writeString(element));
jsonWriter.writeNumberField("order", this.order);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ScgRoute from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ScgRoute 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 ScgRoute.
*/
public static ScgRoute fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ScgRoute deserializedScgRoute = new ScgRoute();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedScgRoute.id = reader.getString();
} else if ("uri".equals(fieldName)) {
deserializedScgRoute.uri = reader.getString();
} else if ("predicates".equals(fieldName)) {
List predicates = reader.readArray(reader1 -> reader1.getString());
deserializedScgRoute.predicates = predicates;
} else if ("filters".equals(fieldName)) {
List filters = reader.readArray(reader1 -> reader1.getString());
deserializedScgRoute.filters = filters;
} else if ("order".equals(fieldName)) {
deserializedScgRoute.order = reader.getNullable(JsonReader::getLong);
} else {
reader.skipChildren();
}
}
return deserializedScgRoute;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy