com.azure.resourcemanager.securityinsights.models.GeoLocation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-securityinsights Show documentation
Show all versions of azure-resourcemanager-securityinsights Show documentation
This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2022-09.
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.securityinsights.models;
import com.azure.core.annotation.Immutable;
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 geo-location context attached to the ip entity.
*/
@Immutable
public final class GeoLocation implements JsonSerializable {
/*
* Autonomous System Number
*/
private Integer asn;
/*
* City name
*/
private String city;
/*
* The country code according to ISO 3166 format
*/
private String countryCode;
/*
* Country name according to ISO 3166 Alpha 2: the lowercase of the English Short Name
*/
private String countryName;
/*
* The longitude of the identified location, expressed as a floating point number with range of -180 to 180, with
* positive numbers representing East and negative numbers representing West. Latitude and longitude are derived
* from the city or postal code.
*/
private Double latitude;
/*
* The latitude of the identified location, expressed as a floating point number with range of - 90 to 90, with
* positive numbers representing North and negative numbers representing South. Latitude and longitude are derived
* from the city or postal code.
*/
private Double longitude;
/*
* State name
*/
private String state;
/**
* Creates an instance of GeoLocation class.
*/
public GeoLocation() {
}
/**
* Get the asn property: Autonomous System Number.
*
* @return the asn value.
*/
public Integer asn() {
return this.asn;
}
/**
* Get the city property: City name.
*
* @return the city value.
*/
public String city() {
return this.city;
}
/**
* Get the countryCode property: The country code according to ISO 3166 format.
*
* @return the countryCode value.
*/
public String countryCode() {
return this.countryCode;
}
/**
* Get the countryName property: Country name according to ISO 3166 Alpha 2: the lowercase of the English Short
* Name.
*
* @return the countryName value.
*/
public String countryName() {
return this.countryName;
}
/**
* Get the latitude property: The longitude of the identified location, expressed as a floating point number with
* range of -180 to 180, with positive numbers representing East and negative numbers representing West. Latitude
* and longitude are derived from the city or postal code.
*
* @return the latitude value.
*/
public Double latitude() {
return this.latitude;
}
/**
* Get the longitude property: The latitude of the identified location, expressed as a floating point number with
* range of - 90 to 90, with positive numbers representing North and negative numbers representing South. Latitude
* and longitude are derived from the city or postal code.
*
* @return the longitude value.
*/
public Double longitude() {
return this.longitude;
}
/**
* Get the state property: State name.
*
* @return the state value.
*/
public String state() {
return this.state;
}
/**
* 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();
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of GeoLocation from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of GeoLocation 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 GeoLocation.
*/
public static GeoLocation fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
GeoLocation deserializedGeoLocation = new GeoLocation();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("asn".equals(fieldName)) {
deserializedGeoLocation.asn = reader.getNullable(JsonReader::getInt);
} else if ("city".equals(fieldName)) {
deserializedGeoLocation.city = reader.getString();
} else if ("countryCode".equals(fieldName)) {
deserializedGeoLocation.countryCode = reader.getString();
} else if ("countryName".equals(fieldName)) {
deserializedGeoLocation.countryName = reader.getString();
} else if ("latitude".equals(fieldName)) {
deserializedGeoLocation.latitude = reader.getNullable(JsonReader::getDouble);
} else if ("longitude".equals(fieldName)) {
deserializedGeoLocation.longitude = reader.getNullable(JsonReader::getDouble);
} else if ("state".equals(fieldName)) {
deserializedGeoLocation.state = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedGeoLocation;
});
}
}