com.azure.resourcemanager.securityinsights.models.ThreatIntelligenceExternalReference 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.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;
import java.util.Map;
/**
* Describes external reference.
*/
@Fluent
public final class ThreatIntelligenceExternalReference
implements JsonSerializable {
/*
* External reference description
*/
private String description;
/*
* External reference ID
*/
private String externalId;
/*
* External reference source name
*/
private String sourceName;
/*
* External reference URL
*/
private String url;
/*
* External reference hashes
*/
private Map hashes;
/**
* Creates an instance of ThreatIntelligenceExternalReference class.
*/
public ThreatIntelligenceExternalReference() {
}
/**
* Get the description property: External reference description.
*
* @return the description value.
*/
public String description() {
return this.description;
}
/**
* Set the description property: External reference description.
*
* @param description the description value to set.
* @return the ThreatIntelligenceExternalReference object itself.
*/
public ThreatIntelligenceExternalReference withDescription(String description) {
this.description = description;
return this;
}
/**
* Get the externalId property: External reference ID.
*
* @return the externalId value.
*/
public String externalId() {
return this.externalId;
}
/**
* Set the externalId property: External reference ID.
*
* @param externalId the externalId value to set.
* @return the ThreatIntelligenceExternalReference object itself.
*/
public ThreatIntelligenceExternalReference withExternalId(String externalId) {
this.externalId = externalId;
return this;
}
/**
* Get the sourceName property: External reference source name.
*
* @return the sourceName value.
*/
public String sourceName() {
return this.sourceName;
}
/**
* Set the sourceName property: External reference source name.
*
* @param sourceName the sourceName value to set.
* @return the ThreatIntelligenceExternalReference object itself.
*/
public ThreatIntelligenceExternalReference withSourceName(String sourceName) {
this.sourceName = sourceName;
return this;
}
/**
* Get the url property: External reference URL.
*
* @return the url value.
*/
public String url() {
return this.url;
}
/**
* Set the url property: External reference URL.
*
* @param url the url value to set.
* @return the ThreatIntelligenceExternalReference object itself.
*/
public ThreatIntelligenceExternalReference withUrl(String url) {
this.url = url;
return this;
}
/**
* Get the hashes property: External reference hashes.
*
* @return the hashes value.
*/
public Map hashes() {
return this.hashes;
}
/**
* Set the hashes property: External reference hashes.
*
* @param hashes the hashes value to set.
* @return the ThreatIntelligenceExternalReference object itself.
*/
public ThreatIntelligenceExternalReference withHashes(Map hashes) {
this.hashes = hashes;
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("description", this.description);
jsonWriter.writeStringField("externalId", this.externalId);
jsonWriter.writeStringField("sourceName", this.sourceName);
jsonWriter.writeStringField("url", this.url);
jsonWriter.writeMapField("hashes", this.hashes, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ThreatIntelligenceExternalReference from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ThreatIntelligenceExternalReference 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 ThreatIntelligenceExternalReference.
*/
public static ThreatIntelligenceExternalReference fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ThreatIntelligenceExternalReference deserializedThreatIntelligenceExternalReference
= new ThreatIntelligenceExternalReference();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("description".equals(fieldName)) {
deserializedThreatIntelligenceExternalReference.description = reader.getString();
} else if ("externalId".equals(fieldName)) {
deserializedThreatIntelligenceExternalReference.externalId = reader.getString();
} else if ("sourceName".equals(fieldName)) {
deserializedThreatIntelligenceExternalReference.sourceName = reader.getString();
} else if ("url".equals(fieldName)) {
deserializedThreatIntelligenceExternalReference.url = reader.getString();
} else if ("hashes".equals(fieldName)) {
Map hashes = reader.readMap(reader1 -> reader1.getString());
deserializedThreatIntelligenceExternalReference.hashes = hashes;
} else {
reader.skipChildren();
}
}
return deserializedThreatIntelligenceExternalReference;
});
}
}