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

com.azure.resourcemanager.security.models.AssignedAssessmentItem 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.models;

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

/**
 * Describe the properties of a security assessment object reference (by key).
 */
@Fluent
public final class AssignedAssessmentItem implements JsonSerializable {
    /*
     * Unique key to a security assessment object
     */
    private String assessmentKey;

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

    /**
     * Get the assessmentKey property: Unique key to a security assessment object.
     * 
     * @return the assessmentKey value.
     */
    public String assessmentKey() {
        return this.assessmentKey;
    }

    /**
     * Set the assessmentKey property: Unique key to a security assessment object.
     * 
     * @param assessmentKey the assessmentKey value to set.
     * @return the AssignedAssessmentItem object itself.
     */
    public AssignedAssessmentItem withAssessmentKey(String assessmentKey) {
        this.assessmentKey = assessmentKey;
        return this;
    }

    /**
     * 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();
        jsonWriter.writeStringField("assessmentKey", this.assessmentKey);
        return jsonWriter.writeEndObject();
    }

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

                if ("assessmentKey".equals(fieldName)) {
                    deserializedAssignedAssessmentItem.assessmentKey = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAssignedAssessmentItem;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy