com.azure.resourcemanager.securityinsights.models.MetadataDependencies Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-securityinsights Show documentation
Show all versions of azure-resourcemanager-securityinsights Show documentation
This package contains Microsoft Azure SDK for SecurityInsights Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.SecurityInsights (Azure Security Insights) resource provider. Package tag package-preview-2022-09.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.securityinsights.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;
/**
* Dependencies for the content item, what other content items it requires to work. Can describe more complex
* dependencies using a recursive/nested structure. For a single dependency an id/kind/version can be supplied or
* operator/criteria for complex dependencies.
*/
@Fluent
public final class MetadataDependencies implements JsonSerializable {
/*
* Id of the content item we depend on
*/
private String contentId;
/*
* Type of the content item we depend on
*/
private Kind kind;
/*
* Version of the the content item we depend on. Can be blank, * or missing to indicate any version fulfills the
* dependency. If version does not match our defined numeric format then an exact match is required.
*/
private String version;
/*
* Name of the content item
*/
private String name;
/*
* Operator used for list of dependencies in criteria array.
*/
private Operator operator;
/*
* This is the list of dependencies we must fulfill, according to the AND/OR operator
*/
private List criteria;
/**
* Creates an instance of MetadataDependencies class.
*/
public MetadataDependencies() {
}
/**
* Get the contentId property: Id of the content item we depend on.
*
* @return the contentId value.
*/
public String contentId() {
return this.contentId;
}
/**
* Set the contentId property: Id of the content item we depend on.
*
* @param contentId the contentId value to set.
* @return the MetadataDependencies object itself.
*/
public MetadataDependencies withContentId(String contentId) {
this.contentId = contentId;
return this;
}
/**
* Get the kind property: Type of the content item we depend on.
*
* @return the kind value.
*/
public Kind kind() {
return this.kind;
}
/**
* Set the kind property: Type of the content item we depend on.
*
* @param kind the kind value to set.
* @return the MetadataDependencies object itself.
*/
public MetadataDependencies withKind(Kind kind) {
this.kind = kind;
return this;
}
/**
* Get the version property: Version of the the content item we depend on. Can be blank, * or missing to indicate
* any version fulfills the dependency. If version does not match our defined numeric format then an exact match is
* required.
*
* @return the version value.
*/
public String version() {
return this.version;
}
/**
* Set the version property: Version of the the content item we depend on. Can be blank, * or missing to indicate
* any version fulfills the dependency. If version does not match our defined numeric format then an exact match is
* required.
*
* @param version the version value to set.
* @return the MetadataDependencies object itself.
*/
public MetadataDependencies withVersion(String version) {
this.version = version;
return this;
}
/**
* Get the name property: Name of the content item.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: Name of the content item.
*
* @param name the name value to set.
* @return the MetadataDependencies object itself.
*/
public MetadataDependencies withName(String name) {
this.name = name;
return this;
}
/**
* Get the operator property: Operator used for list of dependencies in criteria array.
*
* @return the operator value.
*/
public Operator operator() {
return this.operator;
}
/**
* Set the operator property: Operator used for list of dependencies in criteria array.
*
* @param operator the operator value to set.
* @return the MetadataDependencies object itself.
*/
public MetadataDependencies withOperator(Operator operator) {
this.operator = operator;
return this;
}
/**
* Get the criteria property: This is the list of dependencies we must fulfill, according to the AND/OR operator.
*
* @return the criteria value.
*/
public List criteria() {
return this.criteria;
}
/**
* Set the criteria property: This is the list of dependencies we must fulfill, according to the AND/OR operator.
*
* @param criteria the criteria value to set.
* @return the MetadataDependencies object itself.
*/
public MetadataDependencies withCriteria(List criteria) {
this.criteria = criteria;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (criteria() != null) {
criteria().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("contentId", this.contentId);
jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString());
jsonWriter.writeStringField("version", this.version);
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeStringField("operator", this.operator == null ? null : this.operator.toString());
jsonWriter.writeArrayField("criteria", this.criteria, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MetadataDependencies from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MetadataDependencies 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 MetadataDependencies.
*/
public static MetadataDependencies fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MetadataDependencies deserializedMetadataDependencies = new MetadataDependencies();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("contentId".equals(fieldName)) {
deserializedMetadataDependencies.contentId = reader.getString();
} else if ("kind".equals(fieldName)) {
deserializedMetadataDependencies.kind = Kind.fromString(reader.getString());
} else if ("version".equals(fieldName)) {
deserializedMetadataDependencies.version = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedMetadataDependencies.name = reader.getString();
} else if ("operator".equals(fieldName)) {
deserializedMetadataDependencies.operator = Operator.fromString(reader.getString());
} else if ("criteria".equals(fieldName)) {
List criteria
= reader.readArray(reader1 -> MetadataDependencies.fromJson(reader1));
deserializedMetadataDependencies.criteria = criteria;
} else {
reader.skipChildren();
}
}
return deserializedMetadataDependencies;
});
}
}