com.azure.resourcemanager.securityinsights.fluent.models.HuntingBookmarkProperties 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.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.securityinsights.models.EntityCommonProperties;
import com.azure.resourcemanager.securityinsights.models.IncidentInfo;
import com.azure.resourcemanager.securityinsights.models.UserInfo;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Map;
/**
* Describes bookmark properties.
*/
@Fluent
public final class HuntingBookmarkProperties extends EntityCommonProperties {
/*
* The time the bookmark was created
*/
private OffsetDateTime created;
/*
* Describes a user that created the bookmark
*/
private UserInfo createdBy;
/*
* The display name of the bookmark
*/
private String displayName;
/*
* The time of the event
*/
private OffsetDateTime eventTime;
/*
* List of labels relevant to this bookmark
*/
private List labels;
/*
* The notes of the bookmark
*/
private String notes;
/*
* The query of the bookmark.
*/
private String query;
/*
* The query result of the bookmark.
*/
private String queryResult;
/*
* The last time the bookmark was updated
*/
private OffsetDateTime updated;
/*
* Describes a user that updated the bookmark
*/
private UserInfo updatedBy;
/*
* Describes an incident that relates to bookmark
*/
private IncidentInfo incidentInfo;
/*
* The graph item display name which is a short humanly readable description of the graph item instance. This
* property is optional and might be system generated.
*/
private String friendlyName;
/*
* A bag of custom fields that should be part of the entity and will be presented to the user.
*/
private Map additionalData;
/**
* Creates an instance of HuntingBookmarkProperties class.
*/
public HuntingBookmarkProperties() {
}
/**
* Get the created property: The time the bookmark was created.
*
* @return the created value.
*/
public OffsetDateTime created() {
return this.created;
}
/**
* Set the created property: The time the bookmark was created.
*
* @param created the created value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withCreated(OffsetDateTime created) {
this.created = created;
return this;
}
/**
* Get the createdBy property: Describes a user that created the bookmark.
*
* @return the createdBy value.
*/
public UserInfo createdBy() {
return this.createdBy;
}
/**
* Set the createdBy property: Describes a user that created the bookmark.
*
* @param createdBy the createdBy value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withCreatedBy(UserInfo createdBy) {
this.createdBy = createdBy;
return this;
}
/**
* Get the displayName property: The display name of the bookmark.
*
* @return the displayName value.
*/
public String displayName() {
return this.displayName;
}
/**
* Set the displayName property: The display name of the bookmark.
*
* @param displayName the displayName value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withDisplayName(String displayName) {
this.displayName = displayName;
return this;
}
/**
* Get the eventTime property: The time of the event.
*
* @return the eventTime value.
*/
public OffsetDateTime eventTime() {
return this.eventTime;
}
/**
* Set the eventTime property: The time of the event.
*
* @param eventTime the eventTime value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withEventTime(OffsetDateTime eventTime) {
this.eventTime = eventTime;
return this;
}
/**
* Get the labels property: List of labels relevant to this bookmark.
*
* @return the labels value.
*/
public List labels() {
return this.labels;
}
/**
* Set the labels property: List of labels relevant to this bookmark.
*
* @param labels the labels value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withLabels(List labels) {
this.labels = labels;
return this;
}
/**
* Get the notes property: The notes of the bookmark.
*
* @return the notes value.
*/
public String notes() {
return this.notes;
}
/**
* Set the notes property: The notes of the bookmark.
*
* @param notes the notes value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withNotes(String notes) {
this.notes = notes;
return this;
}
/**
* Get the query property: The query of the bookmark.
*
* @return the query value.
*/
public String query() {
return this.query;
}
/**
* Set the query property: The query of the bookmark.
*
* @param query the query value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withQuery(String query) {
this.query = query;
return this;
}
/**
* Get the queryResult property: The query result of the bookmark.
*
* @return the queryResult value.
*/
public String queryResult() {
return this.queryResult;
}
/**
* Set the queryResult property: The query result of the bookmark.
*
* @param queryResult the queryResult value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withQueryResult(String queryResult) {
this.queryResult = queryResult;
return this;
}
/**
* Get the updated property: The last time the bookmark was updated.
*
* @return the updated value.
*/
public OffsetDateTime updated() {
return this.updated;
}
/**
* Set the updated property: The last time the bookmark was updated.
*
* @param updated the updated value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withUpdated(OffsetDateTime updated) {
this.updated = updated;
return this;
}
/**
* Get the updatedBy property: Describes a user that updated the bookmark.
*
* @return the updatedBy value.
*/
public UserInfo updatedBy() {
return this.updatedBy;
}
/**
* Set the updatedBy property: Describes a user that updated the bookmark.
*
* @param updatedBy the updatedBy value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withUpdatedBy(UserInfo updatedBy) {
this.updatedBy = updatedBy;
return this;
}
/**
* Get the incidentInfo property: Describes an incident that relates to bookmark.
*
* @return the incidentInfo value.
*/
public IncidentInfo incidentInfo() {
return this.incidentInfo;
}
/**
* Set the incidentInfo property: Describes an incident that relates to bookmark.
*
* @param incidentInfo the incidentInfo value to set.
* @return the HuntingBookmarkProperties object itself.
*/
public HuntingBookmarkProperties withIncidentInfo(IncidentInfo incidentInfo) {
this.incidentInfo = incidentInfo;
return this;
}
/**
* Get the friendlyName property: The graph item display name which is a short humanly readable description of the
* graph item instance. This property is optional and might be system generated.
*
* @return the friendlyName value.
*/
@Override
public String friendlyName() {
return this.friendlyName;
}
/**
* Get the additionalData property: A bag of custom fields that should be part of the entity and will be presented
* to the user.
*
* @return the additionalData value.
*/
@Override
public Map additionalData() {
return this.additionalData;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (createdBy() != null) {
createdBy().validate();
}
if (displayName() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property displayName in model HuntingBookmarkProperties"));
}
if (query() == null) {
throw LOGGER.atError()
.log(
new IllegalArgumentException("Missing required property query in model HuntingBookmarkProperties"));
}
if (updatedBy() != null) {
updatedBy().validate();
}
if (incidentInfo() != null) {
incidentInfo().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(HuntingBookmarkProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("displayName", this.displayName);
jsonWriter.writeStringField("query", this.query);
jsonWriter.writeStringField("created",
this.created == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.created));
jsonWriter.writeJsonField("createdBy", this.createdBy);
jsonWriter.writeStringField("eventTime",
this.eventTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.eventTime));
jsonWriter.writeArrayField("labels", this.labels, (writer, element) -> writer.writeString(element));
jsonWriter.writeStringField("notes", this.notes);
jsonWriter.writeStringField("queryResult", this.queryResult);
jsonWriter.writeStringField("updated",
this.updated == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.updated));
jsonWriter.writeJsonField("updatedBy", this.updatedBy);
jsonWriter.writeJsonField("incidentInfo", this.incidentInfo);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of HuntingBookmarkProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of HuntingBookmarkProperties 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 HuntingBookmarkProperties.
*/
public static HuntingBookmarkProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
HuntingBookmarkProperties deserializedHuntingBookmarkProperties = new HuntingBookmarkProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("additionalData".equals(fieldName)) {
Map additionalData = reader.readMap(reader1 -> reader1.readUntyped());
deserializedHuntingBookmarkProperties.additionalData = additionalData;
} else if ("friendlyName".equals(fieldName)) {
deserializedHuntingBookmarkProperties.friendlyName = reader.getString();
} else if ("displayName".equals(fieldName)) {
deserializedHuntingBookmarkProperties.displayName = reader.getString();
} else if ("query".equals(fieldName)) {
deserializedHuntingBookmarkProperties.query = reader.getString();
} else if ("created".equals(fieldName)) {
deserializedHuntingBookmarkProperties.created = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("createdBy".equals(fieldName)) {
deserializedHuntingBookmarkProperties.createdBy = UserInfo.fromJson(reader);
} else if ("eventTime".equals(fieldName)) {
deserializedHuntingBookmarkProperties.eventTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("labels".equals(fieldName)) {
List labels = reader.readArray(reader1 -> reader1.getString());
deserializedHuntingBookmarkProperties.labels = labels;
} else if ("notes".equals(fieldName)) {
deserializedHuntingBookmarkProperties.notes = reader.getString();
} else if ("queryResult".equals(fieldName)) {
deserializedHuntingBookmarkProperties.queryResult = reader.getString();
} else if ("updated".equals(fieldName)) {
deserializedHuntingBookmarkProperties.updated = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("updatedBy".equals(fieldName)) {
deserializedHuntingBookmarkProperties.updatedBy = UserInfo.fromJson(reader);
} else if ("incidentInfo".equals(fieldName)) {
deserializedHuntingBookmarkProperties.incidentInfo = IncidentInfo.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedHuntingBookmarkProperties;
});
}
}