com.azure.resourcemanager.security.fluent.models.ComplianceProperties 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.Immutable;
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.ComplianceSegment;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;
/**
* The Compliance score (percentage) of a Subscription is a sum of all Resources' Compliances under the given
* Subscription. A Resource Compliance is defined as the compliant ('healthy') Policy Definitions out of all Policy
* Definitions applicable to a given resource.
*/
@Immutable
public final class ComplianceProperties implements JsonSerializable {
/*
* The timestamp when the Compliance calculation was conducted.
*/
private OffsetDateTime assessmentTimestampUtcDate;
/*
* The resource count of the given subscription for which the Compliance calculation was conducted (needed for
* Management Group Compliance calculation).
*/
private Integer resourceCount;
/*
* An array of segment, which is the actually the compliance assessment.
*/
private List assessmentResult;
/**
* Creates an instance of ComplianceProperties class.
*/
public ComplianceProperties() {
}
/**
* Get the assessmentTimestampUtcDate property: The timestamp when the Compliance calculation was conducted.
*
* @return the assessmentTimestampUtcDate value.
*/
public OffsetDateTime assessmentTimestampUtcDate() {
return this.assessmentTimestampUtcDate;
}
/**
* Get the resourceCount property: The resource count of the given subscription for which the Compliance calculation
* was conducted (needed for Management Group Compliance calculation).
*
* @return the resourceCount value.
*/
public Integer resourceCount() {
return this.resourceCount;
}
/**
* Get the assessmentResult property: An array of segment, which is the actually the compliance assessment.
*
* @return the assessmentResult value.
*/
public List assessmentResult() {
return this.assessmentResult;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (assessmentResult() != null) {
assessmentResult().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ComplianceProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ComplianceProperties 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 ComplianceProperties.
*/
public static ComplianceProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ComplianceProperties deserializedComplianceProperties = new ComplianceProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("assessmentTimestampUtcDate".equals(fieldName)) {
deserializedComplianceProperties.assessmentTimestampUtcDate = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("resourceCount".equals(fieldName)) {
deserializedComplianceProperties.resourceCount = reader.getNullable(JsonReader::getInt);
} else if ("assessmentResult".equals(fieldName)) {
List assessmentResult
= reader.readArray(reader1 -> ComplianceSegment.fromJson(reader1));
deserializedComplianceProperties.assessmentResult = assessmentResult;
} else {
reader.skipChildren();
}
}
return deserializedComplianceProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy