![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.securityinsights.models.ActivityTimelineItem 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-2021-09.
// 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.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 java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* Represents Activity timeline item.
*/
@Fluent
public final class ActivityTimelineItem extends EntityTimelineItem {
/*
* The entity query kind type.
*/
private EntityTimelineKind kind = EntityTimelineKind.ACTIVITY;
/*
* The activity query id.
*/
private String queryId;
/*
* The grouping bucket start time.
*/
private OffsetDateTime bucketStartTimeUtc;
/*
* The grouping bucket end time.
*/
private OffsetDateTime bucketEndTimeUtc;
/*
* The time of the first activity in the grouping bucket.
*/
private OffsetDateTime firstActivityTimeUtc;
/*
* The time of the last activity in the grouping bucket.
*/
private OffsetDateTime lastActivityTimeUtc;
/*
* The activity timeline content.
*/
private String content;
/*
* The activity timeline title.
*/
private String title;
/**
* Creates an instance of ActivityTimelineItem class.
*/
public ActivityTimelineItem() {
}
/**
* Get the kind property: The entity query kind type.
*
* @return the kind value.
*/
@Override
public EntityTimelineKind kind() {
return this.kind;
}
/**
* Get the queryId property: The activity query id.
*
* @return the queryId value.
*/
public String queryId() {
return this.queryId;
}
/**
* Set the queryId property: The activity query id.
*
* @param queryId the queryId value to set.
* @return the ActivityTimelineItem object itself.
*/
public ActivityTimelineItem withQueryId(String queryId) {
this.queryId = queryId;
return this;
}
/**
* Get the bucketStartTimeUtc property: The grouping bucket start time.
*
* @return the bucketStartTimeUtc value.
*/
public OffsetDateTime bucketStartTimeUtc() {
return this.bucketStartTimeUtc;
}
/**
* Set the bucketStartTimeUtc property: The grouping bucket start time.
*
* @param bucketStartTimeUtc the bucketStartTimeUtc value to set.
* @return the ActivityTimelineItem object itself.
*/
public ActivityTimelineItem withBucketStartTimeUtc(OffsetDateTime bucketStartTimeUtc) {
this.bucketStartTimeUtc = bucketStartTimeUtc;
return this;
}
/**
* Get the bucketEndTimeUtc property: The grouping bucket end time.
*
* @return the bucketEndTimeUtc value.
*/
public OffsetDateTime bucketEndTimeUtc() {
return this.bucketEndTimeUtc;
}
/**
* Set the bucketEndTimeUtc property: The grouping bucket end time.
*
* @param bucketEndTimeUtc the bucketEndTimeUtc value to set.
* @return the ActivityTimelineItem object itself.
*/
public ActivityTimelineItem withBucketEndTimeUtc(OffsetDateTime bucketEndTimeUtc) {
this.bucketEndTimeUtc = bucketEndTimeUtc;
return this;
}
/**
* Get the firstActivityTimeUtc property: The time of the first activity in the grouping bucket.
*
* @return the firstActivityTimeUtc value.
*/
public OffsetDateTime firstActivityTimeUtc() {
return this.firstActivityTimeUtc;
}
/**
* Set the firstActivityTimeUtc property: The time of the first activity in the grouping bucket.
*
* @param firstActivityTimeUtc the firstActivityTimeUtc value to set.
* @return the ActivityTimelineItem object itself.
*/
public ActivityTimelineItem withFirstActivityTimeUtc(OffsetDateTime firstActivityTimeUtc) {
this.firstActivityTimeUtc = firstActivityTimeUtc;
return this;
}
/**
* Get the lastActivityTimeUtc property: The time of the last activity in the grouping bucket.
*
* @return the lastActivityTimeUtc value.
*/
public OffsetDateTime lastActivityTimeUtc() {
return this.lastActivityTimeUtc;
}
/**
* Set the lastActivityTimeUtc property: The time of the last activity in the grouping bucket.
*
* @param lastActivityTimeUtc the lastActivityTimeUtc value to set.
* @return the ActivityTimelineItem object itself.
*/
public ActivityTimelineItem withLastActivityTimeUtc(OffsetDateTime lastActivityTimeUtc) {
this.lastActivityTimeUtc = lastActivityTimeUtc;
return this;
}
/**
* Get the content property: The activity timeline content.
*
* @return the content value.
*/
public String content() {
return this.content;
}
/**
* Set the content property: The activity timeline content.
*
* @param content the content value to set.
* @return the ActivityTimelineItem object itself.
*/
public ActivityTimelineItem withContent(String content) {
this.content = content;
return this;
}
/**
* Get the title property: The activity timeline title.
*
* @return the title value.
*/
public String title() {
return this.title;
}
/**
* Set the title property: The activity timeline title.
*
* @param title the title value to set.
* @return the ActivityTimelineItem object itself.
*/
public ActivityTimelineItem withTitle(String title) {
this.title = title;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (queryId() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property queryId in model ActivityTimelineItem"));
}
if (bucketStartTimeUtc() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property bucketStartTimeUtc in model ActivityTimelineItem"));
}
if (bucketEndTimeUtc() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property bucketEndTimeUtc in model ActivityTimelineItem"));
}
if (firstActivityTimeUtc() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property firstActivityTimeUtc in model ActivityTimelineItem"));
}
if (lastActivityTimeUtc() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property lastActivityTimeUtc in model ActivityTimelineItem"));
}
if (content() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property content in model ActivityTimelineItem"));
}
if (title() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property title in model ActivityTimelineItem"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(ActivityTimelineItem.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("queryId", this.queryId);
jsonWriter.writeStringField("bucketStartTimeUTC",
this.bucketStartTimeUtc == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.bucketStartTimeUtc));
jsonWriter.writeStringField("bucketEndTimeUTC",
this.bucketEndTimeUtc == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.bucketEndTimeUtc));
jsonWriter.writeStringField("firstActivityTimeUTC",
this.firstActivityTimeUtc == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.firstActivityTimeUtc));
jsonWriter.writeStringField("lastActivityTimeUTC",
this.lastActivityTimeUtc == null
? null
: DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastActivityTimeUtc));
jsonWriter.writeStringField("content", this.content);
jsonWriter.writeStringField("title", this.title);
jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ActivityTimelineItem from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ActivityTimelineItem 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 ActivityTimelineItem.
*/
public static ActivityTimelineItem fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ActivityTimelineItem deserializedActivityTimelineItem = new ActivityTimelineItem();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("queryId".equals(fieldName)) {
deserializedActivityTimelineItem.queryId = reader.getString();
} else if ("bucketStartTimeUTC".equals(fieldName)) {
deserializedActivityTimelineItem.bucketStartTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("bucketEndTimeUTC".equals(fieldName)) {
deserializedActivityTimelineItem.bucketEndTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("firstActivityTimeUTC".equals(fieldName)) {
deserializedActivityTimelineItem.firstActivityTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("lastActivityTimeUTC".equals(fieldName)) {
deserializedActivityTimelineItem.lastActivityTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("content".equals(fieldName)) {
deserializedActivityTimelineItem.content = reader.getString();
} else if ("title".equals(fieldName)) {
deserializedActivityTimelineItem.title = reader.getString();
} else if ("kind".equals(fieldName)) {
deserializedActivityTimelineItem.kind = EntityTimelineKind.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedActivityTimelineItem;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy