com.azure.resourcemanager.security.models.StandardAssignmentPropertiesExemptionData 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;
/**
* Additional data about assignment that has Exempt effect.
*/
@Fluent
public final class StandardAssignmentPropertiesExemptionData
implements JsonSerializable {
/*
* Exemption category of this assignment
*/
private ExemptionCategory exemptionCategory;
/*
* Component item with key as applied to this standard assignment over the given scope
*/
private AssignedAssessmentItem assignedAssessment;
/**
* Creates an instance of StandardAssignmentPropertiesExemptionData class.
*/
public StandardAssignmentPropertiesExemptionData() {
}
/**
* Get the exemptionCategory property: Exemption category of this assignment.
*
* @return the exemptionCategory value.
*/
public ExemptionCategory exemptionCategory() {
return this.exemptionCategory;
}
/**
* Set the exemptionCategory property: Exemption category of this assignment.
*
* @param exemptionCategory the exemptionCategory value to set.
* @return the StandardAssignmentPropertiesExemptionData object itself.
*/
public StandardAssignmentPropertiesExemptionData withExemptionCategory(ExemptionCategory exemptionCategory) {
this.exemptionCategory = exemptionCategory;
return this;
}
/**
* Get the assignedAssessment property: Component item with key as applied to this standard assignment over the
* given scope.
*
* @return the assignedAssessment value.
*/
public AssignedAssessmentItem assignedAssessment() {
return this.assignedAssessment;
}
/**
* Set the assignedAssessment property: Component item with key as applied to this standard assignment over the
* given scope.
*
* @param assignedAssessment the assignedAssessment value to set.
* @return the StandardAssignmentPropertiesExemptionData object itself.
*/
public StandardAssignmentPropertiesExemptionData withAssignedAssessment(AssignedAssessmentItem assignedAssessment) {
this.assignedAssessment = assignedAssessment;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (assignedAssessment() != null) {
assignedAssessment().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("exemptionCategory",
this.exemptionCategory == null ? null : this.exemptionCategory.toString());
jsonWriter.writeJsonField("assignedAssessment", this.assignedAssessment);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of StandardAssignmentPropertiesExemptionData from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of StandardAssignmentPropertiesExemptionData 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 StandardAssignmentPropertiesExemptionData.
*/
public static StandardAssignmentPropertiesExemptionData fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
StandardAssignmentPropertiesExemptionData deserializedStandardAssignmentPropertiesExemptionData
= new StandardAssignmentPropertiesExemptionData();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("exemptionCategory".equals(fieldName)) {
deserializedStandardAssignmentPropertiesExemptionData.exemptionCategory
= ExemptionCategory.fromString(reader.getString());
} else if ("assignedAssessment".equals(fieldName)) {
deserializedStandardAssignmentPropertiesExemptionData.assignedAssessment
= AssignedAssessmentItem.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedStandardAssignmentPropertiesExemptionData;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy