All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.security.models.ComplianceSegment Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.0.0
Show 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.security.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * A segment of a compliance assessment.
 */
@Immutable
public final class ComplianceSegment implements JsonSerializable {
    /*
     * The segment type, e.g. compliant, non-compliance, insufficient coverage, N/A, etc.
     */
    private String segmentType;

    /*
     * The size (%) of the segment.
     */
    private Double percentage;

    /**
     * Creates an instance of ComplianceSegment class.
     */
    public ComplianceSegment() {
    }

    /**
     * Get the segmentType property: The segment type, e.g. compliant, non-compliance, insufficient coverage, N/A, etc.
     * 
     * @return the segmentType value.
     */
    public String segmentType() {
        return this.segmentType;
    }

    /**
     * Get the percentage property: The size (%) of the segment.
     * 
     * @return the percentage value.
     */
    public Double percentage() {
        return this.percentage;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of ComplianceSegment from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of ComplianceSegment 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 ComplianceSegment.
     */
    public static ComplianceSegment fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            ComplianceSegment deserializedComplianceSegment = new ComplianceSegment();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("segmentType".equals(fieldName)) {
                    deserializedComplianceSegment.segmentType = reader.getString();
                } else if ("percentage".equals(fieldName)) {
                    deserializedComplianceSegment.percentage = reader.getNullable(JsonReader::getDouble);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedComplianceSegment;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy