com.azure.resourcemanager.compute.models.SecurityPostureReferenceUpdate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.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;
/**
* Specifies the security posture to be used in the scale set. Minimum api-version: 2023-03-01.
*/
@Fluent
public final class SecurityPostureReferenceUpdate implements JsonSerializable {
/*
* The security posture reference id in the form of
* /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|
* latest
*/
private String id;
/*
* The list of virtual machine extension names to exclude when applying the security posture.
*/
private List excludeExtensions;
/*
* Whether the security posture can be overridden by the user.
*/
private Boolean isOverridable;
/**
* Creates an instance of SecurityPostureReferenceUpdate class.
*/
public SecurityPostureReferenceUpdate() {
}
/**
* Get the id property: The security posture reference id in the form of
* /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Set the id property: The security posture reference id in the form of
* /CommunityGalleries/{communityGalleryName}/securityPostures/{securityPostureName}/versions/{major.minor.patch}|latest.
*
* @param id the id value to set.
* @return the SecurityPostureReferenceUpdate object itself.
*/
public SecurityPostureReferenceUpdate withId(String id) {
this.id = id;
return this;
}
/**
* Get the excludeExtensions property: The list of virtual machine extension names to exclude when applying the
* security posture.
*
* @return the excludeExtensions value.
*/
public List excludeExtensions() {
return this.excludeExtensions;
}
/**
* Set the excludeExtensions property: The list of virtual machine extension names to exclude when applying the
* security posture.
*
* @param excludeExtensions the excludeExtensions value to set.
* @return the SecurityPostureReferenceUpdate object itself.
*/
public SecurityPostureReferenceUpdate withExcludeExtensions(List excludeExtensions) {
this.excludeExtensions = excludeExtensions;
return this;
}
/**
* Get the isOverridable property: Whether the security posture can be overridden by the user.
*
* @return the isOverridable value.
*/
public Boolean isOverridable() {
return this.isOverridable;
}
/**
* Set the isOverridable property: Whether the security posture can be overridden by the user.
*
* @param isOverridable the isOverridable value to set.
* @return the SecurityPostureReferenceUpdate object itself.
*/
public SecurityPostureReferenceUpdate withIsOverridable(Boolean isOverridable) {
this.isOverridable = isOverridable;
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("id", this.id);
jsonWriter.writeArrayField("excludeExtensions", this.excludeExtensions,
(writer, element) -> writer.writeString(element));
jsonWriter.writeBooleanField("isOverridable", this.isOverridable);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of SecurityPostureReferenceUpdate from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of SecurityPostureReferenceUpdate 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 SecurityPostureReferenceUpdate.
*/
public static SecurityPostureReferenceUpdate fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
SecurityPostureReferenceUpdate deserializedSecurityPostureReferenceUpdate
= new SecurityPostureReferenceUpdate();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedSecurityPostureReferenceUpdate.id = reader.getString();
} else if ("excludeExtensions".equals(fieldName)) {
List excludeExtensions = reader.readArray(reader1 -> reader1.getString());
deserializedSecurityPostureReferenceUpdate.excludeExtensions = excludeExtensions;
} else if ("isOverridable".equals(fieldName)) {
deserializedSecurityPostureReferenceUpdate.isOverridable
= reader.getNullable(JsonReader::getBoolean);
} else {
reader.skipChildren();
}
}
return deserializedSecurityPostureReferenceUpdate;
});
}
}