com.azure.resourcemanager.security.fluent.models.SecurityTaskProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-security Show documentation
Show all versions of azure-resourcemanager-security Show documentation
This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.security.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.models.SecurityTaskParameters;
import java.io.IOException;
import java.time.OffsetDateTime;
/**
* Describes properties of a task.
*/
@Fluent
public final class SecurityTaskProperties implements JsonSerializable {
/*
* State of the task (Active, Resolved etc.)
*/
private String state;
/*
* The time this task was discovered in UTC
*/
private OffsetDateTime creationTimeUtc;
/*
* Changing set of properties, depending on the task type that is derived from the name field
*/
private SecurityTaskParameters securityTaskParameters;
/*
* The time this task's details were last changed in UTC
*/
private OffsetDateTime lastStateChangeTimeUtc;
/*
* Additional data on the state of the task
*/
private String subState;
/**
* Creates an instance of SecurityTaskProperties class.
*/
public SecurityTaskProperties() {
}
/**
* Get the state property: State of the task (Active, Resolved etc.).
*
* @return the state value.
*/
public String state() {
return this.state;
}
/**
* Get the creationTimeUtc property: The time this task was discovered in UTC.
*
* @return the creationTimeUtc value.
*/
public OffsetDateTime creationTimeUtc() {
return this.creationTimeUtc;
}
/**
* Get the securityTaskParameters property: Changing set of properties, depending on the task type that is derived
* from the name field.
*
* @return the securityTaskParameters value.
*/
public SecurityTaskParameters securityTaskParameters() {
return this.securityTaskParameters;
}
/**
* Set the securityTaskParameters property: Changing set of properties, depending on the task type that is derived
* from the name field.
*
* @param securityTaskParameters the securityTaskParameters value to set.
* @return the SecurityTaskProperties object itself.
*/
public SecurityTaskProperties withSecurityTaskParameters(SecurityTaskParameters securityTaskParameters) {
this.securityTaskParameters = securityTaskParameters;
return this;
}
/**
* Get the lastStateChangeTimeUtc property: The time this task's details were last changed in UTC.
*
* @return the lastStateChangeTimeUtc value.
*/
public OffsetDateTime lastStateChangeTimeUtc() {
return this.lastStateChangeTimeUtc;
}
/**
* Get the subState property: Additional data on the state of the task.
*
* @return the subState value.
*/
public String subState() {
return this.subState;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (securityTaskParameters() != null) {
securityTaskParameters().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("securityTaskParameters", this.securityTaskParameters);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SecurityTaskProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SecurityTaskProperties 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 SecurityTaskProperties.
*/
public static SecurityTaskProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SecurityTaskProperties deserializedSecurityTaskProperties = new SecurityTaskProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("state".equals(fieldName)) {
deserializedSecurityTaskProperties.state = reader.getString();
} else if ("creationTimeUtc".equals(fieldName)) {
deserializedSecurityTaskProperties.creationTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("securityTaskParameters".equals(fieldName)) {
deserializedSecurityTaskProperties.securityTaskParameters = SecurityTaskParameters.fromJson(reader);
} else if ("lastStateChangeTimeUtc".equals(fieldName)) {
deserializedSecurityTaskProperties.lastStateChangeTimeUtc = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("subState".equals(fieldName)) {
deserializedSecurityTaskProperties.subState = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedSecurityTaskProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy