
com.azure.resourcemanager.policyinsights.models.CheckManagementGroupRestrictionsRequest 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.policyinsights.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;
import java.util.List;
/**
* The check policy restrictions parameters describing the resource that is being evaluated.
*/
@Fluent
public final class CheckManagementGroupRestrictionsRequest
implements JsonSerializable {
/*
* The information about the resource that will be evaluated.
*/
private CheckRestrictionsResourceDetails resourceDetails;
/*
* The list of fields and values that should be evaluated for potential restrictions.
*/
private List pendingFields;
/**
* Creates an instance of CheckManagementGroupRestrictionsRequest class.
*/
public CheckManagementGroupRestrictionsRequest() {
}
/**
* Get the resourceDetails property: The information about the resource that will be evaluated.
*
* @return the resourceDetails value.
*/
public CheckRestrictionsResourceDetails resourceDetails() {
return this.resourceDetails;
}
/**
* Set the resourceDetails property: The information about the resource that will be evaluated.
*
* @param resourceDetails the resourceDetails value to set.
* @return the CheckManagementGroupRestrictionsRequest object itself.
*/
public CheckManagementGroupRestrictionsRequest
withResourceDetails(CheckRestrictionsResourceDetails resourceDetails) {
this.resourceDetails = resourceDetails;
return this;
}
/**
* Get the pendingFields property: The list of fields and values that should be evaluated for potential
* restrictions.
*
* @return the pendingFields value.
*/
public List pendingFields() {
return this.pendingFields;
}
/**
* Set the pendingFields property: The list of fields and values that should be evaluated for potential
* restrictions.
*
* @param pendingFields the pendingFields value to set.
* @return the CheckManagementGroupRestrictionsRequest object itself.
*/
public CheckManagementGroupRestrictionsRequest withPendingFields(List pendingFields) {
this.pendingFields = pendingFields;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (resourceDetails() != null) {
resourceDetails().validate();
}
if (pendingFields() != null) {
pendingFields().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("resourceDetails", this.resourceDetails);
jsonWriter.writeArrayField("pendingFields", this.pendingFields, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of CheckManagementGroupRestrictionsRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CheckManagementGroupRestrictionsRequest 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 CheckManagementGroupRestrictionsRequest.
*/
public static CheckManagementGroupRestrictionsRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
CheckManagementGroupRestrictionsRequest deserializedCheckManagementGroupRestrictionsRequest
= new CheckManagementGroupRestrictionsRequest();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("resourceDetails".equals(fieldName)) {
deserializedCheckManagementGroupRestrictionsRequest.resourceDetails
= CheckRestrictionsResourceDetails.fromJson(reader);
} else if ("pendingFields".equals(fieldName)) {
List pendingFields = reader.readArray(reader1 -> PendingField.fromJson(reader1));
deserializedCheckManagementGroupRestrictionsRequest.pendingFields = pendingFields;
} else {
reader.skipChildren();
}
}
return deserializedCheckManagementGroupRestrictionsRequest;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy