
com.azure.resourcemanager.applicationinsights.models.WebTestGeolocation 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.applicationinsights.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;
/**
* Geo-physical location to run a WebTest from. You must specify one or more locations for the test to run from.
*/
@Fluent
public final class WebTestGeolocation implements JsonSerializable {
/*
* Location ID for the WebTest to run from.
*/
private String location;
/**
* Creates an instance of WebTestGeolocation class.
*/
public WebTestGeolocation() {
}
/**
* Get the location property: Location ID for the WebTest to run from.
*
* @return the location value.
*/
public String location() {
return this.location;
}
/**
* Set the location property: Location ID for the WebTest to run from.
*
* @param location the location value to set.
* @return the WebTestGeolocation object itself.
*/
public WebTestGeolocation 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("Id", this.location);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of WebTestGeolocation from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of WebTestGeolocation 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 WebTestGeolocation.
*/
public static WebTestGeolocation fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
WebTestGeolocation deserializedWebTestGeolocation = new WebTestGeolocation();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("Id".equals(fieldName)) {
deserializedWebTestGeolocation.location = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedWebTestGeolocation;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy