com.azure.resourcemanager.security.models.UpdateSensitivitySettingsRequest 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.core.util.logging.ClientLogger;
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;
import java.util.Objects;
import java.util.UUID;
/**
* Request to update data sensitivity settings for sensitive data discovery.
*/
@Fluent
public final class UpdateSensitivitySettingsRequest implements JsonSerializable {
/*
* List of selected sensitive info types' IDs.
*/
private List sensitiveInfoTypesIds;
/*
* The order of the sensitivity threshold label. Any label at or above this order will be considered sensitive. If
* set to -1, sensitivity by labels is turned off
*/
private Float sensitivityThresholdLabelOrder;
/*
* The id of the sensitivity threshold label. Any label at or above this rank will be considered sensitive.
*/
private UUID sensitivityThresholdLabelId;
/**
* Creates an instance of UpdateSensitivitySettingsRequest class.
*/
public UpdateSensitivitySettingsRequest() {
}
/**
* Get the sensitiveInfoTypesIds property: List of selected sensitive info types' IDs.
*
* @return the sensitiveInfoTypesIds value.
*/
public List sensitiveInfoTypesIds() {
return this.sensitiveInfoTypesIds;
}
/**
* Set the sensitiveInfoTypesIds property: List of selected sensitive info types' IDs.
*
* @param sensitiveInfoTypesIds the sensitiveInfoTypesIds value to set.
* @return the UpdateSensitivitySettingsRequest object itself.
*/
public UpdateSensitivitySettingsRequest withSensitiveInfoTypesIds(List sensitiveInfoTypesIds) {
this.sensitiveInfoTypesIds = sensitiveInfoTypesIds;
return this;
}
/**
* Get the sensitivityThresholdLabelOrder property: The order of the sensitivity threshold label. Any label at or
* above this order will be considered sensitive. If set to -1, sensitivity by labels is turned off.
*
* @return the sensitivityThresholdLabelOrder value.
*/
public Float sensitivityThresholdLabelOrder() {
return this.sensitivityThresholdLabelOrder;
}
/**
* Set the sensitivityThresholdLabelOrder property: The order of the sensitivity threshold label. Any label at or
* above this order will be considered sensitive. If set to -1, sensitivity by labels is turned off.
*
* @param sensitivityThresholdLabelOrder the sensitivityThresholdLabelOrder value to set.
* @return the UpdateSensitivitySettingsRequest object itself.
*/
public UpdateSensitivitySettingsRequest withSensitivityThresholdLabelOrder(Float sensitivityThresholdLabelOrder) {
this.sensitivityThresholdLabelOrder = sensitivityThresholdLabelOrder;
return this;
}
/**
* Get the sensitivityThresholdLabelId property: The id of the sensitivity threshold label. Any label at or above
* this rank will be considered sensitive.
*
* @return the sensitivityThresholdLabelId value.
*/
public UUID sensitivityThresholdLabelId() {
return this.sensitivityThresholdLabelId;
}
/**
* Set the sensitivityThresholdLabelId property: The id of the sensitivity threshold label. Any label at or above
* this rank will be considered sensitive.
*
* @param sensitivityThresholdLabelId the sensitivityThresholdLabelId value to set.
* @return the UpdateSensitivitySettingsRequest object itself.
*/
public UpdateSensitivitySettingsRequest withSensitivityThresholdLabelId(UUID sensitivityThresholdLabelId) {
this.sensitivityThresholdLabelId = sensitivityThresholdLabelId;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (sensitiveInfoTypesIds() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property sensitiveInfoTypesIds in model UpdateSensitivitySettingsRequest"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(UpdateSensitivitySettingsRequest.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("sensitiveInfoTypesIds", this.sensitiveInfoTypesIds,
(writer, element) -> writer.writeString(Objects.toString(element, null)));
jsonWriter.writeNumberField("sensitivityThresholdLabelOrder", this.sensitivityThresholdLabelOrder);
jsonWriter.writeStringField("sensitivityThresholdLabelId",
Objects.toString(this.sensitivityThresholdLabelId, null));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of UpdateSensitivitySettingsRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of UpdateSensitivitySettingsRequest if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the UpdateSensitivitySettingsRequest.
*/
public static UpdateSensitivitySettingsRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
UpdateSensitivitySettingsRequest deserializedUpdateSensitivitySettingsRequest
= new UpdateSensitivitySettingsRequest();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("sensitiveInfoTypesIds".equals(fieldName)) {
List sensitiveInfoTypesIds = reader.readArray(
reader1 -> reader1.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())));
deserializedUpdateSensitivitySettingsRequest.sensitiveInfoTypesIds = sensitiveInfoTypesIds;
} else if ("sensitivityThresholdLabelOrder".equals(fieldName)) {
deserializedUpdateSensitivitySettingsRequest.sensitivityThresholdLabelOrder
= reader.getNullable(JsonReader::getFloat);
} else if ("sensitivityThresholdLabelId".equals(fieldName)) {
deserializedUpdateSensitivitySettingsRequest.sensitivityThresholdLabelId
= reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
} else {
reader.skipChildren();
}
}
return deserializedUpdateSensitivitySettingsRequest;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy