com.azure.resourcemanager.security.fluent.models.SecurityTaskInner Maven / Gradle / Ivy
// 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.management.ProxyResource;
import com.azure.json.JsonReader;
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;
/**
* Security task that we recommend to do in order to strengthen security.
*/
@Fluent
public final class SecurityTaskInner extends ProxyResource {
/*
* Describes properties of a task.
*/
private SecurityTaskProperties innerProperties;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of SecurityTaskInner class.
*/
public SecurityTaskInner() {
}
/**
* Get the innerProperties property: Describes properties of a task.
*
* @return the innerProperties value.
*/
private SecurityTaskProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the state property: State of the task (Active, Resolved etc.).
*
* @return the state value.
*/
public String state() {
return this.innerProperties() == null ? null : this.innerProperties().state();
}
/**
* Get the creationTimeUtc property: The time this task was discovered in UTC.
*
* @return the creationTimeUtc value.
*/
public OffsetDateTime creationTimeUtc() {
return this.innerProperties() == null ? null : this.innerProperties().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.innerProperties() == null ? null : this.innerProperties().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 SecurityTaskInner object itself.
*/
public SecurityTaskInner withSecurityTaskParameters(SecurityTaskParameters securityTaskParameters) {
if (this.innerProperties() == null) {
this.innerProperties = new SecurityTaskProperties();
}
this.innerProperties().withSecurityTaskParameters(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.innerProperties() == null ? null : this.innerProperties().lastStateChangeTimeUtc();
}
/**
* Get the subState property: Additional data on the state of the task.
*
* @return the subState value.
*/
public String subState() {
return this.innerProperties() == null ? null : this.innerProperties().subState();
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SecurityTaskInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SecurityTaskInner 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 SecurityTaskInner.
*/
public static SecurityTaskInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SecurityTaskInner deserializedSecurityTaskInner = new SecurityTaskInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedSecurityTaskInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedSecurityTaskInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedSecurityTaskInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedSecurityTaskInner.innerProperties = SecurityTaskProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedSecurityTaskInner;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy